@startupjs-ui/carousel 0.1.13 → 0.1.17
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/CHANGELOG.md +16 -0
- package/README.mdx +16 -20
- package/index.cssx.styl +3 -3
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.1.17](https://github.com/startupjs/startupjs-ui/compare/v0.1.16...v0.1.17) (2026-02-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/carousel
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.1.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @startupjs-ui/carousel
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.1.13](https://github.com/startupjs/startupjs-ui/compare/v0.1.12...v0.1.13) (2026-02-03)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @startupjs-ui/carousel
|
package/README.mdx
CHANGED
|
@@ -7,14 +7,15 @@ import { Sandbox } from '@startupjs-ui/docs'
|
|
|
7
7
|
|
|
8
8
|
# Carousel
|
|
9
9
|
|
|
10
|
+
A horizontally (or vertically) scrollable container for cycling through a series of slides. Supports swipe gestures, navigation arrows, dot indicators, infinite scrolling, auto-scroll, and responsive sizing. Pass slides as `children` and customize behavior with props like `isResponsive`, `isEndless`, `isLoop`, and more. You can also provide a `ref` to access navigation helpers (`toBack`, `toNext`, `toIndex`) and the `activeChild`. The `duration` prop (defaults to `300`ms) controls the animation speed, and `onChange` fires whenever the active slide changes.
|
|
11
|
+
|
|
10
12
|
```js
|
|
11
13
|
import { Carousel } from 'startupjs-ui'
|
|
12
14
|
```
|
|
13
15
|
|
|
14
16
|
## Simple example
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
Such an example of a carousel, used on instagram or vk for stories, children have no clear boundaries, such a carousel should be adaptive for all extensions and devices
|
|
18
|
+
Pass child elements directly to the Carousel. Each child defines its own width, and the carousel scrolls horizontally by default. This works well for free-form layouts like story thumbnails. Custom `style` can be applied to the outer wrapper.
|
|
18
19
|
|
|
19
20
|
```jsx example noscroll
|
|
20
21
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -44,7 +45,7 @@ return (
|
|
|
44
45
|
)
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
Children can also have different widths -- the component handles mixed sizes correctly.
|
|
48
49
|
|
|
49
50
|
```jsx example noscroll
|
|
50
51
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -82,11 +83,7 @@ return (
|
|
|
82
83
|
|
|
83
84
|
## Adaptability
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
There is a property for this - isResponsive (by default - false)
|
|
87
|
-
In conjunction with this property, each children needs to minWidth and maxWidth
|
|
88
|
-
The component itself will calculate how many blocks need to be displayed for a specific resolution
|
|
89
|
-
For example, when minWidth 100 and maxWidth 500, on the desktop extension there will be 2 blocks, on mobile 1
|
|
86
|
+
Set `isResponsive` to `true` (defaults to `false`) to have the carousel automatically calculate how many slides fit within the available space. Each child must specify `minWidth` and `maxWidth` in its style so the component can determine the optimal size. For example, with `minWidth: 100` and `maxWidth: 500`, a desktop screen might display 2 slides at once, while a mobile screen shows only 1.
|
|
90
87
|
|
|
91
88
|
```jsx example noscroll
|
|
92
89
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -117,7 +114,7 @@ return (
|
|
|
117
114
|
)
|
|
118
115
|
```
|
|
119
116
|
|
|
120
|
-
To
|
|
117
|
+
To show only one slide at a time, set the child's `minWidth` to `'100%'`.
|
|
121
118
|
|
|
122
119
|
```jsx example noscroll
|
|
123
120
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -149,8 +146,7 @@ return (
|
|
|
149
146
|
|
|
150
147
|
## Infinite scrolling
|
|
151
148
|
|
|
152
|
-
Set
|
|
153
|
-
Without isResponsive property, infinite scrolling works only on arrow clicks
|
|
149
|
+
Set `isEndless` to `true` (defaults to `false`) to enable infinite scrolling. Without `isResponsive`, infinite scrolling only works via arrow navigation. When combined with `isResponsive`, it also works through swipe gestures.
|
|
154
150
|
|
|
155
151
|
```jsx example noscroll
|
|
156
152
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -187,7 +183,7 @@ return (
|
|
|
187
183
|
)
|
|
188
184
|
```
|
|
189
185
|
|
|
190
|
-
With isResponsive
|
|
186
|
+
With both `isResponsive` and `isEndless` enabled, swipe-based infinite scrolling works as well.
|
|
191
187
|
|
|
192
188
|
```jsx example noscroll
|
|
193
189
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -225,8 +221,7 @@ return (
|
|
|
225
221
|
|
|
226
222
|
## Swipe
|
|
227
223
|
|
|
228
|
-
The
|
|
229
|
-
The default is true, and you can always turn it off:
|
|
224
|
+
The `isSwipe` prop controls whether users can scroll the carousel by dragging with a mouse or finger. It defaults to `true`. Set it to `false` to disable swipe gestures entirely.
|
|
230
225
|
|
|
231
226
|
```jsx example noscroll
|
|
232
227
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -253,8 +248,7 @@ return (
|
|
|
253
248
|
|
|
254
249
|
## Display arrows and dots
|
|
255
250
|
|
|
256
|
-
|
|
257
|
-
Without isResponsive - hasDots always false
|
|
251
|
+
Use `hasArrows` (defaults to `true`) and `hasDots` (defaults to `false`) to control the visibility of navigation arrows and dot indicators. Note that dots only appear when `isResponsive` is also enabled.
|
|
258
252
|
|
|
259
253
|
```jsx example noscroll
|
|
260
254
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -286,7 +280,7 @@ return (
|
|
|
286
280
|
|
|
287
281
|
## Auto scroll
|
|
288
282
|
|
|
289
|
-
Set
|
|
283
|
+
Set `isLoop` to `true` (defaults to `false`) to automatically advance slides on a timer. This is typically combined with `isEndless` and `isResponsive` for a seamless looping slideshow.
|
|
290
284
|
|
|
291
285
|
```jsx example noscroll
|
|
292
286
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -319,7 +313,7 @@ return (
|
|
|
319
313
|
|
|
320
314
|
## Start value
|
|
321
315
|
|
|
322
|
-
|
|
316
|
+
Use the `startIndex` prop to set the initially visible slide (defaults to `0`).
|
|
323
317
|
|
|
324
318
|
```jsx example noscroll
|
|
325
319
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
@@ -357,7 +351,7 @@ return (
|
|
|
357
351
|
|
|
358
352
|
## Styling arrows
|
|
359
353
|
|
|
360
|
-
|
|
354
|
+
Use `arrowBackStyle` and `arrowNextStyle` to customize the appearance of the navigation arrows.
|
|
361
355
|
|
|
362
356
|
```jsx example noscroll
|
|
363
357
|
const carouselStyle = { width: '80%', alignSelf: 'center' }
|
|
@@ -404,7 +398,7 @@ return (
|
|
|
404
398
|
)
|
|
405
399
|
```
|
|
406
400
|
|
|
407
|
-
|
|
401
|
+
For full control over arrows and dots, pass a `ref` to the Carousel. The ref exposes navigation methods: `toBack()`, `toNext()`, and `toIndex(index)`. Use the `onChange` callback to track the currently active slide index.
|
|
408
402
|
|
|
409
403
|
```jsx example noscroll
|
|
410
404
|
const ref = useRef()
|
|
@@ -491,6 +485,8 @@ return (
|
|
|
491
485
|
|
|
492
486
|
## Vertical mode
|
|
493
487
|
|
|
488
|
+
Set `variant` to `'vertical'` (defaults to `'horizontal'`) to scroll slides vertically instead of horizontally.
|
|
489
|
+
|
|
494
490
|
```jsx example
|
|
495
491
|
const carouselStyle = { marginLeft: 4, marginRight: 4 }
|
|
496
492
|
const caseStyle = {
|
package/index.cssx.styl
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
position absolute
|
|
19
19
|
user-select none
|
|
20
20
|
z-index 999
|
|
21
|
-
|
|
21
|
+
radius()
|
|
22
22
|
padding .5u
|
|
23
23
|
|
|
24
24
|
&.vertical
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
|
|
58
58
|
.dot
|
|
59
59
|
height 1u
|
|
60
|
-
width
|
|
60
|
+
width 1u
|
|
61
61
|
background-color var(--color-bg-main-subtle)
|
|
62
|
-
|
|
62
|
+
radius(circle)
|
|
63
63
|
margin 0 .4u
|
|
64
64
|
cursor pointer
|
|
65
65
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/carousel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@startupjs-ui/core": "^0.1.11",
|
|
12
|
-
"@startupjs-ui/div": "^0.1.
|
|
13
|
-
"@startupjs-ui/icon": "^0.1.
|
|
12
|
+
"@startupjs-ui/div": "^0.1.16",
|
|
13
|
+
"@startupjs-ui/icon": "^0.1.16"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "*",
|
|
17
17
|
"react-native": "*",
|
|
18
18
|
"startupjs": "*"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "902cb7536d017b53dc268cc54e8e54818279744c"
|
|
21
21
|
}
|