@atom63/ui-react 0.2.0-beta.0 → 0.2.0-beta.10

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.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -50
  3. package/dist/{button-sktq-nvV.d.ts → button-CfLIHg-R.d.ts} +1 -1
  4. package/dist/chunk-GDUMA6FI.js +2678 -0
  5. package/dist/chunk-GDUMA6FI.js.map +1 -0
  6. package/dist/{chunk-STCXERLM.js → chunk-J77BAGTA.js} +8 -148
  7. package/dist/chunk-J77BAGTA.js.map +1 -0
  8. package/dist/chunk-NBHGMMQN.js +135 -0
  9. package/dist/chunk-NBHGMMQN.js.map +1 -0
  10. package/dist/{chunk-7VSPECOH.js → chunk-R67OZVA2.js} +4 -14
  11. package/dist/chunk-R67OZVA2.js.map +1 -0
  12. package/dist/chunk-UPPHQLZ2.js +18 -0
  13. package/dist/chunk-UPPHQLZ2.js.map +1 -0
  14. package/dist/{chunk-MXNO63TC.js → chunk-X5L5DEUZ.js} +597 -290
  15. package/dist/chunk-X5L5DEUZ.js.map +1 -0
  16. package/dist/{destination-link-C9NKeKLe.d.ts → destination-link-DMLeR-oF.d.ts} +1 -1
  17. package/dist/index-BDzW8upQ.d.ts +442 -0
  18. package/dist/index.d.ts +56 -454
  19. package/dist/index.js +402 -2987
  20. package/dist/index.js.map +1 -1
  21. package/dist/layout/index.js +4 -4
  22. package/dist/layout/index.js.map +1 -1
  23. package/dist/media/index.d.ts +15 -4
  24. package/dist/media/index.js +213 -46
  25. package/dist/media/index.js.map +1 -1
  26. package/dist/media/media-lightbox/parts/index.d.ts +23 -15
  27. package/dist/media/media-lightbox/parts/index.js +3 -2
  28. package/dist/preview/index.d.ts +16 -0
  29. package/dist/preview/index.js +6 -0
  30. package/dist/preview/index.js.map +1 -0
  31. package/dist/theme/index.d.ts +2 -2
  32. package/dist/theme/index.js +81 -36
  33. package/dist/theme/index.js.map +1 -1
  34. package/package.json +47 -43
  35. package/src/components/accordion/accordion.css +2 -4
  36. package/src/components/alert-dialog/alert-dialog.css +1 -1
  37. package/src/components/autocomplete/autocomplete.css +3 -7
  38. package/src/components/badge/badge.css +5 -8
  39. package/src/components/breadcrumb/breadcrumb.css +1 -2
  40. package/src/components/button/button.css +8 -6
  41. package/src/components/button-group/button-group.css +17 -1
  42. package/src/components/calendar/calendar.css +5 -8
  43. package/src/components/card/card.css +2 -2
  44. package/src/components/carousel/carousel.css +4 -8
  45. package/src/components/checkbox/checkbox.css +1 -1
  46. package/src/components/command/command.css +8 -0
  47. package/src/components/connected-panel/connected-panel.css +3 -2
  48. package/src/components/dialog/dialog.css +1 -1
  49. package/src/components/drawer/drawer.css +1 -1
  50. package/src/components/empty/empty.css +2 -2
  51. package/src/components/feedback-state/feedback-state.css +1 -1
  52. package/src/components/field/field.css +4 -4
  53. package/src/components/form/form.css +2 -2
  54. package/src/components/input/input.css +2 -6
  55. package/src/components/input-otp/input-otp.css +4 -11
  56. package/src/components/item/item.css +3 -3
  57. package/src/components/menu/menu.css +5 -4
  58. package/src/components/menubar/menubar.css +4 -1
  59. package/src/components/navigation-menu/navigation-menu.css +5 -1
  60. package/src/components/panel-setting-button/panel-setting-button.css +1 -1
  61. package/src/components/radio/radio.css +1 -1
  62. package/src/components/resizable/resizable.css +1 -1
  63. package/src/components/scroll-area/scroll-area.css +1 -2
  64. package/src/components/segmented-control/segmented-control.css +8 -1
  65. package/src/components/select/select.css +2 -6
  66. package/src/components/sidebar/sidebar.css +12 -12
  67. package/src/components/sidebar-nav-tree/sidebar-nav-tree.css +8 -8
  68. package/src/components/slider/slider.css +6 -6
  69. package/src/components/switch/switch.css +3 -3
  70. package/src/components/table/table.css +7 -1
  71. package/src/components/tabs/tabs.css +15 -1
  72. package/src/components/textarea/textarea.css +2 -6
  73. package/src/components/toggle/toggle.css +5 -4
  74. package/src/components/toggle-group/toggle-group.css +4 -4
  75. package/src/media/media-lightbox/media-lightbox.css +15 -5
  76. package/src/styles/index.css +1 -0
  77. package/src/styles/utilities.css +2253 -0
  78. package/dist/chunk-7VSPECOH.js.map +0 -1
  79. package/dist/chunk-MXNO63TC.js.map +0 -1
  80. package/dist/chunk-STCXERLM.js.map +0 -1
@@ -1,6 +1,7 @@
1
- import { useReducedMotion, Lightbox, supportsViewTransitions, preferCheapMediaTransition, runMediaViewTransition, useLightboxConfig, useLightboxState, useLightboxRefs, CHROME_IN, CHROME_OUT, CHROME_EXIT_OFFSET } from '../chunk-MXNO63TC.js';
2
- export { DEFAULT_MEDIA_LIGHTBOX_LABELS } from '../chunk-MXNO63TC.js';
3
- import '../chunk-7VSPECOH.js';
1
+ import { useReducedMotion, Lightbox, revealOrigin, supportsViewTransitions, preferCheapMediaTransition, runMediaViewTransition, useLightboxRefs, useLightboxConfig, useLightboxState, CHROME_IN, CHROME_OUT, CHROME_EXIT_OFFSET, AXIS_LOCK_THRESHOLD } from '../chunk-X5L5DEUZ.js';
2
+ export { DEFAULT_MEDIA_LIGHTBOX_LABELS } from '../chunk-X5L5DEUZ.js';
3
+ import '../chunk-R67OZVA2.js';
4
+ import '../chunk-UPPHQLZ2.js';
4
5
  import { cn } from '../chunk-AJLHJRK6.js';
5
6
  import { motion, AnimatePresence } from 'motion/react';
6
7
  import * as React from 'react';
@@ -82,7 +83,7 @@ function useIsMobile() {
82
83
  return !!isMobile;
83
84
  }
84
85
  function Skeleton({ className }) {
85
- return /* @__PURE__ */ jsx("div", { className: cn("bg-muted animate-pulse rounded-md", className) });
86
+ return /* @__PURE__ */ jsx("div", { className: cn("animate-pulse rounded-md bg-muted", className) });
86
87
  }
87
88
  var animatedImagesCache = /* @__PURE__ */ new Set();
88
89
  var IMAGE_REVEAL_INITIAL = { opacity: 0, scale: 1.02 };
@@ -228,13 +229,13 @@ var Image = ({
228
229
  "div",
229
230
  {
230
231
  className: cn(
231
- "bg-muted flex items-center justify-center p-8",
232
+ "flex items-center justify-center bg-muted p-8",
232
233
  getAspectRatioClass(),
233
234
  containerClassName,
234
235
  className
235
236
  ),
236
237
  ...props,
237
- children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: fallbackText })
238
+ children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: fallbackText })
238
239
  }
239
240
  );
240
241
  }
@@ -243,13 +244,13 @@ var Image = ({
243
244
  "div",
244
245
  {
245
246
  className: cn(
246
- "bg-muted flex items-center justify-center p-8",
247
+ "flex items-center justify-center bg-muted p-8",
247
248
  getAspectRatioClass(),
248
249
  containerClassName,
249
250
  className
250
251
  ),
251
252
  ...props,
252
- children: /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: errorText })
253
+ children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: errorText })
253
254
  }
254
255
  );
255
256
  }
@@ -364,8 +365,16 @@ var ImageDisplay = memo(ImageDisplayComponent, (prevProps, nextProps) => {
364
365
  return prevProps.imageSrc === nextProps.imageSrc && prevProps.aspectRatio === nextProps.aspectRatio && prevProps.isMobile === nextProps.isMobile && prevProps.reducedMotion === nextProps.reducedMotion;
365
366
  });
366
367
  var CHROME_IDLE_MS = 2500;
368
+ function isRevealingPointer(event) {
369
+ return event.pointerType !== "touch" && event.pointerType !== "pen";
370
+ }
367
371
  function useChromeAutoHide(open) {
368
- const [visible, setVisible] = useState(true);
372
+ const [visible, setVisibleState] = useState(true);
373
+ const visibleRef = useRef(true);
374
+ const setVisible = useCallback((next) => {
375
+ visibleRef.current = next;
376
+ setVisibleState(next);
377
+ }, []);
369
378
  const idleTimerRef = useRef(null);
370
379
  const holdsRef = useRef(/* @__PURE__ */ new Set());
371
380
  const clearIdleTimer = useCallback(() => {
@@ -382,22 +391,28 @@ function useChromeAutoHide(open) {
382
391
  setVisible(false);
383
392
  }
384
393
  }, CHROME_IDLE_MS);
385
- }, [clearIdleTimer]);
394
+ }, [clearIdleTimer, setVisible]);
386
395
  const reveal = useCallback(() => {
387
396
  setVisible(true);
388
397
  scheduleHide();
389
- }, [scheduleHide]);
398
+ }, [scheduleHide, setVisible]);
399
+ const toggle = useCallback(() => {
400
+ clearIdleTimer();
401
+ setVisible(!visibleRef.current);
402
+ }, [clearIdleTimer, setVisible]);
390
403
  const hold = useCallback(
391
404
  (reason) => {
392
405
  holdsRef.current.add(reason);
393
406
  clearIdleTimer();
394
407
  setVisible(true);
395
408
  },
396
- [clearIdleTimer]
409
+ [clearIdleTimer, setVisible]
397
410
  );
398
411
  const release = useCallback(
399
412
  (reason) => {
400
- holdsRef.current.delete(reason);
413
+ if (!holdsRef.current.delete(reason)) {
414
+ return;
415
+ }
401
416
  if (holdsRef.current.size === 0) {
402
417
  scheduleHide();
403
418
  }
@@ -413,7 +428,7 @@ function useChromeAutoHide(open) {
413
428
  setVisible(true);
414
429
  scheduleHide();
415
430
  return clearIdleTimer;
416
- }, [open, clearIdleTimer, scheduleHide]);
431
+ }, [open, clearIdleTimer, scheduleHide, setVisible]);
417
432
  useEffect(() => {
418
433
  if (!open) {
419
434
  return;
@@ -448,6 +463,7 @@ function useChromeAutoHide(open) {
448
463
  release("hover");
449
464
  }, [release]),
450
465
  reveal,
466
+ toggle,
451
467
  visible
452
468
  };
453
469
  }
@@ -472,6 +488,106 @@ function useMinWidth(minWidthPx) {
472
488
  }, [minWidthPx]);
473
489
  return aboveMinWidth;
474
490
  }
491
+ var DOUBLE_TAP_MS = 300;
492
+ var DOUBLE_TAP_SLOP = 40;
493
+ var TAP_MAX_MS = 500;
494
+ var NO_TAP_SELECTOR = 'a, button:not([tabindex="-1"]), [role="tab"], input, select, textarea, video, [data-a63-no-drag]';
495
+ function isTouchPointer(event) {
496
+ return event.pointerType === "touch" || event.pointerType === "pen";
497
+ }
498
+ function useTouchTap({ onPress, onTap, rootRef }) {
499
+ const onTapRef = useRef(onTap);
500
+ onTapRef.current = onTap;
501
+ const onPressRef = useRef(onPress);
502
+ onPressRef.current = onPress;
503
+ useEffect(() => {
504
+ const root = rootRef.current;
505
+ if (!root) {
506
+ return;
507
+ }
508
+ let press = null;
509
+ let multiTouch = false;
510
+ let pending = null;
511
+ let lastTap = { time: Number.NEGATIVE_INFINITY, x: 0, y: 0 };
512
+ const cancelPending = () => {
513
+ if (pending) {
514
+ clearTimeout(pending);
515
+ pending = null;
516
+ }
517
+ };
518
+ const handlePointerDown = (event) => {
519
+ const touch = isTouchPointer(event);
520
+ onPressRef.current(touch);
521
+ if (!touch) {
522
+ press = null;
523
+ return;
524
+ }
525
+ if (press !== null) {
526
+ multiTouch = true;
527
+ cancelPending();
528
+ return;
529
+ }
530
+ if (event.target?.closest(NO_TAP_SELECTOR)) {
531
+ return;
532
+ }
533
+ const second = pending !== null && event.timeStamp - lastTap.time <= DOUBLE_TAP_MS && Math.hypot(event.clientX - lastTap.x, event.clientY - lastTap.y) <= DOUBLE_TAP_SLOP;
534
+ if (second) {
535
+ cancelPending();
536
+ }
537
+ multiTouch = false;
538
+ press = {
539
+ id: event.pointerId,
540
+ moved: false,
541
+ second,
542
+ time: event.timeStamp,
543
+ x: event.clientX,
544
+ y: event.clientY
545
+ };
546
+ };
547
+ const handlePointerMove = (event) => {
548
+ if (!press || event.pointerId !== press.id || press.moved) {
549
+ return;
550
+ }
551
+ if (Math.abs(event.clientX - press.x) >= AXIS_LOCK_THRESHOLD || Math.abs(event.clientY - press.y) >= AXIS_LOCK_THRESHOLD) {
552
+ press.moved = true;
553
+ }
554
+ };
555
+ const handlePointerUp = (event) => {
556
+ if (!press || event.pointerId !== press.id) {
557
+ return;
558
+ }
559
+ const ended = press;
560
+ press = null;
561
+ if (ended.moved || ended.second || multiTouch || event.timeStamp - ended.time > TAP_MAX_MS) {
562
+ return;
563
+ }
564
+ lastTap = { time: event.timeStamp, x: event.clientX, y: event.clientY };
565
+ cancelPending();
566
+ pending = setTimeout(() => {
567
+ pending = null;
568
+ onTapRef.current();
569
+ }, DOUBLE_TAP_MS);
570
+ };
571
+ const handlePointerCancel = (event) => {
572
+ if (press && event.pointerId === press.id) {
573
+ press = null;
574
+ }
575
+ };
576
+ root.addEventListener("pointerdown", handlePointerDown, true);
577
+ window.addEventListener("pointermove", handlePointerMove, { passive: true });
578
+ window.addEventListener("pointerup", handlePointerUp, { passive: true });
579
+ window.addEventListener("pointercancel", handlePointerCancel, { passive: true });
580
+ root.addEventListener("dblclick", cancelPending, true);
581
+ return () => {
582
+ cancelPending();
583
+ root.removeEventListener("pointerdown", handlePointerDown, true);
584
+ window.removeEventListener("pointermove", handlePointerMove);
585
+ window.removeEventListener("pointerup", handlePointerUp);
586
+ window.removeEventListener("pointercancel", handlePointerCancel);
587
+ root.removeEventListener("dblclick", cancelPending, true);
588
+ };
589
+ }, [rootRef]);
590
+ }
475
591
  function isInternalFocusMove(event, rootRef) {
476
592
  const related = event.relatedTarget;
477
593
  return related instanceof Node && Boolean(rootRef.current?.contains(related));
@@ -496,17 +612,17 @@ function lightboxIconButtonClassName(tone = "glass") {
496
612
  tone !== "capsule" && "rounded-full",
497
613
  tone === "glass" && cn(
498
614
  "a63-media-lightbox-on-media",
499
- "focus-visible:ring-2 focus-visible:ring-[var(--a63-lightbox-on-media-ring)]"
615
+ "focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-(--a63-lightbox-on-media-ring)"
500
616
  ),
501
617
  tone === "capsule" && cn(
502
618
  "text-[var(--a63-lightbox-on-media-fg)]",
503
619
  "hover:bg-[var(--a63-lightbox-on-media-surface-hover)]",
504
- "focus-visible:ring-2 focus-visible:ring-inset",
505
- "focus-visible:ring-[var(--a63-lightbox-on-media-ring)]"
620
+ "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-solid",
621
+ "focus-visible:outline-(--a63-lightbox-on-media-ring)"
506
622
  ),
507
623
  tone === "ghost" && cn(
508
624
  "rounded-full text-[var(--a63-text-primary)] hover:bg-[var(--a63-surface-control-hover)]",
509
- "focus-visible:ring-2 focus-visible:ring-[var(--a63-focus-ring)]"
625
+ "focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-(--a63-focus-ring)"
510
626
  )
511
627
  );
512
628
  }
@@ -643,19 +759,27 @@ function Dock({
643
759
  className: cn(
644
760
  "flex w-full flex-col items-center gap-2.5",
645
761
  "px-3 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",
646
- "text-[var(--a63-text-primary)]"
762
+ "text-[var(--a63-on-media-foreground)] sm:text-[var(--a63-text-primary)]"
647
763
  ),
648
764
  "data-slot": "media-lightbox-dock",
649
765
  children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[min(92vw,1400px)] flex-col items-center gap-2.5", children: [
650
766
  /* @__PURE__ */ jsxs("div", { className: "flex max-w-full items-baseline justify-center gap-3", children: [
651
- item?.caption ? /* @__PURE__ */ jsx(Lightbox.Caption, { className: "min-w-0 truncate text-center text-sm text-[var(--a63-text-secondary)]" }) : null,
767
+ item?.caption ? /* @__PURE__ */ jsx(
768
+ Lightbox.Caption,
769
+ {
770
+ className: cn(
771
+ "min-w-0 truncate text-center text-sm",
772
+ "text-[var(--a63-on-media-foreground)] sm:text-[var(--a63-text-secondary)]"
773
+ )
774
+ }
775
+ ) : null,
652
776
  itemCount > 1 && !showThumbnails ? /* @__PURE__ */ jsx(
653
777
  Lightbox.Counter,
654
778
  {
655
779
  "aria-hidden": true,
656
780
  className: cn(
657
- "shrink-0 font-mono text-xs text-[var(--a63-text-secondary)]",
658
- "tabular-nums opacity-70"
781
+ "shrink-0 font-mono text-xs tabular-nums opacity-70",
782
+ "text-[var(--a63-on-media-foreground)] sm:text-[var(--a63-text-secondary)]"
659
783
  )
660
784
  }
661
785
  ) : null
@@ -666,7 +790,7 @@ function Dock({
666
790
  className: cn(
667
791
  "relative h-11 w-14 shrink-0 snap-center overflow-hidden rounded-md outline-none",
668
792
  "bg-[var(--a63-lightbox-on-media-surface)]",
669
- "focus-visible:ring-2 focus-visible:ring-[var(--a63-lightbox-on-media-ring)]",
793
+ "focus-visible:outline-2 focus-visible:outline-(--a63-lightbox-on-media-ring) focus-visible:outline-solid",
670
794
  // Opacity alone. The thumbs used to scale between
671
795
  // states as well, which put a size change next to the
672
796
  // photo's own dissolve and read as the picture being
@@ -686,7 +810,7 @@ function Dock({
686
810
  }
687
811
  );
688
812
  }
689
- function SlideCloseArea() {
813
+ function SlideCloseArea({ touchRef }) {
690
814
  const { labels } = useLightboxConfig();
691
815
  const { close } = useLightboxState();
692
816
  return /* @__PURE__ */ jsx(
@@ -695,12 +819,31 @@ function SlideCloseArea() {
695
819
  "aria-hidden": true,
696
820
  "aria-label": labels.close,
697
821
  className: "absolute inset-0 cursor-default outline-none",
698
- onClick: close,
822
+ onClick: () => {
823
+ if (!touchRef.current) {
824
+ close();
825
+ }
826
+ },
699
827
  tabIndex: -1,
700
828
  type: "button"
701
829
  }
702
830
  );
703
831
  }
832
+ function ChromeTapToggle({
833
+ chrome,
834
+ onPress
835
+ }) {
836
+ const { rootRef } = useLightboxRefs();
837
+ useTouchTap({ onPress, onTap: chrome.toggle, rootRef });
838
+ return null;
839
+ }
840
+ function revealFor(chrome) {
841
+ return (event) => {
842
+ if (isRevealingPointer(event)) {
843
+ chrome.reveal();
844
+ }
845
+ };
846
+ }
704
847
  function MediaLightbox({
705
848
  appearance,
706
849
  className,
@@ -718,6 +861,7 @@ function MediaLightbox({
718
861
  transition = "flip"
719
862
  }) {
720
863
  const chrome = useChromeAutoHide(open);
864
+ const touchRef = useRef(false);
721
865
  return /* @__PURE__ */ jsx(
722
866
  Lightbox.Root,
723
867
  {
@@ -733,22 +877,38 @@ function MediaLightbox({
733
877
  preload,
734
878
  transition,
735
879
  children: /* @__PURE__ */ jsxs(Lightbox.Portal, { onExitComplete, children: [
736
- /* @__PURE__ */ jsx(Lightbox.Backdrop, { className: "bg-[var(--a63-surface-page)]" }),
880
+ /* @__PURE__ */ jsx(Lightbox.Backdrop, { className: "bg-[var(--a63-media-stage)] sm:bg-[var(--a63-surface-page)]" }),
737
881
  /* @__PURE__ */ jsxs(
738
882
  Lightbox.Content,
739
883
  {
740
884
  className,
741
885
  onKeyDownCapture: chrome.reveal,
742
- onPointerMove: chrome.reveal,
886
+ onPointerMove: revealFor(chrome),
743
887
  children: [
744
888
  /* @__PURE__ */ jsx(Lightbox.Status, {}),
745
- /* @__PURE__ */ jsxs(Lightbox.Viewport, { className: "relative z-10 min-h-0 flex-1", onPointerDown: chrome.reveal, children: [
746
- /* @__PURE__ */ jsx(Lightbox.Slides, { children: (slide) => /* @__PURE__ */ jsxs(Lightbox.Slide, { children: [
747
- /* @__PURE__ */ jsx(SlideCloseArea, {}),
748
- /* @__PURE__ */ jsx(Lightbox.Frame, { className: "rounded-2xl", children: /* @__PURE__ */ jsx(Lightbox.Zoom, { children: /* @__PURE__ */ jsx(Lightbox.Media, {}) }) })
749
- ] }, slide.item.id) }),
750
- /* @__PURE__ */ jsx(PresetFloatingChrome, { chrome })
751
- ] }),
889
+ /* @__PURE__ */ jsx(
890
+ ChromeTapToggle,
891
+ {
892
+ chrome,
893
+ onPress: (touch) => {
894
+ touchRef.current = touch;
895
+ }
896
+ }
897
+ ),
898
+ /* @__PURE__ */ jsxs(
899
+ Lightbox.Viewport,
900
+ {
901
+ className: "relative z-10 min-h-0 flex-1",
902
+ onPointerDown: revealFor(chrome),
903
+ children: [
904
+ /* @__PURE__ */ jsx(Lightbox.Slides, { children: (slide) => /* @__PURE__ */ jsxs(Lightbox.Slide, { children: [
905
+ /* @__PURE__ */ jsx(SlideCloseArea, { touchRef }),
906
+ /* @__PURE__ */ jsx(Lightbox.Frame, { className: "sm:rounded-2xl", children: /* @__PURE__ */ jsx(Lightbox.Zoom, { children: /* @__PURE__ */ jsx(Lightbox.Media, {}) }) })
907
+ ] }, slide.item.id) }),
908
+ /* @__PURE__ */ jsx(PresetFloatingChrome, { chrome })
909
+ ]
910
+ }
911
+ ),
752
912
  /* @__PURE__ */ jsx(Dock, { chrome, thumbnails: Boolean(thumbnails) })
753
913
  ]
754
914
  }
@@ -843,11 +1003,17 @@ function useMediaLightbox(itemCount, options) {
843
1003
  const [index, setIndexState] = useState(0);
844
1004
  const [origin, setOrigin] = useState(null);
845
1005
  const [transition, setTransition] = useState("flip");
1006
+ const getOriginRef = useRef(options?.getOrigin);
1007
+ getOriginRef.current = options?.getOrigin;
846
1008
  const setIndex = useCallback(
847
1009
  (next) => {
848
- setIndexState(clamp(next, itemCount));
1010
+ const clamped = clamp(next, itemCount);
1011
+ setIndexState(clamped);
1012
+ if (isOpen) {
1013
+ revealOrigin(getOriginRef.current?.(clamped));
1014
+ }
849
1015
  },
850
- [itemCount]
1016
+ [isOpen, itemCount]
851
1017
  );
852
1018
  const openAt = useCallback(
853
1019
  (next, nextOrigin) => {
@@ -874,7 +1040,8 @@ function useMediaLightbox(itemCount, options) {
874
1040
  );
875
1041
  const close = useCallback(
876
1042
  (nextOrigin) => {
877
- const target = nextOrigin === void 0 ? origin : nextOrigin;
1043
+ const getOrigin = getOriginRef.current;
1044
+ const target = nextOrigin === void 0 ? getOrigin ? getOrigin(index) : origin : nextOrigin;
878
1045
  const shut = () => {
879
1046
  setOrigin(target);
880
1047
  setIsOpen(false);
@@ -888,7 +1055,7 @@ function useMediaLightbox(itemCount, options) {
888
1055
  shut();
889
1056
  }
890
1057
  },
891
- [origin, transition]
1058
+ [index, origin, transition]
892
1059
  );
893
1060
  return useMemo(
894
1061
  () => ({ close, index, isOpen, openAt, origin, setIndex, transition }),
@@ -939,7 +1106,7 @@ var Video = forwardRef(
939
1106
  },
940
1107
  source.src
941
1108
  )),
942
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground p-4 text-center", children: fallbackText })
1109
+ /* @__PURE__ */ jsx("p", { className: "p-4 text-center text-muted-foreground", children: fallbackText })
943
1110
  ] });
944
1111
  }
945
1112
  );
@@ -1179,7 +1346,7 @@ var VideoDialog = ({
1179
1346
  /* @__PURE__ */ jsx(
1180
1347
  Dialog.Backdrop,
1181
1348
  {
1182
- className: "fixed inset-0 z-(--z-layer-overlay) bg-black/70 backdrop-blur-sm transition-opacity duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
1349
+ className: "fixed inset-0 z-(--z-layer-overlay) bg-[var(--a63-media-scrim)] backdrop-blur-sm transition-opacity duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
1183
1350
  "data-media-overlay": "video"
1184
1351
  }
1185
1352
  ),
@@ -1192,7 +1359,7 @@ var VideoDialog = ({
1192
1359
  Dialog.Popup,
1193
1360
  {
1194
1361
  className: cn(
1195
- "relative w-full max-w-7xl origin-center overflow-hidden rounded-2xl bg-black transition-[opacity,scale] duration-200 outline-none data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0",
1362
+ "relative w-full max-w-7xl origin-center overflow-hidden rounded-2xl bg-[var(--a63-media-stage)] transition-[opacity,scale] duration-200 outline-none data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0",
1196
1363
  className
1197
1364
  ),
1198
1365
  "data-media-overlay": "video",
@@ -1222,12 +1389,12 @@ var IconButton = ({
1222
1389
  {
1223
1390
  "aria-label": ariaLabel,
1224
1391
  className: cn(
1225
- "rounded-full bg-black/70 p-2 transition-transform duration-300 group-hover:scale-110",
1392
+ "rounded-full bg-[var(--a63-on-media-surface-strong)] p-2 transition-transform duration-300 group-hover:scale-110",
1226
1393
  className
1227
1394
  ),
1228
1395
  type: "button",
1229
1396
  ...props,
1230
- children: /* @__PURE__ */ jsx("div", { className: "rounded-full bg-gradient-to-b from-white/10 to-white/5 p-3 transition-transform duration-300 group-hover:scale-110", children: /* @__PURE__ */ jsxs("div", { className: "flex h-8 w-8 items-center justify-center text-white", children: [
1397
+ children: /* @__PURE__ */ jsx("div", { className: "rounded-full bg-gradient-to-b from-[color-mix(in_oklch,var(--a63-on-media-foreground)_10%,transparent)] to-[color-mix(in_oklch,var(--a63-on-media-foreground)_5%,transparent)] p-3 transition-transform duration-300 group-hover:scale-110", children: /* @__PURE__ */ jsxs("div", { className: "flex h-8 w-8 items-center justify-center text-[var(--a63-on-media-foreground)]", children: [
1231
1398
  icon === "play" && /* @__PURE__ */ jsx(Play, { className: "ml-1 h-8 w-8" }),
1232
1399
  icon === "maximize" && /* @__PURE__ */ jsx(Maximize, { className: "h-8 w-8" })
1233
1400
  ] }) })
@@ -1384,7 +1551,7 @@ var VideoModal = ({
1384
1551
  }
1385
1552
  );
1386
1553
  }
1387
- return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center bg-gray-200 text-gray-500", children: "No video available" });
1554
+ return /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center bg-[var(--a63-surface-muted)] text-[var(--a63-text-secondary)]", children: "No video available" });
1388
1555
  };
1389
1556
  return /* @__PURE__ */ jsxs("div", { className: cn("group relative h-full w-full overflow-hidden", aspectRatio, className), children: [
1390
1557
  renderPreviewContent(),
@@ -1401,7 +1568,7 @@ var VideoModal = ({
1401
1568
  "aria-label": `Watch full ${title.toLowerCase()}`,
1402
1569
  className: cn(
1403
1570
  "absolute inset-0 z-10 flex items-center justify-center",
1404
- "bg-black/20 transition-opacity duration-300",
1571
+ "bg-[var(--a63-on-media-veil-strong)] transition-opacity duration-300",
1405
1572
  getButtonOpacity()
1406
1573
  ),
1407
1574
  onKeyDown: handleKeyDown,
@@ -1415,7 +1582,7 @@ var VideoModal = ({
1415
1582
  vimeoId
1416
1583
  }
1417
1584
  ),
1418
- isPlaying && videoRef.current?.readyState === 0 && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center bg-black/10", children: /* @__PURE__ */ jsx(LoaderCircle, { className: "size-6 animate-spin" }) })
1585
+ isPlaying && videoRef.current?.readyState === 0 && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center bg-[var(--a63-on-media-veil)]", children: /* @__PURE__ */ jsx(LoaderCircle, { className: "size-6 animate-spin" }) })
1419
1586
  ] });
1420
1587
  };
1421
1588
  var VIDEO_MIME = {