@classic-homes/theme-react 0.2.3 → 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 +1779 -264
- package/dist/index.mjs +1793 -292
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57,6 +57,8 @@ __export(index_exports, {
|
|
|
57
57
|
DialogTitle: () => DialogTitle,
|
|
58
58
|
DialogTrigger: () => DialogTrigger,
|
|
59
59
|
Input: () => Input,
|
|
60
|
+
InsertPalette: () => InsertPalette,
|
|
61
|
+
IssuesButton: () => IssuesButton,
|
|
60
62
|
Label: () => Label,
|
|
61
63
|
LiveRegion: () => LiveRegion,
|
|
62
64
|
LoadingLogo: () => LoadingLogo,
|
|
@@ -66,10 +68,21 @@ __export(index_exports, {
|
|
|
66
68
|
PageHeader: () => PageHeader,
|
|
67
69
|
PasswordInput: () => PasswordInput,
|
|
68
70
|
ProgressBar: () => ProgressBar,
|
|
71
|
+
SaveStatus: () => SaveStatus,
|
|
69
72
|
Separator: () => Separator,
|
|
73
|
+
Sheet: () => Sheet,
|
|
70
74
|
Skeleton: () => Skeleton,
|
|
71
75
|
SkipLink: () => SkipLink,
|
|
76
|
+
SortableList: () => SortableList,
|
|
72
77
|
Spinner: () => Spinner,
|
|
78
|
+
Studio: () => Studio,
|
|
79
|
+
StudioBar: () => StudioBar,
|
|
80
|
+
StudioCanvas: () => StudioCanvas,
|
|
81
|
+
StudioCanvasItem: () => StudioCanvasItem,
|
|
82
|
+
StudioInspector: () => StudioInspector,
|
|
83
|
+
StudioInspectorSection: () => StudioInspectorSection,
|
|
84
|
+
StudioOutline: () => StudioOutline,
|
|
85
|
+
StudioPage: () => StudioPage,
|
|
73
86
|
Switch: () => Switch,
|
|
74
87
|
badgeVariants: () => badgeVariants,
|
|
75
88
|
buttonVariants: () => buttonVariants,
|
|
@@ -89,7 +102,8 @@ __export(index_exports, {
|
|
|
89
102
|
useFocusRef: () => useFocusRef,
|
|
90
103
|
useFocusTrap: () => useFocusTrap,
|
|
91
104
|
useReducedMotion: () => useReducedMotion,
|
|
92
|
-
useRovingTabindex: () => useRovingTabindex
|
|
105
|
+
useRovingTabindex: () => useRovingTabindex,
|
|
106
|
+
useStudio: () => useStudio
|
|
93
107
|
});
|
|
94
108
|
module.exports = __toCommonJS(index_exports);
|
|
95
109
|
|
|
@@ -769,9 +783,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,15 +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
|
|
2385
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
885
2386
|
function layoutViewportWidth() {
|
|
886
2387
|
return document.documentElement.clientWidth;
|
|
887
2388
|
}
|
|
888
|
-
var DropdownTrigger =
|
|
889
|
-
var DropdownContent =
|
|
890
|
-
var DropdownLabel =
|
|
891
|
-
var DropdownItem =
|
|
892
|
-
var DropdownSeparator =
|
|
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;
|
|
893
2394
|
function useDataPanel(options = {}) {
|
|
894
2395
|
const {
|
|
895
2396
|
persistKey,
|
|
@@ -899,28 +2400,28 @@ function useDataPanel(options = {}) {
|
|
|
899
2400
|
constraints = {}
|
|
900
2401
|
} = options;
|
|
901
2402
|
const resolvedConstraints = { ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints };
|
|
902
|
-
const [persistedState] =
|
|
2403
|
+
const [persistedState] = React24.useState(() => {
|
|
903
2404
|
if (persistKey && typeof window !== "undefined") {
|
|
904
2405
|
return (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
905
2406
|
}
|
|
906
2407
|
return null;
|
|
907
2408
|
});
|
|
908
|
-
const [mode, setMode] =
|
|
909
|
-
const [edge, setEdge] =
|
|
910
|
-
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(
|
|
911
2412
|
persistedState?.isExpanded ?? initialExpanded
|
|
912
2413
|
);
|
|
913
|
-
const [detachedPosition, setDetachedPosition] =
|
|
2414
|
+
const [detachedPosition, setDetachedPosition] = React24.useState(
|
|
914
2415
|
persistedState?.detachedPosition ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
915
2416
|
);
|
|
916
|
-
const [detachedSize, setDetachedSize] =
|
|
2417
|
+
const [detachedSize, setDetachedSize] = React24.useState(
|
|
917
2418
|
persistedState?.detachedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.detachedSize
|
|
918
2419
|
);
|
|
919
|
-
const [pinnedSize, setPinnedSize] =
|
|
2420
|
+
const [pinnedSize, setPinnedSize] = React24.useState(
|
|
920
2421
|
persistedState?.pinnedSize ?? import_data_panel_core.DEFAULT_PANEL_STATE.pinnedSize
|
|
921
2422
|
);
|
|
922
|
-
const saveTimeoutRef =
|
|
923
|
-
const debouncedSave =
|
|
2423
|
+
const saveTimeoutRef = React24.useRef(null);
|
|
2424
|
+
const debouncedSave = React24.useCallback(() => {
|
|
924
2425
|
if (!persistKey) return;
|
|
925
2426
|
if (saveTimeoutRef.current) {
|
|
926
2427
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -939,7 +2440,7 @@ function useDataPanel(options = {}) {
|
|
|
939
2440
|
});
|
|
940
2441
|
}, 300);
|
|
941
2442
|
}, [persistKey, mode, edge, isExpanded, detachedPosition, detachedSize, pinnedSize]);
|
|
942
|
-
const handleSetMode =
|
|
2443
|
+
const handleSetMode = React24.useCallback(
|
|
943
2444
|
(newMode) => {
|
|
944
2445
|
setMode(newMode);
|
|
945
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) {
|
|
@@ -950,7 +2451,7 @@ function useDataPanel(options = {}) {
|
|
|
950
2451
|
},
|
|
951
2452
|
[detachedPosition, detachedSize]
|
|
952
2453
|
);
|
|
953
|
-
const handleSetDetachedPosition =
|
|
2454
|
+
const handleSetDetachedPosition = React24.useCallback(
|
|
954
2455
|
(position) => {
|
|
955
2456
|
if (typeof window === "undefined") {
|
|
956
2457
|
setDetachedPosition(position);
|
|
@@ -962,13 +2463,13 @@ function useDataPanel(options = {}) {
|
|
|
962
2463
|
},
|
|
963
2464
|
[detachedSize]
|
|
964
2465
|
);
|
|
965
|
-
const handleSetDetachedSize =
|
|
2466
|
+
const handleSetDetachedSize = React24.useCallback(
|
|
966
2467
|
(size) => {
|
|
967
2468
|
setDetachedSize((0, import_data_panel_core.constrainSize)(size, resolvedConstraints));
|
|
968
2469
|
},
|
|
969
2470
|
[resolvedConstraints]
|
|
970
2471
|
);
|
|
971
|
-
const handleSetPinnedSize =
|
|
2472
|
+
const handleSetPinnedSize = React24.useCallback(
|
|
972
2473
|
(size) => {
|
|
973
2474
|
if (typeof window === "undefined") {
|
|
974
2475
|
setPinnedSize(size);
|
|
@@ -982,7 +2483,7 @@ function useDataPanel(options = {}) {
|
|
|
982
2483
|
},
|
|
983
2484
|
[edge, resolvedConstraints]
|
|
984
2485
|
);
|
|
985
|
-
|
|
2486
|
+
React24.useEffect(() => {
|
|
986
2487
|
debouncedSave();
|
|
987
2488
|
}, [debouncedSave]);
|
|
988
2489
|
return {
|
|
@@ -1000,7 +2501,7 @@ function useDataPanel(options = {}) {
|
|
|
1000
2501
|
setPinnedSize: handleSetPinnedSize
|
|
1001
2502
|
};
|
|
1002
2503
|
}
|
|
1003
|
-
var ChevronUpIcon = () => /* @__PURE__ */ (0,
|
|
2504
|
+
var ChevronUpIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1004
2505
|
"svg",
|
|
1005
2506
|
{
|
|
1006
2507
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1012,10 +2513,10 @@ var ChevronUpIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
|
1012
2513
|
strokeWidth: "2",
|
|
1013
2514
|
strokeLinecap: "round",
|
|
1014
2515
|
strokeLinejoin: "round",
|
|
1015
|
-
children: /* @__PURE__ */ (0,
|
|
2516
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "m18 15-6-6-6 6" })
|
|
1016
2517
|
}
|
|
1017
2518
|
);
|
|
1018
|
-
var MoreVerticalIcon = () => /* @__PURE__ */ (0,
|
|
2519
|
+
var MoreVerticalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1019
2520
|
"svg",
|
|
1020
2521
|
{
|
|
1021
2522
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1028,13 +2529,13 @@ var MoreVerticalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
|
1028
2529
|
strokeLinecap: "round",
|
|
1029
2530
|
strokeLinejoin: "round",
|
|
1030
2531
|
children: [
|
|
1031
|
-
/* @__PURE__ */ (0,
|
|
1032
|
-
/* @__PURE__ */ (0,
|
|
1033
|
-
/* @__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" })
|
|
1034
2535
|
]
|
|
1035
2536
|
}
|
|
1036
2537
|
);
|
|
1037
|
-
var CloseIcon = () => /* @__PURE__ */ (0,
|
|
2538
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1038
2539
|
"svg",
|
|
1039
2540
|
{
|
|
1040
2541
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1047,12 +2548,12 @@ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
|
1047
2548
|
strokeLinecap: "round",
|
|
1048
2549
|
strokeLinejoin: "round",
|
|
1049
2550
|
children: [
|
|
1050
|
-
/* @__PURE__ */ (0,
|
|
1051
|
-
/* @__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" })
|
|
1052
2553
|
]
|
|
1053
2554
|
}
|
|
1054
2555
|
);
|
|
1055
|
-
var GripIcon = () => /* @__PURE__ */ (0,
|
|
2556
|
+
var GripIcon = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1056
2557
|
"svg",
|
|
1057
2558
|
{
|
|
1058
2559
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1061,12 +2562,12 @@ var GripIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
|
1061
2562
|
viewBox: "0 0 24 24",
|
|
1062
2563
|
fill: "currentColor",
|
|
1063
2564
|
children: [
|
|
1064
|
-
/* @__PURE__ */ (0,
|
|
1065
|
-
/* @__PURE__ */ (0,
|
|
1066
|
-
/* @__PURE__ */ (0,
|
|
1067
|
-
/* @__PURE__ */ (0,
|
|
1068
|
-
/* @__PURE__ */ (0,
|
|
1069
|
-
/* @__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" })
|
|
1070
2571
|
]
|
|
1071
2572
|
}
|
|
1072
2573
|
);
|
|
@@ -1076,7 +2577,7 @@ var edgeLabels = {
|
|
|
1076
2577
|
top: "Pin to top",
|
|
1077
2578
|
bottom: "Pin to bottom"
|
|
1078
2579
|
};
|
|
1079
|
-
var DataPanelHeader =
|
|
2580
|
+
var DataPanelHeader = React24.forwardRef(
|
|
1080
2581
|
({
|
|
1081
2582
|
title,
|
|
1082
2583
|
subtitle,
|
|
@@ -1095,7 +2596,7 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1095
2596
|
className,
|
|
1096
2597
|
draggable = false
|
|
1097
2598
|
}, ref) => {
|
|
1098
|
-
return /* @__PURE__ */ (0,
|
|
2599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1099
2600
|
"div",
|
|
1100
2601
|
{
|
|
1101
2602
|
ref,
|
|
@@ -1106,13 +2607,13 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1106
2607
|
),
|
|
1107
2608
|
"data-panel-header": true,
|
|
1108
2609
|
children: [
|
|
1109
|
-
/* @__PURE__ */ (0,
|
|
1110
|
-
title && /* @__PURE__ */ (0,
|
|
1111
|
-
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 })
|
|
1112
2613
|
] }) }),
|
|
1113
|
-
/* @__PURE__ */ (0,
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1114
2615
|
headerActions,
|
|
1115
|
-
/* @__PURE__ */ (0,
|
|
2616
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1116
2617
|
"button",
|
|
1117
2618
|
{
|
|
1118
2619
|
type: "button",
|
|
@@ -1127,37 +2628,37 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1127
2628
|
},
|
|
1128
2629
|
"aria-label": isExpanded ? "Collapse panel" : "Expand panel",
|
|
1129
2630
|
"aria-expanded": isExpanded,
|
|
1130
|
-
children: /* @__PURE__ */ (0,
|
|
2631
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1131
2632
|
"span",
|
|
1132
2633
|
{
|
|
1133
2634
|
className: cn(
|
|
1134
2635
|
"transition-transform",
|
|
1135
2636
|
{ top: "", bottom: "rotate-180", left: "-rotate-90", right: "rotate-90" }[edge]
|
|
1136
2637
|
),
|
|
1137
|
-
children: /* @__PURE__ */ (0,
|
|
2638
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChevronUpIcon, {})
|
|
1138
2639
|
}
|
|
1139
2640
|
)
|
|
1140
2641
|
}
|
|
1141
2642
|
),
|
|
1142
|
-
!disableModeSwitch && /* @__PURE__ */ (0,
|
|
1143
|
-
/* @__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)(
|
|
1144
2645
|
"button",
|
|
1145
2646
|
{
|
|
1146
2647
|
type: "button",
|
|
1147
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",
|
|
1148
2649
|
"aria-label": "Panel options",
|
|
1149
|
-
children: /* @__PURE__ */ (0,
|
|
2650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(MoreVerticalIcon, {})
|
|
1150
2651
|
}
|
|
1151
2652
|
) }),
|
|
1152
|
-
/* @__PURE__ */ (0,
|
|
2653
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DropdownMenuPrimitive2.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1153
2654
|
DropdownContent,
|
|
1154
2655
|
{
|
|
1155
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",
|
|
1156
2657
|
sideOffset: 4,
|
|
1157
2658
|
align: "end",
|
|
1158
2659
|
children: [
|
|
1159
|
-
/* @__PURE__ */ (0,
|
|
1160
|
-
["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)(
|
|
1161
2662
|
DropdownItem,
|
|
1162
2663
|
{
|
|
1163
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",
|
|
@@ -1167,20 +2668,20 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1167
2668
|
},
|
|
1168
2669
|
children: [
|
|
1169
2670
|
edgeLabels[e],
|
|
1170
|
-
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" })
|
|
1171
2672
|
]
|
|
1172
2673
|
},
|
|
1173
2674
|
e
|
|
1174
2675
|
)),
|
|
1175
|
-
/* @__PURE__ */ (0,
|
|
1176
|
-
/* @__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)(
|
|
1177
2678
|
DropdownItem,
|
|
1178
2679
|
{
|
|
1179
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",
|
|
1180
2681
|
onSelect: () => onModeChange?.("detached"),
|
|
1181
2682
|
children: [
|
|
1182
2683
|
"Detach",
|
|
1183
|
-
mode === "detached" && /* @__PURE__ */ (0,
|
|
2684
|
+
mode === "detached" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "ml-auto text-xs", children: "\u2713" })
|
|
1184
2685
|
]
|
|
1185
2686
|
}
|
|
1186
2687
|
)
|
|
@@ -1188,14 +2689,14 @@ var DataPanelHeader = React14.forwardRef(
|
|
|
1188
2689
|
}
|
|
1189
2690
|
) })
|
|
1190
2691
|
] }),
|
|
1191
|
-
!disableClose && /* @__PURE__ */ (0,
|
|
2692
|
+
!disableClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1192
2693
|
"button",
|
|
1193
2694
|
{
|
|
1194
2695
|
type: "button",
|
|
1195
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",
|
|
1196
2697
|
onClick: onClose,
|
|
1197
2698
|
"aria-label": "Close panel",
|
|
1198
|
-
children: /* @__PURE__ */ (0,
|
|
2699
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
1199
2700
|
}
|
|
1200
2701
|
)
|
|
1201
2702
|
] })
|
|
@@ -1219,14 +2720,14 @@ function DataPanelCardHeader({
|
|
|
1219
2720
|
onToggleExpand,
|
|
1220
2721
|
onClose
|
|
1221
2722
|
}) {
|
|
1222
|
-
return /* @__PURE__ */ (0,
|
|
2723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1223
2724
|
"div",
|
|
1224
2725
|
{
|
|
1225
2726
|
"data-panel-header": true,
|
|
1226
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",
|
|
1227
2728
|
onPointerDown: onHeaderPointerDown,
|
|
1228
2729
|
children: [
|
|
1229
|
-
showDragHandle && /* @__PURE__ */ (0,
|
|
2730
|
+
showDragHandle && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1230
2731
|
"div",
|
|
1231
2732
|
{
|
|
1232
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",
|
|
@@ -1238,22 +2739,22 @@ function DataPanelCardHeader({
|
|
|
1238
2739
|
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && onToggleExpand()
|
|
1239
2740
|
}
|
|
1240
2741
|
),
|
|
1241
|
-
/* @__PURE__ */ (0,
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1242
2743
|
"div",
|
|
1243
2744
|
{
|
|
1244
2745
|
className: "flex-1 min-w-0",
|
|
1245
2746
|
role: "button",
|
|
1246
2747
|
tabIndex: 0,
|
|
1247
2748
|
onKeyDown: (e) => (e.key === "Enter" || e.key === " ") && onToggleExpand(),
|
|
1248
|
-
children: headerContent ? headerContent : /* @__PURE__ */ (0,
|
|
1249
|
-
subtitle && /* @__PURE__ */ (0,
|
|
1250
|
-
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 })
|
|
1251
2752
|
] })
|
|
1252
2753
|
}
|
|
1253
2754
|
),
|
|
1254
|
-
/* @__PURE__ */ (0,
|
|
2755
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
1255
2756
|
headerActions,
|
|
1256
|
-
!isMobile && /* @__PURE__ */ (0,
|
|
2757
|
+
!isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1257
2758
|
"button",
|
|
1258
2759
|
{
|
|
1259
2760
|
"data-card-drag-handle": true,
|
|
@@ -1262,10 +2763,10 @@ function DataPanelCardHeader({
|
|
|
1262
2763
|
"aria-label": "Drag to reposition panel",
|
|
1263
2764
|
title: "Drag to move",
|
|
1264
2765
|
onPointerDown: onHeaderPointerDown,
|
|
1265
|
-
children: /* @__PURE__ */ (0,
|
|
2766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GripIcon, {})
|
|
1266
2767
|
}
|
|
1267
2768
|
),
|
|
1268
|
-
/* @__PURE__ */ (0,
|
|
2769
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1269
2770
|
"button",
|
|
1270
2771
|
{
|
|
1271
2772
|
type: "button",
|
|
@@ -1274,17 +2775,17 @@ function DataPanelCardHeader({
|
|
|
1274
2775
|
"aria-expanded": isExpanded,
|
|
1275
2776
|
"aria-label": isExpanded ? "Collapse panel" : "Expand panel",
|
|
1276
2777
|
title: isExpanded ? "Collapse" : "Expand",
|
|
1277
|
-
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, {}) })
|
|
1278
2779
|
}
|
|
1279
2780
|
),
|
|
1280
|
-
!disableClose && /* @__PURE__ */ (0,
|
|
2781
|
+
!disableClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1281
2782
|
"button",
|
|
1282
2783
|
{
|
|
1283
2784
|
type: "button",
|
|
1284
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",
|
|
1285
2786
|
onClick: onClose,
|
|
1286
2787
|
"aria-label": "Close panel",
|
|
1287
|
-
children: /* @__PURE__ */ (0,
|
|
2788
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
1288
2789
|
}
|
|
1289
2790
|
)
|
|
1290
2791
|
] })
|
|
@@ -1292,9 +2793,9 @@ function DataPanelCardHeader({
|
|
|
1292
2793
|
}
|
|
1293
2794
|
);
|
|
1294
2795
|
}
|
|
1295
|
-
var DataPanelContent =
|
|
2796
|
+
var DataPanelContent = React24.forwardRef(
|
|
1296
2797
|
({ children, className, "aria-label": ariaLabel = "Panel content" }, ref) => {
|
|
1297
|
-
return /* @__PURE__ */ (0,
|
|
2798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1298
2799
|
"div",
|
|
1299
2800
|
{
|
|
1300
2801
|
ref,
|
|
@@ -1307,7 +2808,7 @@ var DataPanelContent = React14.forwardRef(
|
|
|
1307
2808
|
}
|
|
1308
2809
|
);
|
|
1309
2810
|
DataPanelContent.displayName = "DataPanelContent";
|
|
1310
|
-
var DataPanelFooter =
|
|
2811
|
+
var DataPanelFooter = React24.forwardRef(
|
|
1311
2812
|
({ actions = [], footerContent, footerActions, className }, ref) => {
|
|
1312
2813
|
if (!footerContent && actions.length === 0 && !footerActions) {
|
|
1313
2814
|
return null;
|
|
@@ -1316,7 +2817,7 @@ var DataPanelFooter = React14.forwardRef(
|
|
|
1316
2817
|
if (variant === "primary") return "default";
|
|
1317
2818
|
return variant ?? "default";
|
|
1318
2819
|
};
|
|
1319
|
-
return /* @__PURE__ */ (0,
|
|
2820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1320
2821
|
"div",
|
|
1321
2822
|
{
|
|
1322
2823
|
ref,
|
|
@@ -1324,9 +2825,9 @@ var DataPanelFooter = React14.forwardRef(
|
|
|
1324
2825
|
"flex items-center justify-end gap-2 border-t border-border bg-muted/30 px-4 py-3",
|
|
1325
2826
|
className
|
|
1326
2827
|
),
|
|
1327
|
-
children: footerContent ? footerContent : /* @__PURE__ */ (0,
|
|
2828
|
+
children: footerContent ? footerContent : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
1328
2829
|
footerActions,
|
|
1329
|
-
actions.map((action, index) => /* @__PURE__ */ (0,
|
|
2830
|
+
actions.map((action, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1330
2831
|
Button,
|
|
1331
2832
|
{
|
|
1332
2833
|
variant: mapVariant(action.variant),
|
|
@@ -1343,7 +2844,7 @@ var DataPanelFooter = React14.forwardRef(
|
|
|
1343
2844
|
}
|
|
1344
2845
|
);
|
|
1345
2846
|
DataPanelFooter.displayName = "DataPanelFooter";
|
|
1346
|
-
var DataPanelTab =
|
|
2847
|
+
var DataPanelTab = React24.forwardRef(
|
|
1347
2848
|
({
|
|
1348
2849
|
title = "Panel",
|
|
1349
2850
|
subtitle,
|
|
@@ -1369,15 +2870,15 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1369
2870
|
bottom: "left-1/2 rounded-t-lg border-b-0"
|
|
1370
2871
|
}[edge];
|
|
1371
2872
|
const insetStyle = { [edge]: tabInset };
|
|
1372
|
-
const innerRef =
|
|
1373
|
-
const dragRef =
|
|
2873
|
+
const innerRef = React24.useRef(null);
|
|
2874
|
+
const dragRef = React24.useRef({
|
|
1374
2875
|
startX: 0,
|
|
1375
2876
|
startY: 0,
|
|
1376
2877
|
startOffset: 0,
|
|
1377
2878
|
moved: false,
|
|
1378
2879
|
pointerId: -1
|
|
1379
2880
|
});
|
|
1380
|
-
const [dragOffset, setDragOffset] =
|
|
2881
|
+
const [dragOffset, setDragOffset] = React24.useState(null);
|
|
1381
2882
|
const effectiveOffset = dragOffset ?? offset;
|
|
1382
2883
|
const draggable = !!onOffsetChange;
|
|
1383
2884
|
const tabTransform = (0, import_data_panel_core.getTabTransform)(edge, tabWidth, effectiveOffset);
|
|
@@ -1446,7 +2947,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1446
2947
|
onClick?.();
|
|
1447
2948
|
}
|
|
1448
2949
|
};
|
|
1449
|
-
|
|
2950
|
+
React24.useEffect(() => {
|
|
1450
2951
|
if (!onOffsetChange || dragOffset !== null) return;
|
|
1451
2952
|
const reclamp = () => {
|
|
1452
2953
|
const clamped = (0, import_data_panel_core.constrainTabOffset)(
|
|
@@ -1462,7 +2963,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1462
2963
|
window.addEventListener("resize", reclamp);
|
|
1463
2964
|
return () => window.removeEventListener("resize", reclamp);
|
|
1464
2965
|
}, [edge, tabWidth, offset, onOffsetChange, dragOffset]);
|
|
1465
|
-
return /* @__PURE__ */ (0,
|
|
2966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1466
2967
|
"div",
|
|
1467
2968
|
{
|
|
1468
2969
|
ref: setRefs,
|
|
@@ -1488,7 +2989,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1488
2989
|
onPointerUp: draggable ? handlePointerUp : void 0,
|
|
1489
2990
|
onPointerCancel: draggable ? handlePointerCancel : void 0,
|
|
1490
2991
|
children: [
|
|
1491
|
-
/* @__PURE__ */ (0,
|
|
2992
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1492
2993
|
"button",
|
|
1493
2994
|
{
|
|
1494
2995
|
type: "button",
|
|
@@ -1497,12 +2998,12 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1497
2998
|
onClick: draggable ? void 0 : onClick,
|
|
1498
2999
|
onKeyDown: handleExpandKeyDown,
|
|
1499
3000
|
children: [
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
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 })
|
|
1502
3003
|
]
|
|
1503
3004
|
}
|
|
1504
3005
|
),
|
|
1505
|
-
!disableClose && onClose && /* @__PURE__ */ (0,
|
|
3006
|
+
!disableClose && onClose && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1506
3007
|
"button",
|
|
1507
3008
|
{
|
|
1508
3009
|
"data-no-drag": true,
|
|
@@ -1513,7 +3014,7 @@ var DataPanelTab = React14.forwardRef(
|
|
|
1513
3014
|
e.stopPropagation();
|
|
1514
3015
|
onClose();
|
|
1515
3016
|
},
|
|
1516
|
-
children: /* @__PURE__ */ (0,
|
|
3017
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
1517
3018
|
}
|
|
1518
3019
|
)
|
|
1519
3020
|
]
|
|
@@ -1535,7 +3036,7 @@ function ResizeHandles({
|
|
|
1535
3036
|
onPinnedSizeChange,
|
|
1536
3037
|
constraints
|
|
1537
3038
|
}) {
|
|
1538
|
-
const handleDetachedKeyDown =
|
|
3039
|
+
const handleDetachedKeyDown = React24.useCallback(
|
|
1539
3040
|
(e, handle) => {
|
|
1540
3041
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
1541
3042
|
let width = detachedSize.width;
|
|
@@ -1598,7 +3099,7 @@ function ResizeHandles({
|
|
|
1598
3099
|
},
|
|
1599
3100
|
[detachedPosition, detachedSize, constraints, onDetachedResize]
|
|
1600
3101
|
);
|
|
1601
|
-
const handlePinnedKeyDown =
|
|
3102
|
+
const handlePinnedKeyDown = React24.useCallback(
|
|
1602
3103
|
(e) => {
|
|
1603
3104
|
const step = e.shiftKey ? KEYBOARD_RESIZE_STEP_LARGE : KEYBOARD_RESIZE_STEP;
|
|
1604
3105
|
let newSize = pinnedSize;
|
|
@@ -1658,12 +3159,12 @@ function ResizeHandles({
|
|
|
1658
3159
|
"bottom-left",
|
|
1659
3160
|
"bottom-right"
|
|
1660
3161
|
];
|
|
1661
|
-
return /* @__PURE__ */ (0,
|
|
3162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: handles.map((handle) => {
|
|
1662
3163
|
const isCorner = handle.includes("-");
|
|
1663
3164
|
const isHorizontal2 = handle === "top" || handle === "bottom";
|
|
1664
3165
|
const isVertical = handle === "left" || handle === "right";
|
|
1665
3166
|
const { min: min2, max: max2 } = getAriaValueMinMax(handle);
|
|
1666
|
-
return /* @__PURE__ */ (0,
|
|
3167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1667
3168
|
"div",
|
|
1668
3169
|
{
|
|
1669
3170
|
className: cn(
|
|
@@ -1692,7 +3193,7 @@ function ResizeHandles({
|
|
|
1692
3193
|
const pinnedHandle = (0, import_data_panel_core.getPinnedResizeHandle)(edge);
|
|
1693
3194
|
const isHorizontal = edge === "left" || edge === "right";
|
|
1694
3195
|
const { min, max } = getAriaValueMinMax(pinnedHandle);
|
|
1695
|
-
return /* @__PURE__ */ (0,
|
|
3196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1696
3197
|
"div",
|
|
1697
3198
|
{
|
|
1698
3199
|
className: cn(
|
|
@@ -1715,7 +3216,7 @@ function ResizeHandles({
|
|
|
1715
3216
|
}
|
|
1716
3217
|
);
|
|
1717
3218
|
}
|
|
1718
|
-
var DataPanel =
|
|
3219
|
+
var DataPanel = React24.forwardRef(
|
|
1719
3220
|
({
|
|
1720
3221
|
open: controlledOpen,
|
|
1721
3222
|
onOpenChange,
|
|
@@ -1747,76 +3248,76 @@ var DataPanel = React14.forwardRef(
|
|
|
1747
3248
|
footerActions,
|
|
1748
3249
|
className
|
|
1749
3250
|
}, ref) => {
|
|
1750
|
-
const resolvedConstraints =
|
|
3251
|
+
const resolvedConstraints = React24.useMemo(
|
|
1751
3252
|
() => ({ ...import_data_panel_core.DEFAULT_CONSTRAINTS, ...constraints }),
|
|
1752
3253
|
[constraints]
|
|
1753
3254
|
);
|
|
1754
|
-
const resolvedCardConfig =
|
|
3255
|
+
const resolvedCardConfig = React24.useMemo(
|
|
1755
3256
|
() => ({ ...import_data_panel_core.DEFAULT_CARD_CONFIG, ...cardConfig }),
|
|
1756
3257
|
[cardConfig]
|
|
1757
3258
|
);
|
|
1758
|
-
const panelId =
|
|
3259
|
+
const panelId = React24.useId();
|
|
1759
3260
|
const titleId = `${panelId}-title`;
|
|
1760
|
-
const [internalOpen, setInternalOpen] =
|
|
1761
|
-
const [internalMode, setInternalMode] =
|
|
1762
|
-
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(
|
|
1763
3264
|
import_data_panel_core.DEFAULT_PANEL_STATE.variant
|
|
1764
3265
|
);
|
|
1765
|
-
const [internalEdge, setInternalEdge] =
|
|
1766
|
-
const [internalExpanded, setInternalExpanded] =
|
|
3266
|
+
const [internalEdge, setInternalEdge] = React24.useState(import_data_panel_core.DEFAULT_PANEL_STATE.edge);
|
|
3267
|
+
const [internalExpanded, setInternalExpanded] = React24.useState(
|
|
1767
3268
|
import_data_panel_core.DEFAULT_PANEL_STATE.isExpanded
|
|
1768
3269
|
);
|
|
1769
|
-
const [detachedPosition, setDetachedPosition] =
|
|
3270
|
+
const [detachedPosition, setDetachedPosition] = React24.useState(
|
|
1770
3271
|
import_data_panel_core.DEFAULT_PANEL_STATE.detachedPosition
|
|
1771
3272
|
);
|
|
1772
|
-
const [detachedSize, setDetachedSize] =
|
|
1773
|
-
const [pinnedSize, setPinnedSize] =
|
|
1774
|
-
const [tabOffset, setTabOffset] =
|
|
1775
|
-
const [viewportWidth, setViewportWidth] =
|
|
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(
|
|
1776
3277
|
typeof window !== "undefined" ? layoutViewportWidth() : 1024
|
|
1777
3278
|
);
|
|
1778
|
-
const [viewportHeight, setViewportHeight] =
|
|
3279
|
+
const [viewportHeight, setViewportHeight] = React24.useState(
|
|
1779
3280
|
typeof window !== "undefined" ? window.innerHeight : 768
|
|
1780
3281
|
);
|
|
1781
3282
|
const isMobile = viewportWidth < 640;
|
|
1782
|
-
const [cardHorizontalPosition, setCardHorizontalPosition] =
|
|
1783
|
-
const [cardExpandedHeight, setCardExpandedHeight] =
|
|
1784
|
-
const [cardWidth, setCardWidth] =
|
|
1785
|
-
const [cardDragCurrentHeight, setCardDragCurrentHeight] =
|
|
1786
|
-
const [isCardVerticalDragging, setIsCardVerticalDragging] =
|
|
1787
|
-
const [isCardHorizontalDragging, setIsCardHorizontalDragging] =
|
|
1788
|
-
const [isCardHeightTransitioning, setIsCardHeightTransitioning] =
|
|
1789
|
-
const [isCardWidthResizing, setIsCardWidthResizing] =
|
|
1790
|
-
const [isCardTopResizing, setIsCardTopResizing] =
|
|
1791
|
-
const [isDragging, setIsDragging] =
|
|
1792
|
-
const [isResizing, setIsResizing] =
|
|
1793
|
-
const [snapPreview, setSnapPreview] =
|
|
1794
|
-
const [isPinnedDragging, setIsPinnedDragging] =
|
|
1795
|
-
const [pullOffset, setPullOffset] =
|
|
1796
|
-
const dragStateRef =
|
|
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({
|
|
1797
3298
|
startPosition: { x: 0, y: 0 },
|
|
1798
3299
|
startPanelPosition: { x: 0, y: 0 }
|
|
1799
3300
|
});
|
|
1800
|
-
const pinnedDragStateRef =
|
|
3301
|
+
const pinnedDragStateRef = React24.useRef({
|
|
1801
3302
|
startPosition: { x: 0, y: 0 },
|
|
1802
3303
|
hasDetached: false
|
|
1803
3304
|
});
|
|
1804
|
-
const resizeStateRef =
|
|
3305
|
+
const resizeStateRef = React24.useRef({
|
|
1805
3306
|
handle: null,
|
|
1806
3307
|
startPosition: { x: 0, y: 0 },
|
|
1807
3308
|
startSize: { width: 0, height: 0 },
|
|
1808
3309
|
startPanelPosition: { x: 0, y: 0 }
|
|
1809
3310
|
});
|
|
1810
|
-
const cardDragStateRef =
|
|
3311
|
+
const cardDragStateRef = React24.useRef({
|
|
1811
3312
|
startY: 0,
|
|
1812
3313
|
startX: 0,
|
|
1813
3314
|
startTime: 0,
|
|
1814
3315
|
startExpanded: false,
|
|
1815
3316
|
startHorizontalPosition: 0
|
|
1816
3317
|
});
|
|
1817
|
-
const cardCurrentHeightRef =
|
|
1818
|
-
const cardTopResizeStartRef =
|
|
1819
|
-
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({
|
|
1820
3321
|
handle: null,
|
|
1821
3322
|
startX: 0,
|
|
1822
3323
|
startWidth: 0,
|
|
@@ -1828,9 +3329,9 @@ var DataPanel = React14.forwardRef(
|
|
|
1828
3329
|
const edge = controlledEdge ?? internalEdge;
|
|
1829
3330
|
const isExpanded = controlledExpanded ?? internalExpanded;
|
|
1830
3331
|
const showContent = variant !== "card" || isExpanded || isCardVerticalDragging;
|
|
1831
|
-
const saveTimeoutRef =
|
|
1832
|
-
const isMountedRef =
|
|
1833
|
-
|
|
3332
|
+
const saveTimeoutRef = React24.useRef(null);
|
|
3333
|
+
const isMountedRef = React24.useRef(true);
|
|
3334
|
+
React24.useEffect(() => {
|
|
1834
3335
|
isMountedRef.current = true;
|
|
1835
3336
|
return () => {
|
|
1836
3337
|
isMountedRef.current = false;
|
|
@@ -1841,7 +3342,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1841
3342
|
}
|
|
1842
3343
|
};
|
|
1843
3344
|
}, []);
|
|
1844
|
-
const debouncedSave =
|
|
3345
|
+
const debouncedSave = React24.useCallback(() => {
|
|
1845
3346
|
if (!persistKey) return;
|
|
1846
3347
|
if (saveTimeoutRef.current) {
|
|
1847
3348
|
clearTimeout(saveTimeoutRef.current);
|
|
@@ -1870,11 +3371,11 @@ var DataPanel = React14.forwardRef(
|
|
|
1870
3371
|
pinnedSize,
|
|
1871
3372
|
tabOffset
|
|
1872
3373
|
]);
|
|
1873
|
-
|
|
3374
|
+
React24.useEffect(() => {
|
|
1874
3375
|
debouncedSave();
|
|
1875
3376
|
}, [debouncedSave]);
|
|
1876
|
-
const hasLoadedRef =
|
|
1877
|
-
|
|
3377
|
+
const hasLoadedRef = React24.useRef(false);
|
|
3378
|
+
React24.useEffect(() => {
|
|
1878
3379
|
if (!persistKey || hasLoadedRef.current) return;
|
|
1879
3380
|
hasLoadedRef.current = true;
|
|
1880
3381
|
const persisted = (0, import_data_panel_core.loadPanelState)(persistKey);
|
|
@@ -1891,7 +3392,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1891
3392
|
if (persisted.tabOffset !== void 0) setTabOffset(persisted.tabOffset);
|
|
1892
3393
|
}
|
|
1893
3394
|
}, [persistKey, controlledMode, controlledVariant, controlledEdge, controlledExpanded]);
|
|
1894
|
-
|
|
3395
|
+
React24.useEffect(() => {
|
|
1895
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) {
|
|
1896
3397
|
setDetachedPosition(
|
|
1897
3398
|
(0, import_data_panel_core.getInitialDetachedPosition)(detachedSize, layoutViewportWidth(), window.innerHeight)
|
|
@@ -1920,7 +3421,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1920
3421
|
ref.current = node;
|
|
1921
3422
|
}
|
|
1922
3423
|
};
|
|
1923
|
-
const handleModeChange =
|
|
3424
|
+
const handleModeChange = React24.useCallback(
|
|
1924
3425
|
(newMode) => {
|
|
1925
3426
|
if (controlledMode === void 0) {
|
|
1926
3427
|
setInternalMode(newMode);
|
|
@@ -1929,7 +3430,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1929
3430
|
},
|
|
1930
3431
|
[controlledMode, onModeChange]
|
|
1931
3432
|
);
|
|
1932
|
-
const handleEdgeChange =
|
|
3433
|
+
const handleEdgeChange = React24.useCallback(
|
|
1933
3434
|
(newEdge) => {
|
|
1934
3435
|
if (controlledEdge === void 0) {
|
|
1935
3436
|
setInternalEdge(newEdge);
|
|
@@ -1938,7 +3439,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1938
3439
|
},
|
|
1939
3440
|
[controlledEdge, onEdgeChange]
|
|
1940
3441
|
);
|
|
1941
|
-
const handleExpandedChange =
|
|
3442
|
+
const handleExpandedChange = React24.useCallback(
|
|
1942
3443
|
(newExpanded) => {
|
|
1943
3444
|
if (controlledExpanded === void 0) {
|
|
1944
3445
|
setInternalExpanded(newExpanded);
|
|
@@ -1972,7 +3473,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1972
3473
|
document.body.style.userSelect = "none";
|
|
1973
3474
|
}
|
|
1974
3475
|
};
|
|
1975
|
-
const handleDragMove =
|
|
3476
|
+
const handleDragMove = React24.useCallback(
|
|
1976
3477
|
(e) => {
|
|
1977
3478
|
if (!isDragging) return;
|
|
1978
3479
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -1999,7 +3500,7 @@ var DataPanel = React14.forwardRef(
|
|
|
1999
3500
|
},
|
|
2000
3501
|
[isDragging, detachedSize, snapThreshold]
|
|
2001
3502
|
);
|
|
2002
|
-
const handleDragEnd =
|
|
3503
|
+
const handleDragEnd = React24.useCallback(() => {
|
|
2003
3504
|
if (!isDragging) return;
|
|
2004
3505
|
setIsDragging(false);
|
|
2005
3506
|
document.body.style.cursor = "";
|
|
@@ -2010,7 +3511,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2010
3511
|
setSnapPreview(null);
|
|
2011
3512
|
}
|
|
2012
3513
|
}, [isDragging, snapPreview, handleModeChange, handleEdgeChange]);
|
|
2013
|
-
const handlePinnedDragMove =
|
|
3514
|
+
const handlePinnedDragMove = React24.useCallback(
|
|
2014
3515
|
(e) => {
|
|
2015
3516
|
if (!isPinnedDragging) return;
|
|
2016
3517
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2046,7 +3547,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2046
3547
|
},
|
|
2047
3548
|
[isPinnedDragging, edge, detachThreshold, pinnedSize, detachedSize, handleModeChange]
|
|
2048
3549
|
);
|
|
2049
|
-
const handlePinnedDragEnd =
|
|
3550
|
+
const handlePinnedDragEnd = React24.useCallback(() => {
|
|
2050
3551
|
if (!isPinnedDragging) return;
|
|
2051
3552
|
setIsPinnedDragging(false);
|
|
2052
3553
|
setPullOffset(0);
|
|
@@ -2068,7 +3569,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2068
3569
|
document.body.style.cursor = (0, import_data_panel_core.getResizeCursor)(handle);
|
|
2069
3570
|
document.body.style.userSelect = "none";
|
|
2070
3571
|
};
|
|
2071
|
-
const handleResizeMove =
|
|
3572
|
+
const handleResizeMove = React24.useCallback(
|
|
2072
3573
|
(e) => {
|
|
2073
3574
|
if (!isResizing || !resizeStateRef.current.handle) return;
|
|
2074
3575
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2109,7 +3610,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2109
3610
|
},
|
|
2110
3611
|
[isResizing, mode, edge, resolvedConstraints]
|
|
2111
3612
|
);
|
|
2112
|
-
const handleResizeEnd =
|
|
3613
|
+
const handleResizeEnd = React24.useCallback(() => {
|
|
2113
3614
|
if (!isResizing) return;
|
|
2114
3615
|
setIsResizing(false);
|
|
2115
3616
|
resizeStateRef.current.handle = null;
|
|
@@ -2141,7 +3642,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2141
3642
|
}
|
|
2142
3643
|
document.body.style.userSelect = "none";
|
|
2143
3644
|
};
|
|
2144
|
-
const handleCardPointerMove =
|
|
3645
|
+
const handleCardPointerMove = React24.useCallback(
|
|
2145
3646
|
(e) => {
|
|
2146
3647
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
2147
3648
|
if (isCardVerticalDragging) {
|
|
@@ -2181,7 +3682,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2181
3682
|
resolvedCardConfig.maxWidth
|
|
2182
3683
|
]
|
|
2183
3684
|
);
|
|
2184
|
-
const handleCardPointerUp =
|
|
3685
|
+
const handleCardPointerUp = React24.useCallback(
|
|
2185
3686
|
(e) => {
|
|
2186
3687
|
const endTime = Date.now();
|
|
2187
3688
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2238,7 +3739,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2238
3739
|
document.body.style.cursor = "ns-resize";
|
|
2239
3740
|
document.body.style.userSelect = "none";
|
|
2240
3741
|
};
|
|
2241
|
-
const handleCardResizeMove =
|
|
3742
|
+
const handleCardResizeMove = React24.useCallback(
|
|
2242
3743
|
(e) => {
|
|
2243
3744
|
if (!isCardTopResizing) return;
|
|
2244
3745
|
const currentPos = (0, import_data_panel_core.getPointerPosition)(e);
|
|
@@ -2251,7 +3752,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2251
3752
|
},
|
|
2252
3753
|
[isCardTopResizing, viewportHeight]
|
|
2253
3754
|
);
|
|
2254
|
-
const handleCardResizeEnd =
|
|
3755
|
+
const handleCardResizeEnd = React24.useCallback(() => {
|
|
2255
3756
|
if (!isCardTopResizing) return;
|
|
2256
3757
|
setIsCardTopResizing(false);
|
|
2257
3758
|
document.body.style.cursor = "";
|
|
@@ -2282,7 +3783,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2282
3783
|
document.body.style.cursor = "ew-resize";
|
|
2283
3784
|
document.body.style.userSelect = "none";
|
|
2284
3785
|
};
|
|
2285
|
-
const handleCardWidthResizeMove =
|
|
3786
|
+
const handleCardWidthResizeMove = React24.useCallback(
|
|
2286
3787
|
(e) => {
|
|
2287
3788
|
const st = cardWidthResizeStateRef.current;
|
|
2288
3789
|
if (!isCardWidthResizing || !st.handle) return;
|
|
@@ -2322,7 +3823,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2322
3823
|
resolvedCardConfig.maxWidth
|
|
2323
3824
|
]
|
|
2324
3825
|
);
|
|
2325
|
-
const handleCardWidthResizeEnd =
|
|
3826
|
+
const handleCardWidthResizeEnd = React24.useCallback(() => {
|
|
2326
3827
|
if (!isCardWidthResizing) return;
|
|
2327
3828
|
setIsCardWidthResizing(false);
|
|
2328
3829
|
cardWidthResizeStateRef.current.handle = null;
|
|
@@ -2370,7 +3871,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2370
3871
|
if (kind === "width-left") setCardHorizontalPosition((p) => p - appliedDelta);
|
|
2371
3872
|
debouncedSave();
|
|
2372
3873
|
};
|
|
2373
|
-
|
|
3874
|
+
React24.useEffect(() => {
|
|
2374
3875
|
if (isDragging) {
|
|
2375
3876
|
window.addEventListener("pointermove", handleDragMove);
|
|
2376
3877
|
window.addEventListener("pointerup", handleDragEnd);
|
|
@@ -2382,7 +3883,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2382
3883
|
};
|
|
2383
3884
|
}
|
|
2384
3885
|
}, [isDragging, handleDragMove, handleDragEnd]);
|
|
2385
|
-
|
|
3886
|
+
React24.useEffect(() => {
|
|
2386
3887
|
if (isPinnedDragging) {
|
|
2387
3888
|
window.addEventListener("pointermove", handlePinnedDragMove);
|
|
2388
3889
|
window.addEventListener("pointerup", handlePinnedDragEnd);
|
|
@@ -2394,7 +3895,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2394
3895
|
};
|
|
2395
3896
|
}
|
|
2396
3897
|
}, [isPinnedDragging, handlePinnedDragMove, handlePinnedDragEnd]);
|
|
2397
|
-
|
|
3898
|
+
React24.useEffect(() => {
|
|
2398
3899
|
if (isResizing) {
|
|
2399
3900
|
window.addEventListener("pointermove", handleResizeMove);
|
|
2400
3901
|
window.addEventListener("pointerup", handleResizeEnd);
|
|
@@ -2406,7 +3907,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2406
3907
|
};
|
|
2407
3908
|
}
|
|
2408
3909
|
}, [isResizing, handleResizeMove, handleResizeEnd]);
|
|
2409
|
-
|
|
3910
|
+
React24.useEffect(() => {
|
|
2410
3911
|
if (isCardVerticalDragging || isCardHorizontalDragging) {
|
|
2411
3912
|
window.addEventListener("pointermove", handleCardPointerMove);
|
|
2412
3913
|
window.addEventListener("pointerup", handleCardPointerUp);
|
|
@@ -2423,7 +3924,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2423
3924
|
handleCardPointerMove,
|
|
2424
3925
|
handleCardPointerUp
|
|
2425
3926
|
]);
|
|
2426
|
-
|
|
3927
|
+
React24.useEffect(() => {
|
|
2427
3928
|
if (isCardTopResizing) {
|
|
2428
3929
|
window.addEventListener("pointermove", handleCardResizeMove);
|
|
2429
3930
|
window.addEventListener("pointerup", handleCardResizeEnd);
|
|
@@ -2435,7 +3936,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2435
3936
|
};
|
|
2436
3937
|
}
|
|
2437
3938
|
}, [isCardTopResizing, handleCardResizeMove, handleCardResizeEnd]);
|
|
2438
|
-
|
|
3939
|
+
React24.useEffect(() => {
|
|
2439
3940
|
if (isCardWidthResizing) {
|
|
2440
3941
|
window.addEventListener("pointermove", handleCardWidthResizeMove);
|
|
2441
3942
|
window.addEventListener("pointerup", handleCardWidthResizeEnd);
|
|
@@ -2447,7 +3948,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2447
3948
|
};
|
|
2448
3949
|
}
|
|
2449
3950
|
}, [isCardWidthResizing, handleCardWidthResizeMove, handleCardWidthResizeEnd]);
|
|
2450
|
-
|
|
3951
|
+
React24.useEffect(() => {
|
|
2451
3952
|
const onResize = () => {
|
|
2452
3953
|
setViewportWidth(layoutViewportWidth());
|
|
2453
3954
|
setViewportHeight(window.innerHeight);
|
|
@@ -2457,19 +3958,19 @@ var DataPanel = React14.forwardRef(
|
|
|
2457
3958
|
window.addEventListener("resize", onResize);
|
|
2458
3959
|
return () => window.removeEventListener("resize", onResize);
|
|
2459
3960
|
}, []);
|
|
2460
|
-
|
|
3961
|
+
React24.useEffect(() => {
|
|
2461
3962
|
if (isMobile && variant === "card") {
|
|
2462
3963
|
setCardHorizontalPosition(0);
|
|
2463
3964
|
setCardWidth(null);
|
|
2464
3965
|
}
|
|
2465
3966
|
}, [isMobile, variant]);
|
|
2466
|
-
|
|
3967
|
+
React24.useEffect(() => {
|
|
2467
3968
|
if (isCardHeightTransitioning) {
|
|
2468
3969
|
const t = setTimeout(() => setIsCardHeightTransitioning(false), 350);
|
|
2469
3970
|
return () => clearTimeout(t);
|
|
2470
3971
|
}
|
|
2471
3972
|
}, [isCardHeightTransitioning]);
|
|
2472
|
-
const panelStyles =
|
|
3973
|
+
const panelStyles = React24.useMemo(() => {
|
|
2473
3974
|
if (variant === "card") {
|
|
2474
3975
|
const defaultCardWidth = Math.min(
|
|
2475
3976
|
viewportWidth - resolvedCardConfig.horizontalMargin * 2,
|
|
@@ -2534,7 +4035,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2534
4035
|
}[edge] : "animate-scale-in";
|
|
2535
4036
|
if (!open) return null;
|
|
2536
4037
|
if (variant === "full" && !isExpanded && mode === "pinned") {
|
|
2537
|
-
return /* @__PURE__ */ (0,
|
|
4038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2538
4039
|
DataPanelTab,
|
|
2539
4040
|
{
|
|
2540
4041
|
title,
|
|
@@ -2550,8 +4051,8 @@ var DataPanel = React14.forwardRef(
|
|
|
2550
4051
|
}
|
|
2551
4052
|
);
|
|
2552
4053
|
}
|
|
2553
|
-
return /* @__PURE__ */ (0,
|
|
2554
|
-
snapPreview && /* @__PURE__ */ (0,
|
|
4054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
4055
|
+
snapPreview && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2555
4056
|
"div",
|
|
2556
4057
|
{
|
|
2557
4058
|
className: cn(
|
|
@@ -2563,7 +4064,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2563
4064
|
)
|
|
2564
4065
|
}
|
|
2565
4066
|
),
|
|
2566
|
-
variant === "card" && isExpanded && isMobile && /* @__PURE__ */ (0,
|
|
4067
|
+
variant === "card" && isExpanded && isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2567
4068
|
"div",
|
|
2568
4069
|
{
|
|
2569
4070
|
className: "fixed inset-0 z-40 bg-black/50 transition-opacity",
|
|
@@ -2571,7 +4072,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2571
4072
|
onClick: handleToggleExpand
|
|
2572
4073
|
}
|
|
2573
4074
|
),
|
|
2574
|
-
/* @__PURE__ */ (0,
|
|
4075
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2575
4076
|
"div",
|
|
2576
4077
|
{
|
|
2577
4078
|
ref: setPanelRef,
|
|
@@ -2593,7 +4094,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2593
4094
|
"aria-expanded": variant === "card" ? isExpanded : void 0,
|
|
2594
4095
|
onPointerDown: variant === "full" ? handleDragStart : void 0,
|
|
2595
4096
|
children: [
|
|
2596
|
-
variant === "card" ? /* @__PURE__ */ (0,
|
|
4097
|
+
variant === "card" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2597
4098
|
DataPanelCardHeader,
|
|
2598
4099
|
{
|
|
2599
4100
|
title,
|
|
@@ -2609,7 +4110,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2609
4110
|
onToggleExpand: handleToggleExpand,
|
|
2610
4111
|
onClose: () => handleOpenChange(false)
|
|
2611
4112
|
}
|
|
2612
|
-
) : /* @__PURE__ */ (0,
|
|
4113
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2613
4114
|
DataPanelHeader,
|
|
2614
4115
|
{
|
|
2615
4116
|
title,
|
|
@@ -2629,9 +4130,9 @@ var DataPanel = React14.forwardRef(
|
|
|
2629
4130
|
draggable: !disableDrag && (mode === "detached" || mode === "pinned" && detachThreshold > 0)
|
|
2630
4131
|
}
|
|
2631
4132
|
),
|
|
2632
|
-
showContent && /* @__PURE__ */ (0,
|
|
2633
|
-
/* @__PURE__ */ (0,
|
|
2634
|
-
/* @__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)(
|
|
2635
4136
|
DataPanelFooter,
|
|
2636
4137
|
{
|
|
2637
4138
|
actions,
|
|
@@ -2640,7 +4141,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2640
4141
|
}
|
|
2641
4142
|
)
|
|
2642
4143
|
] }),
|
|
2643
|
-
variant === "full" && !disableResize && /* @__PURE__ */ (0,
|
|
4144
|
+
variant === "full" && !disableResize && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2644
4145
|
ResizeHandles,
|
|
2645
4146
|
{
|
|
2646
4147
|
mode,
|
|
@@ -2671,8 +4172,8 @@ var DataPanel = React14.forwardRef(
|
|
|
2671
4172
|
constraints: resolvedConstraints
|
|
2672
4173
|
}
|
|
2673
4174
|
),
|
|
2674
|
-
variant === "card" && isExpanded && !disableResize && !isMobile && /* @__PURE__ */ (0,
|
|
2675
|
-
/* @__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)(
|
|
2676
4177
|
"div",
|
|
2677
4178
|
{
|
|
2678
4179
|
className: "resize-handle resize-handle--horizontal resize-handle--top",
|
|
@@ -2688,7 +4189,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2688
4189
|
onKeyDown: (e) => handleCardResizeKeyDown(e, "height")
|
|
2689
4190
|
}
|
|
2690
4191
|
),
|
|
2691
|
-
/* @__PURE__ */ (0,
|
|
4192
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2692
4193
|
"div",
|
|
2693
4194
|
{
|
|
2694
4195
|
className: "resize-handle resize-handle--vertical resize-handle--left resize-handle--card-edge",
|
|
@@ -2704,7 +4205,7 @@ var DataPanel = React14.forwardRef(
|
|
|
2704
4205
|
onKeyDown: (e) => handleCardResizeKeyDown(e, "width-left")
|
|
2705
4206
|
}
|
|
2706
4207
|
),
|
|
2707
|
-
/* @__PURE__ */ (0,
|
|
4208
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2708
4209
|
"div",
|
|
2709
4210
|
{
|
|
2710
4211
|
className: "resize-handle resize-handle--vertical resize-handle--right resize-handle--card-edge",
|
|
@@ -2730,10 +4231,10 @@ var DataPanel = React14.forwardRef(
|
|
|
2730
4231
|
DataPanel.displayName = "DataPanel";
|
|
2731
4232
|
|
|
2732
4233
|
// src/components/Skeleton.tsx
|
|
2733
|
-
var
|
|
2734
|
-
var
|
|
2735
|
-
var
|
|
2736
|
-
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", {
|
|
2737
4238
|
variants: {
|
|
2738
4239
|
variant: {
|
|
2739
4240
|
default: "",
|
|
@@ -2748,10 +4249,10 @@ var skeletonVariants = (0, import_class_variance_authority5.cva)("rounded-md bg-
|
|
|
2748
4249
|
variant: "default"
|
|
2749
4250
|
}
|
|
2750
4251
|
});
|
|
2751
|
-
var Skeleton =
|
|
4252
|
+
var Skeleton = React25.forwardRef(
|
|
2752
4253
|
({ className, variant, animation = "pulse", ...props }, ref) => {
|
|
2753
4254
|
const animationClass = animation === "pulse" ? "animate-pulse" : animation === "shimmer" ? "animate-shimmer" : "";
|
|
2754
|
-
return /* @__PURE__ */ (0,
|
|
4255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2755
4256
|
"div",
|
|
2756
4257
|
{
|
|
2757
4258
|
ref,
|
|
@@ -2764,10 +4265,10 @@ var Skeleton = React15.forwardRef(
|
|
|
2764
4265
|
Skeleton.displayName = "Skeleton";
|
|
2765
4266
|
|
|
2766
4267
|
// src/components/Spinner.tsx
|
|
2767
|
-
var
|
|
2768
|
-
var
|
|
2769
|
-
var
|
|
2770
|
-
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", {
|
|
2771
4272
|
variants: {
|
|
2772
4273
|
size: {
|
|
2773
4274
|
sm: "h-4 w-4",
|
|
@@ -2780,9 +4281,9 @@ var spinnerVariants = (0, import_class_variance_authority6.cva)("animate-spin te
|
|
|
2780
4281
|
size: "md"
|
|
2781
4282
|
}
|
|
2782
4283
|
});
|
|
2783
|
-
var Spinner =
|
|
4284
|
+
var Spinner = React26.forwardRef(
|
|
2784
4285
|
({ className, size, label = "Loading...", ...props }, ref) => {
|
|
2785
|
-
return /* @__PURE__ */ (0,
|
|
4286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2786
4287
|
"svg",
|
|
2787
4288
|
{
|
|
2788
4289
|
ref,
|
|
@@ -2794,7 +4295,7 @@ var Spinner = React16.forwardRef(
|
|
|
2794
4295
|
role: "status",
|
|
2795
4296
|
...props,
|
|
2796
4297
|
children: [
|
|
2797
|
-
/* @__PURE__ */ (0,
|
|
4298
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2798
4299
|
"circle",
|
|
2799
4300
|
{
|
|
2800
4301
|
className: "opacity-25",
|
|
@@ -2805,7 +4306,7 @@ var Spinner = React16.forwardRef(
|
|
|
2805
4306
|
strokeWidth: "4"
|
|
2806
4307
|
}
|
|
2807
4308
|
),
|
|
2808
|
-
/* @__PURE__ */ (0,
|
|
4309
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2809
4310
|
"path",
|
|
2810
4311
|
{
|
|
2811
4312
|
className: "opacity-75",
|
|
@@ -2813,7 +4314,7 @@ var Spinner = React16.forwardRef(
|
|
|
2813
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"
|
|
2814
4315
|
}
|
|
2815
4316
|
),
|
|
2816
|
-
/* @__PURE__ */ (0,
|
|
4317
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("title", { children: label })
|
|
2817
4318
|
]
|
|
2818
4319
|
}
|
|
2819
4320
|
);
|
|
@@ -2822,8 +4323,8 @@ var Spinner = React16.forwardRef(
|
|
|
2822
4323
|
Spinner.displayName = "Spinner";
|
|
2823
4324
|
|
|
2824
4325
|
// src/components/LoadingLogo.tsx
|
|
2825
|
-
var
|
|
2826
|
-
var
|
|
4326
|
+
var React27 = __toESM(require("react"));
|
|
4327
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2827
4328
|
var logoPaths = [
|
|
2828
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",
|
|
2829
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",
|
|
@@ -2845,12 +4346,12 @@ var colors = {
|
|
|
2845
4346
|
stroke: "#ffffff"
|
|
2846
4347
|
}
|
|
2847
4348
|
};
|
|
2848
|
-
var LoadingLogo =
|
|
4349
|
+
var LoadingLogo = React27.forwardRef(
|
|
2849
4350
|
({ width = 40, height = 40, loading = false, variant = "dark", className, ...props }, ref) => {
|
|
2850
4351
|
const currentColors = colors[variant];
|
|
2851
4352
|
const fillColor = loading ? currentColors.fillLoading : currentColors.fill;
|
|
2852
4353
|
const strokeColor = currentColors.stroke;
|
|
2853
|
-
return /* @__PURE__ */ (0,
|
|
4354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2854
4355
|
"div",
|
|
2855
4356
|
{
|
|
2856
4357
|
ref,
|
|
@@ -2860,7 +4361,7 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2860
4361
|
"aria-label": loading ? "Loading" : "Classic Homes",
|
|
2861
4362
|
...props,
|
|
2862
4363
|
children: [
|
|
2863
|
-
/* @__PURE__ */ (0,
|
|
4364
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2864
4365
|
"svg",
|
|
2865
4366
|
{
|
|
2866
4367
|
width: "100%",
|
|
@@ -2870,8 +4371,8 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2870
4371
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2871
4372
|
"aria-hidden": "true",
|
|
2872
4373
|
children: [
|
|
2873
|
-
/* @__PURE__ */ (0,
|
|
2874
|
-
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)(
|
|
2875
4376
|
"g",
|
|
2876
4377
|
{
|
|
2877
4378
|
fill: "none",
|
|
@@ -2879,13 +4380,13 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2879
4380
|
strokeWidth: "0.5",
|
|
2880
4381
|
strokeDasharray: "10 4",
|
|
2881
4382
|
className: "animate-trace",
|
|
2882
|
-
children: logoPaths.map((path, i) => /* @__PURE__ */ (0,
|
|
4383
|
+
children: logoPaths.map((path, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: path }, i))
|
|
2883
4384
|
}
|
|
2884
4385
|
)
|
|
2885
4386
|
]
|
|
2886
4387
|
}
|
|
2887
4388
|
),
|
|
2888
|
-
loading && /* @__PURE__ */ (0,
|
|
4389
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "sr-only", children: "Loading" })
|
|
2889
4390
|
]
|
|
2890
4391
|
}
|
|
2891
4392
|
);
|
|
@@ -2894,10 +4395,10 @@ var LoadingLogo = React17.forwardRef(
|
|
|
2894
4395
|
LoadingLogo.displayName = "LoadingLogo";
|
|
2895
4396
|
|
|
2896
4397
|
// src/components/ProgressBar.tsx
|
|
2897
|
-
var
|
|
2898
|
-
var
|
|
2899
|
-
var
|
|
2900
|
-
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", {
|
|
2901
4402
|
variants: {
|
|
2902
4403
|
size: {
|
|
2903
4404
|
sm: "h-1",
|
|
@@ -2909,7 +4410,7 @@ var progressBarVariants = (0, import_class_variance_authority7.cva)("w-full over
|
|
|
2909
4410
|
size: "md"
|
|
2910
4411
|
}
|
|
2911
4412
|
});
|
|
2912
|
-
var progressFillVariants = (0,
|
|
4413
|
+
var progressFillVariants = (0, import_class_variance_authority8.cva)("h-full rounded-full transition-all duration-300", {
|
|
2913
4414
|
variants: {
|
|
2914
4415
|
variant: {
|
|
2915
4416
|
default: "bg-primary",
|
|
@@ -2922,12 +4423,12 @@ var progressFillVariants = (0, import_class_variance_authority7.cva)("h-full rou
|
|
|
2922
4423
|
variant: "default"
|
|
2923
4424
|
}
|
|
2924
4425
|
});
|
|
2925
|
-
var ProgressBar =
|
|
4426
|
+
var ProgressBar = React28.forwardRef(
|
|
2926
4427
|
({ className, size, variant, value, max = 100, label = "Progress", showValue = false, ...props }, ref) => {
|
|
2927
4428
|
const isIndeterminate = value === void 0;
|
|
2928
4429
|
const clampedValue = isIndeterminate ? 0 : Math.min(Math.max(0, value), max);
|
|
2929
4430
|
const percentage = isIndeterminate ? 0 : Math.round(clampedValue / max * 100);
|
|
2930
|
-
return /* @__PURE__ */ (0,
|
|
4431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2931
4432
|
"div",
|
|
2932
4433
|
{
|
|
2933
4434
|
ref,
|
|
@@ -2939,7 +4440,7 @@ var ProgressBar = React18.forwardRef(
|
|
|
2939
4440
|
className: cn("flex items-center gap-2", className),
|
|
2940
4441
|
...props,
|
|
2941
4442
|
children: [
|
|
2942
|
-
/* @__PURE__ */ (0,
|
|
4443
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(progressBarVariants({ size })), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2943
4444
|
"div",
|
|
2944
4445
|
{
|
|
2945
4446
|
className: cn(
|
|
@@ -2949,7 +4450,7 @@ var ProgressBar = React18.forwardRef(
|
|
|
2949
4450
|
style: isIndeterminate ? void 0 : { width: `${percentage}%` }
|
|
2950
4451
|
}
|
|
2951
4452
|
) }),
|
|
2952
|
-
showValue && !isIndeterminate && /* @__PURE__ */ (0,
|
|
4453
|
+
showValue && !isIndeterminate && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "text-sm tabular-nums text-muted-foreground", children: [
|
|
2953
4454
|
percentage,
|
|
2954
4455
|
"%"
|
|
2955
4456
|
] })
|
|
@@ -2961,11 +4462,11 @@ var ProgressBar = React18.forwardRef(
|
|
|
2961
4462
|
ProgressBar.displayName = "ProgressBar";
|
|
2962
4463
|
|
|
2963
4464
|
// src/components/LoadingOverlay.tsx
|
|
2964
|
-
var
|
|
2965
|
-
var
|
|
4465
|
+
var React29 = __toESM(require("react"));
|
|
4466
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2966
4467
|
var spinnerSizeMap = { sm: "sm", md: "md", lg: "lg", xl: "xl" };
|
|
2967
4468
|
var logoSizeMap = { sm: 32, md: 40, lg: 56, xl: 80 };
|
|
2968
|
-
var LoadingOverlay =
|
|
4469
|
+
var LoadingOverlay = React29.forwardRef(
|
|
2969
4470
|
({
|
|
2970
4471
|
loading = true,
|
|
2971
4472
|
variant = "spinner",
|
|
@@ -2980,8 +4481,8 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
2980
4481
|
children,
|
|
2981
4482
|
...props
|
|
2982
4483
|
}, ref) => {
|
|
2983
|
-
const [visible, setVisible] =
|
|
2984
|
-
|
|
4484
|
+
const [visible, setVisible] = React29.useState(delay === 0 && loading);
|
|
4485
|
+
React29.useEffect(() => {
|
|
2985
4486
|
if (!loading) {
|
|
2986
4487
|
setVisible(false);
|
|
2987
4488
|
return;
|
|
@@ -2994,23 +4495,23 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
2994
4495
|
return () => clearTimeout(timer);
|
|
2995
4496
|
}, [loading, delay]);
|
|
2996
4497
|
if (!visible) {
|
|
2997
|
-
return mode === "inline" ? null : /* @__PURE__ */ (0,
|
|
4498
|
+
return mode === "inline" ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children });
|
|
2998
4499
|
}
|
|
2999
|
-
const indicator = /* @__PURE__ */ (0,
|
|
3000
|
-
variant === "spinner" && /* @__PURE__ */ (0,
|
|
3001
|
-
variant === "logo" && /* @__PURE__ */ (0,
|
|
3002
|
-
variant === "progress" && /* @__PURE__ */ (0,
|
|
3003
|
-
variant === "skeleton" && /* @__PURE__ */ (0,
|
|
3004
|
-
/* @__PURE__ */ (0,
|
|
3005
|
-
/* @__PURE__ */ (0,
|
|
3006
|
-
/* @__PURE__ */ (0,
|
|
3007
|
-
/* @__PURE__ */ (0,
|
|
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" })
|
|
3008
4509
|
] }),
|
|
3009
|
-
message && /* @__PURE__ */ (0,
|
|
3010
|
-
!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" })
|
|
3011
4512
|
] });
|
|
3012
4513
|
if (mode === "inline") {
|
|
3013
|
-
return /* @__PURE__ */ (0,
|
|
4514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3014
4515
|
"div",
|
|
3015
4516
|
{
|
|
3016
4517
|
ref,
|
|
@@ -3024,9 +4525,9 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
3024
4525
|
}
|
|
3025
4526
|
const bgClass = opaque ? "bg-background" : mode === "fullscreen" ? "bg-background/80" : "bg-background/60";
|
|
3026
4527
|
const positionClass = mode === "fullscreen" ? "fixed inset-0 z-50" : "absolute inset-0 z-10";
|
|
3027
|
-
return /* @__PURE__ */ (0,
|
|
4528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3028
4529
|
children,
|
|
3029
|
-
/* @__PURE__ */ (0,
|
|
4530
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
3030
4531
|
"div",
|
|
3031
4532
|
{
|
|
3032
4533
|
ref,
|
|
@@ -3049,9 +4550,9 @@ var LoadingOverlay = React19.forwardRef(
|
|
|
3049
4550
|
LoadingOverlay.displayName = "LoadingOverlay";
|
|
3050
4551
|
|
|
3051
4552
|
// src/components/LoadingPage.tsx
|
|
3052
|
-
var
|
|
3053
|
-
var
|
|
3054
|
-
var LoadingPage =
|
|
4553
|
+
var React30 = __toESM(require("react"));
|
|
4554
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4555
|
+
var LoadingPage = React30.forwardRef(
|
|
3055
4556
|
({
|
|
3056
4557
|
loading = true,
|
|
3057
4558
|
message,
|
|
@@ -3062,8 +4563,8 @@ var LoadingPage = React20.forwardRef(
|
|
|
3062
4563
|
className,
|
|
3063
4564
|
...props
|
|
3064
4565
|
}, ref) => {
|
|
3065
|
-
const [visible, setVisible] =
|
|
3066
|
-
|
|
4566
|
+
const [visible, setVisible] = React30.useState(delay === 0 && loading);
|
|
4567
|
+
React30.useEffect(() => {
|
|
3067
4568
|
if (!loading) {
|
|
3068
4569
|
setVisible(false);
|
|
3069
4570
|
return;
|
|
@@ -3076,7 +4577,7 @@ var LoadingPage = React20.forwardRef(
|
|
|
3076
4577
|
return () => clearTimeout(timer);
|
|
3077
4578
|
}, [loading, delay]);
|
|
3078
4579
|
if (!visible) return null;
|
|
3079
|
-
return /* @__PURE__ */ (0,
|
|
4580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3080
4581
|
"div",
|
|
3081
4582
|
{
|
|
3082
4583
|
ref,
|
|
@@ -3088,10 +4589,10 @@ var LoadingPage = React20.forwardRef(
|
|
|
3088
4589
|
),
|
|
3089
4590
|
...props,
|
|
3090
4591
|
children: [
|
|
3091
|
-
showLogo ? /* @__PURE__ */ (0,
|
|
3092
|
-
progress !== void 0 && /* @__PURE__ */ (0,
|
|
3093
|
-
message && /* @__PURE__ */ (0,
|
|
3094
|
-
/* @__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: [
|
|
3095
4596
|
message || "Loading",
|
|
3096
4597
|
progress !== void 0 && `, ${Math.round(progress)}% complete`
|
|
3097
4598
|
] })
|
|
@@ -3103,9 +4604,9 @@ var LoadingPage = React20.forwardRef(
|
|
|
3103
4604
|
LoadingPage.displayName = "LoadingPage";
|
|
3104
4605
|
|
|
3105
4606
|
// src/components/LoadingSection.tsx
|
|
3106
|
-
var
|
|
3107
|
-
var
|
|
3108
|
-
var LoadingSection =
|
|
4607
|
+
var React31 = __toESM(require("react"));
|
|
4608
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4609
|
+
var LoadingSection = React31.forwardRef(
|
|
3109
4610
|
({
|
|
3110
4611
|
loading = false,
|
|
3111
4612
|
variant = "spinner",
|
|
@@ -3118,7 +4619,7 @@ var LoadingSection = React21.forwardRef(
|
|
|
3118
4619
|
children,
|
|
3119
4620
|
...props
|
|
3120
4621
|
}, ref) => {
|
|
3121
|
-
return /* @__PURE__ */ (0,
|
|
4622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3122
4623
|
"div",
|
|
3123
4624
|
{
|
|
3124
4625
|
ref,
|
|
@@ -3128,7 +4629,7 @@ var LoadingSection = React21.forwardRef(
|
|
|
3128
4629
|
...props,
|
|
3129
4630
|
children: [
|
|
3130
4631
|
children,
|
|
3131
|
-
loading && /* @__PURE__ */ (0,
|
|
4632
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3132
4633
|
LoadingOverlay,
|
|
3133
4634
|
{
|
|
3134
4635
|
mode: "overlay",
|
|
@@ -3147,11 +4648,11 @@ var LoadingSection = React21.forwardRef(
|
|
|
3147
4648
|
LoadingSection.displayName = "LoadingSection";
|
|
3148
4649
|
|
|
3149
4650
|
// src/components/LiveRegion.tsx
|
|
3150
|
-
var
|
|
3151
|
-
var
|
|
3152
|
-
var LiveRegion =
|
|
4651
|
+
var React32 = __toESM(require("react"));
|
|
4652
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4653
|
+
var LiveRegion = React32.forwardRef(
|
|
3153
4654
|
({ message, politeness = "polite", atomic = true, visuallyHidden = true, className, children }, ref) => {
|
|
3154
|
-
return /* @__PURE__ */ (0,
|
|
4655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3155
4656
|
"div",
|
|
3156
4657
|
{
|
|
3157
4658
|
ref,
|
|
@@ -3170,9 +4671,9 @@ var LiveRegion = React22.forwardRef(
|
|
|
3170
4671
|
LiveRegion.displayName = "LiveRegion";
|
|
3171
4672
|
|
|
3172
4673
|
// src/components/SkipLink.tsx
|
|
3173
|
-
var
|
|
3174
|
-
var
|
|
3175
|
-
var SkipLink =
|
|
4674
|
+
var React33 = __toESM(require("react"));
|
|
4675
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4676
|
+
var SkipLink = React33.forwardRef(
|
|
3176
4677
|
({ targetId, className, children = "Skip to main content", ...props }, ref) => {
|
|
3177
4678
|
const handleClick = (e) => {
|
|
3178
4679
|
e.preventDefault();
|
|
@@ -3190,7 +4691,7 @@ var SkipLink = React23.forwardRef(
|
|
|
3190
4691
|
}
|
|
3191
4692
|
props.onClick?.(e);
|
|
3192
4693
|
};
|
|
3193
|
-
return /* @__PURE__ */ (0,
|
|
4694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3194
4695
|
"a",
|
|
3195
4696
|
{
|
|
3196
4697
|
ref,
|
|
@@ -3478,21 +4979,21 @@ function useRovingTabindex(options = {}) {
|
|
|
3478
4979
|
}
|
|
3479
4980
|
|
|
3480
4981
|
// src/hooks/useClickOutside.ts
|
|
3481
|
-
var
|
|
4982
|
+
var React34 = __toESM(require("react"));
|
|
3482
4983
|
function useClickOutside(ref, callback, options) {
|
|
3483
4984
|
const {
|
|
3484
4985
|
enabled = true,
|
|
3485
4986
|
events = ["mousedown", "touchstart"],
|
|
3486
4987
|
ignoreElements = []
|
|
3487
4988
|
} = options ?? {};
|
|
3488
|
-
const callbackRef =
|
|
3489
|
-
const ignoreElementsRef =
|
|
3490
|
-
|
|
4989
|
+
const callbackRef = React34.useRef(callback);
|
|
4990
|
+
const ignoreElementsRef = React34.useRef(ignoreElements);
|
|
4991
|
+
React34.useEffect(() => {
|
|
3491
4992
|
callbackRef.current = callback;
|
|
3492
4993
|
ignoreElementsRef.current = ignoreElements;
|
|
3493
4994
|
}, [callback, ignoreElements]);
|
|
3494
4995
|
const eventsKey = events.join(",");
|
|
3495
|
-
|
|
4996
|
+
React34.useEffect(() => {
|
|
3496
4997
|
if (!enabled) return;
|
|
3497
4998
|
const handleEvent = (event) => {
|
|
3498
4999
|
const target = event.target;
|
|
@@ -3546,6 +5047,8 @@ function useClickOutside(ref, callback, options) {
|
|
|
3546
5047
|
DialogTitle,
|
|
3547
5048
|
DialogTrigger,
|
|
3548
5049
|
Input,
|
|
5050
|
+
InsertPalette,
|
|
5051
|
+
IssuesButton,
|
|
3549
5052
|
Label,
|
|
3550
5053
|
LiveRegion,
|
|
3551
5054
|
LoadingLogo,
|
|
@@ -3555,10 +5058,21 @@ function useClickOutside(ref, callback, options) {
|
|
|
3555
5058
|
PageHeader,
|
|
3556
5059
|
PasswordInput,
|
|
3557
5060
|
ProgressBar,
|
|
5061
|
+
SaveStatus,
|
|
3558
5062
|
Separator,
|
|
5063
|
+
Sheet,
|
|
3559
5064
|
Skeleton,
|
|
3560
5065
|
SkipLink,
|
|
5066
|
+
SortableList,
|
|
3561
5067
|
Spinner,
|
|
5068
|
+
Studio,
|
|
5069
|
+
StudioBar,
|
|
5070
|
+
StudioCanvas,
|
|
5071
|
+
StudioCanvasItem,
|
|
5072
|
+
StudioInspector,
|
|
5073
|
+
StudioInspectorSection,
|
|
5074
|
+
StudioOutline,
|
|
5075
|
+
StudioPage,
|
|
3562
5076
|
Switch,
|
|
3563
5077
|
badgeVariants,
|
|
3564
5078
|
buttonVariants,
|
|
@@ -3578,5 +5092,6 @@ function useClickOutside(ref, callback, options) {
|
|
|
3578
5092
|
useFocusRef,
|
|
3579
5093
|
useFocusTrap,
|
|
3580
5094
|
useReducedMotion,
|
|
3581
|
-
useRovingTabindex
|
|
5095
|
+
useRovingTabindex,
|
|
5096
|
+
useStudio
|
|
3582
5097
|
});
|