@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 UIBit Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Carousel
|
|
2
|
+
|
|
3
|
+
[Interactive Demonstration](https://rawlings.github.io/uibit/components/carousel)
|
|
4
|
+
|
|
5
|
+
Carousel provides a fluid and responsive content presentation display that invites exploration. With smooth transitions, touch responsiveness, and elegant pagination control, it showcases visual content without cluttering the interface structure.
|
|
6
|
+
|
|
7
|
+
## Value Delivery
|
|
8
|
+
|
|
9
|
+
- **Effortless Discovery** – Users can browse through galleries or testimonials at their own pace, maintaining layout context.
|
|
10
|
+
- **Space Efficiency** – Displays multiple featured items in a single container, preventing vertical page bloat.
|
|
11
|
+
- **Responsive Layouts** – Adapts item counts and dimensions smoothly between compact mobile screens and spacious desktops.
|
|
12
|
+
- **Polished Presentation** – Subtle animations and support for optional automatic cycles create a high-end, responsive feel.
|
|
13
|
+
|
|
14
|
+
## Ideal Applications
|
|
15
|
+
|
|
16
|
+
- **Product Galleries** – Displaying multi-angle shots or catalog collections.
|
|
17
|
+
- **Content Showcases** – Highlighting blog posts, featured articles, or portfolio highlights.
|
|
18
|
+
- **Testimonial Carousels** – Presenting social proof and user feedback in an elegant, interactive format.
|
|
19
|
+
|
|
20
|
+
## Further Information
|
|
21
|
+
|
|
22
|
+
Detailed design guidelines, customizable attributes, and integration examples are available on our documentation site.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Changelog
|
|
26
|
+
|
|
27
|
+
Please see the [Changelog](CHANGELOG.md) for version history.
|
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/carousel.ts",
|
|
8
|
+
"declarations": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "class",
|
|
11
|
+
"description": "Accessible, scroll-driven carousel with keyboard navigation, auto-play,\nand configurable items-per-view via CSS custom properties.",
|
|
12
|
+
"name": "UIBitCarousel",
|
|
13
|
+
"cssProperties": [
|
|
14
|
+
{
|
|
15
|
+
"description": "Gap between slides",
|
|
16
|
+
"name": "--uibit-carousel-gap",
|
|
17
|
+
"default": "1rem"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"description": "Padding inside the viewport around slides",
|
|
21
|
+
"name": "--uibit-carousel-padding",
|
|
22
|
+
"default": "0"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"description": "Scroll animation duration",
|
|
26
|
+
"name": "--uibit-carousel-duration",
|
|
27
|
+
"default": "300ms"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"description": "Number of slides visible at once",
|
|
31
|
+
"name": "--uibit-carousel-items-per-view",
|
|
32
|
+
"default": "1"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"description": "Border color of the viewport",
|
|
36
|
+
"name": "--uibit-carousel-border-color",
|
|
37
|
+
"default": "#e5e7eb"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"description": "Background of prev/next buttons",
|
|
41
|
+
"name": "--uibit-carousel-button-bg",
|
|
42
|
+
"default": "#f9fafb"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"description": "Hover background of prev/next buttons",
|
|
46
|
+
"name": "--uibit-carousel-button-bg-hover",
|
|
47
|
+
"default": "#f3f4f6"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"description": "Hover text/icon color of prev/next buttons",
|
|
51
|
+
"name": "--uibit-carousel-button-color-hover",
|
|
52
|
+
"default": "#ffffff"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"description": "Background of inactive indicator dots",
|
|
56
|
+
"name": "--uibit-carousel-indicator-bg",
|
|
57
|
+
"default": "#e5e7eb"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"description": "Background of the active indicator dot",
|
|
61
|
+
"name": "--uibit-carousel-indicator-active-bg",
|
|
62
|
+
"default": "#000000"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"description": "Color of the focus outline on buttons",
|
|
66
|
+
"name": "--uibit-carousel-focus-color",
|
|
67
|
+
"default": "#000000"
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"cssParts": [
|
|
71
|
+
{
|
|
72
|
+
"description": "The root carousel container",
|
|
73
|
+
"name": "carousel"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"description": "The overflow-hidden viewport",
|
|
77
|
+
"name": "viewport"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"description": "The scrollable slides row",
|
|
81
|
+
"name": "content"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"description": "The control bar below the viewport",
|
|
85
|
+
"name": "controls"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"description": "The prev/next button group",
|
|
89
|
+
"name": "buttons"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"description": "Each navigation button",
|
|
93
|
+
"name": "button"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"description": "The previous slide button",
|
|
97
|
+
"name": "button-prev"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"description": "The next slide button",
|
|
101
|
+
"name": "button-next"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"description": "The indicator dot group",
|
|
105
|
+
"name": "indicators"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"description": "Each indicator dot",
|
|
109
|
+
"name": "indicator"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"description": "Added to the active indicator dot",
|
|
113
|
+
"name": "indicator-active"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
"slots": [
|
|
117
|
+
{
|
|
118
|
+
"description": "One or more slide elements (add `slot=\"item\"` to each child)",
|
|
119
|
+
"name": "item"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"members": [
|
|
123
|
+
{
|
|
124
|
+
"kind": "field",
|
|
125
|
+
"name": "autoPlay",
|
|
126
|
+
"type": {
|
|
127
|
+
"text": "boolean"
|
|
128
|
+
},
|
|
129
|
+
"default": "false",
|
|
130
|
+
"description": "Automatically advance slides on a timer.",
|
|
131
|
+
"attribute": "auto-play"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"kind": "field",
|
|
135
|
+
"name": "autoPlayInterval",
|
|
136
|
+
"type": {
|
|
137
|
+
"text": "number"
|
|
138
|
+
},
|
|
139
|
+
"default": "5000",
|
|
140
|
+
"description": "Milliseconds between auto-play advances.",
|
|
141
|
+
"attribute": "auto-play-interval"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"kind": "field",
|
|
145
|
+
"name": "loop",
|
|
146
|
+
"type": {
|
|
147
|
+
"text": "boolean"
|
|
148
|
+
},
|
|
149
|
+
"default": "true",
|
|
150
|
+
"description": "When `true`, the carousel wraps from the last slide back to the first.",
|
|
151
|
+
"attribute": "loop"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"kind": "field",
|
|
155
|
+
"name": "itemsPerView",
|
|
156
|
+
"type": {
|
|
157
|
+
"text": "number"
|
|
158
|
+
},
|
|
159
|
+
"readonly": true
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"kind": "field",
|
|
163
|
+
"name": "gap",
|
|
164
|
+
"type": {
|
|
165
|
+
"text": "number"
|
|
166
|
+
},
|
|
167
|
+
"readonly": true
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"kind": "field",
|
|
171
|
+
"name": "duration",
|
|
172
|
+
"type": {
|
|
173
|
+
"text": "number"
|
|
174
|
+
},
|
|
175
|
+
"readonly": true
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"kind": "field",
|
|
179
|
+
"name": "content",
|
|
180
|
+
"type": {
|
|
181
|
+
"text": "HTMLElement | undefined"
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"kind": "field",
|
|
186
|
+
"name": "viewport",
|
|
187
|
+
"type": {
|
|
188
|
+
"text": "HTMLElement | undefined"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"kind": "field",
|
|
193
|
+
"name": "slotElement",
|
|
194
|
+
"type": {
|
|
195
|
+
"text": "HTMLSlotElement | undefined"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"kind": "field",
|
|
200
|
+
"name": "currentIndex",
|
|
201
|
+
"type": {
|
|
202
|
+
"text": "number"
|
|
203
|
+
},
|
|
204
|
+
"default": "0"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"kind": "field",
|
|
208
|
+
"name": "totalSlides",
|
|
209
|
+
"type": {
|
|
210
|
+
"text": "number"
|
|
211
|
+
},
|
|
212
|
+
"default": "0"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"kind": "field",
|
|
216
|
+
"name": "canPrev",
|
|
217
|
+
"type": {
|
|
218
|
+
"text": "boolean"
|
|
219
|
+
},
|
|
220
|
+
"default": "false"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"kind": "field",
|
|
224
|
+
"name": "canNext",
|
|
225
|
+
"type": {
|
|
226
|
+
"text": "boolean"
|
|
227
|
+
},
|
|
228
|
+
"default": "true"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"kind": "field",
|
|
232
|
+
"name": "autoPlayTimer",
|
|
233
|
+
"type": {
|
|
234
|
+
"text": "number | undefined"
|
|
235
|
+
},
|
|
236
|
+
"privacy": "private"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"kind": "field",
|
|
240
|
+
"name": "resizeObserver",
|
|
241
|
+
"type": {
|
|
242
|
+
"text": "ResizeObserver | undefined"
|
|
243
|
+
},
|
|
244
|
+
"privacy": "private"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"kind": "field",
|
|
248
|
+
"name": "slideObserver",
|
|
249
|
+
"type": {
|
|
250
|
+
"text": "IntersectionObserver | undefined"
|
|
251
|
+
},
|
|
252
|
+
"privacy": "private"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"kind": "field",
|
|
256
|
+
"name": "slideIntersectionRatios",
|
|
257
|
+
"privacy": "private",
|
|
258
|
+
"default": "new Map<Element, number>()"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"kind": "field",
|
|
262
|
+
"name": "isProgrammaticScroll",
|
|
263
|
+
"type": {
|
|
264
|
+
"text": "boolean"
|
|
265
|
+
},
|
|
266
|
+
"privacy": "private",
|
|
267
|
+
"default": "false"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"kind": "field",
|
|
271
|
+
"name": "programmaticScrollTimeout",
|
|
272
|
+
"type": {
|
|
273
|
+
"text": "number | undefined"
|
|
274
|
+
},
|
|
275
|
+
"privacy": "private"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"kind": "field",
|
|
279
|
+
"name": "isPausedByInteraction",
|
|
280
|
+
"type": {
|
|
281
|
+
"text": "boolean"
|
|
282
|
+
},
|
|
283
|
+
"privacy": "private",
|
|
284
|
+
"default": "false"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"kind": "field",
|
|
288
|
+
"name": "handlePointerEnter",
|
|
289
|
+
"privacy": "private"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"kind": "field",
|
|
293
|
+
"name": "handlePointerLeave",
|
|
294
|
+
"privacy": "private"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"kind": "field",
|
|
298
|
+
"name": "handleFocusIn",
|
|
299
|
+
"privacy": "private"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"kind": "field",
|
|
303
|
+
"name": "handleFocusOut",
|
|
304
|
+
"privacy": "private"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"kind": "method",
|
|
308
|
+
"name": "setupCarousel",
|
|
309
|
+
"privacy": "private"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"kind": "method",
|
|
313
|
+
"name": "setupSlideObserver",
|
|
314
|
+
"privacy": "private"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"kind": "method",
|
|
318
|
+
"name": "setupResizeObserver",
|
|
319
|
+
"privacy": "private"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"kind": "method",
|
|
323
|
+
"name": "setupKeyboardNavigation",
|
|
324
|
+
"privacy": "private"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"kind": "method",
|
|
328
|
+
"name": "setupAutoPlay",
|
|
329
|
+
"privacy": "private"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"kind": "method",
|
|
333
|
+
"name": "stopAutoPlay",
|
|
334
|
+
"privacy": "private"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"kind": "method",
|
|
338
|
+
"name": "getSlides",
|
|
339
|
+
"privacy": "private",
|
|
340
|
+
"return": {
|
|
341
|
+
"type": {
|
|
342
|
+
"text": "HTMLElement[]"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"kind": "method",
|
|
348
|
+
"name": "updateNavigationState",
|
|
349
|
+
"privacy": "private"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"kind": "method",
|
|
353
|
+
"name": "prev"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"kind": "method",
|
|
357
|
+
"name": "next"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"kind": "method",
|
|
361
|
+
"name": "goToSlide",
|
|
362
|
+
"parameters": [
|
|
363
|
+
{
|
|
364
|
+
"name": "index",
|
|
365
|
+
"type": {
|
|
366
|
+
"text": "number"
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"kind": "method",
|
|
373
|
+
"name": "scrollToSlide",
|
|
374
|
+
"privacy": "private",
|
|
375
|
+
"parameters": [
|
|
376
|
+
{
|
|
377
|
+
"name": "index",
|
|
378
|
+
"type": {
|
|
379
|
+
"text": "number"
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
]
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"kind": "method",
|
|
386
|
+
"name": "emitSlideChange",
|
|
387
|
+
"privacy": "private"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"kind": "method",
|
|
391
|
+
"name": "handleSlotChange",
|
|
392
|
+
"privacy": "private"
|
|
393
|
+
}
|
|
394
|
+
],
|
|
395
|
+
"events": [
|
|
396
|
+
{
|
|
397
|
+
"type": {
|
|
398
|
+
"text": "{ index: number, totalSlides: number }"
|
|
399
|
+
},
|
|
400
|
+
"description": "Fired when the active slide changes",
|
|
401
|
+
"name": "slide-change"
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
"attributes": [
|
|
405
|
+
{
|
|
406
|
+
"name": "auto-play",
|
|
407
|
+
"type": {
|
|
408
|
+
"text": "boolean"
|
|
409
|
+
},
|
|
410
|
+
"default": "false",
|
|
411
|
+
"description": "Automatically advance slides on a timer.",
|
|
412
|
+
"fieldName": "autoPlay"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"name": "auto-play-interval",
|
|
416
|
+
"type": {
|
|
417
|
+
"text": "number"
|
|
418
|
+
},
|
|
419
|
+
"default": "5000",
|
|
420
|
+
"description": "Milliseconds between auto-play advances.",
|
|
421
|
+
"fieldName": "autoPlayInterval"
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"name": "loop",
|
|
425
|
+
"type": {
|
|
426
|
+
"text": "boolean"
|
|
427
|
+
},
|
|
428
|
+
"default": "true",
|
|
429
|
+
"description": "When `true`, the carousel wraps from the last slide back to the first.",
|
|
430
|
+
"fieldName": "loop"
|
|
431
|
+
}
|
|
432
|
+
],
|
|
433
|
+
"superclass": {
|
|
434
|
+
"name": "UIBitElement",
|
|
435
|
+
"package": "@uibit/core"
|
|
436
|
+
},
|
|
437
|
+
"tagName": "uibit-carousel",
|
|
438
|
+
"customElement": true
|
|
439
|
+
}
|
|
440
|
+
],
|
|
441
|
+
"exports": [
|
|
442
|
+
{
|
|
443
|
+
"kind": "js",
|
|
444
|
+
"name": "UIBitCarousel",
|
|
445
|
+
"declaration": {
|
|
446
|
+
"name": "UIBitCarousel",
|
|
447
|
+
"module": "src/carousel.ts"
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"kind": "custom-element-definition",
|
|
452
|
+
"name": "uibit-carousel",
|
|
453
|
+
"declaration": {
|
|
454
|
+
"name": "UIBitCarousel",
|
|
455
|
+
"module": "src/carousel.ts"
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"kind": "js",
|
|
460
|
+
"name": "default",
|
|
461
|
+
"declaration": {
|
|
462
|
+
"name": "UIBitCarousel",
|
|
463
|
+
"module": "src/carousel.ts"
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
]
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
"kind": "javascript-module",
|
|
470
|
+
"path": "src/index.ts",
|
|
471
|
+
"declarations": [],
|
|
472
|
+
"exports": [
|
|
473
|
+
{
|
|
474
|
+
"kind": "js",
|
|
475
|
+
"name": "default",
|
|
476
|
+
"declaration": {
|
|
477
|
+
"name": "UIBitCarousel",
|
|
478
|
+
"module": "./carousel"
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"kind": "js",
|
|
483
|
+
"name": "CarouselConfig",
|
|
484
|
+
"declaration": {
|
|
485
|
+
"name": "CarouselConfig",
|
|
486
|
+
"module": "./types"
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"kind": "js",
|
|
491
|
+
"name": "SlideChangeEvent",
|
|
492
|
+
"declaration": {
|
|
493
|
+
"name": "SlideChangeEvent",
|
|
494
|
+
"module": "./types"
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
]
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"kind": "javascript-module",
|
|
501
|
+
"path": "src/styles.ts",
|
|
502
|
+
"declarations": [
|
|
503
|
+
{
|
|
504
|
+
"kind": "variable",
|
|
505
|
+
"name": "styles",
|
|
506
|
+
"default": "css` :host { --uibit-carousel-gap: var(--uibit-spacing-4, 1rem); --uibit-carousel-padding: 0; --uibit-carousel-duration: 300ms; --uibit-carousel-items-per-view: 1; --uibit-carousel-border-color: var(--uibit-border-color, var(--uibit-color-gray-200, #e5e7eb)); --uibit-carousel-button-bg: var(--uibit-bg-surface, var(--uibit-color-white, #ffffff)); --uibit-carousel-button-bg-hover: var(--uibit-focus-color, var(--uibit-color-black, #000000)); --uibit-carousel-button-color-hover: var(--uibit-color-white, #ffffff); --uibit-carousel-indicator-bg: var(--uibit-border-color, var(--uibit-color-gray-200, #e5e7eb)); --uibit-carousel-indicator-active-bg: var(--uibit-focus-color, var(--uibit-color-black, #000000)); --uibit-carousel-focus-color: var(--uibit-focus-color, var(--uibit-color-black, #000000)); display: block; width: 100%; } .carousel { display: flex; flex-direction: column; gap: var(--uibit-spacing-4, 1rem); width: 100%; } .carousel-viewport { position: relative; overflow: hidden; border: 0.0625rem solid var(--uibit-carousel-border-color); border-radius: var(--uibit-radius-2xl, 0.75rem); background-color: var(--uibit-bg-surface, var(--uibit-color-white, #ffffff)); } .carousel-content { display: flex; gap: var(--uibit-carousel-gap); overflow-x: auto; scroll-behavior: smooth; scroll-snap-type: x mandatory; padding: var(--uibit-carousel-padding, 0); width: 100%; scrollbar-width: none; -ms-overflow-style: none; } .carousel-content::-webkit-scrollbar { display: none; } slot[name='item'] { display: contents; } ::slotted([slot='item']), ::slotted(:not([slot])) { scroll-snap-align: start; scroll-snap-stop: always; width: calc( (100% - (var(--uibit-carousel-items-per-view, 1) - 1) * var(--uibit-carousel-gap, 1rem)) / var(--uibit-carousel-items-per-view, 1) ); flex-shrink: 0; min-width: 0; } .carousel-controls { display: flex; align-items: center; justify-content: space-between; gap: var(--uibit-spacing-4, 1rem); } .carousel-buttons { display: flex; gap: 0.5rem; } .carousel-button { width: 2.25rem; height: 2.25rem; background-color: var(--uibit-carousel-button-bg, #ffffff); border: 0.0625rem solid var(--uibit-carousel-border-color, #e5e7eb); border-radius: 9999rem; cursor: pointer; color: var(--uibit-text-primary, #111827); transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, opacity 100ms ease, transform 150ms ease; display: inline-flex; align-items: center; justify-content: center; box-shadow: none; } .carousel-button:hover:not(:disabled) { background-color: var(--uibit-carousel-button-bg-hover, #f3f4f6); color: var(--uibit-carousel-button-color-hover, #ffffff); border-color: var(--uibit-carousel-button-bg-hover, #000000); box-shadow: none; transform: scale(1.06); } .carousel-button:active:not(:disabled) { transform: scale(0.95); } .carousel-button:disabled { opacity: 0.3; cursor: not-allowed; } .carousel-button:focus-visible { outline: 0.125rem solid var(--uibit-carousel-focus-color); outline-offset: 0.125rem; } .carousel-indicators { display: flex; gap: 0.5rem; align-items: center; justify-content: center; } .carousel-indicator { width: 0.5rem; height: 0.5rem; border-radius: 9999rem; background-color: var(--uibit-carousel-indicator-bg); cursor: pointer; border: none; padding: 0; transition: background-color 150ms ease, width 150ms ease, border-radius 150ms ease, opacity 100ms ease; } .carousel-indicator:hover { background-color: var(--uibit-carousel-indicator-active-bg); } .carousel-indicator:active { opacity: 0.6; } .carousel-indicator.active { width: 1.25rem; border-radius: 0.25rem; background-color: var(--uibit-carousel-indicator-active-bg); } .carousel-indicator:focus-visible { outline: 0.125rem solid var(--uibit-carousel-focus-color); outline-offset: 0.125rem; } @media (max-width: 40rem) { .carousel-controls { flex-wrap: wrap; } .carousel-content { padding: var(--uibit-carousel-padding, 0); } } `"
|
|
507
|
+
}
|
|
508
|
+
],
|
|
509
|
+
"exports": [
|
|
510
|
+
{
|
|
511
|
+
"kind": "js",
|
|
512
|
+
"name": "styles",
|
|
513
|
+
"declaration": {
|
|
514
|
+
"name": "styles",
|
|
515
|
+
"module": "src/styles.ts"
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
"kind": "javascript-module",
|
|
522
|
+
"path": "src/types.ts",
|
|
523
|
+
"declarations": [],
|
|
524
|
+
"exports": []
|
|
525
|
+
}
|
|
526
|
+
]
|
|
527
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { UIBitElement } from '@uibit/core';
|
|
2
|
+
import type { CarouselConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Accessible, scroll-driven carousel with keyboard navigation, auto-play,
|
|
5
|
+
* and configurable items-per-view via CSS custom properties.
|
|
6
|
+
*
|
|
7
|
+
* @fires {{ index: number, totalSlides: number }} slide-change - Fired when the active slide changes
|
|
8
|
+
*
|
|
9
|
+
* @slot item - One or more slide elements (add `slot="item"` to each child)
|
|
10
|
+
*
|
|
11
|
+
* @cssprop [--uibit-carousel-gap=1rem] - Gap between slides
|
|
12
|
+
* @cssprop [--uibit-carousel-padding=0] - Padding inside the viewport around slides
|
|
13
|
+
* @cssprop [--uibit-carousel-duration=300ms] - Scroll animation duration
|
|
14
|
+
* @cssprop [--uibit-carousel-items-per-view=1] - Number of slides visible at once
|
|
15
|
+
* @cssprop [--uibit-carousel-border-color=#e5e7eb] - Border color of the viewport
|
|
16
|
+
* @cssprop [--uibit-carousel-button-bg=#f9fafb] - Background of prev/next buttons
|
|
17
|
+
* @cssprop [--uibit-carousel-button-bg-hover=#f3f4f6] - Hover background of prev/next buttons
|
|
18
|
+
* @cssprop [--uibit-carousel-button-color-hover=#ffffff] - Hover text/icon color of prev/next buttons
|
|
19
|
+
* @cssprop [--uibit-carousel-indicator-bg=#e5e7eb] - Background of inactive indicator dots
|
|
20
|
+
* @cssprop [--uibit-carousel-indicator-active-bg=#000000] - Background of the active indicator dot
|
|
21
|
+
* @cssprop [--uibit-carousel-focus-color=#000000] - Color of the focus outline on buttons
|
|
22
|
+
*
|
|
23
|
+
* @csspart carousel - The root carousel container
|
|
24
|
+
* @csspart viewport - The overflow-hidden viewport
|
|
25
|
+
* @csspart content - The scrollable slides row
|
|
26
|
+
* @csspart controls - The control bar below the viewport
|
|
27
|
+
* @csspart buttons - The prev/next button group
|
|
28
|
+
* @csspart button - Each navigation button
|
|
29
|
+
* @csspart button-prev - The previous slide button
|
|
30
|
+
* @csspart button-next - The next slide button
|
|
31
|
+
* @csspart indicators - The indicator dot group
|
|
32
|
+
* @csspart indicator - Each indicator dot
|
|
33
|
+
* @csspart indicator-active - Added to the active indicator dot
|
|
34
|
+
*/
|
|
35
|
+
export declare class UIBitCarousel extends UIBitElement {
|
|
36
|
+
static styles: import("lit").CSSResult;
|
|
37
|
+
/** Automatically advance slides on a timer. */
|
|
38
|
+
autoPlay: boolean;
|
|
39
|
+
/** Milliseconds between auto-play advances. */
|
|
40
|
+
autoPlayInterval: number;
|
|
41
|
+
/** When `true`, the carousel wraps from the last slide back to the first. */
|
|
42
|
+
loop: boolean;
|
|
43
|
+
get itemsPerView(): number;
|
|
44
|
+
get gap(): number;
|
|
45
|
+
get duration(): number;
|
|
46
|
+
content?: HTMLElement;
|
|
47
|
+
viewport?: HTMLElement;
|
|
48
|
+
slotElement?: HTMLSlotElement;
|
|
49
|
+
currentIndex: number;
|
|
50
|
+
totalSlides: number;
|
|
51
|
+
canPrev: boolean;
|
|
52
|
+
canNext: boolean;
|
|
53
|
+
private autoPlayTimer?;
|
|
54
|
+
private resizeObserver?;
|
|
55
|
+
private slideObserver?;
|
|
56
|
+
private slideIntersectionRatios;
|
|
57
|
+
private isProgrammaticScroll;
|
|
58
|
+
private programmaticScrollTimeout?;
|
|
59
|
+
private isPausedByInteraction;
|
|
60
|
+
private handlePointerEnter;
|
|
61
|
+
private handlePointerLeave;
|
|
62
|
+
private handleFocusIn;
|
|
63
|
+
private handleFocusOut;
|
|
64
|
+
constructor(config?: CarouselConfig);
|
|
65
|
+
protected firstUpdated(): void;
|
|
66
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
67
|
+
disconnectedCallback(): void;
|
|
68
|
+
private setupCarousel;
|
|
69
|
+
private setupSlideObserver;
|
|
70
|
+
private setupResizeObserver;
|
|
71
|
+
private setupKeyboardNavigation;
|
|
72
|
+
private setupAutoPlay;
|
|
73
|
+
private stopAutoPlay;
|
|
74
|
+
private getSlides;
|
|
75
|
+
private updateNavigationState;
|
|
76
|
+
prev(): void;
|
|
77
|
+
next(): void;
|
|
78
|
+
goToSlide(index: number): void;
|
|
79
|
+
private scrollToSlide;
|
|
80
|
+
private emitSlideChange;
|
|
81
|
+
private handleSlotChange;
|
|
82
|
+
render(): import("lit").TemplateResult<1>;
|
|
83
|
+
}
|
|
84
|
+
export default UIBitCarousel;
|
|
85
|
+
//# sourceMappingURL=carousel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../src/carousel.ts"],"names":[],"mappings":"AACA,OAAO,EAAgD,YAAY,EAAE,MAAM,aAAa,CAAC;AAGzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBACa,aAAc,SAAQ,YAAY;IAC7C,MAAM,CAAC,MAAM,0BAAU;IAEvB,+CAA+C;IACM,QAAQ,UAAS;IACtE,+CAA+C;IACc,gBAAgB,SAAQ;IACrF,6EAA6E;IAChD,IAAI,UAAQ;IAEzC,IAAI,YAAY,IAAI,MAAM,CAIzB;IAED,IAAI,GAAG,IAAI,MAAM,CAIhB;IAED,IAAI,QAAQ,IAAI,MAAM,CAOrB;IAE2B,OAAO,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACxB,WAAW,CAAC,EAAE,eAAe,CAAC;IAEjD,YAAY,SAAK;IACjB,WAAW,SAAK;IAChB,OAAO,UAAS;IAChB,OAAO,UAAQ;IAExB,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,cAAc,CAAC,CAAiB;IACxC,OAAO,CAAC,aAAa,CAAC,CAAuB;IAC7C,OAAO,CAAC,uBAAuB,CAA8B;IAC7D,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,yBAAyB,CAAC,CAAS;IAC3C,OAAO,CAAC,qBAAqB,CAAS;IAEtC,OAAO,CAAC,kBAAkB,CAGxB;IAEF,OAAO,CAAC,kBAAkB,CAKxB;IAEF,OAAO,CAAC,aAAa,CAGnB;IAEF,OAAO,CAAC,cAAc,CAKpB;IAEF,YAAY,MAAM,CAAC,EAAE,cAAc,EAgBlC;IAED,SAAS,CAAC,YAAY,SASrB;IAED,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAW9C;IAED,oBAAoB,SAMnB;IAED,OAAO,CAAC,aAAa;IAqBrB,OAAO,CAAC,kBAAkB;IAuC1B,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,SAAS;IAgBjB,OAAO,CAAC,qBAAqB;IAK7B,IAAI,SAMH;IAED,IAAI,SAMH;IAED,SAAS,CAAC,KAAK,EAAE,MAAM,QAItB;IAED,OAAO,CAAC,aAAa;IA6CrB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,gBAAgB;IAIxB,MAAM,oCAoEL;CACF;eAEc,aAAa"}
|