@underverse-ui/underverse 1.0.180 → 1.0.182
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/api-reference.json +1 -1
- package/dist/index.cjs +40 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +40 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/api-reference.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -21903,7 +21903,8 @@ function ImageUpload({
|
|
|
21903
21903
|
previewSize = "md",
|
|
21904
21904
|
dragDropText,
|
|
21905
21905
|
browseText,
|
|
21906
|
-
supportedFormatsText
|
|
21906
|
+
supportedFormatsText,
|
|
21907
|
+
uploadAreaHeight
|
|
21907
21908
|
}) {
|
|
21908
21909
|
const [isDragging, setIsDragging] = (0, import_react27.useState)(false);
|
|
21909
21910
|
const [uploading, setUploading] = (0, import_react27.useState)(false);
|
|
@@ -21912,10 +21913,12 @@ function ImageUpload({
|
|
|
21912
21913
|
const { addToast } = useToast();
|
|
21913
21914
|
const t = useSmartTranslations("OCR.imageUpload");
|
|
21914
21915
|
const previewSizes = {
|
|
21916
|
+
sx: "w-12 h-12",
|
|
21915
21917
|
sm: "w-16 h-16",
|
|
21916
21918
|
md: "w-24 h-24",
|
|
21917
21919
|
lg: "w-32 h-32"
|
|
21918
21920
|
};
|
|
21921
|
+
const compactUploadArea = typeof uploadAreaHeight === "number" ? uploadAreaHeight <= 150 : typeof uploadAreaHeight === "string" && /^\s*\d+(?:\.\d+)?px\s*$/.test(uploadAreaHeight) ? parseFloat(uploadAreaHeight) <= 150 : false;
|
|
21919
21922
|
const handleDragOver = (0, import_react27.useCallback)(
|
|
21920
21923
|
(e) => {
|
|
21921
21924
|
e.preventDefault();
|
|
@@ -21952,11 +21955,12 @@ function ImageUpload({
|
|
|
21952
21955
|
if (validFiles.length === 0) return;
|
|
21953
21956
|
setUploading(true);
|
|
21954
21957
|
try {
|
|
21958
|
+
let idCount = 0;
|
|
21955
21959
|
for (const file of validFiles) {
|
|
21956
21960
|
const formData = new FormData();
|
|
21957
21961
|
formData.append("file", file);
|
|
21958
21962
|
const response = {
|
|
21959
|
-
id: Date.now(),
|
|
21963
|
+
id: Date.now() + idCount,
|
|
21960
21964
|
path: "",
|
|
21961
21965
|
url: URL.createObjectURL(file),
|
|
21962
21966
|
originalName: file.name,
|
|
@@ -21983,6 +21987,7 @@ function ImageUpload({
|
|
|
21983
21987
|
type: "success",
|
|
21984
21988
|
message: `"${file.name}" uploaded successfully`
|
|
21985
21989
|
});
|
|
21990
|
+
idCount++;
|
|
21986
21991
|
}
|
|
21987
21992
|
} catch (error) {
|
|
21988
21993
|
console.error("Upload error:", error);
|
|
@@ -22028,11 +22033,14 @@ function ImageUpload({
|
|
|
22028
22033
|
"div",
|
|
22029
22034
|
{
|
|
22030
22035
|
className: cn(
|
|
22031
|
-
"relative border-2 border-dashed rounded-2xl md:rounded-3xl
|
|
22036
|
+
"relative border-2 border-dashed rounded-2xl md:rounded-3xl text-center transition-all duration-200",
|
|
22037
|
+
uploadAreaHeight ? "px-4 py-3 sm:px-6 sm:py-4" : "p-8",
|
|
22038
|
+
compactUploadArea && "px-3 py-2 sm:px-4 sm:py-3",
|
|
22032
22039
|
isDragging && !disabled ? "border-primary bg-primary/5 scale-[1.02]" : "border-border/50 hover:border-primary/50",
|
|
22033
22040
|
disabled && "opacity-50 cursor-not-allowed",
|
|
22034
22041
|
uploading && "pointer-events-none"
|
|
22035
22042
|
),
|
|
22043
|
+
style: uploadAreaHeight ? { height: uploadAreaHeight } : void 0,
|
|
22036
22044
|
onDragOver: handleDragOver,
|
|
22037
22045
|
onDragLeave: handleDragLeave,
|
|
22038
22046
|
onDrop: handleDrop,
|
|
@@ -22041,14 +22049,35 @@ function ImageUpload({
|
|
|
22041
22049
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react30.Loader2, { className: "w-6 h-6 animate-spin text-primary" }),
|
|
22042
22050
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-sm font-medium", children: "Uploading..." })
|
|
22043
22051
|
] }) }),
|
|
22044
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
22045
|
-
|
|
22046
|
-
|
|
22047
|
-
|
|
22048
|
-
|
|
22049
|
-
|
|
22050
|
-
|
|
22051
|
-
|
|
22052
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
22053
|
+
"div",
|
|
22054
|
+
{
|
|
22055
|
+
className: cn(
|
|
22056
|
+
"space-y-4",
|
|
22057
|
+
uploadAreaHeight && "flex h-full flex-col items-center justify-center gap-3 space-y-0",
|
|
22058
|
+
compactUploadArea && "flex-row items-center justify-between gap-3 text-left"
|
|
22059
|
+
),
|
|
22060
|
+
children: [
|
|
22061
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: cn("bg-primary/10 rounded-full flex items-center justify-center shrink-0", compactUploadArea ? "w-9 h-9 mx-0" : "mx-auto w-12 h-12"), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react30.Upload, { className: cn("text-primary", compactUploadArea ? "w-4 h-4" : "w-6 h-6") }) }),
|
|
22062
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: cn("space-y-2", compactUploadArea && "flex min-w-0 flex-1 items-center justify-between gap-3 space-y-0"), children: [
|
|
22063
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: cn("text-muted-foreground", compactUploadArea && "text-sm leading-tight whitespace-nowrap"), children: dragDropText || t("dragDropText") }),
|
|
22064
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
22065
|
+
Button_default,
|
|
22066
|
+
{
|
|
22067
|
+
type: "button",
|
|
22068
|
+
variant: "outline",
|
|
22069
|
+
size: "sm",
|
|
22070
|
+
className: cn(compactUploadArea && "shrink-0"),
|
|
22071
|
+
onClick: handleBrowseClick,
|
|
22072
|
+
disabled: disabled || uploading,
|
|
22073
|
+
children: browseText || t("browseFiles")
|
|
22074
|
+
}
|
|
22075
|
+
)
|
|
22076
|
+
] }),
|
|
22077
|
+
!compactUploadArea && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs text-muted-foreground", children: supportedFormatsText || t("supportedFormats") })
|
|
22078
|
+
]
|
|
22079
|
+
}
|
|
22080
|
+
),
|
|
22052
22081
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
22053
22082
|
"input",
|
|
22054
22083
|
{
|