@yamada-ui/carousel 2.0.7-next-20241005220055 → 2.0.7
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/carousel-control.js +2 -2
- package/dist/carousel-control.js.map +1 -1
- package/dist/carousel-control.mjs +2 -2
- package/dist/carousel-indicators.js +5 -5
- package/dist/carousel-indicators.js.map +1 -1
- package/dist/carousel-indicators.mjs +2 -2
- package/dist/carousel-slide.js +6 -7
- package/dist/carousel-slide.js.map +1 -1
- package/dist/carousel-slide.mjs +2 -2
- package/dist/carousel.d.mts +47 -47
- package/dist/carousel.d.ts +47 -47
- package/dist/carousel.js +71 -70
- package/dist/carousel.js.map +1 -1
- package/dist/carousel.mjs +5 -5
- package/dist/{chunk-OQNU22B2.mjs → chunk-CXXL47SC.mjs} +8 -9
- package/dist/chunk-CXXL47SC.mjs.map +1 -0
- package/dist/{chunk-T3LMURPY.mjs → chunk-PEXGWNKB.mjs} +4 -4
- package/dist/chunk-PEXGWNKB.mjs.map +1 -0
- package/dist/{chunk-LRO4RIBJ.mjs → chunk-SYCPZC2C.mjs} +41 -31
- package/dist/chunk-SYCPZC2C.mjs.map +1 -0
- package/dist/{chunk-W6XPFRNI.mjs → chunk-UTOIPGGP.mjs} +7 -7
- package/dist/chunk-UTOIPGGP.mjs.map +1 -0
- package/dist/{chunk-LV5JHVV6.mjs → chunk-WSTWB7CV.mjs} +29 -37
- package/dist/chunk-WSTWB7CV.mjs.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +71 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/use-carousel.d.mts +71 -99
- package/dist/use-carousel.d.ts +71 -99
- package/dist/use-carousel.js +39 -29
- package/dist/use-carousel.js.map +1 -1
- package/dist/use-carousel.mjs +1 -1
- package/package.json +7 -8
- package/dist/chunk-LRO4RIBJ.mjs.map +0 -1
- package/dist/chunk-LV5JHVV6.mjs.map +0 -1
- package/dist/chunk-OQNU22B2.mjs.map +0 -1
- package/dist/chunk-T3LMURPY.mjs.map +0 -1
- package/dist/chunk-W6XPFRNI.mjs.map +0 -1
package/dist/carousel.d.ts
CHANGED
@@ -8,18 +8,18 @@ import 'react';
|
|
8
8
|
import 'embla-carousel';
|
9
9
|
|
10
10
|
interface CarouselOptions {
|
11
|
-
/**
|
12
|
-
* The orientation of the carousel.
|
13
|
-
*
|
14
|
-
* @default 'horizontal'
|
15
|
-
*/
|
16
|
-
orientation?: Token<"vertical" | "horizontal">;
|
17
11
|
/**
|
18
12
|
* The alignment of the carousel.
|
19
13
|
*
|
20
14
|
* @default 'center'
|
21
15
|
*/
|
22
16
|
align?: Token<AlignmentOptionType>;
|
17
|
+
/**
|
18
|
+
* If `true`, the carousel will be autoplay.
|
19
|
+
*
|
20
|
+
* @default false
|
21
|
+
*/
|
22
|
+
autoplay?: Token<boolean>;
|
23
23
|
/**
|
24
24
|
* Clear leading and trailing empty space that causes excessive scrolling.
|
25
25
|
* Use trimSnaps to only use snap points that trigger scrolling or keepSnaps to keep them.
|
@@ -28,11 +28,11 @@ interface CarouselOptions {
|
|
28
28
|
*/
|
29
29
|
containScroll?: Token<ScrollContainOptionType>;
|
30
30
|
/**
|
31
|
-
* The number
|
31
|
+
* The number for the autoplay interval of the carousel.
|
32
32
|
*
|
33
|
-
* @default
|
33
|
+
* @default 4000
|
34
34
|
*/
|
35
|
-
|
35
|
+
delay?: Token<number>;
|
36
36
|
/**
|
37
37
|
* If `true`, momentum scrolling will be enabled.
|
38
38
|
*
|
@@ -45,6 +45,20 @@ interface CarouselOptions {
|
|
45
45
|
* @default true
|
46
46
|
*/
|
47
47
|
draggable?: Token<boolean>;
|
48
|
+
/**
|
49
|
+
* Set scroll duration when triggered by any of the API methods.
|
50
|
+
* Higher numbers enables slower scrolling.
|
51
|
+
* Drag interactions are not affected because duration is then determined by the drag force.
|
52
|
+
*
|
53
|
+
* @default 25
|
54
|
+
*/
|
55
|
+
duration?: Token<number>;
|
56
|
+
/**
|
57
|
+
* If `true`, gap will be treated as part of the carousel slide size.
|
58
|
+
*
|
59
|
+
* @default true
|
60
|
+
*/
|
61
|
+
includeGapInSize?: Token<boolean>;
|
48
62
|
/**
|
49
63
|
* Choose a fraction representing the percentage portion of a slide that needs to be visible in order to be considered in view.
|
50
64
|
*
|
@@ -58,6 +72,12 @@ interface CarouselOptions {
|
|
58
72
|
* @default true
|
59
73
|
*/
|
60
74
|
loop?: Token<boolean>;
|
75
|
+
/**
|
76
|
+
* The orientation of the carousel.
|
77
|
+
*
|
78
|
+
* @default 'horizontal'
|
79
|
+
*/
|
80
|
+
orientation?: Token<"horizontal" | "vertical">;
|
61
81
|
/**
|
62
82
|
* If `true`, allow the carousel to skip scroll snaps if it's dragged vigorously.
|
63
83
|
* Note that this option will be ignored if the dragFree option is set to true.
|
@@ -66,25 +86,15 @@ interface CarouselOptions {
|
|
66
86
|
*/
|
67
87
|
skipSnaps?: Token<boolean>;
|
68
88
|
/**
|
69
|
-
*
|
70
|
-
* Higher numbers enables slower scrolling.
|
71
|
-
* Drag interactions are not affected because duration is then determined by the drag force.
|
72
|
-
*
|
73
|
-
* @default 25
|
74
|
-
*/
|
75
|
-
duration?: Token<number>;
|
76
|
-
/**
|
77
|
-
* The number for the autoplay interval of the carousel.
|
78
|
-
*
|
79
|
-
* @default 4000
|
89
|
+
* The CSS `width` property.
|
80
90
|
*/
|
81
|
-
|
91
|
+
slideSize?: CSSUIProps["width"];
|
82
92
|
/**
|
83
|
-
*
|
93
|
+
* The number of slides that should be scrolled with next or previous buttons.
|
84
94
|
*
|
85
|
-
* @default
|
95
|
+
* @default 1
|
86
96
|
*/
|
87
|
-
|
97
|
+
slidesToScroll?: Token<number>;
|
88
98
|
/**
|
89
99
|
* If `true`, autoplay will pause when the mouse entries over.
|
90
100
|
*
|
@@ -92,49 +102,39 @@ interface CarouselOptions {
|
|
92
102
|
*/
|
93
103
|
stopMouseEnterAutoplay?: Token<boolean>;
|
94
104
|
/**
|
95
|
-
* If `true`,
|
105
|
+
* If `true`, display the carousel control buttons.
|
96
106
|
*
|
97
107
|
* @default true
|
98
108
|
*/
|
99
|
-
|
100
|
-
/**
|
101
|
-
* The CSS `width` property.
|
102
|
-
*/
|
103
|
-
slideSize?: CSSUIProps["width"];
|
104
|
-
/**
|
105
|
-
* Props for carousel inner element.
|
106
|
-
*/
|
107
|
-
innerProps?: HTMLUIProps;
|
109
|
+
withControls?: Token<boolean>;
|
108
110
|
/**
|
109
|
-
* If `true`, display the carousel
|
111
|
+
* If `true`, display the carousel indicator buttons.
|
110
112
|
*
|
111
113
|
* @default true
|
112
114
|
*/
|
113
|
-
|
115
|
+
withIndicators?: Token<boolean>;
|
114
116
|
/**
|
115
|
-
* Props for carousel control element.
|
117
|
+
* Props for next of the carousel control element.
|
116
118
|
*/
|
117
|
-
|
119
|
+
controlNextProps?: CarouselControlProps;
|
118
120
|
/**
|
119
121
|
* Props for previous of the carousel control element.
|
120
122
|
*/
|
121
123
|
controlPrevProps?: CarouselControlProps;
|
122
124
|
/**
|
123
|
-
* Props for
|
124
|
-
*/
|
125
|
-
controlNextProps?: CarouselControlProps;
|
126
|
-
/**
|
127
|
-
* If `true`, display the carousel indicator buttons.
|
128
|
-
*
|
129
|
-
* @default true
|
125
|
+
* Props for carousel control element.
|
130
126
|
*/
|
131
|
-
|
127
|
+
controlProps?: CarouselControlProps;
|
132
128
|
/**
|
133
129
|
* Props for carousel indicators element.
|
134
130
|
*/
|
135
131
|
indicatorsProps?: CarouselIndicatorsProps;
|
132
|
+
/**
|
133
|
+
* Props for carousel inner element.
|
134
|
+
*/
|
135
|
+
innerProps?: HTMLUIProps;
|
136
136
|
}
|
137
|
-
interface CarouselProps extends ThemeProps<"Carousel">, Omit<HTMLUIProps, "
|
137
|
+
interface CarouselProps extends ThemeProps<"Carousel">, Omit<HTMLUIProps, "draggable" | "onChange">, Pick<UseCarouselProps, "controlRef" | "defaultIndex" | "index" | "onChange" | "onScrollProgress" | "watchDrag" | "watchResize" | "watchSlides">, CarouselOptions {
|
138
138
|
}
|
139
139
|
/**
|
140
140
|
* `Carousel` is a component that displays multiple elements like a slideshow.
|
package/dist/carousel.js
CHANGED
@@ -35,7 +35,6 @@ __export(carousel_exports, {
|
|
35
35
|
});
|
36
36
|
module.exports = __toCommonJS(carousel_exports);
|
37
37
|
var import_core5 = require("@yamada-ui/core");
|
38
|
-
var import_use_token = require("@yamada-ui/use-token");
|
39
38
|
var import_use_value = require("@yamada-ui/use-value");
|
40
39
|
var import_utils5 = require("@yamada-ui/utils");
|
41
40
|
var import_react3 = require("react");
|
@@ -57,51 +56,54 @@ var [CarouselProvider, useCarouselContext] = (0, import_utils.createContext)({
|
|
57
56
|
errorMessage: `useCarouselContext returned is 'undefined'. Seems you forgot to wrap the components in "<Carousel />"`
|
58
57
|
});
|
59
58
|
var useCarousel = ({
|
60
|
-
index,
|
61
|
-
defaultIndex = 0,
|
62
|
-
onChange,
|
63
59
|
align = "center",
|
64
|
-
orientation = "horizontal",
|
65
60
|
autoplay = false,
|
66
|
-
|
67
|
-
|
68
|
-
|
61
|
+
children,
|
62
|
+
containScroll = false,
|
63
|
+
controlRef,
|
64
|
+
defaultIndex = 0,
|
69
65
|
delay = 4e3,
|
70
|
-
slidesToScroll = 1,
|
71
|
-
draggable = true,
|
72
66
|
dragFree = false,
|
67
|
+
draggable = true,
|
68
|
+
duration = 25,
|
69
|
+
includeGapInSize = true,
|
70
|
+
index,
|
73
71
|
inViewThreshold = 0,
|
72
|
+
loop = true,
|
73
|
+
orientation = "horizontal",
|
74
74
|
skipSnaps = false,
|
75
|
-
containScroll = false,
|
76
75
|
slideSize = "100%",
|
77
|
-
|
78
|
-
|
76
|
+
slidesToScroll = 1,
|
77
|
+
stopMouseEnterAutoplay = true,
|
79
78
|
watchDrag = draggable,
|
80
79
|
watchResize = true,
|
81
80
|
watchSlides = true,
|
82
|
-
|
83
|
-
|
81
|
+
onChange,
|
82
|
+
onScrollProgress,
|
84
83
|
...rest
|
85
84
|
}) => {
|
86
|
-
const [
|
85
|
+
const [
|
86
|
+
{ gap = "fallback(4, 1rem)", ...containerProps },
|
87
|
+
{ vars, ...slidesProps }
|
88
|
+
] = (0, import_utils.splitObject)(rest, import_core.layoutStyleProperties);
|
87
89
|
const [selectedIndex, setSelectedIndex] = (0, import_use_controllable_state.useControllableState)({
|
88
|
-
value: index,
|
89
90
|
defaultValue: defaultIndex,
|
91
|
+
value: index,
|
90
92
|
onChange
|
91
93
|
});
|
92
94
|
const isVertical = orientation === "vertical";
|
93
95
|
const [carouselRef, carousel] = (0, import_embla_carousel_react.default)(
|
94
96
|
{
|
95
|
-
axis: isVertical ? "y" : "x",
|
96
|
-
startIndex: defaultIndex,
|
97
|
-
loop,
|
98
97
|
align,
|
99
|
-
|
100
|
-
|
98
|
+
axis: isVertical ? "y" : "x",
|
99
|
+
containScroll,
|
101
100
|
dragFree,
|
101
|
+
duration,
|
102
102
|
inViewThreshold,
|
103
|
+
loop,
|
103
104
|
skipSnaps,
|
104
|
-
|
105
|
+
slidesToScroll,
|
106
|
+
startIndex: defaultIndex,
|
105
107
|
watchDrag,
|
106
108
|
watchResize,
|
107
109
|
watchSlides
|
@@ -186,11 +188,20 @@ var useCarousel = ({
|
|
186
188
|
};
|
187
189
|
}
|
188
190
|
}, [carousel, onScroll]);
|
191
|
+
(0, import_utils.useUpdateEffect)(() => {
|
192
|
+
if (!carousel) return;
|
193
|
+
if (index === void 0) return;
|
194
|
+
carousel.scrollTo(index);
|
195
|
+
}, [index]);
|
189
196
|
const getContainerProps = (0, import_react.useCallback)(
|
190
197
|
(props = {}, ref = null) => ({
|
191
198
|
...containerProps,
|
192
199
|
...props,
|
193
200
|
ref,
|
201
|
+
vars: (0, import_core.mergeVars)(vars, [
|
202
|
+
{ name: "gap", token: "spaces", value: gap },
|
203
|
+
{ name: "slideSize", token: "sizes", value: slideSize }
|
204
|
+
]),
|
194
205
|
onMouseEnter: (0, import_utils.handlerAll)(props.onMouseEnter, () => {
|
195
206
|
setIsMouseEnter(true);
|
196
207
|
}),
|
@@ -198,7 +209,7 @@ var useCarousel = ({
|
|
198
209
|
setIsMouseEnter(false);
|
199
210
|
})
|
200
211
|
}),
|
201
|
-
[containerProps]
|
212
|
+
[containerProps, gap, slideSize, vars]
|
202
213
|
);
|
203
214
|
const getSlidesProps = (0, import_react.useCallback)(
|
204
215
|
(props = {}) => ({
|
@@ -211,20 +222,18 @@ var useCarousel = ({
|
|
211
222
|
return {
|
212
223
|
carousel,
|
213
224
|
children,
|
225
|
+
includeGapInSize,
|
214
226
|
indexes,
|
215
|
-
selectedIndex,
|
216
227
|
orientation,
|
217
|
-
|
218
|
-
gap,
|
228
|
+
selectedIndex,
|
219
229
|
slidesToScroll,
|
220
|
-
includeGapInSize,
|
221
230
|
getContainerProps,
|
222
231
|
getSlidesProps
|
223
232
|
};
|
224
233
|
};
|
225
234
|
var useCarouselSlide = ({ index }) => {
|
226
235
|
const { selectedIndex, slidesToScroll } = useCarouselContext();
|
227
|
-
index = Math.floor((index != null ? index : 0) /
|
236
|
+
index = Math.floor((index != null ? index : 0) / slidesToScroll);
|
228
237
|
const isSelected = index === selectedIndex;
|
229
238
|
const getSlideProps = (0, import_react.useCallback)(
|
230
239
|
(props = {}) => ({
|
@@ -264,7 +273,7 @@ var useCarouselControl = ({
|
|
264
273
|
return { getControlProps };
|
265
274
|
};
|
266
275
|
var useCarouselIndicators = () => {
|
267
|
-
const {
|
276
|
+
const { carousel, indexes, selectedIndex } = useCarouselContext();
|
268
277
|
const onClick = (0, import_react.useCallback)(
|
269
278
|
(ev, index) => {
|
270
279
|
if (!carousel) return;
|
@@ -299,7 +308,6 @@ var CarouselControlPrev = (0, import_core2.forwardRef)(
|
|
299
308
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
300
309
|
CarouselControl,
|
301
310
|
{
|
302
|
-
operation: "prev",
|
303
311
|
className: (0, import_utils2.cx)("ui-carousel__control--prev", className),
|
304
312
|
"aria-label": "Go to previous slide",
|
305
313
|
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
@@ -311,6 +319,7 @@ var CarouselControlPrev = (0, import_core2.forwardRef)(
|
|
311
319
|
}
|
312
320
|
}
|
313
321
|
),
|
322
|
+
operation: "prev",
|
314
323
|
...getControlProps(rest, ref)
|
315
324
|
}
|
316
325
|
);
|
@@ -325,7 +334,6 @@ var CarouselControlNext = (0, import_core2.forwardRef)(
|
|
325
334
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
326
335
|
CarouselControl,
|
327
336
|
{
|
328
|
-
operation: "next",
|
329
337
|
className: (0, import_utils2.cx)("ui-carousel__control--next", className),
|
330
338
|
"aria-label": "Go to next slide",
|
331
339
|
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
@@ -337,6 +345,7 @@ var CarouselControlNext = (0, import_core2.forwardRef)(
|
|
337
345
|
}
|
338
346
|
}
|
339
347
|
),
|
348
|
+
operation: "next",
|
340
349
|
...getControlProps(rest, ref)
|
341
350
|
}
|
342
351
|
);
|
@@ -374,13 +383,13 @@ var import_react2 = require("react");
|
|
374
383
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
375
384
|
var CarouselIndicators = (0, import_core3.forwardRef)(
|
376
385
|
({ className, component, ...rest }, ref) => {
|
377
|
-
const {
|
386
|
+
const { orientation, selectedIndex, styles } = useCarouselContext();
|
378
387
|
const { indexes, getIndicatorProps } = useCarouselIndicators();
|
379
388
|
const css = {
|
380
|
-
position: "absolute",
|
381
|
-
zIndex: "fallback(kurillin, 9)",
|
382
389
|
display: "flex",
|
383
390
|
justifyContent: "center",
|
391
|
+
position: "absolute",
|
392
|
+
zIndex: "fallback(kurillin, 9)",
|
384
393
|
...styles.indicators,
|
385
394
|
...orientation === "vertical" ? { flexDirection: "column" } : { flexDirection: "row" }
|
386
395
|
};
|
@@ -422,8 +431,8 @@ var CarouselIndicator = ({
|
|
422
431
|
import_core3.ui.button,
|
423
432
|
{
|
424
433
|
type: "button",
|
425
|
-
tabIndex: -1,
|
426
434
|
className: (0, import_utils3.cx)("ui-carousel__indicators__indicator", className),
|
435
|
+
tabIndex: -1,
|
427
436
|
__css: css,
|
428
437
|
...rest
|
429
438
|
}
|
@@ -438,13 +447,13 @@ var import_utils4 = require("@yamada-ui/utils");
|
|
438
447
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
439
448
|
var CarouselSlide = (0, import_core4.forwardRef)(
|
440
449
|
({ className, size, ...rest }, ref) => {
|
441
|
-
const {
|
450
|
+
const { includeGapInSize, orientation } = useCarouselContext();
|
442
451
|
const { getSlideProps } = useCarouselSlide(rest);
|
443
|
-
size != null ? size : size = slideSize;
|
452
|
+
size != null ? size : size = "$slideSize";
|
444
453
|
const css = {
|
445
|
-
position: "relative",
|
446
454
|
flex: `0 0 ${size}`,
|
447
|
-
|
455
|
+
position: "relative",
|
456
|
+
...includeGapInSize ? { [orientation === "vertical" ? "pb" : "pr"]: "$gap" } : { [orientation === "vertical" ? "mb" : "mr"]: "$gap" }
|
448
457
|
};
|
449
458
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
450
459
|
import_core4.ui.div,
|
@@ -466,8 +475,7 @@ var CarouselSlideInner = (0, import_core4.forwardRef)(
|
|
466
475
|
{
|
467
476
|
ref,
|
468
477
|
className: "ui-carousel__slide__inner",
|
469
|
-
|
470
|
-
h: "100%",
|
478
|
+
boxSize: "100%",
|
471
479
|
...rest
|
472
480
|
}
|
473
481
|
);
|
@@ -480,7 +488,6 @@ CarouselSlideInner.__ui__ = "CarouselSlideInner";
|
|
480
488
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
481
489
|
var Carousel = (0, import_core5.forwardRef)(
|
482
490
|
({ h, height, minH, minHeight, ...props }, ref) => {
|
483
|
-
var _a, _b;
|
484
491
|
const orientation = (0, import_use_value.useValue)(props.orientation);
|
485
492
|
const align = (0, import_use_value.useValue)(props.align);
|
486
493
|
const autoplay = (0, import_use_value.useValue)(props.autoplay);
|
@@ -495,43 +502,37 @@ var Carousel = (0, import_core5.forwardRef)(
|
|
495
502
|
const skipSnaps = (0, import_use_value.useValue)(props.skipSnaps);
|
496
503
|
const containScroll = (0, import_use_value.useValue)(props.containScroll);
|
497
504
|
const includeGapInSize = (0, import_use_value.useValue)(props.includeGapInSize);
|
498
|
-
const _gap = (0, import_use_value.useValue)(props.gap);
|
499
|
-
const gap = (_a = (0, import_use_token.useToken)("spaces", _gap)) != null ? _a : _gap;
|
500
|
-
const _slideSize = (0, import_use_value.useValue)(props.slideSize);
|
501
|
-
const slideSize = (_b = (0, import_use_token.useToken)("sizes", _slideSize)) != null ? _b : _slideSize;
|
502
505
|
const [styles, mergedProps] = (0, import_core5.useComponentMultiStyle)("Carousel", {
|
503
506
|
...props,
|
504
|
-
orientation,
|
505
507
|
align,
|
506
508
|
autoplay,
|
507
|
-
|
508
|
-
loop,
|
509
|
-
duration,
|
509
|
+
containScroll,
|
510
510
|
delay,
|
511
|
-
slidesToScroll,
|
512
|
-
draggable,
|
513
511
|
dragFree,
|
512
|
+
draggable,
|
513
|
+
duration,
|
514
|
+
includeGapInSize,
|
514
515
|
inViewThreshold,
|
516
|
+
loop,
|
517
|
+
orientation,
|
515
518
|
skipSnaps,
|
516
|
-
|
517
|
-
|
518
|
-
gap,
|
519
|
-
slideSize
|
519
|
+
slidesToScroll,
|
520
|
+
stopMouseEnterAutoplay
|
520
521
|
});
|
521
522
|
const {
|
522
523
|
className,
|
523
|
-
innerProps,
|
524
524
|
withControls = true,
|
525
|
-
controlProps,
|
526
|
-
controlPrevProps,
|
527
|
-
controlNextProps,
|
528
525
|
withIndicators = true,
|
526
|
+
controlNextProps,
|
527
|
+
controlPrevProps,
|
528
|
+
controlProps,
|
529
529
|
indicatorsProps,
|
530
|
+
innerProps,
|
530
531
|
...computedProps
|
531
532
|
} = (0, import_core5.omitThemeProps)(mergedProps);
|
532
533
|
const computedWithControls = (0, import_use_value.useValue)(withControls);
|
533
534
|
const computedWithIndicators = (0, import_use_value.useValue)(withIndicators);
|
534
|
-
const { getContainerProps, getSlidesProps,
|
535
|
+
const { children, getContainerProps, getSlidesProps, ...rest } = useCarousel({
|
535
536
|
...computedProps
|
536
537
|
});
|
537
538
|
const validChildren = (0, import_utils5.getValidChildren)(children);
|
@@ -558,17 +559,18 @@ var Carousel = (0, import_core5.forwardRef)(
|
|
558
559
|
const cloneSlideChildren = slideChildren.map(
|
559
560
|
(child, index) => (0, import_react3.cloneElement)(child, { index })
|
560
561
|
);
|
562
|
+
const css = {
|
563
|
+
h: "fit-content",
|
564
|
+
position: "relative",
|
565
|
+
...styles.container
|
566
|
+
};
|
561
567
|
h != null ? h : h = height;
|
562
568
|
minH != null ? minH : minH = minHeight;
|
563
569
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CarouselProvider, { value: { styles, ...rest }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
564
570
|
import_core5.ui.div,
|
565
571
|
{
|
566
572
|
className: (0, import_utils5.cx)("ui-carousel", className),
|
567
|
-
__css:
|
568
|
-
position: "relative",
|
569
|
-
h: "fit-content",
|
570
|
-
...styles.container
|
571
|
-
},
|
573
|
+
__css: css,
|
572
574
|
...getContainerProps({}, ref),
|
573
575
|
children: [
|
574
576
|
customCarouselControlPrev != null ? customCarouselControlPrev : computedWithControls ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CarouselControlPrev, { ...controlProps, ...controlPrevProps }) : null,
|
@@ -594,20 +596,19 @@ Carousel.displayName = "Carousel";
|
|
594
596
|
Carousel.__ui__ = "Carousel";
|
595
597
|
var CarouselSlides = (0, import_core5.forwardRef)(
|
596
598
|
({ ...rest }, ref) => {
|
597
|
-
const css = {
|
599
|
+
const css = { h: "fit-content", overflow: "hidden", w: "100%" };
|
598
600
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core5.ui.div, { ref, className: "ui-carousel__sliders", __css: css, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CarouselSlidesInner, { ...rest }) });
|
599
601
|
}
|
600
602
|
);
|
601
603
|
CarouselSlides.displayName = "CarouselSlides";
|
602
604
|
CarouselSlides.__ui__ = "CarouselSlides";
|
603
605
|
var CarouselSlidesInner = ({ ...rest }) => {
|
604
|
-
const {
|
606
|
+
const { includeGapInSize, orientation, styles } = useCarouselContext();
|
605
607
|
const css = {
|
606
608
|
display: "flex",
|
607
609
|
flexDirection: orientation === "vertical" ? "column" : "row",
|
608
610
|
...styles.inner,
|
609
611
|
...includeGapInSize ? {
|
610
|
-
vars: [{ name: "gap", token: "spaces", value: gap }],
|
611
612
|
[orientation === "vertical" ? "mb" : "mr"]: "calc($gap * -1)"
|
612
613
|
} : {}
|
613
614
|
};
|