@yamada-ui/carousel 2.0.8-next-20241022143327 → 2.1.0-dev-20241026110242
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/carousel-control.js +10 -10
- package/dist/carousel-control.js.map +1 -1
- package/dist/carousel-control.mjs +2 -2
- package/dist/carousel-indicators.js +109 -29
- package/dist/carousel-indicators.js.map +1 -1
- package/dist/carousel-indicators.mjs +2 -2
- package/dist/carousel-slide.js +9 -4
- package/dist/carousel-slide.js.map +1 -1
- package/dist/carousel-slide.mjs +2 -2
- package/dist/carousel.js +143 -51
- package/dist/carousel.js.map +1 -1
- package/dist/carousel.mjs +5 -5
- package/dist/{chunk-SYCPZC2C.mjs → chunk-2HSC64IV.mjs} +128 -23
- package/dist/chunk-2HSC64IV.mjs.map +1 -0
- package/dist/{chunk-WSTWB7CV.mjs → chunk-3TQFASU2.mjs} +8 -8
- package/dist/{chunk-WSTWB7CV.mjs.map → chunk-3TQFASU2.mjs.map} +1 -1
- package/dist/{chunk-CXXL47SC.mjs → chunk-GUUMIIYD.mjs} +2 -2
- package/dist/{chunk-UTOIPGGP.mjs → chunk-GXNJ5VYJ.mjs} +20 -21
- package/dist/chunk-GXNJ5VYJ.mjs.map +1 -0
- package/dist/{chunk-PEXGWNKB.mjs → chunk-HVGHVY6Y.mjs} +8 -10
- package/dist/chunk-HVGHVY6Y.mjs.map +1 -0
- package/dist/index.js +143 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/use-carousel.d.mts +4 -1
- package/dist/use-carousel.d.ts +4 -1
- package/dist/use-carousel.js +116 -21
- package/dist/use-carousel.js.map +1 -1
- package/dist/use-carousel.mjs +1 -1
- package/package.json +7 -7
- package/dist/chunk-PEXGWNKB.mjs.map +0 -1
- package/dist/chunk-SYCPZC2C.mjs.map +0 -1
- package/dist/chunk-UTOIPGGP.mjs.map +0 -1
- /package/dist/{chunk-CXXL47SC.mjs.map → chunk-GUUMIIYD.mjs.map} +0 -0
@@ -8,16 +8,27 @@ import {
|
|
8
8
|
createContext,
|
9
9
|
dataAttr,
|
10
10
|
handlerAll,
|
11
|
+
mergeRefs,
|
11
12
|
splitObject,
|
13
|
+
useUnmountEffect,
|
12
14
|
useUpdateEffect
|
13
15
|
} from "@yamada-ui/utils";
|
14
16
|
import useEmblaCarousel from "embla-carousel-react";
|
15
|
-
import {
|
17
|
+
import {
|
18
|
+
Children,
|
19
|
+
createRef,
|
20
|
+
useCallback,
|
21
|
+
useEffect,
|
22
|
+
useId,
|
23
|
+
useRef,
|
24
|
+
useState
|
25
|
+
} from "react";
|
16
26
|
var [CarouselProvider, useCarouselContext] = createContext({
|
17
27
|
name: "CarouselContext",
|
18
28
|
errorMessage: `useCarouselContext returned is 'undefined'. Seems you forgot to wrap the components in "<Carousel />"`
|
19
29
|
});
|
20
30
|
var useCarousel = ({
|
31
|
+
id,
|
21
32
|
align = "center",
|
22
33
|
autoplay = false,
|
23
34
|
children,
|
@@ -53,6 +64,9 @@ var useCarousel = ({
|
|
53
64
|
value: index,
|
54
65
|
onChange
|
55
66
|
});
|
67
|
+
const [indexes, setIndexes] = useState([]);
|
68
|
+
const [isMouseEnter, setIsMouseEnter] = useState(false);
|
69
|
+
const timeoutId = useRef(void 0);
|
56
70
|
const isVertical = orientation === "vertical";
|
57
71
|
const [carouselRef, carousel] = useEmblaCarousel(
|
58
72
|
{
|
@@ -72,10 +86,8 @@ var useCarousel = ({
|
|
72
86
|
},
|
73
87
|
[]
|
74
88
|
);
|
75
|
-
|
76
|
-
|
77
|
-
const [isMouseEnter, setIsMouseEnter] = useState(false);
|
78
|
-
const timeoutId = useRef(void 0);
|
89
|
+
const uuid = useId();
|
90
|
+
id != null ? id : id = uuid;
|
79
91
|
const onScroll = useCallback(() => {
|
80
92
|
if (!carousel) return;
|
81
93
|
const progress = Math.round(
|
@@ -155,8 +167,10 @@ var useCarousel = ({
|
|
155
167
|
if (index === void 0) return;
|
156
168
|
carousel.scrollTo(index);
|
157
169
|
}, [index]);
|
170
|
+
assignRef(controlRef, carousel);
|
158
171
|
const getContainerProps = useCallback(
|
159
172
|
(props = {}, ref = null) => ({
|
173
|
+
"aria-roledescription": "carousel",
|
160
174
|
...containerProps,
|
161
175
|
...props,
|
162
176
|
ref,
|
@@ -175,13 +189,16 @@ var useCarousel = ({
|
|
175
189
|
);
|
176
190
|
const getSlidesProps = useCallback(
|
177
191
|
(props = {}) => ({
|
192
|
+
id,
|
193
|
+
"aria-live": autoplay ? "off" : "polite",
|
178
194
|
...slidesProps,
|
179
195
|
...props,
|
180
196
|
ref: carouselRef
|
181
197
|
}),
|
182
|
-
[slidesProps, carouselRef]
|
198
|
+
[slidesProps, id, carouselRef, autoplay]
|
183
199
|
);
|
184
200
|
return {
|
201
|
+
id,
|
185
202
|
carousel,
|
186
203
|
children,
|
187
204
|
includeGapInSize,
|
@@ -194,16 +211,21 @@ var useCarousel = ({
|
|
194
211
|
};
|
195
212
|
};
|
196
213
|
var useCarouselSlide = ({ index }) => {
|
197
|
-
const { selectedIndex, slidesToScroll } = useCarouselContext();
|
214
|
+
const { id, indexes, selectedIndex, slidesToScroll } = useCarouselContext();
|
198
215
|
index = Math.floor((index != null ? index : 0) / slidesToScroll);
|
216
|
+
const totalSlides = indexes.length;
|
199
217
|
const isSelected = index === selectedIndex;
|
200
218
|
const getSlideProps = useCallback(
|
201
219
|
(props = {}) => ({
|
202
|
-
|
220
|
+
id: `${id}-${index + 1}`,
|
221
|
+
"aria-label": `${index + 1} of ${totalSlides}`,
|
222
|
+
"aria-roledescription": "slide",
|
203
223
|
"data-index": index,
|
204
|
-
"data-selected": dataAttr(isSelected)
|
224
|
+
"data-selected": dataAttr(isSelected),
|
225
|
+
role: "tabpanel",
|
226
|
+
...props
|
205
227
|
}),
|
206
|
-
[isSelected,
|
228
|
+
[id, index, isSelected, totalSlides]
|
207
229
|
);
|
208
230
|
return { getSlideProps };
|
209
231
|
};
|
@@ -212,7 +234,7 @@ var useCarouselControl = ({
|
|
212
234
|
...rest
|
213
235
|
}) => {
|
214
236
|
var _a, _b;
|
215
|
-
const { carousel } = useCarouselContext();
|
237
|
+
const { id, carousel } = useCarouselContext();
|
216
238
|
const isPrev = operation === "prev";
|
217
239
|
const disabled = (_b = (_a = rest.disabled) != null ? _a : rest.isDisabled) != null ? _b : isPrev ? !(carousel == null ? void 0 : carousel.canScrollPrev()) : !(carousel == null ? void 0 : carousel.canScrollNext());
|
218
240
|
const onClick = useCallback(() => {
|
@@ -225,40 +247,123 @@ var useCarouselControl = ({
|
|
225
247
|
}, [carousel, isPrev]);
|
226
248
|
const getControlProps = useCallback(
|
227
249
|
(props = {}, ref = null) => ({
|
250
|
+
"aria-controls": id,
|
251
|
+
"aria-label": `Go to ${isPrev ? "previous" : "next"} slide`,
|
228
252
|
...props,
|
229
253
|
ref,
|
230
254
|
disabled,
|
231
255
|
onClick: handlerAll(props.onClick, onClick)
|
232
256
|
}),
|
233
|
-
[disabled, onClick]
|
257
|
+
[disabled, id, onClick, isPrev]
|
234
258
|
);
|
235
259
|
return { getControlProps };
|
236
260
|
};
|
237
261
|
var useCarouselIndicators = () => {
|
238
|
-
const { carousel, indexes, selectedIndex } = useCarouselContext();
|
262
|
+
const { id, carousel, indexes, orientation, selectedIndex } = useCarouselContext();
|
263
|
+
const refMap = useRef(/* @__PURE__ */ new Map());
|
264
|
+
const isVertical = orientation === "vertical";
|
265
|
+
const onSelect = useCallback(
|
266
|
+
(index) => {
|
267
|
+
var _a;
|
268
|
+
const ref = refMap.current.get(index);
|
269
|
+
(_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.focus();
|
270
|
+
carousel == null ? void 0 : carousel.scrollTo(index);
|
271
|
+
},
|
272
|
+
[carousel]
|
273
|
+
);
|
239
274
|
const onClick = useCallback(
|
240
|
-
(
|
241
|
-
if (!carousel) return;
|
275
|
+
(index) => (ev) => {
|
242
276
|
ev.stopPropagation();
|
243
|
-
carousel.scrollTo(index);
|
277
|
+
carousel == null ? void 0 : carousel.scrollTo(index);
|
244
278
|
},
|
245
279
|
[carousel]
|
246
280
|
);
|
281
|
+
const onKeyDown = useCallback(
|
282
|
+
(index) => (ev) => {
|
283
|
+
const lastIndex = indexes.length - 1;
|
284
|
+
const actions = {
|
285
|
+
ArrowDown: () => {
|
286
|
+
if (!isVertical) return;
|
287
|
+
if (index === lastIndex) {
|
288
|
+
index = 0;
|
289
|
+
} else {
|
290
|
+
index += 1;
|
291
|
+
}
|
292
|
+
onSelect(index);
|
293
|
+
},
|
294
|
+
ArrowLeft: () => {
|
295
|
+
if (isVertical) return;
|
296
|
+
if (index === 0) {
|
297
|
+
index = lastIndex;
|
298
|
+
} else {
|
299
|
+
index -= 1;
|
300
|
+
}
|
301
|
+
onSelect(index);
|
302
|
+
},
|
303
|
+
ArrowRight: () => {
|
304
|
+
if (isVertical) return;
|
305
|
+
if (index === lastIndex) {
|
306
|
+
index = 0;
|
307
|
+
} else {
|
308
|
+
index += 1;
|
309
|
+
}
|
310
|
+
onSelect(index);
|
311
|
+
},
|
312
|
+
ArrowUp: () => {
|
313
|
+
if (!isVertical) return;
|
314
|
+
if (index === 0) {
|
315
|
+
index = lastIndex;
|
316
|
+
} else {
|
317
|
+
index -= 1;
|
318
|
+
}
|
319
|
+
onSelect(index);
|
320
|
+
},
|
321
|
+
End: () => onSelect(lastIndex),
|
322
|
+
Home: () => onSelect(0)
|
323
|
+
};
|
324
|
+
const action = actions[ev.key];
|
325
|
+
if (!action) return;
|
326
|
+
ev.preventDefault();
|
327
|
+
action(ev);
|
328
|
+
},
|
329
|
+
[indexes, onSelect, isVertical]
|
330
|
+
);
|
331
|
+
useUnmountEffect(() => {
|
332
|
+
refMap.current.clear();
|
333
|
+
});
|
334
|
+
const getIndicatorsProps = useCallback(
|
335
|
+
(props = {}, ref = null) => ({
|
336
|
+
"aria-label": "Sliders",
|
337
|
+
"aria-orientation": orientation,
|
338
|
+
role: "tablist",
|
339
|
+
...props,
|
340
|
+
ref
|
341
|
+
}),
|
342
|
+
[orientation]
|
343
|
+
);
|
247
344
|
const getIndicatorProps = useCallback(
|
248
|
-
({ index, ...props }) => {
|
345
|
+
({ index, ...props }, ref) => {
|
249
346
|
const isSelected = index === selectedIndex;
|
347
|
+
const internalRef = createRef();
|
348
|
+
refMap.current.set(index, internalRef);
|
250
349
|
return {
|
350
|
+
ref: mergeRefs(ref, internalRef),
|
351
|
+
"aria-controls": `${id}-${index + 1}`,
|
251
352
|
"aria-label": `Go to ${index + 1} slide`,
|
252
|
-
|
253
|
-
key: index,
|
353
|
+
"aria-selected": isSelected,
|
254
354
|
"data-index": index,
|
255
355
|
"data-selected": dataAttr(isSelected),
|
256
|
-
|
356
|
+
role: "tab",
|
357
|
+
tabIndex: isSelected ? 0 : -1,
|
358
|
+
...props,
|
359
|
+
key: index,
|
360
|
+
onClick: handlerAll(props.onClick, onClick(index)),
|
361
|
+
onKeyDown: handlerAll(props.onKeyDown, onKeyDown(index))
|
257
362
|
};
|
258
363
|
},
|
259
|
-
[onClick, selectedIndex]
|
364
|
+
[onClick, onKeyDown, selectedIndex, id]
|
260
365
|
);
|
261
|
-
return { indexes, getIndicatorProps };
|
366
|
+
return { indexes, getIndicatorProps, getIndicatorsProps };
|
262
367
|
};
|
263
368
|
|
264
369
|
export {
|
@@ -269,4 +374,4 @@ export {
|
|
269
374
|
useCarouselControl,
|
270
375
|
useCarouselIndicators
|
271
376
|
};
|
272
|
-
//# sourceMappingURL=chunk-
|
377
|
+
//# sourceMappingURL=chunk-2HSC64IV.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-carousel.ts"],"sourcesContent":["import type { IconButtonProps } from \"@yamada-ui/button\"\nimport type {\n CSSUIObject,\n CSSUIProps,\n HTMLProps,\n HTMLUIProps,\n PropGetter,\n RequiredPropGetter,\n} from \"@yamada-ui/core\"\nimport type { EmblaCarouselType, EmblaOptionsType } from \"embla-carousel\"\nimport type {\n KeyboardEvent,\n KeyboardEventHandler,\n MouseEvent,\n RefObject,\n} from \"react\"\nimport { layoutStyleProperties, mergeVars } from \"@yamada-ui/core\"\nimport { useControllableState } from \"@yamada-ui/use-controllable-state\"\nimport {\n assignRef,\n createContext,\n dataAttr,\n handlerAll,\n mergeRefs,\n splitObject,\n useUnmountEffect,\n useUpdateEffect,\n} from \"@yamada-ui/utils\"\nimport useEmblaCarousel from \"embla-carousel-react\"\nimport {\n Children,\n createRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from \"react\"\n\nexport type AlignmentOptionType = EmblaOptionsType[\"align\"]\nexport type ScrollContainOptionType = EmblaOptionsType[\"containScroll\"]\nexport type SlidesInViewOptionsType = EmblaOptionsType[\"inViewThreshold\"]\nexport type DragHandlerOptionType = EmblaOptionsType[\"watchDrag\"]\nexport type ResizeHandlerOptionType = EmblaOptionsType[\"watchResize\"]\nexport type SlidesHandlerOptionType = EmblaOptionsType[\"watchSlides\"]\nexport type CarouselControl = EmblaCarouselType\n\ninterface CarouselContext {\n id: string\n carousel: CarouselControl | undefined\n includeGapInSize: boolean\n indexes: number[]\n orientation: \"horizontal\" | \"vertical\"\n selectedIndex: number\n slidesToScroll: number\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [CarouselProvider, useCarouselContext] =\n createContext<CarouselContext>({\n name: \"CarouselContext\",\n errorMessage: `useCarouselContext returned is 'undefined'. Seems you forgot to wrap the components in \"<Carousel />\"`,\n })\n\nexport interface UseCarouselProps\n extends Omit<HTMLUIProps, \"draggable\" | \"gap\" | \"onChange\"> {\n /**\n * The alignment of the carousel.\n *\n * @default 'center'\n */\n align?: AlignmentOptionType\n /**\n * If `true`, the carousel will be autoplay.\n *\n * @default false\n */\n autoplay?: boolean\n /**\n * Clear leading and trailing empty space that causes excessive scrolling.\n * Use trimSnaps to only use snap points that trigger scrolling or keepSnaps to keep them.\n *\n * @default false\n */\n containScroll?: ScrollContainOptionType\n /**\n * Ref of the resizable item callback.\n */\n controlRef?: RefObject<CarouselControl | undefined>\n /**\n * The initial index of the carousel slide.\n *\n * @default 0\n */\n defaultIndex?: number\n /**\n * The number for the autoplay interval of the carousel.\n *\n * @default 4000\n */\n delay?: number\n /**\n * If `true`, momentum scrolling will be enabled.\n *\n * @default false\n */\n dragFree?: boolean\n /**\n * If `true`, carousel can be scrolled with mouse and touch interactions.\n *\n * @default true\n */\n draggable?: boolean\n /**\n * Set scroll duration when triggered by any of the API methods.\n * Higher numbers enables slower scrolling.\n * Drag interactions are not affected because duration is then determined by the drag force.\n *\n * @default 25\n */\n duration?: number\n /**\n * The CSS `gap` property.\n *\n * @default '4'\n */\n gap?: CSSUIProps[\"gap\"]\n /**\n * If `true`, gap will be treated as part of the carousel slide size.\n *\n * @default true\n */\n includeGapInSize?: boolean\n /**\n * The index of the carousel slide.\n */\n index?: number\n /**\n * Choose a fraction representing the percentage portion of a slide that needs to be visible in order to be considered in view.\n *\n * @default 0\n */\n inViewThreshold?: SlidesInViewOptionsType\n /**\n * If `true`, infinite looping.\n * Automatically falls back to false if slide content isn't enough to loop.\n *\n * @default true\n */\n loop?: boolean\n /**\n * The orientation of the carousel.\n *\n * @default 'horizontal'\n */\n orientation?: \"horizontal\" | \"vertical\"\n /**\n * If `true`, allow the carousel to skip scroll snaps if it's dragged vigorously.\n * Note that this option will be ignored if the dragFree option is set to true.\n *\n * @default false\n */\n skipSnaps?: boolean\n /**\n * The carousel slide width.\n *\n * @default '100%'\n */\n slideSize?: CSSUIProps[\"width\"]\n /**\n * The number of slides that should be scrolled with next or previous buttons.\n *\n * @default 1\n */\n slidesToScroll?: number\n /**\n * If `true`, autoplay will pause when the mouse entries over.\n *\n * @default true\n */\n stopMouseEnterAutoplay?: boolean\n /**\n * Enables for scrolling the carousel with mouse and touch interactions.\n * Set this to `false` to disable drag events or pass a custom callback to add your own drag logic.\n *\n * @default true\n */\n watchDrag?: DragHandlerOptionType\n /**\n * Embla automatically watches the container and slides for size changes and runs `reInit` when any size has changed.\n * Set this to `false` to disable this behaviour or pass a custom callback to add your own resize logic.\n *\n * @default true\n */\n watchResize?: ResizeHandlerOptionType\n /**\n * Embla automatically watches the container for added and/or removed slides and runs `reInit` if needed.\n * Set this to `false` to disable this behaviour or pass a custom callback to add your own slides changed logic.\n *\n * @default true\n */\n watchSlides?: SlidesHandlerOptionType\n /**\n * The callback invoked when carousel slide selected.\n */\n onChange?: (index: number) => void\n /**\n * A callback that return the current scroll amount when the carousel is scrolled.\n */\n onScrollProgress?: (progress: number) => void\n}\n\nexport const useCarousel = ({\n id,\n align = \"center\",\n autoplay = false,\n children,\n containScroll = false,\n controlRef,\n defaultIndex = 0,\n delay = 4000,\n dragFree = false,\n draggable = true,\n duration = 25,\n includeGapInSize = true,\n index,\n inViewThreshold = 0,\n loop = true,\n orientation = \"horizontal\",\n skipSnaps = false,\n slideSize = \"100%\",\n slidesToScroll = 1,\n stopMouseEnterAutoplay = true,\n watchDrag = draggable,\n watchResize = true,\n watchSlides = true,\n onChange,\n onScrollProgress,\n ...rest\n}: UseCarouselProps) => {\n const [\n { gap = \"fallback(4, 1rem)\", ...containerProps },\n { vars, ...slidesProps },\n ] = splitObject(rest, layoutStyleProperties)\n const [selectedIndex, setSelectedIndex] = useControllableState({\n defaultValue: defaultIndex,\n value: index,\n onChange,\n })\n const [indexes, setIndexes] = useState<number[]>([])\n const [isMouseEnter, setIsMouseEnter] = useState<boolean>(false)\n const timeoutId = useRef<any>(undefined)\n const isVertical = orientation === \"vertical\"\n const [carouselRef, carousel] = useEmblaCarousel(\n {\n align,\n axis: isVertical ? \"y\" : \"x\",\n containScroll,\n dragFree,\n duration,\n inViewThreshold,\n loop,\n skipSnaps,\n slidesToScroll,\n startIndex: defaultIndex,\n watchDrag,\n watchResize,\n watchSlides,\n },\n [],\n )\n const uuid = useId()\n\n id ??= uuid\n\n const onScroll = useCallback(() => {\n if (!carousel) return\n\n const progress = Math.round(\n Math.max(0, Math.min(1, carousel.scrollProgress())) * 100,\n )\n\n onScrollProgress?.(progress)\n }, [carousel, onScrollProgress])\n\n const onSelect = useCallback(() => {\n if (!carousel) return\n\n const index = carousel.selectedScrollSnap()\n\n setSelectedIndex(index)\n }, [carousel, setSelectedIndex])\n\n useEffect(() => {\n const isStop = isMouseEnter && stopMouseEnterAutoplay\n const isLast = !carousel?.canScrollNext()\n\n if (carousel && autoplay && !isStop && !isLast) {\n timeoutId.current = setInterval(() => {\n carousel.scrollNext()\n }, delay)\n } else {\n if (timeoutId.current) clearInterval(timeoutId.current)\n\n timeoutId.current = undefined\n }\n\n return () => {\n if (timeoutId.current) clearInterval(timeoutId.current)\n }\n }, [\n autoplay,\n delay,\n stopMouseEnterAutoplay,\n carousel,\n isMouseEnter,\n loop,\n selectedIndex,\n ])\n\n useUpdateEffect(() => {\n if (!carousel) return\n\n carousel.reInit()\n\n const snapList = carousel.scrollSnapList()\n const indexes = snapList.map((_, i) => i)\n\n setIndexes(indexes)\n }, [\n Children.toArray(children).length,\n align,\n orientation,\n loop,\n duration,\n gap,\n slidesToScroll,\n draggable,\n dragFree,\n inViewThreshold,\n skipSnaps,\n containScroll,\n slideSize,\n includeGapInSize,\n ])\n\n useUpdateEffect(() => {\n if (!carousel) return\n\n const snapList = carousel.scrollSnapList()\n const indexes = snapList.map((_, i) => i)\n\n setIndexes(indexes)\n }, [carousel])\n\n useUpdateEffect(() => {\n if (carousel) {\n carousel.on(\"select\", onSelect)\n carousel.on(\"scroll\", onScroll)\n\n onScroll()\n\n return () => {\n carousel.off(\"select\", onSelect)\n carousel.off(\"scroll\", onScroll)\n }\n }\n }, [carousel, onScroll])\n\n useUpdateEffect(() => {\n if (!carousel) return\n\n if (index === undefined) return\n\n carousel.scrollTo(index)\n }, [index])\n\n assignRef(controlRef, carousel)\n\n const getContainerProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n \"aria-roledescription\": \"carousel\",\n ...containerProps,\n ...props,\n ref,\n vars: mergeVars(vars, [\n { name: \"gap\", token: \"spaces\", value: gap },\n { name: \"slideSize\", token: \"sizes\", value: slideSize },\n ]),\n onMouseEnter: handlerAll(props.onMouseEnter, () => {\n setIsMouseEnter(true)\n }),\n onMouseLeave: handlerAll(props.onMouseLeave, () => {\n setIsMouseEnter(false)\n }),\n }),\n [containerProps, gap, slideSize, vars],\n )\n\n const getSlidesProps: PropGetter = useCallback(\n (props = {}) => ({\n id,\n \"aria-live\": autoplay ? \"off\" : \"polite\",\n ...slidesProps,\n ...props,\n ref: carouselRef,\n }),\n [slidesProps, id, carouselRef, autoplay],\n )\n\n return {\n id,\n carousel,\n children,\n includeGapInSize,\n indexes,\n orientation,\n selectedIndex,\n slidesToScroll,\n getContainerProps,\n getSlidesProps,\n }\n}\n\nexport type UseCarouselReturn = ReturnType<typeof useCarousel>\n\nexport interface UseCarouselSlideProps {\n index?: number\n}\n\nexport const useCarouselSlide = ({ index }: UseCarouselSlideProps) => {\n const { id, indexes, selectedIndex, slidesToScroll } = useCarouselContext()\n\n index = Math.floor((index ?? 0) / slidesToScroll)\n\n const totalSlides = indexes.length\n const isSelected = index === selectedIndex\n\n const getSlideProps: PropGetter = useCallback(\n (props = {}) => ({\n id: `${id}-${index + 1}`,\n \"aria-label\": `${index + 1} of ${totalSlides}`,\n \"aria-roledescription\": \"slide\",\n \"data-index\": index,\n \"data-selected\": dataAttr(isSelected),\n role: \"tabpanel\",\n ...props,\n }),\n [id, index, isSelected, totalSlides],\n )\n\n return { getSlideProps }\n}\n\nexport type UseCarouselSlideReturn = ReturnType<typeof useCarouselSlide>\n\nexport interface UseCarouselControlProps extends IconButtonProps {\n operation: \"next\" | \"prev\"\n}\n\nexport const useCarouselControl = ({\n operation,\n ...rest\n}: UseCarouselControlProps) => {\n const { id, carousel } = useCarouselContext()\n\n const isPrev = operation === \"prev\"\n\n const disabled =\n rest.disabled ??\n rest.isDisabled ??\n (isPrev ? !carousel?.canScrollPrev() : !carousel?.canScrollNext())\n\n const onClick = useCallback(() => {\n if (!carousel) return\n\n if (isPrev) {\n carousel.scrollPrev()\n } else {\n carousel.scrollNext()\n }\n }, [carousel, isPrev])\n\n const getControlProps: PropGetter<\"button\"> = useCallback(\n (props = {}, ref = null) => ({\n \"aria-controls\": id,\n \"aria-label\": `Go to ${isPrev ? \"previous\" : \"next\"} slide`,\n ...props,\n ref,\n disabled,\n onClick: handlerAll(props.onClick, onClick),\n }),\n [disabled, id, onClick, isPrev],\n )\n\n return { getControlProps }\n}\n\nexport type UseCarouselControlReturn = ReturnType<typeof useCarouselControl>\n\nexport const useCarouselIndicators = () => {\n const { id, carousel, indexes, orientation, selectedIndex } =\n useCarouselContext()\n const refMap = useRef<Map<number, RefObject<HTMLButtonElement>>>(new Map())\n const isVertical = orientation === \"vertical\"\n\n const onSelect = useCallback(\n (index: number) => {\n const ref = refMap.current.get(index)\n\n ref?.current?.focus()\n carousel?.scrollTo(index)\n },\n [carousel],\n )\n\n const onClick = useCallback(\n (index: number) => (ev: MouseEvent) => {\n ev.stopPropagation()\n\n carousel?.scrollTo(index)\n },\n [carousel],\n )\n\n const onKeyDown = useCallback(\n (index: number) => (ev: KeyboardEvent) => {\n const lastIndex = indexes.length - 1\n\n const actions: { [key: string]: KeyboardEventHandler } = {\n ArrowDown: () => {\n if (!isVertical) return\n\n if (index === lastIndex) {\n index = 0\n } else {\n index += 1\n }\n\n onSelect(index)\n },\n ArrowLeft: () => {\n if (isVertical) return\n\n if (index === 0) {\n index = lastIndex\n } else {\n index -= 1\n }\n\n onSelect(index)\n },\n ArrowRight: () => {\n if (isVertical) return\n\n if (index === lastIndex) {\n index = 0\n } else {\n index += 1\n }\n\n onSelect(index)\n },\n ArrowUp: () => {\n if (!isVertical) return\n\n if (index === 0) {\n index = lastIndex\n } else {\n index -= 1\n }\n\n onSelect(index)\n },\n End: () => onSelect(lastIndex),\n Home: () => onSelect(0),\n }\n\n const action = actions[ev.key]\n\n if (!action) return\n\n ev.preventDefault()\n action(ev)\n },\n [indexes, onSelect, isVertical],\n )\n\n useUnmountEffect(() => {\n refMap.current.clear()\n })\n\n const getIndicatorsProps: PropGetter = useCallback(\n (props = {}, ref = null) => ({\n \"aria-label\": \"Sliders\",\n \"aria-orientation\": orientation,\n role: \"tablist\",\n ...props,\n ref,\n }),\n [orientation],\n )\n\n const getIndicatorProps: RequiredPropGetter<\n { index: number } & HTMLProps<\"button\">,\n HTMLProps<\"button\">\n > = useCallback(\n ({ index, ...props }, ref) => {\n const isSelected = index === selectedIndex\n const internalRef = createRef<HTMLButtonElement>()\n\n refMap.current.set(index, internalRef)\n\n return {\n ref: mergeRefs(ref, internalRef),\n \"aria-controls\": `${id}-${index + 1}`,\n \"aria-label\": `Go to ${index + 1} slide`,\n \"aria-selected\": isSelected,\n \"data-index\": index,\n \"data-selected\": dataAttr(isSelected),\n role: \"tab\",\n tabIndex: isSelected ? 0 : -1,\n ...props,\n key: index,\n onClick: handlerAll(props.onClick, onClick(index)),\n onKeyDown: handlerAll(props.onKeyDown, onKeyDown(index)),\n }\n },\n [onClick, onKeyDown, selectedIndex, id],\n )\n\n return { indexes, getIndicatorProps, getIndicatorsProps }\n}\n\nexport type UseCarouselIndicatorsReturn = ReturnType<\n typeof useCarouselIndicators\n>\n"],"mappings":";;;AAgBA,SAAS,uBAAuB,iBAAiB;AACjD,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,sBAAsB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAqBA,IAAM,CAAC,kBAAkB,kBAAkB,IAChD,cAA+B;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AAsJI,IAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA,QAAQ;AAAA,EACR,WAAW;AAAA,EACX;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,mBAAm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 @@
|
|
2
2
|
import {
|
3
3
|
CarouselControlNext,
|
4
4
|
CarouselControlPrev
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-HVGHVY6Y.mjs";
|
6
6
|
import {
|
7
7
|
CarouselIndicators
|
8
|
-
} from "./chunk-
|
8
|
+
} from "./chunk-GXNJ5VYJ.mjs";
|
9
9
|
import {
|
10
10
|
CarouselSlide
|
11
|
-
} from "./chunk-
|
11
|
+
} from "./chunk-GUUMIIYD.mjs";
|
12
12
|
import {
|
13
13
|
CarouselProvider,
|
14
14
|
useCarousel,
|
15
15
|
useCarouselContext
|
16
|
-
} from "./chunk-
|
16
|
+
} from "./chunk-2HSC64IV.mjs";
|
17
17
|
|
18
18
|
// src/carousel.tsx
|
19
19
|
import {
|
@@ -79,7 +79,7 @@ var Carousel = forwardRef(
|
|
79
79
|
} = omitThemeProps(mergedProps);
|
80
80
|
const computedWithControls = useValue(withControls);
|
81
81
|
const computedWithIndicators = useValue(withIndicators);
|
82
|
-
const { children, getContainerProps, getSlidesProps, ...rest } = useCarousel({
|
82
|
+
const { id, children, getContainerProps, getSlidesProps, ...rest } = useCarousel({
|
83
83
|
...computedProps
|
84
84
|
});
|
85
85
|
const validChildren = getValidChildren(children);
|
@@ -113,8 +113,8 @@ var Carousel = forwardRef(
|
|
113
113
|
};
|
114
114
|
h != null ? h : h = height;
|
115
115
|
minH != null ? minH : minH = minHeight;
|
116
|
-
return /* @__PURE__ */ jsx(CarouselProvider, { value: { styles, ...rest }, children: /* @__PURE__ */ jsxs(
|
117
|
-
ui.
|
116
|
+
return /* @__PURE__ */ jsx(CarouselProvider, { value: { id, styles, ...rest }, children: /* @__PURE__ */ jsxs(
|
117
|
+
ui.section,
|
118
118
|
{
|
119
119
|
className: cx("ui-carousel", className),
|
120
120
|
__css: css,
|
@@ -167,4 +167,4 @@ CarouselSlidesInner.__ui__ = "CarouselSlidesInner";
|
|
167
167
|
export {
|
168
168
|
Carousel
|
169
169
|
};
|
170
|
-
//# sourceMappingURL=chunk-
|
170
|
+
//# sourceMappingURL=chunk-3TQFASU2.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/carousel.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n FC,\n HTMLUIProps,\n ThemeProps,\n Token,\n} from \"@yamada-ui/core\"\nimport type { CarouselControlProps } from \"./carousel-control\"\nimport type { CarouselIndicatorsProps } from \"./carousel-indicators\"\nimport type {\n AlignmentOptionType,\n ScrollContainOptionType,\n SlidesInViewOptionsType,\n UseCarouselProps,\n} from \"./use-carousel\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport {\n cx,\n filterUndefined,\n findChild,\n getValidChildren,\n omitChildren,\n pickChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { CarouselControlNext, CarouselControlPrev } from \"./carousel-control\"\nimport { CarouselIndicators } from \"./carousel-indicators\"\nimport { CarouselSlide } from \"./carousel-slide\"\nimport {\n CarouselProvider,\n useCarousel,\n useCarouselContext,\n} from \"./use-carousel\"\n\ninterface CarouselOptions {\n /**\n * The alignment of the carousel.\n *\n * @default 'center'\n */\n align?: Token<AlignmentOptionType>\n /**\n * If `true`, the carousel will be autoplay.\n *\n * @default false\n */\n autoplay?: Token<boolean>\n /**\n * Clear leading and trailing empty space that causes excessive scrolling.\n * Use trimSnaps to only use snap points that trigger scrolling or keepSnaps to keep them.\n *\n * @default ''\n */\n containScroll?: Token<ScrollContainOptionType>\n /**\n * The number for the autoplay interval of the carousel.\n *\n * @default 4000\n */\n delay?: Token<number>\n /**\n * If `true`, momentum scrolling will be enabled.\n *\n * @default false\n */\n dragFree?: Token<boolean>\n /**\n * If `true`, carousel can be scrolled with mouse and touch interactions.\n *\n * @default true\n */\n draggable?: Token<boolean>\n /**\n * Set scroll duration when triggered by any of the API methods.\n * Higher numbers enables slower scrolling.\n * Drag interactions are not affected because duration is then determined by the drag force.\n *\n * @default 25\n */\n duration?: Token<number>\n /**\n * If `true`, gap will be treated as part of the carousel slide size.\n *\n * @default true\n */\n includeGapInSize?: Token<boolean>\n /**\n * Choose a fraction representing the percentage portion of a slide that needs to be visible in order to be considered in view.\n *\n * @default 0\n */\n inViewThreshold?: Token<SlidesInViewOptionsType>\n /**\n * If `true`, infinite looping.\n * Automatically falls back to false if slide content isn't enough to loop.\n *\n * @default true\n */\n loop?: Token<boolean>\n /**\n * The orientation of the carousel.\n *\n * @default 'horizontal'\n */\n orientation?: Token<\"horizontal\" | \"vertical\">\n /**\n * If `true`, allow the carousel to skip scroll snaps if it's dragged vigorously.\n * Note that this option will be ignored if the dragFree option is set to true.\n *\n * @default false\n */\n skipSnaps?: Token<boolean>\n /**\n * The CSS `width` property.\n */\n slideSize?: CSSUIProps[\"width\"]\n /**\n * The number of slides that should be scrolled with next or previous buttons.\n *\n * @default 1\n */\n slidesToScroll?: Token<number>\n /**\n * If `true`, autoplay will pause when the mouse entries over.\n *\n * @default true\n */\n stopMouseEnterAutoplay?: Token<boolean>\n /**\n * If `true`, display the carousel control buttons.\n *\n * @default true\n */\n withControls?: Token<boolean>\n /**\n * If `true`, display the carousel indicator buttons.\n *\n * @default true\n */\n withIndicators?: Token<boolean>\n /**\n * Props for next of the carousel control element.\n */\n controlNextProps?: CarouselControlProps\n /**\n * Props for previous of the carousel control element.\n */\n controlPrevProps?: CarouselControlProps\n /**\n * Props for carousel control element.\n */\n controlProps?: CarouselControlProps\n /**\n * Props for carousel indicators element.\n */\n indicatorsProps?: CarouselIndicatorsProps\n /**\n * Props for carousel inner element.\n */\n innerProps?: HTMLUIProps\n}\n\nexport interface CarouselProps\n extends ThemeProps<\"Carousel\">,\n Omit<HTMLUIProps, \"draggable\" | \"onChange\">,\n Pick<\n UseCarouselProps,\n | \"controlRef\"\n | \"defaultIndex\"\n | \"index\"\n | \"onChange\"\n | \"onScrollProgress\"\n | \"watchDrag\"\n | \"watchResize\"\n | \"watchSlides\"\n >,\n CarouselOptions {}\n\n/**\n * `Carousel` is a component that displays multiple elements like a slideshow.\n *\n * @see Docs https://yamada-ui.com/components/data-display/carousel\n */\nexport const Carousel = forwardRef<CarouselProps, \"div\">(\n ({ h, height, minH, minHeight, ...props }, ref) => {\n const orientation = useValue(props.orientation)\n const align = useValue(props.align)\n const autoplay = useValue(props.autoplay)\n const stopMouseEnterAutoplay = useValue(props.stopMouseEnterAutoplay)\n const loop = useValue(props.loop)\n const duration = useValue(props.duration)\n const delay = useValue(props.delay)\n const slidesToScroll = useValue(props.slidesToScroll)\n const draggable = useValue(props.draggable)\n const dragFree = useValue(props.dragFree)\n const inViewThreshold = useValue(props.inViewThreshold)\n const skipSnaps = useValue(props.skipSnaps)\n const containScroll = useValue(props.containScroll)\n const includeGapInSize = useValue(props.includeGapInSize)\n\n const [styles, mergedProps] = useComponentMultiStyle(\"Carousel\", {\n ...props,\n align,\n autoplay,\n containScroll,\n delay,\n dragFree,\n draggable,\n duration,\n includeGapInSize,\n inViewThreshold,\n loop,\n orientation,\n skipSnaps,\n slidesToScroll,\n stopMouseEnterAutoplay,\n })\n const {\n className,\n withControls = true,\n withIndicators = true,\n controlNextProps,\n controlPrevProps,\n controlProps,\n indicatorsProps,\n innerProps,\n ...computedProps\n } = omitThemeProps(mergedProps)\n\n const computedWithControls = useValue(withControls)\n const computedWithIndicators = useValue(withIndicators)\n\n const { children, getContainerProps, getSlidesProps, ...rest } =\n useCarousel({\n ...computedProps,\n })\n\n const validChildren = getValidChildren(children)\n\n const customCarouselControlPrev = findChild(\n validChildren,\n CarouselControlPrev,\n )\n const customCarouselControlNext = findChild(\n validChildren,\n CarouselControlNext,\n )\n const customCarouselIndicators = findChild(\n validChildren,\n CarouselIndicators,\n )\n const slideChildren = pickChildren(validChildren, CarouselSlide)\n const otherChildren = omitChildren(\n validChildren,\n CarouselControlPrev,\n CarouselControlNext,\n CarouselIndicators,\n CarouselSlide,\n )\n\n const cloneSlideChildren = slideChildren.map((child, index) =>\n cloneElement(child, { index }),\n )\n\n const css: CSSUIObject = {\n h: \"fit-content\",\n position: \"relative\",\n ...styles.container,\n }\n\n h ??= height\n minH ??= minHeight\n\n return (\n <CarouselProvider value={{ styles, ...rest }}>\n <ui.div\n className={cx(\"ui-carousel\", className)}\n __css={css}\n {...getContainerProps({}, ref)}\n >\n {customCarouselControlPrev ??\n (computedWithControls ? (\n <CarouselControlPrev {...controlProps} {...controlPrevProps} />\n ) : null)}\n {customCarouselControlNext ??\n (computedWithControls ? (\n <CarouselControlNext {...controlProps} {...controlNextProps} />\n ) : null)}\n\n <CarouselSlides\n {...getSlidesProps({\n ...filterUndefined({ h, minH }),\n ...innerProps,\n })}\n >\n {cloneSlideChildren}\n </CarouselSlides>\n\n {customCarouselIndicators ??\n (computedWithIndicators ? (\n <CarouselIndicators {...indicatorsProps} />\n ) : null)}\n\n {otherChildren}\n </ui.div>\n </CarouselProvider>\n )\n },\n)\n\nCarousel.displayName = \"Carousel\"\nCarousel.__ui__ = \"Carousel\"\n\ninterface CarouselSlidesProps extends HTMLUIProps {}\n\nconst CarouselSlides = forwardRef<CarouselSlidesProps, \"div\">(\n ({ ...rest }, ref) => {\n const css: CSSUIObject = { h: \"fit-content\", overflow: \"hidden\", w: \"100%\" }\n\n return (\n <ui.div ref={ref} className=\"ui-carousel__sliders\" __css={css}>\n <CarouselSlidesInner {...rest} />\n </ui.div>\n )\n },\n)\n\nCarouselSlides.displayName = \"CarouselSlides\"\nCarouselSlides.__ui__ = \"CarouselSlides\"\n\ninterface CarouselSlidesInnerProps extends HTMLUIProps {}\n\nconst CarouselSlidesInner: FC<CarouselSlidesInnerProps> = ({ ...rest }) => {\n const { includeGapInSize, orientation, styles } = useCarouselContext()\n\n const css: CSSUIObject = {\n display: \"flex\",\n flexDirection: orientation === \"vertical\" ? \"column\" : \"row\",\n ...styles.inner,\n ...(includeGapInSize\n ? {\n [orientation === \"vertical\" ? \"mb\" : \"mr\"]: \"calc($gap * -1)\",\n }\n : {}),\n }\n\n return (\n <ui.div className=\"ui-carousel__sliders__inner\" __css={css} {...rest} />\n )\n}\n\nCarouselSlidesInner.displayName = \"CarouselSlidesInner\"\nCarouselSlidesInner.__ui__ = \"CarouselSlidesInner\"\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AA2PrB,SAOM,KAPN;AA5FD,IAAM,WAAW;AAAA,EACtB,CAAC,EAAE,GAAG,QAAQ,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ;AACjD,UAAM,cAAc,SAAS,MAAM,WAAW;AAC9C,UAAM,QAAQ,SAAS,MAAM,KAAK;AAClC,UAAM,WAAW,SAAS,MAAM,QAAQ;AACxC,UAAM,yBAAyB,SAAS,MAAM,sBAAsB;AACpE,UAAM,OAAO,SAAS,MAAM,IAAI;AAChC,UAAM,WAAW,SAAS,MAAM,QAAQ;AACxC,UAAM,QAAQ,SAAS,MAAM,KAAK;AAClC,UAAM,iBAAiB,SAAS,MAAM,cAAc;AACpD,UAAM,YAAY,SAAS,MAAM,SAAS;AAC1C,UAAM,WAAW,SAAS,MAAM,QAAQ;AACxC,UAAM,kBAAkB,SAAS,MAAM,eAAe;AACtD,UAAM,YAAY,SAAS,MAAM,SAAS;AAC1C,UAAM,gBAAgB,SAAS,MAAM,aAAa;AAClD,UAAM,mBAAmB,SAAS,MAAM,gBAAgB;AAExD,UAAM,CAAC,QAAQ,WAAW,IAAI,uBAAuB,YAAY;AAAA,MAC/D,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AA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kB,IAC3D;AAAA,UAEN;AAAA,YAAC;AAAA;AAAA,cACE,GAAG,eAAe;AAAA,gBACjB,GAAG,gBAAgB,EAAE,GAAG,KAAK,CAAC;AAAA,gBAC9B,GAAG;AAAA,cACL,CAAC;AAAA,cAEA;AAAA;AAAA,UACH;AAAA,UAEC,8DACE,yBACC,oBAAC,sBAAoB,GAAG,iBAAiB,IACvC;AAAA,UAEL;AAAA;AAAA;AAAA,IACH,GACF;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;AACvB,SAAS,SAAS;AAIlB,IAAM,iBAAiB;AAAA,EACrB,CAAC,EAAE,GAAG,KAAK,GAAG,QAAQ;AACpB,UAAM,MAAmB,EAAE,GAAG,eAAe,UAAU,UAAU,GAAG,OAAO;AAE3E,WACE,oBAAC,GAAG,KAAH,EAAO,KAAU,WAAU,wBAAuB,OAAO,KACxD,8BAAC,uBAAqB,GAAG,MAAM,GACjC;AAAA,EAEJ;AACF;AAEA,eAAe,cAAc;AAC7B,eAAe,SAAS;AAIxB,IAAM,sBAAoD,CAAC,EAAE,GAAG,KAAK,MAAM;AACzE,QAAM,EAAE,kBAAkB,aAAa,OAAO,IAAI,mBAAmB;AAErE,QAAM,MAAmB;AAAA,IACvB,SAAS;AAAA,IACT,eAAe,gBAAgB,aAAa,WAAW;AAAA,IACvD,GAAG,OAAO;AAAA,IACV,GAAI,mBACA;AAAA,MACE,CAAC,gBAAgB,aAAa,OAAO,IAAI,GAAG;AAAA,IAC9C,IACA,CAAC;AAAA,EACP;AAEA,SACE,oBAAC,GAAG,KAAH,EAAO,WAAU,+BAA8B,OAAO,KAAM,GAAG,MAAM;AAE1E;AAEA,oBAAoB,cAAc;AAClC,oBAAoB,SAAS;","names":[]}
|
1
|
+
{"version":3,"sources":["../src/carousel.tsx"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n FC,\n HTMLUIProps,\n ThemeProps,\n Token,\n} from \"@yamada-ui/core\"\nimport type { CarouselControlProps } from \"./carousel-control\"\nimport type { CarouselIndicatorsProps } from \"./carousel-indicators\"\nimport type {\n AlignmentOptionType,\n ScrollContainOptionType,\n SlidesInViewOptionsType,\n UseCarouselProps,\n} from \"./use-carousel\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport {\n cx,\n filterUndefined,\n findChild,\n getValidChildren,\n omitChildren,\n pickChildren,\n} from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { CarouselControlNext, CarouselControlPrev } from \"./carousel-control\"\nimport { CarouselIndicators } from \"./carousel-indicators\"\nimport { CarouselSlide } from \"./carousel-slide\"\nimport {\n CarouselProvider,\n useCarousel,\n useCarouselContext,\n} from \"./use-carousel\"\n\ninterface CarouselOptions {\n /**\n * The alignment of the carousel.\n *\n * @default 'center'\n */\n align?: Token<AlignmentOptionType>\n /**\n * If `true`, the carousel will be autoplay.\n *\n * @default false\n */\n autoplay?: Token<boolean>\n /**\n * Clear leading and trailing empty space that causes excessive scrolling.\n * Use trimSnaps to only use snap points that trigger scrolling or keepSnaps to keep them.\n *\n * @default ''\n */\n containScroll?: Token<ScrollContainOptionType>\n /**\n * The number for the autoplay interval of the carousel.\n *\n * @default 4000\n */\n delay?: Token<number>\n /**\n * If `true`, momentum scrolling will be enabled.\n *\n * @default false\n */\n dragFree?: Token<boolean>\n /**\n * If `true`, carousel can be scrolled with mouse and touch interactions.\n *\n * @default true\n */\n draggable?: Token<boolean>\n /**\n * Set scroll duration when triggered by any of the API methods.\n * Higher numbers enables slower scrolling.\n * Drag interactions are not affected because duration is then determined by the drag force.\n *\n * @default 25\n */\n duration?: Token<number>\n /**\n * If `true`, gap will be treated as part of the carousel slide size.\n *\n * @default true\n */\n includeGapInSize?: Token<boolean>\n /**\n * Choose a fraction representing the percentage portion of a slide that needs to be visible in order to be considered in view.\n *\n * @default 0\n */\n inViewThreshold?: Token<SlidesInViewOptionsType>\n /**\n * If `true`, infinite looping.\n * Automatically falls back to false if slide content isn't enough to loop.\n *\n * @default true\n */\n loop?: Token<boolean>\n /**\n * The orientation of the carousel.\n *\n * @default 'horizontal'\n */\n orientation?: Token<\"horizontal\" | \"vertical\">\n /**\n * If `true`, allow the carousel to skip scroll snaps if it's dragged vigorously.\n * Note that this option will be ignored if the dragFree option is set to true.\n *\n * @default false\n */\n skipSnaps?: Token<boolean>\n /**\n * The CSS `width` property.\n */\n slideSize?: CSSUIProps[\"width\"]\n /**\n * The number of slides that should be scrolled with next or previous buttons.\n *\n * @default 1\n */\n slidesToScroll?: Token<number>\n /**\n * If `true`, autoplay will pause when the mouse entries over.\n *\n * @default true\n */\n stopMouseEnterAutoplay?: Token<boolean>\n /**\n * If `true`, display the carousel control buttons.\n *\n * @default true\n */\n withControls?: Token<boolean>\n /**\n * If `true`, display the carousel indicator buttons.\n *\n * @default true\n */\n withIndicators?: Token<boolean>\n /**\n * Props for next of the carousel control element.\n */\n controlNextProps?: CarouselControlProps\n /**\n * Props for previous of the carousel control element.\n */\n controlPrevProps?: CarouselControlProps\n /**\n * Props for carousel control element.\n */\n controlProps?: CarouselControlProps\n /**\n * Props for carousel indicators element.\n */\n indicatorsProps?: CarouselIndicatorsProps\n /**\n * Props for carousel inner element.\n */\n innerProps?: HTMLUIProps\n}\n\nexport interface CarouselProps\n extends ThemeProps<\"Carousel\">,\n Omit<HTMLUIProps, \"draggable\" | \"onChange\">,\n Pick<\n UseCarouselProps,\n | \"controlRef\"\n | \"defaultIndex\"\n | \"index\"\n | \"onChange\"\n | \"onScrollProgress\"\n | \"watchDrag\"\n | \"watchResize\"\n | \"watchSlides\"\n >,\n CarouselOptions {}\n\n/**\n * `Carousel` is a component that displays multiple elements like a slideshow.\n *\n * @see Docs https://yamada-ui.com/components/data-display/carousel\n */\nexport const Carousel = forwardRef<CarouselProps, \"div\">(\n ({ h, height, minH, minHeight, ...props }, ref) => {\n const orientation = useValue(props.orientation)\n const align = useValue(props.align)\n const autoplay = useValue(props.autoplay)\n const stopMouseEnterAutoplay = useValue(props.stopMouseEnterAutoplay)\n const loop = useValue(props.loop)\n const duration = useValue(props.duration)\n const delay = useValue(props.delay)\n const slidesToScroll = useValue(props.slidesToScroll)\n const draggable = useValue(props.draggable)\n const dragFree = useValue(props.dragFree)\n const inViewThreshold = useValue(props.inViewThreshold)\n const skipSnaps = useValue(props.skipSnaps)\n const containScroll = useValue(props.containScroll)\n const includeGapInSize = useValue(props.includeGapInSize)\n\n const [styles, mergedProps] = useComponentMultiStyle(\"Carousel\", {\n ...props,\n align,\n autoplay,\n containScroll,\n delay,\n dragFree,\n draggable,\n duration,\n includeGapInSize,\n inViewThreshold,\n loop,\n orientation,\n skipSnaps,\n slidesToScroll,\n stopMouseEnterAutoplay,\n })\n const {\n className,\n withControls = true,\n withIndicators = true,\n controlNextProps,\n controlPrevProps,\n controlProps,\n indicatorsProps,\n innerProps,\n ...computedProps\n } = omitThemeProps(mergedProps)\n const computedWithControls = useValue(withControls)\n const computedWithIndicators = useValue(withIndicators)\n const { id, children, getContainerProps, getSlidesProps, ...rest } =\n useCarousel({\n ...computedProps,\n })\n\n const validChildren = getValidChildren(children)\n const customCarouselControlPrev = findChild(\n validChildren,\n CarouselControlPrev,\n )\n const customCarouselControlNext = findChild(\n validChildren,\n CarouselControlNext,\n )\n const customCarouselIndicators = findChild(\n validChildren,\n CarouselIndicators,\n )\n const slideChildren = pickChildren(validChildren, CarouselSlide)\n const otherChildren = omitChildren(\n validChildren,\n CarouselControlPrev,\n CarouselControlNext,\n CarouselIndicators,\n CarouselSlide,\n )\n const cloneSlideChildren = slideChildren.map((child, index) =>\n cloneElement(child, { index }),\n )\n\n const css: CSSUIObject = {\n h: \"fit-content\",\n position: \"relative\",\n ...styles.container,\n }\n\n h ??= height\n minH ??= minHeight\n\n return (\n <CarouselProvider value={{ id, styles, ...rest }}>\n <ui.section\n className={cx(\"ui-carousel\", className)}\n __css={css}\n {...getContainerProps({}, ref)}\n >\n {customCarouselControlPrev ??\n (computedWithControls ? (\n <CarouselControlPrev {...controlProps} {...controlPrevProps} />\n ) : null)}\n {customCarouselControlNext ??\n (computedWithControls ? (\n <CarouselControlNext {...controlProps} {...controlNextProps} />\n ) : null)}\n\n <CarouselSlides\n {...getSlidesProps({\n ...filterUndefined({ h, minH }),\n ...innerProps,\n })}\n >\n {cloneSlideChildren}\n </CarouselSlides>\n\n {customCarouselIndicators ??\n (computedWithIndicators ? (\n <CarouselIndicators {...indicatorsProps} />\n ) : null)}\n\n {otherChildren}\n </ui.section>\n </CarouselProvider>\n )\n },\n)\n\nCarousel.displayName = \"Carousel\"\nCarousel.__ui__ = \"Carousel\"\n\ninterface CarouselSlidesProps extends HTMLUIProps {}\n\nconst CarouselSlides = forwardRef<CarouselSlidesProps, \"div\">(\n ({ ...rest }, ref) => {\n const css: CSSUIObject = { h: \"fit-content\", overflow: \"hidden\", w: \"100%\" }\n\n return (\n <ui.div ref={ref} className=\"ui-carousel__sliders\" __css={css}>\n <CarouselSlidesInner {...rest} />\n </ui.div>\n )\n },\n)\n\nCarouselSlides.displayName = \"CarouselSlides\"\nCarouselSlides.__ui__ = \"CarouselSlides\"\n\ninterface CarouselSlidesInnerProps extends HTMLUIProps {}\n\nconst CarouselSlidesInner: FC<CarouselSlidesInnerProps> = ({ ...rest }) => {\n const { includeGapInSize, orientation, styles } = useCarouselContext()\n\n const css: CSSUIObject = {\n display: \"flex\",\n flexDirection: orientation === \"vertical\" ? \"column\" : \"row\",\n ...styles.inner,\n ...(includeGapInSize\n ? {\n [orientation === \"vertical\" ? \"mb\" : \"mr\"]: \"calc($gap * -1)\",\n }\n : {}),\n }\n\n return (\n <ui.div className=\"ui-carousel__sliders__inner\" __css={css} {...rest} />\n )\n}\n\nCarouselSlidesInner.displayName = \"CarouselSlidesInner\"\nCarouselSlidesInner.__ui__ = \"CarouselSlidesInner\"\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,E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ACvC;AAAA,UAEL;AAAA;AAAA;AAAA,IACH,GACF;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;AACvB,SAAS,SAAS;AAIlB,IAAM,iBAAiB;AAAA,EACrB,CAAC,EAAE,GAAG,KAAK,GAAG,QAAQ;AACpB,UAAM,MAAmB,EAAE,GAAG,eAAe,UAAU,UAAU,GAAG,OAAO;AAE3E,WACE,oBAAC,GAAG,KAAH,EAAO,KAAU,WAAU,wBAAuB,OAAO,KACxD,8BAAC,uBAAqB,GAAG,MAAM,GACjC;AAAA,EAEJ;AACF;AAEA,eAAe,cAAc;AAC7B,eAAe,SAAS;AAIxB,IAAM,sBAAoD,CAAC,EAAE,GAAG,KAAK,MAAM;AACzE,QAAM,EAAE,kBAAkB,aAAa,OAAO,IAAI,mBAAmB;AAErE,QAAM,MAAmB;AAAA,IACvB,SAAS;AAAA,IACT,eAAe,gBAAgB,aAAa,WAAW;AAAA,IACvD,GAAG,OAAO;AAAA,IACV,GAAI,mBACA;AAAA,MACE,CAAC,gBAAgB,aAAa,OAAO,IAAI,GAAG;AAAA,IAC9C,IACA,CAAC;AAAA,EACP;AAEA,SACE,oBAAC,GAAG,KAAH,EAAO,WAAU,+BAA8B,OAAO,KAAM,GAAG,MAAM;AAE1E;AAEA,oBAAoB,cAAc;AAClC,oBAAoB,SAAS;","names":[]}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import {
|
3
3
|
useCarouselContext,
|
4
4
|
useCarouselSlide
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-2HSC64IV.mjs";
|
6
6
|
|
7
7
|
// src/carousel-slide.tsx
|
8
8
|
import { forwardRef, ui } from "@yamada-ui/core";
|
@@ -50,4 +50,4 @@ CarouselSlideInner.__ui__ = "CarouselSlideInner";
|
|
50
50
|
export {
|
51
51
|
CarouselSlide
|
52
52
|
};
|
53
|
-
//# sourceMappingURL=chunk-
|
53
|
+
//# sourceMappingURL=chunk-GUUMIIYD.mjs.map
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import {
|
3
3
|
useCarouselContext,
|
4
4
|
useCarouselIndicators
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-2HSC64IV.mjs";
|
6
6
|
|
7
7
|
// src/carousel-indicators.tsx
|
8
8
|
import { forwardRef, ui } from "@yamada-ui/core";
|
@@ -12,7 +12,7 @@ import { jsx } from "react/jsx-runtime";
|
|
12
12
|
var CarouselIndicators = forwardRef(
|
13
13
|
({ className, component, ...rest }, ref) => {
|
14
14
|
const { orientation, selectedIndex, styles } = useCarouselContext();
|
15
|
-
const { indexes, getIndicatorProps } = useCarouselIndicators();
|
15
|
+
const { indexes, getIndicatorProps, getIndicatorsProps } = useCarouselIndicators();
|
16
16
|
const css = {
|
17
17
|
display: "flex",
|
18
18
|
justifyContent: "center",
|
@@ -24,8 +24,8 @@ var CarouselIndicators = forwardRef(
|
|
24
24
|
return /* @__PURE__ */ jsx(
|
25
25
|
ui.div,
|
26
26
|
{
|
27
|
-
ref,
|
28
27
|
className: cx("ui-carousel__indicators", className),
|
28
|
+
...getIndicatorsProps(rest, ref),
|
29
29
|
__css: css,
|
30
30
|
...rest,
|
31
31
|
children: indexes.map((index) => {
|
@@ -49,27 +49,26 @@ var CarouselIndicators = forwardRef(
|
|
49
49
|
);
|
50
50
|
CarouselIndicators.displayName = "CarouselIndicators";
|
51
51
|
CarouselIndicators.__ui__ = "CarouselIndicators";
|
52
|
-
var CarouselIndicator = (
|
53
|
-
className,
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
};
|
52
|
+
var CarouselIndicator = forwardRef(
|
53
|
+
({ className, ...rest }, ref) => {
|
54
|
+
const { styles } = useCarouselContext();
|
55
|
+
const css = { ...styles.indicator };
|
56
|
+
return /* @__PURE__ */ jsx(
|
57
|
+
ui.button,
|
58
|
+
{
|
59
|
+
ref,
|
60
|
+
type: "button",
|
61
|
+
className: cx("ui-carousel__indicators__indicator", className),
|
62
|
+
__css: css,
|
63
|
+
...rest
|
64
|
+
}
|
65
|
+
);
|
66
|
+
}
|
67
|
+
);
|
69
68
|
CarouselIndicator.displayName = "CarouselIndicator";
|
70
69
|
CarouselIndicator.__ui__ = "CarouselIndicator";
|
71
70
|
|
72
71
|
export {
|
73
72
|
CarouselIndicators
|
74
73
|
};
|
75
|
-
//# sourceMappingURL=chunk-
|
74
|
+
//# sourceMappingURL=chunk-GXNJ5VYJ.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/carousel-indicators.tsx"],"sourcesContent":["import type { CSSUIObject, FC, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { ReactElement } from \"react\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { cloneElement } from \"react\"\nimport { useCarouselContext, useCarouselIndicators } from \"./use-carousel\"\n\ninterface CarouselIndicatorsOptions {\n /**\n * The custom carousel indicator to use.\n */\n component?: FC<{ index: number; isSelected: boolean }>\n}\n\nexport interface CarouselIndicatorsProps\n extends HTMLUIProps,\n CarouselIndicatorsOptions {}\n\nexport const CarouselIndicators = forwardRef<CarouselIndicatorsProps, \"div\">(\n ({ className, component, ...rest }, ref) => {\n const { orientation, selectedIndex, styles } = useCarouselContext()\n const { indexes, getIndicatorProps, getIndicatorsProps } =\n useCarouselIndicators()\n\n const css: CSSUIObject = {\n display: \"flex\",\n justifyContent: \"center\",\n position: \"absolute\",\n zIndex: \"fallback(kurillin, 9)\",\n ...styles.indicators,\n ...(orientation === \"vertical\"\n ? { flexDirection: \"column\" }\n : { flexDirection: \"row\" }),\n }\n\n return (\n <ui.div\n className={cx(\"ui-carousel__indicators\", className)}\n {...getIndicatorsProps(rest, ref)}\n __css={css}\n {...rest}\n >\n {indexes.map((index) => {\n const isSelected = index === selectedIndex\n\n if (typeof component === \"function\") {\n const child = component({\n index,\n isSelected,\n }) as null | ReactElement\n\n if (!child) return null\n\n const props = getIndicatorProps({ ...child.props, index })\n\n return cloneElement(child as ReactElement, props)\n } else {\n const { key, ...props } = getIndicatorProps({ index })\n\n return <CarouselIndicator key={key} {...props} />\n }\n })}\n </ui.div>\n )\n },\n)\n\nCarouselIndicators.displayName = \"CarouselIndicators\"\nCarouselIndicators.__ui__ = \"CarouselIndicators\"\n\ninterface CarouselIndicatorProps extends HTMLUIProps<\"button\"> {}\n\nconst CarouselIndicator = forwardRef<CarouselIndicatorProps, \"button\">(\n ({ className, ...rest }, ref) => {\n const { styles } = useCarouselContext()\n\n const css: CSSUIObject = { ...styles.indicator }\n\n return (\n <ui.button\n ref={ref}\n type=\"button\"\n className={cx(\"ui-carousel__indicators__indicator\", className)}\n __css={css}\n {...rest}\n />\n )\n },\n)\n\nCarouselIndicator.displayName = \"CarouselIndicator\"\nCarouselIndicator.__ui__ = \"CarouselIndicator\"\n"],"mappings":";;;;;;;AAEA,SAAS,YAAY,UAAU;AAC/B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAuDV;AAzCZ,IAAM,qBAAqB;AAAA,EAChC,CAAC,EAAE,WAAW,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC1C,UAAM,EAAE,aAAa,eAAe,OAAO,IAAI,mBAAmB;AAClE,UAAM,EAAE,SAAS,mBAAmB,mBAAmB,IACrD,sBAAsB;AAExB,UAAM,MAAmB;AAAA,MACvB,SAAS;AAAA,MACT,gBAAgB;AAAA,MAChB,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,GAAG,OAAO;AAAA,MACV,GAAI,gBAAgB,aAChB,EAAE,eAAe,SAAS,IAC1B,EAAE,eAAe,MAAM;AAAA,IAC7B;AAEA,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC,WAAW,GAAG,2BAA2B,SAAS;AAAA,QACjD,GAAG,mBAAmB,MAAM,GAAG;AAAA,QAChC,OAAO;AAAA,QACN,GAAG;AAAA,QAEH,kBAAQ,IAAI,CAAC,UAAU;AACtB,gBAAM,aAAa,UAAU;AAE7B,cAAI,OAAO,cAAc,YAAY;AACnC,kBAAM,QAAQ,UAAU;AAAA,cACtB;AAAA,cACA;AAAA,YACF,CAAC;AAED,gBAAI,CAAC,MAAO,QAAO;AAEnB,kBAAM,QAAQ,kBAAkB,EAAE,GAAG,MAAM,OAAO,MAAM,CAAC;AAEzD,mBAAO,aAAa,OAAuB,KAAK;AAAA,UAClD,OAAO;AACL,kBAAM,EAAE,KAAK,GAAG,MAAM,IAAI,kBAAkB,EAAE,MAAM,CAAC;AAErD,mBAAO,oBAAC,qBAA6B,GAAG,SAAT,GAAgB;AAAA,UACjD;AAAA,QACF,CAAC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,mBAAmB,cAAc;AACjC,mBAAmB,SAAS;AAI5B,IAAM,oBAAoB;AAAA,EACxB,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,UAAM,EAAE,OAAO,IAAI,mBAAmB;AAEtC,UAAM,MAAmB,EAAE,GAAG,OAAO,UAAU;AAE/C,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,WAAW,GAAG,sCAAsC,SAAS;AAAA,QAC7D,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,kBAAkB,cAAc;AAChC,kBAAkB,SAAS;","names":[]}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import {
|
3
3
|
useCarouselContext,
|
4
4
|
useCarouselControl
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-2HSC64IV.mjs";
|
6
6
|
|
7
7
|
// src/carousel-control.tsx
|
8
8
|
import { IconButton } from "@yamada-ui/button";
|
@@ -13,12 +13,11 @@ import { jsx } from "react/jsx-runtime";
|
|
13
13
|
var CarouselControlPrev = forwardRef(
|
14
14
|
({ className, ...rest }, ref) => {
|
15
15
|
const { orientation } = useCarouselContext();
|
16
|
-
const { getControlProps } = useCarouselControl({ operation: "prev" });
|
17
16
|
return /* @__PURE__ */ jsx(
|
18
17
|
CarouselControl,
|
19
18
|
{
|
19
|
+
ref,
|
20
20
|
className: cx("ui-carousel__control--prev", className),
|
21
|
-
"aria-label": "Go to previous slide",
|
22
21
|
icon: /* @__PURE__ */ jsx(
|
23
22
|
ChevronIcon,
|
24
23
|
{
|
@@ -29,7 +28,7 @@ var CarouselControlPrev = forwardRef(
|
|
29
28
|
}
|
30
29
|
),
|
31
30
|
operation: "prev",
|
32
|
-
...
|
31
|
+
...rest
|
33
32
|
}
|
34
33
|
);
|
35
34
|
}
|
@@ -39,12 +38,11 @@ CarouselControlPrev.__ui__ = "CarouselControlPrev";
|
|
39
38
|
var CarouselControlNext = forwardRef(
|
40
39
|
({ className, ...rest }, ref) => {
|
41
40
|
const { orientation } = useCarouselContext();
|
42
|
-
const { getControlProps } = useCarouselControl({ operation: "next" });
|
43
41
|
return /* @__PURE__ */ jsx(
|
44
42
|
CarouselControl,
|
45
43
|
{
|
44
|
+
ref,
|
46
45
|
className: cx("ui-carousel__control--next", className),
|
47
|
-
"aria-label": "Go to next slide",
|
48
46
|
icon: /* @__PURE__ */ jsx(
|
49
47
|
ChevronIcon,
|
50
48
|
{
|
@@ -55,7 +53,7 @@ var CarouselControlNext = forwardRef(
|
|
55
53
|
}
|
56
54
|
),
|
57
55
|
operation: "next",
|
58
|
-
...
|
56
|
+
...rest
|
59
57
|
}
|
60
58
|
);
|
61
59
|
}
|
@@ -64,6 +62,7 @@ CarouselControlNext.displayName = "CarouselControlNext";
|
|
64
62
|
CarouselControlNext.__ui__ = "CarouselControlNext";
|
65
63
|
var CarouselControl = forwardRef(({ className, operation, ...rest }, ref) => {
|
66
64
|
const { styles } = useCarouselContext();
|
65
|
+
const { getControlProps } = useCarouselControl({ operation });
|
67
66
|
const css = {
|
68
67
|
position: "absolute",
|
69
68
|
zIndex: "fallback(kurillin, 9)",
|
@@ -73,12 +72,11 @@ var CarouselControl = forwardRef(({ className, operation, ...rest }, ref) => {
|
|
73
72
|
return /* @__PURE__ */ jsx(
|
74
73
|
IconButton,
|
75
74
|
{
|
76
|
-
ref,
|
77
75
|
className: cx("ui-carousel__control", className),
|
78
76
|
colorScheme: ["whiteAlpha", "blackAlpha"],
|
79
77
|
isRounded: true,
|
80
78
|
__css: css,
|
81
|
-
...rest
|
79
|
+
...getControlProps(rest, ref)
|
82
80
|
}
|
83
81
|
);
|
84
82
|
});
|
@@ -89,4 +87,4 @@ export {
|
|
89
87
|
CarouselControlPrev,
|
90
88
|
CarouselControlNext
|
91
89
|
};
|
92
|
-
//# sourceMappingURL=chunk-
|
90
|
+
//# sourceMappingURL=chunk-HVGHVY6Y.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/carousel-control.tsx"],"sourcesContent":["import type { IconButtonProps } from \"@yamada-ui/button\"\nimport type { CSSUIObject } from \"@yamada-ui/core\"\nimport { IconButton } from \"@yamada-ui/button\"\nimport { forwardRef } from \"@yamada-ui/core\"\nimport { ChevronIcon } from \"@yamada-ui/icon\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useCarouselContext, useCarouselControl } from \"./use-carousel\"\n\nexport interface CarouselControlProps extends IconButtonProps {}\n\nexport const CarouselControlPrev = forwardRef<CarouselControlProps, \"button\">(\n ({ className, ...rest }, ref) => {\n const { orientation } = useCarouselContext()\n\n return (\n <CarouselControl\n ref={ref}\n className={cx(\"ui-carousel__control--prev\", className)}\n icon={\n <ChevronIcon\n __css={{\n fontSize: \"1.5em\",\n transform:\n orientation === \"vertical\" ? \"rotate(180deg)\" : \"rotate(90deg)\",\n }}\n />\n }\n operation=\"prev\"\n {...rest}\n />\n )\n },\n)\n\nCarouselControlPrev.displayName = \"CarouselControlPrev\"\nCarouselControlPrev.__ui__ = \"CarouselControlPrev\"\n\nexport const CarouselControlNext = forwardRef<CarouselControlProps, \"button\">(\n ({ className, ...rest }, ref) => {\n const { orientation } = useCarouselContext()\n\n return (\n <CarouselControl\n ref={ref}\n className={cx(\"ui-carousel__control--next\", className)}\n icon={\n <ChevronIcon\n __css={{\n fontSize: \"1.5em\",\n transform:\n orientation === \"vertical\" ? \"rotate(0deg)\" : \"rotate(-90deg)\",\n }}\n />\n }\n operation=\"next\"\n {...rest}\n />\n )\n },\n)\n\nCarouselControlNext.displayName = \"CarouselControlNext\"\nCarouselControlNext.__ui__ = \"CarouselControlNext\"\n\nconst CarouselControl = forwardRef<\n { operation: \"next\" | \"prev\" } & CarouselControlProps,\n \"button\"\n>(({ className, operation, ...rest }, ref) => {\n const { styles } = useCarouselContext()\n const { getControlProps } = useCarouselControl({ operation })\n\n const css: CSSUIObject = {\n position: \"absolute\",\n zIndex: \"fallback(kurillin, 9)\",\n ...styles.control,\n ...styles[operation],\n }\n\n return (\n <IconButton\n className={cx(\"ui-carousel__control\", className)}\n colorScheme={[\"whiteAlpha\", \"blackAlpha\"]}\n isRounded\n __css={css}\n {...getControlProps(rest, ref)}\n />\n )\n})\n\nCarouselControl.displayName = \"CarouselControl\"\nCarouselControl.__ui__ = \"CarouselControl\"\n"],"mappings":";;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AAcT;AATH,IAAM,sBAAsB;AAAA,EACjC,CAAC,EAAE,WAAW,GAAG,KAAK,GAAG,QAAQ;AAC/B,UAAM,EAAE,YAAY,IAAI,mBAAmB;AAE3C,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,8BAA8B,SAAS;AAAA,QACrD,MACE;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,UAAU;AAAA,cACV,WACE,gBAAgB,aAAa,mBAAmB;AAAA,YACpD;AAAA;AAAA,QACF;AAAA,QAEF,WAAU;AAAA,QACT,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;AAEA,oBAAoB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