@underverse-ui/underverse 1.0.64 → 1.0.66

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/index.js CHANGED
@@ -16224,6 +16224,7 @@ function Carousel({
16224
16224
  const carouselRef = React42.useRef(null);
16225
16225
  const rafRef = React42.useRef(null);
16226
16226
  const isDraggingRef = React42.useRef(false);
16227
+ const dragDistanceRef = React42.useRef(0);
16227
16228
  const startPosRef = React42.useRef(0);
16228
16229
  const lastDragPositionRef = React42.useRef(0);
16229
16230
  const slides = React42.useMemo(() => React42.Children.toArray(children), [children]);
@@ -16250,12 +16251,12 @@ function Carousel({
16250
16251
  mainScale: 1.12,
16251
16252
  sideScale: 0.82,
16252
16253
  farScale: 0.72,
16253
- sideOpacity: 0.72,
16254
- farOpacity: 0.24,
16254
+ sideOpacity: 0.84,
16255
+ farOpacity: 0.44,
16255
16256
  sideOffset: 22,
16256
16257
  rotate: 20,
16257
16258
  depthStep: 120,
16258
- blur: 2.6
16259
+ blur: 1.6
16259
16260
  };
16260
16261
  }
16261
16262
  if (effectPreset === "gallery") {
@@ -16334,12 +16335,12 @@ function Carousel({
16334
16335
  mainScale: 1.04,
16335
16336
  sideScale: effectiveAnimation === "stack" ? 0.93 : 0.88,
16336
16337
  farScale: effectiveAnimation === "stack" ? 0.86 : 0.76,
16337
- sideOpacity: effectiveAnimation === "stack" ? 0.74 : 0.78,
16338
- farOpacity: effectiveAnimation === "stack" ? 0.42 : 0.38,
16338
+ sideOpacity: effectiveAnimation === "stack" ? 0.8 : 0.86,
16339
+ farOpacity: effectiveAnimation === "stack" ? 0.5 : 0.48,
16339
16340
  sideOffset: effectiveAnimation === "stack" ? 20 : 28,
16340
16341
  rotate: 24,
16341
16342
  depthStep: effectiveAnimation === "stack" ? 60 : 90,
16342
- blur: 1.5,
16343
+ blur: 1.1,
16343
16344
  stackOffset: 20,
16344
16345
  stackLift: 12,
16345
16346
  ...presetEffectOptions,
@@ -16423,6 +16424,7 @@ function Carousel({
16423
16424
  };
16424
16425
  const touchStart = (event) => {
16425
16426
  isDraggingRef.current = true;
16427
+ dragDistanceRef.current = 0;
16426
16428
  const pos = isHorizontal ? getPositionX(event.nativeEvent) : getPositionY(event.nativeEvent);
16427
16429
  startPosRef.current = pos;
16428
16430
  lastDragPositionRef.current = pos;
@@ -16431,6 +16433,7 @@ function Carousel({
16431
16433
  if (!isDraggingRef.current) return;
16432
16434
  const pos = isHorizontal ? getPositionX(event.nativeEvent) : getPositionY(event.nativeEvent);
16433
16435
  lastDragPositionRef.current = pos;
16436
+ dragDistanceRef.current = Math.max(dragDistanceRef.current, Math.abs(pos - startPosRef.current));
16434
16437
  };
16435
16438
  const touchEnd = () => {
16436
16439
  if (!isDraggingRef.current) return;
@@ -16445,6 +16448,23 @@ function Carousel({
16445
16448
  startPosRef.current = 0;
16446
16449
  lastDragPositionRef.current = 0;
16447
16450
  };
16451
+ const handleDeckAreaClick = React42.useCallback((event) => {
16452
+ if (!isDeckAnimation || dragDistanceRef.current > 8) {
16453
+ dragDistanceRef.current = 0;
16454
+ return;
16455
+ }
16456
+ const activeDeck = event.currentTarget.querySelector("[data-active-deck='true']");
16457
+ if (!activeDeck) return;
16458
+ const activeRect = activeDeck.getBoundingClientRect();
16459
+ const x = event.clientX;
16460
+ if (x < activeRect.left) {
16461
+ scrollPrev();
16462
+ return;
16463
+ }
16464
+ if (x > activeRect.right) {
16465
+ scrollNext();
16466
+ }
16467
+ }, [isDeckAnimation, scrollNext, scrollPrev]);
16448
16468
  React42.useEffect(() => {
16449
16469
  onSlideChange?.(currentIndex);
16450
16470
  }, [currentIndex, onSlideChange]);
@@ -16480,6 +16500,7 @@ function Carousel({
16480
16500
  return {
16481
16501
  opacity: 0,
16482
16502
  pointerEvents: "none",
16503
+ zIndex: 0,
16483
16504
  transform: `translate3d(0, 0, -${mergedEffectOptions.depthStep * 2}px) scale(${mergedEffectOptions.farScale})`,
16484
16505
  filter: `blur(${mergedEffectOptions.blur * 1.4}px)`
16485
16506
  };
@@ -16492,7 +16513,8 @@ function Carousel({
16492
16513
  opacity: distance === 0 ? 1 : distance === 1 || distance === -1 ? mergedEffectOptions.sideOpacity : mergedEffectOptions.farOpacity,
16493
16514
  transform: `translate3d(${xOffset2}px, ${yOffset}px, -${absDistance * mergedEffectOptions.depthStep}px) scale(${scale2})`,
16494
16515
  filter: distance === 0 ? "blur(0px)" : `blur(${Math.min(absDistance, 2) * mergedEffectOptions.blur}px)`,
16495
- pointerEvents: distance === 0 ? "auto" : "none"
16516
+ pointerEvents: "auto",
16517
+ zIndex: 30 - absDistance
16496
16518
  };
16497
16519
  }
16498
16520
  const xOffset = distance * mergedEffectOptions.sideOffset;
@@ -16502,7 +16524,8 @@ function Carousel({
16502
16524
  opacity: distance === 0 ? 1 : distance === 1 || distance === -1 ? mergedEffectOptions.sideOpacity : mergedEffectOptions.farOpacity,
16503
16525
  transform: `translate3d(${xOffset}%, 0, -${absDistance * mergedEffectOptions.depthStep}px) rotateY(${rotateY}deg) scale(${scale})`,
16504
16526
  filter: distance === 0 ? "blur(0px)" : `blur(${Math.min(absDistance, 2) * mergedEffectOptions.blur}px)`,
16505
- pointerEvents: distance === 0 ? "auto" : "none"
16527
+ pointerEvents: "auto",
16528
+ zIndex: 30 - absDistance
16506
16529
  };
16507
16530
  },
16508
16531
  [effectiveAnimation, getLoopDistance, mergedEffectOptions]
@@ -16512,7 +16535,7 @@ function Carousel({
16512
16535
  {
16513
16536
  ref: carouselRef,
16514
16537
  className: cn(
16515
- "relative w-full overflow-hidden focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 rounded-xl md:rounded-3xl",
16538
+ "relative w-full overflow-hidden focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 rounded-xl md:rounded-3xl",
16516
16539
  className
16517
16540
  ),
16518
16541
  onKeyDown: handleKeyDown,
@@ -16542,30 +16565,61 @@ function Carousel({
16542
16565
  onMouseMove: touchMove,
16543
16566
  onMouseUp: touchEnd,
16544
16567
  onMouseLeave: touchEnd,
16568
+ onClick: handleDeckAreaClick,
16545
16569
  role: "group",
16546
16570
  "aria-atomic": "false",
16547
16571
  "aria-live": autoScroll ? "off" : "polite",
16548
- children: slides.map((child, idx) => /* @__PURE__ */ jsx49(
16549
- "div",
16550
- {
16551
- className: cn(
16552
- "shrink-0",
16553
- effectiveAnimation === "slide" ? isHorizontal ? "h-full" : "h-full w-full" : "col-start-1 row-start-1",
16554
- effectiveAnimation === "fade" && (idx === currentIndex ? "opacity-100 z-10" : "opacity-0 pointer-events-none z-0"),
16555
- effectiveAnimation === "scale" && (idx === currentIndex ? "opacity-100 scale-100 z-10" : "opacity-0 scale-95 pointer-events-none z-0"),
16556
- isDeckAnimation && "w-full max-w-[78%] md:max-w-[72%] transition-[opacity,transform] duration-500 ease-out",
16557
- effectiveAnimation !== "slide" && "transition-[opacity,transform] duration-500 ease-in-out",
16558
- slideClassName
16559
- ),
16560
- style: effectiveAnimation === "slide" ? { [isHorizontal ? "width" : "height"]: `${slideWidth}%` } : isDeckAnimation ? getDeckSlideStyles(idx) : void 0,
16561
- role: "group",
16562
- "aria-roledescription": "slide",
16563
- "aria-label": `${idx + 1} of ${totalSlides}`,
16564
- "aria-hidden": effectiveAnimation === "slide" ? idx < currentIndex || idx >= currentIndex + slidesToShow : idx !== currentIndex,
16565
- children: child
16566
- },
16567
- React42.isValidElement(child) && child.key || idx
16568
- ))
16572
+ children: slides.map((child, idx) => {
16573
+ const key = React42.isValidElement(child) && child.key || idx;
16574
+ const ariaHidden = effectiveAnimation === "slide" ? idx < currentIndex || idx >= currentIndex + slidesToShow : idx !== currentIndex;
16575
+ if (isDeckAnimation) {
16576
+ return /* @__PURE__ */ jsx49(
16577
+ "div",
16578
+ {
16579
+ className: "col-start-1 row-start-1 flex w-full items-center justify-center pointer-events-none",
16580
+ "aria-hidden": ariaHidden,
16581
+ children: /* @__PURE__ */ jsx49(
16582
+ "div",
16583
+ {
16584
+ className: cn(
16585
+ "w-full max-w-[68%] md:max-w-[60%] transition-[opacity,transform,filter] duration-500 ease-out",
16586
+ idx !== currentIndex && "cursor-pointer",
16587
+ slideClassName
16588
+ ),
16589
+ "data-active-deck": idx === currentIndex ? "true" : void 0,
16590
+ style: getDeckSlideStyles(idx),
16591
+ onClick: idx !== currentIndex ? () => scrollTo(idx) : void 0,
16592
+ role: "group",
16593
+ "aria-roledescription": "slide",
16594
+ "aria-label": `${idx + 1} of ${totalSlides}`,
16595
+ children: child
16596
+ }
16597
+ )
16598
+ },
16599
+ key
16600
+ );
16601
+ }
16602
+ return /* @__PURE__ */ jsx49(
16603
+ "div",
16604
+ {
16605
+ className: cn(
16606
+ "shrink-0",
16607
+ effectiveAnimation === "slide" ? isHorizontal ? "h-full" : "h-full w-full" : "col-start-1 row-start-1",
16608
+ effectiveAnimation === "fade" && (idx === currentIndex ? "opacity-100 z-10" : "opacity-0 pointer-events-none z-0"),
16609
+ effectiveAnimation === "scale" && (idx === currentIndex ? "opacity-100 scale-100 z-10" : "opacity-0 scale-95 pointer-events-none z-0"),
16610
+ effectiveAnimation !== "slide" && "transition-[opacity,transform] duration-500 ease-in-out",
16611
+ slideClassName
16612
+ ),
16613
+ style: effectiveAnimation === "slide" ? { [isHorizontal ? "width" : "height"]: `${slideWidth}%` } : void 0,
16614
+ role: "group",
16615
+ "aria-roledescription": "slide",
16616
+ "aria-label": `${idx + 1} of ${totalSlides}`,
16617
+ "aria-hidden": ariaHidden,
16618
+ children: child
16619
+ },
16620
+ key
16621
+ );
16622
+ })
16569
16623
  }
16570
16624
  ),
16571
16625
  shouldShowArrows && totalSlides > effectiveSlidesToShow && /* @__PURE__ */ jsxs41(Fragment17, { children: [