@classic-homes/theme-react 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +419 -1
- package/dist/index.d.ts +419 -1
- package/dist/index.js +1801 -279
- package/dist/index.mjs +1815 -307
- 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,1496 @@ 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 select = (reveal) => {
|
|
1726
|
+
if (!selected) onSelect?.();
|
|
1727
|
+
if (reveal) studio?.revealInspector();
|
|
1728
|
+
};
|
|
1729
|
+
React19.useEffect(() => {
|
|
1730
|
+
const el = ref.current;
|
|
1731
|
+
if (!selected || !el || el.contains(document.activeElement)) return;
|
|
1732
|
+
const reduce = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
1733
|
+
el.scrollIntoView?.({ block: "nearest", behavior: reduce ? "auto" : "smooth" });
|
|
1734
|
+
}, [selected]);
|
|
1735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1736
|
+
"div",
|
|
1737
|
+
{
|
|
1738
|
+
ref,
|
|
1739
|
+
role: "group",
|
|
1740
|
+
"aria-label": label,
|
|
1741
|
+
"aria-current": selected ? "true" : void 0,
|
|
1742
|
+
"data-selected": selected || void 0,
|
|
1743
|
+
className: cn(
|
|
1744
|
+
"group/item relative scroll-my-6 rounded-lg transition-shadow",
|
|
1745
|
+
// Problems are a dashed amber outline: with a red brand primary, a red
|
|
1746
|
+
// ring would read as "selected"
|
|
1747
|
+
selected ? "ring-2 ring-primary" : "hover:ring-1 hover:ring-border",
|
|
1748
|
+
invalid && "-outline-offset-2 outline-dashed outline-2 outline-warning/70",
|
|
1749
|
+
className
|
|
1750
|
+
),
|
|
1751
|
+
onClickCapture: (e) => select(!e.target.closest?.("[data-studio-quick-action]")),
|
|
1752
|
+
onFocus: () => select(false),
|
|
1753
|
+
children: [
|
|
1754
|
+
!selected && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1755
|
+
"button",
|
|
1756
|
+
{
|
|
1757
|
+
type: "button",
|
|
1758
|
+
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",
|
|
1759
|
+
onClick: () => select(true),
|
|
1760
|
+
children: [
|
|
1761
|
+
"Edit ",
|
|
1762
|
+
label
|
|
1763
|
+
]
|
|
1764
|
+
}
|
|
1765
|
+
),
|
|
1766
|
+
selected && toolbar && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1767
|
+
"div",
|
|
1768
|
+
{
|
|
1769
|
+
"data-studio-quick-action": "",
|
|
1770
|
+
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",
|
|
1771
|
+
children: toolbar
|
|
1772
|
+
}
|
|
1773
|
+
),
|
|
1774
|
+
children,
|
|
1775
|
+
onInsert && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "relative h-0", "data-studio-quick-action": "", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1776
|
+
"button",
|
|
1777
|
+
{
|
|
1778
|
+
type: "button",
|
|
1779
|
+
"aria-label": insertLabel ?? `Add below ${label}`,
|
|
1780
|
+
title: insertLabel ?? "Add below",
|
|
1781
|
+
className: cn(
|
|
1782
|
+
"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",
|
|
1783
|
+
selected && "opacity-100"
|
|
1784
|
+
),
|
|
1785
|
+
onClick: (e) => {
|
|
1786
|
+
e.stopPropagation();
|
|
1787
|
+
onInsert();
|
|
1788
|
+
},
|
|
1789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StudioIcon, { name: "plus", size: 14 })
|
|
1790
|
+
}
|
|
1791
|
+
) })
|
|
1792
|
+
]
|
|
1793
|
+
}
|
|
1794
|
+
);
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
// src/components/studio/StudioInspector.tsx
|
|
1798
|
+
var React20 = __toESM(require("react"));
|
|
1799
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1800
|
+
function StudioInspector({
|
|
1801
|
+
title,
|
|
1802
|
+
description,
|
|
1803
|
+
headerActions,
|
|
1804
|
+
tabs,
|
|
1805
|
+
tab: tabProp,
|
|
1806
|
+
onTabChange,
|
|
1807
|
+
children,
|
|
1808
|
+
footer,
|
|
1809
|
+
className
|
|
1810
|
+
}) {
|
|
1811
|
+
const uid = React20.useId();
|
|
1812
|
+
const [innerTab, setInnerTab] = React20.useState(tabs?.[0]?.id ?? "");
|
|
1813
|
+
const tab = tabProp ?? innerTab;
|
|
1814
|
+
const hasTabs = !!tabs && tabs.length > 1;
|
|
1815
|
+
const choose = (id) => {
|
|
1816
|
+
if (id === tab) return;
|
|
1817
|
+
if (tabProp === void 0) setInnerTab(id);
|
|
1818
|
+
onTabChange?.(id);
|
|
1819
|
+
};
|
|
1820
|
+
const keyDown = (event, index) => {
|
|
1821
|
+
if (!tabs) return;
|
|
1822
|
+
const step = event.key === "ArrowRight" ? 1 : event.key === "ArrowLeft" ? -1 : 0;
|
|
1823
|
+
if (!step) return;
|
|
1824
|
+
event.preventDefault();
|
|
1825
|
+
const next = tabs[(index + step + tabs.length) % tabs.length];
|
|
1826
|
+
choose(next.id);
|
|
1827
|
+
document.getElementById(`${uid}-tab-${next.id}`)?.focus();
|
|
1828
|
+
};
|
|
1829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cn("flex h-full min-h-0 flex-col", className), children: [
|
|
1830
|
+
(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: [
|
|
1831
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
1832
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { className: "truncate text-sm font-semibold", children: title }),
|
|
1833
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "truncate text-xs text-muted-foreground", children: description })
|
|
1834
|
+
] }),
|
|
1835
|
+
headerActions && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex shrink-0 items-center gap-1", children: headerActions })
|
|
1836
|
+
] }),
|
|
1837
|
+
hasTabs && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1838
|
+
"div",
|
|
1839
|
+
{
|
|
1840
|
+
role: "tablist",
|
|
1841
|
+
"aria-label": title ?? "Inspector",
|
|
1842
|
+
className: "flex shrink-0 gap-4 border-b border-border px-4",
|
|
1843
|
+
children: tabs.map((t, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1844
|
+
"button",
|
|
1845
|
+
{
|
|
1846
|
+
type: "button",
|
|
1847
|
+
role: "tab",
|
|
1848
|
+
id: `${uid}-tab-${t.id}`,
|
|
1849
|
+
"aria-selected": t.id === tab,
|
|
1850
|
+
"aria-controls": `${uid}-panel`,
|
|
1851
|
+
tabIndex: t.id === tab ? 0 : -1,
|
|
1852
|
+
onClick: () => choose(t.id),
|
|
1853
|
+
onKeyDown: (e) => keyDown(e, index),
|
|
1854
|
+
className: cn(
|
|
1855
|
+
"-mb-px border-b-2 py-2 text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1856
|
+
t.id === tab ? "border-primary text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
1857
|
+
),
|
|
1858
|
+
children: [
|
|
1859
|
+
t.label,
|
|
1860
|
+
!!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 })
|
|
1861
|
+
]
|
|
1862
|
+
},
|
|
1863
|
+
t.id
|
|
1864
|
+
))
|
|
1865
|
+
}
|
|
1866
|
+
),
|
|
1867
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1868
|
+
"div",
|
|
1869
|
+
{
|
|
1870
|
+
className: "min-h-0 flex-1 overflow-y-auto",
|
|
1871
|
+
id: hasTabs ? `${uid}-panel` : void 0,
|
|
1872
|
+
role: hasTabs ? "tabpanel" : void 0,
|
|
1873
|
+
"aria-labelledby": hasTabs ? `${uid}-tab-${tab}` : void 0,
|
|
1874
|
+
children
|
|
1875
|
+
}
|
|
1876
|
+
),
|
|
1877
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "shrink-0 border-t border-border px-4 py-3", children: footer })
|
|
1878
|
+
] });
|
|
1879
|
+
}
|
|
1880
|
+
function StudioInspectorSection({
|
|
1881
|
+
title,
|
|
1882
|
+
description,
|
|
1883
|
+
collapsible = false,
|
|
1884
|
+
defaultOpen = false,
|
|
1885
|
+
summary,
|
|
1886
|
+
children,
|
|
1887
|
+
className
|
|
1888
|
+
}) {
|
|
1889
|
+
const uid = React20.useId();
|
|
1890
|
+
const [open, setOpen] = React20.useState(defaultOpen);
|
|
1891
|
+
const expanded = !collapsible || open;
|
|
1892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1893
|
+
"section",
|
|
1894
|
+
{
|
|
1895
|
+
className: cn("border-b border-border px-4 py-4 last:border-b-0", className),
|
|
1896
|
+
"aria-labelledby": title ? `${uid}-title` : void 0,
|
|
1897
|
+
children: [
|
|
1898
|
+
title && (collapsible ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { id: `${uid}-title`, className: "-my-1", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1899
|
+
"button",
|
|
1900
|
+
{
|
|
1901
|
+
type: "button",
|
|
1902
|
+
"aria-expanded": open,
|
|
1903
|
+
"aria-controls": `${uid}-body`,
|
|
1904
|
+
onClick: () => setOpen(!open),
|
|
1905
|
+
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",
|
|
1906
|
+
children: [
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1908
|
+
StudioIcon,
|
|
1909
|
+
{
|
|
1910
|
+
name: "chevron-right",
|
|
1911
|
+
className: cn("text-muted-foreground transition-transform", open && "rotate-90")
|
|
1912
|
+
}
|
|
1913
|
+
),
|
|
1914
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1", children: title }),
|
|
1915
|
+
summary && !open && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs font-normal text-muted-foreground", children: summary })
|
|
1916
|
+
]
|
|
1917
|
+
}
|
|
1918
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { id: `${uid}-title`, className: "text-sm font-semibold", children: title })),
|
|
1919
|
+
title && description && expanded && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: description }),
|
|
1920
|
+
expanded && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { id: `${uid}-body`, className: cn("space-y-4", title && "mt-3"), children })
|
|
1921
|
+
]
|
|
1922
|
+
}
|
|
1923
|
+
);
|
|
1924
|
+
}
|
|
1925
|
+
function StudioPage({
|
|
1926
|
+
title,
|
|
1927
|
+
description,
|
|
1928
|
+
children,
|
|
1929
|
+
maxWidth = "42rem",
|
|
1930
|
+
className
|
|
1931
|
+
}) {
|
|
1932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "h-full overflow-y-auto bg-muted/40", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
1933
|
+
"div",
|
|
1934
|
+
{
|
|
1935
|
+
className: cn("mx-auto w-full space-y-6 px-4 py-6 md:py-10", className),
|
|
1936
|
+
style: { maxWidth },
|
|
1937
|
+
children: [
|
|
1938
|
+
(title || description) && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
1939
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h2", { className: "text-xl font-semibold", children: title }),
|
|
1940
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
1941
|
+
] }),
|
|
1942
|
+
children
|
|
1943
|
+
]
|
|
1944
|
+
}
|
|
1945
|
+
) });
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
// src/components/studio/SaveStatus.tsx
|
|
1949
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
1950
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1951
|
+
var META = {
|
|
1952
|
+
saved: { label: "Saved", icon: "check-circle", tone: "text-muted-foreground" },
|
|
1953
|
+
saving: { label: "Saving\u2026", icon: "loader", tone: "text-muted-foreground" },
|
|
1954
|
+
unsaved: { label: "Unsaved", icon: "edit", tone: "text-muted-foreground" },
|
|
1955
|
+
error: { label: "Not saved", icon: "alert-circle", tone: "text-destructive" },
|
|
1956
|
+
offline: { label: "Offline", icon: "wifi-off", tone: "text-warning" },
|
|
1957
|
+
conflict: { label: "Conflict", icon: "alert-triangle", tone: "text-destructive" },
|
|
1958
|
+
invalid: { label: "Needs fixes", icon: "alert-triangle", tone: "text-warning" },
|
|
1959
|
+
readonly: { label: "View only", icon: "eye", tone: "text-muted-foreground" }
|
|
1960
|
+
};
|
|
1961
|
+
var chip = "inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-sm font-medium text-foreground";
|
|
1962
|
+
function SaveStatus({ state, detail, onRetry, label, className }) {
|
|
1963
|
+
const meta = META[state];
|
|
1964
|
+
const text = label ?? meta.label;
|
|
1965
|
+
const canRetry = !!onRetry && (state === "error" || state === "offline");
|
|
1966
|
+
const announced = ["error", "offline", "conflict", "invalid"].includes(state);
|
|
1967
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1968
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1969
|
+
StudioIcon,
|
|
1970
|
+
{
|
|
1971
|
+
name: meta.icon,
|
|
1972
|
+
className: cn(meta.tone, state === "saving" && "animate-spin")
|
|
1973
|
+
}
|
|
1974
|
+
),
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "sr-only sm:not-sr-only", children: text })
|
|
1976
|
+
] });
|
|
1977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("inline-flex", className), children: [
|
|
1978
|
+
detail || canRetry ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(PopoverPrimitive.Root, { children: [
|
|
1979
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1980
|
+
PopoverPrimitive.Trigger,
|
|
1981
|
+
{
|
|
1982
|
+
className: cn(
|
|
1983
|
+
chip,
|
|
1984
|
+
"hover:bg-muted-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
1985
|
+
),
|
|
1986
|
+
"aria-label": `Save status: ${text}. Show details`,
|
|
1987
|
+
children: [
|
|
1988
|
+
content,
|
|
1989
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StudioIcon, { name: "chevron-down", size: 14, className: "text-muted-foreground" })
|
|
1990
|
+
]
|
|
1991
|
+
}
|
|
1992
|
+
),
|
|
1993
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1994
|
+
PopoverPrimitive.Content,
|
|
1995
|
+
{
|
|
1996
|
+
align: "end",
|
|
1997
|
+
sideOffset: 6,
|
|
1998
|
+
collisionPadding: 8,
|
|
1999
|
+
className: "z-50 w-72 rounded-md border border-border bg-popover p-3 text-sm text-popover-foreground shadow-md",
|
|
2000
|
+
children: [
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "font-medium", children: text }),
|
|
2002
|
+
detail && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "mt-1 text-muted-foreground", children: detail }),
|
|
2003
|
+
canRetry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2004
|
+
"button",
|
|
2005
|
+
{
|
|
2006
|
+
type: "button",
|
|
2007
|
+
onClick: onRetry,
|
|
2008
|
+
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",
|
|
2009
|
+
children: [
|
|
2010
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StudioIcon, { name: "refresh", size: 14 }),
|
|
2011
|
+
"Retry"
|
|
2012
|
+
]
|
|
2013
|
+
}
|
|
2014
|
+
)
|
|
2015
|
+
]
|
|
2016
|
+
}
|
|
2017
|
+
) })
|
|
2018
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: chip, children: content }),
|
|
2019
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "sr-only", role: "status", "aria-live": "polite", children: announced ? text : "" })
|
|
2020
|
+
] });
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
// src/components/studio/IssuesButton.tsx
|
|
2024
|
+
var React21 = __toESM(require("react"));
|
|
2025
|
+
var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"));
|
|
2026
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2027
|
+
var plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
2028
|
+
function IssuesButton({
|
|
2029
|
+
issues,
|
|
2030
|
+
onSelect,
|
|
2031
|
+
open: openProp,
|
|
2032
|
+
onOpenChange,
|
|
2033
|
+
title = "Before you publish",
|
|
2034
|
+
showWhenEmpty = false,
|
|
2035
|
+
className
|
|
2036
|
+
}) {
|
|
2037
|
+
const [innerOpen, setInnerOpen] = React21.useState(false);
|
|
2038
|
+
const open = openProp ?? innerOpen;
|
|
2039
|
+
const setOpen = (next) => {
|
|
2040
|
+
if (openProp === void 0) setInnerOpen(next);
|
|
2041
|
+
onOpenChange?.(next);
|
|
2042
|
+
};
|
|
2043
|
+
const errors = issues.filter((i) => (i.severity ?? "error") === "error");
|
|
2044
|
+
const warnings = issues.filter((i) => i.severity === "warning");
|
|
2045
|
+
const countLabel = [
|
|
2046
|
+
errors.length ? `${plural(errors.length, "issue", "issues")} to fix` : "",
|
|
2047
|
+
warnings.length ? plural(warnings.length, "suggestion", "suggestions") : ""
|
|
2048
|
+
].filter(Boolean).join(", ");
|
|
2049
|
+
if (issues.length === 0) {
|
|
2050
|
+
return showWhenEmpty ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2051
|
+
"span",
|
|
2052
|
+
{
|
|
2053
|
+
className: cn(
|
|
2054
|
+
"inline-flex h-8 items-center gap-1.5 px-2 text-sm text-muted-foreground",
|
|
2055
|
+
className
|
|
2056
|
+
),
|
|
2057
|
+
children: [
|
|
2058
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StudioIcon, { name: "check-circle", className: "text-success" }),
|
|
2059
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only sm:not-sr-only", children: "No issues" })
|
|
2060
|
+
]
|
|
2061
|
+
}
|
|
2062
|
+
) : null;
|
|
2063
|
+
}
|
|
2064
|
+
const group = (list, heading, error) => list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
2065
|
+
/* @__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 }),
|
|
2066
|
+
/* @__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)(
|
|
2067
|
+
"button",
|
|
2068
|
+
{
|
|
2069
|
+
type: "button",
|
|
2070
|
+
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",
|
|
2071
|
+
onClick: () => {
|
|
2072
|
+
setOpen(false);
|
|
2073
|
+
onSelect?.(issue);
|
|
2074
|
+
},
|
|
2075
|
+
children: [
|
|
2076
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2077
|
+
StudioIcon,
|
|
2078
|
+
{
|
|
2079
|
+
name: error ? "alert-circle" : "info",
|
|
2080
|
+
className: cn("mt-0.5", error ? "text-destructive" : "text-warning")
|
|
2081
|
+
}
|
|
2082
|
+
),
|
|
2083
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
2084
|
+
issue.location && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "block text-xs text-muted-foreground", children: issue.location }),
|
|
2085
|
+
issue.message
|
|
2086
|
+
] })
|
|
2087
|
+
]
|
|
2088
|
+
}
|
|
2089
|
+
) }, issue.id)) })
|
|
2090
|
+
] });
|
|
2091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(PopoverPrimitive2.Root, { open, onOpenChange: setOpen, children: [
|
|
2092
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2093
|
+
PopoverPrimitive2.Trigger,
|
|
2094
|
+
{
|
|
2095
|
+
"aria-label": countLabel,
|
|
2096
|
+
className: cn(
|
|
2097
|
+
"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",
|
|
2098
|
+
className
|
|
2099
|
+
),
|
|
2100
|
+
children: [
|
|
2101
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2102
|
+
StudioIcon,
|
|
2103
|
+
{
|
|
2104
|
+
name: "alert-triangle",
|
|
2105
|
+
className: errors.length ? "text-destructive" : "text-warning"
|
|
2106
|
+
}
|
|
2107
|
+
),
|
|
2108
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": "true", children: issues.length })
|
|
2109
|
+
]
|
|
2110
|
+
}
|
|
2111
|
+
),
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PopoverPrimitive2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2113
|
+
PopoverPrimitive2.Content,
|
|
2114
|
+
{
|
|
2115
|
+
align: "end",
|
|
2116
|
+
sideOffset: 6,
|
|
2117
|
+
collisionPadding: 8,
|
|
2118
|
+
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",
|
|
2119
|
+
children: [
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "border-b border-border px-3 py-2", children: [
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-semibold", children: title }),
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-muted-foreground", children: countLabel })
|
|
2123
|
+
] }),
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "overflow-y-auto", children: [
|
|
2125
|
+
group(errors, "Must fix", true),
|
|
2126
|
+
group(warnings, "Suggestions", false)
|
|
2127
|
+
] })
|
|
2128
|
+
]
|
|
2129
|
+
}
|
|
2130
|
+
) })
|
|
2131
|
+
] });
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
// src/components/studio/InsertPalette.tsx
|
|
2135
|
+
var React22 = __toESM(require("react"));
|
|
2136
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2137
|
+
function InsertPalette({
|
|
2138
|
+
open,
|
|
2139
|
+
onOpenChange,
|
|
2140
|
+
groups,
|
|
2141
|
+
onSelect,
|
|
2142
|
+
title = "Add",
|
|
2143
|
+
description,
|
|
2144
|
+
searchPlaceholder = "Search",
|
|
2145
|
+
renderThumbnail
|
|
2146
|
+
}) {
|
|
2147
|
+
const [query, setQuery] = React22.useState("");
|
|
2148
|
+
const listRef = React22.useRef(null);
|
|
2149
|
+
const searchRef = React22.useRef(null);
|
|
2150
|
+
React22.useEffect(() => {
|
|
2151
|
+
if (open) setQuery("");
|
|
2152
|
+
}, [open]);
|
|
2153
|
+
const q = query.trim().toLowerCase();
|
|
2154
|
+
const filtered = q ? groups.map((g) => ({
|
|
2155
|
+
...g,
|
|
2156
|
+
items: g.items.filter(
|
|
2157
|
+
(item) => [item.label, item.description ?? "", ...item.keywords ?? []].some(
|
|
2158
|
+
(t) => t.toLowerCase().includes(q)
|
|
2159
|
+
)
|
|
2160
|
+
)
|
|
2161
|
+
})).filter((g) => g.items.length > 0) : groups;
|
|
2162
|
+
const firstMatch = filtered.flatMap((g) => g.items).find((i) => !i.disabled);
|
|
2163
|
+
const choose = (item) => {
|
|
2164
|
+
if (item.disabled) return;
|
|
2165
|
+
onOpenChange(false);
|
|
2166
|
+
onSelect(item.id);
|
|
2167
|
+
};
|
|
2168
|
+
const entries = () => Array.from(listRef.current?.querySelectorAll("[data-palette-item]") ?? []);
|
|
2169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2170
|
+
DialogContent,
|
|
2171
|
+
{
|
|
2172
|
+
size: renderThumbnail ? "2xl" : "xl",
|
|
2173
|
+
className: "max-h-[calc(100dvh-2rem)] overflow-y-auto",
|
|
2174
|
+
onOpenAutoFocus: (e) => {
|
|
2175
|
+
e.preventDefault();
|
|
2176
|
+
searchRef.current?.focus();
|
|
2177
|
+
},
|
|
2178
|
+
...description ? {} : { "aria-describedby": void 0 },
|
|
2179
|
+
children: [
|
|
2180
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogTitle, { children: title }),
|
|
2181
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogDescription, { children: description }),
|
|
2182
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative", children: [
|
|
2183
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2184
|
+
StudioIcon,
|
|
2185
|
+
{
|
|
2186
|
+
name: "search",
|
|
2187
|
+
className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
|
|
2188
|
+
}
|
|
2189
|
+
),
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2191
|
+
"input",
|
|
2192
|
+
{
|
|
2193
|
+
ref: searchRef,
|
|
2194
|
+
type: "search",
|
|
2195
|
+
value: query,
|
|
2196
|
+
onChange: (e) => setQuery(e.target.value),
|
|
2197
|
+
"aria-label": searchPlaceholder,
|
|
2198
|
+
placeholder: searchPlaceholder,
|
|
2199
|
+
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",
|
|
2200
|
+
onKeyDown: (e) => {
|
|
2201
|
+
if (e.key === "Enter" && firstMatch) {
|
|
2202
|
+
e.preventDefault();
|
|
2203
|
+
choose(firstMatch);
|
|
2204
|
+
} else if (e.key === "ArrowDown") {
|
|
2205
|
+
e.preventDefault();
|
|
2206
|
+
entries()[0]?.focus();
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
)
|
|
2211
|
+
] }),
|
|
2212
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { ref: listRef, className: "space-y-5", children: [
|
|
2213
|
+
filtered.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("p", { className: "py-8 text-center text-sm text-muted-foreground", children: [
|
|
2214
|
+
"Nothing matches \u201C",
|
|
2215
|
+
query,
|
|
2216
|
+
"\u201D."
|
|
2217
|
+
] }),
|
|
2218
|
+
filtered.map((group) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("section", { "aria-label": group.label, children: [
|
|
2219
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground", children: group.label }),
|
|
2220
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2221
|
+
"ul",
|
|
2222
|
+
{
|
|
2223
|
+
className: cn(
|
|
2224
|
+
"grid gap-2",
|
|
2225
|
+
renderThumbnail ? "grid-cols-2 sm:grid-cols-3" : "grid-cols-1 sm:grid-cols-2"
|
|
2226
|
+
),
|
|
2227
|
+
children: group.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2228
|
+
"button",
|
|
2229
|
+
{
|
|
2230
|
+
type: "button",
|
|
2231
|
+
"data-palette-item": "",
|
|
2232
|
+
disabled: item.disabled,
|
|
2233
|
+
onClick: () => choose(item),
|
|
2234
|
+
onKeyDown: (e) => {
|
|
2235
|
+
const all = entries();
|
|
2236
|
+
const index = all.indexOf(e.currentTarget);
|
|
2237
|
+
const step = e.key === "ArrowDown" || e.key === "ArrowRight" ? 1 : e.key === "ArrowUp" || e.key === "ArrowLeft" ? -1 : 0;
|
|
2238
|
+
if (!step) return;
|
|
2239
|
+
e.preventDefault();
|
|
2240
|
+
const next = index + step;
|
|
2241
|
+
if (next < 0) searchRef.current?.focus();
|
|
2242
|
+
else all[Math.min(next, all.length - 1)]?.focus();
|
|
2243
|
+
},
|
|
2244
|
+
className: cn(
|
|
2245
|
+
"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",
|
|
2246
|
+
renderThumbnail ? "flex-col" : "items-start"
|
|
2247
|
+
),
|
|
2248
|
+
children: [
|
|
2249
|
+
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)(
|
|
2250
|
+
"span",
|
|
2251
|
+
{
|
|
2252
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted text-foreground",
|
|
2253
|
+
"aria-hidden": "true",
|
|
2254
|
+
children: item.icon
|
|
2255
|
+
}
|
|
2256
|
+
),
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "min-w-0", children: [
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "block text-sm font-medium", children: item.label }),
|
|
2259
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: item.description })
|
|
2260
|
+
] })
|
|
2261
|
+
]
|
|
2262
|
+
}
|
|
2263
|
+
) }, item.id))
|
|
2264
|
+
}
|
|
2265
|
+
)
|
|
2266
|
+
] }, group.label))
|
|
2267
|
+
] })
|
|
2268
|
+
]
|
|
2269
|
+
}
|
|
2270
|
+
) });
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
// src/components/DataPanel.tsx
|
|
2274
|
+
var React24 = __toESM(require("react"));
|
|
2275
|
+
var DropdownMenuPrimitive2 = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
775
2276
|
|
|
776
2277
|
// src/hooks/useFocusTrap.ts
|
|
777
2278
|
var import_react = require("react");
|
|
@@ -852,14 +2353,14 @@ function useFocusTrap(options = {}) {
|
|
|
852
2353
|
}
|
|
853
2354
|
|
|
854
2355
|
// src/hooks/useEscapeKey.ts
|
|
855
|
-
var
|
|
2356
|
+
var React23 = __toESM(require("react"));
|
|
856
2357
|
function useEscapeKey(callback, options) {
|
|
857
2358
|
const { enabled = true, preventDefault = true, stopPropagation = false } = options ?? {};
|
|
858
|
-
const callbackRef =
|
|
859
|
-
|
|
2359
|
+
const callbackRef = React23.useRef(callback);
|
|
2360
|
+
React23.useEffect(() => {
|
|
860
2361
|
callbackRef.current = callback;
|
|
861
2362
|
}, [callback]);
|
|
862
|
-
|
|
2363
|
+
React23.useEffect(() => {
|
|
863
2364
|
if (!enabled) return;
|
|
864
2365
|
const handleKeyDown = (event) => {
|
|
865
2366
|
if (event.key === "Escape") {
|
|
@@ -881,12 +2382,15 @@ function useEscapeKey(callback, options) {
|
|
|
881
2382
|
|
|
882
2383
|
// src/components/DataPanel.tsx
|
|
883
2384
|
var import_data_panel_core = require("@classic-homes/data-panel-core");
|
|
884
|
-
var
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
var
|
|
889
|
-
var
|
|
2385
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2386
|
+
function layoutViewportWidth() {
|
|
2387
|
+
return document.documentElement.clientWidth;
|
|
2388
|
+
}
|
|
2389
|
+
var DropdownTrigger = DropdownMenuPrimitive2.Trigger;
|
|
2390
|
+
var DropdownContent = DropdownMenuPrimitive2.Content;
|
|
2391
|
+
var DropdownLabel = DropdownMenuPrimitive2.Label;
|
|
2392
|
+
var DropdownItem = DropdownMenuPrimitive2.Item;
|
|
2393
|
+
var DropdownSeparator = DropdownMenuPrimitive2.Separator;
|
|
890
2394
|
function useDataPanel(options = {}) {
|
|
891
2395
|
const {
|
|
892
2396
|
persistKey,
|
|
@@ -896,28 +2400,28 @@ function useDataPanel(options = {}) {
|
|
|
896
2400
|
constraints = {}
|
|
897
2401
|
} = options;
|
|
898
2402
|
const resolvedConstraints = { ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints };
|
|
899
|
-
const [persistedState] =
|
|
2403
|
+
const [persistedState] = React24.useState(() => {
|
|
900
2404
|
if (persistKey && typeof window !== "undefined") {
|
|
901
2405
|
return (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
902
2406
|
}
|
|
903
2407
|
return null;
|
|
904
2408
|
});
|
|
905
|
-
const [mode, setMode] =
|
|
906
|
-
const [edge, setEdge] =
|
|
907
|
-
const [isExpanded, setIsExpanded] =
|
|
2409
|
+
const [mode, setMode] = React24.useState(persistedState?.mode ?? initialMode);
|
|
2410
|
+
const [edge, setEdge] = React24.useState(persistedState?.edge ?? initialEdge);
|
|
2411
|
+
const [isExpanded, setIsExpanded] = React24.useState(
|
|
908
2412
|
persistedState?.isExpanded ?? initialExpanded
|
|
909
2413
|
);
|
|
910
|
-
const [detachedPosition, setDetachedPosition] =
|
|
2414
|
+
const [detachedPosition, setDetachedPosition] = React24.useState(
|
|
911
2415
|
persistedState?.detachedPosition ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
912
2416
|
);
|
|
913
|
-
const [detachedSize, setDetachedSize] =
|
|
2417
|
+
const [detachedSize, setDetachedSize] = React24.useState(
|
|
914
2418
|
persistedState?.detachedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize
|
|
915
2419
|
);
|
|
916
|
-
const [pinnedSize, setPinnedSize] =
|
|
2420
|
+
const [pinnedSize, setPinnedSize] = React24.useState(
|
|
917
2421
|
persistedState?.pinnedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize
|
|
918
2422
|
);
|
|
919
|
-
const saveTimeoutRef =
|
|
920
|
-
const debouncedSave =
|
|
2423
|
+
const saveTimeoutRef = React24.useRef(null);
|
|
2424
|
+
const debouncedSave = React24.useCallback(() => {
|
|
921
2425
|
if (!persistKey) return;
|
|
922
2426
|
if (saveTimeoutRef.current) {
|
|
923
2427
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -936,50 +2440,50 @@ function useDataPanel(options = {}) {
|
|
|
936
2440
|
});
|
|
937
2441
|
}, 300);
|
|
938
2442
|
}, [persistKey, mode, edge, isExpanded, detachedPosition, detachedSize, pinnedSize]);
|
|
939
|
-
const handleSetMode =
|
|
2443
|
+
const handleSetMode = React24.useCallback(
|
|
940
2444
|
(newMode) => {
|
|
941
2445
|
setMode(newMode);
|
|
942
2446
|
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) {
|
|
943
2447
|
setDetachedPosition(
|
|
944
|
-
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize,
|
|
2448
|
+
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, layoutViewportWidth(), window.innerHeight)
|
|
945
2449
|
);
|
|
946
2450
|
}
|
|
947
2451
|
},
|
|
948
2452
|
[detachedPosition, detachedSize]
|
|
949
2453
|
);
|
|
950
|
-
const handleSetDetachedPosition =
|
|
2454
|
+
const handleSetDetachedPosition = React24.useCallback(
|
|
951
2455
|
(position) => {
|
|
952
2456
|
if (typeof window === "undefined") {
|
|
953
2457
|
setDetachedPosition(position);
|
|
954
2458
|
return;
|
|
955
2459
|
}
|
|
956
2460
|
setDetachedPosition(
|
|
957
|
-
(0, import_data_panel_core.constrainPosition)(position, detachedSize,
|
|
2461
|
+
(0, import_data_panel_core.constrainPosition)(position, detachedSize, layoutViewportWidth(), window.innerHeight)
|
|
958
2462
|
);
|
|
959
2463
|
},
|
|
960
2464
|
[detachedSize]
|
|
961
2465
|
);
|
|
962
|
-
const handleSetDetachedSize =
|
|
2466
|
+
const handleSetDetachedSize = React24.useCallback(
|
|
963
2467
|
(size) => {
|
|
964
2468
|
setDetachedSize((0, import_data_panel_core.constrainSize)(size, resolvedConstraints));
|
|
965
2469
|
},
|
|
966
2470
|
[resolvedConstraints]
|
|
967
2471
|
);
|
|
968
|
-
const handleSetPinnedSize =
|
|
2472
|
+
const handleSetPinnedSize = React24.useCallback(
|
|
969
2473
|
(size) => {
|
|
970
2474
|
if (typeof window === "undefined") {
|
|
971
2475
|
setPinnedSize(size);
|
|
972
2476
|
return;
|
|
973
2477
|
}
|
|
974
2478
|
if ((0, import_data_panel_core.isHorizontalEdge)(edge)) {
|
|
975
|
-
setPinnedSize((0, import_data_panel_core.constrainPinnedWidth)(size, resolvedConstraints,
|
|
2479
|
+
setPinnedSize((0, import_data_panel_core.constrainPinnedWidth)(size, resolvedConstraints, layoutViewportWidth()));
|
|
976
2480
|
} else {
|
|
977
2481
|
setPinnedSize((0, import_data_panel_core.constrainPinnedHeight)(size, resolvedConstraints, window.innerHeight));
|
|
978
2482
|
}
|
|
979
2483
|
},
|
|
980
2484
|
[edge, resolvedConstraints]
|
|
981
2485
|
);
|
|
982
|
-
|
|
2486
|
+
React24.useEffect(() => {
|
|
983
2487
|
debouncedSave();
|
|
984
2488
|
}, [debouncedSave]);
|
|
985
2489
|
return {
|
|
@@ -997,7 +2501,7 @@ function useDataPanel(options = {}) {
|
|
|
997
2501
|
setPinnedSize: handleSetPinnedSize
|
|
998
2502
|
};
|
|
999
2503
|
}
|
|
1000
|
-
var ChevronUpIcon = () => /* @__PURE__ */ (0,
|
|
2504
|
+
var ChevronUpIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1001
2505
|
"svg",
|
|
1002
2506
|
{
|
|
1003
2507
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1009,10 +2513,10 @@ var ChevronUpIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
|
1009
2513
|
strokeWidth: "2",
|
|
1010
2514
|
strokeLinecap: "round",
|
|
1011
2515
|
strokeLinejoin: "round",
|
|
1012
|
-
children: /* @__PURE__ */ (0,
|
|
2516
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m18 15-6-6-6 6" })
|
|
1013
2517
|
}
|
|
1014
2518
|
);
|
|
1015
|
-
var MoreVerticalIcon = () => /* @__PURE__ */ (0,
|
|
2519
|
+
var MoreVerticalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1016
2520
|
"svg",
|
|
1017
2521
|
{
|
|
1018
2522
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1025,13 +2529,13 @@ var MoreVerticalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
|
1025
2529
|
strokeLinecap: "round",
|
|
1026
2530
|
strokeLinejoin: "round",
|
|
1027
2531
|
children: [
|
|
1028
|
-
/* @__PURE__ */ (0,
|
|
1029
|
-
/* @__PURE__ */ (0,
|
|
1030
|
-
/* @__PURE__ */ (0,
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "12", cy: "12", r: "1" }),
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "12", cy: "5", r: "1" }),
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "12", cy: "19", r: "1" })
|
|
1031
2535
|
]
|
|
1032
2536
|
}
|
|
1033
2537
|
);
|
|
1034
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
2538
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1035
2539
|
"svg",
|
|
1036
2540
|
{
|
|
1037
2541
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1044,12 +2548,12 @@ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
|
1044
2548
|
strokeLinecap: "round",
|
|
1045
2549
|
strokeLinejoin: "round",
|
|
1046
2550
|
children: [
|
|
1047
|
-
/* @__PURE__ */ (0,
|
|
1048
|
-
/* @__PURE__ */ (0,
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M18 6 6 18" }),
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m6 6 12 12" })
|
|
1049
2553
|
]
|
|
1050
2554
|
}
|
|
1051
2555
|
);
|
|
1052
|
-
var GripIcon = () => /* @__PURE__ */ (0,
|
|
2556
|
+
var GripIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1053
2557
|
"svg",
|
|
1054
2558
|
{
|
|
1055
2559
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1058,12 +2562,12 @@ var GripIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
|
1058
2562
|
viewBox: "0 0 24 24",
|
|
1059
2563
|
fill: "currentColor",
|
|
1060
2564
|
children: [
|
|
1061
|
-
/* @__PURE__ */ (0,
|
|
1062
|
-
/* @__PURE__ */ (0,
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "9", cy: "6", r: "1.5" }),
|
|
2566
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "15", cy: "6", r: "1.5" }),
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "9", cy: "12", r: "1.5" }),
|
|
2568
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "15", cy: "12", r: "1.5" }),
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "9", cy: "18", r: "1.5" }),
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { cx: "15", cy: "18", r: "1.5" })
|
|
1067
2571
|
]
|
|
1068
2572
|
}
|
|
1069
2573
|
);
|
|
@@ -1073,7 +2577,7 @@ var edgeLabels = {
|
|
|
1073
2577
|
top: "Pin to top",
|
|
1074
2578
|
bottom: "Pin to bottom"
|
|
1075
2579
|
};
|
|
1076
|
-
var DataPanelHeader =
|
|
2580
|
+
var DataPanelHeader = React24.forwardRef(
|
|
1077
2581
|
({
|
|
1078
2582
|
title,
|
|
1079
2583
|
subtitle,
|
|
@@ -1092,7 +2596,7 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1092
2596
|
className,
|
|
1093
2597
|
draggable = false
|
|
1094
2598
|
}, ref) => {
|
|
1095
|
-
return /* @__PURE__ */ (0,
|
|
2599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1096
2600
|
"div",
|
|
1097
2601
|
{
|
|
1098
2602
|
ref,
|
|
@@ -1103,13 +2607,13 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1103
2607
|
),
|
|
1104
2608
|
"data-panel-header": true,
|
|
1105
2609
|
children: [
|
|
1106
|
-
/* @__PURE__ */ (0,
|
|
1107
|
-
title && /* @__PURE__ */ (0,
|
|
1108
|
-
subtitle && /* @__PURE__ */ (0,
|
|
2610
|
+
/* @__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: [
|
|
2611
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { id: titleId, className: "text-sm font-semibold leading-none truncate", children: title }),
|
|
2612
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground mt-1 truncate", children: subtitle })
|
|
1109
2613
|
] }) }),
|
|
1110
|
-
/* @__PURE__ */ (0,
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1111
2615
|
headerActions,
|
|
1112
|
-
/* @__PURE__ */ (0,
|
|
2616
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1113
2617
|
"button",
|
|
1114
2618
|
{
|
|
1115
2619
|
type: "button",
|
|
@@ -1124,37 +2628,37 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1124
2628
|
},
|
|
1125
2629
|
"aria-label": isExpanded ? "Collapse panel" : "Expand panel",
|
|
1126
2630
|
"aria-expanded": isExpanded,
|
|
1127
|
-
children: /* @__PURE__ */ (0,
|
|
2631
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1128
2632
|
"span",
|
|
1129
2633
|
{
|
|
1130
2634
|
className: cn(
|
|
1131
2635
|
"transition-transform",
|
|
1132
2636
|
{ top: "", bottom: "rotate-180", left: "-rotate-90", right: "rotate-90" }[edge]
|
|
1133
2637
|
),
|
|
1134
|
-
children: /* @__PURE__ */ (0,
|
|
2638
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronUpIcon, {})
|
|
1135
2639
|
}
|
|
1136
2640
|
)
|
|
1137
2641
|
}
|
|
1138
2642
|
),
|
|
1139
|
-
!disableModeSwitch && /* @__PURE__ */ (0,
|
|
1140
|
-
/* @__PURE__ */ (0,
|
|
2643
|
+
!disableModeSwitch && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(DropdownMenuPrimitive2.Root, { children: [
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1141
2645
|
"button",
|
|
1142
2646
|
{
|
|
1143
2647
|
type: "button",
|
|
1144
2648
|
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",
|
|
1145
2649
|
"aria-label": "Panel options",
|
|
1146
|
-
children: /* @__PURE__ */ (0,
|
|
2650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MoreVerticalIcon, {})
|
|
1147
2651
|
}
|
|
1148
2652
|
) }),
|
|
1149
|
-
/* @__PURE__ */ (0,
|
|
2653
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenuPrimitive2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1150
2654
|
DropdownContent,
|
|
1151
2655
|
{
|
|
1152
2656
|
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",
|
|
1153
2657
|
sideOffset: 4,
|
|
1154
2658
|
align: "end",
|
|
1155
2659
|
children: [
|
|
1156
|
-
/* @__PURE__ */ (0,
|
|
1157
|
-
["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ (0,
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownLabel, { className: "px-2 py-1.5 text-sm font-semibold", children: "Panel Position" }),
|
|
2661
|
+
["left", "right", "top", "bottom"].map((e) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1158
2662
|
DropdownItem,
|
|
1159
2663
|
{
|
|
1160
2664
|
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",
|
|
@@ -1164,20 +2668,20 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1164
2668
|
},
|
|
1165
2669
|
children: [
|
|
1166
2670
|
edgeLabels[e],
|
|
1167
|
-
mode === "pinned" && edge === e && /* @__PURE__ */ (0,
|
|
2671
|
+
mode === "pinned" && edge === e && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ml-auto text-xs", children: "\u2713" })
|
|
1168
2672
|
]
|
|
1169
2673
|
},
|
|
1170
2674
|
e
|
|
1171
2675
|
)),
|
|
1172
|
-
/* @__PURE__ */ (0,
|
|
1173
|
-
/* @__PURE__ */ (0,
|
|
2676
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownSeparator, { className: "-mx-1 my-1 h-px bg-muted" }),
|
|
2677
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1174
2678
|
DropdownItem,
|
|
1175
2679
|
{
|
|
1176
2680
|
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",
|
|
1177
2681
|
onSelect: () => onModeChange?.("detached"),
|
|
1178
2682
|
children: [
|
|
1179
2683
|
"Detach",
|
|
1180
|
-
mode === "detached" && /* @__PURE__ */ (0,
|
|
2684
|
+
mode === "detached" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ml-auto text-xs", children: "\u2713" })
|
|
1181
2685
|
]
|
|
1182
2686
|
}
|
|
1183
2687
|
)
|
|
@@ -1185,14 +2689,14 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1185
2689
|
}
|
|
1186
2690
|
) })
|
|
1187
2691
|
] }),
|
|
1188
|
-
!disableClose && /* @__PURE__ */ (0,
|
|
2692
|
+
!disableClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1189
2693
|
"button",
|
|
1190
2694
|
{
|
|
1191
2695
|
type: "button",
|
|
1192
2696
|
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",
|
|
1193
2697
|
onClick: onClose,
|
|
1194
2698
|
"aria-label": "Close panel",
|
|
1195
|
-
children: /* @__PURE__ */ (0,
|
|
2699
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
1196
2700
|
}
|
|
1197
2701
|
)
|
|
1198
2702
|
] })
|
|
@@ -1216,14 +2720,14 @@ function DataPanelCardHeader({
|
|
|
1216
2720
|
onToggleExpand,
|
|
1217
2721
|
onClose
|
|
1218
2722
|
}) {
|
|
1219
|
-
return /* @__PURE__ */ (0,
|
|
2723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1220
2724
|
"div",
|
|
1221
2725
|
{
|
|
1222
2726
|
"data-panel-header": true,
|
|
1223
2727
|
className: "relative flex items-center justify-between gap-2 border-b border-border bg-muted/30 px-4 pt-5 pb-3 cursor-pointer",
|
|
1224
2728
|
onPointerDown: onHeaderPointerDown,
|
|
1225
2729
|
children: [
|
|
1226
|
-
showDragHandle && /* @__PURE__ */ (0,
|
|
2730
|
+
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1227
2731
|
"div",
|
|
1228
2732
|
{
|
|
1229
2733
|
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",
|
|
@@ -1235,22 +2739,22 @@ function DataPanelCardHeader({
|
|
|
1235
2739
|
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && onToggleExpand()
|
|
1236
2740
|
}
|
|
1237
2741
|
),
|
|
1238
|
-
/* @__PURE__ */ (0,
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1239
2743
|
"div",
|
|
1240
2744
|
{
|
|
1241
2745
|
className: "flex-1 min-w-0",
|
|
1242
2746
|
role: "button",
|
|
1243
2747
|
tabIndex: 0,
|
|
1244
2748
|
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && onToggleExpand(),
|
|
1245
|
-
children: headerContent ? headerContent : /* @__PURE__ */ (0,
|
|
1246
|
-
subtitle && /* @__PURE__ */ (0,
|
|
1247
|
-
title && /* @__PURE__ */ (0,
|
|
2749
|
+
children: headerContent ? headerContent : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
2750
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-muted-foreground truncate", children: subtitle }),
|
|
2751
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { id: titleId, className: "text-lg font-semibold truncate", children: title })
|
|
1248
2752
|
] })
|
|
1249
2753
|
}
|
|
1250
2754
|
),
|
|
1251
|
-
/* @__PURE__ */ (0,
|
|
2755
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1252
2756
|
headerActions,
|
|
1253
|
-
!isMobile && /* @__PURE__ */ (0,
|
|
2757
|
+
!isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1254
2758
|
"button",
|
|
1255
2759
|
{
|
|
1256
2760
|
"data-card-drag-handle": true,
|
|
@@ -1259,10 +2763,10 @@ function DataPanelCardHeader({
|
|
|
1259
2763
|
"aria-label": "Drag to reposition panel",
|
|
1260
2764
|
title: "Drag to move",
|
|
1261
2765
|
onPointerDown: onHeaderPointerDown,
|
|
1262
|
-
children: /* @__PURE__ */ (0,
|
|
2766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GripIcon, {})
|
|
1263
2767
|
}
|
|
1264
2768
|
),
|
|
1265
|
-
/* @__PURE__ */ (0,
|
|
2769
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1266
2770
|
"button",
|
|
1267
2771
|
{
|
|
1268
2772
|
type: "button",
|
|
@@ -1271,17 +2775,17 @@ function DataPanelCardHeader({
|
|
|
1271
2775
|
"aria-expanded": isExpanded,
|
|
1272
2776
|
"aria-label": isExpanded ? "Collapse panel" : "Expand panel",
|
|
1273
2777
|
title: isExpanded ? "Collapse" : "Expand",
|
|
1274
|
-
children: /* @__PURE__ */ (0,
|
|
2778
|
+
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, {}) })
|
|
1275
2779
|
}
|
|
1276
2780
|
),
|
|
1277
|
-
!disableClose && /* @__PURE__ */ (0,
|
|
2781
|
+
!disableClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1278
2782
|
"button",
|
|
1279
2783
|
{
|
|
1280
2784
|
type: "button",
|
|
1281
2785
|
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",
|
|
1282
2786
|
onClick: onClose,
|
|
1283
2787
|
"aria-label": "Close panel",
|
|
1284
|
-
children: /* @__PURE__ */ (0,
|
|
2788
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
1285
2789
|
}
|
|
1286
2790
|
)
|
|
1287
2791
|
] })
|
|
@@ -1289,9 +2793,9 @@ function DataPanelCardHeader({
|
|
|
1289
2793
|
}
|
|
1290
2794
|
);
|
|
1291
2795
|
}
|
|
1292
|
-
var DataPanelContent =
|
|
2796
|
+
var DataPanelContent = React24.forwardRef(
|
|
1293
2797
|
({ children, className, "aria-label": ariaLabel = "Panel content" }, ref) => {
|
|
1294
|
-
return /* @__PURE__ */ (0,
|
|
2798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1295
2799
|
"div",
|
|
1296
2800
|
{
|
|
1297
2801
|
ref,
|
|
@@ -1304,7 +2808,7 @@ var DataPanelContent = React14.forwardRef(
|
|
|
1304
2808
|
}
|
|
1305
2809
|
);
|
|
1306
2810
|
DataPanelContent.displayName = "DataPanelContent";
|
|
1307
|
-
var DataPanelFooter =
|
|
2811
|
+
var DataPanelFooter = React24.forwardRef(
|
|
1308
2812
|
({ actions = [], footerContent, footerActions, className }, ref) => {
|
|
1309
2813
|
if (!footerContent && actions.length === 0 && !footerActions) {
|
|
1310
2814
|
return null;
|
|
@@ -1313,7 +2817,7 @@ var DataPanelFooter = React14.forwardRef(
|
|
|
1313
2817
|
if (variant === "primary") return "default";
|
|
1314
2818
|
return variant ?? "default";
|
|
1315
2819
|
};
|
|
1316
|
-
return /* @__PURE__ */ (0,
|
|
2820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1317
2821
|
"div",
|
|
1318
2822
|
{
|
|
1319
2823
|
ref,
|
|
@@ -1321,9 +2825,9 @@ var DataPanelFooter = React14.forwardRef(
|
|
|
1321
2825
|
"flex items-center justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",
|
|
1322
2826
|
className
|
|
1323
2827
|
),
|
|
1324
|
-
children: footerContent ? footerContent : /* @__PURE__ */ (0,
|
|
2828
|
+
children: footerContent ? footerContent : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
1325
2829
|
footerActions,
|
|
1326
|
-
actions.map((action, index) => /* @__PURE__ */ (0,
|
|
2830
|
+
actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1327
2831
|
Button,
|
|
1328
2832
|
{
|
|
1329
2833
|
variant: mapVariant(action.variant),
|
|
@@ -1340,7 +2844,7 @@ var DataPanelFooter = React14.forwardRef(
|
|
|
1340
2844
|
}
|
|
1341
2845
|
);
|
|
1342
2846
|
DataPanelFooter.displayName = "DataPanelFooter";
|
|
1343
|
-
var DataPanelTab =
|
|
2847
|
+
var DataPanelTab = React24.forwardRef(
|
|
1344
2848
|
({
|
|
1345
2849
|
title = "Panel",
|
|
1346
2850
|
subtitle,
|
|
@@ -1366,15 +2870,15 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1366
2870
|
bottom: "left-1/2 rounded-t-lg border-b-0"
|
|
1367
2871
|
}[edge];
|
|
1368
2872
|
const insetStyle = { [edge]: tabInset };
|
|
1369
|
-
const innerRef =
|
|
1370
|
-
const dragRef =
|
|
2873
|
+
const innerRef = React24.useRef(null);
|
|
2874
|
+
const dragRef = React24.useRef({
|
|
1371
2875
|
startX: 0,
|
|
1372
2876
|
startY: 0,
|
|
1373
2877
|
startOffset: 0,
|
|
1374
2878
|
moved: false,
|
|
1375
2879
|
pointerId: -1
|
|
1376
2880
|
});
|
|
1377
|
-
const [dragOffset, setDragOffset] =
|
|
2881
|
+
const [dragOffset, setDragOffset] = React24.useState(null);
|
|
1378
2882
|
const effectiveOffset = dragOffset ?? offset;
|
|
1379
2883
|
const draggable = !!onOffsetChange;
|
|
1380
2884
|
const tabTransform = (0, import_data_panel_core.getTabTransform)(edge, tabWidth, effectiveOffset);
|
|
@@ -1408,7 +2912,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1408
2912
|
d.startOffset + delta,
|
|
1409
2913
|
edge,
|
|
1410
2914
|
tabBounds,
|
|
1411
|
-
|
|
2915
|
+
layoutViewportWidth(),
|
|
1412
2916
|
window.innerHeight
|
|
1413
2917
|
)
|
|
1414
2918
|
);
|
|
@@ -1443,14 +2947,14 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1443
2947
|
onClick?.();
|
|
1444
2948
|
}
|
|
1445
2949
|
};
|
|
1446
|
-
|
|
2950
|
+
React24.useEffect(() => {
|
|
1447
2951
|
if (!onOffsetChange || dragOffset !== null) return;
|
|
1448
2952
|
const reclamp = () => {
|
|
1449
2953
|
const clamped = (0, import_data_panel_core.constrainTabOffset)(
|
|
1450
2954
|
offset,
|
|
1451
2955
|
edge,
|
|
1452
2956
|
tabBounds,
|
|
1453
|
-
|
|
2957
|
+
layoutViewportWidth(),
|
|
1454
2958
|
window.innerHeight
|
|
1455
2959
|
);
|
|
1456
2960
|
if (clamped !== offset) onOffsetChange(clamped);
|
|
@@ -1459,7 +2963,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1459
2963
|
window.addEventListener("resize", reclamp);
|
|
1460
2964
|
return () => window.removeEventListener("resize", reclamp);
|
|
1461
2965
|
}, [edge, tabWidth, offset, onOffsetChange, dragOffset]);
|
|
1462
|
-
return /* @__PURE__ */ (0,
|
|
2966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1463
2967
|
"div",
|
|
1464
2968
|
{
|
|
1465
2969
|
ref: setRefs,
|
|
@@ -1485,7 +2989,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1485
2989
|
onPointerUp: draggable ? handlePointerUp : void 0,
|
|
1486
2990
|
onPointerCancel: draggable ? handlePointerCancel : void 0,
|
|
1487
2991
|
children: [
|
|
1488
|
-
/* @__PURE__ */ (0,
|
|
2992
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1489
2993
|
"button",
|
|
1490
2994
|
{
|
|
1491
2995
|
type: "button",
|
|
@@ -1494,12 +2998,12 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1494
2998
|
onClick: draggable ? void 0 : onClick,
|
|
1495
2999
|
onKeyDown: handleExpandKeyDown,
|
|
1496
3000
|
children: [
|
|
1497
|
-
/* @__PURE__ */ (0,
|
|
1498
|
-
subtitle && /* @__PURE__ */ (0,
|
|
3001
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-sm font-semibold", children: title }),
|
|
3002
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: subtitle })
|
|
1499
3003
|
]
|
|
1500
3004
|
}
|
|
1501
3005
|
),
|
|
1502
|
-
!disableClose && onClose && /* @__PURE__ */ (0,
|
|
3006
|
+
!disableClose && onClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1503
3007
|
"button",
|
|
1504
3008
|
{
|
|
1505
3009
|
"data-no-drag": true,
|
|
@@ -1510,7 +3014,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1510
3014
|
e.stopPropagation();
|
|
1511
3015
|
onClose();
|
|
1512
3016
|
},
|
|
1513
|
-
children: /* @__PURE__ */ (0,
|
|
3017
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
1514
3018
|
}
|
|
1515
3019
|
)
|
|
1516
3020
|
]
|
|
@@ -1532,7 +3036,7 @@ function ResizeHandles({
|
|
|
1532
3036
|
onPinnedSizeChange,
|
|
1533
3037
|
constraints
|
|
1534
3038
|
}) {
|
|
1535
|
-
const handleDetachedKeyDown =
|
|
3039
|
+
const handleDetachedKeyDown = React24.useCallback(
|
|
1536
3040
|
(e, handle) => {
|
|
1537
3041
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
1538
3042
|
let width = detachedSize.width;
|
|
@@ -1586,7 +3090,7 @@ function ResizeHandles({
|
|
|
1586
3090
|
candidatePosition,
|
|
1587
3091
|
{ width, height },
|
|
1588
3092
|
constraints,
|
|
1589
|
-
typeof window === "undefined" ? 1024 :
|
|
3093
|
+
typeof window === "undefined" ? 1024 : layoutViewportWidth(),
|
|
1590
3094
|
typeof window === "undefined" ? 768 : window.innerHeight,
|
|
1591
3095
|
handle
|
|
1592
3096
|
);
|
|
@@ -1595,7 +3099,7 @@ function ResizeHandles({
|
|
|
1595
3099
|
},
|
|
1596
3100
|
[detachedPosition, detachedSize, constraints, onDetachedResize]
|
|
1597
3101
|
);
|
|
1598
|
-
const handlePinnedKeyDown =
|
|
3102
|
+
const handlePinnedKeyDown = React24.useCallback(
|
|
1599
3103
|
(e) => {
|
|
1600
3104
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
1601
3105
|
let newSize = pinnedSize;
|
|
@@ -1655,12 +3159,12 @@ function ResizeHandles({
|
|
|
1655
3159
|
"bottom-left",
|
|
1656
3160
|
"bottom-right"
|
|
1657
3161
|
];
|
|
1658
|
-
return /* @__PURE__ */ (0,
|
|
3162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: handles.map((handle) => {
|
|
1659
3163
|
const isCorner = handle.includes("-");
|
|
1660
3164
|
const isHorizontal2 = handle === "top" || handle === "bottom";
|
|
1661
3165
|
const isVertical = handle === "left" || handle === "right";
|
|
1662
3166
|
const { min: min2, max: max2 } = getAriaValueMinMax(handle);
|
|
1663
|
-
return /* @__PURE__ */ (0,
|
|
3167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1664
3168
|
"div",
|
|
1665
3169
|
{
|
|
1666
3170
|
className: cn(
|
|
@@ -1689,7 +3193,7 @@ function ResizeHandles({
|
|
|
1689
3193
|
const pinnedHandle = (0, import_data_panel_core.getPinnedResizeHandle)(edge);
|
|
1690
3194
|
const isHorizontal = edge === "left" || edge === "right";
|
|
1691
3195
|
const { min, max } = getAriaValueMinMax(pinnedHandle);
|
|
1692
|
-
return /* @__PURE__ */ (0,
|
|
3196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1693
3197
|
"div",
|
|
1694
3198
|
{
|
|
1695
3199
|
className: cn(
|
|
@@ -1712,7 +3216,7 @@ function ResizeHandles({
|
|
|
1712
3216
|
}
|
|
1713
3217
|
);
|
|
1714
3218
|
}
|
|
1715
|
-
var DataPanel =
|
|
3219
|
+
var DataPanel = React24.forwardRef(
|
|
1716
3220
|
({
|
|
1717
3221
|
open: controlledOpen,
|
|
1718
3222
|
onOpenChange,
|
|
@@ -1744,76 +3248,76 @@ var DataPanel = React14.forwardRef(
|
|
|
1744
3248
|
footerActions,
|
|
1745
3249
|
className
|
|
1746
3250
|
}, ref) => {
|
|
1747
|
-
const resolvedConstraints =
|
|
3251
|
+
const resolvedConstraints = React24.useMemo(
|
|
1748
3252
|
() => ({ ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints }),
|
|
1749
3253
|
[constraints]
|
|
1750
3254
|
);
|
|
1751
|
-
const resolvedCardConfig =
|
|
3255
|
+
const resolvedCardConfig = React24.useMemo(
|
|
1752
3256
|
() => ({ ...import_data_panel_core.DEFAULT_CARD_CONFIG, ...cardConfig }),
|
|
1753
3257
|
[cardConfig]
|
|
1754
3258
|
);
|
|
1755
|
-
const panelId =
|
|
3259
|
+
const panelId = React24.useId();
|
|
1756
3260
|
const titleId = `${panelId}-title`;
|
|
1757
|
-
const [internalOpen, setInternalOpen] =
|
|
1758
|
-
const [internalMode, setInternalMode] =
|
|
1759
|
-
const [internalVariant, setInternalVariant] =
|
|
3261
|
+
const [internalOpen, setInternalOpen] = React24.useState(true);
|
|
3262
|
+
const [internalMode, setInternalMode] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.mode);
|
|
3263
|
+
const [internalVariant, setInternalVariant] = React24.useState(
|
|
1760
3264
|
import_data_panel_core.DEFAULT_PANEL_STATE.variant
|
|
1761
3265
|
);
|
|
1762
|
-
const [internalEdge, setInternalEdge] =
|
|
1763
|
-
const [internalExpanded, setInternalExpanded] =
|
|
3266
|
+
const [internalEdge, setInternalEdge] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.edge);
|
|
3267
|
+
const [internalExpanded, setInternalExpanded] = React24.useState(
|
|
1764
3268
|
import_data_panel_core.DEFAULT_PANEL_STATE.isExpanded
|
|
1765
3269
|
);
|
|
1766
|
-
const [detachedPosition, setDetachedPosition] =
|
|
3270
|
+
const [detachedPosition, setDetachedPosition] = React24.useState(
|
|
1767
3271
|
import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
1768
3272
|
);
|
|
1769
|
-
const [detachedSize, setDetachedSize] =
|
|
1770
|
-
const [pinnedSize, setPinnedSize] =
|
|
1771
|
-
const [tabOffset, setTabOffset] =
|
|
1772
|
-
const [viewportWidth, setViewportWidth] =
|
|
1773
|
-
typeof window !== "undefined" ?
|
|
3273
|
+
const [detachedSize, setDetachedSize] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize);
|
|
3274
|
+
const [pinnedSize, setPinnedSize] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize);
|
|
3275
|
+
const [tabOffset, setTabOffset] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.tabOffset);
|
|
3276
|
+
const [viewportWidth, setViewportWidth] = React24.useState(
|
|
3277
|
+
typeof window !== "undefined" ? layoutViewportWidth() : 1024
|
|
1774
3278
|
);
|
|
1775
|
-
const [viewportHeight, setViewportHeight] =
|
|
3279
|
+
const [viewportHeight, setViewportHeight] = React24.useState(
|
|
1776
3280
|
typeof window !== "undefined" ? window.innerHeight : 768
|
|
1777
3281
|
);
|
|
1778
3282
|
const isMobile = viewportWidth < 640;
|
|
1779
|
-
const [cardHorizontalPosition, setCardHorizontalPosition] =
|
|
1780
|
-
const [cardExpandedHeight, setCardExpandedHeight] =
|
|
1781
|
-
const [cardWidth, setCardWidth] =
|
|
1782
|
-
const [cardDragCurrentHeight, setCardDragCurrentHeight] =
|
|
1783
|
-
const [isCardVerticalDragging, setIsCardVerticalDragging] =
|
|
1784
|
-
const [isCardHorizontalDragging, setIsCardHorizontalDragging] =
|
|
1785
|
-
const [isCardHeightTransitioning, setIsCardHeightTransitioning] =
|
|
1786
|
-
const [isCardWidthResizing, setIsCardWidthResizing] =
|
|
1787
|
-
const [isCardTopResizing, setIsCardTopResizing] =
|
|
1788
|
-
const [isDragging, setIsDragging] =
|
|
1789
|
-
const [isResizing, setIsResizing] =
|
|
1790
|
-
const [snapPreview, setSnapPreview] =
|
|
1791
|
-
const [isPinnedDragging, setIsPinnedDragging] =
|
|
1792
|
-
const [pullOffset, setPullOffset] =
|
|
1793
|
-
const dragStateRef =
|
|
3283
|
+
const [cardHorizontalPosition, setCardHorizontalPosition] = React24.useState(0);
|
|
3284
|
+
const [cardExpandedHeight, setCardExpandedHeight] = React24.useState(0);
|
|
3285
|
+
const [cardWidth, setCardWidth] = React24.useState(null);
|
|
3286
|
+
const [cardDragCurrentHeight, setCardDragCurrentHeight] = React24.useState(import_data_panel_core.CARD_HEADER_HEIGHT);
|
|
3287
|
+
const [isCardVerticalDragging, setIsCardVerticalDragging] = React24.useState(false);
|
|
3288
|
+
const [isCardHorizontalDragging, setIsCardHorizontalDragging] = React24.useState(false);
|
|
3289
|
+
const [isCardHeightTransitioning, setIsCardHeightTransitioning] = React24.useState(false);
|
|
3290
|
+
const [isCardWidthResizing, setIsCardWidthResizing] = React24.useState(false);
|
|
3291
|
+
const [isCardTopResizing, setIsCardTopResizing] = React24.useState(false);
|
|
3292
|
+
const [isDragging, setIsDragging] = React24.useState(false);
|
|
3293
|
+
const [isResizing, setIsResizing] = React24.useState(false);
|
|
3294
|
+
const [snapPreview, setSnapPreview] = React24.useState(null);
|
|
3295
|
+
const [isPinnedDragging, setIsPinnedDragging] = React24.useState(false);
|
|
3296
|
+
const [pullOffset, setPullOffset] = React24.useState(0);
|
|
3297
|
+
const dragStateRef = React24.useRef({
|
|
1794
3298
|
startPosition: { x: 0, y: 0 },
|
|
1795
3299
|
startPanelPosition: { x: 0, y: 0 }
|
|
1796
3300
|
});
|
|
1797
|
-
const pinnedDragStateRef =
|
|
3301
|
+
const pinnedDragStateRef = React24.useRef({
|
|
1798
3302
|
startPosition: { x: 0, y: 0 },
|
|
1799
3303
|
hasDetached: false
|
|
1800
3304
|
});
|
|
1801
|
-
const resizeStateRef =
|
|
3305
|
+
const resizeStateRef = React24.useRef({
|
|
1802
3306
|
handle: null,
|
|
1803
3307
|
startPosition: { x: 0, y: 0 },
|
|
1804
3308
|
startSize: { width: 0, height: 0 },
|
|
1805
3309
|
startPanelPosition: { x: 0, y: 0 }
|
|
1806
3310
|
});
|
|
1807
|
-
const cardDragStateRef =
|
|
3311
|
+
const cardDragStateRef = React24.useRef({
|
|
1808
3312
|
startY: 0,
|
|
1809
3313
|
startX: 0,
|
|
1810
3314
|
startTime: 0,
|
|
1811
3315
|
startExpanded: false,
|
|
1812
3316
|
startHorizontalPosition: 0
|
|
1813
3317
|
});
|
|
1814
|
-
const cardCurrentHeightRef =
|
|
1815
|
-
const cardTopResizeStartRef =
|
|
1816
|
-
const cardWidthResizeStateRef =
|
|
3318
|
+
const cardCurrentHeightRef = React24.useRef(import_data_panel_core.CARD_HEADER_HEIGHT);
|
|
3319
|
+
const cardTopResizeStartRef = React24.useRef({ startY: 0, startHeight: 0 });
|
|
3320
|
+
const cardWidthResizeStateRef = React24.useRef({
|
|
1817
3321
|
handle: null,
|
|
1818
3322
|
startX: 0,
|
|
1819
3323
|
startWidth: 0,
|
|
@@ -1825,9 +3329,9 @@ var DataPanel = React14.forwardRef(
|
|
|
1825
3329
|
const edge = controlledEdge ?? internalEdge;
|
|
1826
3330
|
const isExpanded = controlledExpanded ?? internalExpanded;
|
|
1827
3331
|
const showContent = variant !== "card" || isExpanded || isCardVerticalDragging;
|
|
1828
|
-
const saveTimeoutRef =
|
|
1829
|
-
const isMountedRef =
|
|
1830
|
-
|
|
3332
|
+
const saveTimeoutRef = React24.useRef(null);
|
|
3333
|
+
const isMountedRef = React24.useRef(true);
|
|
3334
|
+
React24.useEffect(() => {
|
|
1831
3335
|
isMountedRef.current = true;
|
|
1832
3336
|
return () => {
|
|
1833
3337
|
isMountedRef.current = false;
|
|
@@ -1838,7 +3342,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1838
3342
|
}
|
|
1839
3343
|
};
|
|
1840
3344
|
}, []);
|
|
1841
|
-
const debouncedSave =
|
|
3345
|
+
const debouncedSave = React24.useCallback(() => {
|
|
1842
3346
|
if (!persistKey) return;
|
|
1843
3347
|
if (saveTimeoutRef.current) {
|
|
1844
3348
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -1867,11 +3371,11 @@ var DataPanel = React14.forwardRef(
|
|
|
1867
3371
|
pinnedSize,
|
|
1868
3372
|
tabOffset
|
|
1869
3373
|
]);
|
|
1870
|
-
|
|
3374
|
+
React24.useEffect(() => {
|
|
1871
3375
|
debouncedSave();
|
|
1872
3376
|
}, [debouncedSave]);
|
|
1873
|
-
const hasLoadedRef =
|
|
1874
|
-
|
|
3377
|
+
const hasLoadedRef = React24.useRef(false);
|
|
3378
|
+
React24.useEffect(() => {
|
|
1875
3379
|
if (!persistKey || hasLoadedRef.current) return;
|
|
1876
3380
|
hasLoadedRef.current = true;
|
|
1877
3381
|
const persisted = (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
@@ -1888,10 +3392,10 @@ var DataPanel = React14.forwardRef(
|
|
|
1888
3392
|
if (persisted.tabOffset !== void 0) setTabOffset(persisted.tabOffset);
|
|
1889
3393
|
}
|
|
1890
3394
|
}, [persistKey, controlledMode, controlledVariant, controlledEdge, controlledExpanded]);
|
|
1891
|
-
|
|
3395
|
+
React24.useEffect(() => {
|
|
1892
3396
|
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) {
|
|
1893
3397
|
setDetachedPosition(
|
|
1894
|
-
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize,
|
|
3398
|
+
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, layoutViewportWidth(), window.innerHeight)
|
|
1895
3399
|
);
|
|
1896
3400
|
}
|
|
1897
3401
|
}, [mode, detachedPosition, detachedSize]);
|
|
@@ -1917,7 +3421,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1917
3421
|
ref.current = node;
|
|
1918
3422
|
}
|
|
1919
3423
|
};
|
|
1920
|
-
const handleModeChange =
|
|
3424
|
+
const handleModeChange = React24.useCallback(
|
|
1921
3425
|
(newMode) => {
|
|
1922
3426
|
if (controlledMode === void 0) {
|
|
1923
3427
|
setInternalMode(newMode);
|
|
@@ -1926,7 +3430,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1926
3430
|
},
|
|
1927
3431
|
[controlledMode, onModeChange]
|
|
1928
3432
|
);
|
|
1929
|
-
const handleEdgeChange =
|
|
3433
|
+
const handleEdgeChange = React24.useCallback(
|
|
1930
3434
|
(newEdge) => {
|
|
1931
3435
|
if (controlledEdge === void 0) {
|
|
1932
3436
|
setInternalEdge(newEdge);
|
|
@@ -1935,7 +3439,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1935
3439
|
},
|
|
1936
3440
|
[controlledEdge, onEdgeChange]
|
|
1937
3441
|
);
|
|
1938
|
-
const handleExpandedChange =
|
|
3442
|
+
const handleExpandedChange = React24.useCallback(
|
|
1939
3443
|
(newExpanded) => {
|
|
1940
3444
|
if (controlledExpanded === void 0) {
|
|
1941
3445
|
setInternalExpanded(newExpanded);
|
|
@@ -1969,7 +3473,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1969
3473
|
document.body.style.userSelect = "none";
|
|
1970
3474
|
}
|
|
1971
3475
|
};
|
|
1972
|
-
const handleDragMove =
|
|
3476
|
+
const handleDragMove = React24.useCallback(
|
|
1973
3477
|
(e) => {
|
|
1974
3478
|
if (!isDragging) return;
|
|
1975
3479
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -1985,18 +3489,18 @@ var DataPanel = React14.forwardRef(
|
|
|
1985
3489
|
const snap = (0, import_data_panel_core.detectEdgeSnap)(
|
|
1986
3490
|
newPosition,
|
|
1987
3491
|
detachedSize,
|
|
1988
|
-
|
|
3492
|
+
layoutViewportWidth(),
|
|
1989
3493
|
window.innerHeight,
|
|
1990
3494
|
snapThreshold
|
|
1991
3495
|
);
|
|
1992
3496
|
setSnapPreview(snap.shouldSnap ? snap.edge : null);
|
|
1993
3497
|
setDetachedPosition(
|
|
1994
|
-
(0, import_data_panel_core.constrainPosition)(newPosition, detachedSize,
|
|
3498
|
+
(0, import_data_panel_core.constrainPosition)(newPosition, detachedSize, layoutViewportWidth(), window.innerHeight)
|
|
1995
3499
|
);
|
|
1996
3500
|
},
|
|
1997
3501
|
[isDragging, detachedSize, snapThreshold]
|
|
1998
3502
|
);
|
|
1999
|
-
const handleDragEnd =
|
|
3503
|
+
const handleDragEnd = React24.useCallback(() => {
|
|
2000
3504
|
if (!isDragging) return;
|
|
2001
3505
|
setIsDragging(false);
|
|
2002
3506
|
document.body.style.cursor = "";
|
|
@@ -2007,7 +3511,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2007
3511
|
setSnapPreview(null);
|
|
2008
3512
|
}
|
|
2009
3513
|
}, [isDragging, snapPreview, handleModeChange, handleEdgeChange]);
|
|
2010
|
-
const handlePinnedDragMove =
|
|
3514
|
+
const handlePinnedDragMove = React24.useCallback(
|
|
2011
3515
|
(e) => {
|
|
2012
3516
|
if (!isPinnedDragging) return;
|
|
2013
3517
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2025,7 +3529,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2025
3529
|
pinnedSize,
|
|
2026
3530
|
detachedSize,
|
|
2027
3531
|
edge,
|
|
2028
|
-
|
|
3532
|
+
layoutViewportWidth(),
|
|
2029
3533
|
window.innerHeight
|
|
2030
3534
|
);
|
|
2031
3535
|
setDetachedPosition(newPosition);
|
|
@@ -2043,7 +3547,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2043
3547
|
},
|
|
2044
3548
|
[isPinnedDragging, edge, detachThreshold, pinnedSize, detachedSize, handleModeChange]
|
|
2045
3549
|
);
|
|
2046
|
-
const handlePinnedDragEnd =
|
|
3550
|
+
const handlePinnedDragEnd = React24.useCallback(() => {
|
|
2047
3551
|
if (!isPinnedDragging) return;
|
|
2048
3552
|
setIsPinnedDragging(false);
|
|
2049
3553
|
setPullOffset(0);
|
|
@@ -2065,7 +3569,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2065
3569
|
document.body.style.cursor = (0, import_data_panel_core.getResizeCursor)(handle);
|
|
2066
3570
|
document.body.style.userSelect = "none";
|
|
2067
3571
|
};
|
|
2068
|
-
const handleResizeMove =
|
|
3572
|
+
const handleResizeMove = React24.useCallback(
|
|
2069
3573
|
(e) => {
|
|
2070
3574
|
if (!isResizing || !resizeStateRef.current.handle) return;
|
|
2071
3575
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2085,7 +3589,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2085
3589
|
result.position,
|
|
2086
3590
|
result.size,
|
|
2087
3591
|
resolvedConstraints,
|
|
2088
|
-
|
|
3592
|
+
layoutViewportWidth(),
|
|
2089
3593
|
window.innerHeight,
|
|
2090
3594
|
handle
|
|
2091
3595
|
);
|
|
@@ -2096,7 +3600,9 @@ var DataPanel = React14.forwardRef(
|
|
|
2096
3600
|
const direction = edge === "left" || edge === "top" ? 1 : -1;
|
|
2097
3601
|
const newSize = startSize.width + delta * direction;
|
|
2098
3602
|
if ((0, import_data_panel_core.isHorizontalEdge)(edge)) {
|
|
2099
|
-
setPinnedSize(
|
|
3603
|
+
setPinnedSize(
|
|
3604
|
+
(0, import_data_panel_core.constrainPinnedWidth)(newSize, resolvedConstraints, layoutViewportWidth())
|
|
3605
|
+
);
|
|
2100
3606
|
} else {
|
|
2101
3607
|
setPinnedSize((0, import_data_panel_core.constrainPinnedHeight)(newSize, resolvedConstraints, window.innerHeight));
|
|
2102
3608
|
}
|
|
@@ -2104,7 +3610,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2104
3610
|
},
|
|
2105
3611
|
[isResizing, mode, edge, resolvedConstraints]
|
|
2106
3612
|
);
|
|
2107
|
-
const handleResizeEnd =
|
|
3613
|
+
const handleResizeEnd = React24.useCallback(() => {
|
|
2108
3614
|
if (!isResizing) return;
|
|
2109
3615
|
setIsResizing(false);
|
|
2110
3616
|
resizeStateRef.current.handle = null;
|
|
@@ -2136,7 +3642,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2136
3642
|
}
|
|
2137
3643
|
document.body.style.userSelect = "none";
|
|
2138
3644
|
};
|
|
2139
|
-
const handleCardPointerMove =
|
|
3645
|
+
const handleCardPointerMove = React24.useCallback(
|
|
2140
3646
|
(e) => {
|
|
2141
3647
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
2142
3648
|
if (isCardVerticalDragging) {
|
|
@@ -2176,7 +3682,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2176
3682
|
resolvedCardConfig.maxWidth
|
|
2177
3683
|
]
|
|
2178
3684
|
);
|
|
2179
|
-
const handleCardPointerUp =
|
|
3685
|
+
const handleCardPointerUp = React24.useCallback(
|
|
2180
3686
|
(e) => {
|
|
2181
3687
|
const endTime = Date.now();
|
|
2182
3688
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2233,7 +3739,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2233
3739
|
document.body.style.cursor = "ns-resize";
|
|
2234
3740
|
document.body.style.userSelect = "none";
|
|
2235
3741
|
};
|
|
2236
|
-
const handleCardResizeMove =
|
|
3742
|
+
const handleCardResizeMove = React24.useCallback(
|
|
2237
3743
|
(e) => {
|
|
2238
3744
|
if (!isCardTopResizing) return;
|
|
2239
3745
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2246,7 +3752,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2246
3752
|
},
|
|
2247
3753
|
[isCardTopResizing, viewportHeight]
|
|
2248
3754
|
);
|
|
2249
|
-
const handleCardResizeEnd =
|
|
3755
|
+
const handleCardResizeEnd = React24.useCallback(() => {
|
|
2250
3756
|
if (!isCardTopResizing) return;
|
|
2251
3757
|
setIsCardTopResizing(false);
|
|
2252
3758
|
document.body.style.cursor = "";
|
|
@@ -2277,7 +3783,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2277
3783
|
document.body.style.cursor = "ew-resize";
|
|
2278
3784
|
document.body.style.userSelect = "none";
|
|
2279
3785
|
};
|
|
2280
|
-
const handleCardWidthResizeMove =
|
|
3786
|
+
const handleCardWidthResizeMove = React24.useCallback(
|
|
2281
3787
|
(e) => {
|
|
2282
3788
|
const st = cardWidthResizeStateRef.current;
|
|
2283
3789
|
if (!isCardWidthResizing || !st.handle) return;
|
|
@@ -2317,7 +3823,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2317
3823
|
resolvedCardConfig.maxWidth
|
|
2318
3824
|
]
|
|
2319
3825
|
);
|
|
2320
|
-
const handleCardWidthResizeEnd =
|
|
3826
|
+
const handleCardWidthResizeEnd = React24.useCallback(() => {
|
|
2321
3827
|
if (!isCardWidthResizing) return;
|
|
2322
3828
|
setIsCardWidthResizing(false);
|
|
2323
3829
|
cardWidthResizeStateRef.current.handle = null;
|
|
@@ -2365,7 +3871,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2365
3871
|
if (kind === "width-left") setCardHorizontalPosition((p) => p - appliedDelta);
|
|
2366
3872
|
debouncedSave();
|
|
2367
3873
|
};
|
|
2368
|
-
|
|
3874
|
+
React24.useEffect(() => {
|
|
2369
3875
|
if (isDragging) {
|
|
2370
3876
|
window.addEventListener("pointermove", handleDragMove);
|
|
2371
3877
|
window.addEventListener("pointerup", handleDragEnd);
|
|
@@ -2377,7 +3883,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2377
3883
|
};
|
|
2378
3884
|
}
|
|
2379
3885
|
}, [isDragging, handleDragMove, handleDragEnd]);
|
|
2380
|
-
|
|
3886
|
+
React24.useEffect(() => {
|
|
2381
3887
|
if (isPinnedDragging) {
|
|
2382
3888
|
window.addEventListener("pointermove", handlePinnedDragMove);
|
|
2383
3889
|
window.addEventListener("pointerup", handlePinnedDragEnd);
|
|
@@ -2389,7 +3895,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2389
3895
|
};
|
|
2390
3896
|
}
|
|
2391
3897
|
}, [isPinnedDragging, handlePinnedDragMove, handlePinnedDragEnd]);
|
|
2392
|
-
|
|
3898
|
+
React24.useEffect(() => {
|
|
2393
3899
|
if (isResizing) {
|
|
2394
3900
|
window.addEventListener("pointermove", handleResizeMove);
|
|
2395
3901
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
@@ -2401,7 +3907,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2401
3907
|
};
|
|
2402
3908
|
}
|
|
2403
3909
|
}, [isResizing, handleResizeMove, handleResizeEnd]);
|
|
2404
|
-
|
|
3910
|
+
React24.useEffect(() => {
|
|
2405
3911
|
if (isCardVerticalDragging || isCardHorizontalDragging) {
|
|
2406
3912
|
window.addEventListener("pointermove", handleCardPointerMove);
|
|
2407
3913
|
window.addEventListener("pointerup", handleCardPointerUp);
|
|
@@ -2418,7 +3924,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2418
3924
|
handleCardPointerMove,
|
|
2419
3925
|
handleCardPointerUp
|
|
2420
3926
|
]);
|
|
2421
|
-
|
|
3927
|
+
React24.useEffect(() => {
|
|
2422
3928
|
if (isCardTopResizing) {
|
|
2423
3929
|
window.addEventListener("pointermove", handleCardResizeMove);
|
|
2424
3930
|
window.addEventListener("pointerup", handleCardResizeEnd);
|
|
@@ -2430,7 +3936,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2430
3936
|
};
|
|
2431
3937
|
}
|
|
2432
3938
|
}, [isCardTopResizing, handleCardResizeMove, handleCardResizeEnd]);
|
|
2433
|
-
|
|
3939
|
+
React24.useEffect(() => {
|
|
2434
3940
|
if (isCardWidthResizing) {
|
|
2435
3941
|
window.addEventListener("pointermove", handleCardWidthResizeMove);
|
|
2436
3942
|
window.addEventListener("pointerup", handleCardWidthResizeEnd);
|
|
@@ -2442,9 +3948,9 @@ var DataPanel = React14.forwardRef(
|
|
|
2442
3948
|
};
|
|
2443
3949
|
}
|
|
2444
3950
|
}, [isCardWidthResizing, handleCardWidthResizeMove, handleCardWidthResizeEnd]);
|
|
2445
|
-
|
|
3951
|
+
React24.useEffect(() => {
|
|
2446
3952
|
const onResize = () => {
|
|
2447
|
-
setViewportWidth(
|
|
3953
|
+
setViewportWidth(layoutViewportWidth());
|
|
2448
3954
|
setViewportHeight(window.innerHeight);
|
|
2449
3955
|
setCardExpandedHeight(window.innerHeight * import_data_panel_core.CARD_EXPANDED_RATIO);
|
|
2450
3956
|
};
|
|
@@ -2452,19 +3958,19 @@ var DataPanel = React14.forwardRef(
|
|
|
2452
3958
|
window.addEventListener("resize", onResize);
|
|
2453
3959
|
return () => window.removeEventListener("resize", onResize);
|
|
2454
3960
|
}, []);
|
|
2455
|
-
|
|
3961
|
+
React24.useEffect(() => {
|
|
2456
3962
|
if (isMobile && variant === "card") {
|
|
2457
3963
|
setCardHorizontalPosition(0);
|
|
2458
3964
|
setCardWidth(null);
|
|
2459
3965
|
}
|
|
2460
3966
|
}, [isMobile, variant]);
|
|
2461
|
-
|
|
3967
|
+
React24.useEffect(() => {
|
|
2462
3968
|
if (isCardHeightTransitioning) {
|
|
2463
3969
|
const t = setTimeout(() => setIsCardHeightTransitioning(false), 350);
|
|
2464
3970
|
return () => clearTimeout(t);
|
|
2465
3971
|
}
|
|
2466
3972
|
}, [isCardHeightTransitioning]);
|
|
2467
|
-
const panelStyles =
|
|
3973
|
+
const panelStyles = React24.useMemo(() => {
|
|
2468
3974
|
if (variant === "card") {
|
|
2469
3975
|
const defaultCardWidth = Math.min(
|
|
2470
3976
|
viewportWidth - resolvedCardConfig.horizontalMargin * 2,
|
|
@@ -2529,7 +4035,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2529
4035
|
}[edge] : "animate-scale-in";
|
|
2530
4036
|
if (!open) return null;
|
|
2531
4037
|
if (variant === "full" && !isExpanded && mode === "pinned") {
|
|
2532
|
-
return /* @__PURE__ */ (0,
|
|
4038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2533
4039
|
DataPanelTab,
|
|
2534
4040
|
{
|
|
2535
4041
|
title,
|
|
@@ -2545,8 +4051,8 @@ var DataPanel = React14.forwardRef(
|
|
|
2545
4051
|
}
|
|
2546
4052
|
);
|
|
2547
4053
|
}
|
|
2548
|
-
return /* @__PURE__ */ (0,
|
|
2549
|
-
snapPreview && /* @__PURE__ */ (0,
|
|
4054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4055
|
+
snapPreview && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2550
4056
|
"div",
|
|
2551
4057
|
{
|
|
2552
4058
|
className: cn(
|
|
@@ -2558,7 +4064,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2558
4064
|
)
|
|
2559
4065
|
}
|
|
2560
4066
|
),
|
|
2561
|
-
variant === "card" && isExpanded && isMobile && /* @__PURE__ */ (0,
|
|
4067
|
+
variant === "card" && isExpanded && isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2562
4068
|
"div",
|
|
2563
4069
|
{
|
|
2564
4070
|
className: "fixed inset-0 z-40 bg-black/50 transition-opacity",
|
|
@@ -2566,7 +4072,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2566
4072
|
onClick: handleToggleExpand
|
|
2567
4073
|
}
|
|
2568
4074
|
),
|
|
2569
|
-
/* @__PURE__ */ (0,
|
|
4075
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2570
4076
|
"div",
|
|
2571
4077
|
{
|
|
2572
4078
|
ref: setPanelRef,
|
|
@@ -2588,7 +4094,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2588
4094
|
"aria-expanded": variant === "card" ? isExpanded : void 0,
|
|
2589
4095
|
onPointerDown: variant === "full" ? handleDragStart : void 0,
|
|
2590
4096
|
children: [
|
|
2591
|
-
variant === "card" ? /* @__PURE__ */ (0,
|
|
4097
|
+
variant === "card" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2592
4098
|
DataPanelCardHeader,
|
|
2593
4099
|
{
|
|
2594
4100
|
title,
|
|
@@ -2604,7 +4110,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2604
4110
|
onToggleExpand: handleToggleExpand,
|
|
2605
4111
|
onClose: () => handleOpenChange(false)
|
|
2606
4112
|
}
|
|
2607
|
-
) : /* @__PURE__ */ (0,
|
|
4113
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2608
4114
|
DataPanelHeader,
|
|
2609
4115
|
{
|
|
2610
4116
|
title,
|
|
@@ -2624,9 +4130,9 @@ var DataPanel = React14.forwardRef(
|
|
|
2624
4130
|
draggable: !disableDrag && (mode === "detached" || mode === "pinned" && detachThreshold > 0)
|
|
2625
4131
|
}
|
|
2626
4132
|
),
|
|
2627
|
-
showContent && /* @__PURE__ */ (0,
|
|
2628
|
-
/* @__PURE__ */ (0,
|
|
2629
|
-
/* @__PURE__ */ (0,
|
|
4133
|
+
showContent && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4134
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DataPanelContent, { children }),
|
|
4135
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2630
4136
|
DataPanelFooter,
|
|
2631
4137
|
{
|
|
2632
4138
|
actions,
|
|
@@ -2635,7 +4141,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2635
4141
|
}
|
|
2636
4142
|
)
|
|
2637
4143
|
] }),
|
|
2638
|
-
variant === "full" && !disableResize && /* @__PURE__ */ (0,
|
|
4144
|
+
variant === "full" && !disableResize && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2639
4145
|
ResizeHandles,
|
|
2640
4146
|
{
|
|
2641
4147
|
mode,
|
|
@@ -2654,7 +4160,9 @@ var DataPanel = React14.forwardRef(
|
|
|
2654
4160
|
return;
|
|
2655
4161
|
}
|
|
2656
4162
|
if ((0, import_data_panel_core.isHorizontalEdge)(edge)) {
|
|
2657
|
-
setPinnedSize(
|
|
4163
|
+
setPinnedSize(
|
|
4164
|
+
(0, import_data_panel_core.constrainPinnedWidth)(size, resolvedConstraints, layoutViewportWidth())
|
|
4165
|
+
);
|
|
2658
4166
|
} else {
|
|
2659
4167
|
setPinnedSize(
|
|
2660
4168
|
(0, import_data_panel_core.constrainPinnedHeight)(size, resolvedConstraints, window.innerHeight)
|
|
@@ -2664,8 +4172,8 @@ var DataPanel = React14.forwardRef(
|
|
|
2664
4172
|
constraints: resolvedConstraints
|
|
2665
4173
|
}
|
|
2666
4174
|
),
|
|
2667
|
-
variant === "card" && isExpanded && !disableResize && !isMobile && /* @__PURE__ */ (0,
|
|
2668
|
-
/* @__PURE__ */ (0,
|
|
4175
|
+
variant === "card" && isExpanded && !disableResize && !isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4176
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2669
4177
|
"div",
|
|
2670
4178
|
{
|
|
2671
4179
|
className: "resize-handle resize-handle--horizontal resize-handle--top",
|
|
@@ -2681,7 +4189,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2681
4189
|
onKeyDown: (e) => handleCardResizeKeyDown(e, "height")
|
|
2682
4190
|
}
|
|
2683
4191
|
),
|
|
2684
|
-
/* @__PURE__ */ (0,
|
|
4192
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2685
4193
|
"div",
|
|
2686
4194
|
{
|
|
2687
4195
|
className: "resize-handle resize-handle--vertical resize-handle--left resize-handle--card-edge",
|
|
@@ -2697,7 +4205,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2697
4205
|
onKeyDown: (e) => handleCardResizeKeyDown(e, "width-left")
|
|
2698
4206
|
}
|
|
2699
4207
|
),
|
|
2700
|
-
/* @__PURE__ */ (0,
|
|
4208
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2701
4209
|
"div",
|
|
2702
4210
|
{
|
|
2703
4211
|
className: "resize-handle resize-handle--vertical resize-handle--right resize-handle--card-edge",
|
|
@@ -2723,10 +4231,10 @@ var DataPanel = React14.forwardRef(
|
|
|
2723
4231
|
DataPanel.displayName = "DataPanel";
|
|
2724
4232
|
|
|
2725
4233
|
// src/components/Skeleton.tsx
|
|
2726
|
-
var
|
|
2727
|
-
var
|
|
2728
|
-
var
|
|
2729
|
-
var skeletonVariants = (0,
|
|
4234
|
+
var React25 = __toESM(require("react"));
|
|
4235
|
+
var import_class_variance_authority6 = require("class-variance-authority");
|
|
4236
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4237
|
+
var skeletonVariants = (0, import_class_variance_authority6.cva)("rounded-md bg-muted", {
|
|
2730
4238
|
variants: {
|
|
2731
4239
|
variant: {
|
|
2732
4240
|
default: "",
|
|
@@ -2741,10 +4249,10 @@ var skeletonVariants = (0, import_class_variance_authority5.cva)("rounded-md bg-
|
|
|
2741
4249
|
variant: "default"
|
|
2742
4250
|
}
|
|
2743
4251
|
});
|
|
2744
|
-
var Skeleton =
|
|
4252
|
+
var Skeleton = React25.forwardRef(
|
|
2745
4253
|
({ className, variant, animation = "pulse", ...props }, ref) => {
|
|
2746
4254
|
const animationClass = animation === "pulse" ? "animate-pulse" : animation === "shimmer" ? "animate-shimmer" : "";
|
|
2747
|
-
return /* @__PURE__ */ (0,
|
|
4255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2748
4256
|
"div",
|
|
2749
4257
|
{
|
|
2750
4258
|
ref,
|
|
@@ -2757,10 +4265,10 @@ var Skeleton = React15.forwardRef(
|
|
|
2757
4265
|
Skeleton.displayName = "Skeleton";
|
|
2758
4266
|
|
|
2759
4267
|
// src/components/Spinner.tsx
|
|
2760
|
-
var
|
|
2761
|
-
var
|
|
2762
|
-
var
|
|
2763
|
-
var spinnerVariants = (0,
|
|
4268
|
+
var React26 = __toESM(require("react"));
|
|
4269
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
4270
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4271
|
+
var spinnerVariants = (0, import_class_variance_authority7.cva)("animate-spin text-current", {
|
|
2764
4272
|
variants: {
|
|
2765
4273
|
size: {
|
|
2766
4274
|
sm: "h-4 w-4",
|
|
@@ -2773,9 +4281,9 @@ var spinnerVariants = (0, import_class_variance_authority6.cva)("animate-spin te
|
|
|
2773
4281
|
size: "md"
|
|
2774
4282
|
}
|
|
2775
4283
|
});
|
|
2776
|
-
var Spinner =
|
|
4284
|
+
var Spinner = React26.forwardRef(
|
|
2777
4285
|
({ className, size, label = "Loading...", ...props }, ref) => {
|
|
2778
|
-
return /* @__PURE__ */ (0,
|
|
4286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2779
4287
|
"svg",
|
|
2780
4288
|
{
|
|
2781
4289
|
ref,
|
|
@@ -2787,7 +4295,7 @@ var Spinner = React16.forwardRef(
|
|
|
2787
4295
|
role: "status",
|
|
2788
4296
|
...props,
|
|
2789
4297
|
children: [
|
|
2790
|
-
/* @__PURE__ */ (0,
|
|
4298
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2791
4299
|
"circle",
|
|
2792
4300
|
{
|
|
2793
4301
|
className: "opacity-25",
|
|
@@ -2798,7 +4306,7 @@ var Spinner = React16.forwardRef(
|
|
|
2798
4306
|
strokeWidth: "4"
|
|
2799
4307
|
}
|
|
2800
4308
|
),
|
|
2801
|
-
/* @__PURE__ */ (0,
|
|
4309
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2802
4310
|
"path",
|
|
2803
4311
|
{
|
|
2804
4312
|
className: "opacity-75",
|
|
@@ -2806,7 +4314,7 @@ var Spinner = React16.forwardRef(
|
|
|
2806
4314
|
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"
|
|
2807
4315
|
}
|
|
2808
4316
|
),
|
|
2809
|
-
/* @__PURE__ */ (0,
|
|
4317
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("title", { children: label })
|
|
2810
4318
|
]
|
|
2811
4319
|
}
|
|
2812
4320
|
);
|
|
@@ -2815,8 +4323,8 @@ var Spinner = React16.forwardRef(
|
|
|
2815
4323
|
Spinner.displayName = "Spinner";
|
|
2816
4324
|
|
|
2817
4325
|
// src/components/LoadingLogo.tsx
|
|
2818
|
-
var
|
|
2819
|
-
var
|
|
4326
|
+
var React27 = __toESM(require("react"));
|
|
4327
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2820
4328
|
var logoPaths = [
|
|
2821
4329
|
"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",
|
|
2822
4330
|
"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",
|
|
@@ -2838,12 +4346,12 @@ var colors = {
|
|
|
2838
4346
|
stroke: "#ffffff"
|
|
2839
4347
|
}
|
|
2840
4348
|
};
|
|
2841
|
-
var LoadingLogo =
|
|
4349
|
+
var LoadingLogo = React27.forwardRef(
|
|
2842
4350
|
({ width = 40, height = 40, loading = false, variant = "dark", className, ...props }, ref) => {
|
|
2843
4351
|
const currentColors = colors[variant];
|
|
2844
4352
|
const fillColor = loading ? currentColors.fillLoading : currentColors.fill;
|
|
2845
4353
|
const strokeColor = currentColors.stroke;
|
|
2846
|
-
return /* @__PURE__ */ (0,
|
|
4354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2847
4355
|
"div",
|
|
2848
4356
|
{
|
|
2849
4357
|
ref,
|
|
@@ -2853,7 +4361,7 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2853
4361
|
"aria-label": loading ? "Loading" : "Classic Homes",
|
|
2854
4362
|
...props,
|
|
2855
4363
|
children: [
|
|
2856
|
-
/* @__PURE__ */ (0,
|
|
4364
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2857
4365
|
"svg",
|
|
2858
4366
|
{
|
|
2859
4367
|
width: "100%",
|
|
@@ -2863,8 +4371,8 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2863
4371
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2864
4372
|
"aria-hidden": "true",
|
|
2865
4373
|
children: [
|
|
2866
|
-
/* @__PURE__ */ (0,
|
|
2867
|
-
loading && /* @__PURE__ */ (0,
|
|
4374
|
+
/* @__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)) }),
|
|
4375
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2868
4376
|
"g",
|
|
2869
4377
|
{
|
|
2870
4378
|
fill: "none",
|
|
@@ -2872,13 +4380,13 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2872
4380
|
strokeWidth: "0.5",
|
|
2873
4381
|
strokeDasharray: "10 4",
|
|
2874
4382
|
className: "animate-trace",
|
|
2875
|
-
children: logoPaths.map((path, i) => /* @__PURE__ */ (0,
|
|
4383
|
+
children: logoPaths.map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: path }, i))
|
|
2876
4384
|
}
|
|
2877
4385
|
)
|
|
2878
4386
|
]
|
|
2879
4387
|
}
|
|
2880
4388
|
),
|
|
2881
|
-
loading && /* @__PURE__ */ (0,
|
|
4389
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "sr-only", children: "Loading" })
|
|
2882
4390
|
]
|
|
2883
4391
|
}
|
|
2884
4392
|
);
|
|
@@ -2887,10 +4395,10 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2887
4395
|
LoadingLogo.displayName = "LoadingLogo";
|
|
2888
4396
|
|
|
2889
4397
|
// src/components/ProgressBar.tsx
|
|
2890
|
-
var
|
|
2891
|
-
var
|
|
2892
|
-
var
|
|
2893
|
-
var progressBarVariants = (0,
|
|
4398
|
+
var React28 = __toESM(require("react"));
|
|
4399
|
+
var import_class_variance_authority8 = require("class-variance-authority");
|
|
4400
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4401
|
+
var progressBarVariants = (0, import_class_variance_authority8.cva)("w-full overflow-hidden rounded-full bg-muted", {
|
|
2894
4402
|
variants: {
|
|
2895
4403
|
size: {
|
|
2896
4404
|
sm: "h-1",
|
|
@@ -2902,7 +4410,7 @@ var progressBarVariants = (0, import_class_variance_authority7.cva)("w-full over
|
|
|
2902
4410
|
size: "md"
|
|
2903
4411
|
}
|
|
2904
4412
|
});
|
|
2905
|
-
var progressFillVariants = (0,
|
|
4413
|
+
var progressFillVariants = (0, import_class_variance_authority8.cva)("h-full rounded-full transition-all duration-300", {
|
|
2906
4414
|
variants: {
|
|
2907
4415
|
variant: {
|
|
2908
4416
|
default: "bg-primary",
|
|
@@ -2915,12 +4423,12 @@ var progressFillVariants = (0, import_class_variance_authority7.cva)("h-full rou
|
|
|
2915
4423
|
variant: "default"
|
|
2916
4424
|
}
|
|
2917
4425
|
});
|
|
2918
|
-
var ProgressBar =
|
|
4426
|
+
var ProgressBar = React28.forwardRef(
|
|
2919
4427
|
({ className, size, variant, value, max = 100, label = "Progress", showValue = false, ...props }, ref) => {
|
|
2920
4428
|
const isIndeterminate = value === void 0;
|
|
2921
4429
|
const clampedValue = isIndeterminate ? 0 : Math.min(Math.max(0, value), max);
|
|
2922
4430
|
const percentage = isIndeterminate ? 0 : Math.round(clampedValue / max * 100);
|
|
2923
|
-
return /* @__PURE__ */ (0,
|
|
4431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2924
4432
|
"div",
|
|
2925
4433
|
{
|
|
2926
4434
|
ref,
|
|
@@ -2932,7 +4440,7 @@ var ProgressBar = React18.forwardRef(
|
|
|
2932
4440
|
className: cn("flex items-center gap-2", className),
|
|
2933
4441
|
...props,
|
|
2934
4442
|
children: [
|
|
2935
|
-
/* @__PURE__ */ (0,
|
|
4443
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(progressBarVariants({ size })), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2936
4444
|
"div",
|
|
2937
4445
|
{
|
|
2938
4446
|
className: cn(
|
|
@@ -2942,7 +4450,7 @@ var ProgressBar = React18.forwardRef(
|
|
|
2942
4450
|
style: isIndeterminate ? void 0 : { width: `${percentage}%` }
|
|
2943
4451
|
}
|
|
2944
4452
|
) }),
|
|
2945
|
-
showValue && !isIndeterminate && /* @__PURE__ */ (0,
|
|
4453
|
+
showValue && !isIndeterminate && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "text-sm tabular-nums text-muted-foreground", children: [
|
|
2946
4454
|
percentage,
|
|
2947
4455
|
"%"
|
|
2948
4456
|
] })
|
|
@@ -2954,11 +4462,11 @@ var ProgressBar = React18.forwardRef(
|
|
|
2954
4462
|
ProgressBar.displayName = "ProgressBar";
|
|
2955
4463
|
|
|
2956
4464
|
// src/components/LoadingOverlay.tsx
|
|
2957
|
-
var
|
|
2958
|
-
var
|
|
4465
|
+
var React29 = __toESM(require("react"));
|
|
4466
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2959
4467
|
var spinnerSizeMap = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
|
|
2960
4468
|
var logoSizeMap = { sm: 32, md: 40, lg: 56, xl: 80 };
|
|
2961
|
-
var LoadingOverlay =
|
|
4469
|
+
var LoadingOverlay = React29.forwardRef(
|
|
2962
4470
|
({
|
|
2963
4471
|
loading = true,
|
|
2964
4472
|
variant = "spinner",
|
|
@@ -2973,8 +4481,8 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
2973
4481
|
children,
|
|
2974
4482
|
...props
|
|
2975
4483
|
}, ref) => {
|
|
2976
|
-
const [visible, setVisible] =
|
|
2977
|
-
|
|
4484
|
+
const [visible, setVisible] = React29.useState(delay === 0 && loading);
|
|
4485
|
+
React29.useEffect(() => {
|
|
2978
4486
|
if (!loading) {
|
|
2979
4487
|
setVisible(false);
|
|
2980
4488
|
return;
|
|
@@ -2987,23 +4495,23 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
2987
4495
|
return () => clearTimeout(timer);
|
|
2988
4496
|
}, [loading, delay]);
|
|
2989
4497
|
if (!visible) {
|
|
2990
|
-
return mode === "inline" ? null : /* @__PURE__ */ (0,
|
|
4498
|
+
return mode === "inline" ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
|
|
2991
4499
|
}
|
|
2992
|
-
const indicator = /* @__PURE__ */ (0,
|
|
2993
|
-
variant === "spinner" && /* @__PURE__ */ (0,
|
|
2994
|
-
variant === "logo" && /* @__PURE__ */ (0,
|
|
2995
|
-
variant === "progress" && /* @__PURE__ */ (0,
|
|
2996
|
-
variant === "skeleton" && /* @__PURE__ */ (0,
|
|
2997
|
-
/* @__PURE__ */ (0,
|
|
2998
|
-
/* @__PURE__ */ (0,
|
|
2999
|
-
/* @__PURE__ */ (0,
|
|
3000
|
-
/* @__PURE__ */ (0,
|
|
4500
|
+
const indicator = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4501
|
+
variant === "spinner" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Spinner, { size: spinnerSizeMap[size] }),
|
|
4502
|
+
variant === "logo" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(LoadingLogo, { loading: true, width: logoSizeMap[size], height: logoSizeMap[size] }),
|
|
4503
|
+
variant === "progress" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ProgressBar, { value: progress, className: "w-48 max-w-full" }),
|
|
4504
|
+
variant === "skeleton" && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "w-full space-y-3", children: [
|
|
4505
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { variant: "title" }),
|
|
4506
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { variant: "text" }),
|
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { variant: "text" }),
|
|
4508
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Skeleton, { variant: "text", className: "w-2/3" })
|
|
3001
4509
|
] }),
|
|
3002
|
-
message && /* @__PURE__ */ (0,
|
|
3003
|
-
!message && /* @__PURE__ */ (0,
|
|
4510
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "mt-2 text-sm text-muted-foreground animate-pulse-subtle", children: message }),
|
|
4511
|
+
!message && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "sr-only", children: "Loading" })
|
|
3004
4512
|
] });
|
|
3005
4513
|
if (mode === "inline") {
|
|
3006
|
-
return /* @__PURE__ */ (0,
|
|
4514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3007
4515
|
"div",
|
|
3008
4516
|
{
|
|
3009
4517
|
ref,
|
|
@@ -3017,9 +4525,9 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
3017
4525
|
}
|
|
3018
4526
|
const bgClass = opaque ? "bg-background" : mode === "fullscreen" ? "bg-background/80" : "bg-background/60";
|
|
3019
4527
|
const positionClass = mode === "fullscreen" ? "fixed inset-0 z-50" : "absolute inset-0 z-10";
|
|
3020
|
-
return /* @__PURE__ */ (0,
|
|
4528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3021
4529
|
children,
|
|
3022
|
-
/* @__PURE__ */ (0,
|
|
4530
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3023
4531
|
"div",
|
|
3024
4532
|
{
|
|
3025
4533
|
ref,
|
|
@@ -3042,9 +4550,9 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
3042
4550
|
LoadingOverlay.displayName = "LoadingOverlay";
|
|
3043
4551
|
|
|
3044
4552
|
// src/components/LoadingPage.tsx
|
|
3045
|
-
var
|
|
3046
|
-
var
|
|
3047
|
-
var LoadingPage =
|
|
4553
|
+
var React30 = __toESM(require("react"));
|
|
4554
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4555
|
+
var LoadingPage = React30.forwardRef(
|
|
3048
4556
|
({
|
|
3049
4557
|
loading = true,
|
|
3050
4558
|
message,
|
|
@@ -3055,8 +4563,8 @@ var LoadingPage = React20.forwardRef(
|
|
|
3055
4563
|
className,
|
|
3056
4564
|
...props
|
|
3057
4565
|
}, ref) => {
|
|
3058
|
-
const [visible, setVisible] =
|
|
3059
|
-
|
|
4566
|
+
const [visible, setVisible] = React30.useState(delay === 0 && loading);
|
|
4567
|
+
React30.useEffect(() => {
|
|
3060
4568
|
if (!loading) {
|
|
3061
4569
|
setVisible(false);
|
|
3062
4570
|
return;
|
|
@@ -3069,7 +4577,7 @@ var LoadingPage = React20.forwardRef(
|
|
|
3069
4577
|
return () => clearTimeout(timer);
|
|
3070
4578
|
}, [loading, delay]);
|
|
3071
4579
|
if (!visible) return null;
|
|
3072
|
-
return /* @__PURE__ */ (0,
|
|
4580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3073
4581
|
"div",
|
|
3074
4582
|
{
|
|
3075
4583
|
ref,
|
|
@@ -3081,10 +4589,10 @@ var LoadingPage = React20.forwardRef(
|
|
|
3081
4589
|
),
|
|
3082
4590
|
...props,
|
|
3083
4591
|
children: [
|
|
3084
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
3085
|
-
progress !== void 0 && /* @__PURE__ */ (0,
|
|
3086
|
-
message && /* @__PURE__ */ (0,
|
|
3087
|
-
/* @__PURE__ */ (0,
|
|
4592
|
+
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" }),
|
|
4593
|
+
progress !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ProgressBar, { value: progress, className: "mt-6 w-48 max-w-full" }),
|
|
4594
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "mt-4 text-sm text-muted-foreground animate-pulse-subtle", children: message }),
|
|
4595
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: "sr-only", children: [
|
|
3088
4596
|
message || "Loading",
|
|
3089
4597
|
progress !== void 0 && `, ${Math.round(progress)}% complete`
|
|
3090
4598
|
] })
|
|
@@ -3096,9 +4604,9 @@ var LoadingPage = React20.forwardRef(
|
|
|
3096
4604
|
LoadingPage.displayName = "LoadingPage";
|
|
3097
4605
|
|
|
3098
4606
|
// src/components/LoadingSection.tsx
|
|
3099
|
-
var
|
|
3100
|
-
var
|
|
3101
|
-
var LoadingSection =
|
|
4607
|
+
var React31 = __toESM(require("react"));
|
|
4608
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4609
|
+
var LoadingSection = React31.forwardRef(
|
|
3102
4610
|
({
|
|
3103
4611
|
loading = false,
|
|
3104
4612
|
variant = "spinner",
|
|
@@ -3111,7 +4619,7 @@ var LoadingSection = React21.forwardRef(
|
|
|
3111
4619
|
children,
|
|
3112
4620
|
...props
|
|
3113
4621
|
}, ref) => {
|
|
3114
|
-
return /* @__PURE__ */ (0,
|
|
4622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3115
4623
|
"div",
|
|
3116
4624
|
{
|
|
3117
4625
|
ref,
|
|
@@ -3121,7 +4629,7 @@ var LoadingSection = React21.forwardRef(
|
|
|
3121
4629
|
...props,
|
|
3122
4630
|
children: [
|
|
3123
4631
|
children,
|
|
3124
|
-
loading && /* @__PURE__ */ (0,
|
|
4632
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3125
4633
|
LoadingOverlay,
|
|
3126
4634
|
{
|
|
3127
4635
|
mode: "overlay",
|
|
@@ -3140,11 +4648,11 @@ var LoadingSection = React21.forwardRef(
|
|
|
3140
4648
|
LoadingSection.displayName = "LoadingSection";
|
|
3141
4649
|
|
|
3142
4650
|
// src/components/LiveRegion.tsx
|
|
3143
|
-
var
|
|
3144
|
-
var
|
|
3145
|
-
var LiveRegion =
|
|
4651
|
+
var React32 = __toESM(require("react"));
|
|
4652
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4653
|
+
var LiveRegion = React32.forwardRef(
|
|
3146
4654
|
({ message, politeness = "polite", atomic = true, visuallyHidden = true, className, children }, ref) => {
|
|
3147
|
-
return /* @__PURE__ */ (0,
|
|
4655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3148
4656
|
"div",
|
|
3149
4657
|
{
|
|
3150
4658
|
ref,
|
|
@@ -3163,9 +4671,9 @@ var LiveRegion = React22.forwardRef(
|
|
|
3163
4671
|
LiveRegion.displayName = "LiveRegion";
|
|
3164
4672
|
|
|
3165
4673
|
// src/components/SkipLink.tsx
|
|
3166
|
-
var
|
|
3167
|
-
var
|
|
3168
|
-
var SkipLink =
|
|
4674
|
+
var React33 = __toESM(require("react"));
|
|
4675
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4676
|
+
var SkipLink = React33.forwardRef(
|
|
3169
4677
|
({ targetId, className, children = "Skip to main content", ...props }, ref) => {
|
|
3170
4678
|
const handleClick = (e) => {
|
|
3171
4679
|
e.preventDefault();
|
|
@@ -3183,7 +4691,7 @@ var SkipLink = React23.forwardRef(
|
|
|
3183
4691
|
}
|
|
3184
4692
|
props.onClick?.(e);
|
|
3185
4693
|
};
|
|
3186
|
-
return /* @__PURE__ */ (0,
|
|
4694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3187
4695
|
"a",
|
|
3188
4696
|
{
|
|
3189
4697
|
ref,
|
|
@@ -3471,21 +4979,21 @@ function useRovingTabindex(options = {}) {
|
|
|
3471
4979
|
}
|
|
3472
4980
|
|
|
3473
4981
|
// src/hooks/useClickOutside.ts
|
|
3474
|
-
var
|
|
4982
|
+
var React34 = __toESM(require("react"));
|
|
3475
4983
|
function useClickOutside(ref, callback, options) {
|
|
3476
4984
|
const {
|
|
3477
4985
|
enabled = true,
|
|
3478
4986
|
events = ["mousedown", "touchstart"],
|
|
3479
4987
|
ignoreElements = []
|
|
3480
4988
|
} = options ?? {};
|
|
3481
|
-
const callbackRef =
|
|
3482
|
-
const ignoreElementsRef =
|
|
3483
|
-
|
|
4989
|
+
const callbackRef = React34.useRef(callback);
|
|
4990
|
+
const ignoreElementsRef = React34.useRef(ignoreElements);
|
|
4991
|
+
React34.useEffect(() => {
|
|
3484
4992
|
callbackRef.current = callback;
|
|
3485
4993
|
ignoreElementsRef.current = ignoreElements;
|
|
3486
4994
|
}, [callback, ignoreElements]);
|
|
3487
4995
|
const eventsKey = events.join(",");
|
|
3488
|
-
|
|
4996
|
+
React34.useEffect(() => {
|
|
3489
4997
|
if (!enabled) return;
|
|
3490
4998
|
const handleEvent = (event) => {
|
|
3491
4999
|
const target = event.target;
|
|
@@ -3539,6 +5047,8 @@ function useClickOutside(ref, callback, options) {
|
|
|
3539
5047
|
DialogTitle,
|
|
3540
5048
|
DialogTrigger,
|
|
3541
5049
|
Input,
|
|
5050
|
+
InsertPalette,
|
|
5051
|
+
IssuesButton,
|
|
3542
5052
|
Label,
|
|
3543
5053
|
LiveRegion,
|
|
3544
5054
|
LoadingLogo,
|
|
@@ -3548,10 +5058,21 @@ function useClickOutside(ref, callback, options) {
|
|
|
3548
5058
|
PageHeader,
|
|
3549
5059
|
PasswordInput,
|
|
3550
5060
|
ProgressBar,
|
|
5061
|
+
SaveStatus,
|
|
3551
5062
|
Separator,
|
|
5063
|
+
Sheet,
|
|
3552
5064
|
Skeleton,
|
|
3553
5065
|
SkipLink,
|
|
5066
|
+
SortableList,
|
|
3554
5067
|
Spinner,
|
|
5068
|
+
Studio,
|
|
5069
|
+
StudioBar,
|
|
5070
|
+
StudioCanvas,
|
|
5071
|
+
StudioCanvasItem,
|
|
5072
|
+
StudioInspector,
|
|
5073
|
+
StudioInspectorSection,
|
|
5074
|
+
StudioOutline,
|
|
5075
|
+
StudioPage,
|
|
3555
5076
|
Switch,
|
|
3556
5077
|
badgeVariants,
|
|
3557
5078
|
buttonVariants,
|
|
@@ -3571,5 +5092,6 @@ function useClickOutside(ref, callback, options) {
|
|
|
3571
5092
|
useFocusRef,
|
|
3572
5093
|
useFocusTrap,
|
|
3573
5094
|
useReducedMotion,
|
|
3574
|
-
useRovingTabindex
|
|
5095
|
+
useRovingTabindex,
|
|
5096
|
+
useStudio
|
|
3575
5097
|
});
|