@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.cjs CHANGED
@@ -12224,24 +12224,24 @@ function FeedLightbox({
12224
12224
  if (frame) cancelAnimationFrame(frame);
12225
12225
  };
12226
12226
  }, []);
12227
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-50 flex flex-col bg-background", children: [
12228
- /* @__PURE__ */ jsxRuntime.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: [
12227
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed inset-0 z-50 flex flex-col bg-zinc-950 text-white", children: [
12228
+ /* @__PURE__ */ jsxRuntime.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: [
12229
12229
  /* @__PURE__ */ jsxRuntime.jsx(
12230
12230
  "button",
12231
12231
  {
12232
12232
  type: "button",
12233
12233
  onClick: onClose,
12234
- 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",
12234
+ 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",
12235
12235
  "aria-label": (_a = labels == null ? void 0 : labels.close) != null ? _a : "Close lightbox",
12236
12236
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "h-5 w-5" })
12237
12237
  }
12238
12238
  ),
12239
- activeLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate text-center font-heading text-sm font-bold uppercase tracking-wide text-foreground", children: activeLabel }),
12239
+ activeLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate text-center font-heading text-sm font-bold uppercase tracking-wide text-white", children: activeLabel }),
12240
12240
  total > 1 && /* @__PURE__ */ jsxRuntime.jsxs(
12241
12241
  "span",
12242
12242
  {
12243
12243
  className: cn(
12244
- "shrink-0 font-ui text-sm font-medium tabular-nums text-muted-foreground",
12244
+ "shrink-0 font-ui text-sm font-medium tabular-nums text-white/60",
12245
12245
  !activeLabel && "ml-auto"
12246
12246
  ),
12247
12247
  children: [
@@ -12264,7 +12264,7 @@ function FeedLightbox({
12264
12264
  "h2",
12265
12265
  {
12266
12266
  className: cn(
12267
- "px-3 font-heading text-lg font-bold uppercase tracking-wide text-foreground sm:px-4",
12267
+ "px-3 font-heading text-lg font-bold uppercase tracking-wide text-white sm:px-4",
12268
12268
  index > 0 && "mt-3"
12269
12269
  ),
12270
12270
  children: sectionLabel
@@ -12278,7 +12278,7 @@ function FeedLightbox({
12278
12278
  itemRefs.current[index] = el;
12279
12279
  },
12280
12280
  children: [
12281
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden bg-muted", children: /* @__PURE__ */ jsxRuntime.jsx(
12281
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden bg-white/5", children: /* @__PURE__ */ jsxRuntime.jsx(
12282
12282
  Picture,
12283
12283
  {
12284
12284
  src: photo.src,
@@ -12290,8 +12290,8 @@ function FeedLightbox({
12290
12290
  }
12291
12291
  ) }),
12292
12292
  (photo.caption || photo.credit) && /* @__PURE__ */ jsxRuntime.jsxs("figcaption", { className: "px-3 pt-2 sm:px-4", children: [
12293
- photo.caption && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-ui text-sm leading-snug text-foreground/80", children: photo.caption }),
12294
- photo.credit && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-ui text-xs text-muted-foreground", children: [
12293
+ photo.caption && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-ui text-sm leading-snug text-white/90", children: photo.caption }),
12294
+ photo.credit && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "font-ui text-xs text-white/50", children: [
12295
12295
  "\xA9 ",
12296
12296
  photo.credit
12297
12297
  ] })
@@ -12702,65 +12702,117 @@ function CarouselGallery({
12702
12702
  onOpen,
12703
12703
  className
12704
12704
  }) {
12705
- var _a;
12706
12705
  const total = photos.length;
12707
- const photo = photos[index];
12708
- const prev = () => onIndexChange((index - 1 + total) % total);
12709
- const next = () => onIndexChange((index + 1) % total);
12710
- const touchStart = React20__namespace.useRef(null);
12711
- const swiped = React20__namespace.useRef(false);
12712
- const onTouchStart = (e) => {
12713
- const t = e.touches[0];
12714
- touchStart.current = { x: t.clientX, y: t.clientY };
12715
- swiped.current = false;
12706
+ const go = (i) => onIndexChange(Math.max(0, Math.min(total - 1, i)));
12707
+ const prev = () => go(index - 1);
12708
+ const next = () => go(index + 1);
12709
+ const containerRef = React20__namespace.useRef(null);
12710
+ const [drag, setDrag] = React20__namespace.useState(0);
12711
+ const [dragging, setDragging] = React20__namespace.useState(false);
12712
+ const gesture = React20__namespace.useRef(null);
12713
+ const movedRef = React20__namespace.useRef(false);
12714
+ const onPointerDown = (e) => {
12715
+ var _a, _b;
12716
+ if (total <= 1) return;
12717
+ movedRef.current = false;
12718
+ gesture.current = {
12719
+ x: e.clientX,
12720
+ y: e.clientY,
12721
+ w: (_b = (_a = containerRef.current) == null ? void 0 : _a.clientWidth) != null ? _b : 1,
12722
+ axis: null,
12723
+ id: e.pointerId
12724
+ };
12716
12725
  };
12717
- const onTouchEnd = (e) => {
12718
- const start = touchStart.current;
12719
- touchStart.current = null;
12720
- if (!start || total <= 1) return;
12721
- const t = e.changedTouches[0];
12722
- const dx = t.clientX - start.x;
12723
- const dy = t.clientY - start.y;
12724
- if (Math.abs(dx) > 40 && Math.abs(dx) > Math.abs(dy)) {
12725
- swiped.current = true;
12726
- if (dx < 0) next();
12727
- else prev();
12726
+ const onPointerMove = (e) => {
12727
+ var _a;
12728
+ const g = gesture.current;
12729
+ if (!g || e.pointerId !== g.id) return;
12730
+ const dx = e.clientX - g.x;
12731
+ const dy = e.clientY - g.y;
12732
+ if (g.axis === null) {
12733
+ if (Math.abs(dx) > 8 && Math.abs(dx) > Math.abs(dy)) {
12734
+ g.axis = "x";
12735
+ setDragging(true);
12736
+ try {
12737
+ (_a = containerRef.current) == null ? void 0 : _a.setPointerCapture(g.id);
12738
+ } catch (e2) {
12739
+ }
12740
+ } else if (Math.abs(dy) > 8) {
12741
+ gesture.current = null;
12742
+ return;
12743
+ } else {
12744
+ return;
12745
+ }
12728
12746
  }
12747
+ if (g.axis !== "x") return;
12748
+ movedRef.current = true;
12749
+ let d = dx;
12750
+ if (index === 0 && d > 0 || index === total - 1 && d < 0) d *= 0.35;
12751
+ setDrag(d);
12752
+ };
12753
+ const endGesture = (e) => {
12754
+ const g = gesture.current;
12755
+ gesture.current = null;
12756
+ setDragging(false);
12757
+ setDrag(0);
12758
+ if (!g || g.axis !== "x") return;
12759
+ const dx = e.clientX - g.x;
12760
+ const threshold = Math.min(110, g.w * 0.18);
12761
+ if (dx <= -threshold) next();
12762
+ else if (dx >= threshold) prev();
12729
12763
  };
12730
12764
  return /* @__PURE__ */ jsxRuntime.jsxs(
12731
12765
  "div",
12732
12766
  {
12733
- onTouchStart,
12734
- onTouchEnd,
12767
+ ref: containerRef,
12768
+ onPointerDown,
12769
+ onPointerMove,
12770
+ onPointerUp: endGesture,
12771
+ onPointerCancel: endGesture,
12772
+ onClick: () => {
12773
+ if (movedRef.current) {
12774
+ movedRef.current = false;
12775
+ return;
12776
+ }
12777
+ onOpen(index);
12778
+ },
12779
+ onKeyDown: (e) => {
12780
+ if (e.key === "Enter" || e.key === " ") {
12781
+ e.preventDefault();
12782
+ onOpen(index);
12783
+ }
12784
+ },
12785
+ role: "button",
12786
+ tabIndex: 0,
12787
+ "aria-label": `Open photo ${index + 1} fullscreen`,
12735
12788
  className: cn(
12736
- "relative w-full aspect-[4/3] sm:aspect-[16/10] overflow-hidden bg-muted group/photo touch-pan-y select-none",
12789
+ "relative w-full aspect-[4/3] sm:aspect-[16/10] overflow-hidden bg-muted",
12790
+ "touch-pan-y select-none cursor-zoom-in",
12791
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
12737
12792
  className
12738
12793
  ),
12739
12794
  children: [
12740
12795
  /* @__PURE__ */ jsxRuntime.jsx(
12741
- "button",
12796
+ "div",
12742
12797
  {
12743
- type: "button",
12744
- onClick: () => {
12745
- if (swiped.current) {
12746
- swiped.current = false;
12747
- return;
12748
- }
12749
- onOpen(index);
12798
+ className: "flex h-full w-full",
12799
+ style: {
12800
+ transform: `translateX(calc(${-index * 100}% + ${drag}px))`,
12801
+ transition: dragging ? "none" : "transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1)"
12750
12802
  },
12751
- "aria-label": `Open photo ${index + 1} fullscreen`,
12752
- 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",
12753
- children: /* @__PURE__ */ jsxRuntime.jsx(
12754
- Picture,
12755
- {
12756
- src: photo.src,
12757
- alt: (_a = photo.alt) != null ? _a : `Photo ${index + 1}`,
12758
- title: photo.caption,
12759
- className: "h-full w-full object-cover transition-transform duration-500 group-hover/photo:scale-[1.02]",
12760
- loading: "lazy"
12761
- },
12762
- photo.src
12763
- )
12803
+ children: photos.map((p, i) => {
12804
+ var _a;
12805
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
12806
+ Picture,
12807
+ {
12808
+ src: p.src,
12809
+ alt: (_a = p.alt) != null ? _a : `Photo ${i + 1}`,
12810
+ title: p.caption,
12811
+ className: "pointer-events-none h-full w-full object-cover",
12812
+ rootMargin: "400px"
12813
+ }
12814
+ ) }, i);
12815
+ })
12764
12816
  }
12765
12817
  ),
12766
12818
  total > 1 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -12768,7 +12820,10 @@ function CarouselGallery({
12768
12820
  "button",
12769
12821
  {
12770
12822
  type: "button",
12771
- onClick: prev,
12823
+ onClick: (e) => {
12824
+ e.stopPropagation();
12825
+ prev();
12826
+ },
12772
12827
  "aria-label": "Previous photo",
12773
12828
  className: cn(
12774
12829
  "absolute left-3 sm:left-4 top-1/2 -translate-y-1/2 z-10",
@@ -12784,7 +12839,10 @@ function CarouselGallery({
12784
12839
  "button",
12785
12840
  {
12786
12841
  type: "button",
12787
- onClick: next,
12842
+ onClick: (e) => {
12843
+ e.stopPropagation();
12844
+ next();
12845
+ },
12788
12846
  "aria-label": "Next photo",
12789
12847
  className: cn(
12790
12848
  "absolute right-3 sm:right-4 top-1/2 -translate-y-1/2 z-10",
@@ -12801,7 +12859,10 @@ function CarouselGallery({
12801
12859
  "button",
12802
12860
  {
12803
12861
  type: "button",
12804
- onClick: () => onIndexChange(i),
12862
+ onClick: (e) => {
12863
+ e.stopPropagation();
12864
+ onIndexChange(i);
12865
+ },
12805
12866
  "aria-label": `Go to photo ${i + 1}`,
12806
12867
  className: cn(
12807
12868
  "h-1.5 rounded-full transition-all duration-300",