@streamoid/chat-components 0.2.8 → 0.2.9
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.js +67 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -494,6 +494,7 @@ function DynamicForm(props) {
|
|
|
494
494
|
const [editingTodoContent, setEditingTodoContent] = useState("");
|
|
495
495
|
const [newTodoInputs, setNewTodoInputs] = useState({});
|
|
496
496
|
const [fileUploadState, setFileUploadState] = useState({});
|
|
497
|
+
const [mediaPreview, setMediaPreview] = useState(null);
|
|
497
498
|
const scrollRef = useRef(null);
|
|
498
499
|
const [canScrollUp, setCanScrollUp] = useState(false);
|
|
499
500
|
const [canScrollDown, setCanScrollDown] = useState(false);
|
|
@@ -909,13 +910,29 @@ ${valueSummaryParts.join("\n")}` : "";
|
|
|
909
910
|
"div",
|
|
910
911
|
{
|
|
911
912
|
className: "rounded-md border border-border overflow-hidden bg-muted/20",
|
|
912
|
-
children:
|
|
913
|
-
"
|
|
913
|
+
children: /* @__PURE__ */ jsx10(
|
|
914
|
+
"button",
|
|
914
915
|
{
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
className: "w-full
|
|
918
|
-
|
|
916
|
+
type: "button",
|
|
917
|
+
onClick: () => setMediaPreview({ url, type: mediaType }),
|
|
918
|
+
className: "w-full text-left cursor-zoom-in",
|
|
919
|
+
title: "Click to view full media",
|
|
920
|
+
children: mediaType === "video" ? /* @__PURE__ */ jsx10(
|
|
921
|
+
"video",
|
|
922
|
+
{
|
|
923
|
+
src: url,
|
|
924
|
+
controls: true,
|
|
925
|
+
className: "w-full h-44 object-cover bg-black"
|
|
926
|
+
}
|
|
927
|
+
) : /* @__PURE__ */ jsx10(
|
|
928
|
+
"img",
|
|
929
|
+
{
|
|
930
|
+
src: url,
|
|
931
|
+
alt: `Generated media ${idx + 1}`,
|
|
932
|
+
className: "w-full h-44 object-cover",
|
|
933
|
+
loading: "lazy"
|
|
934
|
+
}
|
|
935
|
+
)
|
|
919
936
|
}
|
|
920
937
|
)
|
|
921
938
|
},
|
|
@@ -1267,7 +1284,50 @@ ${valueSummaryParts.join("\n")}` : "";
|
|
|
1267
1284
|
}
|
|
1268
1285
|
)
|
|
1269
1286
|
] })
|
|
1270
|
-
] })
|
|
1287
|
+
] }),
|
|
1288
|
+
mediaPreview && /* @__PURE__ */ jsx10(
|
|
1289
|
+
"div",
|
|
1290
|
+
{
|
|
1291
|
+
className: "fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-4",
|
|
1292
|
+
onClick: () => setMediaPreview(null),
|
|
1293
|
+
children: /* @__PURE__ */ jsxs2(
|
|
1294
|
+
"div",
|
|
1295
|
+
{
|
|
1296
|
+
className: "relative w-full max-w-5xl max-h-[90vh] bg-background rounded-lg border border-border overflow-hidden",
|
|
1297
|
+
onClick: (e) => e.stopPropagation(),
|
|
1298
|
+
children: [
|
|
1299
|
+
/* @__PURE__ */ jsx10(
|
|
1300
|
+
Button,
|
|
1301
|
+
{
|
|
1302
|
+
type: "button",
|
|
1303
|
+
variant: "ghost",
|
|
1304
|
+
size: "sm",
|
|
1305
|
+
onClick: () => setMediaPreview(null),
|
|
1306
|
+
className: "absolute right-2 top-2 z-10 bg-background/80 hover:bg-background",
|
|
1307
|
+
children: /* @__PURE__ */ jsx10(X, { className: "w-4 h-4" })
|
|
1308
|
+
}
|
|
1309
|
+
),
|
|
1310
|
+
/* @__PURE__ */ jsx10("div", { className: "w-full h-full p-2 flex items-center justify-center", children: mediaPreview.type === "video" ? /* @__PURE__ */ jsx10(
|
|
1311
|
+
"video",
|
|
1312
|
+
{
|
|
1313
|
+
src: mediaPreview.url,
|
|
1314
|
+
controls: true,
|
|
1315
|
+
autoPlay: true,
|
|
1316
|
+
className: "max-w-full max-h-[84vh] object-contain bg-black rounded"
|
|
1317
|
+
}
|
|
1318
|
+
) : /* @__PURE__ */ jsx10(
|
|
1319
|
+
"img",
|
|
1320
|
+
{
|
|
1321
|
+
src: mediaPreview.url,
|
|
1322
|
+
alt: "Full preview",
|
|
1323
|
+
className: "max-w-full max-h-[84vh] object-contain rounded"
|
|
1324
|
+
}
|
|
1325
|
+
) })
|
|
1326
|
+
]
|
|
1327
|
+
}
|
|
1328
|
+
)
|
|
1329
|
+
}
|
|
1330
|
+
)
|
|
1271
1331
|
] });
|
|
1272
1332
|
}
|
|
1273
1333
|
|
package/package.json
CHANGED