@classic-homes/theme-react 0.2.3 → 0.3.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.d.mts +419 -1
- package/dist/index.d.ts +419 -1
- package/dist/index.js +1782 -264
- package/dist/index.mjs +1796 -292
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57,6 +57,8 @@ __export(index_exports, {
|
|
|
57
57
|
DialogTitle: () => DialogTitle,
|
|
58
58
|
DialogTrigger: () => DialogTrigger,
|
|
59
59
|
Input: () => Input,
|
|
60
|
+
InsertPalette: () => InsertPalette,
|
|
61
|
+
IssuesButton: () => IssuesButton,
|
|
60
62
|
Label: () => Label,
|
|
61
63
|
LiveRegion: () => LiveRegion,
|
|
62
64
|
LoadingLogo: () => LoadingLogo,
|
|
@@ -66,10 +68,21 @@ __export(index_exports, {
|
|
|
66
68
|
PageHeader: () => PageHeader,
|
|
67
69
|
PasswordInput: () => PasswordInput,
|
|
68
70
|
ProgressBar: () => ProgressBar,
|
|
71
|
+
SaveStatus: () => SaveStatus,
|
|
69
72
|
Separator: () => Separator,
|
|
73
|
+
Sheet: () => Sheet,
|
|
70
74
|
Skeleton: () => Skeleton,
|
|
71
75
|
SkipLink: () => SkipLink,
|
|
76
|
+
SortableList: () => SortableList,
|
|
72
77
|
Spinner: () => Spinner,
|
|
78
|
+
Studio: () => Studio,
|
|
79
|
+
StudioBar: () => StudioBar,
|
|
80
|
+
StudioCanvas: () => StudioCanvas,
|
|
81
|
+
StudioCanvasItem: () => StudioCanvasItem,
|
|
82
|
+
StudioInspector: () => StudioInspector,
|
|
83
|
+
StudioInspectorSection: () => StudioInspectorSection,
|
|
84
|
+
StudioOutline: () => StudioOutline,
|
|
85
|
+
StudioPage: () => StudioPage,
|
|
73
86
|
Switch: () => Switch,
|
|
74
87
|
badgeVariants: () => badgeVariants,
|
|
75
88
|
buttonVariants: () => buttonVariants,
|
|
@@ -89,7 +102,8 @@ __export(index_exports, {
|
|
|
89
102
|
useFocusRef: () => useFocusRef,
|
|
90
103
|
useFocusTrap: () => useFocusTrap,
|
|
91
104
|
useReducedMotion: () => useReducedMotion,
|
|
92
|
-
useRovingTabindex: () => useRovingTabindex
|
|
105
|
+
useRovingTabindex: () => useRovingTabindex,
|
|
106
|
+
useStudio: () => useStudio
|
|
93
107
|
});
|
|
94
108
|
module.exports = __toCommonJS(index_exports);
|
|
95
109
|
|
|
@@ -769,9 +783,1499 @@ var PageHeader = React12.forwardRef(
|
|
|
769
783
|
);
|
|
770
784
|
PageHeader.displayName = "PageHeader";
|
|
771
785
|
|
|
772
|
-
// src/components/
|
|
786
|
+
// src/components/Sheet.tsx
|
|
787
|
+
var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"));
|
|
788
|
+
var import_class_variance_authority5 = require("class-variance-authority");
|
|
789
|
+
|
|
790
|
+
// src/components/studio/icons.tsx
|
|
791
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
792
|
+
var PATHS = {
|
|
793
|
+
close: "M18 6 6 18M6 6l12 12",
|
|
794
|
+
plus: "M12 5v14M5 12h14",
|
|
795
|
+
"arrow-left": "M19 12H5M12 19l-7-7 7-7",
|
|
796
|
+
"arrow-up": "M12 19V5M5 12l7-7 7 7",
|
|
797
|
+
"arrow-down": "M12 5v14M19 12l-7 7-7-7",
|
|
798
|
+
"chevron-down": "m6 9 6 6 6-6",
|
|
799
|
+
"chevron-right": "m9 18 6-6-6-6",
|
|
800
|
+
"alert-triangle": "M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4M12 17h.01",
|
|
801
|
+
"alert-circle": "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM12 8v4M12 16h.01",
|
|
802
|
+
info: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM12 16v-4M12 8h.01",
|
|
803
|
+
"check-circle": "M22 11.08V12a10 10 0 1 1-5.93-9.14M22 4 12 14.01l-3-3",
|
|
804
|
+
loader: "M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83",
|
|
805
|
+
edit: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",
|
|
806
|
+
"wifi-off": "M2 2l20 20M8.5 16.5a5 5 0 0 1 7 0M2 8.82a15 15 0 0 1 4.17-2.65M10.66 5c4.01-.36 8.14.9 11.34 3.76M16.85 11.25a10 10 0 0 1 2.22 1.68M5 13a10 10 0 0 1 5.24-2.76M12 20h.01",
|
|
807
|
+
eye: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7ZM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
|
|
808
|
+
refresh: "M3 12a9 9 0 0 1 15-6.7L21 8M21 3v5h-5M21 12a9 9 0 0 1-15 6.7L3 16M3 21v-5h5",
|
|
809
|
+
list: "M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01",
|
|
810
|
+
settings: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z",
|
|
811
|
+
search: "M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.35-4.35",
|
|
812
|
+
monitor: "M4 3h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM8 21h8M12 17v4",
|
|
813
|
+
smartphone: "M7 2h10a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zM12 18h.01"
|
|
814
|
+
};
|
|
815
|
+
var DOTS = {
|
|
816
|
+
grip: [
|
|
817
|
+
[9, 5],
|
|
818
|
+
[15, 5],
|
|
819
|
+
[9, 12],
|
|
820
|
+
[15, 12],
|
|
821
|
+
[9, 19],
|
|
822
|
+
[15, 19]
|
|
823
|
+
],
|
|
824
|
+
"more-horizontal": [
|
|
825
|
+
[5, 12],
|
|
826
|
+
[12, 12],
|
|
827
|
+
[19, 12]
|
|
828
|
+
]
|
|
829
|
+
};
|
|
830
|
+
function StudioIcon({
|
|
831
|
+
name,
|
|
832
|
+
size = 16,
|
|
833
|
+
className
|
|
834
|
+
}) {
|
|
835
|
+
const dots = name === "grip" || name === "more-horizontal" ? DOTS[name] : null;
|
|
836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
837
|
+
"svg",
|
|
838
|
+
{
|
|
839
|
+
width: size,
|
|
840
|
+
height: size,
|
|
841
|
+
viewBox: "0 0 24 24",
|
|
842
|
+
fill: dots ? "currentColor" : "none",
|
|
843
|
+
stroke: dots ? "none" : "currentColor",
|
|
844
|
+
strokeWidth: 2,
|
|
845
|
+
strokeLinecap: "round",
|
|
846
|
+
strokeLinejoin: "round",
|
|
847
|
+
"aria-hidden": "true",
|
|
848
|
+
className: cn("shrink-0", className),
|
|
849
|
+
children: dots ? dots.map(([cx, cy]) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("circle", { cx, cy, r: 1.6 }, `${cx}-${cy}`)) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: PATHS[name] })
|
|
850
|
+
}
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
// src/components/Sheet.tsx
|
|
855
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
856
|
+
var sheetVariants = (0, import_class_variance_authority5.cva)(
|
|
857
|
+
"fixed z-50 flex flex-col border-border bg-background shadow-lg outline-none duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
858
|
+
{
|
|
859
|
+
variants: {
|
|
860
|
+
side: {
|
|
861
|
+
right: "inset-y-0 right-0 h-dvh w-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",
|
|
862
|
+
left: "inset-y-0 left-0 h-dvh w-full border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",
|
|
863
|
+
bottom: "inset-x-0 bottom-0 max-h-[85dvh] w-full rounded-t-xl border-t pb-[env(safe-area-inset-bottom)] data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"
|
|
864
|
+
},
|
|
865
|
+
size: { sm: "", md: "", lg: "" }
|
|
866
|
+
},
|
|
867
|
+
compoundVariants: [
|
|
868
|
+
{ side: ["left", "right"], size: "sm", className: "sm:max-w-xs" },
|
|
869
|
+
{ side: ["left", "right"], size: "md", className: "sm:max-w-md" },
|
|
870
|
+
{ side: ["left", "right"], size: "lg", className: "sm:max-w-xl" }
|
|
871
|
+
],
|
|
872
|
+
defaultVariants: { side: "right", size: "md" }
|
|
873
|
+
}
|
|
874
|
+
);
|
|
875
|
+
var closeClass = "flex h-9 w-9 items-center justify-center rounded-md text-muted-foreground hover:bg-muted-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
876
|
+
function Sheet({
|
|
877
|
+
open,
|
|
878
|
+
onOpenChange,
|
|
879
|
+
side = "right",
|
|
880
|
+
size = "md",
|
|
881
|
+
title,
|
|
882
|
+
hideTitle = false,
|
|
883
|
+
description,
|
|
884
|
+
headerActions,
|
|
885
|
+
footer,
|
|
886
|
+
children,
|
|
887
|
+
className
|
|
888
|
+
}) {
|
|
889
|
+
const close = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive2.Close, { className: closeClass, "aria-label": "Close", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(StudioIcon, { name: "close", size: 18 }) });
|
|
890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive2.Root, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(DialogPrimitive2.Portal, { children: [
|
|
891
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive2.Overlay, { className: "fixed inset-0 z-50 bg-foreground/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
893
|
+
DialogPrimitive2.Content,
|
|
894
|
+
{
|
|
895
|
+
className: cn(sheetVariants({ side, size }), className),
|
|
896
|
+
...description ? {} : { "aria-describedby": void 0 },
|
|
897
|
+
children: [
|
|
898
|
+
side === "bottom" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative flex h-6 shrink-0 items-center justify-center", children: [
|
|
899
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "h-1.5 w-10 rounded-full bg-muted", "aria-hidden": "true" }),
|
|
900
|
+
hideTitle && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute right-2 top-1", children: close })
|
|
901
|
+
] }),
|
|
902
|
+
hideTitle ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive2.Title, { className: "sr-only", children: title }),
|
|
904
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive2.Description, { className: "sr-only", children: description }),
|
|
905
|
+
side !== "bottom" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "absolute right-2 top-2 z-10", children: close })
|
|
906
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex shrink-0 items-start gap-3 border-b border-border px-4 py-3", children: [
|
|
907
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
908
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive2.Title, { className: "text-base font-semibold leading-tight", children: title }),
|
|
909
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DialogPrimitive2.Description, { className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
910
|
+
] }),
|
|
911
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "-mr-1 ml-auto flex shrink-0 items-center gap-1", children: [
|
|
912
|
+
headerActions,
|
|
913
|
+
close
|
|
914
|
+
] })
|
|
915
|
+
] }),
|
|
916
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain", children }),
|
|
917
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3", children: footer })
|
|
918
|
+
]
|
|
919
|
+
}
|
|
920
|
+
)
|
|
921
|
+
] }) });
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
// src/components/SortableList.tsx
|
|
925
|
+
var React13 = __toESM(require("react"));
|
|
926
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
927
|
+
function SortableList({
|
|
928
|
+
items,
|
|
929
|
+
getKey,
|
|
930
|
+
onReorder,
|
|
931
|
+
renderItem,
|
|
932
|
+
label,
|
|
933
|
+
getItemLabel = (_item, index) => `Item ${index + 1}`,
|
|
934
|
+
disabled = false,
|
|
935
|
+
className,
|
|
936
|
+
itemClassName
|
|
937
|
+
}) {
|
|
938
|
+
const instructionsId = `${React13.useId()}-sortable-help`;
|
|
939
|
+
const listRef = React13.useRef(null);
|
|
940
|
+
const [announcement, setAnnouncement] = React13.useState("");
|
|
941
|
+
const [drag, setDrag] = React13.useState(
|
|
942
|
+
null
|
|
943
|
+
);
|
|
944
|
+
const rects = React13.useRef([]);
|
|
945
|
+
const startY = React13.useRef(0);
|
|
946
|
+
const [grabbed, setGrabbed] = React13.useState(null);
|
|
947
|
+
const grabbedFrom = React13.useRef(0);
|
|
948
|
+
const moving = React13.useRef(false);
|
|
949
|
+
const pendingFocus = React13.useRef(null);
|
|
950
|
+
React13.useLayoutEffect(() => {
|
|
951
|
+
if (pendingFocus.current === null) return;
|
|
952
|
+
const handles = listRef.current?.querySelectorAll(
|
|
953
|
+
":scope > li [data-sortable-handle]"
|
|
954
|
+
);
|
|
955
|
+
handles?.[pendingFocus.current]?.focus();
|
|
956
|
+
pendingFocus.current = null;
|
|
957
|
+
moving.current = false;
|
|
958
|
+
});
|
|
959
|
+
const announce = (message) => {
|
|
960
|
+
setAnnouncement("");
|
|
961
|
+
queueMicrotask(() => setAnnouncement(message));
|
|
962
|
+
};
|
|
963
|
+
const positionText = (index) => `position ${index + 1} of ${items.length}`;
|
|
964
|
+
const move = (from, to, keepFocus = true) => {
|
|
965
|
+
if (to < 0 || to >= items.length || from === to) return;
|
|
966
|
+
const name = getItemLabel(items[from], from);
|
|
967
|
+
moving.current = keepFocus;
|
|
968
|
+
if (keepFocus) pendingFocus.current = to;
|
|
969
|
+
onReorder(from, to);
|
|
970
|
+
setGrabbed((g) => g === from ? to : g);
|
|
971
|
+
announce(`${name} moved to ${positionText(to)}.`);
|
|
972
|
+
};
|
|
973
|
+
const shiftFor = (index) => {
|
|
974
|
+
if (!drag) return 0;
|
|
975
|
+
const { from, over, offset } = drag;
|
|
976
|
+
if (index === from) return offset;
|
|
977
|
+
const r = rects.current;
|
|
978
|
+
const height = r[from]?.height ?? 0;
|
|
979
|
+
const gap = r.length > 1 ? Math.max(0, r[1].top - r[0].bottom) : 0;
|
|
980
|
+
if (from < over && index > from && index <= over) return -(height + gap);
|
|
981
|
+
if (from > over && index >= over && index < from) return height + gap;
|
|
982
|
+
return 0;
|
|
983
|
+
};
|
|
984
|
+
const endDrag = (commit) => {
|
|
985
|
+
const current = drag;
|
|
986
|
+
setDrag(null);
|
|
987
|
+
rects.current = [];
|
|
988
|
+
if (commit && current && current.from !== current.over) move(current.from, current.over, false);
|
|
989
|
+
};
|
|
990
|
+
const handleProps = (index, key, name) => ({
|
|
991
|
+
type: "button",
|
|
992
|
+
"aria-label": `Reorder ${name}`,
|
|
993
|
+
"aria-roledescription": "sortable handle",
|
|
994
|
+
"aria-describedby": instructionsId,
|
|
995
|
+
"aria-pressed": grabbed === index,
|
|
996
|
+
"data-sortable-handle": String(key),
|
|
997
|
+
onPointerDown(event) {
|
|
998
|
+
if (disabled || event.button !== 0 || !listRef.current) return;
|
|
999
|
+
event.preventDefault();
|
|
1000
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
1001
|
+
rects.current = Array.from(listRef.current.children, (c) => c.getBoundingClientRect());
|
|
1002
|
+
startY.current = event.clientY;
|
|
1003
|
+
setDrag({ from: index, over: index, offset: 0 });
|
|
1004
|
+
},
|
|
1005
|
+
onPointerMove(event) {
|
|
1006
|
+
if (!drag) return;
|
|
1007
|
+
const offset = event.clientY - startY.current;
|
|
1008
|
+
const origin = rects.current[drag.from];
|
|
1009
|
+
const center = origin.top + origin.height / 2 + offset;
|
|
1010
|
+
const over = rects.current.filter(
|
|
1011
|
+
(r, i) => i !== drag.from && r.top + r.height / 2 < center
|
|
1012
|
+
).length;
|
|
1013
|
+
setDrag({ ...drag, over, offset });
|
|
1014
|
+
},
|
|
1015
|
+
onPointerUp() {
|
|
1016
|
+
endDrag(true);
|
|
1017
|
+
},
|
|
1018
|
+
onPointerCancel() {
|
|
1019
|
+
endDrag(false);
|
|
1020
|
+
},
|
|
1021
|
+
onKeyDown(event) {
|
|
1022
|
+
if (disabled) return;
|
|
1023
|
+
const picked = grabbed === index;
|
|
1024
|
+
if (event.key === " " || event.key === "Enter") {
|
|
1025
|
+
event.preventDefault();
|
|
1026
|
+
if (picked) {
|
|
1027
|
+
setGrabbed(null);
|
|
1028
|
+
announce(`${name} dropped at ${positionText(index)}.`);
|
|
1029
|
+
} else {
|
|
1030
|
+
setGrabbed(index);
|
|
1031
|
+
grabbedFrom.current = index;
|
|
1032
|
+
announce(`${name} picked up at ${positionText(index)}. Use the arrow keys to move it.`);
|
|
1033
|
+
}
|
|
1034
|
+
} else if (event.key === "Escape" && picked) {
|
|
1035
|
+
event.preventDefault();
|
|
1036
|
+
event.stopPropagation();
|
|
1037
|
+
setGrabbed(null);
|
|
1038
|
+
if (index !== grabbedFrom.current) {
|
|
1039
|
+
moving.current = true;
|
|
1040
|
+
pendingFocus.current = grabbedFrom.current;
|
|
1041
|
+
onReorder(index, grabbedFrom.current);
|
|
1042
|
+
}
|
|
1043
|
+
announce(`Reorder cancelled. ${name} is back at ${positionText(grabbedFrom.current)}.`);
|
|
1044
|
+
} else if ((picked || event.altKey) && (event.key === "ArrowUp" || event.key === "ArrowDown")) {
|
|
1045
|
+
event.preventDefault();
|
|
1046
|
+
move(index, event.key === "ArrowUp" ? index - 1 : index + 1);
|
|
1047
|
+
} else if (picked && (event.key === "Home" || event.key === "End")) {
|
|
1048
|
+
event.preventDefault();
|
|
1049
|
+
move(index, event.key === "Home" ? 0 : items.length - 1);
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
onBlur() {
|
|
1053
|
+
if (!moving.current && grabbed === index) setGrabbed(null);
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { ref: listRef, "aria-label": label, className: cn("relative", className), children: items.map((item, index) => {
|
|
1058
|
+
const key = getKey(item, index);
|
|
1059
|
+
const dragging = drag?.from === index || grabbed === index;
|
|
1060
|
+
const shift = shiftFor(index);
|
|
1061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1062
|
+
"li",
|
|
1063
|
+
{
|
|
1064
|
+
className: cn(
|
|
1065
|
+
"relative",
|
|
1066
|
+
drag && drag.from !== index && "transition-transform duration-150",
|
|
1067
|
+
drag?.from === index && "z-10 opacity-90 shadow-lg",
|
|
1068
|
+
itemClassName
|
|
1069
|
+
),
|
|
1070
|
+
style: shift ? { transform: `translateY(${shift}px)` } : void 0,
|
|
1071
|
+
"data-dragging": dragging || void 0,
|
|
1072
|
+
children: renderItem({
|
|
1073
|
+
item,
|
|
1074
|
+
index,
|
|
1075
|
+
handle: handleProps(index, key, getItemLabel(item, index)),
|
|
1076
|
+
dragging
|
|
1077
|
+
})
|
|
1078
|
+
},
|
|
1079
|
+
key
|
|
1080
|
+
);
|
|
1081
|
+
}) }),
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { id: instructionsId, className: "sr-only", children: "Press Space or Enter to pick up, use the arrow keys to move, Space or Enter to drop, Escape to cancel." }),
|
|
1083
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "sr-only", role: "status", "aria-live": "assertive", "aria-atomic": "true", children: announcement })
|
|
1084
|
+
] });
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
// src/components/studio/Studio.tsx
|
|
1088
|
+
var React15 = __toESM(require("react"));
|
|
1089
|
+
|
|
1090
|
+
// src/components/studio/context.ts
|
|
773
1091
|
var React14 = __toESM(require("react"));
|
|
1092
|
+
var StudioContext = React14.createContext(void 0);
|
|
1093
|
+
function useStudio() {
|
|
1094
|
+
return React14.useContext(StudioContext);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// src/components/studio/Studio.tsx
|
|
1098
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1099
|
+
function useLayout() {
|
|
1100
|
+
const [layout, setLayout] = React15.useState("wide");
|
|
1101
|
+
React15.useEffect(() => {
|
|
1102
|
+
const wide = window.matchMedia("(min-width: 1280px)");
|
|
1103
|
+
const medium = window.matchMedia("(min-width: 768px)");
|
|
1104
|
+
const update = () => setLayout(wide.matches ? "wide" : medium.matches ? "medium" : "compact");
|
|
1105
|
+
update();
|
|
1106
|
+
wide.addEventListener("change", update);
|
|
1107
|
+
medium.addEventListener("change", update);
|
|
1108
|
+
return () => {
|
|
1109
|
+
wide.removeEventListener("change", update);
|
|
1110
|
+
medium.removeEventListener("change", update);
|
|
1111
|
+
};
|
|
1112
|
+
}, []);
|
|
1113
|
+
return layout;
|
|
1114
|
+
}
|
|
1115
|
+
function useControllable(value, onChange) {
|
|
1116
|
+
const [inner, setInner] = React15.useState(false);
|
|
1117
|
+
const current = value ?? inner;
|
|
1118
|
+
const set = React15.useCallback(
|
|
1119
|
+
(next) => {
|
|
1120
|
+
if (value === void 0) setInner(next);
|
|
1121
|
+
onChange?.(next);
|
|
1122
|
+
},
|
|
1123
|
+
[value, onChange]
|
|
1124
|
+
);
|
|
1125
|
+
return [current, set];
|
|
1126
|
+
}
|
|
1127
|
+
var floatingButton = "pointer-events-auto inline-flex h-9 items-center gap-2 rounded-full border border-border bg-background px-3 text-sm font-medium shadow-md hover:bg-muted-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
1128
|
+
function Studio({
|
|
1129
|
+
bar,
|
|
1130
|
+
banner,
|
|
1131
|
+
rail,
|
|
1132
|
+
canvas,
|
|
1133
|
+
inspector,
|
|
1134
|
+
railLabel = "Outline",
|
|
1135
|
+
inspectorLabel = "Properties",
|
|
1136
|
+
railOpen: railOpenProp,
|
|
1137
|
+
onRailOpenChange,
|
|
1138
|
+
inspectorOpen: inspectorOpenProp,
|
|
1139
|
+
onInspectorOpenChange,
|
|
1140
|
+
className
|
|
1141
|
+
}) {
|
|
1142
|
+
const layout = useLayout();
|
|
1143
|
+
const [railOpen, setRailOpen] = useControllable(railOpenProp, onRailOpenChange);
|
|
1144
|
+
const [inspectorOpen, setInspectorOpen] = useControllable(
|
|
1145
|
+
inspectorOpenProp,
|
|
1146
|
+
onInspectorOpenChange
|
|
1147
|
+
);
|
|
1148
|
+
const railInSheet = !!rail && layout !== "wide";
|
|
1149
|
+
const inspectorInSheet = !!inspector && layout === "compact";
|
|
1150
|
+
React15.useEffect(() => {
|
|
1151
|
+
if (layout === "wide" && railOpen) setRailOpen(false);
|
|
1152
|
+
if (layout !== "compact" && inspectorOpen) setInspectorOpen(false);
|
|
1153
|
+
}, [layout, railOpen, inspectorOpen, setRailOpen, setInspectorOpen]);
|
|
1154
|
+
const context = React15.useMemo(
|
|
1155
|
+
() => ({
|
|
1156
|
+
layout,
|
|
1157
|
+
railInSheet,
|
|
1158
|
+
inspectorInSheet,
|
|
1159
|
+
openRail: () => railInSheet && setRailOpen(true),
|
|
1160
|
+
closeRail: () => setRailOpen(false),
|
|
1161
|
+
revealInspector: () => {
|
|
1162
|
+
setRailOpen(false);
|
|
1163
|
+
if (inspectorInSheet) setInspectorOpen(true);
|
|
1164
|
+
},
|
|
1165
|
+
closeInspector: () => setInspectorOpen(false)
|
|
1166
|
+
}),
|
|
1167
|
+
[layout, railInSheet, inspectorInSheet, setRailOpen, setInspectorOpen]
|
|
1168
|
+
);
|
|
1169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(StudioContext.Provider, { value: context, children: [
|
|
1170
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1171
|
+
"div",
|
|
1172
|
+
{
|
|
1173
|
+
className: cn(
|
|
1174
|
+
"flex h-dvh flex-col overflow-hidden bg-background text-foreground",
|
|
1175
|
+
className
|
|
1176
|
+
),
|
|
1177
|
+
children: [
|
|
1178
|
+
bar,
|
|
1179
|
+
banner && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "shrink-0", children: banner }),
|
|
1180
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative flex min-h-0 flex-1", children: [
|
|
1181
|
+
rail && !railInSheet && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1182
|
+
"aside",
|
|
1183
|
+
{
|
|
1184
|
+
"aria-label": railLabel,
|
|
1185
|
+
className: "hidden w-64 shrink-0 flex-col overflow-hidden border-r border-border bg-background xl:flex",
|
|
1186
|
+
children: rail
|
|
1187
|
+
}
|
|
1188
|
+
),
|
|
1189
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative min-w-0 flex-1 overflow-hidden bg-muted/40", children: [
|
|
1190
|
+
canvas,
|
|
1191
|
+
(railInSheet || inspectorInSheet) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "pointer-events-none absolute inset-x-3 bottom-3 z-10 flex items-end justify-between gap-2", children: [
|
|
1192
|
+
railInSheet ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1193
|
+
"button",
|
|
1194
|
+
{
|
|
1195
|
+
type: "button",
|
|
1196
|
+
className: floatingButton,
|
|
1197
|
+
"aria-expanded": railOpen,
|
|
1198
|
+
onClick: () => setRailOpen(true),
|
|
1199
|
+
children: [
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StudioIcon, { name: "list" }),
|
|
1201
|
+
railLabel
|
|
1202
|
+
]
|
|
1203
|
+
}
|
|
1204
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", {}),
|
|
1205
|
+
inspectorInSheet && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1206
|
+
"button",
|
|
1207
|
+
{
|
|
1208
|
+
type: "button",
|
|
1209
|
+
className: floatingButton,
|
|
1210
|
+
"aria-expanded": inspectorOpen,
|
|
1211
|
+
onClick: () => setInspectorOpen(true),
|
|
1212
|
+
children: [
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StudioIcon, { name: "settings" }),
|
|
1214
|
+
inspectorLabel
|
|
1215
|
+
]
|
|
1216
|
+
}
|
|
1217
|
+
)
|
|
1218
|
+
] })
|
|
1219
|
+
] }),
|
|
1220
|
+
inspector && !inspectorInSheet && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1221
|
+
"aside",
|
|
1222
|
+
{
|
|
1223
|
+
"aria-label": inspectorLabel,
|
|
1224
|
+
className: "hidden w-80 shrink-0 flex-col overflow-hidden border-l border-border bg-background md:flex 2xl:w-96",
|
|
1225
|
+
children: inspector
|
|
1226
|
+
}
|
|
1227
|
+
)
|
|
1228
|
+
] })
|
|
1229
|
+
]
|
|
1230
|
+
}
|
|
1231
|
+
),
|
|
1232
|
+
rail && railInSheet && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Sheet, { open: railOpen, onOpenChange: setRailOpen, side: "left", size: "sm", title: railLabel, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex h-full flex-col", children: rail }) }),
|
|
1233
|
+
inspector && inspectorInSheet && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1234
|
+
Sheet,
|
|
1235
|
+
{
|
|
1236
|
+
open: inspectorOpen,
|
|
1237
|
+
onOpenChange: setInspectorOpen,
|
|
1238
|
+
side: "bottom",
|
|
1239
|
+
title: inspectorLabel,
|
|
1240
|
+
hideTitle: true,
|
|
1241
|
+
children: inspector
|
|
1242
|
+
}
|
|
1243
|
+
)
|
|
1244
|
+
] });
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
// src/components/studio/StudioBar.tsx
|
|
1248
|
+
var React16 = __toESM(require("react"));
|
|
1249
|
+
|
|
1250
|
+
// src/components/studio/menu.tsx
|
|
774
1251
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
1252
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1253
|
+
function StudioMenu({
|
|
1254
|
+
items,
|
|
1255
|
+
label,
|
|
1256
|
+
triggerClassName,
|
|
1257
|
+
children
|
|
1258
|
+
}) {
|
|
1259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownMenuPrimitive.Root, { children: [
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuPrimitive.Trigger, { className: triggerClassName, "aria-label": label, children }),
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1262
|
+
DropdownMenuPrimitive.Content,
|
|
1263
|
+
{
|
|
1264
|
+
align: "end",
|
|
1265
|
+
sideOffset: 4,
|
|
1266
|
+
collisionPadding: 8,
|
|
1267
|
+
className: "z-50 min-w-[10rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md",
|
|
1268
|
+
children: items.map(
|
|
1269
|
+
(item, i) => item.type === "separator" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuPrimitive.Separator, { className: "-mx-1 my-1 h-px bg-muted" }, i) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1270
|
+
DropdownMenuPrimitive.Item,
|
|
1271
|
+
{
|
|
1272
|
+
disabled: item.disabled,
|
|
1273
|
+
onSelect: () => item.onSelect?.(),
|
|
1274
|
+
className: cn(
|
|
1275
|
+
"relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50",
|
|
1276
|
+
item.destructive && "text-destructive data-[highlighted]:text-destructive"
|
|
1277
|
+
),
|
|
1278
|
+
children: [
|
|
1279
|
+
item.icon,
|
|
1280
|
+
item.label
|
|
1281
|
+
]
|
|
1282
|
+
},
|
|
1283
|
+
i
|
|
1284
|
+
)
|
|
1285
|
+
)
|
|
1286
|
+
}
|
|
1287
|
+
) })
|
|
1288
|
+
] });
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
// src/components/studio/StudioBar.tsx
|
|
1292
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1293
|
+
function ModeSwitch({
|
|
1294
|
+
modes,
|
|
1295
|
+
value,
|
|
1296
|
+
onChange
|
|
1297
|
+
}) {
|
|
1298
|
+
const refs = React16.useRef([]);
|
|
1299
|
+
const keyDown = (event, index) => {
|
|
1300
|
+
const step = event.key === "ArrowRight" || event.key === "ArrowDown" ? 1 : event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 0;
|
|
1301
|
+
if (!step) return;
|
|
1302
|
+
event.preventDefault();
|
|
1303
|
+
const next = (index + step + modes.length) % modes.length;
|
|
1304
|
+
onChange(modes[next].value);
|
|
1305
|
+
refs.current[next]?.focus();
|
|
1306
|
+
};
|
|
1307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1308
|
+
"div",
|
|
1309
|
+
{
|
|
1310
|
+
role: "radiogroup",
|
|
1311
|
+
"aria-label": "Editor mode",
|
|
1312
|
+
className: "flex h-9 w-full items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground md:w-auto",
|
|
1313
|
+
children: modes.map((m, i) => {
|
|
1314
|
+
const checked = m.value === value;
|
|
1315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1316
|
+
"button",
|
|
1317
|
+
{
|
|
1318
|
+
ref: (el) => {
|
|
1319
|
+
refs.current[i] = el;
|
|
1320
|
+
},
|
|
1321
|
+
type: "button",
|
|
1322
|
+
role: "radio",
|
|
1323
|
+
"aria-checked": checked,
|
|
1324
|
+
tabIndex: checked ? 0 : -1,
|
|
1325
|
+
onClick: () => onChange(m.value),
|
|
1326
|
+
onKeyDown: (e) => keyDown(e, i),
|
|
1327
|
+
className: cn(
|
|
1328
|
+
"inline-flex h-7 flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md px-2.5 text-sm font-medium hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring md:flex-none",
|
|
1329
|
+
checked && "bg-background text-foreground shadow-sm"
|
|
1330
|
+
),
|
|
1331
|
+
children: [
|
|
1332
|
+
m.icon,
|
|
1333
|
+
m.label
|
|
1334
|
+
]
|
|
1335
|
+
},
|
|
1336
|
+
m.value
|
|
1337
|
+
);
|
|
1338
|
+
})
|
|
1339
|
+
}
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
function StudioBar({
|
|
1343
|
+
title,
|
|
1344
|
+
onTitleInput,
|
|
1345
|
+
onTitleChange,
|
|
1346
|
+
titleReadonly = false,
|
|
1347
|
+
titlePlaceholder = "Untitled",
|
|
1348
|
+
subtitle,
|
|
1349
|
+
backHref,
|
|
1350
|
+
backLabel = "Back",
|
|
1351
|
+
modes,
|
|
1352
|
+
mode,
|
|
1353
|
+
onModeChange,
|
|
1354
|
+
status,
|
|
1355
|
+
issues,
|
|
1356
|
+
actions,
|
|
1357
|
+
menuItems,
|
|
1358
|
+
menuLabel = "More actions",
|
|
1359
|
+
className
|
|
1360
|
+
}) {
|
|
1361
|
+
const [draft, setDraft] = React16.useState(title);
|
|
1362
|
+
const atFocus = React16.useRef(title);
|
|
1363
|
+
React16.useEffect(() => setDraft(title), [title]);
|
|
1364
|
+
const commit = () => {
|
|
1365
|
+
const next = draft.trim();
|
|
1366
|
+
if (!next) {
|
|
1367
|
+
setDraft(atFocus.current);
|
|
1368
|
+
onTitleInput?.(atFocus.current);
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
if (next !== atFocus.current) onTitleChange?.(next);
|
|
1372
|
+
atFocus.current = next;
|
|
1373
|
+
};
|
|
1374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1375
|
+
"header",
|
|
1376
|
+
{
|
|
1377
|
+
className: cn(
|
|
1378
|
+
"flex shrink-0 flex-wrap items-center gap-x-2 gap-y-2 border-b border-border bg-background px-2 py-2 md:h-14 md:flex-nowrap md:gap-x-3 md:px-3 md:py-0",
|
|
1379
|
+
className
|
|
1380
|
+
),
|
|
1381
|
+
children: [
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-1 md:basis-0", children: [
|
|
1383
|
+
backHref && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1384
|
+
"a",
|
|
1385
|
+
{
|
|
1386
|
+
href: backHref,
|
|
1387
|
+
"aria-label": backLabel,
|
|
1388
|
+
title: backLabel,
|
|
1389
|
+
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1390
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StudioIcon, { name: "arrow-left", size: 18 })
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { className: titleReadonly ? "truncate px-1.5 text-base font-semibold" : "sr-only", children: title || titlePlaceholder }),
|
|
1395
|
+
!titleReadonly && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1396
|
+
"input",
|
|
1397
|
+
{
|
|
1398
|
+
value: draft,
|
|
1399
|
+
"aria-label": "Title",
|
|
1400
|
+
placeholder: titlePlaceholder,
|
|
1401
|
+
className: "block w-full max-w-md truncate rounded-md border border-transparent bg-transparent px-1.5 py-0.5 text-base font-semibold leading-tight outline-none hover:border-border focus:border-input focus:bg-background focus:ring-2 focus:ring-ring",
|
|
1402
|
+
onChange: (e) => {
|
|
1403
|
+
setDraft(e.target.value);
|
|
1404
|
+
onTitleInput?.(e.target.value);
|
|
1405
|
+
},
|
|
1406
|
+
onFocus: (e) => atFocus.current = e.target.value,
|
|
1407
|
+
onBlur: commit,
|
|
1408
|
+
onKeyDown: (e) => {
|
|
1409
|
+
if (e.key === "Enter") {
|
|
1410
|
+
e.preventDefault();
|
|
1411
|
+
e.currentTarget.blur();
|
|
1412
|
+
} else if (e.key === "Escape") {
|
|
1413
|
+
e.preventDefault();
|
|
1414
|
+
setDraft(atFocus.current);
|
|
1415
|
+
onTitleInput?.(atFocus.current);
|
|
1416
|
+
const input = e.currentTarget;
|
|
1417
|
+
requestAnimationFrame(() => input.blur());
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
),
|
|
1422
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "truncate px-1.5 text-xs text-muted-foreground", children: subtitle })
|
|
1423
|
+
] })
|
|
1424
|
+
] }),
|
|
1425
|
+
modes && modes.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "order-last flex w-full justify-center md:order-none md:w-auto", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1426
|
+
ModeSwitch,
|
|
1427
|
+
{
|
|
1428
|
+
modes,
|
|
1429
|
+
value: mode ?? modes[0].value,
|
|
1430
|
+
onChange: (v) => v !== mode && onModeChange?.(v)
|
|
1431
|
+
}
|
|
1432
|
+
) }),
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex shrink-0 items-center justify-end gap-1 md:flex-1 md:basis-0 md:gap-2", children: [
|
|
1434
|
+
status,
|
|
1435
|
+
issues,
|
|
1436
|
+
actions,
|
|
1437
|
+
menuItems && menuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1438
|
+
StudioMenu,
|
|
1439
|
+
{
|
|
1440
|
+
items: menuItems,
|
|
1441
|
+
label: menuLabel,
|
|
1442
|
+
triggerClassName: "flex h-9 w-9 items-center justify-center rounded-md text-muted-foreground hover:bg-muted-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1443
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StudioIcon, { name: "more-horizontal", size: 18 })
|
|
1444
|
+
}
|
|
1445
|
+
)
|
|
1446
|
+
] })
|
|
1447
|
+
]
|
|
1448
|
+
}
|
|
1449
|
+
);
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
// src/components/studio/StudioOutline.tsx
|
|
1453
|
+
var React17 = __toESM(require("react"));
|
|
1454
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1455
|
+
function StudioOutline({
|
|
1456
|
+
items,
|
|
1457
|
+
selected = null,
|
|
1458
|
+
onSelect,
|
|
1459
|
+
onReorder,
|
|
1460
|
+
menuItems,
|
|
1461
|
+
onAdd,
|
|
1462
|
+
addLabel = "Add",
|
|
1463
|
+
label = "Items",
|
|
1464
|
+
numbered = true,
|
|
1465
|
+
renderThumbnail,
|
|
1466
|
+
header,
|
|
1467
|
+
empty,
|
|
1468
|
+
className
|
|
1469
|
+
}) {
|
|
1470
|
+
const studio = useStudio();
|
|
1471
|
+
const listHost = React17.useRef(null);
|
|
1472
|
+
const focusIndex = Math.max(
|
|
1473
|
+
0,
|
|
1474
|
+
items.findIndex((i) => i.id === selected)
|
|
1475
|
+
);
|
|
1476
|
+
React17.useEffect(() => {
|
|
1477
|
+
if (!selected) return;
|
|
1478
|
+
listHost.current?.querySelector(`[data-outline-id="${CSS.escape(selected)}"]`)?.scrollIntoView?.({ block: "nearest" });
|
|
1479
|
+
}, [selected]);
|
|
1480
|
+
const select = (id) => {
|
|
1481
|
+
onSelect?.(id);
|
|
1482
|
+
studio?.revealInspector();
|
|
1483
|
+
};
|
|
1484
|
+
const rowKeyDown = (event, index) => {
|
|
1485
|
+
const rows = Array.from(
|
|
1486
|
+
listHost.current?.querySelectorAll("[data-outline-row]") ?? []
|
|
1487
|
+
);
|
|
1488
|
+
const next = event.key === "ArrowDown" ? Math.min(index + 1, rows.length - 1) : event.key === "ArrowUp" ? Math.max(index - 1, 0) : event.key === "Home" ? 0 : event.key === "End" ? rows.length - 1 : -1;
|
|
1489
|
+
if (next < 0) return;
|
|
1490
|
+
event.preventDefault();
|
|
1491
|
+
rows[next]?.focus();
|
|
1492
|
+
};
|
|
1493
|
+
const rowMenu = (entry, index) => {
|
|
1494
|
+
const own = menuItems?.(entry, index) ?? [];
|
|
1495
|
+
if (!onReorder) return own;
|
|
1496
|
+
const moves = [
|
|
1497
|
+
{
|
|
1498
|
+
label: "Move up",
|
|
1499
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioIcon, { name: "arrow-up" }),
|
|
1500
|
+
disabled: index === 0,
|
|
1501
|
+
onSelect: () => onReorder(index, index - 1)
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
label: "Move down",
|
|
1505
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioIcon, { name: "arrow-down" }),
|
|
1506
|
+
disabled: index === items.length - 1,
|
|
1507
|
+
onSelect: () => onReorder(index, index + 1)
|
|
1508
|
+
}
|
|
1509
|
+
];
|
|
1510
|
+
return own.length ? [...moves, { type: "separator" }, ...own] : moves;
|
|
1511
|
+
};
|
|
1512
|
+
const row = (entry, index, handle) => {
|
|
1513
|
+
const active = entry.id === selected;
|
|
1514
|
+
const menu = rowMenu(entry, index);
|
|
1515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1516
|
+
"div",
|
|
1517
|
+
{
|
|
1518
|
+
"data-outline-id": entry.id,
|
|
1519
|
+
className: cn(
|
|
1520
|
+
"group relative flex items-stretch gap-0.5 rounded-md",
|
|
1521
|
+
active ? "bg-primary/10 ring-1 ring-inset ring-primary/40" : "hover:bg-muted-hover"
|
|
1522
|
+
),
|
|
1523
|
+
children: [
|
|
1524
|
+
handle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1525
|
+
"button",
|
|
1526
|
+
{
|
|
1527
|
+
...handle,
|
|
1528
|
+
className: cn(
|
|
1529
|
+
"flex w-6 shrink-0 cursor-grab touch-none items-center justify-center rounded-l-md text-muted-foreground opacity-0 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing group-hover:opacity-100 aria-pressed:opacity-100 [@media(hover:none)]:opacity-100",
|
|
1530
|
+
active && "opacity-100"
|
|
1531
|
+
),
|
|
1532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioIcon, { name: "grip", size: 14 })
|
|
1533
|
+
}
|
|
1534
|
+
),
|
|
1535
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1536
|
+
"button",
|
|
1537
|
+
{
|
|
1538
|
+
type: "button",
|
|
1539
|
+
"data-outline-row": "",
|
|
1540
|
+
tabIndex: index === focusIndex ? 0 : -1,
|
|
1541
|
+
"aria-current": active ? "true" : void 0,
|
|
1542
|
+
className: cn(
|
|
1543
|
+
"flex min-w-0 flex-1 flex-col gap-1.5 rounded-md py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1544
|
+
!handle && "pl-2",
|
|
1545
|
+
entry.muted && "opacity-60"
|
|
1546
|
+
),
|
|
1547
|
+
onClick: () => select(entry.id),
|
|
1548
|
+
onKeyDown: (e) => rowKeyDown(e, index),
|
|
1549
|
+
children: [
|
|
1550
|
+
renderThumbnail && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "w-full overflow-hidden rounded border border-border bg-background", children: renderThumbnail(entry, index) }),
|
|
1551
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "flex min-w-0 items-start gap-2", children: [
|
|
1552
|
+
numbered && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "w-5 shrink-0 pt-px text-right text-xs tabular-nums text-muted-foreground", children: index + 1 }),
|
|
1553
|
+
entry.icon && !renderThumbnail && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "mt-px shrink-0 text-muted-foreground", "aria-hidden": "true", children: entry.icon }),
|
|
1554
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1556
|
+
"span",
|
|
1557
|
+
{
|
|
1558
|
+
className: cn("block truncate text-sm text-foreground", active && "font-medium"),
|
|
1559
|
+
children: entry.title || "Untitled"
|
|
1560
|
+
}
|
|
1561
|
+
),
|
|
1562
|
+
entry.subtitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "block truncate text-xs text-muted-foreground", children: entry.subtitle })
|
|
1563
|
+
] }),
|
|
1564
|
+
entry.badge && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "shrink-0 rounded bg-muted px-1.5 py-px text-[0.6875rem] text-muted-foreground", children: entry.badge }),
|
|
1565
|
+
!!entry.issues && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "inline-flex shrink-0 items-center gap-0.5 text-xs font-medium tabular-nums", children: [
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1567
|
+
StudioIcon,
|
|
1568
|
+
{
|
|
1569
|
+
name: "alert-triangle",
|
|
1570
|
+
size: 12,
|
|
1571
|
+
className: entry.issueSeverity === "warning" ? "text-warning" : "text-destructive"
|
|
1572
|
+
}
|
|
1573
|
+
),
|
|
1574
|
+
entry.issues,
|
|
1575
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "sr-only", children: entry.issues === 1 ? "issue" : "issues" })
|
|
1576
|
+
] })
|
|
1577
|
+
] })
|
|
1578
|
+
]
|
|
1579
|
+
}
|
|
1580
|
+
),
|
|
1581
|
+
menu.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1582
|
+
"div",
|
|
1583
|
+
{
|
|
1584
|
+
className: cn(
|
|
1585
|
+
"flex shrink-0 items-start pt-1 opacity-0 focus-within:opacity-100 group-hover:opacity-100 [@media(hover:none)]:opacity-100",
|
|
1586
|
+
active && "opacity-100"
|
|
1587
|
+
),
|
|
1588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1589
|
+
StudioMenu,
|
|
1590
|
+
{
|
|
1591
|
+
items: menu,
|
|
1592
|
+
label: `Actions for ${entry.title || `item ${index + 1}`}`,
|
|
1593
|
+
triggerClassName: "flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioIcon, { name: "more-horizontal" })
|
|
1595
|
+
}
|
|
1596
|
+
)
|
|
1597
|
+
}
|
|
1598
|
+
)
|
|
1599
|
+
]
|
|
1600
|
+
}
|
|
1601
|
+
);
|
|
1602
|
+
};
|
|
1603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: cn("flex h-full min-h-0 flex-col", className), children: [
|
|
1604
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 border-b border-border px-3 py-2", children: header }),
|
|
1605
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: listHost, className: "min-h-0 flex-1 overflow-y-auto p-2", children: items.length === 0 ? empty ?? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "px-2 py-6 text-center text-sm text-muted-foreground", children: "Nothing here yet." }) : onReorder ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1606
|
+
SortableList,
|
|
1607
|
+
{
|
|
1608
|
+
items,
|
|
1609
|
+
getKey: (e) => e.id,
|
|
1610
|
+
onReorder,
|
|
1611
|
+
label,
|
|
1612
|
+
getItemLabel: (e, i) => e.title || `item ${i + 1}`,
|
|
1613
|
+
className: "space-y-0.5",
|
|
1614
|
+
renderItem: ({ item, index, handle }) => row(item, index, handle)
|
|
1615
|
+
}
|
|
1616
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { "aria-label": label, className: "space-y-0.5", children: items.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { children: row(entry, index) }, entry.id)) }) }),
|
|
1617
|
+
onAdd && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "shrink-0 border-t border-border p-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1618
|
+
"button",
|
|
1619
|
+
{
|
|
1620
|
+
type: "button",
|
|
1621
|
+
onClick: onAdd,
|
|
1622
|
+
className: "flex h-9 w-full items-center justify-center gap-2 rounded-md border border-dashed border-border text-sm font-medium text-muted-foreground hover:border-primary hover:bg-primary/5 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1623
|
+
children: [
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(StudioIcon, { name: "plus" }),
|
|
1625
|
+
addLabel
|
|
1626
|
+
]
|
|
1627
|
+
}
|
|
1628
|
+
) })
|
|
1629
|
+
] });
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
// src/components/studio/StudioCanvas.tsx
|
|
1633
|
+
var React18 = __toESM(require("react"));
|
|
1634
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1635
|
+
function StudioCanvas({
|
|
1636
|
+
children,
|
|
1637
|
+
deviceToggle = false,
|
|
1638
|
+
device: deviceProp,
|
|
1639
|
+
onDeviceChange,
|
|
1640
|
+
maxWidth = "48rem",
|
|
1641
|
+
toolbar,
|
|
1642
|
+
label = "Canvas",
|
|
1643
|
+
onBackgroundClick,
|
|
1644
|
+
frameClassName,
|
|
1645
|
+
className
|
|
1646
|
+
}) {
|
|
1647
|
+
const studio = useStudio();
|
|
1648
|
+
const [innerDevice, setInnerDevice] = React18.useState("desktop");
|
|
1649
|
+
const device = deviceProp ?? innerDevice;
|
|
1650
|
+
const setDevice = (d) => {
|
|
1651
|
+
if (deviceProp === void 0) setInnerDevice(d);
|
|
1652
|
+
onDeviceChange?.(d);
|
|
1653
|
+
};
|
|
1654
|
+
const showDevices = deviceToggle && studio?.layout !== "compact";
|
|
1655
|
+
const width = device === "phone" && showDevices ? "390px" : maxWidth;
|
|
1656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { "aria-label": label, className: cn("flex h-full flex-col", className), children: [
|
|
1657
|
+
(showDevices || toolbar) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex shrink-0 items-center justify-end gap-2 px-3 pt-3", children: [
|
|
1658
|
+
toolbar,
|
|
1659
|
+
showDevices && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1660
|
+
"div",
|
|
1661
|
+
{
|
|
1662
|
+
role: "radiogroup",
|
|
1663
|
+
"aria-label": "Preview size",
|
|
1664
|
+
className: "inline-flex h-9 items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground",
|
|
1665
|
+
children: ["desktop", "phone"].map((d) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1666
|
+
"button",
|
|
1667
|
+
{
|
|
1668
|
+
type: "button",
|
|
1669
|
+
role: "radio",
|
|
1670
|
+
"aria-checked": device === d,
|
|
1671
|
+
onClick: () => setDevice(d),
|
|
1672
|
+
className: cn(
|
|
1673
|
+
"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",
|
|
1674
|
+
device === d && "bg-background text-foreground shadow-sm"
|
|
1675
|
+
),
|
|
1676
|
+
children: [
|
|
1677
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StudioIcon, { name: d === "desktop" ? "monitor" : "smartphone" }),
|
|
1678
|
+
d === "desktop" ? "Desktop" : "Phone"
|
|
1679
|
+
]
|
|
1680
|
+
},
|
|
1681
|
+
d
|
|
1682
|
+
))
|
|
1683
|
+
}
|
|
1684
|
+
)
|
|
1685
|
+
] }),
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1687
|
+
"div",
|
|
1688
|
+
{
|
|
1689
|
+
className: "min-h-0 flex-1 overflow-y-auto px-3 pb-20 pt-3 md:px-6 md:pb-10",
|
|
1690
|
+
onClick: (e) => {
|
|
1691
|
+
if (e.target === e.currentTarget) onBackgroundClick?.();
|
|
1692
|
+
},
|
|
1693
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1694
|
+
"div",
|
|
1695
|
+
{
|
|
1696
|
+
className: cn(
|
|
1697
|
+
"mx-auto w-full rounded-lg border border-border bg-background shadow-sm transition-[max-width] duration-200",
|
|
1698
|
+
frameClassName
|
|
1699
|
+
),
|
|
1700
|
+
style: { maxWidth: width },
|
|
1701
|
+
children
|
|
1702
|
+
}
|
|
1703
|
+
)
|
|
1704
|
+
}
|
|
1705
|
+
)
|
|
1706
|
+
] });
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
// src/components/studio/StudioCanvasItem.tsx
|
|
1710
|
+
var React19 = __toESM(require("react"));
|
|
1711
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1712
|
+
function StudioCanvasItem({
|
|
1713
|
+
children,
|
|
1714
|
+
selected = false,
|
|
1715
|
+
onSelect,
|
|
1716
|
+
label,
|
|
1717
|
+
toolbar,
|
|
1718
|
+
onInsert,
|
|
1719
|
+
insertLabel,
|
|
1720
|
+
invalid = false,
|
|
1721
|
+
className
|
|
1722
|
+
}) {
|
|
1723
|
+
const studio = useStudio();
|
|
1724
|
+
const ref = React19.useRef(null);
|
|
1725
|
+
const inQuickAction = (target) => !!target?.closest?.("[data-studio-quick-action]");
|
|
1726
|
+
const select = (reveal) => {
|
|
1727
|
+
if (!selected) onSelect?.();
|
|
1728
|
+
if (reveal) studio?.revealInspector();
|
|
1729
|
+
};
|
|
1730
|
+
React19.useEffect(() => {
|
|
1731
|
+
const el = ref.current;
|
|
1732
|
+
if (!selected || !el || el.contains(document.activeElement)) return;
|
|
1733
|
+
const reduce = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
1734
|
+
el.scrollIntoView?.({ block: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
1735
|
+
}, [selected]);
|
|
1736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1737
|
+
"div",
|
|
1738
|
+
{
|
|
1739
|
+
ref,
|
|
1740
|
+
role: "group",
|
|
1741
|
+
"aria-label": label,
|
|
1742
|
+
"aria-current": selected ? "true" : void 0,
|
|
1743
|
+
"data-selected": selected || void 0,
|
|
1744
|
+
className: cn(
|
|
1745
|
+
"group/item relative scroll-my-6 rounded-lg transition-shadow",
|
|
1746
|
+
// Problems are a dashed amber outline: with a red brand primary, a red
|
|
1747
|
+
// ring would read as "selected"
|
|
1748
|
+
selected ? "ring-2 ring-primary" : "hover:ring-1 hover:ring-border",
|
|
1749
|
+
invalid && "-outline-offset-2 outline-dashed outline-2 outline-warning/70",
|
|
1750
|
+
className
|
|
1751
|
+
),
|
|
1752
|
+
onClickCapture: (e) => select(!inQuickAction(e.target)),
|
|
1753
|
+
onFocus: (e) => {
|
|
1754
|
+
if (!inQuickAction(e.target)) select(false);
|
|
1755
|
+
},
|
|
1756
|
+
children: [
|
|
1757
|
+
!selected && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1758
|
+
"button",
|
|
1759
|
+
{
|
|
1760
|
+
type: "button",
|
|
1761
|
+
className: "sr-only left-2 top-2 z-10 rounded-md bg-primary px-2 py-1 text-xs font-medium text-primary-foreground focus:not-sr-only focus:absolute",
|
|
1762
|
+
onClick: () => select(true),
|
|
1763
|
+
children: [
|
|
1764
|
+
"Edit ",
|
|
1765
|
+
label
|
|
1766
|
+
]
|
|
1767
|
+
}
|
|
1768
|
+
),
|
|
1769
|
+
selected && toolbar && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1770
|
+
"div",
|
|
1771
|
+
{
|
|
1772
|
+
"data-studio-quick-action": "",
|
|
1773
|
+
className: "absolute -top-4 right-3 z-10 flex items-center gap-0.5 rounded-md border border-border bg-background p-0.5 shadow-md",
|
|
1774
|
+
children: toolbar
|
|
1775
|
+
}
|
|
1776
|
+
),
|
|
1777
|
+
children,
|
|
1778
|
+
onInsert && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "relative h-0", "data-studio-quick-action": "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1779
|
+
"button",
|
|
1780
|
+
{
|
|
1781
|
+
type: "button",
|
|
1782
|
+
"aria-label": insertLabel ?? `Add below ${label}`,
|
|
1783
|
+
title: insertLabel ?? "Add below",
|
|
1784
|
+
className: cn(
|
|
1785
|
+
"absolute left-1/2 top-0 z-10 flex h-7 w-7 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 shadow-sm hover:border-primary hover:text-primary focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/item:opacity-100 [@media(hover:none)]:opacity-100",
|
|
1786
|
+
selected && "opacity-100"
|
|
1787
|
+
),
|
|
1788
|
+
onClick: (e) => {
|
|
1789
|
+
e.stopPropagation();
|
|
1790
|
+
onInsert();
|
|
1791
|
+
},
|
|
1792
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StudioIcon, { name: "plus", size: 14 })
|
|
1793
|
+
}
|
|
1794
|
+
) })
|
|
1795
|
+
]
|
|
1796
|
+
}
|
|
1797
|
+
);
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
// src/components/studio/StudioInspector.tsx
|
|
1801
|
+
var React20 = __toESM(require("react"));
|
|
1802
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1803
|
+
function StudioInspector({
|
|
1804
|
+
title,
|
|
1805
|
+
description,
|
|
1806
|
+
headerActions,
|
|
1807
|
+
tabs,
|
|
1808
|
+
tab: tabProp,
|
|
1809
|
+
onTabChange,
|
|
1810
|
+
children,
|
|
1811
|
+
footer,
|
|
1812
|
+
className
|
|
1813
|
+
}) {
|
|
1814
|
+
const uid = React20.useId();
|
|
1815
|
+
const [innerTab, setInnerTab] = React20.useState(tabs?.[0]?.id ?? "");
|
|
1816
|
+
const tab = tabProp ?? innerTab;
|
|
1817
|
+
const hasTabs = !!tabs && tabs.length > 1;
|
|
1818
|
+
const choose = (id) => {
|
|
1819
|
+
if (id === tab) return;
|
|
1820
|
+
if (tabProp === void 0) setInnerTab(id);
|
|
1821
|
+
onTabChange?.(id);
|
|
1822
|
+
};
|
|
1823
|
+
const keyDown = (event, index) => {
|
|
1824
|
+
if (!tabs) return;
|
|
1825
|
+
const step = event.key === "ArrowRight" ? 1 : event.key === "ArrowLeft" ? -1 : 0;
|
|
1826
|
+
if (!step) return;
|
|
1827
|
+
event.preventDefault();
|
|
1828
|
+
const next = tabs[(index + step + tabs.length) % tabs.length];
|
|
1829
|
+
choose(next.id);
|
|
1830
|
+
document.getElementById(`${uid}-tab-${next.id}`)?.focus();
|
|
1831
|
+
};
|
|
1832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cn("flex h-full min-h-0 flex-col", className), children: [
|
|
1833
|
+
(title || headerActions) && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex shrink-0 items-start gap-2 border-b border-border px-4 py-3", children: [
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
1835
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { className: "truncate text-sm font-semibold", children: title }),
|
|
1836
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: description })
|
|
1837
|
+
] }),
|
|
1838
|
+
headerActions && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions })
|
|
1839
|
+
] }),
|
|
1840
|
+
hasTabs && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1841
|
+
"div",
|
|
1842
|
+
{
|
|
1843
|
+
role: "tablist",
|
|
1844
|
+
"aria-label": title ?? "Inspector",
|
|
1845
|
+
className: "flex shrink-0 gap-4 border-b border-border px-4",
|
|
1846
|
+
children: tabs.map((t, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1847
|
+
"button",
|
|
1848
|
+
{
|
|
1849
|
+
type: "button",
|
|
1850
|
+
role: "tab",
|
|
1851
|
+
id: `${uid}-tab-${t.id}`,
|
|
1852
|
+
"aria-selected": t.id === tab,
|
|
1853
|
+
"aria-controls": `${uid}-panel`,
|
|
1854
|
+
tabIndex: t.id === tab ? 0 : -1,
|
|
1855
|
+
onClick: () => choose(t.id),
|
|
1856
|
+
onKeyDown: (e) => keyDown(e, index),
|
|
1857
|
+
className: cn(
|
|
1858
|
+
"-mb-px border-b-2 py-2 text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1859
|
+
t.id === tab ? "border-primary text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
1860
|
+
),
|
|
1861
|
+
children: [
|
|
1862
|
+
t.label,
|
|
1863
|
+
!!t.count && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "ml-1 rounded-full bg-muted px-1.5 text-xs tabular-nums", children: t.count })
|
|
1864
|
+
]
|
|
1865
|
+
},
|
|
1866
|
+
t.id
|
|
1867
|
+
))
|
|
1868
|
+
}
|
|
1869
|
+
),
|
|
1870
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1871
|
+
"div",
|
|
1872
|
+
{
|
|
1873
|
+
className: "min-h-0 flex-1 overflow-y-auto",
|
|
1874
|
+
id: hasTabs ? `${uid}-panel` : void 0,
|
|
1875
|
+
role: hasTabs ? "tabpanel" : void 0,
|
|
1876
|
+
"aria-labelledby": hasTabs ? `${uid}-tab-${tab}` : void 0,
|
|
1877
|
+
children
|
|
1878
|
+
}
|
|
1879
|
+
),
|
|
1880
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "shrink-0 border-t border-border px-4 py-3", children: footer })
|
|
1881
|
+
] });
|
|
1882
|
+
}
|
|
1883
|
+
function StudioInspectorSection({
|
|
1884
|
+
title,
|
|
1885
|
+
description,
|
|
1886
|
+
collapsible = false,
|
|
1887
|
+
defaultOpen = false,
|
|
1888
|
+
summary,
|
|
1889
|
+
children,
|
|
1890
|
+
className
|
|
1891
|
+
}) {
|
|
1892
|
+
const uid = React20.useId();
|
|
1893
|
+
const [open, setOpen] = React20.useState(defaultOpen);
|
|
1894
|
+
const expanded = !collapsible || open;
|
|
1895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1896
|
+
"section",
|
|
1897
|
+
{
|
|
1898
|
+
className: cn("border-b border-border px-4 py-4 last:border-b-0", className),
|
|
1899
|
+
"aria-labelledby": title ? `${uid}-title` : void 0,
|
|
1900
|
+
children: [
|
|
1901
|
+
title && (collapsible ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { id: `${uid}-title`, className: "-my-1", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1902
|
+
"button",
|
|
1903
|
+
{
|
|
1904
|
+
type: "button",
|
|
1905
|
+
"aria-expanded": open,
|
|
1906
|
+
"aria-controls": `${uid}-body`,
|
|
1907
|
+
onClick: () => setOpen(!open),
|
|
1908
|
+
className: "flex w-full items-center gap-2 rounded-md py-1 text-left text-sm font-semibold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1909
|
+
children: [
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1911
|
+
StudioIcon,
|
|
1912
|
+
{
|
|
1913
|
+
name: "chevron-right",
|
|
1914
|
+
className: cn("text-muted-foreground transition-transform", open && "rotate-90")
|
|
1915
|
+
}
|
|
1916
|
+
),
|
|
1917
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1", children: title }),
|
|
1918
|
+
summary && !open && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-normal text-muted-foreground", children: summary })
|
|
1919
|
+
]
|
|
1920
|
+
}
|
|
1921
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { id: `${uid}-title`, className: "text-sm font-semibold", children: title })),
|
|
1922
|
+
title && description && expanded && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: description }),
|
|
1923
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { id: `${uid}-body`, className: cn("space-y-4", title && "mt-3"), children })
|
|
1924
|
+
]
|
|
1925
|
+
}
|
|
1926
|
+
);
|
|
1927
|
+
}
|
|
1928
|
+
function StudioPage({
|
|
1929
|
+
title,
|
|
1930
|
+
description,
|
|
1931
|
+
children,
|
|
1932
|
+
maxWidth = "42rem",
|
|
1933
|
+
className
|
|
1934
|
+
}) {
|
|
1935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "h-full overflow-y-auto bg-muted/40", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1936
|
+
"div",
|
|
1937
|
+
{
|
|
1938
|
+
className: cn("mx-auto w-full space-y-6 px-4 py-6 md:py-10", className),
|
|
1939
|
+
style: { maxWidth },
|
|
1940
|
+
children: [
|
|
1941
|
+
(title || description) && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
1942
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { className: "text-xl font-semibold", children: title }),
|
|
1943
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
1944
|
+
] }),
|
|
1945
|
+
children
|
|
1946
|
+
]
|
|
1947
|
+
}
|
|
1948
|
+
) });
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
// src/components/studio/SaveStatus.tsx
|
|
1952
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
1953
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1954
|
+
var META = {
|
|
1955
|
+
saved: { label: "Saved", icon: "check-circle", tone: "text-muted-foreground" },
|
|
1956
|
+
saving: { label: "Saving\u2026", icon: "loader", tone: "text-muted-foreground" },
|
|
1957
|
+
unsaved: { label: "Unsaved", icon: "edit", tone: "text-muted-foreground" },
|
|
1958
|
+
error: { label: "Not saved", icon: "alert-circle", tone: "text-destructive" },
|
|
1959
|
+
offline: { label: "Offline", icon: "wifi-off", tone: "text-warning" },
|
|
1960
|
+
conflict: { label: "Conflict", icon: "alert-triangle", tone: "text-destructive" },
|
|
1961
|
+
invalid: { label: "Needs fixes", icon: "alert-triangle", tone: "text-warning" },
|
|
1962
|
+
readonly: { label: "View only", icon: "eye", tone: "text-muted-foreground" }
|
|
1963
|
+
};
|
|
1964
|
+
var chip = "inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-sm font-medium text-foreground";
|
|
1965
|
+
function SaveStatus({ state, detail, onRetry, label, className }) {
|
|
1966
|
+
const meta = META[state];
|
|
1967
|
+
const text = label ?? meta.label;
|
|
1968
|
+
const canRetry = !!onRetry && (state === "error" || state === "offline");
|
|
1969
|
+
const announced = ["error", "offline", "conflict", "invalid"].includes(state);
|
|
1970
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1971
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1972
|
+
StudioIcon,
|
|
1973
|
+
{
|
|
1974
|
+
name: meta.icon,
|
|
1975
|
+
className: cn(meta.tone, state === "saving" && "animate-spin")
|
|
1976
|
+
}
|
|
1977
|
+
),
|
|
1978
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "sr-only sm:not-sr-only", children: text })
|
|
1979
|
+
] });
|
|
1980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("inline-flex", className), children: [
|
|
1981
|
+
detail || canRetry ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(PopoverPrimitive.Root, { children: [
|
|
1982
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1983
|
+
PopoverPrimitive.Trigger,
|
|
1984
|
+
{
|
|
1985
|
+
className: cn(
|
|
1986
|
+
chip,
|
|
1987
|
+
"hover:bg-muted-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
1988
|
+
),
|
|
1989
|
+
"aria-label": `Save status: ${text}. Show details`,
|
|
1990
|
+
children: [
|
|
1991
|
+
content,
|
|
1992
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StudioIcon, { name: "chevron-down", size: 14, className: "text-muted-foreground" })
|
|
1993
|
+
]
|
|
1994
|
+
}
|
|
1995
|
+
),
|
|
1996
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1997
|
+
PopoverPrimitive.Content,
|
|
1998
|
+
{
|
|
1999
|
+
align: "end",
|
|
2000
|
+
sideOffset: 6,
|
|
2001
|
+
collisionPadding: 8,
|
|
2002
|
+
className: "z-50 w-72 rounded-md border border-border bg-popover p-3 text-sm text-popover-foreground shadow-md",
|
|
2003
|
+
children: [
|
|
2004
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "font-medium", children: text }),
|
|
2005
|
+
detail && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mt-1 text-muted-foreground", children: detail }),
|
|
2006
|
+
canRetry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2007
|
+
"button",
|
|
2008
|
+
{
|
|
2009
|
+
type: "button",
|
|
2010
|
+
onClick: onRetry,
|
|
2011
|
+
className: "mt-3 inline-flex h-9 items-center gap-2 rounded-md border-2 border-secondary-border bg-secondary px-3 text-sm font-medium text-secondary-foreground hover:bg-secondary-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2012
|
+
children: [
|
|
2013
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StudioIcon, { name: "refresh", size: 14 }),
|
|
2014
|
+
"Retry"
|
|
2015
|
+
]
|
|
2016
|
+
}
|
|
2017
|
+
)
|
|
2018
|
+
]
|
|
2019
|
+
}
|
|
2020
|
+
) })
|
|
2021
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: chip, children: content }),
|
|
2022
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "sr-only", role: "status", "aria-live": "polite", children: announced ? text : "" })
|
|
2023
|
+
] });
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
// src/components/studio/IssuesButton.tsx
|
|
2027
|
+
var React21 = __toESM(require("react"));
|
|
2028
|
+
var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"));
|
|
2029
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2030
|
+
var plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
2031
|
+
function IssuesButton({
|
|
2032
|
+
issues,
|
|
2033
|
+
onSelect,
|
|
2034
|
+
open: openProp,
|
|
2035
|
+
onOpenChange,
|
|
2036
|
+
title = "Before you publish",
|
|
2037
|
+
showWhenEmpty = false,
|
|
2038
|
+
className
|
|
2039
|
+
}) {
|
|
2040
|
+
const [innerOpen, setInnerOpen] = React21.useState(false);
|
|
2041
|
+
const open = openProp ?? innerOpen;
|
|
2042
|
+
const setOpen = (next) => {
|
|
2043
|
+
if (openProp === void 0) setInnerOpen(next);
|
|
2044
|
+
onOpenChange?.(next);
|
|
2045
|
+
};
|
|
2046
|
+
const errors = issues.filter((i) => (i.severity ?? "error") === "error");
|
|
2047
|
+
const warnings = issues.filter((i) => i.severity === "warning");
|
|
2048
|
+
const countLabel = [
|
|
2049
|
+
errors.length ? `${plural(errors.length, "issue", "issues")} to fix` : "",
|
|
2050
|
+
warnings.length ? plural(warnings.length, "suggestion", "suggestions") : ""
|
|
2051
|
+
].filter(Boolean).join(", ");
|
|
2052
|
+
if (issues.length === 0) {
|
|
2053
|
+
return showWhenEmpty ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2054
|
+
"span",
|
|
2055
|
+
{
|
|
2056
|
+
className: cn(
|
|
2057
|
+
"inline-flex h-8 items-center gap-1.5 px-2 text-sm text-muted-foreground",
|
|
2058
|
+
className
|
|
2059
|
+
),
|
|
2060
|
+
children: [
|
|
2061
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StudioIcon, { name: "check-circle", className: "text-success" }),
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only sm:not-sr-only", children: "No issues" })
|
|
2063
|
+
]
|
|
2064
|
+
}
|
|
2065
|
+
) : null;
|
|
2066
|
+
}
|
|
2067
|
+
const group = (list, heading, error) => list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "px-3 pb-1 pt-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: heading }),
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ul", { className: "pb-1", children: list.map((issue) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2070
|
+
"button",
|
|
2071
|
+
{
|
|
2072
|
+
type: "button",
|
|
2073
|
+
className: "flex w-full items-start gap-2 px-3 py-2 text-left text-sm hover:bg-muted-hover focus-visible:bg-muted-hover focus-visible:outline-none",
|
|
2074
|
+
onClick: () => {
|
|
2075
|
+
setOpen(false);
|
|
2076
|
+
onSelect?.(issue);
|
|
2077
|
+
},
|
|
2078
|
+
children: [
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2080
|
+
StudioIcon,
|
|
2081
|
+
{
|
|
2082
|
+
name: error ? "alert-circle" : "info",
|
|
2083
|
+
className: cn("mt-0.5", error ? "text-destructive" : "text-warning")
|
|
2084
|
+
}
|
|
2085
|
+
),
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
2087
|
+
issue.location && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "block text-xs text-muted-foreground", children: issue.location }),
|
|
2088
|
+
issue.message
|
|
2089
|
+
] })
|
|
2090
|
+
]
|
|
2091
|
+
}
|
|
2092
|
+
) }, issue.id)) })
|
|
2093
|
+
] });
|
|
2094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(PopoverPrimitive2.Root, { open, onOpenChange: setOpen, children: [
|
|
2095
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2096
|
+
PopoverPrimitive2.Trigger,
|
|
2097
|
+
{
|
|
2098
|
+
"aria-label": countLabel,
|
|
2099
|
+
className: cn(
|
|
2100
|
+
"inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-sm font-medium hover:bg-muted-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2101
|
+
className
|
|
2102
|
+
),
|
|
2103
|
+
children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2105
|
+
StudioIcon,
|
|
2106
|
+
{
|
|
2107
|
+
name: "alert-triangle",
|
|
2108
|
+
className: errors.length ? "text-destructive" : "text-warning"
|
|
2109
|
+
}
|
|
2110
|
+
),
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": "true", children: issues.length })
|
|
2112
|
+
]
|
|
2113
|
+
}
|
|
2114
|
+
),
|
|
2115
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2116
|
+
PopoverPrimitive2.Content,
|
|
2117
|
+
{
|
|
2118
|
+
align: "end",
|
|
2119
|
+
sideOffset: 6,
|
|
2120
|
+
collisionPadding: 8,
|
|
2121
|
+
className: "z-50 flex max-h-[min(28rem,70dvh)] w-80 flex-col overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md",
|
|
2122
|
+
children: [
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "border-b border-border px-3 py-2", children: [
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-semibold", children: title }),
|
|
2125
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-muted-foreground", children: countLabel })
|
|
2126
|
+
] }),
|
|
2127
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "overflow-y-auto", children: [
|
|
2128
|
+
group(errors, "Must fix", true),
|
|
2129
|
+
group(warnings, "Suggestions", false)
|
|
2130
|
+
] })
|
|
2131
|
+
]
|
|
2132
|
+
}
|
|
2133
|
+
) })
|
|
2134
|
+
] });
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
// src/components/studio/InsertPalette.tsx
|
|
2138
|
+
var React22 = __toESM(require("react"));
|
|
2139
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2140
|
+
function InsertPalette({
|
|
2141
|
+
open,
|
|
2142
|
+
onOpenChange,
|
|
2143
|
+
groups,
|
|
2144
|
+
onSelect,
|
|
2145
|
+
title = "Add",
|
|
2146
|
+
description,
|
|
2147
|
+
searchPlaceholder = "Search",
|
|
2148
|
+
renderThumbnail
|
|
2149
|
+
}) {
|
|
2150
|
+
const [query, setQuery] = React22.useState("");
|
|
2151
|
+
const listRef = React22.useRef(null);
|
|
2152
|
+
const searchRef = React22.useRef(null);
|
|
2153
|
+
React22.useEffect(() => {
|
|
2154
|
+
if (open) setQuery("");
|
|
2155
|
+
}, [open]);
|
|
2156
|
+
const q = query.trim().toLowerCase();
|
|
2157
|
+
const filtered = q ? groups.map((g) => ({
|
|
2158
|
+
...g,
|
|
2159
|
+
items: g.items.filter(
|
|
2160
|
+
(item) => [item.label, item.description ?? "", ...item.keywords ?? []].some(
|
|
2161
|
+
(t) => t.toLowerCase().includes(q)
|
|
2162
|
+
)
|
|
2163
|
+
)
|
|
2164
|
+
})).filter((g) => g.items.length > 0) : groups;
|
|
2165
|
+
const firstMatch = filtered.flatMap((g) => g.items).find((i) => !i.disabled);
|
|
2166
|
+
const choose = (item) => {
|
|
2167
|
+
if (item.disabled) return;
|
|
2168
|
+
onOpenChange(false);
|
|
2169
|
+
onSelect(item.id);
|
|
2170
|
+
};
|
|
2171
|
+
const entries = () => Array.from(listRef.current?.querySelectorAll("[data-palette-item]") ?? []);
|
|
2172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2173
|
+
DialogContent,
|
|
2174
|
+
{
|
|
2175
|
+
size: renderThumbnail ? "2xl" : "xl",
|
|
2176
|
+
className: "max-h-[calc(100dvh-2rem)] overflow-y-auto",
|
|
2177
|
+
onOpenAutoFocus: (e) => {
|
|
2178
|
+
e.preventDefault();
|
|
2179
|
+
searchRef.current?.focus();
|
|
2180
|
+
},
|
|
2181
|
+
...description ? {} : { "aria-describedby": void 0 },
|
|
2182
|
+
children: [
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogTitle, { children: title }),
|
|
2184
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogDescription, { children: description }),
|
|
2185
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative", children: [
|
|
2186
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2187
|
+
StudioIcon,
|
|
2188
|
+
{
|
|
2189
|
+
name: "search",
|
|
2190
|
+
className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
|
|
2191
|
+
}
|
|
2192
|
+
),
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2194
|
+
"input",
|
|
2195
|
+
{
|
|
2196
|
+
ref: searchRef,
|
|
2197
|
+
type: "search",
|
|
2198
|
+
value: query,
|
|
2199
|
+
onChange: (e) => setQuery(e.target.value),
|
|
2200
|
+
"aria-label": searchPlaceholder,
|
|
2201
|
+
placeholder: searchPlaceholder,
|
|
2202
|
+
className: "h-10 w-full rounded-md border border-input bg-background pl-9 pr-3 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
2203
|
+
onKeyDown: (e) => {
|
|
2204
|
+
if (e.key === "Enter" && firstMatch) {
|
|
2205
|
+
e.preventDefault();
|
|
2206
|
+
choose(firstMatch);
|
|
2207
|
+
} else if (e.key === "ArrowDown") {
|
|
2208
|
+
e.preventDefault();
|
|
2209
|
+
entries()[0]?.focus();
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
)
|
|
2214
|
+
] }),
|
|
2215
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { ref: listRef, className: "space-y-5", children: [
|
|
2216
|
+
filtered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("p", { className: "py-8 text-center text-sm text-muted-foreground", children: [
|
|
2217
|
+
"Nothing matches \u201C",
|
|
2218
|
+
query,
|
|
2219
|
+
"\u201D."
|
|
2220
|
+
] }),
|
|
2221
|
+
filtered.map((group) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { "aria-label": group.label, children: [
|
|
2222
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: group.label }),
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2224
|
+
"ul",
|
|
2225
|
+
{
|
|
2226
|
+
className: cn(
|
|
2227
|
+
"grid gap-2",
|
|
2228
|
+
renderThumbnail ? "grid-cols-2 sm:grid-cols-3" : "grid-cols-1 sm:grid-cols-2"
|
|
2229
|
+
),
|
|
2230
|
+
children: group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2231
|
+
"button",
|
|
2232
|
+
{
|
|
2233
|
+
type: "button",
|
|
2234
|
+
"data-palette-item": "",
|
|
2235
|
+
disabled: item.disabled,
|
|
2236
|
+
onClick: () => choose(item),
|
|
2237
|
+
onKeyDown: (e) => {
|
|
2238
|
+
const all = entries();
|
|
2239
|
+
const index = all.indexOf(e.currentTarget);
|
|
2240
|
+
const step = e.key === "ArrowDown" || e.key === "ArrowRight" ? 1 : e.key === "ArrowUp" || e.key === "ArrowLeft" ? -1 : 0;
|
|
2241
|
+
if (!step) return;
|
|
2242
|
+
e.preventDefault();
|
|
2243
|
+
const next = index + step;
|
|
2244
|
+
if (next < 0) searchRef.current?.focus();
|
|
2245
|
+
else all[Math.min(next, all.length - 1)]?.focus();
|
|
2246
|
+
},
|
|
2247
|
+
className: cn(
|
|
2248
|
+
"flex h-full w-full gap-3 rounded-md border border-border p-3 text-left hover:border-primary hover:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
2249
|
+
renderThumbnail ? "flex-col" : "items-start"
|
|
2250
|
+
),
|
|
2251
|
+
children: [
|
|
2252
|
+
renderThumbnail ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "block overflow-hidden rounded border border-border bg-muted", children: renderThumbnail(item) }) : item.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2253
|
+
"span",
|
|
2254
|
+
{
|
|
2255
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted text-foreground",
|
|
2256
|
+
"aria-hidden": "true",
|
|
2257
|
+
children: item.icon
|
|
2258
|
+
}
|
|
2259
|
+
),
|
|
2260
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "min-w-0", children: [
|
|
2261
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "block text-sm font-medium", children: item.label }),
|
|
2262
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: item.description })
|
|
2263
|
+
] })
|
|
2264
|
+
]
|
|
2265
|
+
}
|
|
2266
|
+
) }, item.id))
|
|
2267
|
+
}
|
|
2268
|
+
)
|
|
2269
|
+
] }, group.label))
|
|
2270
|
+
] })
|
|
2271
|
+
]
|
|
2272
|
+
}
|
|
2273
|
+
) });
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
// src/components/DataPanel.tsx
|
|
2277
|
+
var React24 = __toESM(require("react"));
|
|
2278
|
+
var DropdownMenuPrimitive2 = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
775
2279
|
|
|
776
2280
|
// src/hooks/useFocusTrap.ts
|
|
777
2281
|
var import_react = require("react");
|
|
@@ -852,14 +2356,14 @@ function useFocusTrap(options = {}) {
|
|
|
852
2356
|
}
|
|
853
2357
|
|
|
854
2358
|
// src/hooks/useEscapeKey.ts
|
|
855
|
-
var
|
|
2359
|
+
var React23 = __toESM(require("react"));
|
|
856
2360
|
function useEscapeKey(callback, options) {
|
|
857
2361
|
const { enabled = true, preventDefault = true, stopPropagation = false } = options ?? {};
|
|
858
|
-
const callbackRef =
|
|
859
|
-
|
|
2362
|
+
const callbackRef = React23.useRef(callback);
|
|
2363
|
+
React23.useEffect(() => {
|
|
860
2364
|
callbackRef.current = callback;
|
|
861
2365
|
}, [callback]);
|
|
862
|
-
|
|
2366
|
+
React23.useEffect(() => {
|
|
863
2367
|
if (!enabled) return;
|
|
864
2368
|
const handleKeyDown = (event) => {
|
|
865
2369
|
if (event.key === "Escape") {
|
|
@@ -881,15 +2385,15 @@ function useEscapeKey(callback, options) {
|
|
|
881
2385
|
|
|
882
2386
|
// src/components/DataPanel.tsx
|
|
883
2387
|
var import_data_panel_core = require("@classic-homes/data-panel-core");
|
|
884
|
-
var
|
|
2388
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
885
2389
|
function layoutViewportWidth() {
|
|
886
2390
|
return document.documentElement.clientWidth;
|
|
887
2391
|
}
|
|
888
|
-
var DropdownTrigger =
|
|
889
|
-
var DropdownContent =
|
|
890
|
-
var DropdownLabel =
|
|
891
|
-
var DropdownItem =
|
|
892
|
-
var DropdownSeparator =
|
|
2392
|
+
var DropdownTrigger = DropdownMenuPrimitive2.Trigger;
|
|
2393
|
+
var DropdownContent = DropdownMenuPrimitive2.Content;
|
|
2394
|
+
var DropdownLabel = DropdownMenuPrimitive2.Label;
|
|
2395
|
+
var DropdownItem = DropdownMenuPrimitive2.Item;
|
|
2396
|
+
var DropdownSeparator = DropdownMenuPrimitive2.Separator;
|
|
893
2397
|
function useDataPanel(options = {}) {
|
|
894
2398
|
const {
|
|
895
2399
|
persistKey,
|
|
@@ -899,28 +2403,28 @@ function useDataPanel(options = {}) {
|
|
|
899
2403
|
constraints = {}
|
|
900
2404
|
} = options;
|
|
901
2405
|
const resolvedConstraints = { ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints };
|
|
902
|
-
const [persistedState] =
|
|
2406
|
+
const [persistedState] = React24.useState(() => {
|
|
903
2407
|
if (persistKey && typeof window !== "undefined") {
|
|
904
2408
|
return (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
905
2409
|
}
|
|
906
2410
|
return null;
|
|
907
2411
|
});
|
|
908
|
-
const [mode, setMode] =
|
|
909
|
-
const [edge, setEdge] =
|
|
910
|
-
const [isExpanded, setIsExpanded] =
|
|
2412
|
+
const [mode, setMode] = React24.useState(persistedState?.mode ?? initialMode);
|
|
2413
|
+
const [edge, setEdge] = React24.useState(persistedState?.edge ?? initialEdge);
|
|
2414
|
+
const [isExpanded, setIsExpanded] = React24.useState(
|
|
911
2415
|
persistedState?.isExpanded ?? initialExpanded
|
|
912
2416
|
);
|
|
913
|
-
const [detachedPosition, setDetachedPosition] =
|
|
2417
|
+
const [detachedPosition, setDetachedPosition] = React24.useState(
|
|
914
2418
|
persistedState?.detachedPosition ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
915
2419
|
);
|
|
916
|
-
const [detachedSize, setDetachedSize] =
|
|
2420
|
+
const [detachedSize, setDetachedSize] = React24.useState(
|
|
917
2421
|
persistedState?.detachedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize
|
|
918
2422
|
);
|
|
919
|
-
const [pinnedSize, setPinnedSize] =
|
|
2423
|
+
const [pinnedSize, setPinnedSize] = React24.useState(
|
|
920
2424
|
persistedState?.pinnedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize
|
|
921
2425
|
);
|
|
922
|
-
const saveTimeoutRef =
|
|
923
|
-
const debouncedSave =
|
|
2426
|
+
const saveTimeoutRef = React24.useRef(null);
|
|
2427
|
+
const debouncedSave = React24.useCallback(() => {
|
|
924
2428
|
if (!persistKey) return;
|
|
925
2429
|
if (saveTimeoutRef.current) {
|
|
926
2430
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -939,7 +2443,7 @@ function useDataPanel(options = {}) {
|
|
|
939
2443
|
});
|
|
940
2444
|
}, 300);
|
|
941
2445
|
}, [persistKey, mode, edge, isExpanded, detachedPosition, detachedSize, pinnedSize]);
|
|
942
|
-
const handleSetMode =
|
|
2446
|
+
const handleSetMode = React24.useCallback(
|
|
943
2447
|
(newMode) => {
|
|
944
2448
|
setMode(newMode);
|
|
945
2449
|
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) {
|
|
@@ -950,7 +2454,7 @@ function useDataPanel(options = {}) {
|
|
|
950
2454
|
},
|
|
951
2455
|
[detachedPosition, detachedSize]
|
|
952
2456
|
);
|
|
953
|
-
const handleSetDetachedPosition =
|
|
2457
|
+
const handleSetDetachedPosition = React24.useCallback(
|
|
954
2458
|
(position) => {
|
|
955
2459
|
if (typeof window === "undefined") {
|
|
956
2460
|
setDetachedPosition(position);
|
|
@@ -962,13 +2466,13 @@ function useDataPanel(options = {}) {
|
|
|
962
2466
|
},
|
|
963
2467
|
[detachedSize]
|
|
964
2468
|
);
|
|
965
|
-
const handleSetDetachedSize =
|
|
2469
|
+
const handleSetDetachedSize = React24.useCallback(
|
|
966
2470
|
(size) => {
|
|
967
2471
|
setDetachedSize((0, import_data_panel_core.constrainSize)(size, resolvedConstraints));
|
|
968
2472
|
},
|
|
969
2473
|
[resolvedConstraints]
|
|
970
2474
|
);
|
|
971
|
-
const handleSetPinnedSize =
|
|
2475
|
+
const handleSetPinnedSize = React24.useCallback(
|
|
972
2476
|
(size) => {
|
|
973
2477
|
if (typeof window === "undefined") {
|
|
974
2478
|
setPinnedSize(size);
|
|
@@ -982,7 +2486,7 @@ function useDataPanel(options = {}) {
|
|
|
982
2486
|
},
|
|
983
2487
|
[edge, resolvedConstraints]
|
|
984
2488
|
);
|
|
985
|
-
|
|
2489
|
+
React24.useEffect(() => {
|
|
986
2490
|
debouncedSave();
|
|
987
2491
|
}, [debouncedSave]);
|
|
988
2492
|
return {
|
|
@@ -1000,7 +2504,7 @@ function useDataPanel(options = {}) {
|
|
|
1000
2504
|
setPinnedSize: handleSetPinnedSize
|
|
1001
2505
|
};
|
|
1002
2506
|
}
|
|
1003
|
-
var ChevronUpIcon = () => /* @__PURE__ */ (0,
|
|
2507
|
+
var ChevronUpIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1004
2508
|
"svg",
|
|
1005
2509
|
{
|
|
1006
2510
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1012,10 +2516,10 @@ var ChevronUpIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
|
1012
2516
|
strokeWidth: "2",
|
|
1013
2517
|
strokeLinecap: "round",
|
|
1014
2518
|
strokeLinejoin: "round",
|
|
1015
|
-
children: /* @__PURE__ */ (0,
|
|
2519
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m18 15-6-6-6 6" })
|
|
1016
2520
|
}
|
|
1017
2521
|
);
|
|
1018
|
-
var MoreVerticalIcon = () => /* @__PURE__ */ (0,
|
|
2522
|
+
var MoreVerticalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1019
2523
|
"svg",
|
|
1020
2524
|
{
|
|
1021
2525
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1028,13 +2532,13 @@ var MoreVerticalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
|
1028
2532
|
strokeLinecap: "round",
|
|
1029
2533
|
strokeLinejoin: "round",
|
|
1030
2534
|
children: [
|
|
1031
|
-
/* @__PURE__ */ (0,
|
|
1032
|
-
/* @__PURE__ */ (0,
|
|
1033
|
-
/* @__PURE__ */ (0,
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "12", cy: "12", r: "1" }),
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "12", cy: "5", r: "1" }),
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "12", cy: "19", r: "1" })
|
|
1034
2538
|
]
|
|
1035
2539
|
}
|
|
1036
2540
|
);
|
|
1037
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
2541
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1038
2542
|
"svg",
|
|
1039
2543
|
{
|
|
1040
2544
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1047,12 +2551,12 @@ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
|
1047
2551
|
strokeLinecap: "round",
|
|
1048
2552
|
strokeLinejoin: "round",
|
|
1049
2553
|
children: [
|
|
1050
|
-
/* @__PURE__ */ (0,
|
|
1051
|
-
/* @__PURE__ */ (0,
|
|
2554
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M18 6 6 18" }),
|
|
2555
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m6 6 12 12" })
|
|
1052
2556
|
]
|
|
1053
2557
|
}
|
|
1054
2558
|
);
|
|
1055
|
-
var GripIcon = () => /* @__PURE__ */ (0,
|
|
2559
|
+
var GripIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1056
2560
|
"svg",
|
|
1057
2561
|
{
|
|
1058
2562
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1061,12 +2565,12 @@ var GripIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
|
1061
2565
|
viewBox: "0 0 24 24",
|
|
1062
2566
|
fill: "currentColor",
|
|
1063
2567
|
children: [
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
1067
|
-
/* @__PURE__ */ (0,
|
|
1068
|
-
/* @__PURE__ */ (0,
|
|
1069
|
-
/* @__PURE__ */ (0,
|
|
2568
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "9", cy: "6", r: "1.5" }),
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "15", cy: "6", r: "1.5" }),
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "9", cy: "12", r: "1.5" }),
|
|
2571
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "15", cy: "12", r: "1.5" }),
|
|
2572
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "9", cy: "18", r: "1.5" }),
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "15", cy: "18", r: "1.5" })
|
|
1070
2574
|
]
|
|
1071
2575
|
}
|
|
1072
2576
|
);
|
|
@@ -1076,7 +2580,7 @@ var edgeLabels = {
|
|
|
1076
2580
|
top: "Pin to top",
|
|
1077
2581
|
bottom: "Pin to bottom"
|
|
1078
2582
|
};
|
|
1079
|
-
var DataPanelHeader =
|
|
2583
|
+
var DataPanelHeader = React24.forwardRef(
|
|
1080
2584
|
({
|
|
1081
2585
|
title,
|
|
1082
2586
|
subtitle,
|
|
@@ -1095,7 +2599,7 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1095
2599
|
className,
|
|
1096
2600
|
draggable = false
|
|
1097
2601
|
}, ref) => {
|
|
1098
|
-
return /* @__PURE__ */ (0,
|
|
2602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1099
2603
|
"div",
|
|
1100
2604
|
{
|
|
1101
2605
|
ref,
|
|
@@ -1106,13 +2610,13 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1106
2610
|
),
|
|
1107
2611
|
"data-panel-header": true,
|
|
1108
2612
|
children: [
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1110
|
-
title && /* @__PURE__ */ (0,
|
|
1111
|
-
subtitle && /* @__PURE__ */ (0,
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex flex-col min-w-0 flex-1", children: headerContent ? headerContent : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2614
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { id: titleId, className: "text-sm font-semibold leading-none truncate", children: title }),
|
|
2615
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground mt-1 truncate", children: subtitle })
|
|
1112
2616
|
] }) }),
|
|
1113
|
-
/* @__PURE__ */ (0,
|
|
2617
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1114
2618
|
headerActions,
|
|
1115
|
-
/* @__PURE__ */ (0,
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1116
2620
|
"button",
|
|
1117
2621
|
{
|
|
1118
2622
|
type: "button",
|
|
@@ -1127,37 +2631,37 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1127
2631
|
},
|
|
1128
2632
|
"aria-label": isExpanded ? "Collapse panel" : "Expand panel",
|
|
1129
2633
|
"aria-expanded": isExpanded,
|
|
1130
|
-
children: /* @__PURE__ */ (0,
|
|
2634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1131
2635
|
"span",
|
|
1132
2636
|
{
|
|
1133
2637
|
className: cn(
|
|
1134
2638
|
"transition-transform",
|
|
1135
2639
|
{ top: "", bottom: "rotate-180", left: "-rotate-90", right: "rotate-90" }[edge]
|
|
1136
2640
|
),
|
|
1137
|
-
children: /* @__PURE__ */ (0,
|
|
2641
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronUpIcon, {})
|
|
1138
2642
|
}
|
|
1139
2643
|
)
|
|
1140
2644
|
}
|
|
1141
2645
|
),
|
|
1142
|
-
!disableModeSwitch && /* @__PURE__ */ (0,
|
|
1143
|
-
/* @__PURE__ */ (0,
|
|
2646
|
+
!disableModeSwitch && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenuPrimitive2.Root, { children: [
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1144
2648
|
"button",
|
|
1145
2649
|
{
|
|
1146
2650
|
type: "button",
|
|
1147
2651
|
className: "relative flex h-8 w-8 items-center justify-center rounded-md before:absolute before:-inset-1.5 before:content-[''] bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1148
2652
|
"aria-label": "Panel options",
|
|
1149
|
-
children: /* @__PURE__ */ (0,
|
|
2653
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MoreVerticalIcon, {})
|
|
1150
2654
|
}
|
|
1151
2655
|
) }),
|
|
1152
|
-
/* @__PURE__ */ (0,
|
|
2656
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenuPrimitive2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1153
2657
|
DropdownContent,
|
|
1154
2658
|
{
|
|
1155
2659
|
className: "z-50 min-w-[8rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95",
|
|
1156
2660
|
sideOffset: 4,
|
|
1157
2661
|
align: "end",
|
|
1158
2662
|
children: [
|
|
1159
|
-
/* @__PURE__ */ (0,
|
|
1160
|
-
["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ (0,
|
|
2663
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownLabel, { className: "px-2 py-1.5 text-sm font-semibold", children: "Panel Position" }),
|
|
2664
|
+
["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1161
2665
|
DropdownItem,
|
|
1162
2666
|
{
|
|
1163
2667
|
className: "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none bg-popover focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
@@ -1167,20 +2671,20 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1167
2671
|
},
|
|
1168
2672
|
children: [
|
|
1169
2673
|
edgeLabels[e],
|
|
1170
|
-
mode === "pinned" && edge === e && /* @__PURE__ */ (0,
|
|
2674
|
+
mode === "pinned" && edge === e && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ml-auto text-xs", children: "\u2713" })
|
|
1171
2675
|
]
|
|
1172
2676
|
},
|
|
1173
2677
|
e
|
|
1174
2678
|
)),
|
|
1175
|
-
/* @__PURE__ */ (0,
|
|
1176
|
-
/* @__PURE__ */ (0,
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownSeparator, { className: "-mx-1 my-1 h-px bg-muted" }),
|
|
2680
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1177
2681
|
DropdownItem,
|
|
1178
2682
|
{
|
|
1179
2683
|
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",
|
|
1180
2684
|
onSelect: () => onModeChange?.("detached"),
|
|
1181
2685
|
children: [
|
|
1182
2686
|
"Detach",
|
|
1183
|
-
mode === "detached" && /* @__PURE__ */ (0,
|
|
2687
|
+
mode === "detached" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ml-auto text-xs", children: "\u2713" })
|
|
1184
2688
|
]
|
|
1185
2689
|
}
|
|
1186
2690
|
)
|
|
@@ -1188,14 +2692,14 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1188
2692
|
}
|
|
1189
2693
|
) })
|
|
1190
2694
|
] }),
|
|
1191
|
-
!disableClose && /* @__PURE__ */ (0,
|
|
2695
|
+
!disableClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1192
2696
|
"button",
|
|
1193
2697
|
{
|
|
1194
2698
|
type: "button",
|
|
1195
2699
|
className: "relative flex h-8 w-8 items-center justify-center rounded-md before:absolute before:-inset-1.5 before:content-[''] bg-transparent text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1196
2700
|
onClick: onClose,
|
|
1197
2701
|
"aria-label": "Close panel",
|
|
1198
|
-
children: /* @__PURE__ */ (0,
|
|
2702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
1199
2703
|
}
|
|
1200
2704
|
)
|
|
1201
2705
|
] })
|
|
@@ -1219,14 +2723,14 @@ function DataPanelCardHeader({
|
|
|
1219
2723
|
onToggleExpand,
|
|
1220
2724
|
onClose
|
|
1221
2725
|
}) {
|
|
1222
|
-
return /* @__PURE__ */ (0,
|
|
2726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1223
2727
|
"div",
|
|
1224
2728
|
{
|
|
1225
2729
|
"data-panel-header": true,
|
|
1226
2730
|
className: "relative flex items-center justify-between gap-2 border-b border-border bg-muted/30 px-4 pt-5 pb-3 cursor-pointer",
|
|
1227
2731
|
onPointerDown: onHeaderPointerDown,
|
|
1228
2732
|
children: [
|
|
1229
|
-
showDragHandle && /* @__PURE__ */ (0,
|
|
2733
|
+
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1230
2734
|
"div",
|
|
1231
2735
|
{
|
|
1232
2736
|
className: "absolute top-1.5 left-1/2 -translate-x-1/2 w-10 h-1.5 rounded-full bg-muted-foreground/30 cursor-pointer touch-none",
|
|
@@ -1238,22 +2742,22 @@ function DataPanelCardHeader({
|
|
|
1238
2742
|
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && onToggleExpand()
|
|
1239
2743
|
}
|
|
1240
2744
|
),
|
|
1241
|
-
/* @__PURE__ */ (0,
|
|
2745
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1242
2746
|
"div",
|
|
1243
2747
|
{
|
|
1244
2748
|
className: "flex-1 min-w-0",
|
|
1245
2749
|
role: "button",
|
|
1246
2750
|
tabIndex: 0,
|
|
1247
2751
|
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && onToggleExpand(),
|
|
1248
|
-
children: headerContent ? headerContent : /* @__PURE__ */ (0,
|
|
1249
|
-
subtitle && /* @__PURE__ */ (0,
|
|
1250
|
-
title && /* @__PURE__ */ (0,
|
|
2752
|
+
children: headerContent ? headerContent : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2753
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-muted-foreground truncate", children: subtitle }),
|
|
2754
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { id: titleId, className: "text-lg font-semibold truncate", children: title })
|
|
1251
2755
|
] })
|
|
1252
2756
|
}
|
|
1253
2757
|
),
|
|
1254
|
-
/* @__PURE__ */ (0,
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1255
2759
|
headerActions,
|
|
1256
|
-
!isMobile && /* @__PURE__ */ (0,
|
|
2760
|
+
!isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1257
2761
|
"button",
|
|
1258
2762
|
{
|
|
1259
2763
|
"data-card-drag-handle": true,
|
|
@@ -1262,10 +2766,10 @@ function DataPanelCardHeader({
|
|
|
1262
2766
|
"aria-label": "Drag to reposition panel",
|
|
1263
2767
|
title: "Drag to move",
|
|
1264
2768
|
onPointerDown: onHeaderPointerDown,
|
|
1265
|
-
children: /* @__PURE__ */ (0,
|
|
2769
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GripIcon, {})
|
|
1266
2770
|
}
|
|
1267
2771
|
),
|
|
1268
|
-
/* @__PURE__ */ (0,
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1269
2773
|
"button",
|
|
1270
2774
|
{
|
|
1271
2775
|
type: "button",
|
|
@@ -1274,17 +2778,17 @@ function DataPanelCardHeader({
|
|
|
1274
2778
|
"aria-expanded": isExpanded,
|
|
1275
2779
|
"aria-label": isExpanded ? "Collapse panel" : "Expand panel",
|
|
1276
2780
|
title: isExpanded ? "Collapse" : "Expand",
|
|
1277
|
-
children: /* @__PURE__ */ (0,
|
|
2781
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: cn("inline-flex transition-transform", isExpanded && "rotate-180"), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronUpIcon, {}) })
|
|
1278
2782
|
}
|
|
1279
2783
|
),
|
|
1280
|
-
!disableClose && /* @__PURE__ */ (0,
|
|
2784
|
+
!disableClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1281
2785
|
"button",
|
|
1282
2786
|
{
|
|
1283
2787
|
type: "button",
|
|
1284
2788
|
className: "relative flex h-8 w-8 items-center justify-center rounded-md before:absolute before:-inset-1.5 before:content-[''] text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1285
2789
|
onClick: onClose,
|
|
1286
2790
|
"aria-label": "Close panel",
|
|
1287
|
-
children: /* @__PURE__ */ (0,
|
|
2791
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
1288
2792
|
}
|
|
1289
2793
|
)
|
|
1290
2794
|
] })
|
|
@@ -1292,9 +2796,9 @@ function DataPanelCardHeader({
|
|
|
1292
2796
|
}
|
|
1293
2797
|
);
|
|
1294
2798
|
}
|
|
1295
|
-
var DataPanelContent =
|
|
2799
|
+
var DataPanelContent = React24.forwardRef(
|
|
1296
2800
|
({ children, className, "aria-label": ariaLabel = "Panel content" }, ref) => {
|
|
1297
|
-
return /* @__PURE__ */ (0,
|
|
2801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1298
2802
|
"div",
|
|
1299
2803
|
{
|
|
1300
2804
|
ref,
|
|
@@ -1307,7 +2811,7 @@ var DataPanelContent = React14.forwardRef(
|
|
|
1307
2811
|
}
|
|
1308
2812
|
);
|
|
1309
2813
|
DataPanelContent.displayName = "DataPanelContent";
|
|
1310
|
-
var DataPanelFooter =
|
|
2814
|
+
var DataPanelFooter = React24.forwardRef(
|
|
1311
2815
|
({ actions = [], footerContent, footerActions, className }, ref) => {
|
|
1312
2816
|
if (!footerContent && actions.length === 0 && !footerActions) {
|
|
1313
2817
|
return null;
|
|
@@ -1316,7 +2820,7 @@ var DataPanelFooter = React14.forwardRef(
|
|
|
1316
2820
|
if (variant === "primary") return "default";
|
|
1317
2821
|
return variant ?? "default";
|
|
1318
2822
|
};
|
|
1319
|
-
return /* @__PURE__ */ (0,
|
|
2823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1320
2824
|
"div",
|
|
1321
2825
|
{
|
|
1322
2826
|
ref,
|
|
@@ -1324,9 +2828,9 @@ var DataPanelFooter = React14.forwardRef(
|
|
|
1324
2828
|
"flex items-center justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",
|
|
1325
2829
|
className
|
|
1326
2830
|
),
|
|
1327
|
-
children: footerContent ? footerContent : /* @__PURE__ */ (0,
|
|
2831
|
+
children: footerContent ? footerContent : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
1328
2832
|
footerActions,
|
|
1329
|
-
actions.map((action, index) => /* @__PURE__ */ (0,
|
|
2833
|
+
actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1330
2834
|
Button,
|
|
1331
2835
|
{
|
|
1332
2836
|
variant: mapVariant(action.variant),
|
|
@@ -1343,7 +2847,7 @@ var DataPanelFooter = React14.forwardRef(
|
|
|
1343
2847
|
}
|
|
1344
2848
|
);
|
|
1345
2849
|
DataPanelFooter.displayName = "DataPanelFooter";
|
|
1346
|
-
var DataPanelTab =
|
|
2850
|
+
var DataPanelTab = React24.forwardRef(
|
|
1347
2851
|
({
|
|
1348
2852
|
title = "Panel",
|
|
1349
2853
|
subtitle,
|
|
@@ -1369,15 +2873,15 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1369
2873
|
bottom: "left-1/2 rounded-t-lg border-b-0"
|
|
1370
2874
|
}[edge];
|
|
1371
2875
|
const insetStyle = { [edge]: tabInset };
|
|
1372
|
-
const innerRef =
|
|
1373
|
-
const dragRef =
|
|
2876
|
+
const innerRef = React24.useRef(null);
|
|
2877
|
+
const dragRef = React24.useRef({
|
|
1374
2878
|
startX: 0,
|
|
1375
2879
|
startY: 0,
|
|
1376
2880
|
startOffset: 0,
|
|
1377
2881
|
moved: false,
|
|
1378
2882
|
pointerId: -1
|
|
1379
2883
|
});
|
|
1380
|
-
const [dragOffset, setDragOffset] =
|
|
2884
|
+
const [dragOffset, setDragOffset] = React24.useState(null);
|
|
1381
2885
|
const effectiveOffset = dragOffset ?? offset;
|
|
1382
2886
|
const draggable = !!onOffsetChange;
|
|
1383
2887
|
const tabTransform = (0, import_data_panel_core.getTabTransform)(edge, tabWidth, effectiveOffset);
|
|
@@ -1446,7 +2950,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1446
2950
|
onClick?.();
|
|
1447
2951
|
}
|
|
1448
2952
|
};
|
|
1449
|
-
|
|
2953
|
+
React24.useEffect(() => {
|
|
1450
2954
|
if (!onOffsetChange || dragOffset !== null) return;
|
|
1451
2955
|
const reclamp = () => {
|
|
1452
2956
|
const clamped = (0, import_data_panel_core.constrainTabOffset)(
|
|
@@ -1462,7 +2966,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1462
2966
|
window.addEventListener("resize", reclamp);
|
|
1463
2967
|
return () => window.removeEventListener("resize", reclamp);
|
|
1464
2968
|
}, [edge, tabWidth, offset, onOffsetChange, dragOffset]);
|
|
1465
|
-
return /* @__PURE__ */ (0,
|
|
2969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1466
2970
|
"div",
|
|
1467
2971
|
{
|
|
1468
2972
|
ref: setRefs,
|
|
@@ -1488,7 +2992,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1488
2992
|
onPointerUp: draggable ? handlePointerUp : void 0,
|
|
1489
2993
|
onPointerCancel: draggable ? handlePointerCancel : void 0,
|
|
1490
2994
|
children: [
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
2995
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1492
2996
|
"button",
|
|
1493
2997
|
{
|
|
1494
2998
|
type: "button",
|
|
@@ -1497,12 +3001,12 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1497
3001
|
onClick: draggable ? void 0 : onClick,
|
|
1498
3002
|
onKeyDown: handleExpandKeyDown,
|
|
1499
3003
|
children: [
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
subtitle && /* @__PURE__ */ (0,
|
|
3004
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-sm font-semibold", children: title }),
|
|
3005
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: subtitle })
|
|
1502
3006
|
]
|
|
1503
3007
|
}
|
|
1504
3008
|
),
|
|
1505
|
-
!disableClose && onClose && /* @__PURE__ */ (0,
|
|
3009
|
+
!disableClose && onClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1506
3010
|
"button",
|
|
1507
3011
|
{
|
|
1508
3012
|
"data-no-drag": true,
|
|
@@ -1513,7 +3017,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1513
3017
|
e.stopPropagation();
|
|
1514
3018
|
onClose();
|
|
1515
3019
|
},
|
|
1516
|
-
children: /* @__PURE__ */ (0,
|
|
3020
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
1517
3021
|
}
|
|
1518
3022
|
)
|
|
1519
3023
|
]
|
|
@@ -1535,7 +3039,7 @@ function ResizeHandles({
|
|
|
1535
3039
|
onPinnedSizeChange,
|
|
1536
3040
|
constraints
|
|
1537
3041
|
}) {
|
|
1538
|
-
const handleDetachedKeyDown =
|
|
3042
|
+
const handleDetachedKeyDown = React24.useCallback(
|
|
1539
3043
|
(e, handle) => {
|
|
1540
3044
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
1541
3045
|
let width = detachedSize.width;
|
|
@@ -1598,7 +3102,7 @@ function ResizeHandles({
|
|
|
1598
3102
|
},
|
|
1599
3103
|
[detachedPosition, detachedSize, constraints, onDetachedResize]
|
|
1600
3104
|
);
|
|
1601
|
-
const handlePinnedKeyDown =
|
|
3105
|
+
const handlePinnedKeyDown = React24.useCallback(
|
|
1602
3106
|
(e) => {
|
|
1603
3107
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
1604
3108
|
let newSize = pinnedSize;
|
|
@@ -1658,12 +3162,12 @@ function ResizeHandles({
|
|
|
1658
3162
|
"bottom-left",
|
|
1659
3163
|
"bottom-right"
|
|
1660
3164
|
];
|
|
1661
|
-
return /* @__PURE__ */ (0,
|
|
3165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: handles.map((handle) => {
|
|
1662
3166
|
const isCorner = handle.includes("-");
|
|
1663
3167
|
const isHorizontal2 = handle === "top" || handle === "bottom";
|
|
1664
3168
|
const isVertical = handle === "left" || handle === "right";
|
|
1665
3169
|
const { min: min2, max: max2 } = getAriaValueMinMax(handle);
|
|
1666
|
-
return /* @__PURE__ */ (0,
|
|
3170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1667
3171
|
"div",
|
|
1668
3172
|
{
|
|
1669
3173
|
className: cn(
|
|
@@ -1692,7 +3196,7 @@ function ResizeHandles({
|
|
|
1692
3196
|
const pinnedHandle = (0, import_data_panel_core.getPinnedResizeHandle)(edge);
|
|
1693
3197
|
const isHorizontal = edge === "left" || edge === "right";
|
|
1694
3198
|
const { min, max } = getAriaValueMinMax(pinnedHandle);
|
|
1695
|
-
return /* @__PURE__ */ (0,
|
|
3199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1696
3200
|
"div",
|
|
1697
3201
|
{
|
|
1698
3202
|
className: cn(
|
|
@@ -1715,7 +3219,7 @@ function ResizeHandles({
|
|
|
1715
3219
|
}
|
|
1716
3220
|
);
|
|
1717
3221
|
}
|
|
1718
|
-
var DataPanel =
|
|
3222
|
+
var DataPanel = React24.forwardRef(
|
|
1719
3223
|
({
|
|
1720
3224
|
open: controlledOpen,
|
|
1721
3225
|
onOpenChange,
|
|
@@ -1747,76 +3251,76 @@ var DataPanel = React14.forwardRef(
|
|
|
1747
3251
|
footerActions,
|
|
1748
3252
|
className
|
|
1749
3253
|
}, ref) => {
|
|
1750
|
-
const resolvedConstraints =
|
|
3254
|
+
const resolvedConstraints = React24.useMemo(
|
|
1751
3255
|
() => ({ ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints }),
|
|
1752
3256
|
[constraints]
|
|
1753
3257
|
);
|
|
1754
|
-
const resolvedCardConfig =
|
|
3258
|
+
const resolvedCardConfig = React24.useMemo(
|
|
1755
3259
|
() => ({ ...import_data_panel_core.DEFAULT_CARD_CONFIG, ...cardConfig }),
|
|
1756
3260
|
[cardConfig]
|
|
1757
3261
|
);
|
|
1758
|
-
const panelId =
|
|
3262
|
+
const panelId = React24.useId();
|
|
1759
3263
|
const titleId = `${panelId}-title`;
|
|
1760
|
-
const [internalOpen, setInternalOpen] =
|
|
1761
|
-
const [internalMode, setInternalMode] =
|
|
1762
|
-
const [internalVariant, setInternalVariant] =
|
|
3264
|
+
const [internalOpen, setInternalOpen] = React24.useState(true);
|
|
3265
|
+
const [internalMode, setInternalMode] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.mode);
|
|
3266
|
+
const [internalVariant, setInternalVariant] = React24.useState(
|
|
1763
3267
|
import_data_panel_core.DEFAULT_PANEL_STATE.variant
|
|
1764
3268
|
);
|
|
1765
|
-
const [internalEdge, setInternalEdge] =
|
|
1766
|
-
const [internalExpanded, setInternalExpanded] =
|
|
3269
|
+
const [internalEdge, setInternalEdge] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.edge);
|
|
3270
|
+
const [internalExpanded, setInternalExpanded] = React24.useState(
|
|
1767
3271
|
import_data_panel_core.DEFAULT_PANEL_STATE.isExpanded
|
|
1768
3272
|
);
|
|
1769
|
-
const [detachedPosition, setDetachedPosition] =
|
|
3273
|
+
const [detachedPosition, setDetachedPosition] = React24.useState(
|
|
1770
3274
|
import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
1771
3275
|
);
|
|
1772
|
-
const [detachedSize, setDetachedSize] =
|
|
1773
|
-
const [pinnedSize, setPinnedSize] =
|
|
1774
|
-
const [tabOffset, setTabOffset] =
|
|
1775
|
-
const [viewportWidth, setViewportWidth] =
|
|
3276
|
+
const [detachedSize, setDetachedSize] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize);
|
|
3277
|
+
const [pinnedSize, setPinnedSize] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize);
|
|
3278
|
+
const [tabOffset, setTabOffset] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.tabOffset);
|
|
3279
|
+
const [viewportWidth, setViewportWidth] = React24.useState(
|
|
1776
3280
|
typeof window !== "undefined" ? layoutViewportWidth() : 1024
|
|
1777
3281
|
);
|
|
1778
|
-
const [viewportHeight, setViewportHeight] =
|
|
3282
|
+
const [viewportHeight, setViewportHeight] = React24.useState(
|
|
1779
3283
|
typeof window !== "undefined" ? window.innerHeight : 768
|
|
1780
3284
|
);
|
|
1781
3285
|
const isMobile = viewportWidth < 640;
|
|
1782
|
-
const [cardHorizontalPosition, setCardHorizontalPosition] =
|
|
1783
|
-
const [cardExpandedHeight, setCardExpandedHeight] =
|
|
1784
|
-
const [cardWidth, setCardWidth] =
|
|
1785
|
-
const [cardDragCurrentHeight, setCardDragCurrentHeight] =
|
|
1786
|
-
const [isCardVerticalDragging, setIsCardVerticalDragging] =
|
|
1787
|
-
const [isCardHorizontalDragging, setIsCardHorizontalDragging] =
|
|
1788
|
-
const [isCardHeightTransitioning, setIsCardHeightTransitioning] =
|
|
1789
|
-
const [isCardWidthResizing, setIsCardWidthResizing] =
|
|
1790
|
-
const [isCardTopResizing, setIsCardTopResizing] =
|
|
1791
|
-
const [isDragging, setIsDragging] =
|
|
1792
|
-
const [isResizing, setIsResizing] =
|
|
1793
|
-
const [snapPreview, setSnapPreview] =
|
|
1794
|
-
const [isPinnedDragging, setIsPinnedDragging] =
|
|
1795
|
-
const [pullOffset, setPullOffset] =
|
|
1796
|
-
const dragStateRef =
|
|
3286
|
+
const [cardHorizontalPosition, setCardHorizontalPosition] = React24.useState(0);
|
|
3287
|
+
const [cardExpandedHeight, setCardExpandedHeight] = React24.useState(0);
|
|
3288
|
+
const [cardWidth, setCardWidth] = React24.useState(null);
|
|
3289
|
+
const [cardDragCurrentHeight, setCardDragCurrentHeight] = React24.useState(import_data_panel_core.CARD_HEADER_HEIGHT);
|
|
3290
|
+
const [isCardVerticalDragging, setIsCardVerticalDragging] = React24.useState(false);
|
|
3291
|
+
const [isCardHorizontalDragging, setIsCardHorizontalDragging] = React24.useState(false);
|
|
3292
|
+
const [isCardHeightTransitioning, setIsCardHeightTransitioning] = React24.useState(false);
|
|
3293
|
+
const [isCardWidthResizing, setIsCardWidthResizing] = React24.useState(false);
|
|
3294
|
+
const [isCardTopResizing, setIsCardTopResizing] = React24.useState(false);
|
|
3295
|
+
const [isDragging, setIsDragging] = React24.useState(false);
|
|
3296
|
+
const [isResizing, setIsResizing] = React24.useState(false);
|
|
3297
|
+
const [snapPreview, setSnapPreview] = React24.useState(null);
|
|
3298
|
+
const [isPinnedDragging, setIsPinnedDragging] = React24.useState(false);
|
|
3299
|
+
const [pullOffset, setPullOffset] = React24.useState(0);
|
|
3300
|
+
const dragStateRef = React24.useRef({
|
|
1797
3301
|
startPosition: { x: 0, y: 0 },
|
|
1798
3302
|
startPanelPosition: { x: 0, y: 0 }
|
|
1799
3303
|
});
|
|
1800
|
-
const pinnedDragStateRef =
|
|
3304
|
+
const pinnedDragStateRef = React24.useRef({
|
|
1801
3305
|
startPosition: { x: 0, y: 0 },
|
|
1802
3306
|
hasDetached: false
|
|
1803
3307
|
});
|
|
1804
|
-
const resizeStateRef =
|
|
3308
|
+
const resizeStateRef = React24.useRef({
|
|
1805
3309
|
handle: null,
|
|
1806
3310
|
startPosition: { x: 0, y: 0 },
|
|
1807
3311
|
startSize: { width: 0, height: 0 },
|
|
1808
3312
|
startPanelPosition: { x: 0, y: 0 }
|
|
1809
3313
|
});
|
|
1810
|
-
const cardDragStateRef =
|
|
3314
|
+
const cardDragStateRef = React24.useRef({
|
|
1811
3315
|
startY: 0,
|
|
1812
3316
|
startX: 0,
|
|
1813
3317
|
startTime: 0,
|
|
1814
3318
|
startExpanded: false,
|
|
1815
3319
|
startHorizontalPosition: 0
|
|
1816
3320
|
});
|
|
1817
|
-
const cardCurrentHeightRef =
|
|
1818
|
-
const cardTopResizeStartRef =
|
|
1819
|
-
const cardWidthResizeStateRef =
|
|
3321
|
+
const cardCurrentHeightRef = React24.useRef(import_data_panel_core.CARD_HEADER_HEIGHT);
|
|
3322
|
+
const cardTopResizeStartRef = React24.useRef({ startY: 0, startHeight: 0 });
|
|
3323
|
+
const cardWidthResizeStateRef = React24.useRef({
|
|
1820
3324
|
handle: null,
|
|
1821
3325
|
startX: 0,
|
|
1822
3326
|
startWidth: 0,
|
|
@@ -1828,9 +3332,9 @@ var DataPanel = React14.forwardRef(
|
|
|
1828
3332
|
const edge = controlledEdge ?? internalEdge;
|
|
1829
3333
|
const isExpanded = controlledExpanded ?? internalExpanded;
|
|
1830
3334
|
const showContent = variant !== "card" || isExpanded || isCardVerticalDragging;
|
|
1831
|
-
const saveTimeoutRef =
|
|
1832
|
-
const isMountedRef =
|
|
1833
|
-
|
|
3335
|
+
const saveTimeoutRef = React24.useRef(null);
|
|
3336
|
+
const isMountedRef = React24.useRef(true);
|
|
3337
|
+
React24.useEffect(() => {
|
|
1834
3338
|
isMountedRef.current = true;
|
|
1835
3339
|
return () => {
|
|
1836
3340
|
isMountedRef.current = false;
|
|
@@ -1841,7 +3345,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1841
3345
|
}
|
|
1842
3346
|
};
|
|
1843
3347
|
}, []);
|
|
1844
|
-
const debouncedSave =
|
|
3348
|
+
const debouncedSave = React24.useCallback(() => {
|
|
1845
3349
|
if (!persistKey) return;
|
|
1846
3350
|
if (saveTimeoutRef.current) {
|
|
1847
3351
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -1870,11 +3374,11 @@ var DataPanel = React14.forwardRef(
|
|
|
1870
3374
|
pinnedSize,
|
|
1871
3375
|
tabOffset
|
|
1872
3376
|
]);
|
|
1873
|
-
|
|
3377
|
+
React24.useEffect(() => {
|
|
1874
3378
|
debouncedSave();
|
|
1875
3379
|
}, [debouncedSave]);
|
|
1876
|
-
const hasLoadedRef =
|
|
1877
|
-
|
|
3380
|
+
const hasLoadedRef = React24.useRef(false);
|
|
3381
|
+
React24.useEffect(() => {
|
|
1878
3382
|
if (!persistKey || hasLoadedRef.current) return;
|
|
1879
3383
|
hasLoadedRef.current = true;
|
|
1880
3384
|
const persisted = (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
@@ -1891,7 +3395,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1891
3395
|
if (persisted.tabOffset !== void 0) setTabOffset(persisted.tabOffset);
|
|
1892
3396
|
}
|
|
1893
3397
|
}, [persistKey, controlledMode, controlledVariant, controlledEdge, controlledExpanded]);
|
|
1894
|
-
|
|
3398
|
+
React24.useEffect(() => {
|
|
1895
3399
|
if (mode === "detached" && detachedPosition.x === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.x && detachedPosition.y === import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition.y) {
|
|
1896
3400
|
setDetachedPosition(
|
|
1897
3401
|
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, layoutViewportWidth(), window.innerHeight)
|
|
@@ -1920,7 +3424,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1920
3424
|
ref.current = node;
|
|
1921
3425
|
}
|
|
1922
3426
|
};
|
|
1923
|
-
const handleModeChange =
|
|
3427
|
+
const handleModeChange = React24.useCallback(
|
|
1924
3428
|
(newMode) => {
|
|
1925
3429
|
if (controlledMode === void 0) {
|
|
1926
3430
|
setInternalMode(newMode);
|
|
@@ -1929,7 +3433,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1929
3433
|
},
|
|
1930
3434
|
[controlledMode, onModeChange]
|
|
1931
3435
|
);
|
|
1932
|
-
const handleEdgeChange =
|
|
3436
|
+
const handleEdgeChange = React24.useCallback(
|
|
1933
3437
|
(newEdge) => {
|
|
1934
3438
|
if (controlledEdge === void 0) {
|
|
1935
3439
|
setInternalEdge(newEdge);
|
|
@@ -1938,7 +3442,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1938
3442
|
},
|
|
1939
3443
|
[controlledEdge, onEdgeChange]
|
|
1940
3444
|
);
|
|
1941
|
-
const handleExpandedChange =
|
|
3445
|
+
const handleExpandedChange = React24.useCallback(
|
|
1942
3446
|
(newExpanded) => {
|
|
1943
3447
|
if (controlledExpanded === void 0) {
|
|
1944
3448
|
setInternalExpanded(newExpanded);
|
|
@@ -1972,7 +3476,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1972
3476
|
document.body.style.userSelect = "none";
|
|
1973
3477
|
}
|
|
1974
3478
|
};
|
|
1975
|
-
const handleDragMove =
|
|
3479
|
+
const handleDragMove = React24.useCallback(
|
|
1976
3480
|
(e) => {
|
|
1977
3481
|
if (!isDragging) return;
|
|
1978
3482
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -1999,7 +3503,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1999
3503
|
},
|
|
2000
3504
|
[isDragging, detachedSize, snapThreshold]
|
|
2001
3505
|
);
|
|
2002
|
-
const handleDragEnd =
|
|
3506
|
+
const handleDragEnd = React24.useCallback(() => {
|
|
2003
3507
|
if (!isDragging) return;
|
|
2004
3508
|
setIsDragging(false);
|
|
2005
3509
|
document.body.style.cursor = "";
|
|
@@ -2010,7 +3514,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2010
3514
|
setSnapPreview(null);
|
|
2011
3515
|
}
|
|
2012
3516
|
}, [isDragging, snapPreview, handleModeChange, handleEdgeChange]);
|
|
2013
|
-
const handlePinnedDragMove =
|
|
3517
|
+
const handlePinnedDragMove = React24.useCallback(
|
|
2014
3518
|
(e) => {
|
|
2015
3519
|
if (!isPinnedDragging) return;
|
|
2016
3520
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2046,7 +3550,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2046
3550
|
},
|
|
2047
3551
|
[isPinnedDragging, edge, detachThreshold, pinnedSize, detachedSize, handleModeChange]
|
|
2048
3552
|
);
|
|
2049
|
-
const handlePinnedDragEnd =
|
|
3553
|
+
const handlePinnedDragEnd = React24.useCallback(() => {
|
|
2050
3554
|
if (!isPinnedDragging) return;
|
|
2051
3555
|
setIsPinnedDragging(false);
|
|
2052
3556
|
setPullOffset(0);
|
|
@@ -2068,7 +3572,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2068
3572
|
document.body.style.cursor = (0, import_data_panel_core.getResizeCursor)(handle);
|
|
2069
3573
|
document.body.style.userSelect = "none";
|
|
2070
3574
|
};
|
|
2071
|
-
const handleResizeMove =
|
|
3575
|
+
const handleResizeMove = React24.useCallback(
|
|
2072
3576
|
(e) => {
|
|
2073
3577
|
if (!isResizing || !resizeStateRef.current.handle) return;
|
|
2074
3578
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2109,7 +3613,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2109
3613
|
},
|
|
2110
3614
|
[isResizing, mode, edge, resolvedConstraints]
|
|
2111
3615
|
);
|
|
2112
|
-
const handleResizeEnd =
|
|
3616
|
+
const handleResizeEnd = React24.useCallback(() => {
|
|
2113
3617
|
if (!isResizing) return;
|
|
2114
3618
|
setIsResizing(false);
|
|
2115
3619
|
resizeStateRef.current.handle = null;
|
|
@@ -2141,7 +3645,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2141
3645
|
}
|
|
2142
3646
|
document.body.style.userSelect = "none";
|
|
2143
3647
|
};
|
|
2144
|
-
const handleCardPointerMove =
|
|
3648
|
+
const handleCardPointerMove = React24.useCallback(
|
|
2145
3649
|
(e) => {
|
|
2146
3650
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
2147
3651
|
if (isCardVerticalDragging) {
|
|
@@ -2181,7 +3685,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2181
3685
|
resolvedCardConfig.maxWidth
|
|
2182
3686
|
]
|
|
2183
3687
|
);
|
|
2184
|
-
const handleCardPointerUp =
|
|
3688
|
+
const handleCardPointerUp = React24.useCallback(
|
|
2185
3689
|
(e) => {
|
|
2186
3690
|
const endTime = Date.now();
|
|
2187
3691
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2238,7 +3742,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2238
3742
|
document.body.style.cursor = "ns-resize";
|
|
2239
3743
|
document.body.style.userSelect = "none";
|
|
2240
3744
|
};
|
|
2241
|
-
const handleCardResizeMove =
|
|
3745
|
+
const handleCardResizeMove = React24.useCallback(
|
|
2242
3746
|
(e) => {
|
|
2243
3747
|
if (!isCardTopResizing) return;
|
|
2244
3748
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2251,7 +3755,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2251
3755
|
},
|
|
2252
3756
|
[isCardTopResizing, viewportHeight]
|
|
2253
3757
|
);
|
|
2254
|
-
const handleCardResizeEnd =
|
|
3758
|
+
const handleCardResizeEnd = React24.useCallback(() => {
|
|
2255
3759
|
if (!isCardTopResizing) return;
|
|
2256
3760
|
setIsCardTopResizing(false);
|
|
2257
3761
|
document.body.style.cursor = "";
|
|
@@ -2282,7 +3786,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2282
3786
|
document.body.style.cursor = "ew-resize";
|
|
2283
3787
|
document.body.style.userSelect = "none";
|
|
2284
3788
|
};
|
|
2285
|
-
const handleCardWidthResizeMove =
|
|
3789
|
+
const handleCardWidthResizeMove = React24.useCallback(
|
|
2286
3790
|
(e) => {
|
|
2287
3791
|
const st = cardWidthResizeStateRef.current;
|
|
2288
3792
|
if (!isCardWidthResizing || !st.handle) return;
|
|
@@ -2322,7 +3826,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2322
3826
|
resolvedCardConfig.maxWidth
|
|
2323
3827
|
]
|
|
2324
3828
|
);
|
|
2325
|
-
const handleCardWidthResizeEnd =
|
|
3829
|
+
const handleCardWidthResizeEnd = React24.useCallback(() => {
|
|
2326
3830
|
if (!isCardWidthResizing) return;
|
|
2327
3831
|
setIsCardWidthResizing(false);
|
|
2328
3832
|
cardWidthResizeStateRef.current.handle = null;
|
|
@@ -2370,7 +3874,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2370
3874
|
if (kind === "width-left") setCardHorizontalPosition((p) => p - appliedDelta);
|
|
2371
3875
|
debouncedSave();
|
|
2372
3876
|
};
|
|
2373
|
-
|
|
3877
|
+
React24.useEffect(() => {
|
|
2374
3878
|
if (isDragging) {
|
|
2375
3879
|
window.addEventListener("pointermove", handleDragMove);
|
|
2376
3880
|
window.addEventListener("pointerup", handleDragEnd);
|
|
@@ -2382,7 +3886,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2382
3886
|
};
|
|
2383
3887
|
}
|
|
2384
3888
|
}, [isDragging, handleDragMove, handleDragEnd]);
|
|
2385
|
-
|
|
3889
|
+
React24.useEffect(() => {
|
|
2386
3890
|
if (isPinnedDragging) {
|
|
2387
3891
|
window.addEventListener("pointermove", handlePinnedDragMove);
|
|
2388
3892
|
window.addEventListener("pointerup", handlePinnedDragEnd);
|
|
@@ -2394,7 +3898,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2394
3898
|
};
|
|
2395
3899
|
}
|
|
2396
3900
|
}, [isPinnedDragging, handlePinnedDragMove, handlePinnedDragEnd]);
|
|
2397
|
-
|
|
3901
|
+
React24.useEffect(() => {
|
|
2398
3902
|
if (isResizing) {
|
|
2399
3903
|
window.addEventListener("pointermove", handleResizeMove);
|
|
2400
3904
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
@@ -2406,7 +3910,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2406
3910
|
};
|
|
2407
3911
|
}
|
|
2408
3912
|
}, [isResizing, handleResizeMove, handleResizeEnd]);
|
|
2409
|
-
|
|
3913
|
+
React24.useEffect(() => {
|
|
2410
3914
|
if (isCardVerticalDragging || isCardHorizontalDragging) {
|
|
2411
3915
|
window.addEventListener("pointermove", handleCardPointerMove);
|
|
2412
3916
|
window.addEventListener("pointerup", handleCardPointerUp);
|
|
@@ -2423,7 +3927,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2423
3927
|
handleCardPointerMove,
|
|
2424
3928
|
handleCardPointerUp
|
|
2425
3929
|
]);
|
|
2426
|
-
|
|
3930
|
+
React24.useEffect(() => {
|
|
2427
3931
|
if (isCardTopResizing) {
|
|
2428
3932
|
window.addEventListener("pointermove", handleCardResizeMove);
|
|
2429
3933
|
window.addEventListener("pointerup", handleCardResizeEnd);
|
|
@@ -2435,7 +3939,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2435
3939
|
};
|
|
2436
3940
|
}
|
|
2437
3941
|
}, [isCardTopResizing, handleCardResizeMove, handleCardResizeEnd]);
|
|
2438
|
-
|
|
3942
|
+
React24.useEffect(() => {
|
|
2439
3943
|
if (isCardWidthResizing) {
|
|
2440
3944
|
window.addEventListener("pointermove", handleCardWidthResizeMove);
|
|
2441
3945
|
window.addEventListener("pointerup", handleCardWidthResizeEnd);
|
|
@@ -2447,7 +3951,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2447
3951
|
};
|
|
2448
3952
|
}
|
|
2449
3953
|
}, [isCardWidthResizing, handleCardWidthResizeMove, handleCardWidthResizeEnd]);
|
|
2450
|
-
|
|
3954
|
+
React24.useEffect(() => {
|
|
2451
3955
|
const onResize = () => {
|
|
2452
3956
|
setViewportWidth(layoutViewportWidth());
|
|
2453
3957
|
setViewportHeight(window.innerHeight);
|
|
@@ -2457,19 +3961,19 @@ var DataPanel = React14.forwardRef(
|
|
|
2457
3961
|
window.addEventListener("resize", onResize);
|
|
2458
3962
|
return () => window.removeEventListener("resize", onResize);
|
|
2459
3963
|
}, []);
|
|
2460
|
-
|
|
3964
|
+
React24.useEffect(() => {
|
|
2461
3965
|
if (isMobile && variant === "card") {
|
|
2462
3966
|
setCardHorizontalPosition(0);
|
|
2463
3967
|
setCardWidth(null);
|
|
2464
3968
|
}
|
|
2465
3969
|
}, [isMobile, variant]);
|
|
2466
|
-
|
|
3970
|
+
React24.useEffect(() => {
|
|
2467
3971
|
if (isCardHeightTransitioning) {
|
|
2468
3972
|
const t = setTimeout(() => setIsCardHeightTransitioning(false), 350);
|
|
2469
3973
|
return () => clearTimeout(t);
|
|
2470
3974
|
}
|
|
2471
3975
|
}, [isCardHeightTransitioning]);
|
|
2472
|
-
const panelStyles =
|
|
3976
|
+
const panelStyles = React24.useMemo(() => {
|
|
2473
3977
|
if (variant === "card") {
|
|
2474
3978
|
const defaultCardWidth = Math.min(
|
|
2475
3979
|
viewportWidth - resolvedCardConfig.horizontalMargin * 2,
|
|
@@ -2534,7 +4038,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2534
4038
|
}[edge] : "animate-scale-in";
|
|
2535
4039
|
if (!open) return null;
|
|
2536
4040
|
if (variant === "full" && !isExpanded && mode === "pinned") {
|
|
2537
|
-
return /* @__PURE__ */ (0,
|
|
4041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2538
4042
|
DataPanelTab,
|
|
2539
4043
|
{
|
|
2540
4044
|
title,
|
|
@@ -2550,8 +4054,8 @@ var DataPanel = React14.forwardRef(
|
|
|
2550
4054
|
}
|
|
2551
4055
|
);
|
|
2552
4056
|
}
|
|
2553
|
-
return /* @__PURE__ */ (0,
|
|
2554
|
-
snapPreview && /* @__PURE__ */ (0,
|
|
4057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4058
|
+
snapPreview && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2555
4059
|
"div",
|
|
2556
4060
|
{
|
|
2557
4061
|
className: cn(
|
|
@@ -2563,7 +4067,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2563
4067
|
)
|
|
2564
4068
|
}
|
|
2565
4069
|
),
|
|
2566
|
-
variant === "card" && isExpanded && isMobile && /* @__PURE__ */ (0,
|
|
4070
|
+
variant === "card" && isExpanded && isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2567
4071
|
"div",
|
|
2568
4072
|
{
|
|
2569
4073
|
className: "fixed inset-0 z-40 bg-black/50 transition-opacity",
|
|
@@ -2571,7 +4075,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2571
4075
|
onClick: handleToggleExpand
|
|
2572
4076
|
}
|
|
2573
4077
|
),
|
|
2574
|
-
/* @__PURE__ */ (0,
|
|
4078
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2575
4079
|
"div",
|
|
2576
4080
|
{
|
|
2577
4081
|
ref: setPanelRef,
|
|
@@ -2593,7 +4097,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2593
4097
|
"aria-expanded": variant === "card" ? isExpanded : void 0,
|
|
2594
4098
|
onPointerDown: variant === "full" ? handleDragStart : void 0,
|
|
2595
4099
|
children: [
|
|
2596
|
-
variant === "card" ? /* @__PURE__ */ (0,
|
|
4100
|
+
variant === "card" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2597
4101
|
DataPanelCardHeader,
|
|
2598
4102
|
{
|
|
2599
4103
|
title,
|
|
@@ -2609,7 +4113,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2609
4113
|
onToggleExpand: handleToggleExpand,
|
|
2610
4114
|
onClose: () => handleOpenChange(false)
|
|
2611
4115
|
}
|
|
2612
|
-
) : /* @__PURE__ */ (0,
|
|
4116
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2613
4117
|
DataPanelHeader,
|
|
2614
4118
|
{
|
|
2615
4119
|
title,
|
|
@@ -2629,9 +4133,9 @@ var DataPanel = React14.forwardRef(
|
|
|
2629
4133
|
draggable: !disableDrag && (mode === "detached" || mode === "pinned" && detachThreshold > 0)
|
|
2630
4134
|
}
|
|
2631
4135
|
),
|
|
2632
|
-
showContent && /* @__PURE__ */ (0,
|
|
2633
|
-
/* @__PURE__ */ (0,
|
|
2634
|
-
/* @__PURE__ */ (0,
|
|
4136
|
+
showContent && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4137
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DataPanelContent, { children }),
|
|
4138
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2635
4139
|
DataPanelFooter,
|
|
2636
4140
|
{
|
|
2637
4141
|
actions,
|
|
@@ -2640,7 +4144,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2640
4144
|
}
|
|
2641
4145
|
)
|
|
2642
4146
|
] }),
|
|
2643
|
-
variant === "full" && !disableResize && /* @__PURE__ */ (0,
|
|
4147
|
+
variant === "full" && !disableResize && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2644
4148
|
ResizeHandles,
|
|
2645
4149
|
{
|
|
2646
4150
|
mode,
|
|
@@ -2671,8 +4175,8 @@ var DataPanel = React14.forwardRef(
|
|
|
2671
4175
|
constraints: resolvedConstraints
|
|
2672
4176
|
}
|
|
2673
4177
|
),
|
|
2674
|
-
variant === "card" && isExpanded && !disableResize && !isMobile && /* @__PURE__ */ (0,
|
|
2675
|
-
/* @__PURE__ */ (0,
|
|
4178
|
+
variant === "card" && isExpanded && !disableResize && !isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4179
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2676
4180
|
"div",
|
|
2677
4181
|
{
|
|
2678
4182
|
className: "resize-handle resize-handle--horizontal resize-handle--top",
|
|
@@ -2688,7 +4192,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2688
4192
|
onKeyDown: (e) => handleCardResizeKeyDown(e, "height")
|
|
2689
4193
|
}
|
|
2690
4194
|
),
|
|
2691
|
-
/* @__PURE__ */ (0,
|
|
4195
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2692
4196
|
"div",
|
|
2693
4197
|
{
|
|
2694
4198
|
className: "resize-handle resize-handle--vertical resize-handle--left resize-handle--card-edge",
|
|
@@ -2704,7 +4208,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2704
4208
|
onKeyDown: (e) => handleCardResizeKeyDown(e, "width-left")
|
|
2705
4209
|
}
|
|
2706
4210
|
),
|
|
2707
|
-
/* @__PURE__ */ (0,
|
|
4211
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2708
4212
|
"div",
|
|
2709
4213
|
{
|
|
2710
4214
|
className: "resize-handle resize-handle--vertical resize-handle--right resize-handle--card-edge",
|
|
@@ -2730,10 +4234,10 @@ var DataPanel = React14.forwardRef(
|
|
|
2730
4234
|
DataPanel.displayName = "DataPanel";
|
|
2731
4235
|
|
|
2732
4236
|
// src/components/Skeleton.tsx
|
|
2733
|
-
var
|
|
2734
|
-
var
|
|
2735
|
-
var
|
|
2736
|
-
var skeletonVariants = (0,
|
|
4237
|
+
var React25 = __toESM(require("react"));
|
|
4238
|
+
var import_class_variance_authority6 = require("class-variance-authority");
|
|
4239
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4240
|
+
var skeletonVariants = (0, import_class_variance_authority6.cva)("rounded-md bg-muted", {
|
|
2737
4241
|
variants: {
|
|
2738
4242
|
variant: {
|
|
2739
4243
|
default: "",
|
|
@@ -2748,10 +4252,10 @@ var skeletonVariants = (0, import_class_variance_authority5.cva)("rounded-md bg-
|
|
|
2748
4252
|
variant: "default"
|
|
2749
4253
|
}
|
|
2750
4254
|
});
|
|
2751
|
-
var Skeleton =
|
|
4255
|
+
var Skeleton = React25.forwardRef(
|
|
2752
4256
|
({ className, variant, animation = "pulse", ...props }, ref) => {
|
|
2753
4257
|
const animationClass = animation === "pulse" ? "animate-pulse" : animation === "shimmer" ? "animate-shimmer" : "";
|
|
2754
|
-
return /* @__PURE__ */ (0,
|
|
4258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2755
4259
|
"div",
|
|
2756
4260
|
{
|
|
2757
4261
|
ref,
|
|
@@ -2764,10 +4268,10 @@ var Skeleton = React15.forwardRef(
|
|
|
2764
4268
|
Skeleton.displayName = "Skeleton";
|
|
2765
4269
|
|
|
2766
4270
|
// src/components/Spinner.tsx
|
|
2767
|
-
var
|
|
2768
|
-
var
|
|
2769
|
-
var
|
|
2770
|
-
var spinnerVariants = (0,
|
|
4271
|
+
var React26 = __toESM(require("react"));
|
|
4272
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
4273
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4274
|
+
var spinnerVariants = (0, import_class_variance_authority7.cva)("animate-spin text-current", {
|
|
2771
4275
|
variants: {
|
|
2772
4276
|
size: {
|
|
2773
4277
|
sm: "h-4 w-4",
|
|
@@ -2780,9 +4284,9 @@ var spinnerVariants = (0, import_class_variance_authority6.cva)("animate-spin te
|
|
|
2780
4284
|
size: "md"
|
|
2781
4285
|
}
|
|
2782
4286
|
});
|
|
2783
|
-
var Spinner =
|
|
4287
|
+
var Spinner = React26.forwardRef(
|
|
2784
4288
|
({ className, size, label = "Loading...", ...props }, ref) => {
|
|
2785
|
-
return /* @__PURE__ */ (0,
|
|
4289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2786
4290
|
"svg",
|
|
2787
4291
|
{
|
|
2788
4292
|
ref,
|
|
@@ -2794,7 +4298,7 @@ var Spinner = React16.forwardRef(
|
|
|
2794
4298
|
role: "status",
|
|
2795
4299
|
...props,
|
|
2796
4300
|
children: [
|
|
2797
|
-
/* @__PURE__ */ (0,
|
|
4301
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2798
4302
|
"circle",
|
|
2799
4303
|
{
|
|
2800
4304
|
className: "opacity-25",
|
|
@@ -2805,7 +4309,7 @@ var Spinner = React16.forwardRef(
|
|
|
2805
4309
|
strokeWidth: "4"
|
|
2806
4310
|
}
|
|
2807
4311
|
),
|
|
2808
|
-
/* @__PURE__ */ (0,
|
|
4312
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2809
4313
|
"path",
|
|
2810
4314
|
{
|
|
2811
4315
|
className: "opacity-75",
|
|
@@ -2813,7 +4317,7 @@ var Spinner = React16.forwardRef(
|
|
|
2813
4317
|
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
2814
4318
|
}
|
|
2815
4319
|
),
|
|
2816
|
-
/* @__PURE__ */ (0,
|
|
4320
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("title", { children: label })
|
|
2817
4321
|
]
|
|
2818
4322
|
}
|
|
2819
4323
|
);
|
|
@@ -2822,8 +4326,8 @@ var Spinner = React16.forwardRef(
|
|
|
2822
4326
|
Spinner.displayName = "Spinner";
|
|
2823
4327
|
|
|
2824
4328
|
// src/components/LoadingLogo.tsx
|
|
2825
|
-
var
|
|
2826
|
-
var
|
|
4329
|
+
var React27 = __toESM(require("react"));
|
|
4330
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2827
4331
|
var logoPaths = [
|
|
2828
4332
|
"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",
|
|
2829
4333
|
"M14.602 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",
|
|
@@ -2845,12 +4349,12 @@ var colors = {
|
|
|
2845
4349
|
stroke: "#ffffff"
|
|
2846
4350
|
}
|
|
2847
4351
|
};
|
|
2848
|
-
var LoadingLogo =
|
|
4352
|
+
var LoadingLogo = React27.forwardRef(
|
|
2849
4353
|
({ width = 40, height = 40, loading = false, variant = "dark", className, ...props }, ref) => {
|
|
2850
4354
|
const currentColors = colors[variant];
|
|
2851
4355
|
const fillColor = loading ? currentColors.fillLoading : currentColors.fill;
|
|
2852
4356
|
const strokeColor = currentColors.stroke;
|
|
2853
|
-
return /* @__PURE__ */ (0,
|
|
4357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2854
4358
|
"div",
|
|
2855
4359
|
{
|
|
2856
4360
|
ref,
|
|
@@ -2860,7 +4364,7 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2860
4364
|
"aria-label": loading ? "Loading" : "Classic Homes",
|
|
2861
4365
|
...props,
|
|
2862
4366
|
children: [
|
|
2863
|
-
/* @__PURE__ */ (0,
|
|
4367
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2864
4368
|
"svg",
|
|
2865
4369
|
{
|
|
2866
4370
|
width: "100%",
|
|
@@ -2870,8 +4374,8 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2870
4374
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2871
4375
|
"aria-hidden": "true",
|
|
2872
4376
|
children: [
|
|
2873
|
-
/* @__PURE__ */ (0,
|
|
2874
|
-
loading && /* @__PURE__ */ (0,
|
|
4377
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("g", { fill: fillColor, className: "transition-all duration-300", children: logoPaths.map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: path }, i)) }),
|
|
4378
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2875
4379
|
"g",
|
|
2876
4380
|
{
|
|
2877
4381
|
fill: "none",
|
|
@@ -2879,13 +4383,13 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2879
4383
|
strokeWidth: "0.5",
|
|
2880
4384
|
strokeDasharray: "10 4",
|
|
2881
4385
|
className: "animate-trace",
|
|
2882
|
-
children: logoPaths.map((path, i) => /* @__PURE__ */ (0,
|
|
4386
|
+
children: logoPaths.map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: path }, i))
|
|
2883
4387
|
}
|
|
2884
4388
|
)
|
|
2885
4389
|
]
|
|
2886
4390
|
}
|
|
2887
4391
|
),
|
|
2888
|
-
loading && /* @__PURE__ */ (0,
|
|
4392
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "sr-only", children: "Loading" })
|
|
2889
4393
|
]
|
|
2890
4394
|
}
|
|
2891
4395
|
);
|
|
@@ -2894,10 +4398,10 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2894
4398
|
LoadingLogo.displayName = "LoadingLogo";
|
|
2895
4399
|
|
|
2896
4400
|
// src/components/ProgressBar.tsx
|
|
2897
|
-
var
|
|
2898
|
-
var
|
|
2899
|
-
var
|
|
2900
|
-
var progressBarVariants = (0,
|
|
4401
|
+
var React28 = __toESM(require("react"));
|
|
4402
|
+
var import_class_variance_authority8 = require("class-variance-authority");
|
|
4403
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4404
|
+
var progressBarVariants = (0, import_class_variance_authority8.cva)("w-full overflow-hidden rounded-full bg-muted", {
|
|
2901
4405
|
variants: {
|
|
2902
4406
|
size: {
|
|
2903
4407
|
sm: "h-1",
|
|
@@ -2909,7 +4413,7 @@ var progressBarVariants = (0, import_class_variance_authority7.cva)("w-full over
|
|
|
2909
4413
|
size: "md"
|
|
2910
4414
|
}
|
|
2911
4415
|
});
|
|
2912
|
-
var progressFillVariants = (0,
|
|
4416
|
+
var progressFillVariants = (0, import_class_variance_authority8.cva)("h-full rounded-full transition-all duration-300", {
|
|
2913
4417
|
variants: {
|
|
2914
4418
|
variant: {
|
|
2915
4419
|
default: "bg-primary",
|
|
@@ -2922,12 +4426,12 @@ var progressFillVariants = (0, import_class_variance_authority7.cva)("h-full rou
|
|
|
2922
4426
|
variant: "default"
|
|
2923
4427
|
}
|
|
2924
4428
|
});
|
|
2925
|
-
var ProgressBar =
|
|
4429
|
+
var ProgressBar = React28.forwardRef(
|
|
2926
4430
|
({ className, size, variant, value, max = 100, label = "Progress", showValue = false, ...props }, ref) => {
|
|
2927
4431
|
const isIndeterminate = value === void 0;
|
|
2928
4432
|
const clampedValue = isIndeterminate ? 0 : Math.min(Math.max(0, value), max);
|
|
2929
4433
|
const percentage = isIndeterminate ? 0 : Math.round(clampedValue / max * 100);
|
|
2930
|
-
return /* @__PURE__ */ (0,
|
|
4434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2931
4435
|
"div",
|
|
2932
4436
|
{
|
|
2933
4437
|
ref,
|
|
@@ -2939,7 +4443,7 @@ var ProgressBar = React18.forwardRef(
|
|
|
2939
4443
|
className: cn("flex items-center gap-2", className),
|
|
2940
4444
|
...props,
|
|
2941
4445
|
children: [
|
|
2942
|
-
/* @__PURE__ */ (0,
|
|
4446
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(progressBarVariants({ size })), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2943
4447
|
"div",
|
|
2944
4448
|
{
|
|
2945
4449
|
className: cn(
|
|
@@ -2949,7 +4453,7 @@ var ProgressBar = React18.forwardRef(
|
|
|
2949
4453
|
style: isIndeterminate ? void 0 : { width: `${percentage}%` }
|
|
2950
4454
|
}
|
|
2951
4455
|
) }),
|
|
2952
|
-
showValue && !isIndeterminate && /* @__PURE__ */ (0,
|
|
4456
|
+
showValue && !isIndeterminate && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "text-sm tabular-nums text-muted-foreground", children: [
|
|
2953
4457
|
percentage,
|
|
2954
4458
|
"%"
|
|
2955
4459
|
] })
|
|
@@ -2961,11 +4465,11 @@ var ProgressBar = React18.forwardRef(
|
|
|
2961
4465
|
ProgressBar.displayName = "ProgressBar";
|
|
2962
4466
|
|
|
2963
4467
|
// src/components/LoadingOverlay.tsx
|
|
2964
|
-
var
|
|
2965
|
-
var
|
|
4468
|
+
var React29 = __toESM(require("react"));
|
|
4469
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2966
4470
|
var spinnerSizeMap = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
|
|
2967
4471
|
var logoSizeMap = { sm: 32, md: 40, lg: 56, xl: 80 };
|
|
2968
|
-
var LoadingOverlay =
|
|
4472
|
+
var LoadingOverlay = React29.forwardRef(
|
|
2969
4473
|
({
|
|
2970
4474
|
loading = true,
|
|
2971
4475
|
variant = "spinner",
|
|
@@ -2980,8 +4484,8 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
2980
4484
|
children,
|
|
2981
4485
|
...props
|
|
2982
4486
|
}, ref) => {
|
|
2983
|
-
const [visible, setVisible] =
|
|
2984
|
-
|
|
4487
|
+
const [visible, setVisible] = React29.useState(delay === 0 && loading);
|
|
4488
|
+
React29.useEffect(() => {
|
|
2985
4489
|
if (!loading) {
|
|
2986
4490
|
setVisible(false);
|
|
2987
4491
|
return;
|
|
@@ -2994,23 +4498,23 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
2994
4498
|
return () => clearTimeout(timer);
|
|
2995
4499
|
}, [loading, delay]);
|
|
2996
4500
|
if (!visible) {
|
|
2997
|
-
return mode === "inline" ? null : /* @__PURE__ */ (0,
|
|
4501
|
+
return mode === "inline" ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
|
|
2998
4502
|
}
|
|
2999
|
-
const indicator = /* @__PURE__ */ (0,
|
|
3000
|
-
variant === "spinner" && /* @__PURE__ */ (0,
|
|
3001
|
-
variant === "logo" && /* @__PURE__ */ (0,
|
|
3002
|
-
variant === "progress" && /* @__PURE__ */ (0,
|
|
3003
|
-
variant === "skeleton" && /* @__PURE__ */ (0,
|
|
3004
|
-
/* @__PURE__ */ (0,
|
|
3005
|
-
/* @__PURE__ */ (0,
|
|
3006
|
-
/* @__PURE__ */ (0,
|
|
3007
|
-
/* @__PURE__ */ (0,
|
|
4503
|
+
const indicator = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4504
|
+
variant === "spinner" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Spinner, { size: spinnerSizeMap[size] }),
|
|
4505
|
+
variant === "logo" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LoadingLogo, { loading: true, width: logoSizeMap[size], height: logoSizeMap[size] }),
|
|
4506
|
+
variant === "progress" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ProgressBar, { value: progress, className: "w-48 max-w-full" }),
|
|
4507
|
+
variant === "skeleton" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "w-full space-y-3", children: [
|
|
4508
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { variant: "title" }),
|
|
4509
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { variant: "text" }),
|
|
4510
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { variant: "text" }),
|
|
4511
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { variant: "text", className: "w-2/3" })
|
|
3008
4512
|
] }),
|
|
3009
|
-
message && /* @__PURE__ */ (0,
|
|
3010
|
-
!message && /* @__PURE__ */ (0,
|
|
4513
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "mt-2 text-sm text-muted-foreground animate-pulse-subtle", children: message }),
|
|
4514
|
+
!message && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "sr-only", children: "Loading" })
|
|
3011
4515
|
] });
|
|
3012
4516
|
if (mode === "inline") {
|
|
3013
|
-
return /* @__PURE__ */ (0,
|
|
4517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3014
4518
|
"div",
|
|
3015
4519
|
{
|
|
3016
4520
|
ref,
|
|
@@ -3024,9 +4528,9 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
3024
4528
|
}
|
|
3025
4529
|
const bgClass = opaque ? "bg-background" : mode === "fullscreen" ? "bg-background/80" : "bg-background/60";
|
|
3026
4530
|
const positionClass = mode === "fullscreen" ? "fixed inset-0 z-50" : "absolute inset-0 z-10";
|
|
3027
|
-
return /* @__PURE__ */ (0,
|
|
4531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3028
4532
|
children,
|
|
3029
|
-
/* @__PURE__ */ (0,
|
|
4533
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3030
4534
|
"div",
|
|
3031
4535
|
{
|
|
3032
4536
|
ref,
|
|
@@ -3049,9 +4553,9 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
3049
4553
|
LoadingOverlay.displayName = "LoadingOverlay";
|
|
3050
4554
|
|
|
3051
4555
|
// src/components/LoadingPage.tsx
|
|
3052
|
-
var
|
|
3053
|
-
var
|
|
3054
|
-
var LoadingPage =
|
|
4556
|
+
var React30 = __toESM(require("react"));
|
|
4557
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4558
|
+
var LoadingPage = React30.forwardRef(
|
|
3055
4559
|
({
|
|
3056
4560
|
loading = true,
|
|
3057
4561
|
message,
|
|
@@ -3062,8 +4566,8 @@ var LoadingPage = React20.forwardRef(
|
|
|
3062
4566
|
className,
|
|
3063
4567
|
...props
|
|
3064
4568
|
}, ref) => {
|
|
3065
|
-
const [visible, setVisible] =
|
|
3066
|
-
|
|
4569
|
+
const [visible, setVisible] = React30.useState(delay === 0 && loading);
|
|
4570
|
+
React30.useEffect(() => {
|
|
3067
4571
|
if (!loading) {
|
|
3068
4572
|
setVisible(false);
|
|
3069
4573
|
return;
|
|
@@ -3076,7 +4580,7 @@ var LoadingPage = React20.forwardRef(
|
|
|
3076
4580
|
return () => clearTimeout(timer);
|
|
3077
4581
|
}, [loading, delay]);
|
|
3078
4582
|
if (!visible) return null;
|
|
3079
|
-
return /* @__PURE__ */ (0,
|
|
4583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3080
4584
|
"div",
|
|
3081
4585
|
{
|
|
3082
4586
|
ref,
|
|
@@ -3088,10 +4592,10 @@ var LoadingPage = React20.forwardRef(
|
|
|
3088
4592
|
),
|
|
3089
4593
|
...props,
|
|
3090
4594
|
children: [
|
|
3091
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
3092
|
-
progress !== void 0 && /* @__PURE__ */ (0,
|
|
3093
|
-
message && /* @__PURE__ */ (0,
|
|
3094
|
-
/* @__PURE__ */ (0,
|
|
4595
|
+
showLogo ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LoadingLogo, { loading: true, width: 64, height: 64, variant: logoVariant }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Spinner, { size: "xl" }),
|
|
4596
|
+
progress !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ProgressBar, { value: progress, className: "mt-6 w-48 max-w-full" }),
|
|
4597
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "mt-4 text-sm text-muted-foreground animate-pulse-subtle", children: message }),
|
|
4598
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "sr-only", children: [
|
|
3095
4599
|
message || "Loading",
|
|
3096
4600
|
progress !== void 0 && `, ${Math.round(progress)}% complete`
|
|
3097
4601
|
] })
|
|
@@ -3103,9 +4607,9 @@ var LoadingPage = React20.forwardRef(
|
|
|
3103
4607
|
LoadingPage.displayName = "LoadingPage";
|
|
3104
4608
|
|
|
3105
4609
|
// src/components/LoadingSection.tsx
|
|
3106
|
-
var
|
|
3107
|
-
var
|
|
3108
|
-
var LoadingSection =
|
|
4610
|
+
var React31 = __toESM(require("react"));
|
|
4611
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4612
|
+
var LoadingSection = React31.forwardRef(
|
|
3109
4613
|
({
|
|
3110
4614
|
loading = false,
|
|
3111
4615
|
variant = "spinner",
|
|
@@ -3118,7 +4622,7 @@ var LoadingSection = React21.forwardRef(
|
|
|
3118
4622
|
children,
|
|
3119
4623
|
...props
|
|
3120
4624
|
}, ref) => {
|
|
3121
|
-
return /* @__PURE__ */ (0,
|
|
4625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3122
4626
|
"div",
|
|
3123
4627
|
{
|
|
3124
4628
|
ref,
|
|
@@ -3128,7 +4632,7 @@ var LoadingSection = React21.forwardRef(
|
|
|
3128
4632
|
...props,
|
|
3129
4633
|
children: [
|
|
3130
4634
|
children,
|
|
3131
|
-
loading && /* @__PURE__ */ (0,
|
|
4635
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3132
4636
|
LoadingOverlay,
|
|
3133
4637
|
{
|
|
3134
4638
|
mode: "overlay",
|
|
@@ -3147,11 +4651,11 @@ var LoadingSection = React21.forwardRef(
|
|
|
3147
4651
|
LoadingSection.displayName = "LoadingSection";
|
|
3148
4652
|
|
|
3149
4653
|
// src/components/LiveRegion.tsx
|
|
3150
|
-
var
|
|
3151
|
-
var
|
|
3152
|
-
var LiveRegion =
|
|
4654
|
+
var React32 = __toESM(require("react"));
|
|
4655
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4656
|
+
var LiveRegion = React32.forwardRef(
|
|
3153
4657
|
({ message, politeness = "polite", atomic = true, visuallyHidden = true, className, children }, ref) => {
|
|
3154
|
-
return /* @__PURE__ */ (0,
|
|
4658
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3155
4659
|
"div",
|
|
3156
4660
|
{
|
|
3157
4661
|
ref,
|
|
@@ -3170,9 +4674,9 @@ var LiveRegion = React22.forwardRef(
|
|
|
3170
4674
|
LiveRegion.displayName = "LiveRegion";
|
|
3171
4675
|
|
|
3172
4676
|
// src/components/SkipLink.tsx
|
|
3173
|
-
var
|
|
3174
|
-
var
|
|
3175
|
-
var SkipLink =
|
|
4677
|
+
var React33 = __toESM(require("react"));
|
|
4678
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4679
|
+
var SkipLink = React33.forwardRef(
|
|
3176
4680
|
({ targetId, className, children = "Skip to main content", ...props }, ref) => {
|
|
3177
4681
|
const handleClick = (e) => {
|
|
3178
4682
|
e.preventDefault();
|
|
@@ -3190,7 +4694,7 @@ var SkipLink = React23.forwardRef(
|
|
|
3190
4694
|
}
|
|
3191
4695
|
props.onClick?.(e);
|
|
3192
4696
|
};
|
|
3193
|
-
return /* @__PURE__ */ (0,
|
|
4697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3194
4698
|
"a",
|
|
3195
4699
|
{
|
|
3196
4700
|
ref,
|
|
@@ -3478,21 +4982,21 @@ function useRovingTabindex(options = {}) {
|
|
|
3478
4982
|
}
|
|
3479
4983
|
|
|
3480
4984
|
// src/hooks/useClickOutside.ts
|
|
3481
|
-
var
|
|
4985
|
+
var React34 = __toESM(require("react"));
|
|
3482
4986
|
function useClickOutside(ref, callback, options) {
|
|
3483
4987
|
const {
|
|
3484
4988
|
enabled = true,
|
|
3485
4989
|
events = ["mousedown", "touchstart"],
|
|
3486
4990
|
ignoreElements = []
|
|
3487
4991
|
} = options ?? {};
|
|
3488
|
-
const callbackRef =
|
|
3489
|
-
const ignoreElementsRef =
|
|
3490
|
-
|
|
4992
|
+
const callbackRef = React34.useRef(callback);
|
|
4993
|
+
const ignoreElementsRef = React34.useRef(ignoreElements);
|
|
4994
|
+
React34.useEffect(() => {
|
|
3491
4995
|
callbackRef.current = callback;
|
|
3492
4996
|
ignoreElementsRef.current = ignoreElements;
|
|
3493
4997
|
}, [callback, ignoreElements]);
|
|
3494
4998
|
const eventsKey = events.join(",");
|
|
3495
|
-
|
|
4999
|
+
React34.useEffect(() => {
|
|
3496
5000
|
if (!enabled) return;
|
|
3497
5001
|
const handleEvent = (event) => {
|
|
3498
5002
|
const target = event.target;
|
|
@@ -3546,6 +5050,8 @@ function useClickOutside(ref, callback, options) {
|
|
|
3546
5050
|
DialogTitle,
|
|
3547
5051
|
DialogTrigger,
|
|
3548
5052
|
Input,
|
|
5053
|
+
InsertPalette,
|
|
5054
|
+
IssuesButton,
|
|
3549
5055
|
Label,
|
|
3550
5056
|
LiveRegion,
|
|
3551
5057
|
LoadingLogo,
|
|
@@ -3555,10 +5061,21 @@ function useClickOutside(ref, callback, options) {
|
|
|
3555
5061
|
PageHeader,
|
|
3556
5062
|
PasswordInput,
|
|
3557
5063
|
ProgressBar,
|
|
5064
|
+
SaveStatus,
|
|
3558
5065
|
Separator,
|
|
5066
|
+
Sheet,
|
|
3559
5067
|
Skeleton,
|
|
3560
5068
|
SkipLink,
|
|
5069
|
+
SortableList,
|
|
3561
5070
|
Spinner,
|
|
5071
|
+
Studio,
|
|
5072
|
+
StudioBar,
|
|
5073
|
+
StudioCanvas,
|
|
5074
|
+
StudioCanvasItem,
|
|
5075
|
+
StudioInspector,
|
|
5076
|
+
StudioInspectorSection,
|
|
5077
|
+
StudioOutline,
|
|
5078
|
+
StudioPage,
|
|
3562
5079
|
Switch,
|
|
3563
5080
|
badgeVariants,
|
|
3564
5081
|
buttonVariants,
|
|
@@ -3578,5 +5095,6 @@ function useClickOutside(ref, callback, options) {
|
|
|
3578
5095
|
useFocusRef,
|
|
3579
5096
|
useFocusTrap,
|
|
3580
5097
|
useReducedMotion,
|
|
3581
|
-
useRovingTabindex
|
|
5098
|
+
useRovingTabindex,
|
|
5099
|
+
useStudio
|
|
3582
5100
|
});
|