@underverse-ui/underverse 1.0.61 → 1.0.63
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/api-reference.json +16 -2
- package/dist/index.cjs +230 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.js +240 -74
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/api-reference.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "@underverse-ui/underverse",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.63",
|
|
4
4
|
"sourceEntry": "src/index.ts",
|
|
5
|
-
"totalExports":
|
|
5
|
+
"totalExports": 217,
|
|
6
6
|
"exports": [
|
|
7
7
|
{
|
|
8
8
|
"name": "*",
|
|
@@ -273,6 +273,20 @@
|
|
|
273
273
|
"reexport": true,
|
|
274
274
|
"local": false
|
|
275
275
|
},
|
|
276
|
+
{
|
|
277
|
+
"name": "CarouselEffectOptions",
|
|
278
|
+
"kind": "type",
|
|
279
|
+
"source": "./components/Carousel",
|
|
280
|
+
"reexport": true,
|
|
281
|
+
"local": false
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"name": "CarouselEffectPreset",
|
|
285
|
+
"kind": "type",
|
|
286
|
+
"source": "./components/Carousel",
|
|
287
|
+
"reexport": true,
|
|
288
|
+
"local": false
|
|
289
|
+
},
|
|
276
290
|
{
|
|
277
291
|
"name": "Category",
|
|
278
292
|
"kind": "type",
|
package/dist/index.cjs
CHANGED
|
@@ -16348,20 +16348,139 @@ function Carousel({
|
|
|
16348
16348
|
slideClassName,
|
|
16349
16349
|
onSlideChange,
|
|
16350
16350
|
thumbnailRenderer,
|
|
16351
|
-
ariaLabel = "Carousel"
|
|
16351
|
+
ariaLabel = "Carousel",
|
|
16352
|
+
effectPreset,
|
|
16353
|
+
effectOptions
|
|
16352
16354
|
}) {
|
|
16353
16355
|
const [currentIndex, setCurrentIndex] = React42.useState(0);
|
|
16354
16356
|
const [isPaused, setIsPaused] = React42.useState(false);
|
|
16355
|
-
const [isDragging, setIsDragging] = React42.useState(false);
|
|
16356
|
-
const [startPos, setStartPos] = React42.useState(0);
|
|
16357
|
-
const [currentTranslate, setCurrentTranslate] = React42.useState(0);
|
|
16358
|
-
const [prevTranslate, setPrevTranslate] = React42.useState(0);
|
|
16359
16357
|
const progressElRef = React42.useRef(null);
|
|
16360
16358
|
const carouselRef = React42.useRef(null);
|
|
16361
16359
|
const rafRef = React42.useRef(null);
|
|
16362
|
-
const
|
|
16363
|
-
const
|
|
16360
|
+
const isDraggingRef = React42.useRef(false);
|
|
16361
|
+
const startPosRef = React42.useRef(0);
|
|
16362
|
+
const lastDragPositionRef = React42.useRef(0);
|
|
16363
|
+
const slides = React42.useMemo(() => React42.Children.toArray(children), [children]);
|
|
16364
|
+
const totalSlides = slides.length;
|
|
16364
16365
|
const isHorizontal = orientation === "horizontal";
|
|
16366
|
+
const effectiveAnimation = slidesToShow > 1 && !["slide", "coverflow", "stack"].includes(animation) ? "slide" : animation;
|
|
16367
|
+
const isDeckAnimation = effectiveAnimation === "coverflow" || effectiveAnimation === "stack";
|
|
16368
|
+
const effectiveSlidesToShow = isDeckAnimation ? 1 : slidesToShow;
|
|
16369
|
+
const maxIndex = Math.max(0, totalSlides - effectiveSlidesToShow);
|
|
16370
|
+
const shouldShowArrows = showArrows && isHorizontal;
|
|
16371
|
+
const presetEffectOptions = React42.useMemo(() => {
|
|
16372
|
+
if (effectPreset === "cinematic") {
|
|
16373
|
+
return effectiveAnimation === "stack" ? {
|
|
16374
|
+
mainScale: 1.08,
|
|
16375
|
+
sideScale: 0.9,
|
|
16376
|
+
farScale: 0.84,
|
|
16377
|
+
sideOpacity: 0.68,
|
|
16378
|
+
farOpacity: 0.3,
|
|
16379
|
+
depthStep: 76,
|
|
16380
|
+
blur: 2.2,
|
|
16381
|
+
stackOffset: 16,
|
|
16382
|
+
stackLift: 16
|
|
16383
|
+
} : {
|
|
16384
|
+
mainScale: 1.12,
|
|
16385
|
+
sideScale: 0.82,
|
|
16386
|
+
farScale: 0.72,
|
|
16387
|
+
sideOpacity: 0.72,
|
|
16388
|
+
farOpacity: 0.24,
|
|
16389
|
+
sideOffset: 22,
|
|
16390
|
+
rotate: 20,
|
|
16391
|
+
depthStep: 120,
|
|
16392
|
+
blur: 2.6
|
|
16393
|
+
};
|
|
16394
|
+
}
|
|
16395
|
+
if (effectPreset === "gallery") {
|
|
16396
|
+
return effectiveAnimation === "stack" ? {
|
|
16397
|
+
mainScale: 1.03,
|
|
16398
|
+
sideScale: 0.94,
|
|
16399
|
+
farScale: 0.88,
|
|
16400
|
+
sideOpacity: 0.82,
|
|
16401
|
+
farOpacity: 0.5,
|
|
16402
|
+
depthStep: 50,
|
|
16403
|
+
blur: 0.8,
|
|
16404
|
+
stackOffset: 24,
|
|
16405
|
+
stackLift: 8
|
|
16406
|
+
} : {
|
|
16407
|
+
mainScale: 1.05,
|
|
16408
|
+
sideScale: 0.9,
|
|
16409
|
+
farScale: 0.82,
|
|
16410
|
+
sideOpacity: 0.84,
|
|
16411
|
+
farOpacity: 0.48,
|
|
16412
|
+
sideOffset: 30,
|
|
16413
|
+
rotate: 16,
|
|
16414
|
+
depthStep: 78,
|
|
16415
|
+
blur: 1
|
|
16416
|
+
};
|
|
16417
|
+
}
|
|
16418
|
+
if (effectPreset === "poster") {
|
|
16419
|
+
return effectiveAnimation === "stack" ? {
|
|
16420
|
+
mainScale: 1.12,
|
|
16421
|
+
sideScale: 0.88,
|
|
16422
|
+
farScale: 0.78,
|
|
16423
|
+
sideOpacity: 0.64,
|
|
16424
|
+
farOpacity: 0.22,
|
|
16425
|
+
depthStep: 92,
|
|
16426
|
+
blur: 2.8,
|
|
16427
|
+
stackOffset: 14,
|
|
16428
|
+
stackLift: 18
|
|
16429
|
+
} : {
|
|
16430
|
+
mainScale: 1.16,
|
|
16431
|
+
sideScale: 0.78,
|
|
16432
|
+
farScale: 0.68,
|
|
16433
|
+
sideOpacity: 0.68,
|
|
16434
|
+
farOpacity: 0.18,
|
|
16435
|
+
sideOffset: 18,
|
|
16436
|
+
rotate: 26,
|
|
16437
|
+
depthStep: 140,
|
|
16438
|
+
blur: 3
|
|
16439
|
+
};
|
|
16440
|
+
}
|
|
16441
|
+
if (effectPreset === "minimal") {
|
|
16442
|
+
return effectiveAnimation === "stack" ? {
|
|
16443
|
+
mainScale: 1.01,
|
|
16444
|
+
sideScale: 0.96,
|
|
16445
|
+
farScale: 0.92,
|
|
16446
|
+
sideOpacity: 0.88,
|
|
16447
|
+
farOpacity: 0.66,
|
|
16448
|
+
depthStep: 36,
|
|
16449
|
+
blur: 0,
|
|
16450
|
+
stackOffset: 26,
|
|
16451
|
+
stackLift: 6
|
|
16452
|
+
} : {
|
|
16453
|
+
mainScale: 1.02,
|
|
16454
|
+
sideScale: 0.94,
|
|
16455
|
+
farScale: 0.88,
|
|
16456
|
+
sideOpacity: 0.9,
|
|
16457
|
+
farOpacity: 0.62,
|
|
16458
|
+
sideOffset: 34,
|
|
16459
|
+
rotate: 10,
|
|
16460
|
+
depthStep: 54,
|
|
16461
|
+
blur: 0
|
|
16462
|
+
};
|
|
16463
|
+
}
|
|
16464
|
+
return {};
|
|
16465
|
+
}, [effectPreset, effectiveAnimation]);
|
|
16466
|
+
const mergedEffectOptions = React42.useMemo(
|
|
16467
|
+
() => ({
|
|
16468
|
+
mainScale: 1.04,
|
|
16469
|
+
sideScale: effectiveAnimation === "stack" ? 0.93 : 0.88,
|
|
16470
|
+
farScale: effectiveAnimation === "stack" ? 0.86 : 0.76,
|
|
16471
|
+
sideOpacity: effectiveAnimation === "stack" ? 0.74 : 0.78,
|
|
16472
|
+
farOpacity: effectiveAnimation === "stack" ? 0.42 : 0.38,
|
|
16473
|
+
sideOffset: effectiveAnimation === "stack" ? 20 : 28,
|
|
16474
|
+
rotate: 24,
|
|
16475
|
+
depthStep: effectiveAnimation === "stack" ? 60 : 90,
|
|
16476
|
+
blur: 1.5,
|
|
16477
|
+
stackOffset: 20,
|
|
16478
|
+
stackLift: 12,
|
|
16479
|
+
...presetEffectOptions,
|
|
16480
|
+
...effectOptions
|
|
16481
|
+
}),
|
|
16482
|
+
[effectOptions, effectiveAnimation, presetEffectOptions]
|
|
16483
|
+
);
|
|
16365
16484
|
const scrollPrev = React42.useCallback(() => {
|
|
16366
16485
|
setCurrentIndex((prev) => {
|
|
16367
16486
|
if (prev === 0) {
|
|
@@ -16384,8 +16503,8 @@ function Carousel({
|
|
|
16384
16503
|
},
|
|
16385
16504
|
[maxIndex]
|
|
16386
16505
|
);
|
|
16387
|
-
React42.
|
|
16388
|
-
|
|
16506
|
+
const handleKeyDown = React42.useCallback(
|
|
16507
|
+
(e) => {
|
|
16389
16508
|
if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
|
|
16390
16509
|
e.preventDefault();
|
|
16391
16510
|
scrollPrev();
|
|
@@ -16399,13 +16518,9 @@ function Carousel({
|
|
|
16399
16518
|
e.preventDefault();
|
|
16400
16519
|
scrollTo(maxIndex);
|
|
16401
16520
|
}
|
|
16402
|
-
}
|
|
16403
|
-
|
|
16404
|
-
|
|
16405
|
-
carousel.addEventListener("keydown", handleKeyDown);
|
|
16406
|
-
return () => carousel.removeEventListener("keydown", handleKeyDown);
|
|
16407
|
-
}
|
|
16408
|
-
}, [scrollPrev, scrollNext, scrollTo, maxIndex]);
|
|
16521
|
+
},
|
|
16522
|
+
[scrollPrev, scrollNext, scrollTo, maxIndex]
|
|
16523
|
+
);
|
|
16409
16524
|
React42.useEffect(() => {
|
|
16410
16525
|
const stop = () => {
|
|
16411
16526
|
if (rafRef.current != null) {
|
|
@@ -16414,7 +16529,7 @@ function Carousel({
|
|
|
16414
16529
|
}
|
|
16415
16530
|
if (progressElRef.current) progressElRef.current.style.width = "0%";
|
|
16416
16531
|
};
|
|
16417
|
-
if (!autoScroll || isPaused || totalSlides <=
|
|
16532
|
+
if (!autoScroll || isPaused || totalSlides <= effectiveSlidesToShow) {
|
|
16418
16533
|
stop();
|
|
16419
16534
|
return;
|
|
16420
16535
|
}
|
|
@@ -16433,7 +16548,7 @@ function Carousel({
|
|
|
16433
16548
|
};
|
|
16434
16549
|
rafRef.current = requestAnimationFrame(tick);
|
|
16435
16550
|
return stop;
|
|
16436
|
-
}, [autoScroll, isPaused, totalSlides,
|
|
16551
|
+
}, [autoScroll, isPaused, totalSlides, effectiveSlidesToShow, autoScrollInterval, scrollNext]);
|
|
16437
16552
|
const getPositionX = (event) => {
|
|
16438
16553
|
return event.type.includes("mouse") ? event.pageX : event.touches[0].clientX;
|
|
16439
16554
|
};
|
|
@@ -16441,60 +16556,100 @@ function Carousel({
|
|
|
16441
16556
|
return event.type.includes("mouse") ? event.pageY : event.touches[0].clientY;
|
|
16442
16557
|
};
|
|
16443
16558
|
const touchStart = (event) => {
|
|
16444
|
-
|
|
16559
|
+
isDraggingRef.current = true;
|
|
16445
16560
|
const pos = isHorizontal ? getPositionX(event.nativeEvent) : getPositionY(event.nativeEvent);
|
|
16446
|
-
|
|
16447
|
-
|
|
16561
|
+
startPosRef.current = pos;
|
|
16562
|
+
lastDragPositionRef.current = pos;
|
|
16448
16563
|
};
|
|
16449
16564
|
const touchMove = (event) => {
|
|
16450
|
-
if (!
|
|
16565
|
+
if (!isDraggingRef.current) return;
|
|
16451
16566
|
const pos = isHorizontal ? getPositionX(event.nativeEvent) : getPositionY(event.nativeEvent);
|
|
16452
|
-
|
|
16453
|
-
setCurrentTranslate(prevTranslate + currentPosition - startPos);
|
|
16567
|
+
lastDragPositionRef.current = pos;
|
|
16454
16568
|
};
|
|
16455
16569
|
const touchEnd = () => {
|
|
16456
|
-
if (!
|
|
16457
|
-
|
|
16458
|
-
const movedBy =
|
|
16570
|
+
if (!isDraggingRef.current) return;
|
|
16571
|
+
isDraggingRef.current = false;
|
|
16572
|
+
const movedBy = lastDragPositionRef.current - startPosRef.current;
|
|
16459
16573
|
const threshold = 50;
|
|
16460
|
-
if (movedBy < -threshold
|
|
16574
|
+
if (movedBy < -threshold) {
|
|
16461
16575
|
scrollNext();
|
|
16462
|
-
} else if (movedBy > threshold
|
|
16576
|
+
} else if (movedBy > threshold) {
|
|
16463
16577
|
scrollPrev();
|
|
16464
16578
|
}
|
|
16465
|
-
|
|
16466
|
-
|
|
16579
|
+
startPosRef.current = 0;
|
|
16580
|
+
lastDragPositionRef.current = 0;
|
|
16467
16581
|
};
|
|
16468
16582
|
React42.useEffect(() => {
|
|
16469
16583
|
onSlideChange?.(currentIndex);
|
|
16470
16584
|
}, [currentIndex, onSlideChange]);
|
|
16471
16585
|
const getAnimationStyles2 = () => {
|
|
16472
|
-
|
|
16473
|
-
|
|
16474
|
-
return {
|
|
16475
|
-
transition: "opacity 500ms ease-in-out"
|
|
16476
|
-
};
|
|
16477
|
-
}
|
|
16478
|
-
if (animation === "scale") {
|
|
16479
|
-
return {
|
|
16480
|
-
transform: baseTransform,
|
|
16481
|
-
transition: "transform 500ms ease-in-out, scale 500ms ease-in-out"
|
|
16482
|
-
};
|
|
16586
|
+
if (effectiveAnimation !== "slide") {
|
|
16587
|
+
return {};
|
|
16483
16588
|
}
|
|
16589
|
+
const baseTransform = isHorizontal ? `translateX(-${currentIndex * (100 / effectiveSlidesToShow)}%)` : `translateY(-${currentIndex * (100 / effectiveSlidesToShow)}%)`;
|
|
16484
16590
|
return {
|
|
16485
16591
|
transform: baseTransform,
|
|
16486
|
-
transition:
|
|
16592
|
+
transition: "transform 500ms ease-in-out"
|
|
16487
16593
|
};
|
|
16488
16594
|
};
|
|
16489
|
-
const slideWidth = 100 /
|
|
16595
|
+
const slideWidth = 100 / effectiveSlidesToShow;
|
|
16596
|
+
const getLoopDistance = React42.useCallback(
|
|
16597
|
+
(index) => {
|
|
16598
|
+
if (totalSlides <= 0) return 0;
|
|
16599
|
+
const forward = index - currentIndex;
|
|
16600
|
+
if (!loop) return forward;
|
|
16601
|
+
const altForward = forward - totalSlides;
|
|
16602
|
+
const altBackward = forward + totalSlides;
|
|
16603
|
+
const candidates = [forward, altForward, altBackward];
|
|
16604
|
+
return candidates.reduce((best, candidate) => Math.abs(candidate) < Math.abs(best) ? candidate : best, candidates[0] ?? 0);
|
|
16605
|
+
},
|
|
16606
|
+
[currentIndex, loop, totalSlides]
|
|
16607
|
+
);
|
|
16608
|
+
const getDeckSlideStyles = React42.useCallback(
|
|
16609
|
+
(index) => {
|
|
16610
|
+
const distance = getLoopDistance(index);
|
|
16611
|
+
const absDistance = Math.abs(distance);
|
|
16612
|
+
const hidden = absDistance > 2;
|
|
16613
|
+
if (hidden) {
|
|
16614
|
+
return {
|
|
16615
|
+
opacity: 0,
|
|
16616
|
+
pointerEvents: "none",
|
|
16617
|
+
transform: `translate3d(0, 0, -${mergedEffectOptions.depthStep * 2}px) scale(${mergedEffectOptions.farScale})`,
|
|
16618
|
+
filter: `blur(${mergedEffectOptions.blur * 1.4}px)`
|
|
16619
|
+
};
|
|
16620
|
+
}
|
|
16621
|
+
if (effectiveAnimation === "stack") {
|
|
16622
|
+
const xOffset2 = distance * mergedEffectOptions.stackOffset;
|
|
16623
|
+
const yOffset = absDistance * mergedEffectOptions.stackLift;
|
|
16624
|
+
const scale2 = distance === 0 ? mergedEffectOptions.mainScale : distance === 1 || distance === -1 ? mergedEffectOptions.sideScale : mergedEffectOptions.farScale;
|
|
16625
|
+
return {
|
|
16626
|
+
opacity: distance === 0 ? 1 : distance === 1 || distance === -1 ? mergedEffectOptions.sideOpacity : mergedEffectOptions.farOpacity,
|
|
16627
|
+
transform: `translate3d(${xOffset2}px, ${yOffset}px, -${absDistance * mergedEffectOptions.depthStep}px) scale(${scale2})`,
|
|
16628
|
+
filter: distance === 0 ? "blur(0px)" : `blur(${Math.min(absDistance, 2) * mergedEffectOptions.blur}px)`,
|
|
16629
|
+
pointerEvents: distance === 0 ? "auto" : "none"
|
|
16630
|
+
};
|
|
16631
|
+
}
|
|
16632
|
+
const xOffset = distance * mergedEffectOptions.sideOffset;
|
|
16633
|
+
const rotateY = distance * -mergedEffectOptions.rotate;
|
|
16634
|
+
const scale = distance === 0 ? mergedEffectOptions.mainScale : distance === 1 || distance === -1 ? mergedEffectOptions.sideScale : mergedEffectOptions.farScale;
|
|
16635
|
+
return {
|
|
16636
|
+
opacity: distance === 0 ? 1 : distance === 1 || distance === -1 ? mergedEffectOptions.sideOpacity : mergedEffectOptions.farOpacity,
|
|
16637
|
+
transform: `translate3d(${xOffset}%, 0, -${absDistance * mergedEffectOptions.depthStep}px) rotateY(${rotateY}deg) scale(${scale})`,
|
|
16638
|
+
filter: distance === 0 ? "blur(0px)" : `blur(${Math.min(absDistance, 2) * mergedEffectOptions.blur}px)`,
|
|
16639
|
+
pointerEvents: distance === 0 ? "auto" : "none"
|
|
16640
|
+
};
|
|
16641
|
+
},
|
|
16642
|
+
[effectiveAnimation, getLoopDistance, mergedEffectOptions]
|
|
16643
|
+
);
|
|
16490
16644
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
16491
16645
|
"div",
|
|
16492
16646
|
{
|
|
16493
16647
|
ref: carouselRef,
|
|
16494
16648
|
className: cn(
|
|
16495
|
-
"relative w-full overflow-hidden focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 rounded-
|
|
16649
|
+
"relative w-full overflow-hidden focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 rounded-xl md:rounded-3xl",
|
|
16496
16650
|
className
|
|
16497
16651
|
),
|
|
16652
|
+
onKeyDown: handleKeyDown,
|
|
16498
16653
|
onMouseEnter: () => setIsPaused(true),
|
|
16499
16654
|
onMouseLeave: () => setIsPaused(false),
|
|
16500
16655
|
role: "region",
|
|
@@ -16506,8 +16661,14 @@ function Carousel({
|
|
|
16506
16661
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
16507
16662
|
"div",
|
|
16508
16663
|
{
|
|
16509
|
-
className: cn(
|
|
16510
|
-
|
|
16664
|
+
className: cn(
|
|
16665
|
+
effectiveAnimation === "slide" ? "flex" : "grid",
|
|
16666
|
+
effectiveAnimation === "slide" && (isHorizontal ? "flex-row" : "flex-col h-full"),
|
|
16667
|
+
isDeckAnimation && "place-items-center [transform-style:preserve-3d]",
|
|
16668
|
+
isHorizontal ? "touch-pan-y" : "touch-pan-x",
|
|
16669
|
+
containerClassName
|
|
16670
|
+
),
|
|
16671
|
+
style: isDeckAnimation ? { perspective: "1400px" } : getAnimationStyles2(),
|
|
16511
16672
|
onTouchStart: touchStart,
|
|
16512
16673
|
onTouchMove: touchMove,
|
|
16513
16674
|
onTouchEnd: touchEnd,
|
|
@@ -16518,30 +16679,30 @@ function Carousel({
|
|
|
16518
16679
|
role: "group",
|
|
16519
16680
|
"aria-atomic": "false",
|
|
16520
16681
|
"aria-live": autoScroll ? "off" : "polite",
|
|
16521
|
-
children:
|
|
16682
|
+
children: slides.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
16522
16683
|
"div",
|
|
16523
16684
|
{
|
|
16524
16685
|
className: cn(
|
|
16525
16686
|
"shrink-0",
|
|
16526
|
-
isHorizontal ? "h-full" : "w-full",
|
|
16527
|
-
|
|
16528
|
-
|
|
16687
|
+
effectiveAnimation === "slide" ? isHorizontal ? "h-full" : "h-full w-full" : "col-start-1 row-start-1",
|
|
16688
|
+
effectiveAnimation === "fade" && (idx === currentIndex ? "opacity-100 z-10" : "opacity-0 pointer-events-none z-0"),
|
|
16689
|
+
effectiveAnimation === "scale" && (idx === currentIndex ? "opacity-100 scale-100 z-10" : "opacity-0 scale-95 pointer-events-none z-0"),
|
|
16690
|
+
isDeckAnimation && "w-full max-w-[78%] md:max-w-[72%] transition-[opacity,transform] duration-500 ease-out",
|
|
16691
|
+
effectiveAnimation !== "slide" && "transition-[opacity,transform] duration-500 ease-in-out",
|
|
16529
16692
|
slideClassName
|
|
16530
16693
|
),
|
|
16531
|
-
style: {
|
|
16532
|
-
[isHorizontal ? "width" : "height"]: `${slideWidth}%`
|
|
16533
|
-
},
|
|
16694
|
+
style: effectiveAnimation === "slide" ? { [isHorizontal ? "width" : "height"]: `${slideWidth}%` } : isDeckAnimation ? getDeckSlideStyles(idx) : void 0,
|
|
16534
16695
|
role: "group",
|
|
16535
16696
|
"aria-roledescription": "slide",
|
|
16536
16697
|
"aria-label": `${idx + 1} of ${totalSlides}`,
|
|
16537
|
-
"aria-hidden": idx < currentIndex || idx >= currentIndex + slidesToShow,
|
|
16698
|
+
"aria-hidden": effectiveAnimation === "slide" ? idx < currentIndex || idx >= currentIndex + slidesToShow : idx !== currentIndex,
|
|
16538
16699
|
children: child
|
|
16539
16700
|
},
|
|
16540
|
-
idx
|
|
16701
|
+
React42.isValidElement(child) && child.key || idx
|
|
16541
16702
|
))
|
|
16542
16703
|
}
|
|
16543
16704
|
),
|
|
16544
|
-
|
|
16705
|
+
shouldShowArrows && totalSlides > effectiveSlidesToShow && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
16545
16706
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
16546
16707
|
Button_default,
|
|
16547
16708
|
{
|
|
@@ -16553,7 +16714,8 @@ function Carousel({
|
|
|
16553
16714
|
disabled: !loop && currentIndex === 0,
|
|
16554
16715
|
className: cn(
|
|
16555
16716
|
"absolute top-1/2 -translate-y-1/2 hover:-translate-y-1/2 active:-translate-y-1/2 z-10 rounded-full will-change-transform backdrop-blur-0 hover:backdrop-blur-0 hover:bg-transparent border-0",
|
|
16556
|
-
|
|
16717
|
+
"max-md:h-8 max-md:w-8 max-md:border max-md:border-border/60 max-md:bg-background/75 max-md:backdrop-blur-sm max-md:shadow-sm",
|
|
16718
|
+
isHorizontal ? "left-4 max-md:left-2" : "top-4 left-1/2 -translate-x-1/2 rotate-90 max-md:top-2"
|
|
16557
16719
|
),
|
|
16558
16720
|
"aria-label": "Previous slide"
|
|
16559
16721
|
}
|
|
@@ -16569,18 +16731,19 @@ function Carousel({
|
|
|
16569
16731
|
disabled: !loop && currentIndex >= maxIndex,
|
|
16570
16732
|
className: cn(
|
|
16571
16733
|
"absolute top-1/2 -translate-y-1/2 hover:-translate-y-1/2 active:-translate-y-1/2 z-10 rounded-full will-change-transform backdrop-blur-0 hover:backdrop-blur-0 hover:bg-transparent border-0",
|
|
16572
|
-
|
|
16734
|
+
"max-md:h-8 max-md:w-8 max-md:border max-md:border-border/60 max-md:bg-background/75 max-md:backdrop-blur-sm max-md:shadow-sm",
|
|
16735
|
+
isHorizontal ? "right-4 max-md:right-2" : "bottom-4 left-1/2 -translate-x-1/2 rotate-90 max-md:bottom-2"
|
|
16573
16736
|
),
|
|
16574
16737
|
"aria-label": "Next slide"
|
|
16575
16738
|
}
|
|
16576
16739
|
)
|
|
16577
16740
|
] }),
|
|
16578
|
-
showDots && totalSlides >
|
|
16741
|
+
showDots && totalSlides > effectiveSlidesToShow && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
16579
16742
|
"div",
|
|
16580
16743
|
{
|
|
16581
16744
|
className: cn(
|
|
16582
16745
|
"absolute flex gap-2 z-10",
|
|
16583
|
-
isHorizontal ? "bottom-4 left-1/2 -translate-x-1/2 flex-row" : "right-4 top-1/2 -translate-y-1/2 flex-col"
|
|
16746
|
+
isHorizontal ? "bottom-4 left-1/2 -translate-x-1/2 flex-row max-md:bottom-2" : "right-4 top-1/2 -translate-y-1/2 flex-col max-md:right-2"
|
|
16584
16747
|
),
|
|
16585
16748
|
role: "tablist",
|
|
16586
16749
|
"aria-label": "Carousel pagination",
|
|
@@ -16590,8 +16753,9 @@ function Carousel({
|
|
|
16590
16753
|
onClick: () => scrollTo(idx),
|
|
16591
16754
|
className: cn(
|
|
16592
16755
|
"rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",
|
|
16756
|
+
"max-md:w-1.5 max-md:h-1.5",
|
|
16593
16757
|
isHorizontal ? "w-2 h-2" : "w-2 h-2",
|
|
16594
|
-
idx === currentIndex ? `bg-primary ${isHorizontal ? "w-6" : "h-6"}` : "bg-muted-foreground/50 hover:bg-muted-foreground/75"
|
|
16758
|
+
idx === currentIndex ? `bg-primary ${isHorizontal ? "w-6 max-md:w-4" : "h-6 max-md:h-4"}` : "bg-muted-foreground/50 hover:bg-muted-foreground/75"
|
|
16595
16759
|
),
|
|
16596
16760
|
"aria-label": `Go to slide ${idx + 1}`,
|
|
16597
16761
|
"aria-selected": idx === currentIndex,
|
|
@@ -16601,11 +16765,12 @@ function Carousel({
|
|
|
16601
16765
|
))
|
|
16602
16766
|
}
|
|
16603
16767
|
),
|
|
16604
|
-
showThumbnails && totalSlides >
|
|
16768
|
+
showThumbnails && totalSlides > effectiveSlidesToShow && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
16605
16769
|
"div",
|
|
16606
16770
|
{
|
|
16607
16771
|
className: cn(
|
|
16608
16772
|
"absolute bottom-0 left-0 right-0 flex gap-2 p-4 bg-linear-to-t from-black/50 to-transparent overflow-x-auto",
|
|
16773
|
+
"max-md:gap-1.5 max-md:p-2",
|
|
16609
16774
|
isHorizontal ? "flex-row" : "flex-col"
|
|
16610
16775
|
),
|
|
16611
16776
|
children: React42.Children.map(children, (child, idx) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
@@ -16614,7 +16779,8 @@ function Carousel({
|
|
|
16614
16779
|
onClick: () => scrollTo(idx),
|
|
16615
16780
|
className: cn(
|
|
16616
16781
|
"shrink-0 w-16 h-16 rounded-lg overflow-hidden border-2 transition-all focus:outline-none focus:ring-2 focus:ring-primary",
|
|
16617
|
-
|
|
16782
|
+
"max-md:w-12 max-md:h-12",
|
|
16783
|
+
idx === currentIndex ? "border-primary md:scale-110" : "border-transparent opacity-70 hover:opacity-100"
|
|
16618
16784
|
),
|
|
16619
16785
|
"aria-label": `Thumbnail ${idx + 1}`,
|
|
16620
16786
|
children: thumbnailRenderer ? thumbnailRenderer(child, idx) : child
|