@classic-homes/theme-react 0.4.3 → 0.5.1
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.css +0 -7
- package/dist/index.d.mts +42 -13
- package/dist/index.d.ts +42 -13
- package/dist/index.js +396 -309
- package/dist/index.mjs +430 -344
- package/package.json +9 -5
package/dist/index.js
CHANGED
|
@@ -87,6 +87,7 @@ __export(index_exports, {
|
|
|
87
87
|
badgeVariants: () => badgeVariants,
|
|
88
88
|
buttonVariants: () => buttonVariants,
|
|
89
89
|
cn: () => cn,
|
|
90
|
+
labelVariants: () => labelVariants,
|
|
90
91
|
pageHeaderActionsVariants: () => pageHeaderActionsVariants,
|
|
91
92
|
pageHeaderContainerVariants: () => pageHeaderContainerVariants,
|
|
92
93
|
pageHeaderSubtitleVariants: () => pageHeaderSubtitleVariants,
|
|
@@ -207,9 +208,25 @@ var CardFooter = React2.forwardRef(
|
|
|
207
208
|
CardFooter.displayName = "CardFooter";
|
|
208
209
|
|
|
209
210
|
// src/components/Input.tsx
|
|
211
|
+
var React4 = __toESM(require("react"));
|
|
212
|
+
|
|
213
|
+
// src/lib/useDevWarning.ts
|
|
210
214
|
var React3 = __toESM(require("react"));
|
|
215
|
+
var warnedOnce = /* @__PURE__ */ new Set();
|
|
216
|
+
function useDevWarning(condition, message, once = false) {
|
|
217
|
+
React3.useEffect(() => {
|
|
218
|
+
if (process.env.NODE_ENV === "production" || !condition) return;
|
|
219
|
+
if (once) {
|
|
220
|
+
if (warnedOnce.has(message)) return;
|
|
221
|
+
warnedOnce.add(message);
|
|
222
|
+
}
|
|
223
|
+
console.warn(message);
|
|
224
|
+
}, [condition, message, once]);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// src/components/Input.tsx
|
|
211
228
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
212
|
-
var Input =
|
|
229
|
+
var Input = React4.forwardRef(
|
|
213
230
|
({
|
|
214
231
|
className,
|
|
215
232
|
type,
|
|
@@ -218,13 +235,10 @@ var Input = React3.forwardRef(
|
|
|
218
235
|
"aria-describedby": ariaDescribedBy,
|
|
219
236
|
...props
|
|
220
237
|
}, ref) => {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
238
|
+
useDevWarning(
|
|
239
|
+
!props["aria-label"] && !props["aria-labelledby"] && !props.id,
|
|
240
|
+
"Input: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
|
|
241
|
+
);
|
|
228
242
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
229
243
|
"input",
|
|
230
244
|
{
|
|
@@ -247,24 +261,24 @@ var Input = React3.forwardRef(
|
|
|
247
261
|
Input.displayName = "Input";
|
|
248
262
|
|
|
249
263
|
// src/components/PasswordInput.tsx
|
|
250
|
-
var
|
|
264
|
+
var React6 = __toESM(require("react"));
|
|
251
265
|
|
|
252
266
|
// src/hooks/useAnnounce.ts
|
|
253
|
-
var
|
|
267
|
+
var React5 = __toESM(require("react"));
|
|
254
268
|
function useAnnounce(defaultOptions) {
|
|
255
|
-
const [message, setMessage] =
|
|
256
|
-
const [politeness, setPoliteness] =
|
|
269
|
+
const [message, setMessage] = React5.useState("");
|
|
270
|
+
const [politeness, setPoliteness] = React5.useState(
|
|
257
271
|
defaultOptions?.politeness ?? "polite"
|
|
258
272
|
);
|
|
259
|
-
const clearTimeoutRef =
|
|
260
|
-
const clear =
|
|
273
|
+
const clearTimeoutRef = React5.useRef(null);
|
|
274
|
+
const clear = React5.useCallback(() => {
|
|
261
275
|
setMessage("");
|
|
262
276
|
if (clearTimeoutRef.current) {
|
|
263
277
|
clearTimeout(clearTimeoutRef.current);
|
|
264
278
|
clearTimeoutRef.current = null;
|
|
265
279
|
}
|
|
266
280
|
}, []);
|
|
267
|
-
const announce =
|
|
281
|
+
const announce = React5.useCallback(
|
|
268
282
|
(newMessage, options) => {
|
|
269
283
|
if (clearTimeoutRef.current) {
|
|
270
284
|
clearTimeout(clearTimeoutRef.current);
|
|
@@ -282,7 +296,7 @@ function useAnnounce(defaultOptions) {
|
|
|
282
296
|
},
|
|
283
297
|
[defaultOptions?.clearDelay, defaultOptions?.politeness]
|
|
284
298
|
);
|
|
285
|
-
|
|
299
|
+
React5.useEffect(() => {
|
|
286
300
|
return () => {
|
|
287
301
|
if (clearTimeoutRef.current) {
|
|
288
302
|
clearTimeout(clearTimeoutRef.current);
|
|
@@ -334,7 +348,7 @@ var EyeOffIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
|
334
348
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" })
|
|
335
349
|
}
|
|
336
350
|
);
|
|
337
|
-
var PasswordInput =
|
|
351
|
+
var PasswordInput = React6.forwardRef(
|
|
338
352
|
({
|
|
339
353
|
className,
|
|
340
354
|
disabled,
|
|
@@ -347,15 +361,12 @@ var PasswordInput = React5.forwardRef(
|
|
|
347
361
|
"aria-labelledby": ariaLabelledBy,
|
|
348
362
|
...props
|
|
349
363
|
}, ref) => {
|
|
350
|
-
const [showPassword, setShowPassword] =
|
|
364
|
+
const [showPassword, setShowPassword] = React6.useState(false);
|
|
351
365
|
const { announce, message, politeness } = useAnnounce();
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
366
|
+
useDevWarning(
|
|
367
|
+
!ariaLabel && !ariaLabelledBy && !id,
|
|
368
|
+
"PasswordInput: Missing accessible label. Provide aria-label, aria-labelledby, or an id to associate with a Label element for WCAG compliance."
|
|
369
|
+
);
|
|
359
370
|
const toggleVisibility = () => {
|
|
360
371
|
setShowPassword((prev) => {
|
|
361
372
|
const newState = !prev;
|
|
@@ -399,18 +410,18 @@ var PasswordInput = React5.forwardRef(
|
|
|
399
410
|
PasswordInput.displayName = "PasswordInput";
|
|
400
411
|
|
|
401
412
|
// src/components/Label.tsx
|
|
402
|
-
var
|
|
413
|
+
var React7 = __toESM(require("react"));
|
|
403
414
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
|
|
404
415
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
405
416
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
406
417
|
var labelVariants = (0, import_class_variance_authority2.cva)(
|
|
407
418
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
408
419
|
);
|
|
409
|
-
var Label =
|
|
420
|
+
var Label = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LabelPrimitive.Root, { ref, className: cn(labelVariants(), className), ...props }));
|
|
410
421
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
411
422
|
|
|
412
423
|
// src/components/Badge.tsx
|
|
413
|
-
var
|
|
424
|
+
var React8 = __toESM(require("react"));
|
|
414
425
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
415
426
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
416
427
|
var badgeVariants = (0, import_class_variance_authority3.cva)(
|
|
@@ -458,7 +469,7 @@ var badgeVariants = (0, import_class_variance_authority3.cva)(
|
|
|
458
469
|
}
|
|
459
470
|
}
|
|
460
471
|
);
|
|
461
|
-
var Badge =
|
|
472
|
+
var Badge = React8.forwardRef(
|
|
462
473
|
({ className, variant, size, live, clickable, label, children, onClick, ...props }, ref) => {
|
|
463
474
|
if (process.env.NODE_ENV !== "production") {
|
|
464
475
|
if (live && !label) {
|
|
@@ -469,41 +480,34 @@ var Badge = React7.forwardRef(
|
|
|
469
480
|
}
|
|
470
481
|
const isInteractive = clickable || !!onClick;
|
|
471
482
|
const classes = cn(badgeVariants({ variant, size, clickable: isInteractive }), className);
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
"
|
|
476
|
-
|
|
477
|
-
...props
|
|
478
|
-
};
|
|
483
|
+
const liveProps = live ? { role: "status", "aria-live": "polite", "aria-atomic": "true" } : {};
|
|
484
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
485
|
+
children,
|
|
486
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: label })
|
|
487
|
+
] });
|
|
479
488
|
if (isInteractive) {
|
|
480
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.
|
|
489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
481
490
|
"button",
|
|
482
491
|
{
|
|
483
492
|
ref,
|
|
484
493
|
type: "button",
|
|
485
494
|
onClick,
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: label })
|
|
490
|
-
]
|
|
495
|
+
className: classes,
|
|
496
|
+
...props,
|
|
497
|
+
children: live ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { ...liveProps, children: content }) : content
|
|
491
498
|
}
|
|
492
499
|
);
|
|
493
500
|
}
|
|
494
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.
|
|
495
|
-
children,
|
|
496
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sr-only", children: label })
|
|
497
|
-
] });
|
|
501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { ref, ...liveProps, className: classes, ...props, children: content });
|
|
498
502
|
}
|
|
499
503
|
);
|
|
500
504
|
Badge.displayName = "Badge";
|
|
501
505
|
|
|
502
506
|
// src/components/Separator.tsx
|
|
503
|
-
var
|
|
507
|
+
var React9 = __toESM(require("react"));
|
|
504
508
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"));
|
|
505
509
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
506
|
-
var Separator =
|
|
510
|
+
var Separator = React9.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => {
|
|
507
511
|
if (process.env.NODE_ENV !== "production") {
|
|
508
512
|
if (!decorative && !props["aria-label"]) {
|
|
509
513
|
console.warn(
|
|
@@ -529,12 +533,12 @@ var Separator = React8.forwardRef(({ className, orientation = "horizontal", deco
|
|
|
529
533
|
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
530
534
|
|
|
531
535
|
// src/components/Switch.tsx
|
|
532
|
-
var
|
|
536
|
+
var React10 = __toESM(require("react"));
|
|
533
537
|
var SwitchPrimitives = __toESM(require("@radix-ui/react-switch"));
|
|
534
538
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
535
539
|
var SwitchRoot = SwitchPrimitives.Root;
|
|
536
540
|
var SwitchThumb = SwitchPrimitives.Thumb;
|
|
537
|
-
var Switch =
|
|
541
|
+
var Switch = React10.forwardRef(
|
|
538
542
|
({
|
|
539
543
|
className,
|
|
540
544
|
size = "default",
|
|
@@ -543,13 +547,10 @@ var Switch = React9.forwardRef(
|
|
|
543
547
|
"aria-describedby": ariaDescribedBy,
|
|
544
548
|
...props
|
|
545
549
|
}, ref) => {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
);
|
|
551
|
-
}
|
|
552
|
-
}
|
|
550
|
+
useDevWarning(
|
|
551
|
+
!ariaLabel && !ariaLabelledBy && !props.id,
|
|
552
|
+
"Switch: Missing accessible label. Provide aria-label, aria-labelledby, or associate with a Label using id/htmlFor for WCAG compliance."
|
|
553
|
+
);
|
|
553
554
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
554
555
|
SwitchRoot,
|
|
555
556
|
{
|
|
@@ -581,10 +582,10 @@ var Switch = React9.forwardRef(
|
|
|
581
582
|
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
582
583
|
|
|
583
584
|
// src/components/Avatar.tsx
|
|
584
|
-
var
|
|
585
|
+
var React11 = __toESM(require("react"));
|
|
585
586
|
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
586
587
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
587
|
-
var Avatar =
|
|
588
|
+
var Avatar = React11.forwardRef(
|
|
588
589
|
({ className, name, "aria-label": ariaLabel, ...props }, ref) => {
|
|
589
590
|
if (process.env.NODE_ENV !== "production") {
|
|
590
591
|
if (!ariaLabel && !name) {
|
|
@@ -598,6 +599,7 @@ var Avatar = React10.forwardRef(
|
|
|
598
599
|
AvatarPrimitive.Root,
|
|
599
600
|
{
|
|
600
601
|
ref,
|
|
602
|
+
role: computedAriaLabel ? "img" : void 0,
|
|
601
603
|
"aria-label": computedAriaLabel,
|
|
602
604
|
className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className),
|
|
603
605
|
...props
|
|
@@ -606,7 +608,7 @@ var Avatar = React10.forwardRef(
|
|
|
606
608
|
}
|
|
607
609
|
);
|
|
608
610
|
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
609
|
-
var AvatarImage =
|
|
611
|
+
var AvatarImage = React11.forwardRef(({ className, alt, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
610
612
|
AvatarPrimitive.Image,
|
|
611
613
|
{
|
|
612
614
|
ref,
|
|
@@ -616,7 +618,7 @@ var AvatarImage = React10.forwardRef(({ className, alt, ...props }, ref) => /* @
|
|
|
616
618
|
}
|
|
617
619
|
));
|
|
618
620
|
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
619
|
-
var AvatarFallback =
|
|
621
|
+
var AvatarFallback = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
620
622
|
AvatarPrimitive.Fallback,
|
|
621
623
|
{
|
|
622
624
|
ref,
|
|
@@ -630,7 +632,7 @@ var AvatarFallback = React10.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
630
632
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
631
633
|
|
|
632
634
|
// src/components/Dialog.tsx
|
|
633
|
-
var
|
|
635
|
+
var React12 = __toESM(require("react"));
|
|
634
636
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
|
|
635
637
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
636
638
|
var PrimitiveOverlay = DialogPrimitive.Overlay;
|
|
@@ -649,7 +651,7 @@ var dialogSizeClasses = {
|
|
|
649
651
|
"2xl": "max-w-[min(theme(maxWidth.3xl),calc(100vw-2rem))]",
|
|
650
652
|
full: "max-w-[calc(100vw-2rem)]"
|
|
651
653
|
};
|
|
652
|
-
var DialogOverlay =
|
|
654
|
+
var DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
653
655
|
PrimitiveOverlay,
|
|
654
656
|
{
|
|
655
657
|
ref,
|
|
@@ -661,19 +663,50 @@ var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
661
663
|
}
|
|
662
664
|
));
|
|
663
665
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
664
|
-
var DialogContent =
|
|
666
|
+
var DialogContent = React12.forwardRef(({ className, children, size = "md", showClose = false, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(DialogPortal, { children: [
|
|
665
667
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogOverlay, {}),
|
|
666
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.
|
|
668
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
667
669
|
PrimitiveContent,
|
|
668
670
|
{
|
|
669
671
|
ref,
|
|
670
672
|
className: cn(
|
|
671
|
-
|
|
673
|
+
// max-h + overflow: a dialog taller than the viewport scrolls inside
|
|
674
|
+
// itself instead of running off-screen.
|
|
675
|
+
"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",
|
|
672
676
|
dialogSizeClasses[size],
|
|
673
677
|
className
|
|
674
678
|
),
|
|
675
679
|
...props,
|
|
676
|
-
children
|
|
680
|
+
children: [
|
|
681
|
+
children,
|
|
682
|
+
showClose && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
683
|
+
DialogPrimitive.Close,
|
|
684
|
+
{
|
|
685
|
+
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",
|
|
686
|
+
"aria-label": "Close dialog",
|
|
687
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
688
|
+
"svg",
|
|
689
|
+
{
|
|
690
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
691
|
+
width: "20",
|
|
692
|
+
height: "20",
|
|
693
|
+
viewBox: "0 0 24 24",
|
|
694
|
+
fill: "none",
|
|
695
|
+
stroke: "currentColor",
|
|
696
|
+
strokeWidth: "2",
|
|
697
|
+
strokeLinecap: "round",
|
|
698
|
+
strokeLinejoin: "round",
|
|
699
|
+
className: "h-5 w-5",
|
|
700
|
+
"aria-hidden": "true",
|
|
701
|
+
children: [
|
|
702
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M18 6 6 18" }),
|
|
703
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "m6 6 12 12" })
|
|
704
|
+
]
|
|
705
|
+
}
|
|
706
|
+
)
|
|
707
|
+
}
|
|
708
|
+
)
|
|
709
|
+
]
|
|
677
710
|
}
|
|
678
711
|
)
|
|
679
712
|
] }));
|
|
@@ -688,7 +721,7 @@ var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_r
|
|
|
688
721
|
}
|
|
689
722
|
);
|
|
690
723
|
DialogFooter.displayName = "DialogFooter";
|
|
691
|
-
var DialogTitle =
|
|
724
|
+
var DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
692
725
|
PrimitiveTitle,
|
|
693
726
|
{
|
|
694
727
|
ref,
|
|
@@ -697,7 +730,7 @@ var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
697
730
|
}
|
|
698
731
|
));
|
|
699
732
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
700
|
-
var DialogDescription =
|
|
733
|
+
var DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
701
734
|
PrimitiveDescription,
|
|
702
735
|
{
|
|
703
736
|
ref,
|
|
@@ -708,7 +741,7 @@ var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /*
|
|
|
708
741
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
709
742
|
|
|
710
743
|
// src/components/PageHeader.tsx
|
|
711
|
-
var
|
|
744
|
+
var React13 = __toESM(require("react"));
|
|
712
745
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
713
746
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
714
747
|
var pageHeaderContainerVariants = (0, import_class_variance_authority4.cva)("", {
|
|
@@ -771,15 +804,13 @@ var pageHeaderActionsVariants = (0, import_class_variance_authority4.cva)("flex
|
|
|
771
804
|
variant: "default"
|
|
772
805
|
}
|
|
773
806
|
});
|
|
774
|
-
var PageHeader =
|
|
807
|
+
var PageHeader = React13.forwardRef(
|
|
775
808
|
({ className, variant, title, subtitle, actions, as: Heading = "h1", ...props }, ref) => {
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
}
|
|
809
|
+
useDevWarning(
|
|
810
|
+
Heading === "h1",
|
|
811
|
+
'PageHeader: Using as="h1" (the default). Ensure there is only one h1 per page for proper document structure. Consider as="h2" for secondary headers.',
|
|
812
|
+
true
|
|
813
|
+
);
|
|
783
814
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
784
815
|
"header",
|
|
785
816
|
{
|
|
@@ -945,8 +976,9 @@ function Sheet({
|
|
|
945
976
|
}
|
|
946
977
|
|
|
947
978
|
// src/components/SortableList.tsx
|
|
948
|
-
var
|
|
979
|
+
var React14 = __toESM(require("react"));
|
|
949
980
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
981
|
+
var HANDLE_STYLE = { touchAction: "none" };
|
|
950
982
|
function SortableList({
|
|
951
983
|
items,
|
|
952
984
|
getKey,
|
|
@@ -958,19 +990,19 @@ function SortableList({
|
|
|
958
990
|
className,
|
|
959
991
|
itemClassName
|
|
960
992
|
}) {
|
|
961
|
-
const instructionsId = `${
|
|
962
|
-
const listRef =
|
|
963
|
-
const [announcement, setAnnouncement] =
|
|
964
|
-
const [drag, setDrag] =
|
|
993
|
+
const instructionsId = `${React14.useId()}-sortable-help`;
|
|
994
|
+
const listRef = React14.useRef(null);
|
|
995
|
+
const [announcement, setAnnouncement] = React14.useState("");
|
|
996
|
+
const [drag, setDrag] = React14.useState(
|
|
965
997
|
null
|
|
966
998
|
);
|
|
967
|
-
const rects =
|
|
968
|
-
const startY =
|
|
969
|
-
const [grabbed, setGrabbed] =
|
|
970
|
-
const grabbedFrom =
|
|
971
|
-
const moving =
|
|
972
|
-
const pendingFocus =
|
|
973
|
-
|
|
999
|
+
const rects = React14.useRef([]);
|
|
1000
|
+
const startY = React14.useRef(0);
|
|
1001
|
+
const [grabbed, setGrabbed] = React14.useState(null);
|
|
1002
|
+
const grabbedFrom = React14.useRef(0);
|
|
1003
|
+
const moving = React14.useRef(false);
|
|
1004
|
+
const pendingFocus = React14.useRef(null);
|
|
1005
|
+
React14.useLayoutEffect(() => {
|
|
974
1006
|
if (pendingFocus.current === null) return;
|
|
975
1007
|
const handles = listRef.current?.querySelectorAll(
|
|
976
1008
|
":scope > li [data-sortable-handle]"
|
|
@@ -1017,6 +1049,7 @@ function SortableList({
|
|
|
1017
1049
|
"aria-describedby": instructionsId,
|
|
1018
1050
|
"aria-pressed": grabbed === index,
|
|
1019
1051
|
"data-sortable-handle": String(key),
|
|
1052
|
+
style: HANDLE_STYLE,
|
|
1020
1053
|
onPointerDown(event) {
|
|
1021
1054
|
if (disabled || event.button !== 0 || !listRef.current) return;
|
|
1022
1055
|
event.preventDefault();
|
|
@@ -1108,20 +1141,20 @@ function SortableList({
|
|
|
1108
1141
|
}
|
|
1109
1142
|
|
|
1110
1143
|
// src/components/studio/Studio.tsx
|
|
1111
|
-
var
|
|
1144
|
+
var React16 = __toESM(require("react"));
|
|
1112
1145
|
|
|
1113
1146
|
// src/components/studio/context.ts
|
|
1114
|
-
var
|
|
1115
|
-
var StudioContext =
|
|
1147
|
+
var React15 = __toESM(require("react"));
|
|
1148
|
+
var StudioContext = React15.createContext(void 0);
|
|
1116
1149
|
function useStudio() {
|
|
1117
|
-
return
|
|
1150
|
+
return React15.useContext(StudioContext);
|
|
1118
1151
|
}
|
|
1119
1152
|
|
|
1120
1153
|
// src/components/studio/Studio.tsx
|
|
1121
1154
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1122
1155
|
function useLayout() {
|
|
1123
|
-
const [layout, setLayout] =
|
|
1124
|
-
|
|
1156
|
+
const [layout, setLayout] = React16.useState("wide");
|
|
1157
|
+
React16.useEffect(() => {
|
|
1125
1158
|
const wide = window.matchMedia("(min-width: 1280px)");
|
|
1126
1159
|
const medium = window.matchMedia("(min-width: 768px)");
|
|
1127
1160
|
const update = () => setLayout(wide.matches ? "wide" : medium.matches ? "medium" : "compact");
|
|
@@ -1136,9 +1169,9 @@ function useLayout() {
|
|
|
1136
1169
|
return layout;
|
|
1137
1170
|
}
|
|
1138
1171
|
function useControllable(value, onChange) {
|
|
1139
|
-
const [inner, setInner] =
|
|
1172
|
+
const [inner, setInner] = React16.useState(false);
|
|
1140
1173
|
const current = value ?? inner;
|
|
1141
|
-
const set =
|
|
1174
|
+
const set = React16.useCallback(
|
|
1142
1175
|
(next) => {
|
|
1143
1176
|
if (value === void 0) setInner(next);
|
|
1144
1177
|
onChange?.(next);
|
|
@@ -1170,11 +1203,11 @@ function Studio({
|
|
|
1170
1203
|
);
|
|
1171
1204
|
const railInSheet = !!rail && layout !== "wide";
|
|
1172
1205
|
const inspectorInSheet = !!inspector && layout === "compact";
|
|
1173
|
-
|
|
1206
|
+
React16.useEffect(() => {
|
|
1174
1207
|
if (layout === "wide" && railOpen) setRailOpen(false);
|
|
1175
1208
|
if (layout !== "compact" && inspectorOpen) setInspectorOpen(false);
|
|
1176
1209
|
}, [layout, railOpen, inspectorOpen, setRailOpen, setInspectorOpen]);
|
|
1177
|
-
const context =
|
|
1210
|
+
const context = React16.useMemo(
|
|
1178
1211
|
() => ({
|
|
1179
1212
|
layout,
|
|
1180
1213
|
railInSheet,
|
|
@@ -1268,7 +1301,7 @@ function Studio({
|
|
|
1268
1301
|
}
|
|
1269
1302
|
|
|
1270
1303
|
// src/components/studio/StudioBar.tsx
|
|
1271
|
-
var
|
|
1304
|
+
var React17 = __toESM(require("react"));
|
|
1272
1305
|
|
|
1273
1306
|
// src/components/studio/menu.tsx
|
|
1274
1307
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
@@ -1318,7 +1351,7 @@ function ModeSwitch({
|
|
|
1318
1351
|
value,
|
|
1319
1352
|
onChange
|
|
1320
1353
|
}) {
|
|
1321
|
-
const refs =
|
|
1354
|
+
const refs = React17.useRef([]);
|
|
1322
1355
|
const keyDown = (event, index) => {
|
|
1323
1356
|
const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
|
|
1324
1357
|
if (!step) return;
|
|
@@ -1381,9 +1414,9 @@ function StudioBar({
|
|
|
1381
1414
|
menuLabel = "More actions",
|
|
1382
1415
|
className
|
|
1383
1416
|
}) {
|
|
1384
|
-
const [draft, setDraft] =
|
|
1385
|
-
const atFocus =
|
|
1386
|
-
|
|
1417
|
+
const [draft, setDraft] = React17.useState(title);
|
|
1418
|
+
const atFocus = React17.useRef(title);
|
|
1419
|
+
React17.useEffect(() => setDraft(title), [title]);
|
|
1387
1420
|
const commit = () => {
|
|
1388
1421
|
const next = draft.trim();
|
|
1389
1422
|
if (!next) {
|
|
@@ -1473,7 +1506,7 @@ function StudioBar({
|
|
|
1473
1506
|
}
|
|
1474
1507
|
|
|
1475
1508
|
// src/components/studio/StudioOutline.tsx
|
|
1476
|
-
var
|
|
1509
|
+
var React18 = __toESM(require("react"));
|
|
1477
1510
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1478
1511
|
function StudioOutline({
|
|
1479
1512
|
items,
|
|
@@ -1491,12 +1524,12 @@ function StudioOutline({
|
|
|
1491
1524
|
className
|
|
1492
1525
|
}) {
|
|
1493
1526
|
const studio = useStudio();
|
|
1494
|
-
const listHost =
|
|
1527
|
+
const listHost = React18.useRef(null);
|
|
1495
1528
|
const focusIndex = Math.max(
|
|
1496
1529
|
0,
|
|
1497
1530
|
items.findIndex((i) => i.id === selected)
|
|
1498
1531
|
);
|
|
1499
|
-
|
|
1532
|
+
React18.useEffect(() => {
|
|
1500
1533
|
if (!selected) return;
|
|
1501
1534
|
listHost.current?.querySelector(`[data-outline-id="${CSS.escape(selected)}"]`)?.scrollIntoView?.({ block: "nearest" });
|
|
1502
1535
|
}, [selected]);
|
|
@@ -1653,8 +1686,9 @@ function StudioOutline({
|
|
|
1653
1686
|
}
|
|
1654
1687
|
|
|
1655
1688
|
// src/components/studio/StudioCanvas.tsx
|
|
1656
|
-
var
|
|
1689
|
+
var React19 = __toESM(require("react"));
|
|
1657
1690
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1691
|
+
var DEVICES = ["desktop", "phone"];
|
|
1658
1692
|
function StudioCanvas({
|
|
1659
1693
|
children,
|
|
1660
1694
|
deviceToggle = false,
|
|
@@ -1668,13 +1702,31 @@ function StudioCanvas({
|
|
|
1668
1702
|
className
|
|
1669
1703
|
}) {
|
|
1670
1704
|
const studio = useStudio();
|
|
1671
|
-
const [innerDevice, setInnerDevice] =
|
|
1705
|
+
const [innerDevice, setInnerDevice] = React19.useState("desktop");
|
|
1672
1706
|
const device = deviceProp ?? innerDevice;
|
|
1673
1707
|
const setDevice = (d) => {
|
|
1674
1708
|
if (deviceProp === void 0) setInnerDevice(d);
|
|
1675
1709
|
onDeviceChange?.(d);
|
|
1676
1710
|
};
|
|
1677
1711
|
const showDevices = deviceToggle && studio?.layout !== "compact";
|
|
1712
|
+
const deviceRefs = React19.useRef([]);
|
|
1713
|
+
const deviceKeyDown = (event, index) => {
|
|
1714
|
+
const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
|
|
1715
|
+
if (!step) return;
|
|
1716
|
+
event.preventDefault();
|
|
1717
|
+
const next = (index + step + DEVICES.length) % DEVICES.length;
|
|
1718
|
+
setDevice(DEVICES[next]);
|
|
1719
|
+
deviceRefs.current[next]?.focus();
|
|
1720
|
+
};
|
|
1721
|
+
const handleKeyDown = (e) => {
|
|
1722
|
+
if (e.key !== "Escape" || e.defaultPrevented || !onBackgroundClick) return;
|
|
1723
|
+
const target = e.target;
|
|
1724
|
+
if (target.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName)) {
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
e.preventDefault();
|
|
1728
|
+
onBackgroundClick();
|
|
1729
|
+
};
|
|
1678
1730
|
const width = device === "phone" && showDevices ? "390px" : maxWidth;
|
|
1679
1731
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { "aria-label": label, className: cn("flex h-full flex-col", className), children: [
|
|
1680
1732
|
(showDevices || toolbar) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex shrink-0 items-center justify-end gap-2 px-3 pt-3", children: [
|
|
@@ -1685,13 +1737,18 @@ function StudioCanvas({
|
|
|
1685
1737
|
role: "radiogroup",
|
|
1686
1738
|
"aria-label": "Preview size",
|
|
1687
1739
|
className: "inline-flex h-9 items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground",
|
|
1688
|
-
children:
|
|
1740
|
+
children: DEVICES.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1689
1741
|
"button",
|
|
1690
1742
|
{
|
|
1743
|
+
ref: (el) => {
|
|
1744
|
+
deviceRefs.current[i] = el;
|
|
1745
|
+
},
|
|
1691
1746
|
type: "button",
|
|
1692
1747
|
role: "radio",
|
|
1693
1748
|
"aria-checked": device === d,
|
|
1749
|
+
tabIndex: device === d ? 0 : -1,
|
|
1694
1750
|
onClick: () => setDevice(d),
|
|
1751
|
+
onKeyDown: (e) => deviceKeyDown(e, i),
|
|
1695
1752
|
className: cn(
|
|
1696
1753
|
"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",
|
|
1697
1754
|
device === d && "bg-background text-foreground shadow-sm"
|
|
@@ -1713,6 +1770,7 @@ function StudioCanvas({
|
|
|
1713
1770
|
onClick: (e) => {
|
|
1714
1771
|
if (e.target === e.currentTarget) onBackgroundClick?.();
|
|
1715
1772
|
},
|
|
1773
|
+
onKeyDown: handleKeyDown,
|
|
1716
1774
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1717
1775
|
"div",
|
|
1718
1776
|
{
|
|
@@ -1730,7 +1788,7 @@ function StudioCanvas({
|
|
|
1730
1788
|
}
|
|
1731
1789
|
|
|
1732
1790
|
// src/components/studio/StudioCanvasItem.tsx
|
|
1733
|
-
var
|
|
1791
|
+
var React20 = __toESM(require("react"));
|
|
1734
1792
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1735
1793
|
function StudioCanvasItem({
|
|
1736
1794
|
children,
|
|
@@ -1742,17 +1800,18 @@ function StudioCanvasItem({
|
|
|
1742
1800
|
insertLabel,
|
|
1743
1801
|
invalid = false,
|
|
1744
1802
|
insertPlacement = "center",
|
|
1803
|
+
toolbarPlacement = "edge",
|
|
1745
1804
|
className
|
|
1746
1805
|
}) {
|
|
1747
1806
|
const studio = useStudio();
|
|
1748
|
-
const ref =
|
|
1749
|
-
const pickedHere =
|
|
1807
|
+
const ref = React20.useRef(null);
|
|
1808
|
+
const pickedHere = React20.useRef(false);
|
|
1750
1809
|
const inQuickAction = (target) => !!target?.closest?.("[data-studio-quick-action]");
|
|
1751
1810
|
const select = (reveal) => {
|
|
1752
1811
|
if (!selected) onSelect?.();
|
|
1753
1812
|
if (reveal) studio?.revealInspector();
|
|
1754
1813
|
};
|
|
1755
|
-
|
|
1814
|
+
React20.useEffect(() => {
|
|
1756
1815
|
const el = ref.current;
|
|
1757
1816
|
const here = pickedHere.current;
|
|
1758
1817
|
pickedHere.current = false;
|
|
@@ -1801,7 +1860,10 @@ function StudioCanvasItem({
|
|
|
1801
1860
|
"div",
|
|
1802
1861
|
{
|
|
1803
1862
|
"data-studio-quick-action": "",
|
|
1804
|
-
className:
|
|
1863
|
+
className: cn(
|
|
1864
|
+
"absolute right-3 z-10 flex items-center gap-0.5 rounded-md border border-border bg-background p-0.5 shadow-md",
|
|
1865
|
+
toolbarPlacement === "above" ? "bottom-full mb-1" : "-top-4"
|
|
1866
|
+
),
|
|
1805
1867
|
children: toolbar
|
|
1806
1868
|
}
|
|
1807
1869
|
),
|
|
@@ -1830,7 +1892,7 @@ function StudioCanvasItem({
|
|
|
1830
1892
|
}
|
|
1831
1893
|
|
|
1832
1894
|
// src/components/studio/StudioInspector.tsx
|
|
1833
|
-
var
|
|
1895
|
+
var React21 = __toESM(require("react"));
|
|
1834
1896
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1835
1897
|
function StudioInspector({
|
|
1836
1898
|
title,
|
|
@@ -1843,9 +1905,10 @@ function StudioInspector({
|
|
|
1843
1905
|
footer,
|
|
1844
1906
|
className
|
|
1845
1907
|
}) {
|
|
1846
|
-
const uid =
|
|
1847
|
-
const [innerTab, setInnerTab] =
|
|
1848
|
-
const
|
|
1908
|
+
const uid = React21.useId();
|
|
1909
|
+
const [innerTab, setInnerTab] = React21.useState(tabs?.[0]?.id ?? "");
|
|
1910
|
+
const requestedTab = tabProp ?? innerTab;
|
|
1911
|
+
const tab = !tabs || tabs.some((t) => t.id === requestedTab) ? requestedTab : tabs[0]?.id ?? "";
|
|
1849
1912
|
const hasTabs = !!tabs && tabs.length > 1;
|
|
1850
1913
|
const choose = (id) => {
|
|
1851
1914
|
if (id === tab) return;
|
|
@@ -1921,8 +1984,8 @@ function StudioInspectorSection({
|
|
|
1921
1984
|
children,
|
|
1922
1985
|
className
|
|
1923
1986
|
}) {
|
|
1924
|
-
const uid =
|
|
1925
|
-
const [open, setOpen] =
|
|
1987
|
+
const uid = React21.useId();
|
|
1988
|
+
const [open, setOpen] = React21.useState(defaultOpen);
|
|
1926
1989
|
const expanded = !collapsible || open;
|
|
1927
1990
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1928
1991
|
"section",
|
|
@@ -2056,7 +2119,7 @@ function SaveStatus({ state, detail, onRetry, label, className }) {
|
|
|
2056
2119
|
}
|
|
2057
2120
|
|
|
2058
2121
|
// src/components/studio/IssuesButton.tsx
|
|
2059
|
-
var
|
|
2122
|
+
var React22 = __toESM(require("react"));
|
|
2060
2123
|
var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"));
|
|
2061
2124
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2062
2125
|
var plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
@@ -2069,7 +2132,7 @@ function IssuesButton({
|
|
|
2069
2132
|
showWhenEmpty = false,
|
|
2070
2133
|
className
|
|
2071
2134
|
}) {
|
|
2072
|
-
const [innerOpen, setInnerOpen] =
|
|
2135
|
+
const [innerOpen, setInnerOpen] = React22.useState(false);
|
|
2073
2136
|
const open = openProp ?? innerOpen;
|
|
2074
2137
|
const setOpen = (next) => {
|
|
2075
2138
|
if (openProp === void 0) setInnerOpen(next);
|
|
@@ -2167,7 +2230,7 @@ function IssuesButton({
|
|
|
2167
2230
|
}
|
|
2168
2231
|
|
|
2169
2232
|
// src/components/studio/InsertPalette.tsx
|
|
2170
|
-
var
|
|
2233
|
+
var React23 = __toESM(require("react"));
|
|
2171
2234
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2172
2235
|
function InsertPalette({
|
|
2173
2236
|
open,
|
|
@@ -2179,11 +2242,11 @@ function InsertPalette({
|
|
|
2179
2242
|
searchPlaceholder = "Search",
|
|
2180
2243
|
renderThumbnail
|
|
2181
2244
|
}) {
|
|
2182
|
-
const [query, setQuery] =
|
|
2183
|
-
const picked =
|
|
2184
|
-
const listRef =
|
|
2185
|
-
const searchRef =
|
|
2186
|
-
|
|
2245
|
+
const [query, setQuery] = React23.useState("");
|
|
2246
|
+
const picked = React23.useRef(false);
|
|
2247
|
+
const listRef = React23.useRef(null);
|
|
2248
|
+
const searchRef = React23.useRef(null);
|
|
2249
|
+
React23.useEffect(() => {
|
|
2187
2250
|
if (!open) return;
|
|
2188
2251
|
setQuery("");
|
|
2189
2252
|
picked.current = false;
|
|
@@ -2315,7 +2378,7 @@ function InsertPalette({
|
|
|
2315
2378
|
}
|
|
2316
2379
|
|
|
2317
2380
|
// src/components/DataPanel.tsx
|
|
2318
|
-
var
|
|
2381
|
+
var React25 = __toESM(require("react"));
|
|
2319
2382
|
var DropdownMenuPrimitive2 = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
2320
2383
|
|
|
2321
2384
|
// src/hooks/useFocusTrap.ts
|
|
@@ -2372,6 +2435,7 @@ function useFocusTrap(options = {}) {
|
|
|
2372
2435
|
if (!container) return;
|
|
2373
2436
|
previousActiveElementRef.current = document.activeElement;
|
|
2374
2437
|
const focusableElements = getFocusableElements(container);
|
|
2438
|
+
let focusFrame = 0;
|
|
2375
2439
|
if (focusableElements.length > 0) {
|
|
2376
2440
|
let elementToFocus = null;
|
|
2377
2441
|
if (initialFocus) {
|
|
@@ -2380,12 +2444,13 @@ function useFocusTrap(options = {}) {
|
|
|
2380
2444
|
if (!elementToFocus) {
|
|
2381
2445
|
elementToFocus = focusableElements[0];
|
|
2382
2446
|
}
|
|
2383
|
-
requestAnimationFrame(() => {
|
|
2447
|
+
focusFrame = requestAnimationFrame(() => {
|
|
2384
2448
|
elementToFocus?.focus({ preventScroll });
|
|
2385
2449
|
});
|
|
2386
2450
|
}
|
|
2387
2451
|
document.addEventListener("keydown", handleKeyDown);
|
|
2388
2452
|
return () => {
|
|
2453
|
+
cancelAnimationFrame(focusFrame);
|
|
2389
2454
|
document.removeEventListener("keydown", handleKeyDown);
|
|
2390
2455
|
const elementToReturn = returnFocusTo ?? previousActiveElementRef.current;
|
|
2391
2456
|
if (elementToReturn && typeof elementToReturn.focus === "function") {
|
|
@@ -2397,14 +2462,14 @@ function useFocusTrap(options = {}) {
|
|
|
2397
2462
|
}
|
|
2398
2463
|
|
|
2399
2464
|
// src/hooks/useEscapeKey.ts
|
|
2400
|
-
var
|
|
2465
|
+
var React24 = __toESM(require("react"));
|
|
2401
2466
|
function useEscapeKey(callback, options) {
|
|
2402
2467
|
const { enabled = true, preventDefault = true, stopPropagation = false } = options ?? {};
|
|
2403
|
-
const callbackRef =
|
|
2404
|
-
|
|
2468
|
+
const callbackRef = React24.useRef(callback);
|
|
2469
|
+
React24.useEffect(() => {
|
|
2405
2470
|
callbackRef.current = callback;
|
|
2406
2471
|
}, [callback]);
|
|
2407
|
-
|
|
2472
|
+
React24.useEffect(() => {
|
|
2408
2473
|
if (!enabled) return;
|
|
2409
2474
|
const handleKeyDown = (event) => {
|
|
2410
2475
|
if (event.key === "Escape") {
|
|
@@ -2430,64 +2495,72 @@ var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
|
2430
2495
|
function layoutViewportWidth() {
|
|
2431
2496
|
return document.documentElement.clientWidth;
|
|
2432
2497
|
}
|
|
2498
|
+
var SSR_VIEWPORT_WIDTH = 1024;
|
|
2499
|
+
var SSR_VIEWPORT_HEIGHT = 768;
|
|
2500
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React25.useLayoutEffect : React25.useEffect;
|
|
2433
2501
|
function isSecondaryMouseButton(e) {
|
|
2434
2502
|
return e.pointerType === "mouse" && e.button !== 0;
|
|
2435
2503
|
}
|
|
2436
2504
|
var DropdownTrigger = DropdownMenuPrimitive2.Trigger;
|
|
2437
2505
|
var DropdownContent = DropdownMenuPrimitive2.Content;
|
|
2438
2506
|
var DropdownLabel = DropdownMenuPrimitive2.Label;
|
|
2439
|
-
var
|
|
2507
|
+
var DropdownRadioGroup = DropdownMenuPrimitive2.RadioGroup;
|
|
2508
|
+
var DropdownRadioItem = DropdownMenuPrimitive2.RadioItem;
|
|
2509
|
+
var DropdownItemIndicator = DropdownMenuPrimitive2.ItemIndicator;
|
|
2510
|
+
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";
|
|
2440
2511
|
var DropdownSeparator = DropdownMenuPrimitive2.Separator;
|
|
2512
|
+
var EMPTY_CONSTRAINTS = {};
|
|
2513
|
+
var EMPTY_CARD_CONFIG = {};
|
|
2514
|
+
var EMPTY_ACTIONS = [];
|
|
2441
2515
|
function useDataPanel(options = {}) {
|
|
2442
2516
|
const {
|
|
2443
2517
|
persistKey,
|
|
2444
2518
|
initialMode = import_data_panel_core.DEFAULT_PANEL_STATE.mode,
|
|
2445
2519
|
initialEdge = import_data_panel_core.DEFAULT_PANEL_STATE.edge,
|
|
2446
2520
|
initialExpanded = import_data_panel_core.DEFAULT_PANEL_STATE.isExpanded,
|
|
2447
|
-
constraints =
|
|
2521
|
+
constraints = EMPTY_CONSTRAINTS
|
|
2448
2522
|
} = options;
|
|
2449
|
-
const resolvedConstraints =
|
|
2450
|
-
|
|
2523
|
+
const resolvedConstraints = React25.useMemo(
|
|
2524
|
+
() => ({ ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints }),
|
|
2525
|
+
[constraints]
|
|
2526
|
+
);
|
|
2527
|
+
const [persistedState] = React25.useState(() => {
|
|
2451
2528
|
if (persistKey && typeof window !== "undefined") {
|
|
2452
2529
|
return (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
2453
2530
|
}
|
|
2454
2531
|
return null;
|
|
2455
2532
|
});
|
|
2456
|
-
const [mode, setMode] =
|
|
2457
|
-
const [edge, setEdge] =
|
|
2458
|
-
const [isExpanded, setIsExpanded] =
|
|
2533
|
+
const [mode, setMode] = React25.useState(persistedState?.mode ?? initialMode);
|
|
2534
|
+
const [edge, setEdge] = React25.useState(persistedState?.edge ?? initialEdge);
|
|
2535
|
+
const [isExpanded, setIsExpanded] = React25.useState(
|
|
2459
2536
|
persistedState?.isExpanded ?? initialExpanded
|
|
2460
2537
|
);
|
|
2461
|
-
const [detachedPosition, setDetachedPosition] =
|
|
2538
|
+
const [detachedPosition, setDetachedPosition] = React25.useState(
|
|
2462
2539
|
persistedState?.detachedPosition ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
2463
2540
|
);
|
|
2464
|
-
const [detachedSize, setDetachedSize] =
|
|
2541
|
+
const [detachedSize, setDetachedSize] = React25.useState(
|
|
2465
2542
|
persistedState?.detachedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize
|
|
2466
2543
|
);
|
|
2467
|
-
const [pinnedSize, setPinnedSize] =
|
|
2544
|
+
const [pinnedSize, setPinnedSize] = React25.useState(
|
|
2468
2545
|
persistedState?.pinnedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize
|
|
2469
2546
|
);
|
|
2470
|
-
const saveTimeoutRef =
|
|
2471
|
-
const debouncedSave =
|
|
2547
|
+
const saveTimeoutRef = React25.useRef(null);
|
|
2548
|
+
const debouncedSave = React25.useCallback(() => {
|
|
2472
2549
|
if (!persistKey) return;
|
|
2473
2550
|
if (saveTimeoutRef.current) {
|
|
2474
2551
|
clearTimeout(saveTimeoutRef.current);
|
|
2475
2552
|
}
|
|
2476
2553
|
saveTimeoutRef.current = setTimeout(() => {
|
|
2477
2554
|
(0, import_data_panel_core.savePanelState)(persistKey, {
|
|
2555
|
+
...import_data_panel_core.DEFAULT_PANEL_STATE,
|
|
2556
|
+
...(0, import_data_panel_core.loadPanelState)(persistKey),
|
|
2478
2557
|
mode,
|
|
2479
|
-
variant: "full",
|
|
2480
2558
|
edge,
|
|
2481
|
-
isExpanded
|
|
2482
|
-
detachedPosition,
|
|
2483
|
-
detachedSize,
|
|
2484
|
-
pinnedSize,
|
|
2485
|
-
cardSnapIndex: 0,
|
|
2486
|
-
tabOffset: 0
|
|
2559
|
+
isExpanded
|
|
2487
2560
|
});
|
|
2488
2561
|
}, 300);
|
|
2489
|
-
}, [persistKey, mode, edge, isExpanded
|
|
2490
|
-
const handleSetMode =
|
|
2562
|
+
}, [persistKey, mode, edge, isExpanded]);
|
|
2563
|
+
const handleSetMode = React25.useCallback(
|
|
2491
2564
|
(newMode) => {
|
|
2492
2565
|
setMode(newMode);
|
|
2493
2566
|
if (newMode === "detached" && typeof window !== "undefined" && detachedPosition.x === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.y) {
|
|
@@ -2498,7 +2571,7 @@ function useDataPanel(options = {}) {
|
|
|
2498
2571
|
},
|
|
2499
2572
|
[detachedPosition, detachedSize]
|
|
2500
2573
|
);
|
|
2501
|
-
const handleSetDetachedPosition =
|
|
2574
|
+
const handleSetDetachedPosition = React25.useCallback(
|
|
2502
2575
|
(position) => {
|
|
2503
2576
|
if (typeof window === "undefined") {
|
|
2504
2577
|
setDetachedPosition(position);
|
|
@@ -2510,13 +2583,13 @@ function useDataPanel(options = {}) {
|
|
|
2510
2583
|
},
|
|
2511
2584
|
[detachedSize]
|
|
2512
2585
|
);
|
|
2513
|
-
const handleSetDetachedSize =
|
|
2586
|
+
const handleSetDetachedSize = React25.useCallback(
|
|
2514
2587
|
(size) => {
|
|
2515
2588
|
setDetachedSize((0, import_data_panel_core.constrainSize)(size, resolvedConstraints));
|
|
2516
2589
|
},
|
|
2517
2590
|
[resolvedConstraints]
|
|
2518
2591
|
);
|
|
2519
|
-
const handleSetPinnedSize =
|
|
2592
|
+
const handleSetPinnedSize = React25.useCallback(
|
|
2520
2593
|
(size) => {
|
|
2521
2594
|
if (typeof window === "undefined") {
|
|
2522
2595
|
setPinnedSize(size);
|
|
@@ -2530,7 +2603,7 @@ function useDataPanel(options = {}) {
|
|
|
2530
2603
|
},
|
|
2531
2604
|
[edge, resolvedConstraints]
|
|
2532
2605
|
);
|
|
2533
|
-
|
|
2606
|
+
React25.useEffect(() => {
|
|
2534
2607
|
debouncedSave();
|
|
2535
2608
|
}, [debouncedSave]);
|
|
2536
2609
|
return {
|
|
@@ -2624,7 +2697,7 @@ var edgeLabels = {
|
|
|
2624
2697
|
top: "Pin to top",
|
|
2625
2698
|
bottom: "Pin to bottom"
|
|
2626
2699
|
};
|
|
2627
|
-
var DataPanelHeader =
|
|
2700
|
+
var DataPanelHeader = React25.forwardRef(
|
|
2628
2701
|
({
|
|
2629
2702
|
title,
|
|
2630
2703
|
subtitle,
|
|
@@ -2707,30 +2780,28 @@ var DataPanelHeader = React24.forwardRef(
|
|
|
2707
2780
|
align: "end",
|
|
2708
2781
|
children: [
|
|
2709
2782
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownLabel, { className: "px-2 py-1.5 text-sm font-semibold", children: "Panel Position" }),
|
|
2710
|
-
|
|
2711
|
-
|
|
2783
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2784
|
+
DropdownRadioGroup,
|
|
2712
2785
|
{
|
|
2713
|
-
|
|
2714
|
-
|
|
2786
|
+
value: mode === "detached" ? "detached" : edge,
|
|
2787
|
+
onValueChange: (value) => {
|
|
2788
|
+
if (value === "detached") {
|
|
2789
|
+
onModeChange?.("detached");
|
|
2790
|
+
return;
|
|
2791
|
+
}
|
|
2715
2792
|
onModeChange?.("pinned");
|
|
2716
|
-
onEdgeChange?.(
|
|
2793
|
+
onEdgeChange?.(value);
|
|
2717
2794
|
},
|
|
2718
2795
|
children: [
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
{
|
|
2729
|
-
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",
|
|
2730
|
-
onSelect: () => onModeChange?.("detached"),
|
|
2731
|
-
children: [
|
|
2732
|
-
"Detach",
|
|
2733
|
-
mode === "detached" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ml-auto text-xs", children: "\u2713" })
|
|
2796
|
+
["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownRadioItem, { value: e, className: menuRadioItemClass, children: [
|
|
2797
|
+
edgeLabels[e],
|
|
2798
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownItemIndicator, { className: "ml-auto text-xs", children: "\u2713" })
|
|
2799
|
+
] }, e)),
|
|
2800
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownSeparator, { className: "-mx-1 my-1 h-px bg-muted" }),
|
|
2801
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownRadioItem, { value: "detached", className: menuRadioItemClass, children: [
|
|
2802
|
+
"Detach",
|
|
2803
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownItemIndicator, { className: "ml-auto text-xs", children: "\u2713" })
|
|
2804
|
+
] })
|
|
2734
2805
|
]
|
|
2735
2806
|
}
|
|
2736
2807
|
)
|
|
@@ -2848,7 +2919,7 @@ function DataPanelCardHeader({
|
|
|
2848
2919
|
}
|
|
2849
2920
|
);
|
|
2850
2921
|
}
|
|
2851
|
-
var DataPanelContent =
|
|
2922
|
+
var DataPanelContent = React25.forwardRef(
|
|
2852
2923
|
({ children, className, "aria-label": ariaLabel = "Panel content" }, ref) => {
|
|
2853
2924
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2854
2925
|
"div",
|
|
@@ -2863,7 +2934,7 @@ var DataPanelContent = React24.forwardRef(
|
|
|
2863
2934
|
}
|
|
2864
2935
|
);
|
|
2865
2936
|
DataPanelContent.displayName = "DataPanelContent";
|
|
2866
|
-
var DataPanelFooter =
|
|
2937
|
+
var DataPanelFooter = React25.forwardRef(
|
|
2867
2938
|
({ actions = [], footerContent, footerActions, className }, ref) => {
|
|
2868
2939
|
if (!footerContent && actions.length === 0 && !footerActions) {
|
|
2869
2940
|
return null;
|
|
@@ -2899,7 +2970,7 @@ var DataPanelFooter = React24.forwardRef(
|
|
|
2899
2970
|
}
|
|
2900
2971
|
);
|
|
2901
2972
|
DataPanelFooter.displayName = "DataPanelFooter";
|
|
2902
|
-
var DataPanelTab =
|
|
2973
|
+
var DataPanelTab = React25.forwardRef(
|
|
2903
2974
|
({
|
|
2904
2975
|
title = "Panel",
|
|
2905
2976
|
subtitle,
|
|
@@ -2925,17 +2996,18 @@ var DataPanelTab = React24.forwardRef(
|
|
|
2925
2996
|
bottom: "left-1/2 rounded-t-lg border-b-0"
|
|
2926
2997
|
}[edge];
|
|
2927
2998
|
const insetStyle = { [edge]: tabInset };
|
|
2928
|
-
const innerRef =
|
|
2929
|
-
const dragRef =
|
|
2999
|
+
const innerRef = React25.useRef(null);
|
|
3000
|
+
const dragRef = React25.useRef({
|
|
2930
3001
|
startX: 0,
|
|
2931
3002
|
startY: 0,
|
|
2932
3003
|
startOffset: 0,
|
|
2933
3004
|
moved: false,
|
|
2934
3005
|
pointerId: -1
|
|
2935
3006
|
});
|
|
2936
|
-
const [dragOffset, setDragOffset] =
|
|
3007
|
+
const [dragOffset, setDragOffset] = React25.useState(null);
|
|
2937
3008
|
const effectiveOffset = dragOffset ?? offset;
|
|
2938
3009
|
const draggable = !!onOffsetChange;
|
|
3010
|
+
const pointerHandledRef = React25.useRef(false);
|
|
2939
3011
|
const tabTransform = (0, import_data_panel_core.getTabTransform)(edge, tabWidth, effectiveOffset);
|
|
2940
3012
|
const tabBounds = (0, import_data_panel_core.getTabBounds)(edge, tabWidth);
|
|
2941
3013
|
const setRefs = (node) => {
|
|
@@ -2979,6 +3051,10 @@ var DataPanelTab = React24.forwardRef(
|
|
|
2979
3051
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
2980
3052
|
}
|
|
2981
3053
|
d.pointerId = -1;
|
|
3054
|
+
pointerHandledRef.current = true;
|
|
3055
|
+
setTimeout(() => {
|
|
3056
|
+
pointerHandledRef.current = false;
|
|
3057
|
+
}, 0);
|
|
2982
3058
|
if (d.moved) {
|
|
2983
3059
|
onOffsetChange?.(dragOffset ?? offset);
|
|
2984
3060
|
} else {
|
|
@@ -3002,7 +3078,7 @@ var DataPanelTab = React24.forwardRef(
|
|
|
3002
3078
|
onClick?.();
|
|
3003
3079
|
}
|
|
3004
3080
|
};
|
|
3005
|
-
|
|
3081
|
+
React25.useEffect(() => {
|
|
3006
3082
|
if (!onOffsetChange || dragOffset !== null) return;
|
|
3007
3083
|
const reclamp = () => {
|
|
3008
3084
|
const clamped = (0, import_data_panel_core.constrainTabOffset)(
|
|
@@ -3050,7 +3126,13 @@ var DataPanelTab = React24.forwardRef(
|
|
|
3050
3126
|
type: "button",
|
|
3051
3127
|
"aria-label": `Expand ${title} panel`,
|
|
3052
3128
|
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",
|
|
3053
|
-
onClick:
|
|
3129
|
+
onClick: () => {
|
|
3130
|
+
if (pointerHandledRef.current) {
|
|
3131
|
+
pointerHandledRef.current = false;
|
|
3132
|
+
return;
|
|
3133
|
+
}
|
|
3134
|
+
onClick?.();
|
|
3135
|
+
},
|
|
3054
3136
|
onKeyDown: handleExpandKeyDown,
|
|
3055
3137
|
children: [
|
|
3056
3138
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-sm font-semibold", children: title }),
|
|
@@ -3091,7 +3173,7 @@ function ResizeHandles({
|
|
|
3091
3173
|
onPinnedSizeChange,
|
|
3092
3174
|
constraints
|
|
3093
3175
|
}) {
|
|
3094
|
-
const handleDetachedKeyDown =
|
|
3176
|
+
const handleDetachedKeyDown = React25.useCallback(
|
|
3095
3177
|
(e, handle) => {
|
|
3096
3178
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
3097
3179
|
let width = detachedSize.width;
|
|
@@ -3154,7 +3236,7 @@ function ResizeHandles({
|
|
|
3154
3236
|
},
|
|
3155
3237
|
[detachedPosition, detachedSize, constraints, onDetachedResize]
|
|
3156
3238
|
);
|
|
3157
|
-
const handlePinnedKeyDown =
|
|
3239
|
+
const handlePinnedKeyDown = React25.useCallback(
|
|
3158
3240
|
(e) => {
|
|
3159
3241
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
3160
3242
|
let newSize = pinnedSize;
|
|
@@ -3271,14 +3353,14 @@ function ResizeHandles({
|
|
|
3271
3353
|
}
|
|
3272
3354
|
);
|
|
3273
3355
|
}
|
|
3274
|
-
var DataPanel =
|
|
3356
|
+
var DataPanel = React25.forwardRef(
|
|
3275
3357
|
({
|
|
3276
3358
|
open: controlledOpen,
|
|
3277
3359
|
onOpenChange,
|
|
3278
3360
|
mode: controlledMode,
|
|
3279
3361
|
onModeChange,
|
|
3280
3362
|
variant: controlledVariant,
|
|
3281
|
-
cardConfig =
|
|
3363
|
+
cardConfig = EMPTY_CARD_CONFIG,
|
|
3282
3364
|
edge: controlledEdge,
|
|
3283
3365
|
onEdgeChange,
|
|
3284
3366
|
expanded: controlledExpanded,
|
|
@@ -3286,8 +3368,8 @@ var DataPanel = React24.forwardRef(
|
|
|
3286
3368
|
title,
|
|
3287
3369
|
subtitle,
|
|
3288
3370
|
children,
|
|
3289
|
-
actions =
|
|
3290
|
-
constraints =
|
|
3371
|
+
actions = EMPTY_ACTIONS,
|
|
3372
|
+
constraints = EMPTY_CONSTRAINTS,
|
|
3291
3373
|
tabWidth = import_data_panel_core.DEFAULT_TAB_WIDTH,
|
|
3292
3374
|
tabInset = 0,
|
|
3293
3375
|
disableClose = false,
|
|
@@ -3303,39 +3385,35 @@ var DataPanel = React24.forwardRef(
|
|
|
3303
3385
|
footerActions,
|
|
3304
3386
|
className
|
|
3305
3387
|
}, ref) => {
|
|
3306
|
-
const resolvedConstraints =
|
|
3388
|
+
const resolvedConstraints = React25.useMemo(
|
|
3307
3389
|
() => ({ ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints }),
|
|
3308
3390
|
[constraints]
|
|
3309
3391
|
);
|
|
3310
|
-
const resolvedCardConfig =
|
|
3392
|
+
const resolvedCardConfig = React25.useMemo(
|
|
3311
3393
|
() => ({ ...import_data_panel_core.DEFAULT_CARD_CONFIG, ...cardConfig }),
|
|
3312
3394
|
[cardConfig]
|
|
3313
3395
|
);
|
|
3314
|
-
const panelId =
|
|
3396
|
+
const panelId = React25.useId();
|
|
3315
3397
|
const titleId = `${panelId}-title`;
|
|
3316
|
-
const [internalOpen, setInternalOpen] =
|
|
3317
|
-
const [internalMode, setInternalMode] =
|
|
3318
|
-
const [internalVariant, setInternalVariant] =
|
|
3398
|
+
const [internalOpen, setInternalOpen] = React25.useState(true);
|
|
3399
|
+
const [internalMode, setInternalMode] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.mode);
|
|
3400
|
+
const [internalVariant, setInternalVariant] = React25.useState(
|
|
3319
3401
|
import_data_panel_core.DEFAULT_PANEL_STATE.variant
|
|
3320
3402
|
);
|
|
3321
|
-
const [internalEdge, setInternalEdge] =
|
|
3322
|
-
const [internalExpanded, setInternalExpanded] =
|
|
3403
|
+
const [internalEdge, setInternalEdge] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.edge);
|
|
3404
|
+
const [internalExpanded, setInternalExpanded] = React25.useState(
|
|
3323
3405
|
import_data_panel_core.DEFAULT_PANEL_STATE.isExpanded
|
|
3324
3406
|
);
|
|
3325
|
-
const [detachedPosition, setDetachedPosition] =
|
|
3407
|
+
const [detachedPosition, setDetachedPosition] = React25.useState(
|
|
3326
3408
|
import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
3327
3409
|
);
|
|
3328
|
-
const [detachedSize, setDetachedSize] =
|
|
3329
|
-
const [pinnedSize, setPinnedSize] =
|
|
3330
|
-
const [tabOffset, setTabOffset] =
|
|
3331
|
-
const [viewportWidth, setViewportWidth] =
|
|
3332
|
-
|
|
3333
|
-
);
|
|
3334
|
-
const [viewportHeight, setViewportHeight] = React24.useState(
|
|
3335
|
-
typeof window !== "undefined" ? window.innerHeight : 768
|
|
3336
|
-
);
|
|
3410
|
+
const [detachedSize, setDetachedSize] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize);
|
|
3411
|
+
const [pinnedSize, setPinnedSize] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize);
|
|
3412
|
+
const [tabOffset, setTabOffset] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.tabOffset);
|
|
3413
|
+
const [viewportWidth, setViewportWidth] = React25.useState(SSR_VIEWPORT_WIDTH);
|
|
3414
|
+
const [viewportHeight, setViewportHeight] = React25.useState(SSR_VIEWPORT_HEIGHT);
|
|
3337
3415
|
const isMobile = viewportWidth < 640;
|
|
3338
|
-
const cardDefaultLeftOffset =
|
|
3416
|
+
const cardDefaultLeftOffset = React25.useCallback(
|
|
3339
3417
|
(width) => {
|
|
3340
3418
|
const margin = resolvedCardConfig.horizontalMargin;
|
|
3341
3419
|
if (resolvedCardConfig.align === "left") return margin;
|
|
@@ -3346,45 +3424,45 @@ var DataPanel = React24.forwardRef(
|
|
|
3346
3424
|
},
|
|
3347
3425
|
[viewportWidth, resolvedCardConfig.align, resolvedCardConfig.horizontalMargin]
|
|
3348
3426
|
);
|
|
3349
|
-
const [cardHorizontalPosition, setCardHorizontalPosition] =
|
|
3350
|
-
const [cardExpandedHeight, setCardExpandedHeight] =
|
|
3351
|
-
const [cardWidth, setCardWidth] =
|
|
3352
|
-
const [cardDragCurrentHeight, setCardDragCurrentHeight] =
|
|
3353
|
-
const [isCardVerticalDragging, setIsCardVerticalDragging] =
|
|
3354
|
-
const [isCardHorizontalDragging, setIsCardHorizontalDragging] =
|
|
3355
|
-
const [isCardHeightTransitioning, setIsCardHeightTransitioning] =
|
|
3356
|
-
const [isCardWidthResizing, setIsCardWidthResizing] =
|
|
3357
|
-
const [isCardTopResizing, setIsCardTopResizing] =
|
|
3358
|
-
const [isDragging, setIsDragging] =
|
|
3359
|
-
const [isResizing, setIsResizing] =
|
|
3360
|
-
const [snapPreview, setSnapPreview] =
|
|
3361
|
-
const [isPinnedDragging, setIsPinnedDragging] =
|
|
3362
|
-
const [pullOffset, setPullOffset] =
|
|
3363
|
-
const dragStateRef =
|
|
3427
|
+
const [cardHorizontalPosition, setCardHorizontalPosition] = React25.useState(0);
|
|
3428
|
+
const [cardExpandedHeight, setCardExpandedHeight] = React25.useState(0);
|
|
3429
|
+
const [cardWidth, setCardWidth] = React25.useState(null);
|
|
3430
|
+
const [cardDragCurrentHeight, setCardDragCurrentHeight] = React25.useState(import_data_panel_core.CARD_HEADER_HEIGHT);
|
|
3431
|
+
const [isCardVerticalDragging, setIsCardVerticalDragging] = React25.useState(false);
|
|
3432
|
+
const [isCardHorizontalDragging, setIsCardHorizontalDragging] = React25.useState(false);
|
|
3433
|
+
const [isCardHeightTransitioning, setIsCardHeightTransitioning] = React25.useState(false);
|
|
3434
|
+
const [isCardWidthResizing, setIsCardWidthResizing] = React25.useState(false);
|
|
3435
|
+
const [isCardTopResizing, setIsCardTopResizing] = React25.useState(false);
|
|
3436
|
+
const [isDragging, setIsDragging] = React25.useState(false);
|
|
3437
|
+
const [isResizing, setIsResizing] = React25.useState(false);
|
|
3438
|
+
const [snapPreview, setSnapPreview] = React25.useState(null);
|
|
3439
|
+
const [isPinnedDragging, setIsPinnedDragging] = React25.useState(false);
|
|
3440
|
+
const [pullOffset, setPullOffset] = React25.useState(0);
|
|
3441
|
+
const dragStateRef = React25.useRef({
|
|
3364
3442
|
startPosition: { x: 0, y: 0 },
|
|
3365
3443
|
startPanelPosition: { x: 0, y: 0 }
|
|
3366
3444
|
});
|
|
3367
|
-
const pinnedDragStateRef =
|
|
3445
|
+
const pinnedDragStateRef = React25.useRef({
|
|
3368
3446
|
startPosition: { x: 0, y: 0 },
|
|
3369
3447
|
hasDetached: false
|
|
3370
3448
|
});
|
|
3371
|
-
const resizeStateRef =
|
|
3449
|
+
const resizeStateRef = React25.useRef({
|
|
3372
3450
|
handle: null,
|
|
3373
3451
|
startPosition: { x: 0, y: 0 },
|
|
3374
3452
|
startSize: { width: 0, height: 0 },
|
|
3375
3453
|
startPanelPosition: { x: 0, y: 0 }
|
|
3376
3454
|
});
|
|
3377
|
-
const cardDragStateRef =
|
|
3455
|
+
const cardDragStateRef = React25.useRef({
|
|
3378
3456
|
startY: 0,
|
|
3379
3457
|
startX: 0,
|
|
3380
3458
|
startTime: 0,
|
|
3381
3459
|
startExpanded: false,
|
|
3382
3460
|
startHorizontalPosition: 0
|
|
3383
3461
|
});
|
|
3384
|
-
const cardCurrentHeightRef =
|
|
3385
|
-
const cardTopResizeStartRef =
|
|
3386
|
-
const cardHeightUserSetRef =
|
|
3387
|
-
const cardWidthResizeStateRef =
|
|
3462
|
+
const cardCurrentHeightRef = React25.useRef(import_data_panel_core.CARD_HEADER_HEIGHT);
|
|
3463
|
+
const cardTopResizeStartRef = React25.useRef({ startY: 0, startHeight: 0 });
|
|
3464
|
+
const cardHeightUserSetRef = React25.useRef(false);
|
|
3465
|
+
const cardWidthResizeStateRef = React25.useRef({
|
|
3388
3466
|
handle: null,
|
|
3389
3467
|
startX: 0,
|
|
3390
3468
|
startWidth: 0,
|
|
@@ -3399,9 +3477,9 @@ var DataPanel = React24.forwardRef(
|
|
|
3399
3477
|
const resizeRight = !disableResize && (variant === "full" && (mode === "detached" || edge === "left") || variant === "card" && isExpanded && !isMobile);
|
|
3400
3478
|
const resizeBottom = !disableResize && variant === "full" && (mode === "detached" || edge === "top");
|
|
3401
3479
|
const hasFooter = !!(footerContent || actions.length > 0 || footerActions);
|
|
3402
|
-
const saveTimeoutRef =
|
|
3403
|
-
const isMountedRef =
|
|
3404
|
-
|
|
3480
|
+
const saveTimeoutRef = React25.useRef(null);
|
|
3481
|
+
const isMountedRef = React25.useRef(true);
|
|
3482
|
+
React25.useEffect(() => {
|
|
3405
3483
|
isMountedRef.current = true;
|
|
3406
3484
|
return () => {
|
|
3407
3485
|
isMountedRef.current = false;
|
|
@@ -3412,7 +3490,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3412
3490
|
}
|
|
3413
3491
|
};
|
|
3414
3492
|
}, []);
|
|
3415
|
-
const debouncedSave =
|
|
3493
|
+
const debouncedSave = React25.useCallback(() => {
|
|
3416
3494
|
if (!persistKey) return;
|
|
3417
3495
|
if (saveTimeoutRef.current) {
|
|
3418
3496
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -3441,12 +3519,12 @@ var DataPanel = React24.forwardRef(
|
|
|
3441
3519
|
pinnedSize,
|
|
3442
3520
|
tabOffset
|
|
3443
3521
|
]);
|
|
3444
|
-
|
|
3522
|
+
React25.useEffect(() => {
|
|
3445
3523
|
debouncedSave();
|
|
3446
3524
|
}, [debouncedSave]);
|
|
3447
|
-
const hasLoadedRef =
|
|
3448
|
-
const hasPersistedPositionRef =
|
|
3449
|
-
|
|
3525
|
+
const hasLoadedRef = React25.useRef(false);
|
|
3526
|
+
const hasPersistedPositionRef = React25.useRef(false);
|
|
3527
|
+
React25.useEffect(() => {
|
|
3450
3528
|
if (!persistKey || hasLoadedRef.current) return;
|
|
3451
3529
|
hasLoadedRef.current = true;
|
|
3452
3530
|
const persisted = (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
@@ -3475,7 +3553,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3475
3553
|
if (persisted.tabOffset !== void 0) setTabOffset(persisted.tabOffset);
|
|
3476
3554
|
}
|
|
3477
3555
|
}, [persistKey, controlledMode, controlledVariant, controlledEdge, controlledExpanded]);
|
|
3478
|
-
|
|
3556
|
+
React25.useEffect(() => {
|
|
3479
3557
|
if (mode === "detached" && !hasPersistedPositionRef.current && detachedPosition.x === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.y) {
|
|
3480
3558
|
setDetachedPosition(
|
|
3481
3559
|
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, layoutViewportWidth(), window.innerHeight)
|
|
@@ -3498,8 +3576,8 @@ var DataPanel = React24.forwardRef(
|
|
|
3498
3576
|
},
|
|
3499
3577
|
{ enabled: isDialog, preventDefault: false }
|
|
3500
3578
|
);
|
|
3501
|
-
const panelElRef =
|
|
3502
|
-
const tabRef =
|
|
3579
|
+
const panelElRef = React25.useRef(null);
|
|
3580
|
+
const tabRef = React25.useRef(null);
|
|
3503
3581
|
const setPanelRef = (node) => {
|
|
3504
3582
|
panelElRef.current = node;
|
|
3505
3583
|
focusTrapRef.current = node;
|
|
@@ -3509,7 +3587,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3509
3587
|
ref.current = node;
|
|
3510
3588
|
}
|
|
3511
3589
|
};
|
|
3512
|
-
const handleModeChange =
|
|
3590
|
+
const handleModeChange = React25.useCallback(
|
|
3513
3591
|
(newMode) => {
|
|
3514
3592
|
if (controlledMode === void 0) {
|
|
3515
3593
|
setInternalMode(newMode);
|
|
@@ -3518,7 +3596,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3518
3596
|
},
|
|
3519
3597
|
[controlledMode, onModeChange]
|
|
3520
3598
|
);
|
|
3521
|
-
const handleEdgeChange =
|
|
3599
|
+
const handleEdgeChange = React25.useCallback(
|
|
3522
3600
|
(newEdge) => {
|
|
3523
3601
|
if (controlledEdge === void 0) {
|
|
3524
3602
|
setInternalEdge(newEdge);
|
|
@@ -3527,8 +3605,8 @@ var DataPanel = React24.forwardRef(
|
|
|
3527
3605
|
},
|
|
3528
3606
|
[controlledEdge, onEdgeChange]
|
|
3529
3607
|
);
|
|
3530
|
-
const restoreFocusRef =
|
|
3531
|
-
const handleExpandedChange =
|
|
3608
|
+
const restoreFocusRef = React25.useRef(false);
|
|
3609
|
+
const handleExpandedChange = React25.useCallback(
|
|
3532
3610
|
(newExpanded) => {
|
|
3533
3611
|
const active = typeof document !== "undefined" ? document.activeElement : null;
|
|
3534
3612
|
restoreFocusRef.current = newExpanded !== isExpanded && !!active && active !== document.body;
|
|
@@ -3539,7 +3617,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3539
3617
|
},
|
|
3540
3618
|
[controlledExpanded, onExpandedChange, isExpanded]
|
|
3541
3619
|
);
|
|
3542
|
-
|
|
3620
|
+
React25.useEffect(() => {
|
|
3543
3621
|
if (!restoreFocusRef.current) return;
|
|
3544
3622
|
restoreFocusRef.current = false;
|
|
3545
3623
|
const active = document.activeElement;
|
|
@@ -3572,7 +3650,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3572
3650
|
document.body.style.userSelect = "none";
|
|
3573
3651
|
}
|
|
3574
3652
|
};
|
|
3575
|
-
const handleDragMove =
|
|
3653
|
+
const handleDragMove = React25.useCallback(
|
|
3576
3654
|
(e) => {
|
|
3577
3655
|
if (!isDragging) return;
|
|
3578
3656
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3599,7 +3677,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3599
3677
|
},
|
|
3600
3678
|
[isDragging, detachedSize, snapThreshold]
|
|
3601
3679
|
);
|
|
3602
|
-
const handleDragEnd =
|
|
3680
|
+
const handleDragEnd = React25.useCallback(() => {
|
|
3603
3681
|
if (!isDragging) return;
|
|
3604
3682
|
setIsDragging(false);
|
|
3605
3683
|
document.body.style.cursor = "";
|
|
@@ -3610,7 +3688,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3610
3688
|
setSnapPreview(null);
|
|
3611
3689
|
}
|
|
3612
3690
|
}, [isDragging, snapPreview, handleModeChange, handleEdgeChange]);
|
|
3613
|
-
const handlePinnedDragMove =
|
|
3691
|
+
const handlePinnedDragMove = React25.useCallback(
|
|
3614
3692
|
(e) => {
|
|
3615
3693
|
if (!isPinnedDragging) return;
|
|
3616
3694
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3646,7 +3724,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3646
3724
|
},
|
|
3647
3725
|
[isPinnedDragging, edge, detachThreshold, pinnedSize, detachedSize, handleModeChange]
|
|
3648
3726
|
);
|
|
3649
|
-
const handlePinnedDragEnd =
|
|
3727
|
+
const handlePinnedDragEnd = React25.useCallback(() => {
|
|
3650
3728
|
if (!isPinnedDragging) return;
|
|
3651
3729
|
setIsPinnedDragging(false);
|
|
3652
3730
|
setPullOffset(0);
|
|
@@ -3668,7 +3746,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3668
3746
|
document.body.style.cursor = (0, import_data_panel_core.getResizeCursor)(handle);
|
|
3669
3747
|
document.body.style.userSelect = "none";
|
|
3670
3748
|
};
|
|
3671
|
-
const handleResizeMove =
|
|
3749
|
+
const handleResizeMove = React25.useCallback(
|
|
3672
3750
|
(e) => {
|
|
3673
3751
|
if (!isResizing || !resizeStateRef.current.handle) return;
|
|
3674
3752
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3709,7 +3787,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3709
3787
|
},
|
|
3710
3788
|
[isResizing, mode, edge, resolvedConstraints]
|
|
3711
3789
|
);
|
|
3712
|
-
const handleResizeEnd =
|
|
3790
|
+
const handleResizeEnd = React25.useCallback(() => {
|
|
3713
3791
|
if (!isResizing) return;
|
|
3714
3792
|
setIsResizing(false);
|
|
3715
3793
|
resizeStateRef.current.handle = null;
|
|
@@ -3741,7 +3819,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3741
3819
|
}
|
|
3742
3820
|
document.body.style.userSelect = "none";
|
|
3743
3821
|
};
|
|
3744
|
-
const handleCardPointerMove =
|
|
3822
|
+
const handleCardPointerMove = React25.useCallback(
|
|
3745
3823
|
(e) => {
|
|
3746
3824
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
3747
3825
|
if (isCardVerticalDragging) {
|
|
@@ -3781,7 +3859,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3781
3859
|
resolvedCardConfig.maxWidth
|
|
3782
3860
|
]
|
|
3783
3861
|
);
|
|
3784
|
-
const handleCardPointerUp =
|
|
3862
|
+
const handleCardPointerUp = React25.useCallback(
|
|
3785
3863
|
(e) => {
|
|
3786
3864
|
const endTime = Date.now();
|
|
3787
3865
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3839,7 +3917,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3839
3917
|
document.body.style.cursor = "ns-resize";
|
|
3840
3918
|
document.body.style.userSelect = "none";
|
|
3841
3919
|
};
|
|
3842
|
-
const handleCardResizeMove =
|
|
3920
|
+
const handleCardResizeMove = React25.useCallback(
|
|
3843
3921
|
(e) => {
|
|
3844
3922
|
if (!isCardTopResizing) return;
|
|
3845
3923
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3853,7 +3931,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3853
3931
|
},
|
|
3854
3932
|
[isCardTopResizing, viewportHeight]
|
|
3855
3933
|
);
|
|
3856
|
-
const handleCardResizeEnd =
|
|
3934
|
+
const handleCardResizeEnd = React25.useCallback(() => {
|
|
3857
3935
|
if (!isCardTopResizing) return;
|
|
3858
3936
|
setIsCardTopResizing(false);
|
|
3859
3937
|
document.body.style.cursor = "";
|
|
@@ -3882,7 +3960,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3882
3960
|
document.body.style.cursor = "ew-resize";
|
|
3883
3961
|
document.body.style.userSelect = "none";
|
|
3884
3962
|
};
|
|
3885
|
-
const handleCardWidthResizeMove =
|
|
3963
|
+
const handleCardWidthResizeMove = React25.useCallback(
|
|
3886
3964
|
(e) => {
|
|
3887
3965
|
const st = cardWidthResizeStateRef.current;
|
|
3888
3966
|
if (!isCardWidthResizing || !st.handle) return;
|
|
@@ -3924,7 +4002,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3924
4002
|
resolvedCardConfig.maxWidth
|
|
3925
4003
|
]
|
|
3926
4004
|
);
|
|
3927
|
-
const handleCardWidthResizeEnd =
|
|
4005
|
+
const handleCardWidthResizeEnd = React25.useCallback(() => {
|
|
3928
4006
|
if (!isCardWidthResizing) return;
|
|
3929
4007
|
setIsCardWidthResizing(false);
|
|
3930
4008
|
cardWidthResizeStateRef.current.handle = null;
|
|
@@ -3975,7 +4053,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3975
4053
|
if (kind === "width-left") setCardHorizontalPosition((p) => p - appliedDelta);
|
|
3976
4054
|
debouncedSave();
|
|
3977
4055
|
};
|
|
3978
|
-
|
|
4056
|
+
React25.useEffect(() => {
|
|
3979
4057
|
if (isDragging) {
|
|
3980
4058
|
window.addEventListener("pointermove", handleDragMove);
|
|
3981
4059
|
window.addEventListener("pointerup", handleDragEnd);
|
|
@@ -3987,7 +4065,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3987
4065
|
};
|
|
3988
4066
|
}
|
|
3989
4067
|
}, [isDragging, handleDragMove, handleDragEnd]);
|
|
3990
|
-
|
|
4068
|
+
React25.useEffect(() => {
|
|
3991
4069
|
if (isPinnedDragging) {
|
|
3992
4070
|
window.addEventListener("pointermove", handlePinnedDragMove);
|
|
3993
4071
|
window.addEventListener("pointerup", handlePinnedDragEnd);
|
|
@@ -3999,7 +4077,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3999
4077
|
};
|
|
4000
4078
|
}
|
|
4001
4079
|
}, [isPinnedDragging, handlePinnedDragMove, handlePinnedDragEnd]);
|
|
4002
|
-
|
|
4080
|
+
React25.useEffect(() => {
|
|
4003
4081
|
if (isResizing) {
|
|
4004
4082
|
window.addEventListener("pointermove", handleResizeMove);
|
|
4005
4083
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
@@ -4011,7 +4089,7 @@ var DataPanel = React24.forwardRef(
|
|
|
4011
4089
|
};
|
|
4012
4090
|
}
|
|
4013
4091
|
}, [isResizing, handleResizeMove, handleResizeEnd]);
|
|
4014
|
-
|
|
4092
|
+
React25.useEffect(() => {
|
|
4015
4093
|
if (isCardVerticalDragging || isCardHorizontalDragging) {
|
|
4016
4094
|
window.addEventListener("pointermove", handleCardPointerMove);
|
|
4017
4095
|
window.addEventListener("pointerup", handleCardPointerUp);
|
|
@@ -4028,7 +4106,7 @@ var DataPanel = React24.forwardRef(
|
|
|
4028
4106
|
handleCardPointerMove,
|
|
4029
4107
|
handleCardPointerUp
|
|
4030
4108
|
]);
|
|
4031
|
-
|
|
4109
|
+
React25.useEffect(() => {
|
|
4032
4110
|
if (isCardTopResizing) {
|
|
4033
4111
|
window.addEventListener("pointermove", handleCardResizeMove);
|
|
4034
4112
|
window.addEventListener("pointerup", handleCardResizeEnd);
|
|
@@ -4040,7 +4118,7 @@ var DataPanel = React24.forwardRef(
|
|
|
4040
4118
|
};
|
|
4041
4119
|
}
|
|
4042
4120
|
}, [isCardTopResizing, handleCardResizeMove, handleCardResizeEnd]);
|
|
4043
|
-
|
|
4121
|
+
React25.useEffect(() => {
|
|
4044
4122
|
if (isCardWidthResizing) {
|
|
4045
4123
|
window.addEventListener("pointermove", handleCardWidthResizeMove);
|
|
4046
4124
|
window.addEventListener("pointerup", handleCardWidthResizeEnd);
|
|
@@ -4052,10 +4130,10 @@ var DataPanel = React24.forwardRef(
|
|
|
4052
4130
|
};
|
|
4053
4131
|
}
|
|
4054
4132
|
}, [isCardWidthResizing, handleCardWidthResizeMove, handleCardWidthResizeEnd]);
|
|
4055
|
-
const resizeStateLatestRef =
|
|
4133
|
+
const resizeStateLatestRef = React25.useRef({ mode, detachedSize });
|
|
4056
4134
|
resizeStateLatestRef.current = { mode, detachedSize };
|
|
4057
4135
|
const expandedRatio = resolvedCardConfig.expandedRatio;
|
|
4058
|
-
|
|
4136
|
+
useIsomorphicLayoutEffect(() => {
|
|
4059
4137
|
const onResize = () => {
|
|
4060
4138
|
const vh = window.innerHeight;
|
|
4061
4139
|
setViewportWidth(layoutViewportWidth());
|
|
@@ -4077,19 +4155,19 @@ var DataPanel = React24.forwardRef(
|
|
|
4077
4155
|
window.addEventListener("resize", onWindowResize);
|
|
4078
4156
|
return () => window.removeEventListener("resize", onWindowResize);
|
|
4079
4157
|
}, [expandedRatio]);
|
|
4080
|
-
|
|
4158
|
+
React25.useEffect(() => {
|
|
4081
4159
|
if (isMobile && variant === "card") {
|
|
4082
4160
|
setCardHorizontalPosition(0);
|
|
4083
4161
|
setCardWidth(null);
|
|
4084
4162
|
}
|
|
4085
4163
|
}, [isMobile, variant]);
|
|
4086
|
-
|
|
4164
|
+
React25.useEffect(() => {
|
|
4087
4165
|
if (isCardHeightTransitioning) {
|
|
4088
4166
|
const t = setTimeout(() => setIsCardHeightTransitioning(false), 350);
|
|
4089
4167
|
return () => clearTimeout(t);
|
|
4090
4168
|
}
|
|
4091
4169
|
}, [isCardHeightTransitioning]);
|
|
4092
|
-
const panelStyles =
|
|
4170
|
+
const panelStyles = React25.useMemo(() => {
|
|
4093
4171
|
if (variant === "card") {
|
|
4094
4172
|
const defaultCardWidth = Math.min(
|
|
4095
4173
|
viewportWidth - resolvedCardConfig.horizontalMargin * 2,
|
|
@@ -4209,7 +4287,6 @@ var DataPanel = React24.forwardRef(
|
|
|
4209
4287
|
"aria-modal": isDialog ? "true" : void 0,
|
|
4210
4288
|
"aria-labelledby": title ? titleId : void 0,
|
|
4211
4289
|
"aria-label": !title ? "Side panel" : void 0,
|
|
4212
|
-
"aria-expanded": variant === "card" ? isExpanded : void 0,
|
|
4213
4290
|
onPointerDown: variant === "full" ? handleDragStart : void 0,
|
|
4214
4291
|
children: [
|
|
4215
4292
|
variant === "card" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -4355,7 +4432,7 @@ var DataPanel = React24.forwardRef(
|
|
|
4355
4432
|
DataPanel.displayName = "DataPanel";
|
|
4356
4433
|
|
|
4357
4434
|
// src/components/Skeleton.tsx
|
|
4358
|
-
var
|
|
4435
|
+
var React26 = __toESM(require("react"));
|
|
4359
4436
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
4360
4437
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4361
4438
|
var skeletonVariants = (0, import_class_variance_authority6.cva)("rounded-md bg-muted", {
|
|
@@ -4373,7 +4450,7 @@ var skeletonVariants = (0, import_class_variance_authority6.cva)("rounded-md bg-
|
|
|
4373
4450
|
variant: "default"
|
|
4374
4451
|
}
|
|
4375
4452
|
});
|
|
4376
|
-
var Skeleton =
|
|
4453
|
+
var Skeleton = React26.forwardRef(
|
|
4377
4454
|
({ className, variant, animation = "pulse", ...props }, ref) => {
|
|
4378
4455
|
const animationClass = animation === "pulse" ? "animate-pulse" : animation === "shimmer" ? "animate-shimmer" : "";
|
|
4379
4456
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
@@ -4389,7 +4466,7 @@ var Skeleton = React25.forwardRef(
|
|
|
4389
4466
|
Skeleton.displayName = "Skeleton";
|
|
4390
4467
|
|
|
4391
4468
|
// src/components/Spinner.tsx
|
|
4392
|
-
var
|
|
4469
|
+
var React27 = __toESM(require("react"));
|
|
4393
4470
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
4394
4471
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4395
4472
|
var spinnerVariants = (0, import_class_variance_authority7.cva)("animate-spin text-current", {
|
|
@@ -4405,7 +4482,7 @@ var spinnerVariants = (0, import_class_variance_authority7.cva)("animate-spin te
|
|
|
4405
4482
|
size: "md"
|
|
4406
4483
|
}
|
|
4407
4484
|
});
|
|
4408
|
-
var Spinner =
|
|
4485
|
+
var Spinner = React27.forwardRef(
|
|
4409
4486
|
({ className, size, label = "Loading...", ...props }, ref) => {
|
|
4410
4487
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4411
4488
|
"svg",
|
|
@@ -4447,7 +4524,7 @@ var Spinner = React26.forwardRef(
|
|
|
4447
4524
|
Spinner.displayName = "Spinner";
|
|
4448
4525
|
|
|
4449
4526
|
// src/components/LoadingLogo.tsx
|
|
4450
|
-
var
|
|
4527
|
+
var React28 = __toESM(require("react"));
|
|
4451
4528
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4452
4529
|
var logoPaths = [
|
|
4453
4530
|
"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",
|
|
@@ -4470,7 +4547,7 @@ var colors = {
|
|
|
4470
4547
|
stroke: "#ffffff"
|
|
4471
4548
|
}
|
|
4472
4549
|
};
|
|
4473
|
-
var LoadingLogo =
|
|
4550
|
+
var LoadingLogo = React28.forwardRef(
|
|
4474
4551
|
({ width = 40, height = 40, loading = false, variant = "dark", className, ...props }, ref) => {
|
|
4475
4552
|
const currentColors = colors[variant];
|
|
4476
4553
|
const fillColor = loading ? currentColors.fillLoading : currentColors.fill;
|
|
@@ -4519,7 +4596,7 @@ var LoadingLogo = React27.forwardRef(
|
|
|
4519
4596
|
LoadingLogo.displayName = "LoadingLogo";
|
|
4520
4597
|
|
|
4521
4598
|
// src/components/ProgressBar.tsx
|
|
4522
|
-
var
|
|
4599
|
+
var React29 = __toESM(require("react"));
|
|
4523
4600
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
4524
4601
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4525
4602
|
var progressBarVariants = (0, import_class_variance_authority8.cva)("w-full overflow-hidden rounded-full bg-muted", {
|
|
@@ -4547,7 +4624,7 @@ var progressFillVariants = (0, import_class_variance_authority8.cva)("h-full rou
|
|
|
4547
4624
|
variant: "default"
|
|
4548
4625
|
}
|
|
4549
4626
|
});
|
|
4550
|
-
var ProgressBar =
|
|
4627
|
+
var ProgressBar = React29.forwardRef(
|
|
4551
4628
|
({ className, size, variant, value, max = 100, label = "Progress", showValue = false, ...props }, ref) => {
|
|
4552
4629
|
const isIndeterminate = value === void 0;
|
|
4553
4630
|
const clampedValue = isIndeterminate ? 0 : Math.min(Math.max(0, value), max);
|
|
@@ -4586,11 +4663,11 @@ var ProgressBar = React28.forwardRef(
|
|
|
4586
4663
|
ProgressBar.displayName = "ProgressBar";
|
|
4587
4664
|
|
|
4588
4665
|
// src/components/LoadingOverlay.tsx
|
|
4589
|
-
var
|
|
4666
|
+
var React30 = __toESM(require("react"));
|
|
4590
4667
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4591
4668
|
var spinnerSizeMap = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
|
|
4592
4669
|
var logoSizeMap = { sm: 32, md: 40, lg: 56, xl: 80 };
|
|
4593
|
-
var LoadingOverlay =
|
|
4670
|
+
var LoadingOverlay = React30.forwardRef(
|
|
4594
4671
|
({
|
|
4595
4672
|
loading = true,
|
|
4596
4673
|
variant = "spinner",
|
|
@@ -4605,8 +4682,8 @@ var LoadingOverlay = React29.forwardRef(
|
|
|
4605
4682
|
children,
|
|
4606
4683
|
...props
|
|
4607
4684
|
}, ref) => {
|
|
4608
|
-
const [visible, setVisible] =
|
|
4609
|
-
|
|
4685
|
+
const [visible, setVisible] = React30.useState(delay === 0 && loading);
|
|
4686
|
+
React30.useEffect(() => {
|
|
4610
4687
|
if (!loading) {
|
|
4611
4688
|
setVisible(false);
|
|
4612
4689
|
return;
|
|
@@ -4618,8 +4695,14 @@ var LoadingOverlay = React29.forwardRef(
|
|
|
4618
4695
|
const timer = setTimeout(() => setVisible(true), delay);
|
|
4619
4696
|
return () => clearTimeout(timer);
|
|
4620
4697
|
}, [loading, delay]);
|
|
4698
|
+
if (!visible && mode === "inline") {
|
|
4699
|
+
return null;
|
|
4700
|
+
}
|
|
4621
4701
|
if (!visible) {
|
|
4622
|
-
return
|
|
4702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4703
|
+
children,
|
|
4704
|
+
null
|
|
4705
|
+
] });
|
|
4623
4706
|
}
|
|
4624
4707
|
const indicator = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4625
4708
|
variant === "spinner" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Spinner, { size: spinnerSizeMap[size] }),
|
|
@@ -4674,9 +4757,9 @@ var LoadingOverlay = React29.forwardRef(
|
|
|
4674
4757
|
LoadingOverlay.displayName = "LoadingOverlay";
|
|
4675
4758
|
|
|
4676
4759
|
// src/components/LoadingPage.tsx
|
|
4677
|
-
var
|
|
4760
|
+
var React31 = __toESM(require("react"));
|
|
4678
4761
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4679
|
-
var LoadingPage =
|
|
4762
|
+
var LoadingPage = React31.forwardRef(
|
|
4680
4763
|
({
|
|
4681
4764
|
loading = true,
|
|
4682
4765
|
message,
|
|
@@ -4687,8 +4770,8 @@ var LoadingPage = React30.forwardRef(
|
|
|
4687
4770
|
className,
|
|
4688
4771
|
...props
|
|
4689
4772
|
}, ref) => {
|
|
4690
|
-
const [visible, setVisible] =
|
|
4691
|
-
|
|
4773
|
+
const [visible, setVisible] = React31.useState(delay === 0 && loading);
|
|
4774
|
+
React31.useEffect(() => {
|
|
4692
4775
|
if (!loading) {
|
|
4693
4776
|
setVisible(false);
|
|
4694
4777
|
return;
|
|
@@ -4728,9 +4811,9 @@ var LoadingPage = React30.forwardRef(
|
|
|
4728
4811
|
LoadingPage.displayName = "LoadingPage";
|
|
4729
4812
|
|
|
4730
4813
|
// src/components/LoadingSection.tsx
|
|
4731
|
-
var
|
|
4814
|
+
var React32 = __toESM(require("react"));
|
|
4732
4815
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4733
|
-
var LoadingSection =
|
|
4816
|
+
var LoadingSection = React32.forwardRef(
|
|
4734
4817
|
({
|
|
4735
4818
|
loading = false,
|
|
4736
4819
|
variant = "spinner",
|
|
@@ -4772,9 +4855,9 @@ var LoadingSection = React31.forwardRef(
|
|
|
4772
4855
|
LoadingSection.displayName = "LoadingSection";
|
|
4773
4856
|
|
|
4774
4857
|
// src/components/LiveRegion.tsx
|
|
4775
|
-
var
|
|
4858
|
+
var React33 = __toESM(require("react"));
|
|
4776
4859
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4777
|
-
var LiveRegion =
|
|
4860
|
+
var LiveRegion = React33.forwardRef(
|
|
4778
4861
|
({ message, politeness = "polite", atomic = true, visuallyHidden = true, className, children }, ref) => {
|
|
4779
4862
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4780
4863
|
"div",
|
|
@@ -4795,9 +4878,9 @@ var LiveRegion = React32.forwardRef(
|
|
|
4795
4878
|
LiveRegion.displayName = "LiveRegion";
|
|
4796
4879
|
|
|
4797
4880
|
// src/components/SkipLink.tsx
|
|
4798
|
-
var
|
|
4881
|
+
var React34 = __toESM(require("react"));
|
|
4799
4882
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4800
|
-
var SkipLink =
|
|
4883
|
+
var SkipLink = React34.forwardRef(
|
|
4801
4884
|
({ targetId, className, children = "Skip to main content", onClick, ...props }, ref) => {
|
|
4802
4885
|
const handleClick = (e) => {
|
|
4803
4886
|
e.preventDefault();
|
|
@@ -4873,7 +4956,7 @@ function useReducedMotion() {
|
|
|
4873
4956
|
|
|
4874
4957
|
// src/hooks/useArrowNavigation.ts
|
|
4875
4958
|
var import_react4 = require("react");
|
|
4876
|
-
var DEFAULT_SELECTOR = '[role="menuitem"], [role="option"], [role="tab"], button, a, [tabindex]:not([tabindex="-1"])';
|
|
4959
|
+
var DEFAULT_SELECTOR = '[data-arrow-nav-item], [role="menuitem"], [role="option"], [role="tab"], button, a, [tabindex]:not([tabindex="-1"])';
|
|
4877
4960
|
function useArrowNavigation(options = {}) {
|
|
4878
4961
|
const {
|
|
4879
4962
|
orientation = "vertical",
|
|
@@ -4979,6 +5062,7 @@ function useArrowNavigation(options = {}) {
|
|
|
4979
5062
|
const tabStopIndex = focusedIndex === -1 ? 0 : focusedIndex;
|
|
4980
5063
|
const getItemProps = (0, import_react4.useCallback)(
|
|
4981
5064
|
(index) => ({
|
|
5065
|
+
"data-arrow-nav-item": true,
|
|
4982
5066
|
tabIndex: index === tabStopIndex ? 0 : -1,
|
|
4983
5067
|
onFocus: () => {
|
|
4984
5068
|
setFocusedIndex(index);
|
|
@@ -5067,7 +5151,7 @@ function useRovingTabindex(options = {}) {
|
|
|
5067
5151
|
onKeyDown: handleKeyDown
|
|
5068
5152
|
};
|
|
5069
5153
|
const getItemProps = (0, import_react5.useCallback)(
|
|
5070
|
-
(index) => ({
|
|
5154
|
+
(index, handlers = {}) => ({
|
|
5071
5155
|
"data-roving-tabindex-item": true,
|
|
5072
5156
|
tabIndex: index === activeIndex ? 0 : -1,
|
|
5073
5157
|
ref: (node) => {
|
|
@@ -5077,11 +5161,13 @@ function useRovingTabindex(options = {}) {
|
|
|
5077
5161
|
itemsRef.current.delete(index);
|
|
5078
5162
|
}
|
|
5079
5163
|
},
|
|
5080
|
-
onClick: () => {
|
|
5164
|
+
onClick: (event) => {
|
|
5165
|
+
handlers.onClick?.(event);
|
|
5081
5166
|
setActiveIndex(index);
|
|
5082
5167
|
onIndexChange?.(index);
|
|
5083
5168
|
},
|
|
5084
|
-
onFocus: () => {
|
|
5169
|
+
onFocus: (event) => {
|
|
5170
|
+
handlers.onFocus?.(event);
|
|
5085
5171
|
if (activeIndex !== index) {
|
|
5086
5172
|
setActiveIndex(index);
|
|
5087
5173
|
onIndexChange?.(index);
|
|
@@ -5103,21 +5189,21 @@ function useRovingTabindex(options = {}) {
|
|
|
5103
5189
|
}
|
|
5104
5190
|
|
|
5105
5191
|
// src/hooks/useClickOutside.ts
|
|
5106
|
-
var
|
|
5192
|
+
var React35 = __toESM(require("react"));
|
|
5107
5193
|
function useClickOutside(ref, callback, options) {
|
|
5108
5194
|
const {
|
|
5109
5195
|
enabled = true,
|
|
5110
5196
|
events = ["mousedown", "touchstart"],
|
|
5111
5197
|
ignoreElements = []
|
|
5112
5198
|
} = options ?? {};
|
|
5113
|
-
const callbackRef =
|
|
5114
|
-
const ignoreElementsRef =
|
|
5115
|
-
|
|
5199
|
+
const callbackRef = React35.useRef(callback);
|
|
5200
|
+
const ignoreElementsRef = React35.useRef(ignoreElements);
|
|
5201
|
+
React35.useEffect(() => {
|
|
5116
5202
|
callbackRef.current = callback;
|
|
5117
5203
|
ignoreElementsRef.current = ignoreElements;
|
|
5118
5204
|
}, [callback, ignoreElements]);
|
|
5119
5205
|
const eventsKey = events.join(",");
|
|
5120
|
-
|
|
5206
|
+
React35.useEffect(() => {
|
|
5121
5207
|
if (!enabled) return;
|
|
5122
5208
|
const handleEvent = (event) => {
|
|
5123
5209
|
const target = event.target;
|
|
@@ -5201,6 +5287,7 @@ function useClickOutside(ref, callback, options) {
|
|
|
5201
5287
|
badgeVariants,
|
|
5202
5288
|
buttonVariants,
|
|
5203
5289
|
cn,
|
|
5290
|
+
labelVariants,
|
|
5204
5291
|
pageHeaderActionsVariants,
|
|
5205
5292
|
pageHeaderContainerVariants,
|
|
5206
5293
|
pageHeaderSubtitleVariants,
|