@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.css +0 -7
- package/dist/index.d.mts +39 -12
- package/dist/index.d.ts +39 -12
- package/dist/index.js +391 -308
- package/dist/index.mjs +425 -343
- 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,
|
|
@@ -1745,14 +1803,14 @@ function StudioCanvasItem({
|
|
|
1745
1803
|
className
|
|
1746
1804
|
}) {
|
|
1747
1805
|
const studio = useStudio();
|
|
1748
|
-
const ref =
|
|
1749
|
-
const pickedHere =
|
|
1806
|
+
const ref = React20.useRef(null);
|
|
1807
|
+
const pickedHere = React20.useRef(false);
|
|
1750
1808
|
const inQuickAction = (target) => !!target?.closest?.("[data-studio-quick-action]");
|
|
1751
1809
|
const select = (reveal) => {
|
|
1752
1810
|
if (!selected) onSelect?.();
|
|
1753
1811
|
if (reveal) studio?.revealInspector();
|
|
1754
1812
|
};
|
|
1755
|
-
|
|
1813
|
+
React20.useEffect(() => {
|
|
1756
1814
|
const el = ref.current;
|
|
1757
1815
|
const here = pickedHere.current;
|
|
1758
1816
|
pickedHere.current = false;
|
|
@@ -1830,7 +1888,7 @@ function StudioCanvasItem({
|
|
|
1830
1888
|
}
|
|
1831
1889
|
|
|
1832
1890
|
// src/components/studio/StudioInspector.tsx
|
|
1833
|
-
var
|
|
1891
|
+
var React21 = __toESM(require("react"));
|
|
1834
1892
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1835
1893
|
function StudioInspector({
|
|
1836
1894
|
title,
|
|
@@ -1843,9 +1901,10 @@ function StudioInspector({
|
|
|
1843
1901
|
footer,
|
|
1844
1902
|
className
|
|
1845
1903
|
}) {
|
|
1846
|
-
const uid =
|
|
1847
|
-
const [innerTab, setInnerTab] =
|
|
1848
|
-
const
|
|
1904
|
+
const uid = React21.useId();
|
|
1905
|
+
const [innerTab, setInnerTab] = React21.useState(tabs?.[0]?.id ?? "");
|
|
1906
|
+
const requestedTab = tabProp ?? innerTab;
|
|
1907
|
+
const tab = !tabs || tabs.some((t) => t.id === requestedTab) ? requestedTab : tabs[0]?.id ?? "";
|
|
1849
1908
|
const hasTabs = !!tabs && tabs.length > 1;
|
|
1850
1909
|
const choose = (id) => {
|
|
1851
1910
|
if (id === tab) return;
|
|
@@ -1921,8 +1980,8 @@ function StudioInspectorSection({
|
|
|
1921
1980
|
children,
|
|
1922
1981
|
className
|
|
1923
1982
|
}) {
|
|
1924
|
-
const uid =
|
|
1925
|
-
const [open, setOpen] =
|
|
1983
|
+
const uid = React21.useId();
|
|
1984
|
+
const [open, setOpen] = React21.useState(defaultOpen);
|
|
1926
1985
|
const expanded = !collapsible || open;
|
|
1927
1986
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1928
1987
|
"section",
|
|
@@ -2056,7 +2115,7 @@ function SaveStatus({ state, detail, onRetry, label, className }) {
|
|
|
2056
2115
|
}
|
|
2057
2116
|
|
|
2058
2117
|
// src/components/studio/IssuesButton.tsx
|
|
2059
|
-
var
|
|
2118
|
+
var React22 = __toESM(require("react"));
|
|
2060
2119
|
var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"));
|
|
2061
2120
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2062
2121
|
var plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
@@ -2069,7 +2128,7 @@ function IssuesButton({
|
|
|
2069
2128
|
showWhenEmpty = false,
|
|
2070
2129
|
className
|
|
2071
2130
|
}) {
|
|
2072
|
-
const [innerOpen, setInnerOpen] =
|
|
2131
|
+
const [innerOpen, setInnerOpen] = React22.useState(false);
|
|
2073
2132
|
const open = openProp ?? innerOpen;
|
|
2074
2133
|
const setOpen = (next) => {
|
|
2075
2134
|
if (openProp === void 0) setInnerOpen(next);
|
|
@@ -2167,7 +2226,7 @@ function IssuesButton({
|
|
|
2167
2226
|
}
|
|
2168
2227
|
|
|
2169
2228
|
// src/components/studio/InsertPalette.tsx
|
|
2170
|
-
var
|
|
2229
|
+
var React23 = __toESM(require("react"));
|
|
2171
2230
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2172
2231
|
function InsertPalette({
|
|
2173
2232
|
open,
|
|
@@ -2179,11 +2238,11 @@ function InsertPalette({
|
|
|
2179
2238
|
searchPlaceholder = "Search",
|
|
2180
2239
|
renderThumbnail
|
|
2181
2240
|
}) {
|
|
2182
|
-
const [query, setQuery] =
|
|
2183
|
-
const picked =
|
|
2184
|
-
const listRef =
|
|
2185
|
-
const searchRef =
|
|
2186
|
-
|
|
2241
|
+
const [query, setQuery] = React23.useState("");
|
|
2242
|
+
const picked = React23.useRef(false);
|
|
2243
|
+
const listRef = React23.useRef(null);
|
|
2244
|
+
const searchRef = React23.useRef(null);
|
|
2245
|
+
React23.useEffect(() => {
|
|
2187
2246
|
if (!open) return;
|
|
2188
2247
|
setQuery("");
|
|
2189
2248
|
picked.current = false;
|
|
@@ -2315,7 +2374,7 @@ function InsertPalette({
|
|
|
2315
2374
|
}
|
|
2316
2375
|
|
|
2317
2376
|
// src/components/DataPanel.tsx
|
|
2318
|
-
var
|
|
2377
|
+
var React25 = __toESM(require("react"));
|
|
2319
2378
|
var DropdownMenuPrimitive2 = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
2320
2379
|
|
|
2321
2380
|
// src/hooks/useFocusTrap.ts
|
|
@@ -2372,6 +2431,7 @@ function useFocusTrap(options = {}) {
|
|
|
2372
2431
|
if (!container) return;
|
|
2373
2432
|
previousActiveElementRef.current = document.activeElement;
|
|
2374
2433
|
const focusableElements = getFocusableElements(container);
|
|
2434
|
+
let focusFrame = 0;
|
|
2375
2435
|
if (focusableElements.length > 0) {
|
|
2376
2436
|
let elementToFocus = null;
|
|
2377
2437
|
if (initialFocus) {
|
|
@@ -2380,12 +2440,13 @@ function useFocusTrap(options = {}) {
|
|
|
2380
2440
|
if (!elementToFocus) {
|
|
2381
2441
|
elementToFocus = focusableElements[0];
|
|
2382
2442
|
}
|
|
2383
|
-
requestAnimationFrame(() => {
|
|
2443
|
+
focusFrame = requestAnimationFrame(() => {
|
|
2384
2444
|
elementToFocus?.focus({ preventScroll });
|
|
2385
2445
|
});
|
|
2386
2446
|
}
|
|
2387
2447
|
document.addEventListener("keydown", handleKeyDown);
|
|
2388
2448
|
return () => {
|
|
2449
|
+
cancelAnimationFrame(focusFrame);
|
|
2389
2450
|
document.removeEventListener("keydown", handleKeyDown);
|
|
2390
2451
|
const elementToReturn = returnFocusTo ?? previousActiveElementRef.current;
|
|
2391
2452
|
if (elementToReturn && typeof elementToReturn.focus === "function") {
|
|
@@ -2397,14 +2458,14 @@ function useFocusTrap(options = {}) {
|
|
|
2397
2458
|
}
|
|
2398
2459
|
|
|
2399
2460
|
// src/hooks/useEscapeKey.ts
|
|
2400
|
-
var
|
|
2461
|
+
var React24 = __toESM(require("react"));
|
|
2401
2462
|
function useEscapeKey(callback, options) {
|
|
2402
2463
|
const { enabled = true, preventDefault = true, stopPropagation = false } = options ?? {};
|
|
2403
|
-
const callbackRef =
|
|
2404
|
-
|
|
2464
|
+
const callbackRef = React24.useRef(callback);
|
|
2465
|
+
React24.useEffect(() => {
|
|
2405
2466
|
callbackRef.current = callback;
|
|
2406
2467
|
}, [callback]);
|
|
2407
|
-
|
|
2468
|
+
React24.useEffect(() => {
|
|
2408
2469
|
if (!enabled) return;
|
|
2409
2470
|
const handleKeyDown = (event) => {
|
|
2410
2471
|
if (event.key === "Escape") {
|
|
@@ -2430,64 +2491,72 @@ var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
|
2430
2491
|
function layoutViewportWidth() {
|
|
2431
2492
|
return document.documentElement.clientWidth;
|
|
2432
2493
|
}
|
|
2494
|
+
var SSR_VIEWPORT_WIDTH = 1024;
|
|
2495
|
+
var SSR_VIEWPORT_HEIGHT = 768;
|
|
2496
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React25.useLayoutEffect : React25.useEffect;
|
|
2433
2497
|
function isSecondaryMouseButton(e) {
|
|
2434
2498
|
return e.pointerType === "mouse" && e.button !== 0;
|
|
2435
2499
|
}
|
|
2436
2500
|
var DropdownTrigger = DropdownMenuPrimitive2.Trigger;
|
|
2437
2501
|
var DropdownContent = DropdownMenuPrimitive2.Content;
|
|
2438
2502
|
var DropdownLabel = DropdownMenuPrimitive2.Label;
|
|
2439
|
-
var
|
|
2503
|
+
var DropdownRadioGroup = DropdownMenuPrimitive2.RadioGroup;
|
|
2504
|
+
var DropdownRadioItem = DropdownMenuPrimitive2.RadioItem;
|
|
2505
|
+
var DropdownItemIndicator = DropdownMenuPrimitive2.ItemIndicator;
|
|
2506
|
+
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
2507
|
var DropdownSeparator = DropdownMenuPrimitive2.Separator;
|
|
2508
|
+
var EMPTY_CONSTRAINTS = {};
|
|
2509
|
+
var EMPTY_CARD_CONFIG = {};
|
|
2510
|
+
var EMPTY_ACTIONS = [];
|
|
2441
2511
|
function useDataPanel(options = {}) {
|
|
2442
2512
|
const {
|
|
2443
2513
|
persistKey,
|
|
2444
2514
|
initialMode = import_data_panel_core.DEFAULT_PANEL_STATE.mode,
|
|
2445
2515
|
initialEdge = import_data_panel_core.DEFAULT_PANEL_STATE.edge,
|
|
2446
2516
|
initialExpanded = import_data_panel_core.DEFAULT_PANEL_STATE.isExpanded,
|
|
2447
|
-
constraints =
|
|
2517
|
+
constraints = EMPTY_CONSTRAINTS
|
|
2448
2518
|
} = options;
|
|
2449
|
-
const resolvedConstraints =
|
|
2450
|
-
|
|
2519
|
+
const resolvedConstraints = React25.useMemo(
|
|
2520
|
+
() => ({ ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints }),
|
|
2521
|
+
[constraints]
|
|
2522
|
+
);
|
|
2523
|
+
const [persistedState] = React25.useState(() => {
|
|
2451
2524
|
if (persistKey && typeof window !== "undefined") {
|
|
2452
2525
|
return (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
2453
2526
|
}
|
|
2454
2527
|
return null;
|
|
2455
2528
|
});
|
|
2456
|
-
const [mode, setMode] =
|
|
2457
|
-
const [edge, setEdge] =
|
|
2458
|
-
const [isExpanded, setIsExpanded] =
|
|
2529
|
+
const [mode, setMode] = React25.useState(persistedState?.mode ?? initialMode);
|
|
2530
|
+
const [edge, setEdge] = React25.useState(persistedState?.edge ?? initialEdge);
|
|
2531
|
+
const [isExpanded, setIsExpanded] = React25.useState(
|
|
2459
2532
|
persistedState?.isExpanded ?? initialExpanded
|
|
2460
2533
|
);
|
|
2461
|
-
const [detachedPosition, setDetachedPosition] =
|
|
2534
|
+
const [detachedPosition, setDetachedPosition] = React25.useState(
|
|
2462
2535
|
persistedState?.detachedPosition ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
2463
2536
|
);
|
|
2464
|
-
const [detachedSize, setDetachedSize] =
|
|
2537
|
+
const [detachedSize, setDetachedSize] = React25.useState(
|
|
2465
2538
|
persistedState?.detachedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize
|
|
2466
2539
|
);
|
|
2467
|
-
const [pinnedSize, setPinnedSize] =
|
|
2540
|
+
const [pinnedSize, setPinnedSize] = React25.useState(
|
|
2468
2541
|
persistedState?.pinnedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize
|
|
2469
2542
|
);
|
|
2470
|
-
const saveTimeoutRef =
|
|
2471
|
-
const debouncedSave =
|
|
2543
|
+
const saveTimeoutRef = React25.useRef(null);
|
|
2544
|
+
const debouncedSave = React25.useCallback(() => {
|
|
2472
2545
|
if (!persistKey) return;
|
|
2473
2546
|
if (saveTimeoutRef.current) {
|
|
2474
2547
|
clearTimeout(saveTimeoutRef.current);
|
|
2475
2548
|
}
|
|
2476
2549
|
saveTimeoutRef.current = setTimeout(() => {
|
|
2477
2550
|
(0, import_data_panel_core.savePanelState)(persistKey, {
|
|
2551
|
+
...import_data_panel_core.DEFAULT_PANEL_STATE,
|
|
2552
|
+
...(0, import_data_panel_core.loadPanelState)(persistKey),
|
|
2478
2553
|
mode,
|
|
2479
|
-
variant: "full",
|
|
2480
2554
|
edge,
|
|
2481
|
-
isExpanded
|
|
2482
|
-
detachedPosition,
|
|
2483
|
-
detachedSize,
|
|
2484
|
-
pinnedSize,
|
|
2485
|
-
cardSnapIndex: 0,
|
|
2486
|
-
tabOffset: 0
|
|
2555
|
+
isExpanded
|
|
2487
2556
|
});
|
|
2488
2557
|
}, 300);
|
|
2489
|
-
}, [persistKey, mode, edge, isExpanded
|
|
2490
|
-
const handleSetMode =
|
|
2558
|
+
}, [persistKey, mode, edge, isExpanded]);
|
|
2559
|
+
const handleSetMode = React25.useCallback(
|
|
2491
2560
|
(newMode) => {
|
|
2492
2561
|
setMode(newMode);
|
|
2493
2562
|
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 +2567,7 @@ function useDataPanel(options = {}) {
|
|
|
2498
2567
|
},
|
|
2499
2568
|
[detachedPosition, detachedSize]
|
|
2500
2569
|
);
|
|
2501
|
-
const handleSetDetachedPosition =
|
|
2570
|
+
const handleSetDetachedPosition = React25.useCallback(
|
|
2502
2571
|
(position) => {
|
|
2503
2572
|
if (typeof window === "undefined") {
|
|
2504
2573
|
setDetachedPosition(position);
|
|
@@ -2510,13 +2579,13 @@ function useDataPanel(options = {}) {
|
|
|
2510
2579
|
},
|
|
2511
2580
|
[detachedSize]
|
|
2512
2581
|
);
|
|
2513
|
-
const handleSetDetachedSize =
|
|
2582
|
+
const handleSetDetachedSize = React25.useCallback(
|
|
2514
2583
|
(size) => {
|
|
2515
2584
|
setDetachedSize((0, import_data_panel_core.constrainSize)(size, resolvedConstraints));
|
|
2516
2585
|
},
|
|
2517
2586
|
[resolvedConstraints]
|
|
2518
2587
|
);
|
|
2519
|
-
const handleSetPinnedSize =
|
|
2588
|
+
const handleSetPinnedSize = React25.useCallback(
|
|
2520
2589
|
(size) => {
|
|
2521
2590
|
if (typeof window === "undefined") {
|
|
2522
2591
|
setPinnedSize(size);
|
|
@@ -2530,7 +2599,7 @@ function useDataPanel(options = {}) {
|
|
|
2530
2599
|
},
|
|
2531
2600
|
[edge, resolvedConstraints]
|
|
2532
2601
|
);
|
|
2533
|
-
|
|
2602
|
+
React25.useEffect(() => {
|
|
2534
2603
|
debouncedSave();
|
|
2535
2604
|
}, [debouncedSave]);
|
|
2536
2605
|
return {
|
|
@@ -2624,7 +2693,7 @@ var edgeLabels = {
|
|
|
2624
2693
|
top: "Pin to top",
|
|
2625
2694
|
bottom: "Pin to bottom"
|
|
2626
2695
|
};
|
|
2627
|
-
var DataPanelHeader =
|
|
2696
|
+
var DataPanelHeader = React25.forwardRef(
|
|
2628
2697
|
({
|
|
2629
2698
|
title,
|
|
2630
2699
|
subtitle,
|
|
@@ -2707,30 +2776,28 @@ var DataPanelHeader = React24.forwardRef(
|
|
|
2707
2776
|
align: "end",
|
|
2708
2777
|
children: [
|
|
2709
2778
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownLabel, { className: "px-2 py-1.5 text-sm font-semibold", children: "Panel Position" }),
|
|
2710
|
-
|
|
2711
|
-
|
|
2779
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2780
|
+
DropdownRadioGroup,
|
|
2712
2781
|
{
|
|
2713
|
-
|
|
2714
|
-
|
|
2782
|
+
value: mode === "detached" ? "detached" : edge,
|
|
2783
|
+
onValueChange: (value) => {
|
|
2784
|
+
if (value === "detached") {
|
|
2785
|
+
onModeChange?.("detached");
|
|
2786
|
+
return;
|
|
2787
|
+
}
|
|
2715
2788
|
onModeChange?.("pinned");
|
|
2716
|
-
onEdgeChange?.(
|
|
2789
|
+
onEdgeChange?.(value);
|
|
2717
2790
|
},
|
|
2718
2791
|
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" })
|
|
2792
|
+
["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownRadioItem, { value: e, className: menuRadioItemClass, children: [
|
|
2793
|
+
edgeLabels[e],
|
|
2794
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownItemIndicator, { className: "ml-auto text-xs", children: "\u2713" })
|
|
2795
|
+
] }, e)),
|
|
2796
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownSeparator, { className: "-mx-1 my-1 h-px bg-muted" }),
|
|
2797
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownRadioItem, { value: "detached", className: menuRadioItemClass, children: [
|
|
2798
|
+
"Detach",
|
|
2799
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownItemIndicator, { className: "ml-auto text-xs", children: "\u2713" })
|
|
2800
|
+
] })
|
|
2734
2801
|
]
|
|
2735
2802
|
}
|
|
2736
2803
|
)
|
|
@@ -2848,7 +2915,7 @@ function DataPanelCardHeader({
|
|
|
2848
2915
|
}
|
|
2849
2916
|
);
|
|
2850
2917
|
}
|
|
2851
|
-
var DataPanelContent =
|
|
2918
|
+
var DataPanelContent = React25.forwardRef(
|
|
2852
2919
|
({ children, className, "aria-label": ariaLabel = "Panel content" }, ref) => {
|
|
2853
2920
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2854
2921
|
"div",
|
|
@@ -2863,7 +2930,7 @@ var DataPanelContent = React24.forwardRef(
|
|
|
2863
2930
|
}
|
|
2864
2931
|
);
|
|
2865
2932
|
DataPanelContent.displayName = "DataPanelContent";
|
|
2866
|
-
var DataPanelFooter =
|
|
2933
|
+
var DataPanelFooter = React25.forwardRef(
|
|
2867
2934
|
({ actions = [], footerContent, footerActions, className }, ref) => {
|
|
2868
2935
|
if (!footerContent && actions.length === 0 && !footerActions) {
|
|
2869
2936
|
return null;
|
|
@@ -2899,7 +2966,7 @@ var DataPanelFooter = React24.forwardRef(
|
|
|
2899
2966
|
}
|
|
2900
2967
|
);
|
|
2901
2968
|
DataPanelFooter.displayName = "DataPanelFooter";
|
|
2902
|
-
var DataPanelTab =
|
|
2969
|
+
var DataPanelTab = React25.forwardRef(
|
|
2903
2970
|
({
|
|
2904
2971
|
title = "Panel",
|
|
2905
2972
|
subtitle,
|
|
@@ -2925,17 +2992,18 @@ var DataPanelTab = React24.forwardRef(
|
|
|
2925
2992
|
bottom: "left-1/2 rounded-t-lg border-b-0"
|
|
2926
2993
|
}[edge];
|
|
2927
2994
|
const insetStyle = { [edge]: tabInset };
|
|
2928
|
-
const innerRef =
|
|
2929
|
-
const dragRef =
|
|
2995
|
+
const innerRef = React25.useRef(null);
|
|
2996
|
+
const dragRef = React25.useRef({
|
|
2930
2997
|
startX: 0,
|
|
2931
2998
|
startY: 0,
|
|
2932
2999
|
startOffset: 0,
|
|
2933
3000
|
moved: false,
|
|
2934
3001
|
pointerId: -1
|
|
2935
3002
|
});
|
|
2936
|
-
const [dragOffset, setDragOffset] =
|
|
3003
|
+
const [dragOffset, setDragOffset] = React25.useState(null);
|
|
2937
3004
|
const effectiveOffset = dragOffset ?? offset;
|
|
2938
3005
|
const draggable = !!onOffsetChange;
|
|
3006
|
+
const pointerHandledRef = React25.useRef(false);
|
|
2939
3007
|
const tabTransform = (0, import_data_panel_core.getTabTransform)(edge, tabWidth, effectiveOffset);
|
|
2940
3008
|
const tabBounds = (0, import_data_panel_core.getTabBounds)(edge, tabWidth);
|
|
2941
3009
|
const setRefs = (node) => {
|
|
@@ -2979,6 +3047,10 @@ var DataPanelTab = React24.forwardRef(
|
|
|
2979
3047
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
2980
3048
|
}
|
|
2981
3049
|
d.pointerId = -1;
|
|
3050
|
+
pointerHandledRef.current = true;
|
|
3051
|
+
setTimeout(() => {
|
|
3052
|
+
pointerHandledRef.current = false;
|
|
3053
|
+
}, 0);
|
|
2982
3054
|
if (d.moved) {
|
|
2983
3055
|
onOffsetChange?.(dragOffset ?? offset);
|
|
2984
3056
|
} else {
|
|
@@ -3002,7 +3074,7 @@ var DataPanelTab = React24.forwardRef(
|
|
|
3002
3074
|
onClick?.();
|
|
3003
3075
|
}
|
|
3004
3076
|
};
|
|
3005
|
-
|
|
3077
|
+
React25.useEffect(() => {
|
|
3006
3078
|
if (!onOffsetChange || dragOffset !== null) return;
|
|
3007
3079
|
const reclamp = () => {
|
|
3008
3080
|
const clamped = (0, import_data_panel_core.constrainTabOffset)(
|
|
@@ -3050,7 +3122,13 @@ var DataPanelTab = React24.forwardRef(
|
|
|
3050
3122
|
type: "button",
|
|
3051
3123
|
"aria-label": `Expand ${title} panel`,
|
|
3052
3124
|
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:
|
|
3125
|
+
onClick: () => {
|
|
3126
|
+
if (pointerHandledRef.current) {
|
|
3127
|
+
pointerHandledRef.current = false;
|
|
3128
|
+
return;
|
|
3129
|
+
}
|
|
3130
|
+
onClick?.();
|
|
3131
|
+
},
|
|
3054
3132
|
onKeyDown: handleExpandKeyDown,
|
|
3055
3133
|
children: [
|
|
3056
3134
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-sm font-semibold", children: title }),
|
|
@@ -3091,7 +3169,7 @@ function ResizeHandles({
|
|
|
3091
3169
|
onPinnedSizeChange,
|
|
3092
3170
|
constraints
|
|
3093
3171
|
}) {
|
|
3094
|
-
const handleDetachedKeyDown =
|
|
3172
|
+
const handleDetachedKeyDown = React25.useCallback(
|
|
3095
3173
|
(e, handle) => {
|
|
3096
3174
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
3097
3175
|
let width = detachedSize.width;
|
|
@@ -3154,7 +3232,7 @@ function ResizeHandles({
|
|
|
3154
3232
|
},
|
|
3155
3233
|
[detachedPosition, detachedSize, constraints, onDetachedResize]
|
|
3156
3234
|
);
|
|
3157
|
-
const handlePinnedKeyDown =
|
|
3235
|
+
const handlePinnedKeyDown = React25.useCallback(
|
|
3158
3236
|
(e) => {
|
|
3159
3237
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
3160
3238
|
let newSize = pinnedSize;
|
|
@@ -3271,14 +3349,14 @@ function ResizeHandles({
|
|
|
3271
3349
|
}
|
|
3272
3350
|
);
|
|
3273
3351
|
}
|
|
3274
|
-
var DataPanel =
|
|
3352
|
+
var DataPanel = React25.forwardRef(
|
|
3275
3353
|
({
|
|
3276
3354
|
open: controlledOpen,
|
|
3277
3355
|
onOpenChange,
|
|
3278
3356
|
mode: controlledMode,
|
|
3279
3357
|
onModeChange,
|
|
3280
3358
|
variant: controlledVariant,
|
|
3281
|
-
cardConfig =
|
|
3359
|
+
cardConfig = EMPTY_CARD_CONFIG,
|
|
3282
3360
|
edge: controlledEdge,
|
|
3283
3361
|
onEdgeChange,
|
|
3284
3362
|
expanded: controlledExpanded,
|
|
@@ -3286,8 +3364,8 @@ var DataPanel = React24.forwardRef(
|
|
|
3286
3364
|
title,
|
|
3287
3365
|
subtitle,
|
|
3288
3366
|
children,
|
|
3289
|
-
actions =
|
|
3290
|
-
constraints =
|
|
3367
|
+
actions = EMPTY_ACTIONS,
|
|
3368
|
+
constraints = EMPTY_CONSTRAINTS,
|
|
3291
3369
|
tabWidth = import_data_panel_core.DEFAULT_TAB_WIDTH,
|
|
3292
3370
|
tabInset = 0,
|
|
3293
3371
|
disableClose = false,
|
|
@@ -3303,39 +3381,35 @@ var DataPanel = React24.forwardRef(
|
|
|
3303
3381
|
footerActions,
|
|
3304
3382
|
className
|
|
3305
3383
|
}, ref) => {
|
|
3306
|
-
const resolvedConstraints =
|
|
3384
|
+
const resolvedConstraints = React25.useMemo(
|
|
3307
3385
|
() => ({ ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints }),
|
|
3308
3386
|
[constraints]
|
|
3309
3387
|
);
|
|
3310
|
-
const resolvedCardConfig =
|
|
3388
|
+
const resolvedCardConfig = React25.useMemo(
|
|
3311
3389
|
() => ({ ...import_data_panel_core.DEFAULT_CARD_CONFIG, ...cardConfig }),
|
|
3312
3390
|
[cardConfig]
|
|
3313
3391
|
);
|
|
3314
|
-
const panelId =
|
|
3392
|
+
const panelId = React25.useId();
|
|
3315
3393
|
const titleId = `${panelId}-title`;
|
|
3316
|
-
const [internalOpen, setInternalOpen] =
|
|
3317
|
-
const [internalMode, setInternalMode] =
|
|
3318
|
-
const [internalVariant, setInternalVariant] =
|
|
3394
|
+
const [internalOpen, setInternalOpen] = React25.useState(true);
|
|
3395
|
+
const [internalMode, setInternalMode] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.mode);
|
|
3396
|
+
const [internalVariant, setInternalVariant] = React25.useState(
|
|
3319
3397
|
import_data_panel_core.DEFAULT_PANEL_STATE.variant
|
|
3320
3398
|
);
|
|
3321
|
-
const [internalEdge, setInternalEdge] =
|
|
3322
|
-
const [internalExpanded, setInternalExpanded] =
|
|
3399
|
+
const [internalEdge, setInternalEdge] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.edge);
|
|
3400
|
+
const [internalExpanded, setInternalExpanded] = React25.useState(
|
|
3323
3401
|
import_data_panel_core.DEFAULT_PANEL_STATE.isExpanded
|
|
3324
3402
|
);
|
|
3325
|
-
const [detachedPosition, setDetachedPosition] =
|
|
3403
|
+
const [detachedPosition, setDetachedPosition] = React25.useState(
|
|
3326
3404
|
import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
3327
3405
|
);
|
|
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
|
-
);
|
|
3406
|
+
const [detachedSize, setDetachedSize] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize);
|
|
3407
|
+
const [pinnedSize, setPinnedSize] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize);
|
|
3408
|
+
const [tabOffset, setTabOffset] = React25.useState(import_data_panel_core.DEFAULT_PANEL_STATE.tabOffset);
|
|
3409
|
+
const [viewportWidth, setViewportWidth] = React25.useState(SSR_VIEWPORT_WIDTH);
|
|
3410
|
+
const [viewportHeight, setViewportHeight] = React25.useState(SSR_VIEWPORT_HEIGHT);
|
|
3337
3411
|
const isMobile = viewportWidth < 640;
|
|
3338
|
-
const cardDefaultLeftOffset =
|
|
3412
|
+
const cardDefaultLeftOffset = React25.useCallback(
|
|
3339
3413
|
(width) => {
|
|
3340
3414
|
const margin = resolvedCardConfig.horizontalMargin;
|
|
3341
3415
|
if (resolvedCardConfig.align === "left") return margin;
|
|
@@ -3346,45 +3420,45 @@ var DataPanel = React24.forwardRef(
|
|
|
3346
3420
|
},
|
|
3347
3421
|
[viewportWidth, resolvedCardConfig.align, resolvedCardConfig.horizontalMargin]
|
|
3348
3422
|
);
|
|
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 =
|
|
3423
|
+
const [cardHorizontalPosition, setCardHorizontalPosition] = React25.useState(0);
|
|
3424
|
+
const [cardExpandedHeight, setCardExpandedHeight] = React25.useState(0);
|
|
3425
|
+
const [cardWidth, setCardWidth] = React25.useState(null);
|
|
3426
|
+
const [cardDragCurrentHeight, setCardDragCurrentHeight] = React25.useState(import_data_panel_core.CARD_HEADER_HEIGHT);
|
|
3427
|
+
const [isCardVerticalDragging, setIsCardVerticalDragging] = React25.useState(false);
|
|
3428
|
+
const [isCardHorizontalDragging, setIsCardHorizontalDragging] = React25.useState(false);
|
|
3429
|
+
const [isCardHeightTransitioning, setIsCardHeightTransitioning] = React25.useState(false);
|
|
3430
|
+
const [isCardWidthResizing, setIsCardWidthResizing] = React25.useState(false);
|
|
3431
|
+
const [isCardTopResizing, setIsCardTopResizing] = React25.useState(false);
|
|
3432
|
+
const [isDragging, setIsDragging] = React25.useState(false);
|
|
3433
|
+
const [isResizing, setIsResizing] = React25.useState(false);
|
|
3434
|
+
const [snapPreview, setSnapPreview] = React25.useState(null);
|
|
3435
|
+
const [isPinnedDragging, setIsPinnedDragging] = React25.useState(false);
|
|
3436
|
+
const [pullOffset, setPullOffset] = React25.useState(0);
|
|
3437
|
+
const dragStateRef = React25.useRef({
|
|
3364
3438
|
startPosition: { x: 0, y: 0 },
|
|
3365
3439
|
startPanelPosition: { x: 0, y: 0 }
|
|
3366
3440
|
});
|
|
3367
|
-
const pinnedDragStateRef =
|
|
3441
|
+
const pinnedDragStateRef = React25.useRef({
|
|
3368
3442
|
startPosition: { x: 0, y: 0 },
|
|
3369
3443
|
hasDetached: false
|
|
3370
3444
|
});
|
|
3371
|
-
const resizeStateRef =
|
|
3445
|
+
const resizeStateRef = React25.useRef({
|
|
3372
3446
|
handle: null,
|
|
3373
3447
|
startPosition: { x: 0, y: 0 },
|
|
3374
3448
|
startSize: { width: 0, height: 0 },
|
|
3375
3449
|
startPanelPosition: { x: 0, y: 0 }
|
|
3376
3450
|
});
|
|
3377
|
-
const cardDragStateRef =
|
|
3451
|
+
const cardDragStateRef = React25.useRef({
|
|
3378
3452
|
startY: 0,
|
|
3379
3453
|
startX: 0,
|
|
3380
3454
|
startTime: 0,
|
|
3381
3455
|
startExpanded: false,
|
|
3382
3456
|
startHorizontalPosition: 0
|
|
3383
3457
|
});
|
|
3384
|
-
const cardCurrentHeightRef =
|
|
3385
|
-
const cardTopResizeStartRef =
|
|
3386
|
-
const cardHeightUserSetRef =
|
|
3387
|
-
const cardWidthResizeStateRef =
|
|
3458
|
+
const cardCurrentHeightRef = React25.useRef(import_data_panel_core.CARD_HEADER_HEIGHT);
|
|
3459
|
+
const cardTopResizeStartRef = React25.useRef({ startY: 0, startHeight: 0 });
|
|
3460
|
+
const cardHeightUserSetRef = React25.useRef(false);
|
|
3461
|
+
const cardWidthResizeStateRef = React25.useRef({
|
|
3388
3462
|
handle: null,
|
|
3389
3463
|
startX: 0,
|
|
3390
3464
|
startWidth: 0,
|
|
@@ -3399,9 +3473,9 @@ var DataPanel = React24.forwardRef(
|
|
|
3399
3473
|
const resizeRight = !disableResize && (variant === "full" && (mode === "detached" || edge === "left") || variant === "card" && isExpanded && !isMobile);
|
|
3400
3474
|
const resizeBottom = !disableResize && variant === "full" && (mode === "detached" || edge === "top");
|
|
3401
3475
|
const hasFooter = !!(footerContent || actions.length > 0 || footerActions);
|
|
3402
|
-
const saveTimeoutRef =
|
|
3403
|
-
const isMountedRef =
|
|
3404
|
-
|
|
3476
|
+
const saveTimeoutRef = React25.useRef(null);
|
|
3477
|
+
const isMountedRef = React25.useRef(true);
|
|
3478
|
+
React25.useEffect(() => {
|
|
3405
3479
|
isMountedRef.current = true;
|
|
3406
3480
|
return () => {
|
|
3407
3481
|
isMountedRef.current = false;
|
|
@@ -3412,7 +3486,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3412
3486
|
}
|
|
3413
3487
|
};
|
|
3414
3488
|
}, []);
|
|
3415
|
-
const debouncedSave =
|
|
3489
|
+
const debouncedSave = React25.useCallback(() => {
|
|
3416
3490
|
if (!persistKey) return;
|
|
3417
3491
|
if (saveTimeoutRef.current) {
|
|
3418
3492
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -3441,12 +3515,12 @@ var DataPanel = React24.forwardRef(
|
|
|
3441
3515
|
pinnedSize,
|
|
3442
3516
|
tabOffset
|
|
3443
3517
|
]);
|
|
3444
|
-
|
|
3518
|
+
React25.useEffect(() => {
|
|
3445
3519
|
debouncedSave();
|
|
3446
3520
|
}, [debouncedSave]);
|
|
3447
|
-
const hasLoadedRef =
|
|
3448
|
-
const hasPersistedPositionRef =
|
|
3449
|
-
|
|
3521
|
+
const hasLoadedRef = React25.useRef(false);
|
|
3522
|
+
const hasPersistedPositionRef = React25.useRef(false);
|
|
3523
|
+
React25.useEffect(() => {
|
|
3450
3524
|
if (!persistKey || hasLoadedRef.current) return;
|
|
3451
3525
|
hasLoadedRef.current = true;
|
|
3452
3526
|
const persisted = (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
@@ -3475,7 +3549,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3475
3549
|
if (persisted.tabOffset !== void 0) setTabOffset(persisted.tabOffset);
|
|
3476
3550
|
}
|
|
3477
3551
|
}, [persistKey, controlledMode, controlledVariant, controlledEdge, controlledExpanded]);
|
|
3478
|
-
|
|
3552
|
+
React25.useEffect(() => {
|
|
3479
3553
|
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
3554
|
setDetachedPosition(
|
|
3481
3555
|
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, layoutViewportWidth(), window.innerHeight)
|
|
@@ -3498,8 +3572,8 @@ var DataPanel = React24.forwardRef(
|
|
|
3498
3572
|
},
|
|
3499
3573
|
{ enabled: isDialog, preventDefault: false }
|
|
3500
3574
|
);
|
|
3501
|
-
const panelElRef =
|
|
3502
|
-
const tabRef =
|
|
3575
|
+
const panelElRef = React25.useRef(null);
|
|
3576
|
+
const tabRef = React25.useRef(null);
|
|
3503
3577
|
const setPanelRef = (node) => {
|
|
3504
3578
|
panelElRef.current = node;
|
|
3505
3579
|
focusTrapRef.current = node;
|
|
@@ -3509,7 +3583,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3509
3583
|
ref.current = node;
|
|
3510
3584
|
}
|
|
3511
3585
|
};
|
|
3512
|
-
const handleModeChange =
|
|
3586
|
+
const handleModeChange = React25.useCallback(
|
|
3513
3587
|
(newMode) => {
|
|
3514
3588
|
if (controlledMode === void 0) {
|
|
3515
3589
|
setInternalMode(newMode);
|
|
@@ -3518,7 +3592,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3518
3592
|
},
|
|
3519
3593
|
[controlledMode, onModeChange]
|
|
3520
3594
|
);
|
|
3521
|
-
const handleEdgeChange =
|
|
3595
|
+
const handleEdgeChange = React25.useCallback(
|
|
3522
3596
|
(newEdge) => {
|
|
3523
3597
|
if (controlledEdge === void 0) {
|
|
3524
3598
|
setInternalEdge(newEdge);
|
|
@@ -3527,8 +3601,8 @@ var DataPanel = React24.forwardRef(
|
|
|
3527
3601
|
},
|
|
3528
3602
|
[controlledEdge, onEdgeChange]
|
|
3529
3603
|
);
|
|
3530
|
-
const restoreFocusRef =
|
|
3531
|
-
const handleExpandedChange =
|
|
3604
|
+
const restoreFocusRef = React25.useRef(false);
|
|
3605
|
+
const handleExpandedChange = React25.useCallback(
|
|
3532
3606
|
(newExpanded) => {
|
|
3533
3607
|
const active = typeof document !== "undefined" ? document.activeElement : null;
|
|
3534
3608
|
restoreFocusRef.current = newExpanded !== isExpanded && !!active && active !== document.body;
|
|
@@ -3539,7 +3613,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3539
3613
|
},
|
|
3540
3614
|
[controlledExpanded, onExpandedChange, isExpanded]
|
|
3541
3615
|
);
|
|
3542
|
-
|
|
3616
|
+
React25.useEffect(() => {
|
|
3543
3617
|
if (!restoreFocusRef.current) return;
|
|
3544
3618
|
restoreFocusRef.current = false;
|
|
3545
3619
|
const active = document.activeElement;
|
|
@@ -3572,7 +3646,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3572
3646
|
document.body.style.userSelect = "none";
|
|
3573
3647
|
}
|
|
3574
3648
|
};
|
|
3575
|
-
const handleDragMove =
|
|
3649
|
+
const handleDragMove = React25.useCallback(
|
|
3576
3650
|
(e) => {
|
|
3577
3651
|
if (!isDragging) return;
|
|
3578
3652
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3599,7 +3673,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3599
3673
|
},
|
|
3600
3674
|
[isDragging, detachedSize, snapThreshold]
|
|
3601
3675
|
);
|
|
3602
|
-
const handleDragEnd =
|
|
3676
|
+
const handleDragEnd = React25.useCallback(() => {
|
|
3603
3677
|
if (!isDragging) return;
|
|
3604
3678
|
setIsDragging(false);
|
|
3605
3679
|
document.body.style.cursor = "";
|
|
@@ -3610,7 +3684,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3610
3684
|
setSnapPreview(null);
|
|
3611
3685
|
}
|
|
3612
3686
|
}, [isDragging, snapPreview, handleModeChange, handleEdgeChange]);
|
|
3613
|
-
const handlePinnedDragMove =
|
|
3687
|
+
const handlePinnedDragMove = React25.useCallback(
|
|
3614
3688
|
(e) => {
|
|
3615
3689
|
if (!isPinnedDragging) return;
|
|
3616
3690
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3646,7 +3720,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3646
3720
|
},
|
|
3647
3721
|
[isPinnedDragging, edge, detachThreshold, pinnedSize, detachedSize, handleModeChange]
|
|
3648
3722
|
);
|
|
3649
|
-
const handlePinnedDragEnd =
|
|
3723
|
+
const handlePinnedDragEnd = React25.useCallback(() => {
|
|
3650
3724
|
if (!isPinnedDragging) return;
|
|
3651
3725
|
setIsPinnedDragging(false);
|
|
3652
3726
|
setPullOffset(0);
|
|
@@ -3668,7 +3742,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3668
3742
|
document.body.style.cursor = (0, import_data_panel_core.getResizeCursor)(handle);
|
|
3669
3743
|
document.body.style.userSelect = "none";
|
|
3670
3744
|
};
|
|
3671
|
-
const handleResizeMove =
|
|
3745
|
+
const handleResizeMove = React25.useCallback(
|
|
3672
3746
|
(e) => {
|
|
3673
3747
|
if (!isResizing || !resizeStateRef.current.handle) return;
|
|
3674
3748
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3709,7 +3783,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3709
3783
|
},
|
|
3710
3784
|
[isResizing, mode, edge, resolvedConstraints]
|
|
3711
3785
|
);
|
|
3712
|
-
const handleResizeEnd =
|
|
3786
|
+
const handleResizeEnd = React25.useCallback(() => {
|
|
3713
3787
|
if (!isResizing) return;
|
|
3714
3788
|
setIsResizing(false);
|
|
3715
3789
|
resizeStateRef.current.handle = null;
|
|
@@ -3741,7 +3815,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3741
3815
|
}
|
|
3742
3816
|
document.body.style.userSelect = "none";
|
|
3743
3817
|
};
|
|
3744
|
-
const handleCardPointerMove =
|
|
3818
|
+
const handleCardPointerMove = React25.useCallback(
|
|
3745
3819
|
(e) => {
|
|
3746
3820
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
3747
3821
|
if (isCardVerticalDragging) {
|
|
@@ -3781,7 +3855,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3781
3855
|
resolvedCardConfig.maxWidth
|
|
3782
3856
|
]
|
|
3783
3857
|
);
|
|
3784
|
-
const handleCardPointerUp =
|
|
3858
|
+
const handleCardPointerUp = React25.useCallback(
|
|
3785
3859
|
(e) => {
|
|
3786
3860
|
const endTime = Date.now();
|
|
3787
3861
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3839,7 +3913,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3839
3913
|
document.body.style.cursor = "ns-resize";
|
|
3840
3914
|
document.body.style.userSelect = "none";
|
|
3841
3915
|
};
|
|
3842
|
-
const handleCardResizeMove =
|
|
3916
|
+
const handleCardResizeMove = React25.useCallback(
|
|
3843
3917
|
(e) => {
|
|
3844
3918
|
if (!isCardTopResizing) return;
|
|
3845
3919
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -3853,7 +3927,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3853
3927
|
},
|
|
3854
3928
|
[isCardTopResizing, viewportHeight]
|
|
3855
3929
|
);
|
|
3856
|
-
const handleCardResizeEnd =
|
|
3930
|
+
const handleCardResizeEnd = React25.useCallback(() => {
|
|
3857
3931
|
if (!isCardTopResizing) return;
|
|
3858
3932
|
setIsCardTopResizing(false);
|
|
3859
3933
|
document.body.style.cursor = "";
|
|
@@ -3882,7 +3956,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3882
3956
|
document.body.style.cursor = "ew-resize";
|
|
3883
3957
|
document.body.style.userSelect = "none";
|
|
3884
3958
|
};
|
|
3885
|
-
const handleCardWidthResizeMove =
|
|
3959
|
+
const handleCardWidthResizeMove = React25.useCallback(
|
|
3886
3960
|
(e) => {
|
|
3887
3961
|
const st = cardWidthResizeStateRef.current;
|
|
3888
3962
|
if (!isCardWidthResizing || !st.handle) return;
|
|
@@ -3924,7 +3998,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3924
3998
|
resolvedCardConfig.maxWidth
|
|
3925
3999
|
]
|
|
3926
4000
|
);
|
|
3927
|
-
const handleCardWidthResizeEnd =
|
|
4001
|
+
const handleCardWidthResizeEnd = React25.useCallback(() => {
|
|
3928
4002
|
if (!isCardWidthResizing) return;
|
|
3929
4003
|
setIsCardWidthResizing(false);
|
|
3930
4004
|
cardWidthResizeStateRef.current.handle = null;
|
|
@@ -3975,7 +4049,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3975
4049
|
if (kind === "width-left") setCardHorizontalPosition((p) => p - appliedDelta);
|
|
3976
4050
|
debouncedSave();
|
|
3977
4051
|
};
|
|
3978
|
-
|
|
4052
|
+
React25.useEffect(() => {
|
|
3979
4053
|
if (isDragging) {
|
|
3980
4054
|
window.addEventListener("pointermove", handleDragMove);
|
|
3981
4055
|
window.addEventListener("pointerup", handleDragEnd);
|
|
@@ -3987,7 +4061,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3987
4061
|
};
|
|
3988
4062
|
}
|
|
3989
4063
|
}, [isDragging, handleDragMove, handleDragEnd]);
|
|
3990
|
-
|
|
4064
|
+
React25.useEffect(() => {
|
|
3991
4065
|
if (isPinnedDragging) {
|
|
3992
4066
|
window.addEventListener("pointermove", handlePinnedDragMove);
|
|
3993
4067
|
window.addEventListener("pointerup", handlePinnedDragEnd);
|
|
@@ -3999,7 +4073,7 @@ var DataPanel = React24.forwardRef(
|
|
|
3999
4073
|
};
|
|
4000
4074
|
}
|
|
4001
4075
|
}, [isPinnedDragging, handlePinnedDragMove, handlePinnedDragEnd]);
|
|
4002
|
-
|
|
4076
|
+
React25.useEffect(() => {
|
|
4003
4077
|
if (isResizing) {
|
|
4004
4078
|
window.addEventListener("pointermove", handleResizeMove);
|
|
4005
4079
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
@@ -4011,7 +4085,7 @@ var DataPanel = React24.forwardRef(
|
|
|
4011
4085
|
};
|
|
4012
4086
|
}
|
|
4013
4087
|
}, [isResizing, handleResizeMove, handleResizeEnd]);
|
|
4014
|
-
|
|
4088
|
+
React25.useEffect(() => {
|
|
4015
4089
|
if (isCardVerticalDragging || isCardHorizontalDragging) {
|
|
4016
4090
|
window.addEventListener("pointermove", handleCardPointerMove);
|
|
4017
4091
|
window.addEventListener("pointerup", handleCardPointerUp);
|
|
@@ -4028,7 +4102,7 @@ var DataPanel = React24.forwardRef(
|
|
|
4028
4102
|
handleCardPointerMove,
|
|
4029
4103
|
handleCardPointerUp
|
|
4030
4104
|
]);
|
|
4031
|
-
|
|
4105
|
+
React25.useEffect(() => {
|
|
4032
4106
|
if (isCardTopResizing) {
|
|
4033
4107
|
window.addEventListener("pointermove", handleCardResizeMove);
|
|
4034
4108
|
window.addEventListener("pointerup", handleCardResizeEnd);
|
|
@@ -4040,7 +4114,7 @@ var DataPanel = React24.forwardRef(
|
|
|
4040
4114
|
};
|
|
4041
4115
|
}
|
|
4042
4116
|
}, [isCardTopResizing, handleCardResizeMove, handleCardResizeEnd]);
|
|
4043
|
-
|
|
4117
|
+
React25.useEffect(() => {
|
|
4044
4118
|
if (isCardWidthResizing) {
|
|
4045
4119
|
window.addEventListener("pointermove", handleCardWidthResizeMove);
|
|
4046
4120
|
window.addEventListener("pointerup", handleCardWidthResizeEnd);
|
|
@@ -4052,10 +4126,10 @@ var DataPanel = React24.forwardRef(
|
|
|
4052
4126
|
};
|
|
4053
4127
|
}
|
|
4054
4128
|
}, [isCardWidthResizing, handleCardWidthResizeMove, handleCardWidthResizeEnd]);
|
|
4055
|
-
const resizeStateLatestRef =
|
|
4129
|
+
const resizeStateLatestRef = React25.useRef({ mode, detachedSize });
|
|
4056
4130
|
resizeStateLatestRef.current = { mode, detachedSize };
|
|
4057
4131
|
const expandedRatio = resolvedCardConfig.expandedRatio;
|
|
4058
|
-
|
|
4132
|
+
useIsomorphicLayoutEffect(() => {
|
|
4059
4133
|
const onResize = () => {
|
|
4060
4134
|
const vh = window.innerHeight;
|
|
4061
4135
|
setViewportWidth(layoutViewportWidth());
|
|
@@ -4077,19 +4151,19 @@ var DataPanel = React24.forwardRef(
|
|
|
4077
4151
|
window.addEventListener("resize", onWindowResize);
|
|
4078
4152
|
return () => window.removeEventListener("resize", onWindowResize);
|
|
4079
4153
|
}, [expandedRatio]);
|
|
4080
|
-
|
|
4154
|
+
React25.useEffect(() => {
|
|
4081
4155
|
if (isMobile && variant === "card") {
|
|
4082
4156
|
setCardHorizontalPosition(0);
|
|
4083
4157
|
setCardWidth(null);
|
|
4084
4158
|
}
|
|
4085
4159
|
}, [isMobile, variant]);
|
|
4086
|
-
|
|
4160
|
+
React25.useEffect(() => {
|
|
4087
4161
|
if (isCardHeightTransitioning) {
|
|
4088
4162
|
const t = setTimeout(() => setIsCardHeightTransitioning(false), 350);
|
|
4089
4163
|
return () => clearTimeout(t);
|
|
4090
4164
|
}
|
|
4091
4165
|
}, [isCardHeightTransitioning]);
|
|
4092
|
-
const panelStyles =
|
|
4166
|
+
const panelStyles = React25.useMemo(() => {
|
|
4093
4167
|
if (variant === "card") {
|
|
4094
4168
|
const defaultCardWidth = Math.min(
|
|
4095
4169
|
viewportWidth - resolvedCardConfig.horizontalMargin * 2,
|
|
@@ -4209,7 +4283,6 @@ var DataPanel = React24.forwardRef(
|
|
|
4209
4283
|
"aria-modal": isDialog ? "true" : void 0,
|
|
4210
4284
|
"aria-labelledby": title ? titleId : void 0,
|
|
4211
4285
|
"aria-label": !title ? "Side panel" : void 0,
|
|
4212
|
-
"aria-expanded": variant === "card" ? isExpanded : void 0,
|
|
4213
4286
|
onPointerDown: variant === "full" ? handleDragStart : void 0,
|
|
4214
4287
|
children: [
|
|
4215
4288
|
variant === "card" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -4355,7 +4428,7 @@ var DataPanel = React24.forwardRef(
|
|
|
4355
4428
|
DataPanel.displayName = "DataPanel";
|
|
4356
4429
|
|
|
4357
4430
|
// src/components/Skeleton.tsx
|
|
4358
|
-
var
|
|
4431
|
+
var React26 = __toESM(require("react"));
|
|
4359
4432
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
4360
4433
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4361
4434
|
var skeletonVariants = (0, import_class_variance_authority6.cva)("rounded-md bg-muted", {
|
|
@@ -4373,7 +4446,7 @@ var skeletonVariants = (0, import_class_variance_authority6.cva)("rounded-md bg-
|
|
|
4373
4446
|
variant: "default"
|
|
4374
4447
|
}
|
|
4375
4448
|
});
|
|
4376
|
-
var Skeleton =
|
|
4449
|
+
var Skeleton = React26.forwardRef(
|
|
4377
4450
|
({ className, variant, animation = "pulse", ...props }, ref) => {
|
|
4378
4451
|
const animationClass = animation === "pulse" ? "animate-pulse" : animation === "shimmer" ? "animate-shimmer" : "";
|
|
4379
4452
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
@@ -4389,7 +4462,7 @@ var Skeleton = React25.forwardRef(
|
|
|
4389
4462
|
Skeleton.displayName = "Skeleton";
|
|
4390
4463
|
|
|
4391
4464
|
// src/components/Spinner.tsx
|
|
4392
|
-
var
|
|
4465
|
+
var React27 = __toESM(require("react"));
|
|
4393
4466
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
4394
4467
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4395
4468
|
var spinnerVariants = (0, import_class_variance_authority7.cva)("animate-spin text-current", {
|
|
@@ -4405,7 +4478,7 @@ var spinnerVariants = (0, import_class_variance_authority7.cva)("animate-spin te
|
|
|
4405
4478
|
size: "md"
|
|
4406
4479
|
}
|
|
4407
4480
|
});
|
|
4408
|
-
var Spinner =
|
|
4481
|
+
var Spinner = React27.forwardRef(
|
|
4409
4482
|
({ className, size, label = "Loading...", ...props }, ref) => {
|
|
4410
4483
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4411
4484
|
"svg",
|
|
@@ -4447,7 +4520,7 @@ var Spinner = React26.forwardRef(
|
|
|
4447
4520
|
Spinner.displayName = "Spinner";
|
|
4448
4521
|
|
|
4449
4522
|
// src/components/LoadingLogo.tsx
|
|
4450
|
-
var
|
|
4523
|
+
var React28 = __toESM(require("react"));
|
|
4451
4524
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4452
4525
|
var logoPaths = [
|
|
4453
4526
|
"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 +4543,7 @@ var colors = {
|
|
|
4470
4543
|
stroke: "#ffffff"
|
|
4471
4544
|
}
|
|
4472
4545
|
};
|
|
4473
|
-
var LoadingLogo =
|
|
4546
|
+
var LoadingLogo = React28.forwardRef(
|
|
4474
4547
|
({ width = 40, height = 40, loading = false, variant = "dark", className, ...props }, ref) => {
|
|
4475
4548
|
const currentColors = colors[variant];
|
|
4476
4549
|
const fillColor = loading ? currentColors.fillLoading : currentColors.fill;
|
|
@@ -4519,7 +4592,7 @@ var LoadingLogo = React27.forwardRef(
|
|
|
4519
4592
|
LoadingLogo.displayName = "LoadingLogo";
|
|
4520
4593
|
|
|
4521
4594
|
// src/components/ProgressBar.tsx
|
|
4522
|
-
var
|
|
4595
|
+
var React29 = __toESM(require("react"));
|
|
4523
4596
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
4524
4597
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4525
4598
|
var progressBarVariants = (0, import_class_variance_authority8.cva)("w-full overflow-hidden rounded-full bg-muted", {
|
|
@@ -4547,7 +4620,7 @@ var progressFillVariants = (0, import_class_variance_authority8.cva)("h-full rou
|
|
|
4547
4620
|
variant: "default"
|
|
4548
4621
|
}
|
|
4549
4622
|
});
|
|
4550
|
-
var ProgressBar =
|
|
4623
|
+
var ProgressBar = React29.forwardRef(
|
|
4551
4624
|
({ className, size, variant, value, max = 100, label = "Progress", showValue = false, ...props }, ref) => {
|
|
4552
4625
|
const isIndeterminate = value === void 0;
|
|
4553
4626
|
const clampedValue = isIndeterminate ? 0 : Math.min(Math.max(0, value), max);
|
|
@@ -4586,11 +4659,11 @@ var ProgressBar = React28.forwardRef(
|
|
|
4586
4659
|
ProgressBar.displayName = "ProgressBar";
|
|
4587
4660
|
|
|
4588
4661
|
// src/components/LoadingOverlay.tsx
|
|
4589
|
-
var
|
|
4662
|
+
var React30 = __toESM(require("react"));
|
|
4590
4663
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4591
4664
|
var spinnerSizeMap = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
|
|
4592
4665
|
var logoSizeMap = { sm: 32, md: 40, lg: 56, xl: 80 };
|
|
4593
|
-
var LoadingOverlay =
|
|
4666
|
+
var LoadingOverlay = React30.forwardRef(
|
|
4594
4667
|
({
|
|
4595
4668
|
loading = true,
|
|
4596
4669
|
variant = "spinner",
|
|
@@ -4605,8 +4678,8 @@ var LoadingOverlay = React29.forwardRef(
|
|
|
4605
4678
|
children,
|
|
4606
4679
|
...props
|
|
4607
4680
|
}, ref) => {
|
|
4608
|
-
const [visible, setVisible] =
|
|
4609
|
-
|
|
4681
|
+
const [visible, setVisible] = React30.useState(delay === 0 && loading);
|
|
4682
|
+
React30.useEffect(() => {
|
|
4610
4683
|
if (!loading) {
|
|
4611
4684
|
setVisible(false);
|
|
4612
4685
|
return;
|
|
@@ -4618,8 +4691,14 @@ var LoadingOverlay = React29.forwardRef(
|
|
|
4618
4691
|
const timer = setTimeout(() => setVisible(true), delay);
|
|
4619
4692
|
return () => clearTimeout(timer);
|
|
4620
4693
|
}, [loading, delay]);
|
|
4694
|
+
if (!visible && mode === "inline") {
|
|
4695
|
+
return null;
|
|
4696
|
+
}
|
|
4621
4697
|
if (!visible) {
|
|
4622
|
-
return
|
|
4698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4699
|
+
children,
|
|
4700
|
+
null
|
|
4701
|
+
] });
|
|
4623
4702
|
}
|
|
4624
4703
|
const indicator = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4625
4704
|
variant === "spinner" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Spinner, { size: spinnerSizeMap[size] }),
|
|
@@ -4674,9 +4753,9 @@ var LoadingOverlay = React29.forwardRef(
|
|
|
4674
4753
|
LoadingOverlay.displayName = "LoadingOverlay";
|
|
4675
4754
|
|
|
4676
4755
|
// src/components/LoadingPage.tsx
|
|
4677
|
-
var
|
|
4756
|
+
var React31 = __toESM(require("react"));
|
|
4678
4757
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4679
|
-
var LoadingPage =
|
|
4758
|
+
var LoadingPage = React31.forwardRef(
|
|
4680
4759
|
({
|
|
4681
4760
|
loading = true,
|
|
4682
4761
|
message,
|
|
@@ -4687,8 +4766,8 @@ var LoadingPage = React30.forwardRef(
|
|
|
4687
4766
|
className,
|
|
4688
4767
|
...props
|
|
4689
4768
|
}, ref) => {
|
|
4690
|
-
const [visible, setVisible] =
|
|
4691
|
-
|
|
4769
|
+
const [visible, setVisible] = React31.useState(delay === 0 && loading);
|
|
4770
|
+
React31.useEffect(() => {
|
|
4692
4771
|
if (!loading) {
|
|
4693
4772
|
setVisible(false);
|
|
4694
4773
|
return;
|
|
@@ -4728,9 +4807,9 @@ var LoadingPage = React30.forwardRef(
|
|
|
4728
4807
|
LoadingPage.displayName = "LoadingPage";
|
|
4729
4808
|
|
|
4730
4809
|
// src/components/LoadingSection.tsx
|
|
4731
|
-
var
|
|
4810
|
+
var React32 = __toESM(require("react"));
|
|
4732
4811
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4733
|
-
var LoadingSection =
|
|
4812
|
+
var LoadingSection = React32.forwardRef(
|
|
4734
4813
|
({
|
|
4735
4814
|
loading = false,
|
|
4736
4815
|
variant = "spinner",
|
|
@@ -4772,9 +4851,9 @@ var LoadingSection = React31.forwardRef(
|
|
|
4772
4851
|
LoadingSection.displayName = "LoadingSection";
|
|
4773
4852
|
|
|
4774
4853
|
// src/components/LiveRegion.tsx
|
|
4775
|
-
var
|
|
4854
|
+
var React33 = __toESM(require("react"));
|
|
4776
4855
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4777
|
-
var LiveRegion =
|
|
4856
|
+
var LiveRegion = React33.forwardRef(
|
|
4778
4857
|
({ message, politeness = "polite", atomic = true, visuallyHidden = true, className, children }, ref) => {
|
|
4779
4858
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4780
4859
|
"div",
|
|
@@ -4795,9 +4874,9 @@ var LiveRegion = React32.forwardRef(
|
|
|
4795
4874
|
LiveRegion.displayName = "LiveRegion";
|
|
4796
4875
|
|
|
4797
4876
|
// src/components/SkipLink.tsx
|
|
4798
|
-
var
|
|
4877
|
+
var React34 = __toESM(require("react"));
|
|
4799
4878
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4800
|
-
var SkipLink =
|
|
4879
|
+
var SkipLink = React34.forwardRef(
|
|
4801
4880
|
({ targetId, className, children = "Skip to main content", onClick, ...props }, ref) => {
|
|
4802
4881
|
const handleClick = (e) => {
|
|
4803
4882
|
e.preventDefault();
|
|
@@ -4873,7 +4952,7 @@ function useReducedMotion() {
|
|
|
4873
4952
|
|
|
4874
4953
|
// src/hooks/useArrowNavigation.ts
|
|
4875
4954
|
var import_react4 = require("react");
|
|
4876
|
-
var DEFAULT_SELECTOR = '[role="menuitem"], [role="option"], [role="tab"], button, a, [tabindex]:not([tabindex="-1"])';
|
|
4955
|
+
var DEFAULT_SELECTOR = '[data-arrow-nav-item], [role="menuitem"], [role="option"], [role="tab"], button, a, [tabindex]:not([tabindex="-1"])';
|
|
4877
4956
|
function useArrowNavigation(options = {}) {
|
|
4878
4957
|
const {
|
|
4879
4958
|
orientation = "vertical",
|
|
@@ -4979,6 +5058,7 @@ function useArrowNavigation(options = {}) {
|
|
|
4979
5058
|
const tabStopIndex = focusedIndex === -1 ? 0 : focusedIndex;
|
|
4980
5059
|
const getItemProps = (0, import_react4.useCallback)(
|
|
4981
5060
|
(index) => ({
|
|
5061
|
+
"data-arrow-nav-item": true,
|
|
4982
5062
|
tabIndex: index === tabStopIndex ? 0 : -1,
|
|
4983
5063
|
onFocus: () => {
|
|
4984
5064
|
setFocusedIndex(index);
|
|
@@ -5067,7 +5147,7 @@ function useRovingTabindex(options = {}) {
|
|
|
5067
5147
|
onKeyDown: handleKeyDown
|
|
5068
5148
|
};
|
|
5069
5149
|
const getItemProps = (0, import_react5.useCallback)(
|
|
5070
|
-
(index) => ({
|
|
5150
|
+
(index, handlers = {}) => ({
|
|
5071
5151
|
"data-roving-tabindex-item": true,
|
|
5072
5152
|
tabIndex: index === activeIndex ? 0 : -1,
|
|
5073
5153
|
ref: (node) => {
|
|
@@ -5077,11 +5157,13 @@ function useRovingTabindex(options = {}) {
|
|
|
5077
5157
|
itemsRef.current.delete(index);
|
|
5078
5158
|
}
|
|
5079
5159
|
},
|
|
5080
|
-
onClick: () => {
|
|
5160
|
+
onClick: (event) => {
|
|
5161
|
+
handlers.onClick?.(event);
|
|
5081
5162
|
setActiveIndex(index);
|
|
5082
5163
|
onIndexChange?.(index);
|
|
5083
5164
|
},
|
|
5084
|
-
onFocus: () => {
|
|
5165
|
+
onFocus: (event) => {
|
|
5166
|
+
handlers.onFocus?.(event);
|
|
5085
5167
|
if (activeIndex !== index) {
|
|
5086
5168
|
setActiveIndex(index);
|
|
5087
5169
|
onIndexChange?.(index);
|
|
@@ -5103,21 +5185,21 @@ function useRovingTabindex(options = {}) {
|
|
|
5103
5185
|
}
|
|
5104
5186
|
|
|
5105
5187
|
// src/hooks/useClickOutside.ts
|
|
5106
|
-
var
|
|
5188
|
+
var React35 = __toESM(require("react"));
|
|
5107
5189
|
function useClickOutside(ref, callback, options) {
|
|
5108
5190
|
const {
|
|
5109
5191
|
enabled = true,
|
|
5110
5192
|
events = ["mousedown", "touchstart"],
|
|
5111
5193
|
ignoreElements = []
|
|
5112
5194
|
} = options ?? {};
|
|
5113
|
-
const callbackRef =
|
|
5114
|
-
const ignoreElementsRef =
|
|
5115
|
-
|
|
5195
|
+
const callbackRef = React35.useRef(callback);
|
|
5196
|
+
const ignoreElementsRef = React35.useRef(ignoreElements);
|
|
5197
|
+
React35.useEffect(() => {
|
|
5116
5198
|
callbackRef.current = callback;
|
|
5117
5199
|
ignoreElementsRef.current = ignoreElements;
|
|
5118
5200
|
}, [callback, ignoreElements]);
|
|
5119
5201
|
const eventsKey = events.join(",");
|
|
5120
|
-
|
|
5202
|
+
React35.useEffect(() => {
|
|
5121
5203
|
if (!enabled) return;
|
|
5122
5204
|
const handleEvent = (event) => {
|
|
5123
5205
|
const target = event.target;
|
|
@@ -5201,6 +5283,7 @@ function useClickOutside(ref, callback, options) {
|
|
|
5201
5283
|
badgeVariants,
|
|
5202
5284
|
buttonVariants,
|
|
5203
5285
|
cn,
|
|
5286
|
+
labelVariants,
|
|
5204
5287
|
pageHeaderActionsVariants,
|
|
5205
5288
|
pageHeaderContainerVariants,
|
|
5206
5289
|
pageHeaderSubtitleVariants,
|