@planetaexo/design-system 0.71.0 → 0.73.0

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
@@ -12203,24 +12203,24 @@ function FeedLightbox({
12203
12203
  if (frame) cancelAnimationFrame(frame);
12204
12204
  };
12205
12205
  }, []);
12206
- return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex flex-col bg-background", children: [
12207
- /* @__PURE__ */ jsxs("div", { className: "sticky top-0 z-10 flex items-center gap-3 border-b border-border/60 bg-background/85 px-3 py-2.5 backdrop-blur-md", children: [
12206
+ return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex flex-col bg-zinc-950 text-white", children: [
12207
+ /* @__PURE__ */ jsxs("div", { className: "sticky top-0 z-10 flex items-center gap-3 border-b border-white/10 bg-zinc-950/80 px-3 py-2.5 backdrop-blur-md", children: [
12208
12208
  /* @__PURE__ */ jsx(
12209
12209
  "button",
12210
12210
  {
12211
12211
  type: "button",
12212
12212
  onClick: onClose,
12213
- className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
12213
+ className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-white transition-colors hover:bg-white/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60",
12214
12214
  "aria-label": (_a = labels == null ? void 0 : labels.close) != null ? _a : "Close lightbox",
12215
12215
  children: /* @__PURE__ */ jsx(XIcon, { className: "h-5 w-5" })
12216
12216
  }
12217
12217
  ),
12218
- activeLabel && /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-center font-heading text-sm font-bold uppercase tracking-wide text-foreground", children: activeLabel }),
12218
+ activeLabel && /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-center font-heading text-sm font-bold uppercase tracking-wide text-white", children: activeLabel }),
12219
12219
  total > 1 && /* @__PURE__ */ jsxs(
12220
12220
  "span",
12221
12221
  {
12222
12222
  className: cn(
12223
- "shrink-0 font-ui text-sm font-medium tabular-nums text-muted-foreground",
12223
+ "shrink-0 font-ui text-sm font-medium tabular-nums text-white/60",
12224
12224
  !activeLabel && "ml-auto"
12225
12225
  ),
12226
12226
  children: [
@@ -12243,7 +12243,7 @@ function FeedLightbox({
12243
12243
  "h2",
12244
12244
  {
12245
12245
  className: cn(
12246
- "px-3 font-heading text-lg font-bold uppercase tracking-wide text-foreground sm:px-4",
12246
+ "px-3 font-heading text-lg font-bold uppercase tracking-wide text-white sm:px-4",
12247
12247
  index > 0 && "mt-3"
12248
12248
  ),
12249
12249
  children: sectionLabel
@@ -12257,7 +12257,7 @@ function FeedLightbox({
12257
12257
  itemRefs.current[index] = el;
12258
12258
  },
12259
12259
  children: [
12260
- /* @__PURE__ */ jsx("div", { className: "overflow-hidden bg-muted", children: /* @__PURE__ */ jsx(
12260
+ /* @__PURE__ */ jsx("div", { className: "overflow-hidden bg-white/5", children: /* @__PURE__ */ jsx(
12261
12261
  Picture,
12262
12262
  {
12263
12263
  src: photo.src,
@@ -12269,8 +12269,8 @@ function FeedLightbox({
12269
12269
  }
12270
12270
  ) }),
12271
12271
  (photo.caption || photo.credit) && /* @__PURE__ */ jsxs("figcaption", { className: "px-3 pt-2 sm:px-4", children: [
12272
- photo.caption && /* @__PURE__ */ jsx("p", { className: "font-ui text-sm leading-snug text-foreground/80", children: photo.caption }),
12273
- photo.credit && /* @__PURE__ */ jsxs("p", { className: "font-ui text-xs text-muted-foreground", children: [
12272
+ photo.caption && /* @__PURE__ */ jsx("p", { className: "font-ui text-sm leading-snug text-white/90", children: photo.caption }),
12273
+ photo.credit && /* @__PURE__ */ jsxs("p", { className: "font-ui text-xs text-white/50", children: [
12274
12274
  "\xA9 ",
12275
12275
  photo.credit
12276
12276
  ] })
@@ -12681,65 +12681,117 @@ function CarouselGallery({
12681
12681
  onOpen,
12682
12682
  className
12683
12683
  }) {
12684
- var _a;
12685
12684
  const total = photos.length;
12686
- const photo = photos[index];
12687
- const prev = () => onIndexChange((index - 1 + total) % total);
12688
- const next = () => onIndexChange((index + 1) % total);
12689
- const touchStart = React20.useRef(null);
12690
- const swiped = React20.useRef(false);
12691
- const onTouchStart = (e) => {
12692
- const t = e.touches[0];
12693
- touchStart.current = { x: t.clientX, y: t.clientY };
12694
- swiped.current = false;
12685
+ const go = (i) => onIndexChange(Math.max(0, Math.min(total - 1, i)));
12686
+ const prev = () => go(index - 1);
12687
+ const next = () => go(index + 1);
12688
+ const containerRef = React20.useRef(null);
12689
+ const [drag, setDrag] = React20.useState(0);
12690
+ const [dragging, setDragging] = React20.useState(false);
12691
+ const gesture = React20.useRef(null);
12692
+ const movedRef = React20.useRef(false);
12693
+ const onPointerDown = (e) => {
12694
+ var _a, _b;
12695
+ if (total <= 1) return;
12696
+ movedRef.current = false;
12697
+ gesture.current = {
12698
+ x: e.clientX,
12699
+ y: e.clientY,
12700
+ w: (_b = (_a = containerRef.current) == null ? void 0 : _a.clientWidth) != null ? _b : 1,
12701
+ axis: null,
12702
+ id: e.pointerId
12703
+ };
12695
12704
  };
12696
- const onTouchEnd = (e) => {
12697
- const start = touchStart.current;
12698
- touchStart.current = null;
12699
- if (!start || total <= 1) return;
12700
- const t = e.changedTouches[0];
12701
- const dx = t.clientX - start.x;
12702
- const dy = t.clientY - start.y;
12703
- if (Math.abs(dx) > 40 && Math.abs(dx) > Math.abs(dy)) {
12704
- swiped.current = true;
12705
- if (dx < 0) next();
12706
- else prev();
12705
+ const onPointerMove = (e) => {
12706
+ var _a;
12707
+ const g = gesture.current;
12708
+ if (!g || e.pointerId !== g.id) return;
12709
+ const dx = e.clientX - g.x;
12710
+ const dy = e.clientY - g.y;
12711
+ if (g.axis === null) {
12712
+ if (Math.abs(dx) > 8 && Math.abs(dx) > Math.abs(dy)) {
12713
+ g.axis = "x";
12714
+ setDragging(true);
12715
+ try {
12716
+ (_a = containerRef.current) == null ? void 0 : _a.setPointerCapture(g.id);
12717
+ } catch (e2) {
12718
+ }
12719
+ } else if (Math.abs(dy) > 8) {
12720
+ gesture.current = null;
12721
+ return;
12722
+ } else {
12723
+ return;
12724
+ }
12707
12725
  }
12726
+ if (g.axis !== "x") return;
12727
+ movedRef.current = true;
12728
+ let d = dx;
12729
+ if (index === 0 && d > 0 || index === total - 1 && d < 0) d *= 0.35;
12730
+ setDrag(d);
12731
+ };
12732
+ const endGesture = (e) => {
12733
+ const g = gesture.current;
12734
+ gesture.current = null;
12735
+ setDragging(false);
12736
+ setDrag(0);
12737
+ if (!g || g.axis !== "x") return;
12738
+ const dx = e.clientX - g.x;
12739
+ const threshold = Math.min(110, g.w * 0.18);
12740
+ if (dx <= -threshold) next();
12741
+ else if (dx >= threshold) prev();
12708
12742
  };
12709
12743
  return /* @__PURE__ */ jsxs(
12710
12744
  "div",
12711
12745
  {
12712
- onTouchStart,
12713
- onTouchEnd,
12746
+ ref: containerRef,
12747
+ onPointerDown,
12748
+ onPointerMove,
12749
+ onPointerUp: endGesture,
12750
+ onPointerCancel: endGesture,
12751
+ onClick: () => {
12752
+ if (movedRef.current) {
12753
+ movedRef.current = false;
12754
+ return;
12755
+ }
12756
+ onOpen(index);
12757
+ },
12758
+ onKeyDown: (e) => {
12759
+ if (e.key === "Enter" || e.key === " ") {
12760
+ e.preventDefault();
12761
+ onOpen(index);
12762
+ }
12763
+ },
12764
+ role: "button",
12765
+ tabIndex: 0,
12766
+ "aria-label": `Open photo ${index + 1} fullscreen`,
12714
12767
  className: cn(
12715
- "relative w-full aspect-[4/3] sm:aspect-[16/10] overflow-hidden bg-muted group/photo touch-pan-y select-none",
12768
+ "relative w-full aspect-[4/3] sm:aspect-[16/10] overflow-hidden bg-muted",
12769
+ "touch-pan-y select-none cursor-zoom-in",
12770
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
12716
12771
  className
12717
12772
  ),
12718
12773
  children: [
12719
12774
  /* @__PURE__ */ jsx(
12720
- "button",
12775
+ "div",
12721
12776
  {
12722
- type: "button",
12723
- onClick: () => {
12724
- if (swiped.current) {
12725
- swiped.current = false;
12726
- return;
12727
- }
12728
- onOpen(index);
12777
+ className: "flex h-full w-full",
12778
+ style: {
12779
+ transform: `translateX(calc(${-index * 100}% + ${drag}px))`,
12780
+ transition: dragging ? "none" : "transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1)"
12729
12781
  },
12730
- "aria-label": `Open photo ${index + 1} fullscreen`,
12731
- className: "absolute inset-0 w-full h-full cursor-zoom-in focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
12732
- children: /* @__PURE__ */ jsx(
12733
- Picture,
12734
- {
12735
- src: photo.src,
12736
- alt: (_a = photo.alt) != null ? _a : `Photo ${index + 1}`,
12737
- title: photo.caption,
12738
- className: "h-full w-full object-cover transition-transform duration-500 group-hover/photo:scale-[1.02]",
12739
- loading: "lazy"
12740
- },
12741
- photo.src
12742
- )
12782
+ children: photos.map((p, i) => {
12783
+ var _a;
12784
+ return /* @__PURE__ */ jsx("div", { className: "h-full w-full shrink-0", children: /* @__PURE__ */ jsx(
12785
+ Picture,
12786
+ {
12787
+ src: p.src,
12788
+ alt: (_a = p.alt) != null ? _a : `Photo ${i + 1}`,
12789
+ title: p.caption,
12790
+ className: "pointer-events-none h-full w-full object-cover",
12791
+ rootMargin: "400px"
12792
+ }
12793
+ ) }, i);
12794
+ })
12743
12795
  }
12744
12796
  ),
12745
12797
  total > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -12747,7 +12799,10 @@ function CarouselGallery({
12747
12799
  "button",
12748
12800
  {
12749
12801
  type: "button",
12750
- onClick: prev,
12802
+ onClick: (e) => {
12803
+ e.stopPropagation();
12804
+ prev();
12805
+ },
12751
12806
  "aria-label": "Previous photo",
12752
12807
  className: cn(
12753
12808
  "absolute left-3 sm:left-4 top-1/2 -translate-y-1/2 z-10",
@@ -12763,7 +12818,10 @@ function CarouselGallery({
12763
12818
  "button",
12764
12819
  {
12765
12820
  type: "button",
12766
- onClick: next,
12821
+ onClick: (e) => {
12822
+ e.stopPropagation();
12823
+ next();
12824
+ },
12767
12825
  "aria-label": "Next photo",
12768
12826
  className: cn(
12769
12827
  "absolute right-3 sm:right-4 top-1/2 -translate-y-1/2 z-10",
@@ -12780,7 +12838,10 @@ function CarouselGallery({
12780
12838
  "button",
12781
12839
  {
12782
12840
  type: "button",
12783
- onClick: () => onIndexChange(i),
12841
+ onClick: (e) => {
12842
+ e.stopPropagation();
12843
+ onIndexChange(i);
12844
+ },
12784
12845
  "aria-label": `Go to photo ${i + 1}`,
12785
12846
  className: cn(
12786
12847
  "h-1.5 rounded-full transition-all duration-300",