@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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "1.0.64",
3
+ "version": "1.0.66",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 217,
6
6
  "exports": [
package/dist/index.cjs CHANGED
@@ -16390,6 +16390,7 @@ function Carousel({
16390
16390
  const carouselRef = React42.useRef(null);
16391
16391
  const rafRef = React42.useRef(null);
16392
16392
  const isDraggingRef = React42.useRef(false);
16393
+ const dragDistanceRef = React42.useRef(0);
16393
16394
  const startPosRef = React42.useRef(0);
16394
16395
  const lastDragPositionRef = React42.useRef(0);
16395
16396
  const slides = React42.useMemo(() => React42.Children.toArray(children), [children]);
@@ -16416,12 +16417,12 @@ function Carousel({
16416
16417
  mainScale: 1.12,
16417
16418
  sideScale: 0.82,
16418
16419
  farScale: 0.72,
16419
- sideOpacity: 0.72,
16420
- farOpacity: 0.24,
16420
+ sideOpacity: 0.84,
16421
+ farOpacity: 0.44,
16421
16422
  sideOffset: 22,
16422
16423
  rotate: 20,
16423
16424
  depthStep: 120,
16424
- blur: 2.6
16425
+ blur: 1.6
16425
16426
  };
16426
16427
  }
16427
16428
  if (effectPreset === "gallery") {
@@ -16500,12 +16501,12 @@ function Carousel({
16500
16501
  mainScale: 1.04,
16501
16502
  sideScale: effectiveAnimation === "stack" ? 0.93 : 0.88,
16502
16503
  farScale: effectiveAnimation === "stack" ? 0.86 : 0.76,
16503
- sideOpacity: effectiveAnimation === "stack" ? 0.74 : 0.78,
16504
- farOpacity: effectiveAnimation === "stack" ? 0.42 : 0.38,
16504
+ sideOpacity: effectiveAnimation === "stack" ? 0.8 : 0.86,
16505
+ farOpacity: effectiveAnimation === "stack" ? 0.5 : 0.48,
16505
16506
  sideOffset: effectiveAnimation === "stack" ? 20 : 28,
16506
16507
  rotate: 24,
16507
16508
  depthStep: effectiveAnimation === "stack" ? 60 : 90,
16508
- blur: 1.5,
16509
+ blur: 1.1,
16509
16510
  stackOffset: 20,
16510
16511
  stackLift: 12,
16511
16512
  ...presetEffectOptions,
@@ -16589,6 +16590,7 @@ function Carousel({
16589
16590
  };
16590
16591
  const touchStart = (event) => {
16591
16592
  isDraggingRef.current = true;
16593
+ dragDistanceRef.current = 0;
16592
16594
  const pos = isHorizontal ? getPositionX(event.nativeEvent) : getPositionY(event.nativeEvent);
16593
16595
  startPosRef.current = pos;
16594
16596
  lastDragPositionRef.current = pos;
@@ -16597,6 +16599,7 @@ function Carousel({
16597
16599
  if (!isDraggingRef.current) return;
16598
16600
  const pos = isHorizontal ? getPositionX(event.nativeEvent) : getPositionY(event.nativeEvent);
16599
16601
  lastDragPositionRef.current = pos;
16602
+ dragDistanceRef.current = Math.max(dragDistanceRef.current, Math.abs(pos - startPosRef.current));
16600
16603
  };
16601
16604
  const touchEnd = () => {
16602
16605
  if (!isDraggingRef.current) return;
@@ -16611,6 +16614,23 @@ function Carousel({
16611
16614
  startPosRef.current = 0;
16612
16615
  lastDragPositionRef.current = 0;
16613
16616
  };
16617
+ const handleDeckAreaClick = React42.useCallback((event) => {
16618
+ if (!isDeckAnimation || dragDistanceRef.current > 8) {
16619
+ dragDistanceRef.current = 0;
16620
+ return;
16621
+ }
16622
+ const activeDeck = event.currentTarget.querySelector("[data-active-deck='true']");
16623
+ if (!activeDeck) return;
16624
+ const activeRect = activeDeck.getBoundingClientRect();
16625
+ const x = event.clientX;
16626
+ if (x < activeRect.left) {
16627
+ scrollPrev();
16628
+ return;
16629
+ }
16630
+ if (x > activeRect.right) {
16631
+ scrollNext();
16632
+ }
16633
+ }, [isDeckAnimation, scrollNext, scrollPrev]);
16614
16634
  React42.useEffect(() => {
16615
16635
  onSlideChange?.(currentIndex);
16616
16636
  }, [currentIndex, onSlideChange]);
@@ -16646,6 +16666,7 @@ function Carousel({
16646
16666
  return {
16647
16667
  opacity: 0,
16648
16668
  pointerEvents: "none",
16669
+ zIndex: 0,
16649
16670
  transform: `translate3d(0, 0, -${mergedEffectOptions.depthStep * 2}px) scale(${mergedEffectOptions.farScale})`,
16650
16671
  filter: `blur(${mergedEffectOptions.blur * 1.4}px)`
16651
16672
  };
@@ -16658,7 +16679,8 @@ function Carousel({
16658
16679
  opacity: distance === 0 ? 1 : distance === 1 || distance === -1 ? mergedEffectOptions.sideOpacity : mergedEffectOptions.farOpacity,
16659
16680
  transform: `translate3d(${xOffset2}px, ${yOffset}px, -${absDistance * mergedEffectOptions.depthStep}px) scale(${scale2})`,
16660
16681
  filter: distance === 0 ? "blur(0px)" : `blur(${Math.min(absDistance, 2) * mergedEffectOptions.blur}px)`,
16661
- pointerEvents: distance === 0 ? "auto" : "none"
16682
+ pointerEvents: "auto",
16683
+ zIndex: 30 - absDistance
16662
16684
  };
16663
16685
  }
16664
16686
  const xOffset = distance * mergedEffectOptions.sideOffset;
@@ -16668,7 +16690,8 @@ function Carousel({
16668
16690
  opacity: distance === 0 ? 1 : distance === 1 || distance === -1 ? mergedEffectOptions.sideOpacity : mergedEffectOptions.farOpacity,
16669
16691
  transform: `translate3d(${xOffset}%, 0, -${absDistance * mergedEffectOptions.depthStep}px) rotateY(${rotateY}deg) scale(${scale})`,
16670
16692
  filter: distance === 0 ? "blur(0px)" : `blur(${Math.min(absDistance, 2) * mergedEffectOptions.blur}px)`,
16671
- pointerEvents: distance === 0 ? "auto" : "none"
16693
+ pointerEvents: "auto",
16694
+ zIndex: 30 - absDistance
16672
16695
  };
16673
16696
  },
16674
16697
  [effectiveAnimation, getLoopDistance, mergedEffectOptions]
@@ -16678,7 +16701,7 @@ function Carousel({
16678
16701
  {
16679
16702
  ref: carouselRef,
16680
16703
  className: cn(
16681
- "relative w-full overflow-hidden focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 rounded-xl md:rounded-3xl",
16704
+ "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",
16682
16705
  className
16683
16706
  ),
16684
16707
  onKeyDown: handleKeyDown,
@@ -16708,30 +16731,61 @@ function Carousel({
16708
16731
  onMouseMove: touchMove,
16709
16732
  onMouseUp: touchEnd,
16710
16733
  onMouseLeave: touchEnd,
16734
+ onClick: handleDeckAreaClick,
16711
16735
  role: "group",
16712
16736
  "aria-atomic": "false",
16713
16737
  "aria-live": autoScroll ? "off" : "polite",
16714
- children: slides.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
16715
- "div",
16716
- {
16717
- className: cn(
16718
- "shrink-0",
16719
- effectiveAnimation === "slide" ? isHorizontal ? "h-full" : "h-full w-full" : "col-start-1 row-start-1",
16720
- effectiveAnimation === "fade" && (idx === currentIndex ? "opacity-100 z-10" : "opacity-0 pointer-events-none z-0"),
16721
- effectiveAnimation === "scale" && (idx === currentIndex ? "opacity-100 scale-100 z-10" : "opacity-0 scale-95 pointer-events-none z-0"),
16722
- isDeckAnimation && "w-full max-w-[78%] md:max-w-[72%] transition-[opacity,transform] duration-500 ease-out",
16723
- effectiveAnimation !== "slide" && "transition-[opacity,transform] duration-500 ease-in-out",
16724
- slideClassName
16725
- ),
16726
- style: effectiveAnimation === "slide" ? { [isHorizontal ? "width" : "height"]: `${slideWidth}%` } : isDeckAnimation ? getDeckSlideStyles(idx) : void 0,
16727
- role: "group",
16728
- "aria-roledescription": "slide",
16729
- "aria-label": `${idx + 1} of ${totalSlides}`,
16730
- "aria-hidden": effectiveAnimation === "slide" ? idx < currentIndex || idx >= currentIndex + slidesToShow : idx !== currentIndex,
16731
- children: child
16732
- },
16733
- React42.isValidElement(child) && child.key || idx
16734
- ))
16738
+ children: slides.map((child, idx) => {
16739
+ const key = React42.isValidElement(child) && child.key || idx;
16740
+ const ariaHidden = effectiveAnimation === "slide" ? idx < currentIndex || idx >= currentIndex + slidesToShow : idx !== currentIndex;
16741
+ if (isDeckAnimation) {
16742
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
16743
+ "div",
16744
+ {
16745
+ className: "col-start-1 row-start-1 flex w-full items-center justify-center pointer-events-none",
16746
+ "aria-hidden": ariaHidden,
16747
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
16748
+ "div",
16749
+ {
16750
+ className: cn(
16751
+ "w-full max-w-[68%] md:max-w-[60%] transition-[opacity,transform,filter] duration-500 ease-out",
16752
+ idx !== currentIndex && "cursor-pointer",
16753
+ slideClassName
16754
+ ),
16755
+ "data-active-deck": idx === currentIndex ? "true" : void 0,
16756
+ style: getDeckSlideStyles(idx),
16757
+ onClick: idx !== currentIndex ? () => scrollTo(idx) : void 0,
16758
+ role: "group",
16759
+ "aria-roledescription": "slide",
16760
+ "aria-label": `${idx + 1} of ${totalSlides}`,
16761
+ children: child
16762
+ }
16763
+ )
16764
+ },
16765
+ key
16766
+ );
16767
+ }
16768
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
16769
+ "div",
16770
+ {
16771
+ className: cn(
16772
+ "shrink-0",
16773
+ effectiveAnimation === "slide" ? isHorizontal ? "h-full" : "h-full w-full" : "col-start-1 row-start-1",
16774
+ effectiveAnimation === "fade" && (idx === currentIndex ? "opacity-100 z-10" : "opacity-0 pointer-events-none z-0"),
16775
+ effectiveAnimation === "scale" && (idx === currentIndex ? "opacity-100 scale-100 z-10" : "opacity-0 scale-95 pointer-events-none z-0"),
16776
+ effectiveAnimation !== "slide" && "transition-[opacity,transform] duration-500 ease-in-out",
16777
+ slideClassName
16778
+ ),
16779
+ style: effectiveAnimation === "slide" ? { [isHorizontal ? "width" : "height"]: `${slideWidth}%` } : void 0,
16780
+ role: "group",
16781
+ "aria-roledescription": "slide",
16782
+ "aria-label": `${idx + 1} of ${totalSlides}`,
16783
+ "aria-hidden": ariaHidden,
16784
+ children: child
16785
+ },
16786
+ key
16787
+ );
16788
+ })
16735
16789
  }
16736
16790
  ),
16737
16791
  shouldShowArrows && totalSlides > effectiveSlidesToShow && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [