@classic-homes/theme-react 0.4.3 → 0.5.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.mjs CHANGED
@@ -98,9 +98,25 @@ var CardFooter = React2.forwardRef(
98
98
  CardFooter.displayName = "CardFooter";
99
99
 
100
100
  // src/components/Input.tsx
101
+ import * as React4 from "react";
102
+
103
+ // src/lib/useDevWarning.ts
101
104
  import * as React3 from "react";
105
+ var warnedOnce = /* @__PURE__ */ new Set();
106
+ function useDevWarning(condition, message, once = false) {
107
+ React3.useEffect(() => {
108
+ if (process.env.NODE_ENV === "production" || !condition) return;
109
+ if (once) {
110
+ if (warnedOnce.has(message)) return;
111
+ warnedOnce.add(message);
112
+ }
113
+ console.warn(message);
114
+ }, [condition, message, once]);
115
+ }
116
+
117
+ // src/components/Input.tsx
102
118
  import { jsx as jsx3 } from "react/jsx-runtime";
103
- var Input = React3.forwardRef(
119
+ var Input = React4.forwardRef(
104
120
  ({
105
121
  className,
106
122
  type,
@@ -109,13 +125,10 @@ var Input = React3.forwardRef(
109
125
  "aria-describedby": ariaDescribedBy,
110
126
  ...props
111
127
  }, ref) => {
112
- if (process.env.NODE_ENV !== "production") {
113
- if (!props["aria-label"] && !props["aria-labelledby"] && !props.id) {
114
- console.warn(
115
- "Input: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
116
- );
117
- }
118
- }
128
+ useDevWarning(
129
+ !props["aria-label"] && !props["aria-labelledby"] && !props.id,
130
+ "Input: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
131
+ );
119
132
  return /* @__PURE__ */ jsx3(
120
133
  "input",
121
134
  {
@@ -138,24 +151,24 @@ var Input = React3.forwardRef(
138
151
  Input.displayName = "Input";
139
152
 
140
153
  // src/components/PasswordInput.tsx
141
- import * as React5 from "react";
154
+ import * as React6 from "react";
142
155
 
143
156
  // src/hooks/useAnnounce.ts
144
- import * as React4 from "react";
157
+ import * as React5 from "react";
145
158
  function useAnnounce(defaultOptions) {
146
- const [message, setMessage] = React4.useState("");
147
- const [politeness, setPoliteness] = React4.useState(
159
+ const [message, setMessage] = React5.useState("");
160
+ const [politeness, setPoliteness] = React5.useState(
148
161
  defaultOptions?.politeness ?? "polite"
149
162
  );
150
- const clearTimeoutRef = React4.useRef(null);
151
- const clear = React4.useCallback(() => {
163
+ const clearTimeoutRef = React5.useRef(null);
164
+ const clear = React5.useCallback(() => {
152
165
  setMessage("");
153
166
  if (clearTimeoutRef.current) {
154
167
  clearTimeout(clearTimeoutRef.current);
155
168
  clearTimeoutRef.current = null;
156
169
  }
157
170
  }, []);
158
- const announce = React4.useCallback(
171
+ const announce = React5.useCallback(
159
172
  (newMessage, options) => {
160
173
  if (clearTimeoutRef.current) {
161
174
  clearTimeout(clearTimeoutRef.current);
@@ -173,7 +186,7 @@ function useAnnounce(defaultOptions) {
173
186
  },
174
187
  [defaultOptions?.clearDelay, defaultOptions?.politeness]
175
188
  );
176
- React4.useEffect(() => {
189
+ React5.useEffect(() => {
177
190
  return () => {
178
191
  if (clearTimeoutRef.current) {
179
192
  clearTimeout(clearTimeoutRef.current);
@@ -225,7 +238,7 @@ var EyeOffIcon = () => /* @__PURE__ */ jsx4(
225
238
  children: /* @__PURE__ */ jsx4("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24M1 1l22 22" })
226
239
  }
227
240
  );
228
- var PasswordInput = React5.forwardRef(
241
+ var PasswordInput = React6.forwardRef(
229
242
  ({
230
243
  className,
231
244
  disabled,
@@ -238,15 +251,12 @@ var PasswordInput = React5.forwardRef(
238
251
  "aria-labelledby": ariaLabelledBy,
239
252
  ...props
240
253
  }, ref) => {
241
- const [showPassword, setShowPassword] = React5.useState(false);
254
+ const [showPassword, setShowPassword] = React6.useState(false);
242
255
  const { announce, message, politeness } = useAnnounce();
243
- if (process.env.NODE_ENV !== "production") {
244
- if (!ariaLabel && !ariaLabelledBy && !id) {
245
- console.warn(
246
- "PasswordInput: Missing accessible label. Provide aria-label, aria-labelledby, or an id to associate with a Label element for WCAG compliance."
247
- );
248
- }
249
- }
256
+ useDevWarning(
257
+ !ariaLabel && !ariaLabelledBy && !id,
258
+ "PasswordInput: Missing accessible label. Provide aria-label, aria-labelledby, or an id to associate with a Label element for WCAG compliance."
259
+ );
250
260
  const toggleVisibility = () => {
251
261
  setShowPassword((prev) => {
252
262
  const newState = !prev;
@@ -290,20 +300,20 @@ var PasswordInput = React5.forwardRef(
290
300
  PasswordInput.displayName = "PasswordInput";
291
301
 
292
302
  // src/components/Label.tsx
293
- import * as React6 from "react";
303
+ import * as React7 from "react";
294
304
  import * as LabelPrimitive from "@radix-ui/react-label";
295
305
  import { cva as cva2 } from "class-variance-authority";
296
306
  import { jsx as jsx5 } from "react/jsx-runtime";
297
307
  var labelVariants = cva2(
298
308
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
299
309
  );
300
- var Label = React6.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
310
+ var Label = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx5(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
301
311
  Label.displayName = LabelPrimitive.Root.displayName;
302
312
 
303
313
  // src/components/Badge.tsx
304
- import * as React7 from "react";
314
+ import * as React8 from "react";
305
315
  import { cva as cva3 } from "class-variance-authority";
306
- import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
316
+ import { Fragment, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
307
317
  var badgeVariants = cva3(
308
318
  "inline-flex items-center justify-center rounded-md border font-medium w-fit whitespace-nowrap shrink-0 gap-1",
309
319
  {
@@ -349,7 +359,7 @@ var badgeVariants = cva3(
349
359
  }
350
360
  }
351
361
  );
352
- var Badge = React7.forwardRef(
362
+ var Badge = React8.forwardRef(
353
363
  ({ className, variant, size, live, clickable, label, children, onClick, ...props }, ref) => {
354
364
  if (process.env.NODE_ENV !== "production") {
355
365
  if (live && !label) {
@@ -360,41 +370,34 @@ var Badge = React7.forwardRef(
360
370
  }
361
371
  const isInteractive = clickable || !!onClick;
362
372
  const classes = cn(badgeVariants({ variant, size, clickable: isInteractive }), className);
363
- const sharedProps = {
364
- role: live ? "status" : void 0,
365
- "aria-live": live ? "polite" : void 0,
366
- "aria-atomic": live ? "true" : void 0,
367
- className: classes,
368
- ...props
369
- };
373
+ const liveProps = live ? { role: "status", "aria-live": "polite", "aria-atomic": "true" } : {};
374
+ const content = /* @__PURE__ */ jsxs2(Fragment, { children: [
375
+ children,
376
+ label && /* @__PURE__ */ jsx6("span", { className: "sr-only", children: label })
377
+ ] });
370
378
  if (isInteractive) {
371
- return /* @__PURE__ */ jsxs2(
379
+ return /* @__PURE__ */ jsx6(
372
380
  "button",
373
381
  {
374
382
  ref,
375
383
  type: "button",
376
384
  onClick,
377
- ...sharedProps,
378
- children: [
379
- children,
380
- label && /* @__PURE__ */ jsx6("span", { className: "sr-only", children: label })
381
- ]
385
+ className: classes,
386
+ ...props,
387
+ children: live ? /* @__PURE__ */ jsx6("span", { ...liveProps, children: content }) : content
382
388
  }
383
389
  );
384
390
  }
385
- return /* @__PURE__ */ jsxs2("span", { ref, ...sharedProps, children: [
386
- children,
387
- label && /* @__PURE__ */ jsx6("span", { className: "sr-only", children: label })
388
- ] });
391
+ return /* @__PURE__ */ jsx6("span", { ref, ...liveProps, className: classes, ...props, children: content });
389
392
  }
390
393
  );
391
394
  Badge.displayName = "Badge";
392
395
 
393
396
  // src/components/Separator.tsx
394
- import * as React8 from "react";
397
+ import * as React9 from "react";
395
398
  import * as SeparatorPrimitive from "@radix-ui/react-separator";
396
399
  import { jsx as jsx7 } from "react/jsx-runtime";
397
- var Separator = React8.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => {
400
+ var Separator = React9.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => {
398
401
  if (process.env.NODE_ENV !== "production") {
399
402
  if (!decorative && !props["aria-label"]) {
400
403
  console.warn(
@@ -420,12 +423,12 @@ var Separator = React8.forwardRef(({ className, orientation = "horizontal", deco
420
423
  Separator.displayName = SeparatorPrimitive.Root.displayName;
421
424
 
422
425
  // src/components/Switch.tsx
423
- import * as React9 from "react";
426
+ import * as React10 from "react";
424
427
  import * as SwitchPrimitives from "@radix-ui/react-switch";
425
428
  import { jsx as jsx8 } from "react/jsx-runtime";
426
429
  var SwitchRoot = SwitchPrimitives.Root;
427
430
  var SwitchThumb = SwitchPrimitives.Thumb;
428
- var Switch = React9.forwardRef(
431
+ var Switch = React10.forwardRef(
429
432
  ({
430
433
  className,
431
434
  size = "default",
@@ -434,13 +437,10 @@ var Switch = React9.forwardRef(
434
437
  "aria-describedby": ariaDescribedBy,
435
438
  ...props
436
439
  }, ref) => {
437
- if (process.env.NODE_ENV !== "production") {
438
- if (!ariaLabel && !ariaLabelledBy && !props.id) {
439
- console.warn(
440
- "Switch: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
441
- );
442
- }
443
- }
440
+ useDevWarning(
441
+ !ariaLabel && !ariaLabelledBy && !props.id,
442
+ "Switch: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
443
+ );
444
444
  return /* @__PURE__ */ jsx8(
445
445
  SwitchRoot,
446
446
  {
@@ -472,10 +472,10 @@ var Switch = React9.forwardRef(
472
472
  Switch.displayName = SwitchPrimitives.Root.displayName;
473
473
 
474
474
  // src/components/Avatar.tsx
475
- import * as React10 from "react";
475
+ import * as React11 from "react";
476
476
  import * as AvatarPrimitive from "@radix-ui/react-avatar";
477
477
  import { jsx as jsx9 } from "react/jsx-runtime";
478
- var Avatar = React10.forwardRef(
478
+ var Avatar = React11.forwardRef(
479
479
  ({ className, name, "aria-label": ariaLabel, ...props }, ref) => {
480
480
  if (process.env.NODE_ENV !== "production") {
481
481
  if (!ariaLabel && !name) {
@@ -489,6 +489,7 @@ var Avatar = React10.forwardRef(
489
489
  AvatarPrimitive.Root,
490
490
  {
491
491
  ref,
492
+ role: computedAriaLabel ? "img" : void 0,
492
493
  "aria-label": computedAriaLabel,
493
494
  className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
494
495
  ...props
@@ -497,7 +498,7 @@ var Avatar = React10.forwardRef(
497
498
  }
498
499
  );
499
500
  Avatar.displayName = AvatarPrimitive.Root.displayName;
500
- var AvatarImage = React10.forwardRef(({ className, alt, ...props }, ref) => /* @__PURE__ */ jsx9(
501
+ var AvatarImage = React11.forwardRef(({ className, alt, ...props }, ref) => /* @__PURE__ */ jsx9(
501
502
  AvatarPrimitive.Image,
502
503
  {
503
504
  ref,
@@ -507,7 +508,7 @@ var AvatarImage = React10.forwardRef(({ className, alt, ...props }, ref) => /* @
507
508
  }
508
509
  ));
509
510
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
510
- var AvatarFallback = React10.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
511
+ var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
511
512
  AvatarPrimitive.Fallback,
512
513
  {
513
514
  ref,
@@ -521,7 +522,7 @@ var AvatarFallback = React10.forwardRef(({ className, ...props }, ref) => /* @__
521
522
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
522
523
 
523
524
  // src/components/Dialog.tsx
524
- import * as React11 from "react";
525
+ import * as React12 from "react";
525
526
  import * as DialogPrimitive from "@radix-ui/react-dialog";
526
527
  import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
527
528
  var PrimitiveOverlay = DialogPrimitive.Overlay;
@@ -540,7 +541,7 @@ var dialogSizeClasses = {
540
541
  "2xl": "max-w-[min(theme(maxWidth.3xl),calc(100vw-2rem))]",
541
542
  full: "max-w-[calc(100vw-2rem)]"
542
543
  };
543
- var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
544
+ var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
544
545
  PrimitiveOverlay,
545
546
  {
546
547
  ref,
@@ -552,19 +553,50 @@ var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__P
552
553
  }
553
554
  ));
554
555
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
555
- var DialogContent = React11.forwardRef(({ className, children, size = "md", ...props }, ref) => /* @__PURE__ */ jsxs3(DialogPortal, { children: [
556
+ var DialogContent = React12.forwardRef(({ className, children, size = "md", showClose = false, ...props }, ref) => /* @__PURE__ */ jsxs3(DialogPortal, { children: [
556
557
  /* @__PURE__ */ jsx10(DialogOverlay, {}),
557
- /* @__PURE__ */ jsx10(
558
+ /* @__PURE__ */ jsxs3(
558
559
  PrimitiveContent,
559
560
  {
560
561
  ref,
561
562
  className: cn(
562
- "fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
563
+ // max-h + overflow: a dialog taller than the viewport scrolls inside
564
+ // itself instead of running off-screen.
565
+ "fixed left-[50%] top-[50%] z-50 grid max-h-[calc(100dvh-2rem)] w-full translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto overscroll-contain border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
563
566
  dialogSizeClasses[size],
564
567
  className
565
568
  ),
566
569
  ...props,
567
- children
570
+ children: [
571
+ children,
572
+ showClose && /* @__PURE__ */ jsx10(
573
+ DialogPrimitive.Close,
574
+ {
575
+ className: "absolute right-3 top-3 flex h-9 w-9 items-center justify-center rounded-md bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none",
576
+ "aria-label": "Close dialog",
577
+ children: /* @__PURE__ */ jsxs3(
578
+ "svg",
579
+ {
580
+ xmlns: "http://www.w3.org/2000/svg",
581
+ width: "20",
582
+ height: "20",
583
+ viewBox: "0 0 24 24",
584
+ fill: "none",
585
+ stroke: "currentColor",
586
+ strokeWidth: "2",
587
+ strokeLinecap: "round",
588
+ strokeLinejoin: "round",
589
+ className: "h-5 w-5",
590
+ "aria-hidden": "true",
591
+ children: [
592
+ /* @__PURE__ */ jsx10("path", { d: "M18 6 6 18" }),
593
+ /* @__PURE__ */ jsx10("path", { d: "m6 6 12 12" })
594
+ ]
595
+ }
596
+ )
597
+ }
598
+ )
599
+ ]
568
600
  }
569
601
  )
570
602
  ] }));
@@ -579,7 +611,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx10(
579
611
  }
580
612
  );
581
613
  DialogFooter.displayName = "DialogFooter";
582
- var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
614
+ var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
583
615
  PrimitiveTitle,
584
616
  {
585
617
  ref,
@@ -588,7 +620,7 @@ var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
588
620
  }
589
621
  ));
590
622
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
591
- var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
623
+ var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
592
624
  PrimitiveDescription,
593
625
  {
594
626
  ref,
@@ -599,7 +631,7 @@ var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /*
599
631
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
600
632
 
601
633
  // src/components/PageHeader.tsx
602
- import * as React12 from "react";
634
+ import * as React13 from "react";
603
635
  import { cva as cva4 } from "class-variance-authority";
604
636
  import { jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
605
637
  var pageHeaderContainerVariants = cva4("", {
@@ -662,15 +694,13 @@ var pageHeaderActionsVariants = cva4("flex gap-4", {
662
694
  variant: "default"
663
695
  }
664
696
  });
665
- var PageHeader = React12.forwardRef(
697
+ var PageHeader = React13.forwardRef(
666
698
  ({ className, variant, title, subtitle, actions, as: Heading = "h1", ...props }, ref) => {
667
- if (process.env.NODE_ENV !== "production") {
668
- if (Heading === "h1") {
669
- console.warn(
670
- 'PageHeader: Using as="h1" (the default). Ensure there is only one h1 per page for proper document structure. Consider as="h2" for secondary headers.'
671
- );
672
- }
673
- }
699
+ useDevWarning(
700
+ Heading === "h1",
701
+ 'PageHeader: Using as="h1" (the default). Ensure there is only one h1 per page for proper document structure. Consider as="h2" for secondary headers.',
702
+ true
703
+ );
674
704
  return /* @__PURE__ */ jsxs4(
675
705
  "header",
676
706
  {
@@ -766,7 +796,7 @@ function StudioIcon({
766
796
  }
767
797
 
768
798
  // src/components/Sheet.tsx
769
- import { Fragment, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
799
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
770
800
  var sheetVariants = cva5(
771
801
  "fixed z-50 flex flex-col border-border bg-background shadow-lg outline-none duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out",
772
802
  {
@@ -813,7 +843,7 @@ function Sheet({
813
843
  /* @__PURE__ */ jsx13("div", { className: "h-1.5 w-10 rounded-full bg-muted", "aria-hidden": "true" }),
814
844
  hideTitle && /* @__PURE__ */ jsx13("div", { className: "absolute right-2 top-1", children: close })
815
845
  ] }),
816
- hideTitle ? /* @__PURE__ */ jsxs5(Fragment, { children: [
846
+ hideTitle ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
817
847
  /* @__PURE__ */ jsx13(DialogPrimitive2.Title, { className: "sr-only", children: title }),
818
848
  description && /* @__PURE__ */ jsx13(DialogPrimitive2.Description, { className: "sr-only", children: description }),
819
849
  side !== "bottom" && /* @__PURE__ */ jsx13("div", { className: "absolute right-2 top-2 z-10", children: close })
@@ -836,8 +866,9 @@ function Sheet({
836
866
  }
837
867
 
838
868
  // src/components/SortableList.tsx
839
- import * as React13 from "react";
840
- import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
869
+ import * as React14 from "react";
870
+ import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
871
+ var HANDLE_STYLE = { touchAction: "none" };
841
872
  function SortableList({
842
873
  items,
843
874
  getKey,
@@ -849,19 +880,19 @@ function SortableList({
849
880
  className,
850
881
  itemClassName
851
882
  }) {
852
- const instructionsId = `${React13.useId()}-sortable-help`;
853
- const listRef = React13.useRef(null);
854
- const [announcement, setAnnouncement] = React13.useState("");
855
- const [drag, setDrag] = React13.useState(
883
+ const instructionsId = `${React14.useId()}-sortable-help`;
884
+ const listRef = React14.useRef(null);
885
+ const [announcement, setAnnouncement] = React14.useState("");
886
+ const [drag, setDrag] = React14.useState(
856
887
  null
857
888
  );
858
- const rects = React13.useRef([]);
859
- const startY = React13.useRef(0);
860
- const [grabbed, setGrabbed] = React13.useState(null);
861
- const grabbedFrom = React13.useRef(0);
862
- const moving = React13.useRef(false);
863
- const pendingFocus = React13.useRef(null);
864
- React13.useLayoutEffect(() => {
889
+ const rects = React14.useRef([]);
890
+ const startY = React14.useRef(0);
891
+ const [grabbed, setGrabbed] = React14.useState(null);
892
+ const grabbedFrom = React14.useRef(0);
893
+ const moving = React14.useRef(false);
894
+ const pendingFocus = React14.useRef(null);
895
+ React14.useLayoutEffect(() => {
865
896
  if (pendingFocus.current === null) return;
866
897
  const handles = listRef.current?.querySelectorAll(
867
898
  ":scope > li [data-sortable-handle]"
@@ -908,6 +939,7 @@ function SortableList({
908
939
  "aria-describedby": instructionsId,
909
940
  "aria-pressed": grabbed === index,
910
941
  "data-sortable-handle": String(key),
942
+ style: HANDLE_STYLE,
911
943
  onPointerDown(event) {
912
944
  if (disabled || event.button !== 0 || !listRef.current) return;
913
945
  event.preventDefault();
@@ -967,7 +999,7 @@ function SortableList({
967
999
  if (!moving.current && grabbed === index) setGrabbed(null);
968
1000
  }
969
1001
  });
970
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
1002
+ return /* @__PURE__ */ jsxs6(Fragment3, { children: [
971
1003
  /* @__PURE__ */ jsx14("ul", { ref: listRef, "aria-label": label, className: cn("relative", className), children: items.map((item, index) => {
972
1004
  const key = getKey(item, index);
973
1005
  const dragging = drag?.from === index || grabbed === index;
@@ -999,20 +1031,20 @@ function SortableList({
999
1031
  }
1000
1032
 
1001
1033
  // src/components/studio/Studio.tsx
1002
- import * as React15 from "react";
1034
+ import * as React16 from "react";
1003
1035
 
1004
1036
  // src/components/studio/context.ts
1005
- import * as React14 from "react";
1006
- var StudioContext = React14.createContext(void 0);
1037
+ import * as React15 from "react";
1038
+ var StudioContext = React15.createContext(void 0);
1007
1039
  function useStudio() {
1008
- return React14.useContext(StudioContext);
1040
+ return React15.useContext(StudioContext);
1009
1041
  }
1010
1042
 
1011
1043
  // src/components/studio/Studio.tsx
1012
1044
  import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
1013
1045
  function useLayout() {
1014
- const [layout, setLayout] = React15.useState("wide");
1015
- React15.useEffect(() => {
1046
+ const [layout, setLayout] = React16.useState("wide");
1047
+ React16.useEffect(() => {
1016
1048
  const wide = window.matchMedia("(min-width: 1280px)");
1017
1049
  const medium = window.matchMedia("(min-width: 768px)");
1018
1050
  const update = () => setLayout(wide.matches ? "wide" : medium.matches ? "medium" : "compact");
@@ -1027,9 +1059,9 @@ function useLayout() {
1027
1059
  return layout;
1028
1060
  }
1029
1061
  function useControllable(value, onChange) {
1030
- const [inner, setInner] = React15.useState(false);
1062
+ const [inner, setInner] = React16.useState(false);
1031
1063
  const current = value ?? inner;
1032
- const set = React15.useCallback(
1064
+ const set = React16.useCallback(
1033
1065
  (next) => {
1034
1066
  if (value === void 0) setInner(next);
1035
1067
  onChange?.(next);
@@ -1061,11 +1093,11 @@ function Studio({
1061
1093
  );
1062
1094
  const railInSheet = !!rail && layout !== "wide";
1063
1095
  const inspectorInSheet = !!inspector && layout === "compact";
1064
- React15.useEffect(() => {
1096
+ React16.useEffect(() => {
1065
1097
  if (layout === "wide" && railOpen) setRailOpen(false);
1066
1098
  if (layout !== "compact" && inspectorOpen) setInspectorOpen(false);
1067
1099
  }, [layout, railOpen, inspectorOpen, setRailOpen, setInspectorOpen]);
1068
- const context = React15.useMemo(
1100
+ const context = React16.useMemo(
1069
1101
  () => ({
1070
1102
  layout,
1071
1103
  railInSheet,
@@ -1159,7 +1191,7 @@ function Studio({
1159
1191
  }
1160
1192
 
1161
1193
  // src/components/studio/StudioBar.tsx
1162
- import * as React16 from "react";
1194
+ import * as React17 from "react";
1163
1195
 
1164
1196
  // src/components/studio/menu.tsx
1165
1197
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
@@ -1209,7 +1241,7 @@ function ModeSwitch({
1209
1241
  value,
1210
1242
  onChange
1211
1243
  }) {
1212
- const refs = React16.useRef([]);
1244
+ const refs = React17.useRef([]);
1213
1245
  const keyDown = (event, index) => {
1214
1246
  const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
1215
1247
  if (!step) return;
@@ -1272,9 +1304,9 @@ function StudioBar({
1272
1304
  menuLabel = "More actions",
1273
1305
  className
1274
1306
  }) {
1275
- const [draft, setDraft] = React16.useState(title);
1276
- const atFocus = React16.useRef(title);
1277
- React16.useEffect(() => setDraft(title), [title]);
1307
+ const [draft, setDraft] = React17.useState(title);
1308
+ const atFocus = React17.useRef(title);
1309
+ React17.useEffect(() => setDraft(title), [title]);
1278
1310
  const commit = () => {
1279
1311
  const next = draft.trim();
1280
1312
  if (!next) {
@@ -1364,7 +1396,7 @@ function StudioBar({
1364
1396
  }
1365
1397
 
1366
1398
  // src/components/studio/StudioOutline.tsx
1367
- import * as React17 from "react";
1399
+ import * as React18 from "react";
1368
1400
  import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
1369
1401
  function StudioOutline({
1370
1402
  items,
@@ -1382,12 +1414,12 @@ function StudioOutline({
1382
1414
  className
1383
1415
  }) {
1384
1416
  const studio = useStudio();
1385
- const listHost = React17.useRef(null);
1417
+ const listHost = React18.useRef(null);
1386
1418
  const focusIndex = Math.max(
1387
1419
  0,
1388
1420
  items.findIndex((i) => i.id === selected)
1389
1421
  );
1390
- React17.useEffect(() => {
1422
+ React18.useEffect(() => {
1391
1423
  if (!selected) return;
1392
1424
  listHost.current?.querySelector(`[data-outline-id="${CSS.escape(selected)}"]`)?.scrollIntoView?.({ block: "nearest" });
1393
1425
  }, [selected]);
@@ -1544,8 +1576,9 @@ function StudioOutline({
1544
1576
  }
1545
1577
 
1546
1578
  // src/components/studio/StudioCanvas.tsx
1547
- import * as React18 from "react";
1579
+ import * as React19 from "react";
1548
1580
  import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
1581
+ var DEVICES = ["desktop", "phone"];
1549
1582
  function StudioCanvas({
1550
1583
  children,
1551
1584
  deviceToggle = false,
@@ -1559,13 +1592,31 @@ function StudioCanvas({
1559
1592
  className
1560
1593
  }) {
1561
1594
  const studio = useStudio();
1562
- const [innerDevice, setInnerDevice] = React18.useState("desktop");
1595
+ const [innerDevice, setInnerDevice] = React19.useState("desktop");
1563
1596
  const device = deviceProp ?? innerDevice;
1564
1597
  const setDevice = (d) => {
1565
1598
  if (deviceProp === void 0) setInnerDevice(d);
1566
1599
  onDeviceChange?.(d);
1567
1600
  };
1568
1601
  const showDevices = deviceToggle && studio?.layout !== "compact";
1602
+ const deviceRefs = React19.useRef([]);
1603
+ const deviceKeyDown = (event, index) => {
1604
+ const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
1605
+ if (!step) return;
1606
+ event.preventDefault();
1607
+ const next = (index + step + DEVICES.length) % DEVICES.length;
1608
+ setDevice(DEVICES[next]);
1609
+ deviceRefs.current[next]?.focus();
1610
+ };
1611
+ const handleKeyDown = (e) => {
1612
+ if (e.key !== "Escape" || e.defaultPrevented || !onBackgroundClick) return;
1613
+ const target = e.target;
1614
+ if (target.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName)) {
1615
+ return;
1616
+ }
1617
+ e.preventDefault();
1618
+ onBackgroundClick();
1619
+ };
1569
1620
  const width = device === "phone" && showDevices ? "390px" : maxWidth;
1570
1621
  return /* @__PURE__ */ jsxs11("section", { "aria-label": label, className: cn("flex h-full flex-col", className), children: [
1571
1622
  (showDevices || toolbar) && /* @__PURE__ */ jsxs11("div", { className: "flex shrink-0 items-center justify-end gap-2 px-3 pt-3", children: [
@@ -1576,13 +1627,18 @@ function StudioCanvas({
1576
1627
  role: "radiogroup",
1577
1628
  "aria-label": "Preview size",
1578
1629
  className: "inline-flex h-9 items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground",
1579
- children: ["desktop", "phone"].map((d) => /* @__PURE__ */ jsxs11(
1630
+ children: DEVICES.map((d, i) => /* @__PURE__ */ jsxs11(
1580
1631
  "button",
1581
1632
  {
1633
+ ref: (el) => {
1634
+ deviceRefs.current[i] = el;
1635
+ },
1582
1636
  type: "button",
1583
1637
  role: "radio",
1584
1638
  "aria-checked": device === d,
1639
+ tabIndex: device === d ? 0 : -1,
1585
1640
  onClick: () => setDevice(d),
1641
+ onKeyDown: (e) => deviceKeyDown(e, i),
1586
1642
  className: cn(
1587
1643
  "inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-sm font-medium hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1588
1644
  device === d && "bg-background text-foreground shadow-sm"
@@ -1604,6 +1660,7 @@ function StudioCanvas({
1604
1660
  onClick: (e) => {
1605
1661
  if (e.target === e.currentTarget) onBackgroundClick?.();
1606
1662
  },
1663
+ onKeyDown: handleKeyDown,
1607
1664
  children: /* @__PURE__ */ jsx19(
1608
1665
  "div",
1609
1666
  {
@@ -1621,7 +1678,7 @@ function StudioCanvas({
1621
1678
  }
1622
1679
 
1623
1680
  // src/components/studio/StudioCanvasItem.tsx
1624
- import * as React19 from "react";
1681
+ import * as React20 from "react";
1625
1682
  import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
1626
1683
  function StudioCanvasItem({
1627
1684
  children,
@@ -1636,14 +1693,14 @@ function StudioCanvasItem({
1636
1693
  className
1637
1694
  }) {
1638
1695
  const studio = useStudio();
1639
- const ref = React19.useRef(null);
1640
- const pickedHere = React19.useRef(false);
1696
+ const ref = React20.useRef(null);
1697
+ const pickedHere = React20.useRef(false);
1641
1698
  const inQuickAction = (target) => !!target?.closest?.("[data-studio-quick-action]");
1642
1699
  const select = (reveal) => {
1643
1700
  if (!selected) onSelect?.();
1644
1701
  if (reveal) studio?.revealInspector();
1645
1702
  };
1646
- React19.useEffect(() => {
1703
+ React20.useEffect(() => {
1647
1704
  const el = ref.current;
1648
1705
  const here = pickedHere.current;
1649
1706
  pickedHere.current = false;
@@ -1721,7 +1778,7 @@ function StudioCanvasItem({
1721
1778
  }
1722
1779
 
1723
1780
  // src/components/studio/StudioInspector.tsx
1724
- import * as React20 from "react";
1781
+ import * as React21 from "react";
1725
1782
  import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
1726
1783
  function StudioInspector({
1727
1784
  title,
@@ -1734,9 +1791,10 @@ function StudioInspector({
1734
1791
  footer,
1735
1792
  className
1736
1793
  }) {
1737
- const uid = React20.useId();
1738
- const [innerTab, setInnerTab] = React20.useState(tabs?.[0]?.id ?? "");
1739
- const tab = tabProp ?? innerTab;
1794
+ const uid = React21.useId();
1795
+ const [innerTab, setInnerTab] = React21.useState(tabs?.[0]?.id ?? "");
1796
+ const requestedTab = tabProp ?? innerTab;
1797
+ const tab = !tabs || tabs.some((t) => t.id === requestedTab) ? requestedTab : tabs[0]?.id ?? "";
1740
1798
  const hasTabs = !!tabs && tabs.length > 1;
1741
1799
  const choose = (id) => {
1742
1800
  if (id === tab) return;
@@ -1812,8 +1870,8 @@ function StudioInspectorSection({
1812
1870
  children,
1813
1871
  className
1814
1872
  }) {
1815
- const uid = React20.useId();
1816
- const [open, setOpen] = React20.useState(defaultOpen);
1873
+ const uid = React21.useId();
1874
+ const [open, setOpen] = React21.useState(defaultOpen);
1817
1875
  const expanded = !collapsible || open;
1818
1876
  return /* @__PURE__ */ jsxs13(
1819
1877
  "section",
@@ -1873,7 +1931,7 @@ function StudioPage({
1873
1931
 
1874
1932
  // src/components/studio/SaveStatus.tsx
1875
1933
  import * as PopoverPrimitive from "@radix-ui/react-popover";
1876
- import { Fragment as Fragment3, jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
1934
+ import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
1877
1935
  var META = {
1878
1936
  saved: { label: "Saved", icon: "check-circle", tone: "text-muted-foreground" },
1879
1937
  saving: { label: "Saving\u2026", icon: "loader", tone: "text-muted-foreground" },
@@ -1890,7 +1948,7 @@ function SaveStatus({ state, detail, onRetry, label, className }) {
1890
1948
  const text = label ?? meta.label;
1891
1949
  const canRetry = !!onRetry && (state === "error" || state === "offline");
1892
1950
  const announced = ["error", "offline", "conflict", "invalid"].includes(state);
1893
- const content = /* @__PURE__ */ jsxs14(Fragment3, { children: [
1951
+ const content = /* @__PURE__ */ jsxs14(Fragment4, { children: [
1894
1952
  /* @__PURE__ */ jsx22(
1895
1953
  StudioIcon,
1896
1954
  {
@@ -1947,9 +2005,9 @@ function SaveStatus({ state, detail, onRetry, label, className }) {
1947
2005
  }
1948
2006
 
1949
2007
  // src/components/studio/IssuesButton.tsx
1950
- import * as React21 from "react";
2008
+ import * as React22 from "react";
1951
2009
  import * as PopoverPrimitive2 from "@radix-ui/react-popover";
1952
- import { Fragment as Fragment4, jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
2010
+ import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
1953
2011
  var plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
1954
2012
  function IssuesButton({
1955
2013
  issues,
@@ -1960,7 +2018,7 @@ function IssuesButton({
1960
2018
  showWhenEmpty = false,
1961
2019
  className
1962
2020
  }) {
1963
- const [innerOpen, setInnerOpen] = React21.useState(false);
2021
+ const [innerOpen, setInnerOpen] = React22.useState(false);
1964
2022
  const open = openProp ?? innerOpen;
1965
2023
  const setOpen = (next) => {
1966
2024
  if (openProp === void 0) setInnerOpen(next);
@@ -1987,7 +2045,7 @@ function IssuesButton({
1987
2045
  }
1988
2046
  ) : null;
1989
2047
  }
1990
- const group = (list, heading, error) => list.length > 0 && /* @__PURE__ */ jsxs15(Fragment4, { children: [
2048
+ const group = (list, heading, error) => list.length > 0 && /* @__PURE__ */ jsxs15(Fragment5, { children: [
1991
2049
  /* @__PURE__ */ jsx23("p", { className: "px-3 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: heading }),
1992
2050
  /* @__PURE__ */ jsx23("ul", { className: "pb-1", children: list.map((issue) => /* @__PURE__ */ jsx23("li", { children: /* @__PURE__ */ jsxs15(
1993
2051
  "button",
@@ -2058,7 +2116,7 @@ function IssuesButton({
2058
2116
  }
2059
2117
 
2060
2118
  // src/components/studio/InsertPalette.tsx
2061
- import * as React22 from "react";
2119
+ import * as React23 from "react";
2062
2120
  import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
2063
2121
  function InsertPalette({
2064
2122
  open,
@@ -2070,11 +2128,11 @@ function InsertPalette({
2070
2128
  searchPlaceholder = "Search",
2071
2129
  renderThumbnail
2072
2130
  }) {
2073
- const [query, setQuery] = React22.useState("");
2074
- const picked = React22.useRef(false);
2075
- const listRef = React22.useRef(null);
2076
- const searchRef = React22.useRef(null);
2077
- React22.useEffect(() => {
2131
+ const [query, setQuery] = React23.useState("");
2132
+ const picked = React23.useRef(false);
2133
+ const listRef = React23.useRef(null);
2134
+ const searchRef = React23.useRef(null);
2135
+ React23.useEffect(() => {
2078
2136
  if (!open) return;
2079
2137
  setQuery("");
2080
2138
  picked.current = false;
@@ -2206,11 +2264,11 @@ function InsertPalette({
2206
2264
  }
2207
2265
 
2208
2266
  // src/components/DataPanel.tsx
2209
- import * as React24 from "react";
2267
+ import * as React25 from "react";
2210
2268
  import * as DropdownMenuPrimitive2 from "@radix-ui/react-dropdown-menu";
2211
2269
 
2212
2270
  // src/hooks/useFocusTrap.ts
2213
- import { useEffect as useEffect7, useRef as useRef7, useCallback as useCallback3 } from "react";
2271
+ import { useEffect as useEffect8, useRef as useRef8, useCallback as useCallback3 } from "react";
2214
2272
  var FOCUSABLE_SELECTOR = [
2215
2273
  "a[href]",
2216
2274
  "area[href]",
@@ -2232,8 +2290,8 @@ function getFocusableElements(container) {
2232
2290
  }
2233
2291
  function useFocusTrap(options = {}) {
2234
2292
  const { active = true, returnFocusTo, initialFocus, preventScroll = false } = options;
2235
- const containerRef = useRef7(null);
2236
- const previousActiveElementRef = useRef7(null);
2293
+ const containerRef = useRef8(null);
2294
+ const previousActiveElementRef = useRef8(null);
2237
2295
  const handleKeyDown = useCallback3(
2238
2296
  (event) => {
2239
2297
  if (!active || event.key !== "Tab") return;
@@ -2257,12 +2315,13 @@ function useFocusTrap(options = {}) {
2257
2315
  },
2258
2316
  [active, preventScroll]
2259
2317
  );
2260
- useEffect7(() => {
2318
+ useEffect8(() => {
2261
2319
  if (!active) return;
2262
2320
  const container = containerRef.current;
2263
2321
  if (!container) return;
2264
2322
  previousActiveElementRef.current = document.activeElement;
2265
2323
  const focusableElements = getFocusableElements(container);
2324
+ let focusFrame = 0;
2266
2325
  if (focusableElements.length > 0) {
2267
2326
  let elementToFocus = null;
2268
2327
  if (initialFocus) {
@@ -2271,12 +2330,13 @@ function useFocusTrap(options = {}) {
2271
2330
  if (!elementToFocus) {
2272
2331
  elementToFocus = focusableElements[0];
2273
2332
  }
2274
- requestAnimationFrame(() => {
2333
+ focusFrame = requestAnimationFrame(() => {
2275
2334
  elementToFocus?.focus({ preventScroll });
2276
2335
  });
2277
2336
  }
2278
2337
  document.addEventListener("keydown", handleKeyDown);
2279
2338
  return () => {
2339
+ cancelAnimationFrame(focusFrame);
2280
2340
  document.removeEventListener("keydown", handleKeyDown);
2281
2341
  const elementToReturn = returnFocusTo ?? previousActiveElementRef.current;
2282
2342
  if (elementToReturn && typeof elementToReturn.focus === "function") {
@@ -2288,14 +2348,14 @@ function useFocusTrap(options = {}) {
2288
2348
  }
2289
2349
 
2290
2350
  // src/hooks/useEscapeKey.ts
2291
- import * as React23 from "react";
2351
+ import * as React24 from "react";
2292
2352
  function useEscapeKey(callback, options) {
2293
2353
  const { enabled = true, preventDefault = true, stopPropagation = false } = options ?? {};
2294
- const callbackRef = React23.useRef(callback);
2295
- React23.useEffect(() => {
2354
+ const callbackRef = React24.useRef(callback);
2355
+ React24.useEffect(() => {
2296
2356
  callbackRef.current = callback;
2297
2357
  }, [callback]);
2298
- React23.useEffect(() => {
2358
+ React24.useEffect(() => {
2299
2359
  if (!enabled) return;
2300
2360
  const handleKeyDown = (event) => {
2301
2361
  if (event.key === "Escape") {
@@ -2349,68 +2409,76 @@ import {
2349
2409
  calculateDetachedPositionFromPinned,
2350
2410
  getPinnedPullTransform
2351
2411
  } from "@classic-homes/data-panel-core";
2352
- import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
2412
+ import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs17 } from "react/jsx-runtime";
2353
2413
  function layoutViewportWidth() {
2354
2414
  return document.documentElement.clientWidth;
2355
2415
  }
2416
+ var SSR_VIEWPORT_WIDTH = 1024;
2417
+ var SSR_VIEWPORT_HEIGHT = 768;
2418
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React25.useLayoutEffect : React25.useEffect;
2356
2419
  function isSecondaryMouseButton(e) {
2357
2420
  return e.pointerType === "mouse" && e.button !== 0;
2358
2421
  }
2359
2422
  var DropdownTrigger = DropdownMenuPrimitive2.Trigger;
2360
2423
  var DropdownContent = DropdownMenuPrimitive2.Content;
2361
2424
  var DropdownLabel = DropdownMenuPrimitive2.Label;
2362
- var DropdownItem = DropdownMenuPrimitive2.Item;
2425
+ var DropdownRadioGroup = DropdownMenuPrimitive2.RadioGroup;
2426
+ var DropdownRadioItem = DropdownMenuPrimitive2.RadioItem;
2427
+ var DropdownItemIndicator = DropdownMenuPrimitive2.ItemIndicator;
2428
+ var menuRadioItemClass = "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none bg-popover focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
2363
2429
  var DropdownSeparator = DropdownMenuPrimitive2.Separator;
2430
+ var EMPTY_CONSTRAINTS = {};
2431
+ var EMPTY_CARD_CONFIG = {};
2432
+ var EMPTY_ACTIONS = [];
2364
2433
  function useDataPanel(options = {}) {
2365
2434
  const {
2366
2435
  persistKey,
2367
2436
  initialMode = DEFAULT_PANEL_STATE.mode,
2368
2437
  initialEdge = DEFAULT_PANEL_STATE.edge,
2369
2438
  initialExpanded = DEFAULT_PANEL_STATE.isExpanded,
2370
- constraints = {}
2439
+ constraints = EMPTY_CONSTRAINTS
2371
2440
  } = options;
2372
- const resolvedConstraints = { ...DEFAULT_CONSTRAINTS, ...constraints };
2373
- const [persistedState] = React24.useState(() => {
2441
+ const resolvedConstraints = React25.useMemo(
2442
+ () => ({ ...DEFAULT_CONSTRAINTS, ...constraints }),
2443
+ [constraints]
2444
+ );
2445
+ const [persistedState] = React25.useState(() => {
2374
2446
  if (persistKey && typeof window !== "undefined") {
2375
2447
  return loadPanelState(persistKey);
2376
2448
  }
2377
2449
  return null;
2378
2450
  });
2379
- const [mode, setMode] = React24.useState(persistedState?.mode ?? initialMode);
2380
- const [edge, setEdge] = React24.useState(persistedState?.edge ?? initialEdge);
2381
- const [isExpanded, setIsExpanded] = React24.useState(
2451
+ const [mode, setMode] = React25.useState(persistedState?.mode ?? initialMode);
2452
+ const [edge, setEdge] = React25.useState(persistedState?.edge ?? initialEdge);
2453
+ const [isExpanded, setIsExpanded] = React25.useState(
2382
2454
  persistedState?.isExpanded ?? initialExpanded
2383
2455
  );
2384
- const [detachedPosition, setDetachedPosition] = React24.useState(
2456
+ const [detachedPosition, setDetachedPosition] = React25.useState(
2385
2457
  persistedState?.detachedPosition ?? DEFAULT_PANEL_STATE.detachedPosition
2386
2458
  );
2387
- const [detachedSize, setDetachedSize] = React24.useState(
2459
+ const [detachedSize, setDetachedSize] = React25.useState(
2388
2460
  persistedState?.detachedSize ?? DEFAULT_PANEL_STATE.detachedSize
2389
2461
  );
2390
- const [pinnedSize, setPinnedSize] = React24.useState(
2462
+ const [pinnedSize, setPinnedSize] = React25.useState(
2391
2463
  persistedState?.pinnedSize ?? DEFAULT_PANEL_STATE.pinnedSize
2392
2464
  );
2393
- const saveTimeoutRef = React24.useRef(null);
2394
- const debouncedSave = React24.useCallback(() => {
2465
+ const saveTimeoutRef = React25.useRef(null);
2466
+ const debouncedSave = React25.useCallback(() => {
2395
2467
  if (!persistKey) return;
2396
2468
  if (saveTimeoutRef.current) {
2397
2469
  clearTimeout(saveTimeoutRef.current);
2398
2470
  }
2399
2471
  saveTimeoutRef.current = setTimeout(() => {
2400
2472
  savePanelState(persistKey, {
2473
+ ...DEFAULT_PANEL_STATE,
2474
+ ...loadPanelState(persistKey),
2401
2475
  mode,
2402
- variant: "full",
2403
2476
  edge,
2404
- isExpanded,
2405
- detachedPosition,
2406
- detachedSize,
2407
- pinnedSize,
2408
- cardSnapIndex: 0,
2409
- tabOffset: 0
2477
+ isExpanded
2410
2478
  });
2411
2479
  }, 300);
2412
- }, [persistKey, mode, edge, isExpanded, detachedPosition, detachedSize, pinnedSize]);
2413
- const handleSetMode = React24.useCallback(
2480
+ }, [persistKey, mode, edge, isExpanded]);
2481
+ const handleSetMode = React25.useCallback(
2414
2482
  (newMode) => {
2415
2483
  setMode(newMode);
2416
2484
  if (newMode === "detached" && typeof window !== "undefined" && detachedPosition.x === DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === DEFAULT_PANEL_STATE.detachedPosition.y) {
@@ -2421,7 +2489,7 @@ function useDataPanel(options = {}) {
2421
2489
  },
2422
2490
  [detachedPosition, detachedSize]
2423
2491
  );
2424
- const handleSetDetachedPosition = React24.useCallback(
2492
+ const handleSetDetachedPosition = React25.useCallback(
2425
2493
  (position) => {
2426
2494
  if (typeof window === "undefined") {
2427
2495
  setDetachedPosition(position);
@@ -2433,13 +2501,13 @@ function useDataPanel(options = {}) {
2433
2501
  },
2434
2502
  [detachedSize]
2435
2503
  );
2436
- const handleSetDetachedSize = React24.useCallback(
2504
+ const handleSetDetachedSize = React25.useCallback(
2437
2505
  (size) => {
2438
2506
  setDetachedSize(constrainSize(size, resolvedConstraints));
2439
2507
  },
2440
2508
  [resolvedConstraints]
2441
2509
  );
2442
- const handleSetPinnedSize = React24.useCallback(
2510
+ const handleSetPinnedSize = React25.useCallback(
2443
2511
  (size) => {
2444
2512
  if (typeof window === "undefined") {
2445
2513
  setPinnedSize(size);
@@ -2453,7 +2521,7 @@ function useDataPanel(options = {}) {
2453
2521
  },
2454
2522
  [edge, resolvedConstraints]
2455
2523
  );
2456
- React24.useEffect(() => {
2524
+ React25.useEffect(() => {
2457
2525
  debouncedSave();
2458
2526
  }, [debouncedSave]);
2459
2527
  return {
@@ -2547,7 +2615,7 @@ var edgeLabels = {
2547
2615
  top: "Pin to top",
2548
2616
  bottom: "Pin to bottom"
2549
2617
  };
2550
- var DataPanelHeader = React24.forwardRef(
2618
+ var DataPanelHeader = React25.forwardRef(
2551
2619
  ({
2552
2620
  title,
2553
2621
  subtitle,
@@ -2578,7 +2646,7 @@ var DataPanelHeader = React24.forwardRef(
2578
2646
  ),
2579
2647
  "data-panel-header": true,
2580
2648
  children: [
2581
- /* @__PURE__ */ jsx25("div", { className: "flex flex-col min-w-0 flex-1", children: headerContent ? headerContent : /* @__PURE__ */ jsxs17(Fragment5, { children: [
2649
+ /* @__PURE__ */ jsx25("div", { className: "flex flex-col min-w-0 flex-1", children: headerContent ? headerContent : /* @__PURE__ */ jsxs17(Fragment6, { children: [
2582
2650
  title && /* @__PURE__ */ jsx25("h3", { id: titleId, className: "text-sm font-semibold leading-none truncate", children: title }),
2583
2651
  subtitle && /* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground mt-1 truncate", children: subtitle })
2584
2652
  ] }) }),
@@ -2630,30 +2698,28 @@ var DataPanelHeader = React24.forwardRef(
2630
2698
  align: "end",
2631
2699
  children: [
2632
2700
  /* @__PURE__ */ jsx25(DropdownLabel, { className: "px-2 py-1.5 text-sm font-semibold", children: "Panel Position" }),
2633
- ["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ jsxs17(
2634
- DropdownItem,
2701
+ /* @__PURE__ */ jsxs17(
2702
+ DropdownRadioGroup,
2635
2703
  {
2636
- className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none bg-popover focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2637
- onSelect: () => {
2704
+ value: mode === "detached" ? "detached" : edge,
2705
+ onValueChange: (value) => {
2706
+ if (value === "detached") {
2707
+ onModeChange?.("detached");
2708
+ return;
2709
+ }
2638
2710
  onModeChange?.("pinned");
2639
- onEdgeChange?.(e);
2711
+ onEdgeChange?.(value);
2640
2712
  },
2641
2713
  children: [
2642
- edgeLabels[e],
2643
- mode === "pinned" && edge === e && /* @__PURE__ */ jsx25("span", { className: "ml-auto text-xs", children: "\u2713" })
2644
- ]
2645
- },
2646
- e
2647
- )),
2648
- /* @__PURE__ */ jsx25(DropdownSeparator, { className: "-mx-1 my-1 h-px bg-muted" }),
2649
- /* @__PURE__ */ jsxs17(
2650
- DropdownItem,
2651
- {
2652
- className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none bg-popover focus:bg-accent focus:text-accent-foreground",
2653
- onSelect: () => onModeChange?.("detached"),
2654
- children: [
2655
- "Detach",
2656
- mode === "detached" && /* @__PURE__ */ jsx25("span", { className: "ml-auto text-xs", children: "\u2713" })
2714
+ ["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ jsxs17(DropdownRadioItem, { value: e, className: menuRadioItemClass, children: [
2715
+ edgeLabels[e],
2716
+ /* @__PURE__ */ jsx25(DropdownItemIndicator, { className: "ml-auto text-xs", children: "\u2713" })
2717
+ ] }, e)),
2718
+ /* @__PURE__ */ jsx25(DropdownSeparator, { className: "-mx-1 my-1 h-px bg-muted" }),
2719
+ /* @__PURE__ */ jsxs17(DropdownRadioItem, { value: "detached", className: menuRadioItemClass, children: [
2720
+ "Detach",
2721
+ /* @__PURE__ */ jsx25(DropdownItemIndicator, { className: "ml-auto text-xs", children: "\u2713" })
2722
+ ] })
2657
2723
  ]
2658
2724
  }
2659
2725
  )
@@ -2724,7 +2790,7 @@ function DataPanelCardHeader({
2724
2790
  tabIndex: 0,
2725
2791
  "aria-expanded": isExpanded,
2726
2792
  onKeyDown: onToggleKeyDown,
2727
- children: headerContent ? headerContent : /* @__PURE__ */ jsxs17(Fragment5, { children: [
2793
+ children: headerContent ? headerContent : /* @__PURE__ */ jsxs17(Fragment6, { children: [
2728
2794
  subtitle && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground truncate", children: subtitle }),
2729
2795
  title && /* @__PURE__ */ jsx25("h3", { id: titleId, className: "text-lg font-semibold truncate", children: title })
2730
2796
  ] })
@@ -2771,7 +2837,7 @@ function DataPanelCardHeader({
2771
2837
  }
2772
2838
  );
2773
2839
  }
2774
- var DataPanelContent = React24.forwardRef(
2840
+ var DataPanelContent = React25.forwardRef(
2775
2841
  ({ children, className, "aria-label": ariaLabel = "Panel content" }, ref) => {
2776
2842
  return /* @__PURE__ */ jsx25(
2777
2843
  "div",
@@ -2786,7 +2852,7 @@ var DataPanelContent = React24.forwardRef(
2786
2852
  }
2787
2853
  );
2788
2854
  DataPanelContent.displayName = "DataPanelContent";
2789
- var DataPanelFooter = React24.forwardRef(
2855
+ var DataPanelFooter = React25.forwardRef(
2790
2856
  ({ actions = [], footerContent, footerActions, className }, ref) => {
2791
2857
  if (!footerContent && actions.length === 0 && !footerActions) {
2792
2858
  return null;
@@ -2803,7 +2869,7 @@ var DataPanelFooter = React24.forwardRef(
2803
2869
  "flex items-center justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",
2804
2870
  className
2805
2871
  ),
2806
- children: footerContent ? footerContent : /* @__PURE__ */ jsxs17(Fragment5, { children: [
2872
+ children: footerContent ? footerContent : /* @__PURE__ */ jsxs17(Fragment6, { children: [
2807
2873
  footerActions,
2808
2874
  actions.map((action, index) => /* @__PURE__ */ jsx25(
2809
2875
  Button,
@@ -2822,7 +2888,7 @@ var DataPanelFooter = React24.forwardRef(
2822
2888
  }
2823
2889
  );
2824
2890
  DataPanelFooter.displayName = "DataPanelFooter";
2825
- var DataPanelTab = React24.forwardRef(
2891
+ var DataPanelTab = React25.forwardRef(
2826
2892
  ({
2827
2893
  title = "Panel",
2828
2894
  subtitle,
@@ -2848,17 +2914,18 @@ var DataPanelTab = React24.forwardRef(
2848
2914
  bottom: "left-1/2 rounded-t-lg border-b-0"
2849
2915
  }[edge];
2850
2916
  const insetStyle = { [edge]: tabInset };
2851
- const innerRef = React24.useRef(null);
2852
- const dragRef = React24.useRef({
2917
+ const innerRef = React25.useRef(null);
2918
+ const dragRef = React25.useRef({
2853
2919
  startX: 0,
2854
2920
  startY: 0,
2855
2921
  startOffset: 0,
2856
2922
  moved: false,
2857
2923
  pointerId: -1
2858
2924
  });
2859
- const [dragOffset, setDragOffset] = React24.useState(null);
2925
+ const [dragOffset, setDragOffset] = React25.useState(null);
2860
2926
  const effectiveOffset = dragOffset ?? offset;
2861
2927
  const draggable = !!onOffsetChange;
2928
+ const pointerHandledRef = React25.useRef(false);
2862
2929
  const tabTransform = getTabTransform(edge, tabWidth, effectiveOffset);
2863
2930
  const tabBounds = getTabBounds(edge, tabWidth);
2864
2931
  const setRefs = (node) => {
@@ -2902,6 +2969,10 @@ var DataPanelTab = React24.forwardRef(
2902
2969
  e.currentTarget.releasePointerCapture(e.pointerId);
2903
2970
  }
2904
2971
  d.pointerId = -1;
2972
+ pointerHandledRef.current = true;
2973
+ setTimeout(() => {
2974
+ pointerHandledRef.current = false;
2975
+ }, 0);
2905
2976
  if (d.moved) {
2906
2977
  onOffsetChange?.(dragOffset ?? offset);
2907
2978
  } else {
@@ -2925,7 +2996,7 @@ var DataPanelTab = React24.forwardRef(
2925
2996
  onClick?.();
2926
2997
  }
2927
2998
  };
2928
- React24.useEffect(() => {
2999
+ React25.useEffect(() => {
2929
3000
  if (!onOffsetChange || dragOffset !== null) return;
2930
3001
  const reclamp = () => {
2931
3002
  const clamped = constrainTabOffset(
@@ -2973,7 +3044,13 @@ var DataPanelTab = React24.forwardRef(
2973
3044
  type: "button",
2974
3045
  "aria-label": `Expand ${title} panel`,
2975
3046
  className: "flex min-w-0 flex-1 flex-col text-left leading-tight hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2976
- onClick: draggable ? void 0 : onClick,
3047
+ onClick: () => {
3048
+ if (pointerHandledRef.current) {
3049
+ pointerHandledRef.current = false;
3050
+ return;
3051
+ }
3052
+ onClick?.();
3053
+ },
2977
3054
  onKeyDown: handleExpandKeyDown,
2978
3055
  children: [
2979
3056
  /* @__PURE__ */ jsx25("span", { className: "truncate text-sm font-semibold", children: title }),
@@ -3014,7 +3091,7 @@ function ResizeHandles({
3014
3091
  onPinnedSizeChange,
3015
3092
  constraints
3016
3093
  }) {
3017
- const handleDetachedKeyDown = React24.useCallback(
3094
+ const handleDetachedKeyDown = React25.useCallback(
3018
3095
  (e, handle) => {
3019
3096
  const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
3020
3097
  let width = detachedSize.width;
@@ -3077,7 +3154,7 @@ function ResizeHandles({
3077
3154
  },
3078
3155
  [detachedPosition, detachedSize, constraints, onDetachedResize]
3079
3156
  );
3080
- const handlePinnedKeyDown = React24.useCallback(
3157
+ const handlePinnedKeyDown = React25.useCallback(
3081
3158
  (e) => {
3082
3159
  const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
3083
3160
  let newSize = pinnedSize;
@@ -3137,7 +3214,7 @@ function ResizeHandles({
3137
3214
  "bottom-left",
3138
3215
  "bottom-right"
3139
3216
  ];
3140
- return /* @__PURE__ */ jsx25(Fragment5, { children: handles.map((handle) => {
3217
+ return /* @__PURE__ */ jsx25(Fragment6, { children: handles.map((handle) => {
3141
3218
  const isCorner = handle.includes("-");
3142
3219
  const isHorizontal2 = handle === "top" || handle === "bottom";
3143
3220
  const isVertical = handle === "left" || handle === "right";
@@ -3194,14 +3271,14 @@ function ResizeHandles({
3194
3271
  }
3195
3272
  );
3196
3273
  }
3197
- var DataPanel = React24.forwardRef(
3274
+ var DataPanel = React25.forwardRef(
3198
3275
  ({
3199
3276
  open: controlledOpen,
3200
3277
  onOpenChange,
3201
3278
  mode: controlledMode,
3202
3279
  onModeChange,
3203
3280
  variant: controlledVariant,
3204
- cardConfig = {},
3281
+ cardConfig = EMPTY_CARD_CONFIG,
3205
3282
  edge: controlledEdge,
3206
3283
  onEdgeChange,
3207
3284
  expanded: controlledExpanded,
@@ -3209,8 +3286,8 @@ var DataPanel = React24.forwardRef(
3209
3286
  title,
3210
3287
  subtitle,
3211
3288
  children,
3212
- actions = [],
3213
- constraints = {},
3289
+ actions = EMPTY_ACTIONS,
3290
+ constraints = EMPTY_CONSTRAINTS,
3214
3291
  tabWidth = DEFAULT_TAB_WIDTH,
3215
3292
  tabInset = 0,
3216
3293
  disableClose = false,
@@ -3226,39 +3303,35 @@ var DataPanel = React24.forwardRef(
3226
3303
  footerActions,
3227
3304
  className
3228
3305
  }, ref) => {
3229
- const resolvedConstraints = React24.useMemo(
3306
+ const resolvedConstraints = React25.useMemo(
3230
3307
  () => ({ ...DEFAULT_CONSTRAINTS, ...constraints }),
3231
3308
  [constraints]
3232
3309
  );
3233
- const resolvedCardConfig = React24.useMemo(
3310
+ const resolvedCardConfig = React25.useMemo(
3234
3311
  () => ({ ...DEFAULT_CARD_CONFIG, ...cardConfig }),
3235
3312
  [cardConfig]
3236
3313
  );
3237
- const panelId = React24.useId();
3314
+ const panelId = React25.useId();
3238
3315
  const titleId = `${panelId}-title`;
3239
- const [internalOpen, setInternalOpen] = React24.useState(true);
3240
- const [internalMode, setInternalMode] = React24.useState(DEFAULT_PANEL_STATE.mode);
3241
- const [internalVariant, setInternalVariant] = React24.useState(
3316
+ const [internalOpen, setInternalOpen] = React25.useState(true);
3317
+ const [internalMode, setInternalMode] = React25.useState(DEFAULT_PANEL_STATE.mode);
3318
+ const [internalVariant, setInternalVariant] = React25.useState(
3242
3319
  DEFAULT_PANEL_STATE.variant
3243
3320
  );
3244
- const [internalEdge, setInternalEdge] = React24.useState(DEFAULT_PANEL_STATE.edge);
3245
- const [internalExpanded, setInternalExpanded] = React24.useState(
3321
+ const [internalEdge, setInternalEdge] = React25.useState(DEFAULT_PANEL_STATE.edge);
3322
+ const [internalExpanded, setInternalExpanded] = React25.useState(
3246
3323
  DEFAULT_PANEL_STATE.isExpanded
3247
3324
  );
3248
- const [detachedPosition, setDetachedPosition] = React24.useState(
3325
+ const [detachedPosition, setDetachedPosition] = React25.useState(
3249
3326
  DEFAULT_PANEL_STATE.detachedPosition
3250
3327
  );
3251
- const [detachedSize, setDetachedSize] = React24.useState(DEFAULT_PANEL_STATE.detachedSize);
3252
- const [pinnedSize, setPinnedSize] = React24.useState(DEFAULT_PANEL_STATE.pinnedSize);
3253
- const [tabOffset, setTabOffset] = React24.useState(DEFAULT_PANEL_STATE.tabOffset);
3254
- const [viewportWidth, setViewportWidth] = React24.useState(
3255
- typeof window !== "undefined" ? layoutViewportWidth() : 1024
3256
- );
3257
- const [viewportHeight, setViewportHeight] = React24.useState(
3258
- typeof window !== "undefined" ? window.innerHeight : 768
3259
- );
3328
+ const [detachedSize, setDetachedSize] = React25.useState(DEFAULT_PANEL_STATE.detachedSize);
3329
+ const [pinnedSize, setPinnedSize] = React25.useState(DEFAULT_PANEL_STATE.pinnedSize);
3330
+ const [tabOffset, setTabOffset] = React25.useState(DEFAULT_PANEL_STATE.tabOffset);
3331
+ const [viewportWidth, setViewportWidth] = React25.useState(SSR_VIEWPORT_WIDTH);
3332
+ const [viewportHeight, setViewportHeight] = React25.useState(SSR_VIEWPORT_HEIGHT);
3260
3333
  const isMobile = viewportWidth < 640;
3261
- const cardDefaultLeftOffset = React24.useCallback(
3334
+ const cardDefaultLeftOffset = React25.useCallback(
3262
3335
  (width) => {
3263
3336
  const margin = resolvedCardConfig.horizontalMargin;
3264
3337
  if (resolvedCardConfig.align === "left") return margin;
@@ -3269,45 +3342,45 @@ var DataPanel = React24.forwardRef(
3269
3342
  },
3270
3343
  [viewportWidth, resolvedCardConfig.align, resolvedCardConfig.horizontalMargin]
3271
3344
  );
3272
- const [cardHorizontalPosition, setCardHorizontalPosition] = React24.useState(0);
3273
- const [cardExpandedHeight, setCardExpandedHeight] = React24.useState(0);
3274
- const [cardWidth, setCardWidth] = React24.useState(null);
3275
- const [cardDragCurrentHeight, setCardDragCurrentHeight] = React24.useState(CARD_HEADER_HEIGHT);
3276
- const [isCardVerticalDragging, setIsCardVerticalDragging] = React24.useState(false);
3277
- const [isCardHorizontalDragging, setIsCardHorizontalDragging] = React24.useState(false);
3278
- const [isCardHeightTransitioning, setIsCardHeightTransitioning] = React24.useState(false);
3279
- const [isCardWidthResizing, setIsCardWidthResizing] = React24.useState(false);
3280
- const [isCardTopResizing, setIsCardTopResizing] = React24.useState(false);
3281
- const [isDragging, setIsDragging] = React24.useState(false);
3282
- const [isResizing, setIsResizing] = React24.useState(false);
3283
- const [snapPreview, setSnapPreview] = React24.useState(null);
3284
- const [isPinnedDragging, setIsPinnedDragging] = React24.useState(false);
3285
- const [pullOffset, setPullOffset] = React24.useState(0);
3286
- const dragStateRef = React24.useRef({
3345
+ const [cardHorizontalPosition, setCardHorizontalPosition] = React25.useState(0);
3346
+ const [cardExpandedHeight, setCardExpandedHeight] = React25.useState(0);
3347
+ const [cardWidth, setCardWidth] = React25.useState(null);
3348
+ const [cardDragCurrentHeight, setCardDragCurrentHeight] = React25.useState(CARD_HEADER_HEIGHT);
3349
+ const [isCardVerticalDragging, setIsCardVerticalDragging] = React25.useState(false);
3350
+ const [isCardHorizontalDragging, setIsCardHorizontalDragging] = React25.useState(false);
3351
+ const [isCardHeightTransitioning, setIsCardHeightTransitioning] = React25.useState(false);
3352
+ const [isCardWidthResizing, setIsCardWidthResizing] = React25.useState(false);
3353
+ const [isCardTopResizing, setIsCardTopResizing] = React25.useState(false);
3354
+ const [isDragging, setIsDragging] = React25.useState(false);
3355
+ const [isResizing, setIsResizing] = React25.useState(false);
3356
+ const [snapPreview, setSnapPreview] = React25.useState(null);
3357
+ const [isPinnedDragging, setIsPinnedDragging] = React25.useState(false);
3358
+ const [pullOffset, setPullOffset] = React25.useState(0);
3359
+ const dragStateRef = React25.useRef({
3287
3360
  startPosition: { x: 0, y: 0 },
3288
3361
  startPanelPosition: { x: 0, y: 0 }
3289
3362
  });
3290
- const pinnedDragStateRef = React24.useRef({
3363
+ const pinnedDragStateRef = React25.useRef({
3291
3364
  startPosition: { x: 0, y: 0 },
3292
3365
  hasDetached: false
3293
3366
  });
3294
- const resizeStateRef = React24.useRef({
3367
+ const resizeStateRef = React25.useRef({
3295
3368
  handle: null,
3296
3369
  startPosition: { x: 0, y: 0 },
3297
3370
  startSize: { width: 0, height: 0 },
3298
3371
  startPanelPosition: { x: 0, y: 0 }
3299
3372
  });
3300
- const cardDragStateRef = React24.useRef({
3373
+ const cardDragStateRef = React25.useRef({
3301
3374
  startY: 0,
3302
3375
  startX: 0,
3303
3376
  startTime: 0,
3304
3377
  startExpanded: false,
3305
3378
  startHorizontalPosition: 0
3306
3379
  });
3307
- const cardCurrentHeightRef = React24.useRef(CARD_HEADER_HEIGHT);
3308
- const cardTopResizeStartRef = React24.useRef({ startY: 0, startHeight: 0 });
3309
- const cardHeightUserSetRef = React24.useRef(false);
3310
- const cardWidthResizeStateRef = React24.useRef({
3380
+ const cardCurrentHeightRef = React25.useRef(CARD_HEADER_HEIGHT);
3381
+ const cardTopResizeStartRef = React25.useRef({ startY: 0, startHeight: 0 });
3382
+ const cardHeightUserSetRef = React25.useRef(false);
3383
+ const cardWidthResizeStateRef = React25.useRef({
3311
3384
  handle: null,
3312
3385
  startX: 0,
3313
3386
  startWidth: 0,
@@ -3322,9 +3395,9 @@ var DataPanel = React24.forwardRef(
3322
3395
  const resizeRight = !disableResize && (variant === "full" && (mode === "detached" || edge === "left") || variant === "card" && isExpanded && !isMobile);
3323
3396
  const resizeBottom = !disableResize && variant === "full" && (mode === "detached" || edge === "top");
3324
3397
  const hasFooter = !!(footerContent || actions.length > 0 || footerActions);
3325
- const saveTimeoutRef = React24.useRef(null);
3326
- const isMountedRef = React24.useRef(true);
3327
- React24.useEffect(() => {
3398
+ const saveTimeoutRef = React25.useRef(null);
3399
+ const isMountedRef = React25.useRef(true);
3400
+ React25.useEffect(() => {
3328
3401
  isMountedRef.current = true;
3329
3402
  return () => {
3330
3403
  isMountedRef.current = false;
@@ -3335,7 +3408,7 @@ var DataPanel = React24.forwardRef(
3335
3408
  }
3336
3409
  };
3337
3410
  }, []);
3338
- const debouncedSave = React24.useCallback(() => {
3411
+ const debouncedSave = React25.useCallback(() => {
3339
3412
  if (!persistKey) return;
3340
3413
  if (saveTimeoutRef.current) {
3341
3414
  clearTimeout(saveTimeoutRef.current);
@@ -3364,12 +3437,12 @@ var DataPanel = React24.forwardRef(
3364
3437
  pinnedSize,
3365
3438
  tabOffset
3366
3439
  ]);
3367
- React24.useEffect(() => {
3440
+ React25.useEffect(() => {
3368
3441
  debouncedSave();
3369
3442
  }, [debouncedSave]);
3370
- const hasLoadedRef = React24.useRef(false);
3371
- const hasPersistedPositionRef = React24.useRef(false);
3372
- React24.useEffect(() => {
3443
+ const hasLoadedRef = React25.useRef(false);
3444
+ const hasPersistedPositionRef = React25.useRef(false);
3445
+ React25.useEffect(() => {
3373
3446
  if (!persistKey || hasLoadedRef.current) return;
3374
3447
  hasLoadedRef.current = true;
3375
3448
  const persisted = loadPanelState(persistKey);
@@ -3398,7 +3471,7 @@ var DataPanel = React24.forwardRef(
3398
3471
  if (persisted.tabOffset !== void 0) setTabOffset(persisted.tabOffset);
3399
3472
  }
3400
3473
  }, [persistKey, controlledMode, controlledVariant, controlledEdge, controlledExpanded]);
3401
- React24.useEffect(() => {
3474
+ React25.useEffect(() => {
3402
3475
  if (mode === "detached" && !hasPersistedPositionRef.current && detachedPosition.x === DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === DEFAULT_PANEL_STATE.detachedPosition.y) {
3403
3476
  setDetachedPosition(
3404
3477
  getInitialDetachedPosition(detachedSize, layoutViewportWidth(), window.innerHeight)
@@ -3421,8 +3494,8 @@ var DataPanel = React24.forwardRef(
3421
3494
  },
3422
3495
  { enabled: isDialog, preventDefault: false }
3423
3496
  );
3424
- const panelElRef = React24.useRef(null);
3425
- const tabRef = React24.useRef(null);
3497
+ const panelElRef = React25.useRef(null);
3498
+ const tabRef = React25.useRef(null);
3426
3499
  const setPanelRef = (node) => {
3427
3500
  panelElRef.current = node;
3428
3501
  focusTrapRef.current = node;
@@ -3432,7 +3505,7 @@ var DataPanel = React24.forwardRef(
3432
3505
  ref.current = node;
3433
3506
  }
3434
3507
  };
3435
- const handleModeChange = React24.useCallback(
3508
+ const handleModeChange = React25.useCallback(
3436
3509
  (newMode) => {
3437
3510
  if (controlledMode === void 0) {
3438
3511
  setInternalMode(newMode);
@@ -3441,7 +3514,7 @@ var DataPanel = React24.forwardRef(
3441
3514
  },
3442
3515
  [controlledMode, onModeChange]
3443
3516
  );
3444
- const handleEdgeChange = React24.useCallback(
3517
+ const handleEdgeChange = React25.useCallback(
3445
3518
  (newEdge) => {
3446
3519
  if (controlledEdge === void 0) {
3447
3520
  setInternalEdge(newEdge);
@@ -3450,8 +3523,8 @@ var DataPanel = React24.forwardRef(
3450
3523
  },
3451
3524
  [controlledEdge, onEdgeChange]
3452
3525
  );
3453
- const restoreFocusRef = React24.useRef(false);
3454
- const handleExpandedChange = React24.useCallback(
3526
+ const restoreFocusRef = React25.useRef(false);
3527
+ const handleExpandedChange = React25.useCallback(
3455
3528
  (newExpanded) => {
3456
3529
  const active = typeof document !== "undefined" ? document.activeElement : null;
3457
3530
  restoreFocusRef.current = newExpanded !== isExpanded && !!active && active !== document.body;
@@ -3462,7 +3535,7 @@ var DataPanel = React24.forwardRef(
3462
3535
  },
3463
3536
  [controlledExpanded, onExpandedChange, isExpanded]
3464
3537
  );
3465
- React24.useEffect(() => {
3538
+ React25.useEffect(() => {
3466
3539
  if (!restoreFocusRef.current) return;
3467
3540
  restoreFocusRef.current = false;
3468
3541
  const active = document.activeElement;
@@ -3495,7 +3568,7 @@ var DataPanel = React24.forwardRef(
3495
3568
  document.body.style.userSelect = "none";
3496
3569
  }
3497
3570
  };
3498
- const handleDragMove = React24.useCallback(
3571
+ const handleDragMove = React25.useCallback(
3499
3572
  (e) => {
3500
3573
  if (!isDragging) return;
3501
3574
  const currentPos = getPointerPosition(e);
@@ -3522,7 +3595,7 @@ var DataPanel = React24.forwardRef(
3522
3595
  },
3523
3596
  [isDragging, detachedSize, snapThreshold]
3524
3597
  );
3525
- const handleDragEnd = React24.useCallback(() => {
3598
+ const handleDragEnd = React25.useCallback(() => {
3526
3599
  if (!isDragging) return;
3527
3600
  setIsDragging(false);
3528
3601
  document.body.style.cursor = "";
@@ -3533,7 +3606,7 @@ var DataPanel = React24.forwardRef(
3533
3606
  setSnapPreview(null);
3534
3607
  }
3535
3608
  }, [isDragging, snapPreview, handleModeChange, handleEdgeChange]);
3536
- const handlePinnedDragMove = React24.useCallback(
3609
+ const handlePinnedDragMove = React25.useCallback(
3537
3610
  (e) => {
3538
3611
  if (!isPinnedDragging) return;
3539
3612
  const currentPos = getPointerPosition(e);
@@ -3569,7 +3642,7 @@ var DataPanel = React24.forwardRef(
3569
3642
  },
3570
3643
  [isPinnedDragging, edge, detachThreshold, pinnedSize, detachedSize, handleModeChange]
3571
3644
  );
3572
- const handlePinnedDragEnd = React24.useCallback(() => {
3645
+ const handlePinnedDragEnd = React25.useCallback(() => {
3573
3646
  if (!isPinnedDragging) return;
3574
3647
  setIsPinnedDragging(false);
3575
3648
  setPullOffset(0);
@@ -3591,7 +3664,7 @@ var DataPanel = React24.forwardRef(
3591
3664
  document.body.style.cursor = getResizeCursor(handle);
3592
3665
  document.body.style.userSelect = "none";
3593
3666
  };
3594
- const handleResizeMove = React24.useCallback(
3667
+ const handleResizeMove = React25.useCallback(
3595
3668
  (e) => {
3596
3669
  if (!isResizing || !resizeStateRef.current.handle) return;
3597
3670
  const currentPos = getPointerPosition(e);
@@ -3632,7 +3705,7 @@ var DataPanel = React24.forwardRef(
3632
3705
  },
3633
3706
  [isResizing, mode, edge, resolvedConstraints]
3634
3707
  );
3635
- const handleResizeEnd = React24.useCallback(() => {
3708
+ const handleResizeEnd = React25.useCallback(() => {
3636
3709
  if (!isResizing) return;
3637
3710
  setIsResizing(false);
3638
3711
  resizeStateRef.current.handle = null;
@@ -3664,7 +3737,7 @@ var DataPanel = React24.forwardRef(
3664
3737
  }
3665
3738
  document.body.style.userSelect = "none";
3666
3739
  };
3667
- const handleCardPointerMove = React24.useCallback(
3740
+ const handleCardPointerMove = React25.useCallback(
3668
3741
  (e) => {
3669
3742
  const currentPos = getPointerPosition(e);
3670
3743
  if (isCardVerticalDragging) {
@@ -3704,7 +3777,7 @@ var DataPanel = React24.forwardRef(
3704
3777
  resolvedCardConfig.maxWidth
3705
3778
  ]
3706
3779
  );
3707
- const handleCardPointerUp = React24.useCallback(
3780
+ const handleCardPointerUp = React25.useCallback(
3708
3781
  (e) => {
3709
3782
  const endTime = Date.now();
3710
3783
  const currentPos = getPointerPosition(e);
@@ -3762,7 +3835,7 @@ var DataPanel = React24.forwardRef(
3762
3835
  document.body.style.cursor = "ns-resize";
3763
3836
  document.body.style.userSelect = "none";
3764
3837
  };
3765
- const handleCardResizeMove = React24.useCallback(
3838
+ const handleCardResizeMove = React25.useCallback(
3766
3839
  (e) => {
3767
3840
  if (!isCardTopResizing) return;
3768
3841
  const currentPos = getPointerPosition(e);
@@ -3776,7 +3849,7 @@ var DataPanel = React24.forwardRef(
3776
3849
  },
3777
3850
  [isCardTopResizing, viewportHeight]
3778
3851
  );
3779
- const handleCardResizeEnd = React24.useCallback(() => {
3852
+ const handleCardResizeEnd = React25.useCallback(() => {
3780
3853
  if (!isCardTopResizing) return;
3781
3854
  setIsCardTopResizing(false);
3782
3855
  document.body.style.cursor = "";
@@ -3805,7 +3878,7 @@ var DataPanel = React24.forwardRef(
3805
3878
  document.body.style.cursor = "ew-resize";
3806
3879
  document.body.style.userSelect = "none";
3807
3880
  };
3808
- const handleCardWidthResizeMove = React24.useCallback(
3881
+ const handleCardWidthResizeMove = React25.useCallback(
3809
3882
  (e) => {
3810
3883
  const st = cardWidthResizeStateRef.current;
3811
3884
  if (!isCardWidthResizing || !st.handle) return;
@@ -3847,7 +3920,7 @@ var DataPanel = React24.forwardRef(
3847
3920
  resolvedCardConfig.maxWidth
3848
3921
  ]
3849
3922
  );
3850
- const handleCardWidthResizeEnd = React24.useCallback(() => {
3923
+ const handleCardWidthResizeEnd = React25.useCallback(() => {
3851
3924
  if (!isCardWidthResizing) return;
3852
3925
  setIsCardWidthResizing(false);
3853
3926
  cardWidthResizeStateRef.current.handle = null;
@@ -3898,7 +3971,7 @@ var DataPanel = React24.forwardRef(
3898
3971
  if (kind === "width-left") setCardHorizontalPosition((p) => p - appliedDelta);
3899
3972
  debouncedSave();
3900
3973
  };
3901
- React24.useEffect(() => {
3974
+ React25.useEffect(() => {
3902
3975
  if (isDragging) {
3903
3976
  window.addEventListener("pointermove", handleDragMove);
3904
3977
  window.addEventListener("pointerup", handleDragEnd);
@@ -3910,7 +3983,7 @@ var DataPanel = React24.forwardRef(
3910
3983
  };
3911
3984
  }
3912
3985
  }, [isDragging, handleDragMove, handleDragEnd]);
3913
- React24.useEffect(() => {
3986
+ React25.useEffect(() => {
3914
3987
  if (isPinnedDragging) {
3915
3988
  window.addEventListener("pointermove", handlePinnedDragMove);
3916
3989
  window.addEventListener("pointerup", handlePinnedDragEnd);
@@ -3922,7 +3995,7 @@ var DataPanel = React24.forwardRef(
3922
3995
  };
3923
3996
  }
3924
3997
  }, [isPinnedDragging, handlePinnedDragMove, handlePinnedDragEnd]);
3925
- React24.useEffect(() => {
3998
+ React25.useEffect(() => {
3926
3999
  if (isResizing) {
3927
4000
  window.addEventListener("pointermove", handleResizeMove);
3928
4001
  window.addEventListener("pointerup", handleResizeEnd);
@@ -3934,7 +4007,7 @@ var DataPanel = React24.forwardRef(
3934
4007
  };
3935
4008
  }
3936
4009
  }, [isResizing, handleResizeMove, handleResizeEnd]);
3937
- React24.useEffect(() => {
4010
+ React25.useEffect(() => {
3938
4011
  if (isCardVerticalDragging || isCardHorizontalDragging) {
3939
4012
  window.addEventListener("pointermove", handleCardPointerMove);
3940
4013
  window.addEventListener("pointerup", handleCardPointerUp);
@@ -3951,7 +4024,7 @@ var DataPanel = React24.forwardRef(
3951
4024
  handleCardPointerMove,
3952
4025
  handleCardPointerUp
3953
4026
  ]);
3954
- React24.useEffect(() => {
4027
+ React25.useEffect(() => {
3955
4028
  if (isCardTopResizing) {
3956
4029
  window.addEventListener("pointermove", handleCardResizeMove);
3957
4030
  window.addEventListener("pointerup", handleCardResizeEnd);
@@ -3963,7 +4036,7 @@ var DataPanel = React24.forwardRef(
3963
4036
  };
3964
4037
  }
3965
4038
  }, [isCardTopResizing, handleCardResizeMove, handleCardResizeEnd]);
3966
- React24.useEffect(() => {
4039
+ React25.useEffect(() => {
3967
4040
  if (isCardWidthResizing) {
3968
4041
  window.addEventListener("pointermove", handleCardWidthResizeMove);
3969
4042
  window.addEventListener("pointerup", handleCardWidthResizeEnd);
@@ -3975,10 +4048,10 @@ var DataPanel = React24.forwardRef(
3975
4048
  };
3976
4049
  }
3977
4050
  }, [isCardWidthResizing, handleCardWidthResizeMove, handleCardWidthResizeEnd]);
3978
- const resizeStateLatestRef = React24.useRef({ mode, detachedSize });
4051
+ const resizeStateLatestRef = React25.useRef({ mode, detachedSize });
3979
4052
  resizeStateLatestRef.current = { mode, detachedSize };
3980
4053
  const expandedRatio = resolvedCardConfig.expandedRatio;
3981
- React24.useEffect(() => {
4054
+ useIsomorphicLayoutEffect(() => {
3982
4055
  const onResize = () => {
3983
4056
  const vh = window.innerHeight;
3984
4057
  setViewportWidth(layoutViewportWidth());
@@ -4000,19 +4073,19 @@ var DataPanel = React24.forwardRef(
4000
4073
  window.addEventListener("resize", onWindowResize);
4001
4074
  return () => window.removeEventListener("resize", onWindowResize);
4002
4075
  }, [expandedRatio]);
4003
- React24.useEffect(() => {
4076
+ React25.useEffect(() => {
4004
4077
  if (isMobile && variant === "card") {
4005
4078
  setCardHorizontalPosition(0);
4006
4079
  setCardWidth(null);
4007
4080
  }
4008
4081
  }, [isMobile, variant]);
4009
- React24.useEffect(() => {
4082
+ React25.useEffect(() => {
4010
4083
  if (isCardHeightTransitioning) {
4011
4084
  const t = setTimeout(() => setIsCardHeightTransitioning(false), 350);
4012
4085
  return () => clearTimeout(t);
4013
4086
  }
4014
4087
  }, [isCardHeightTransitioning]);
4015
- const panelStyles = React24.useMemo(() => {
4088
+ const panelStyles = React25.useMemo(() => {
4016
4089
  if (variant === "card") {
4017
4090
  const defaultCardWidth = Math.min(
4018
4091
  viewportWidth - resolvedCardConfig.horizontalMargin * 2,
@@ -4092,7 +4165,7 @@ var DataPanel = React24.forwardRef(
4092
4165
  }
4093
4166
  );
4094
4167
  }
4095
- return /* @__PURE__ */ jsxs17(Fragment5, { children: [
4168
+ return /* @__PURE__ */ jsxs17(Fragment6, { children: [
4096
4169
  snapPreview && /* @__PURE__ */ jsx25(
4097
4170
  "div",
4098
4171
  {
@@ -4132,7 +4205,6 @@ var DataPanel = React24.forwardRef(
4132
4205
  "aria-modal": isDialog ? "true" : void 0,
4133
4206
  "aria-labelledby": title ? titleId : void 0,
4134
4207
  "aria-label": !title ? "Side panel" : void 0,
4135
- "aria-expanded": variant === "card" ? isExpanded : void 0,
4136
4208
  onPointerDown: variant === "full" ? handleDragStart : void 0,
4137
4209
  children: [
4138
4210
  variant === "card" ? /* @__PURE__ */ jsx25(
@@ -4171,7 +4243,7 @@ var DataPanel = React24.forwardRef(
4171
4243
  draggable: !disableDrag && (mode === "detached" || mode === "pinned" && detachThreshold > 0)
4172
4244
  }
4173
4245
  ),
4174
- showContent && /* @__PURE__ */ jsxs17(Fragment5, { children: [
4246
+ showContent && /* @__PURE__ */ jsxs17(Fragment6, { children: [
4175
4247
  /* @__PURE__ */ jsx25(
4176
4248
  DataPanelContent,
4177
4249
  {
@@ -4219,7 +4291,7 @@ var DataPanel = React24.forwardRef(
4219
4291
  constraints: resolvedConstraints
4220
4292
  }
4221
4293
  ),
4222
- variant === "card" && isExpanded && !disableResize && !isMobile && /* @__PURE__ */ jsxs17(Fragment5, { children: [
4294
+ variant === "card" && isExpanded && !disableResize && !isMobile && /* @__PURE__ */ jsxs17(Fragment6, { children: [
4223
4295
  /* @__PURE__ */ jsx25(
4224
4296
  "div",
4225
4297
  {
@@ -4278,7 +4350,7 @@ var DataPanel = React24.forwardRef(
4278
4350
  DataPanel.displayName = "DataPanel";
4279
4351
 
4280
4352
  // src/components/Skeleton.tsx
4281
- import * as React25 from "react";
4353
+ import * as React26 from "react";
4282
4354
  import { cva as cva6 } from "class-variance-authority";
4283
4355
  import { jsx as jsx26 } from "react/jsx-runtime";
4284
4356
  var skeletonVariants = cva6("rounded-md bg-muted", {
@@ -4296,7 +4368,7 @@ var skeletonVariants = cva6("rounded-md bg-muted", {
4296
4368
  variant: "default"
4297
4369
  }
4298
4370
  });
4299
- var Skeleton = React25.forwardRef(
4371
+ var Skeleton = React26.forwardRef(
4300
4372
  ({ className, variant, animation = "pulse", ...props }, ref) => {
4301
4373
  const animationClass = animation === "pulse" ? "animate-pulse" : animation === "shimmer" ? "animate-shimmer" : "";
4302
4374
  return /* @__PURE__ */ jsx26(
@@ -4312,7 +4384,7 @@ var Skeleton = React25.forwardRef(
4312
4384
  Skeleton.displayName = "Skeleton";
4313
4385
 
4314
4386
  // src/components/Spinner.tsx
4315
- import * as React26 from "react";
4387
+ import * as React27 from "react";
4316
4388
  import { cva as cva7 } from "class-variance-authority";
4317
4389
  import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
4318
4390
  var spinnerVariants = cva7("animate-spin text-current", {
@@ -4328,7 +4400,7 @@ var spinnerVariants = cva7("animate-spin text-current", {
4328
4400
  size: "md"
4329
4401
  }
4330
4402
  });
4331
- var Spinner = React26.forwardRef(
4403
+ var Spinner = React27.forwardRef(
4332
4404
  ({ className, size, label = "Loading...", ...props }, ref) => {
4333
4405
  return /* @__PURE__ */ jsxs18(
4334
4406
  "svg",
@@ -4370,7 +4442,7 @@ var Spinner = React26.forwardRef(
4370
4442
  Spinner.displayName = "Spinner";
4371
4443
 
4372
4444
  // src/components/LoadingLogo.tsx
4373
- import * as React27 from "react";
4445
+ import * as React28 from "react";
4374
4446
  import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
4375
4447
  var logoPaths = [
4376
4448
  "M9.902 16.6c.3.7 1.7.8 1-.6-.6-1.4-2.3-5.1-6.1-6.3-1.7-.5-3.7.4-4.3 1.6-.4.7-1.1 2.9.5 4.3.8.7 1.9 1.2 3.6 1 .4-.1.9-.5.6-.8-.5-.4-1.9-1.7-1.1-2.7.7-.8 1.4-.6 2-.3.4.2 2.1 1 3.7 3.6l.1.2z",
@@ -4393,7 +4465,7 @@ var colors = {
4393
4465
  stroke: "#ffffff"
4394
4466
  }
4395
4467
  };
4396
- var LoadingLogo = React27.forwardRef(
4468
+ var LoadingLogo = React28.forwardRef(
4397
4469
  ({ width = 40, height = 40, loading = false, variant = "dark", className, ...props }, ref) => {
4398
4470
  const currentColors = colors[variant];
4399
4471
  const fillColor = loading ? currentColors.fillLoading : currentColors.fill;
@@ -4442,7 +4514,7 @@ var LoadingLogo = React27.forwardRef(
4442
4514
  LoadingLogo.displayName = "LoadingLogo";
4443
4515
 
4444
4516
  // src/components/ProgressBar.tsx
4445
- import * as React28 from "react";
4517
+ import * as React29 from "react";
4446
4518
  import { cva as cva8 } from "class-variance-authority";
4447
4519
  import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
4448
4520
  var progressBarVariants = cva8("w-full overflow-hidden rounded-full bg-muted", {
@@ -4470,7 +4542,7 @@ var progressFillVariants = cva8("h-full rounded-full transition-all duration-300
4470
4542
  variant: "default"
4471
4543
  }
4472
4544
  });
4473
- var ProgressBar = React28.forwardRef(
4545
+ var ProgressBar = React29.forwardRef(
4474
4546
  ({ className, size, variant, value, max = 100, label = "Progress", showValue = false, ...props }, ref) => {
4475
4547
  const isIndeterminate = value === void 0;
4476
4548
  const clampedValue = isIndeterminate ? 0 : Math.min(Math.max(0, value), max);
@@ -4509,11 +4581,11 @@ var ProgressBar = React28.forwardRef(
4509
4581
  ProgressBar.displayName = "ProgressBar";
4510
4582
 
4511
4583
  // src/components/LoadingOverlay.tsx
4512
- import * as React29 from "react";
4513
- import { Fragment as Fragment6, jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
4584
+ import * as React30 from "react";
4585
+ import { Fragment as Fragment7, jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
4514
4586
  var spinnerSizeMap = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
4515
4587
  var logoSizeMap = { sm: 32, md: 40, lg: 56, xl: 80 };
4516
- var LoadingOverlay = React29.forwardRef(
4588
+ var LoadingOverlay = React30.forwardRef(
4517
4589
  ({
4518
4590
  loading = true,
4519
4591
  variant = "spinner",
@@ -4528,8 +4600,8 @@ var LoadingOverlay = React29.forwardRef(
4528
4600
  children,
4529
4601
  ...props
4530
4602
  }, ref) => {
4531
- const [visible, setVisible] = React29.useState(delay === 0 && loading);
4532
- React29.useEffect(() => {
4603
+ const [visible, setVisible] = React30.useState(delay === 0 && loading);
4604
+ React30.useEffect(() => {
4533
4605
  if (!loading) {
4534
4606
  setVisible(false);
4535
4607
  return;
@@ -4541,10 +4613,16 @@ var LoadingOverlay = React29.forwardRef(
4541
4613
  const timer = setTimeout(() => setVisible(true), delay);
4542
4614
  return () => clearTimeout(timer);
4543
4615
  }, [loading, delay]);
4616
+ if (!visible && mode === "inline") {
4617
+ return null;
4618
+ }
4544
4619
  if (!visible) {
4545
- return mode === "inline" ? null : /* @__PURE__ */ jsx30(Fragment6, { children });
4620
+ return /* @__PURE__ */ jsxs21(Fragment7, { children: [
4621
+ children,
4622
+ null
4623
+ ] });
4546
4624
  }
4547
- const indicator = /* @__PURE__ */ jsxs21(Fragment6, { children: [
4625
+ const indicator = /* @__PURE__ */ jsxs21(Fragment7, { children: [
4548
4626
  variant === "spinner" && /* @__PURE__ */ jsx30(Spinner, { size: spinnerSizeMap[size] }),
4549
4627
  variant === "logo" && /* @__PURE__ */ jsx30(LoadingLogo, { loading: true, width: logoSizeMap[size], height: logoSizeMap[size] }),
4550
4628
  variant === "progress" && /* @__PURE__ */ jsx30(ProgressBar, { value: progress, className: "w-48 max-w-full" }),
@@ -4572,7 +4650,7 @@ var LoadingOverlay = React29.forwardRef(
4572
4650
  }
4573
4651
  const bgClass = opaque ? "bg-background" : mode === "fullscreen" ? "bg-background/80" : "bg-background/60";
4574
4652
  const positionClass = mode === "fullscreen" ? "fixed inset-0 z-50" : "absolute inset-0 z-10";
4575
- return /* @__PURE__ */ jsxs21(Fragment6, { children: [
4653
+ return /* @__PURE__ */ jsxs21(Fragment7, { children: [
4576
4654
  children,
4577
4655
  /* @__PURE__ */ jsx30(
4578
4656
  "div",
@@ -4597,9 +4675,9 @@ var LoadingOverlay = React29.forwardRef(
4597
4675
  LoadingOverlay.displayName = "LoadingOverlay";
4598
4676
 
4599
4677
  // src/components/LoadingPage.tsx
4600
- import * as React30 from "react";
4678
+ import * as React31 from "react";
4601
4679
  import { jsx as jsx31, jsxs as jsxs22 } from "react/jsx-runtime";
4602
- var LoadingPage = React30.forwardRef(
4680
+ var LoadingPage = React31.forwardRef(
4603
4681
  ({
4604
4682
  loading = true,
4605
4683
  message,
@@ -4610,8 +4688,8 @@ var LoadingPage = React30.forwardRef(
4610
4688
  className,
4611
4689
  ...props
4612
4690
  }, ref) => {
4613
- const [visible, setVisible] = React30.useState(delay === 0 && loading);
4614
- React30.useEffect(() => {
4691
+ const [visible, setVisible] = React31.useState(delay === 0 && loading);
4692
+ React31.useEffect(() => {
4615
4693
  if (!loading) {
4616
4694
  setVisible(false);
4617
4695
  return;
@@ -4651,9 +4729,9 @@ var LoadingPage = React30.forwardRef(
4651
4729
  LoadingPage.displayName = "LoadingPage";
4652
4730
 
4653
4731
  // src/components/LoadingSection.tsx
4654
- import * as React31 from "react";
4732
+ import * as React32 from "react";
4655
4733
  import { jsx as jsx32, jsxs as jsxs23 } from "react/jsx-runtime";
4656
- var LoadingSection = React31.forwardRef(
4734
+ var LoadingSection = React32.forwardRef(
4657
4735
  ({
4658
4736
  loading = false,
4659
4737
  variant = "spinner",
@@ -4695,9 +4773,9 @@ var LoadingSection = React31.forwardRef(
4695
4773
  LoadingSection.displayName = "LoadingSection";
4696
4774
 
4697
4775
  // src/components/LiveRegion.tsx
4698
- import * as React32 from "react";
4776
+ import * as React33 from "react";
4699
4777
  import { jsx as jsx33 } from "react/jsx-runtime";
4700
- var LiveRegion = React32.forwardRef(
4778
+ var LiveRegion = React33.forwardRef(
4701
4779
  ({ message, politeness = "polite", atomic = true, visuallyHidden = true, className, children }, ref) => {
4702
4780
  return /* @__PURE__ */ jsx33(
4703
4781
  "div",
@@ -4718,9 +4796,9 @@ var LiveRegion = React32.forwardRef(
4718
4796
  LiveRegion.displayName = "LiveRegion";
4719
4797
 
4720
4798
  // src/components/SkipLink.tsx
4721
- import * as React33 from "react";
4799
+ import * as React34 from "react";
4722
4800
  import { jsx as jsx34 } from "react/jsx-runtime";
4723
- var SkipLink = React33.forwardRef(
4801
+ var SkipLink = React34.forwardRef(
4724
4802
  ({ targetId, className, children = "Skip to main content", onClick, ...props }, ref) => {
4725
4803
  const handleClick = (e) => {
4726
4804
  e.preventDefault();
@@ -4754,11 +4832,11 @@ var SkipLink = React33.forwardRef(
4754
4832
  SkipLink.displayName = "SkipLink";
4755
4833
 
4756
4834
  // src/hooks/useFocusRef.ts
4757
- import { useRef as useRef10, useEffect as useEffect12 } from "react";
4835
+ import { useRef as useRef11, useEffect as useEffect13 } from "react";
4758
4836
  function useFocusRef(options = {}) {
4759
4837
  const { focusOnMount = false, preventScroll = false, delay = 0 } = options;
4760
- const ref = useRef10(null);
4761
- useEffect12(() => {
4838
+ const ref = useRef11(null);
4839
+ useEffect13(() => {
4762
4840
  if (!focusOnMount) return;
4763
4841
  const focus = () => {
4764
4842
  if (ref.current && typeof ref.current.focus === "function") {
@@ -4777,10 +4855,10 @@ function useFocusRef(options = {}) {
4777
4855
  }
4778
4856
 
4779
4857
  // src/hooks/useReducedMotion.ts
4780
- import { useState as useState13, useEffect as useEffect13 } from "react";
4858
+ import { useState as useState13, useEffect as useEffect14 } from "react";
4781
4859
  function useReducedMotion() {
4782
4860
  const [reducedMotion, setReducedMotion] = useState13(false);
4783
- useEffect13(() => {
4861
+ useEffect14(() => {
4784
4862
  const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
4785
4863
  setReducedMotion(mediaQuery.matches);
4786
4864
  const handleChange = (event) => {
@@ -4795,8 +4873,8 @@ function useReducedMotion() {
4795
4873
  }
4796
4874
 
4797
4875
  // src/hooks/useArrowNavigation.ts
4798
- import { useCallback as useCallback5, useRef as useRef11, useState as useState14 } from "react";
4799
- var DEFAULT_SELECTOR = '[role="menuitem"], [role="option"], [role="tab"], button, a, [tabindex]:not([tabindex="-1"])';
4876
+ import { useCallback as useCallback5, useRef as useRef12, useState as useState14 } from "react";
4877
+ var DEFAULT_SELECTOR = '[data-arrow-nav-item], [role="menuitem"], [role="option"], [role="tab"], button, a, [tabindex]:not([tabindex="-1"])';
4800
4878
  function useArrowNavigation(options = {}) {
4801
4879
  const {
4802
4880
  orientation = "vertical",
@@ -4804,8 +4882,8 @@ function useArrowNavigation(options = {}) {
4804
4882
  itemSelector = DEFAULT_SELECTOR,
4805
4883
  onFocusChange
4806
4884
  } = options;
4807
- const containerRef = useRef11(null);
4808
- const focusedIndexRef = useRef11(-1);
4885
+ const containerRef = useRef12(null);
4886
+ const focusedIndexRef = useRef12(-1);
4809
4887
  const [focusedIndex, setFocusedIndexState] = useState14(-1);
4810
4888
  const setFocusedIndex = useCallback5((index) => {
4811
4889
  focusedIndexRef.current = index;
@@ -4902,6 +4980,7 @@ function useArrowNavigation(options = {}) {
4902
4980
  const tabStopIndex = focusedIndex === -1 ? 0 : focusedIndex;
4903
4981
  const getItemProps = useCallback5(
4904
4982
  (index) => ({
4983
+ "data-arrow-nav-item": true,
4905
4984
  tabIndex: index === tabStopIndex ? 0 : -1,
4906
4985
  onFocus: () => {
4907
4986
  setFocusedIndex(index);
@@ -4918,13 +4997,13 @@ function useArrowNavigation(options = {}) {
4918
4997
  }
4919
4998
 
4920
4999
  // src/hooks/useRovingTabindex.ts
4921
- import { useState as useState15, useCallback as useCallback6, useRef as useRef12 } from "react";
5000
+ import { useState as useState15, useCallback as useCallback6, useRef as useRef13 } from "react";
4922
5001
  var DEFAULT_SELECTOR2 = "[data-roving-tabindex-item]";
4923
5002
  function useRovingTabindex(options = {}) {
4924
5003
  const { loop = true, itemSelector = DEFAULT_SELECTOR2, initialIndex = 0, onIndexChange } = options;
4925
5004
  const [activeIndex, setActiveIndex] = useState15(initialIndex);
4926
- const containerRef = useRef12(null);
4927
- const itemsRef = useRef12(/* @__PURE__ */ new Map());
5005
+ const containerRef = useRef13(null);
5006
+ const itemsRef = useRef13(/* @__PURE__ */ new Map());
4928
5007
  const getItems = useCallback6(() => {
4929
5008
  if (!containerRef.current) {
4930
5009
  return Array.from(itemsRef.current.values());
@@ -4990,7 +5069,7 @@ function useRovingTabindex(options = {}) {
4990
5069
  onKeyDown: handleKeyDown
4991
5070
  };
4992
5071
  const getItemProps = useCallback6(
4993
- (index) => ({
5072
+ (index, handlers = {}) => ({
4994
5073
  "data-roving-tabindex-item": true,
4995
5074
  tabIndex: index === activeIndex ? 0 : -1,
4996
5075
  ref: (node) => {
@@ -5000,11 +5079,13 @@ function useRovingTabindex(options = {}) {
5000
5079
  itemsRef.current.delete(index);
5001
5080
  }
5002
5081
  },
5003
- onClick: () => {
5082
+ onClick: (event) => {
5083
+ handlers.onClick?.(event);
5004
5084
  setActiveIndex(index);
5005
5085
  onIndexChange?.(index);
5006
5086
  },
5007
- onFocus: () => {
5087
+ onFocus: (event) => {
5088
+ handlers.onFocus?.(event);
5008
5089
  if (activeIndex !== index) {
5009
5090
  setActiveIndex(index);
5010
5091
  onIndexChange?.(index);
@@ -5026,21 +5107,21 @@ function useRovingTabindex(options = {}) {
5026
5107
  }
5027
5108
 
5028
5109
  // src/hooks/useClickOutside.ts
5029
- import * as React34 from "react";
5110
+ import * as React35 from "react";
5030
5111
  function useClickOutside(ref, callback, options) {
5031
5112
  const {
5032
5113
  enabled = true,
5033
5114
  events = ["mousedown", "touchstart"],
5034
5115
  ignoreElements = []
5035
5116
  } = options ?? {};
5036
- const callbackRef = React34.useRef(callback);
5037
- const ignoreElementsRef = React34.useRef(ignoreElements);
5038
- React34.useEffect(() => {
5117
+ const callbackRef = React35.useRef(callback);
5118
+ const ignoreElementsRef = React35.useRef(ignoreElements);
5119
+ React35.useEffect(() => {
5039
5120
  callbackRef.current = callback;
5040
5121
  ignoreElementsRef.current = ignoreElements;
5041
5122
  }, [callback, ignoreElements]);
5042
5123
  const eventsKey = events.join(",");
5043
- React34.useEffect(() => {
5124
+ React35.useEffect(() => {
5044
5125
  if (!enabled) return;
5045
5126
  const handleEvent = (event) => {
5046
5127
  const target = event.target;
@@ -5123,6 +5204,7 @@ export {
5123
5204
  badgeVariants,
5124
5205
  buttonVariants,
5125
5206
  cn,
5207
+ labelVariants,
5126
5208
  pageHeaderActionsVariants,
5127
5209
  pageHeaderContainerVariants,
5128
5210
  pageHeaderSubtitleVariants,