@tangle-network/sandbox-ui 0.3.6 → 0.3.10
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/active-sessions-store-CeOmXgv5.d.ts +85 -0
- package/dist/artifact-pane-Bh45Ssco.d.ts +24 -0
- package/dist/{chat-container-C8eHLw8z.d.ts → chat-container-Dn1jWtWo.d.ts} +20 -3
- package/dist/chat.d.ts +17 -4
- package/dist/chat.js +6 -2
- package/dist/{chunk-4F2GJRGU.js → chunk-6H3EFUUC.js} +196 -77
- package/dist/{chunk-WUR652Y3.js → chunk-72UEKFZ2.js} +113 -89
- package/dist/{chunk-TXI4MZAZ.js → chunk-CSIXZEKN.js} +152 -1
- package/dist/{chunk-5LV6DZZF.js → chunk-FOQTE67I.js} +278 -21
- package/dist/chunk-MGCVTFKB.js +10910 -0
- package/dist/chunk-OEX7NZE3.js +321 -0
- package/dist/chunk-Q56BYXQF.js +61 -0
- package/dist/{chunk-QGI5E7JD.js → chunk-RQOX5JRR.js} +541 -76
- package/dist/{chunk-PDV7W4NY.js → chunk-SULQQJPB.js} +1 -56
- package/dist/chunk-W4LM3QYZ.js +54 -0
- package/dist/{chunk-JF6E2DS5.js → chunk-ZYGWTIWO.js} +171 -155
- package/dist/document-editor-pane-Bk-9MQmw.d.ts +116 -0
- package/dist/document-editor-pane-GRIQOJHB.js +11 -0
- package/dist/editor.d.ts +7 -84
- package/dist/editor.js +18 -699
- package/dist/{expanded-tool-detail-BDi_h_dZ.d.ts → expanded-tool-detail-DM5M_T9h.d.ts} +10 -2
- package/dist/{file-tabs-CmaoDVBI.d.ts → file-tabs-BLfxfmAH.d.ts} +1 -22
- package/dist/files.d.ts +25 -3
- package/dist/files.js +2 -1
- package/dist/hooks.d.ts +3 -1
- package/dist/hooks.js +6 -1
- package/dist/index.d.ts +13 -7
- package/dist/index.js +26 -9
- package/dist/pages.js +4 -2
- package/dist/primitives.d.ts +45 -1
- package/dist/primitives.js +9 -3
- package/dist/run.d.ts +1 -1
- package/dist/run.js +1 -1
- package/dist/sdk-hooks.d.ts +32 -1
- package/dist/sdk-hooks.js +6 -1
- package/dist/stores.d.ts +1 -0
- package/dist/stores.js +60 -1
- package/dist/types.d.ts +2 -0
- package/dist/workspace.d.ts +84 -6
- package/dist/workspace.js +10 -4
- package/package.json +17 -6
|
@@ -759,7 +759,8 @@ var InlineToolItem = memo9(
|
|
|
759
759
|
renderToolDetail,
|
|
760
760
|
groupPosition = "single",
|
|
761
761
|
className,
|
|
762
|
-
contentClassName
|
|
762
|
+
contentClassName,
|
|
763
|
+
actions
|
|
763
764
|
}) => {
|
|
764
765
|
const [open, setOpen] = useState3(false);
|
|
765
766
|
const meta = getToolDisplayMetadata(part);
|
|
@@ -780,49 +781,59 @@ var InlineToolItem = memo9(
|
|
|
780
781
|
last: "rounded-t-[var(--radius-sm)] rounded-b-[var(--radius-lg)]"
|
|
781
782
|
}[groupPosition];
|
|
782
783
|
return /* @__PURE__ */ jsxs10(Collapsible.Root, { open, onOpenChange: setOpen, children: [
|
|
783
|
-
/* @__PURE__ */
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
/* @__PURE__ */ jsxs10("div", { className: "
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
|
|
812
|
-
|
|
784
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-start gap-2", children: [
|
|
785
|
+
/* @__PURE__ */ jsx11(Collapsible.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
786
|
+
"button",
|
|
787
|
+
{
|
|
788
|
+
className: cn(
|
|
789
|
+
"w-full border text-left transition-colors",
|
|
790
|
+
"border-[var(--border-subtle)] bg-[var(--bg-card)] hover:border-[var(--border-accent-hover)] hover:bg-[var(--bg-hover)]/35",
|
|
791
|
+
open && "border-[var(--border-accent)] bg-[var(--bg-hover)]/30",
|
|
792
|
+
shapeClass,
|
|
793
|
+
className
|
|
794
|
+
),
|
|
795
|
+
children: [
|
|
796
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3 px-3 py-3", children: [
|
|
797
|
+
/* @__PURE__ */ jsx11(
|
|
798
|
+
"div",
|
|
799
|
+
{
|
|
800
|
+
className: cn(
|
|
801
|
+
"flex h-8 w-8 shrink-0 items-center justify-center rounded-[var(--radius-md)] border",
|
|
802
|
+
isRunning && "border-[var(--border-accent)] bg-[var(--brand-cool)]/12 text-[var(--brand-cool)]",
|
|
803
|
+
isComplete && "border-emerald-500/30 bg-emerald-500/12 text-emerald-200",
|
|
804
|
+
isError && "border-red-500/30 bg-red-500/10 text-red-200",
|
|
805
|
+
!isRunning && !isComplete && !isError && "border-[var(--border-subtle)] bg-[var(--bg-section)] text-[var(--text-muted)]"
|
|
806
|
+
),
|
|
807
|
+
children: isRunning ? /* @__PURE__ */ jsx11(Loader24, { className: "h-4 w-4 animate-spin" }) : isComplete ? /* @__PURE__ */ jsx11(CheckCircle2, { className: "h-4 w-4" }) : isError ? /* @__PURE__ */ jsx11(AlertCircle2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx11(DefaultIcon, { className: "h-4 w-4" })
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
/* @__PURE__ */ jsxs10("div", { className: "min-w-0 flex-1", children: [
|
|
811
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
812
|
+
/* @__PURE__ */ jsx11("span", { className: "truncate text-sm font-medium text-[var(--text-primary)]", children: meta.title }),
|
|
813
|
+
isError ? /* @__PURE__ */ jsx11("span", { className: "rounded-full border border-red-500/30 bg-red-500/10 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-[0.06em] text-red-200", children: "Failed" }) : null,
|
|
814
|
+
isRunning ? /* @__PURE__ */ jsx11("span", { className: "rounded-full border border-[var(--border-accent)] bg-[var(--brand-cool)]/10 px-2 py-0.5 text-[11px] font-semibold uppercase tracking-[0.06em] text-[var(--brand-cool)]", children: "Running" }) : null
|
|
815
|
+
] }),
|
|
816
|
+
meta.description ? /* @__PURE__ */ jsx11("div", { className: "mt-1 truncate text-xs font-[var(--font-mono)] text-[var(--text-muted)]", children: meta.description }) : null
|
|
813
817
|
] }),
|
|
814
|
-
|
|
818
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 items-center gap-2", children: [
|
|
819
|
+
isRunning && startTime ? /* @__PURE__ */ jsx11(LiveDuration, { startTime }) : null,
|
|
820
|
+
!isRunning && durationMs != null ? /* @__PURE__ */ jsx11("span", { className: "rounded-full border border-[var(--border-subtle)] bg-[var(--bg-section)] px-2 py-0.5 text-[11px] font-[var(--font-mono)] text-[var(--text-muted)]", children: formatDuration(durationMs) }) : null,
|
|
821
|
+
open ? /* @__PURE__ */ jsx11(ChevronDown2, { className: "h-3.5 w-3.5 text-[var(--text-muted)]" }) : /* @__PURE__ */ jsx11(ChevronRight2, { className: "h-3.5 w-3.5 text-[var(--text-muted)]" })
|
|
822
|
+
] })
|
|
815
823
|
] }),
|
|
816
|
-
/* @__PURE__ */
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
824
|
+
errorText && !open ? /* @__PURE__ */ jsx11("div", { className: "border-t border-[var(--border-subtle)] px-3 py-2 text-xs text-red-200", children: errorText }) : null
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
) }),
|
|
828
|
+
actions ? /* @__PURE__ */ jsx11(
|
|
829
|
+
"div",
|
|
830
|
+
{
|
|
831
|
+
className: "flex shrink-0 flex-wrap items-center justify-end gap-1.5 pt-1",
|
|
832
|
+
onClick: (event) => event.stopPropagation(),
|
|
833
|
+
children: actions
|
|
834
|
+
}
|
|
835
|
+
) : null
|
|
836
|
+
] }),
|
|
826
837
|
/* @__PURE__ */ jsx11(Collapsible.Content, { className: "overflow-hidden data-[state=open]:animate-slideDown data-[state=closed]:animate-slideUp", children: /* @__PURE__ */ jsx11("div", { className: cn("mt-2 pl-4", contentClassName), children: renderToolDetail?.(part) ?? /* @__PURE__ */ jsx11(ExpandedToolDetail, { part }) }) })
|
|
827
838
|
] });
|
|
828
839
|
}
|
|
@@ -967,14 +978,17 @@ function CategoryBadges({ categories }) {
|
|
|
967
978
|
[categories]
|
|
968
979
|
);
|
|
969
980
|
if (sorted.length === 0) return null;
|
|
970
|
-
return /* @__PURE__ */ jsx13("div", { className: "flex items-center gap-1", children: sorted.map((cat) => {
|
|
981
|
+
return /* @__PURE__ */ jsx13("div", { className: "flex items-center gap-1.5", children: sorted.map((cat) => {
|
|
971
982
|
const Icon = CATEGORY_ICON_MAP[cat] ?? Settings2;
|
|
972
|
-
return /* @__PURE__ */
|
|
983
|
+
return /* @__PURE__ */ jsxs12(
|
|
973
984
|
"span",
|
|
974
985
|
{
|
|
975
986
|
title: cat,
|
|
976
|
-
className: "flex h-
|
|
977
|
-
children:
|
|
987
|
+
className: "flex h-7 items-center gap-1 rounded-full border border-[var(--border-subtle)] bg-[linear-gradient(180deg,rgba(255,255,255,0.04),transparent)] px-2 text-[11px] uppercase tracking-[0.12em] text-[var(--text-muted)]",
|
|
988
|
+
children: [
|
|
989
|
+
/* @__PURE__ */ jsx13(Icon, { className: "h-3.5 w-3.5" }),
|
|
990
|
+
/* @__PURE__ */ jsx13("span", { children: cat })
|
|
991
|
+
]
|
|
978
992
|
},
|
|
979
993
|
cat
|
|
980
994
|
);
|
|
@@ -1010,7 +1024,9 @@ var RunGroup = memo11(
|
|
|
1010
1024
|
collapsed,
|
|
1011
1025
|
onToggle,
|
|
1012
1026
|
branding = DEFAULT_BRANDING,
|
|
1013
|
-
renderToolDetail
|
|
1027
|
+
renderToolDetail,
|
|
1028
|
+
headerActions,
|
|
1029
|
+
renderToolActions
|
|
1014
1030
|
}) => {
|
|
1015
1031
|
const allParts = useMemo5(() => {
|
|
1016
1032
|
const parts = [];
|
|
@@ -1033,53 +1049,56 @@ var RunGroup = memo11(
|
|
|
1033
1049
|
return null;
|
|
1034
1050
|
}
|
|
1035
1051
|
return /* @__PURE__ */ jsxs12(Collapsible3.Root, { open: !collapsed, onOpenChange: () => onToggle(), children: [
|
|
1036
|
-
/* @__PURE__ */
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
|
|
1046
|
-
/* @__PURE__ */ jsx13(
|
|
1047
|
-
"div",
|
|
1048
|
-
{
|
|
1049
|
-
className: cn(
|
|
1050
|
-
"flex h-10 w-10 shrink-0 items-center justify-center rounded-[var(--radius-lg)] border bg-[var(--bg-section)]",
|
|
1051
|
-
branding.borderClass
|
|
1052
|
-
),
|
|
1053
|
-
children: /* @__PURE__ */ jsx13(Bot2, { className: cn("h-4 w-4", branding.accentClass) })
|
|
1054
|
-
}
|
|
1052
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-start gap-3", children: [
|
|
1053
|
+
/* @__PURE__ */ jsx13(Collapsible3.Trigger, { asChild: true, children: /* @__PURE__ */ jsx13(
|
|
1054
|
+
"button",
|
|
1055
|
+
{
|
|
1056
|
+
className: cn(
|
|
1057
|
+
"w-full rounded-[calc(var(--radius-xl)+2px)] border px-4 py-3.5 text-left transition-colors shadow-[var(--shadow-card)] backdrop-blur-sm",
|
|
1058
|
+
"bg-[radial-gradient(circle_at_top_left,rgba(96,165,250,0.12),transparent_34%),linear-gradient(180deg,rgba(255,255,255,0.03),transparent_30%),var(--bg-card)] hover:bg-[radial-gradient(circle_at_top_left,rgba(96,165,250,0.16),transparent_34%),linear-gradient(180deg,rgba(255,255,255,0.04),transparent_30%),var(--bg-card)]",
|
|
1059
|
+
collapsed ? branding.borderClass : "border-[var(--border-subtle)]",
|
|
1060
|
+
branding.bgClass
|
|
1055
1061
|
),
|
|
1056
|
-
/* @__PURE__ */ jsxs12("div", { className: "
|
|
1057
|
-
/* @__PURE__ */
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
"
|
|
1062
|
+
children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
|
|
1063
|
+
/* @__PURE__ */ jsx13(
|
|
1064
|
+
"div",
|
|
1065
|
+
{
|
|
1066
|
+
className: cn(
|
|
1067
|
+
"flex h-11 w-11 shrink-0 items-center justify-center rounded-[calc(var(--radius-lg)+2px)] border bg-[linear-gradient(135deg,rgba(82,164,255,0.22),rgba(82,164,255,0.06))] shadow-[var(--shadow-accent)]",
|
|
1068
|
+
branding.borderClass
|
|
1069
|
+
),
|
|
1070
|
+
children: /* @__PURE__ */ jsx13(Bot2, { className: cn("h-4 w-4", branding.accentClass) })
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
/* @__PURE__ */ jsxs12("div", { className: "min-w-0 flex-1", children: [
|
|
1074
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1075
|
+
/* @__PURE__ */ jsx13("span", { className: cn("text-sm font-semibold tracking-[0.01em]", branding.textClass), children: branding.label }),
|
|
1076
|
+
isStreaming ? /* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1 rounded-full border border-[var(--border-accent)] bg-[linear-gradient(135deg,rgba(82,164,255,0.22),rgba(82,164,255,0.08))] px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-[var(--brand-cool)]", children: [
|
|
1077
|
+
/* @__PURE__ */ jsx13(Loader25, { className: "h-3 w-3 animate-spin" }),
|
|
1078
|
+
"Running"
|
|
1079
|
+
] }) : /* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1 rounded-full border border-[var(--border-subtle)] bg-[linear-gradient(180deg,rgba(255,255,255,0.04),transparent)] px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-[var(--text-muted)]", children: [
|
|
1080
|
+
/* @__PURE__ */ jsx13(Sparkles, { className: "h-3 w-3" }),
|
|
1081
|
+
"Complete"
|
|
1082
|
+
] })
|
|
1083
|
+
] }),
|
|
1084
|
+
/* @__PURE__ */ jsxs12("div", { className: "mt-1 flex flex-wrap items-center gap-2 text-xs text-[var(--text-muted)]", children: [
|
|
1085
|
+
renderSummary(run) ? /* @__PURE__ */ jsx13("span", { children: renderSummary(run) }) : null,
|
|
1086
|
+
collapsed && run.summaryText ? /* @__PURE__ */ jsx13("span", { className: "min-w-0 truncate text-[var(--text-secondary)]", children: run.summaryText }) : null
|
|
1065
1087
|
] })
|
|
1066
1088
|
] }),
|
|
1067
|
-
/* @__PURE__ */
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
}
|
|
1076
|
-
) }),
|
|
1077
|
-
collapsed && run.summaryText && /* @__PURE__ */ jsx13("div", { className: "px-4 py-2 text-sm text-[var(--text-muted)] line-clamp-2", children: run.summaryText }),
|
|
1089
|
+
/* @__PURE__ */ jsx13(CategoryBadges, { categories: stats.toolCategories }),
|
|
1090
|
+
!collapsed ? /* @__PURE__ */ jsx13(ChevronDown4, { className: "h-4 w-4 shrink-0 text-[var(--text-muted)]" }) : /* @__PURE__ */ jsx13(ChevronRight4, { className: "h-4 w-4 shrink-0 text-[var(--text-muted)]" })
|
|
1091
|
+
] })
|
|
1092
|
+
}
|
|
1093
|
+
) }),
|
|
1094
|
+
headerActions ? /* @__PURE__ */ jsx13("div", { className: "flex shrink-0 flex-wrap items-center justify-end gap-1.5 pt-1", children: headerActions }) : null
|
|
1095
|
+
] }),
|
|
1096
|
+
collapsed && run.summaryText && /* @__PURE__ */ jsx13("div", { className: "px-4 py-2 text-sm leading-6 text-[var(--text-muted)] line-clamp-2", children: run.summaryText }),
|
|
1078
1097
|
/* @__PURE__ */ jsx13(Collapsible3.Content, { className: "overflow-hidden data-[state=open]:animate-slideDown data-[state=closed]:animate-slideUp", children: /* @__PURE__ */ jsx13(
|
|
1079
1098
|
"div",
|
|
1080
1099
|
{
|
|
1081
1100
|
className: cn(
|
|
1082
|
-
"mt-2 space-y-
|
|
1101
|
+
"mt-2 space-y-3 rounded-[calc(var(--radius-xl)+2px)] border border-[var(--border-subtle)] p-3.5 shadow-[var(--shadow-card)]",
|
|
1083
1102
|
branding.containerBgClass
|
|
1084
1103
|
),
|
|
1085
1104
|
children: allParts.map(({ part, msgId, index }, partIndex) => {
|
|
@@ -1090,7 +1109,12 @@ var RunGroup = memo11(
|
|
|
1090
1109
|
{
|
|
1091
1110
|
part,
|
|
1092
1111
|
renderToolDetail,
|
|
1093
|
-
groupPosition: getToolGroupPosition(partIndex, allParts)
|
|
1112
|
+
groupPosition: getToolGroupPosition(partIndex, allParts),
|
|
1113
|
+
actions: renderToolActions?.(part, {
|
|
1114
|
+
run,
|
|
1115
|
+
messageId: msgId,
|
|
1116
|
+
partIndex: index
|
|
1117
|
+
})
|
|
1094
1118
|
},
|
|
1095
1119
|
key
|
|
1096
1120
|
);
|
|
@@ -1109,7 +1133,7 @@ var RunGroup = memo11(
|
|
|
1109
1133
|
return /* @__PURE__ */ jsx13(
|
|
1110
1134
|
"div",
|
|
1111
1135
|
{
|
|
1112
|
-
className: "rounded-[var(--radius-lg)] border border-[var(--border-subtle)] bg-[var(--bg-card)] px-4 py-4",
|
|
1136
|
+
className: "rounded-[calc(var(--radius-lg)+2px)] border border-[var(--border-subtle)] bg-[radial-gradient(circle_at_top_left,rgba(96,165,250,0.08),transparent_36%),linear-gradient(180deg,rgba(255,255,255,0.03),transparent_30%),var(--bg-card)] px-4 py-4",
|
|
1113
1137
|
children: /* @__PURE__ */ jsx13(Markdown, { children: part.text })
|
|
1114
1138
|
},
|
|
1115
1139
|
key
|
|
@@ -530,6 +530,155 @@ var TerminalInput = React6.forwardRef(
|
|
|
530
530
|
);
|
|
531
531
|
TerminalInput.displayName = "TerminalInput";
|
|
532
532
|
|
|
533
|
+
// src/primitives/drop-zone.tsx
|
|
534
|
+
import { useCallback as useCallback2, useRef as useRef2, useState as useState3 } from "react";
|
|
535
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
536
|
+
function DropZone({
|
|
537
|
+
onDrop,
|
|
538
|
+
accept,
|
|
539
|
+
disabled,
|
|
540
|
+
overlay,
|
|
541
|
+
title = "Drop files to upload",
|
|
542
|
+
description = "Your files will be securely stored in the workspace.",
|
|
543
|
+
icon = "cloud_upload",
|
|
544
|
+
children,
|
|
545
|
+
className
|
|
546
|
+
}) {
|
|
547
|
+
const [dragOver, setDragOver] = useState3(false);
|
|
548
|
+
const counter = useRef2(0);
|
|
549
|
+
const isAccepted = useCallback2(
|
|
550
|
+
(file) => {
|
|
551
|
+
if (!accept) return true;
|
|
552
|
+
const extensions = accept.split(",").map((ext) => ext.trim().toLowerCase());
|
|
553
|
+
const fileName = file.name.toLowerCase();
|
|
554
|
+
return extensions.some((ext) => fileName.endsWith(ext));
|
|
555
|
+
},
|
|
556
|
+
[accept]
|
|
557
|
+
);
|
|
558
|
+
const handleDragEnter = useCallback2(
|
|
559
|
+
(e) => {
|
|
560
|
+
e.preventDefault();
|
|
561
|
+
if (disabled) return;
|
|
562
|
+
counter.current++;
|
|
563
|
+
if (e.dataTransfer?.types.includes("Files")) setDragOver(true);
|
|
564
|
+
},
|
|
565
|
+
[disabled]
|
|
566
|
+
);
|
|
567
|
+
const handleDragLeave = useCallback2((e) => {
|
|
568
|
+
e.preventDefault();
|
|
569
|
+
counter.current--;
|
|
570
|
+
if (counter.current === 0) setDragOver(false);
|
|
571
|
+
}, []);
|
|
572
|
+
const handleDragOver = useCallback2(
|
|
573
|
+
(e) => {
|
|
574
|
+
e.preventDefault();
|
|
575
|
+
if (!disabled) e.dataTransfer.dropEffect = "copy";
|
|
576
|
+
},
|
|
577
|
+
[disabled]
|
|
578
|
+
);
|
|
579
|
+
const handleDrop = useCallback2(
|
|
580
|
+
(e) => {
|
|
581
|
+
e.preventDefault();
|
|
582
|
+
counter.current = 0;
|
|
583
|
+
setDragOver(false);
|
|
584
|
+
if (disabled) return;
|
|
585
|
+
const allFiles = Array.from(e.dataTransfer?.files || []);
|
|
586
|
+
const accepted = accept ? allFiles.filter(isAccepted) : allFiles;
|
|
587
|
+
if (accepted.length > 0) onDrop(accepted);
|
|
588
|
+
},
|
|
589
|
+
[disabled, accept, isAccepted, onDrop]
|
|
590
|
+
);
|
|
591
|
+
return /* @__PURE__ */ jsxs5(
|
|
592
|
+
"div",
|
|
593
|
+
{
|
|
594
|
+
onDragEnter: handleDragEnter,
|
|
595
|
+
onDragLeave: handleDragLeave,
|
|
596
|
+
onDragOver: handleDragOver,
|
|
597
|
+
onDrop: handleDrop,
|
|
598
|
+
className: cn("relative", className),
|
|
599
|
+
children: [
|
|
600
|
+
dragOver && (overlay || /* @__PURE__ */ jsx7("div", { className: "fixed inset-0 z-[100] flex items-center justify-center pointer-events-none bg-black/20 backdrop-blur-sm", children: /* @__PURE__ */ jsxs5("div", { className: "rounded-3xl border-2 border-dashed border-[hsl(var(--ring))] bg-[hsl(var(--card))] p-16 text-center shadow-2xl max-w-lg mx-auto", children: [
|
|
601
|
+
/* @__PURE__ */ jsx7("div", { className: "mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-2xl bg-[hsl(var(--primary))]/10", children: typeof icon === "string" ? /* @__PURE__ */ jsx7("span", { className: "material-symbols-outlined text-5xl text-[hsl(var(--primary))]", children: icon }) : icon }),
|
|
602
|
+
/* @__PURE__ */ jsx7("h2", { className: "text-2xl font-extrabold text-[hsl(var(--foreground))]", children: title }),
|
|
603
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-2 text-[hsl(var(--muted-foreground))]", children: description })
|
|
604
|
+
] }) })),
|
|
605
|
+
children
|
|
606
|
+
]
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
// src/primitives/upload-progress.tsx
|
|
612
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
613
|
+
function formatSize(bytes) {
|
|
614
|
+
if (bytes < 1024) return `${bytes}B`;
|
|
615
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)}KB`;
|
|
616
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
617
|
+
}
|
|
618
|
+
function UploadProgress({ files, onRemove, onRetry, className }) {
|
|
619
|
+
if (files.length === 0) return null;
|
|
620
|
+
return /* @__PURE__ */ jsx8("div", { className: cn("space-y-2", className), children: files.map((file) => /* @__PURE__ */ jsxs6(
|
|
621
|
+
"div",
|
|
622
|
+
{
|
|
623
|
+
className: cn(
|
|
624
|
+
"flex items-center gap-3 rounded-lg border px-3 py-2 text-sm",
|
|
625
|
+
file.status === "error" ? "border-[hsl(var(--destructive))]/20 bg-[hsl(var(--destructive))]/5" : file.status === "complete" ? "border-[hsl(var(--success))]/20 bg-[hsl(var(--success))]/5" : "border-[hsl(var(--border))] bg-[hsl(var(--card))]"
|
|
626
|
+
),
|
|
627
|
+
children: [
|
|
628
|
+
/* @__PURE__ */ jsx8(
|
|
629
|
+
"span",
|
|
630
|
+
{
|
|
631
|
+
className: cn(
|
|
632
|
+
"material-symbols-outlined text-base shrink-0",
|
|
633
|
+
file.status === "complete" && "text-[hsl(var(--success))]",
|
|
634
|
+
file.status === "error" && "text-[hsl(var(--destructive))]",
|
|
635
|
+
file.status === "uploading" && "text-[hsl(var(--primary))] animate-pulse",
|
|
636
|
+
file.status === "pending" && "text-[hsl(var(--muted-foreground))]"
|
|
637
|
+
),
|
|
638
|
+
style: file.status === "complete" ? { fontVariationSettings: "'FILL' 1" } : void 0,
|
|
639
|
+
children: file.status === "complete" ? "check_circle" : file.status === "error" ? "error" : file.status === "uploading" ? "progress_activity" : "description"
|
|
640
|
+
}
|
|
641
|
+
),
|
|
642
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex-1 min-w-0", children: [
|
|
643
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
644
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate font-medium text-[hsl(var(--foreground))]", children: file.name }),
|
|
645
|
+
/* @__PURE__ */ jsx8("span", { className: "shrink-0 text-xs text-[hsl(var(--muted-foreground))]", children: formatSize(file.size) })
|
|
646
|
+
] }),
|
|
647
|
+
file.status === "uploading" && file.progress !== void 0 && /* @__PURE__ */ jsx8("div", { className: "mt-1 h-1 w-full rounded-full bg-[hsl(var(--muted))] overflow-hidden", children: /* @__PURE__ */ jsx8(
|
|
648
|
+
"div",
|
|
649
|
+
{
|
|
650
|
+
className: "h-full rounded-full bg-[hsl(var(--primary))] transition-all",
|
|
651
|
+
style: { width: `${file.progress}%` }
|
|
652
|
+
}
|
|
653
|
+
) }),
|
|
654
|
+
file.status === "error" && file.error && /* @__PURE__ */ jsx8("p", { className: "mt-0.5 text-xs text-[hsl(var(--destructive))]", children: file.error })
|
|
655
|
+
] }),
|
|
656
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
657
|
+
file.status === "error" && onRetry && /* @__PURE__ */ jsx8(
|
|
658
|
+
"button",
|
|
659
|
+
{
|
|
660
|
+
type: "button",
|
|
661
|
+
onClick: () => onRetry(file.id),
|
|
662
|
+
className: "rounded p-1 text-[hsl(var(--muted-foreground))] hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))] transition-colors",
|
|
663
|
+
children: /* @__PURE__ */ jsx8("span", { className: "material-symbols-outlined text-sm", children: "refresh" })
|
|
664
|
+
}
|
|
665
|
+
),
|
|
666
|
+
onRemove && /* @__PURE__ */ jsx8(
|
|
667
|
+
"button",
|
|
668
|
+
{
|
|
669
|
+
type: "button",
|
|
670
|
+
onClick: () => onRemove(file.id),
|
|
671
|
+
className: "rounded p-1 text-[hsl(var(--muted-foreground))] hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))] transition-colors",
|
|
672
|
+
children: /* @__PURE__ */ jsx8("span", { className: "material-symbols-outlined text-sm", children: "close" })
|
|
673
|
+
}
|
|
674
|
+
)
|
|
675
|
+
] })
|
|
676
|
+
]
|
|
677
|
+
},
|
|
678
|
+
file.id
|
|
679
|
+
)) });
|
|
680
|
+
}
|
|
681
|
+
|
|
533
682
|
export {
|
|
534
683
|
Select,
|
|
535
684
|
SelectGroup,
|
|
@@ -550,5 +699,7 @@ export {
|
|
|
550
699
|
TerminalDisplay,
|
|
551
700
|
TerminalLine,
|
|
552
701
|
TerminalCursor,
|
|
553
|
-
TerminalInput
|
|
702
|
+
TerminalInput,
|
|
703
|
+
DropZone,
|
|
704
|
+
UploadProgress
|
|
554
705
|
};
|