@underverse-ui/underverse 1.0.180 → 1.0.181
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 +37 -10
- 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 +37 -10
- 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();
|
|
@@ -22028,11 +22031,14 @@ function ImageUpload({
|
|
|
22028
22031
|
"div",
|
|
22029
22032
|
{
|
|
22030
22033
|
className: cn(
|
|
22031
|
-
"relative border-2 border-dashed rounded-2xl md:rounded-3xl
|
|
22034
|
+
"relative border-2 border-dashed rounded-2xl md:rounded-3xl text-center transition-all duration-200",
|
|
22035
|
+
uploadAreaHeight ? "px-4 py-3 sm:px-6 sm:py-4" : "p-8",
|
|
22036
|
+
compactUploadArea && "px-3 py-2 sm:px-4 sm:py-3",
|
|
22032
22037
|
isDragging && !disabled ? "border-primary bg-primary/5 scale-[1.02]" : "border-border/50 hover:border-primary/50",
|
|
22033
22038
|
disabled && "opacity-50 cursor-not-allowed",
|
|
22034
22039
|
uploading && "pointer-events-none"
|
|
22035
22040
|
),
|
|
22041
|
+
style: uploadAreaHeight ? { height: uploadAreaHeight } : void 0,
|
|
22036
22042
|
onDragOver: handleDragOver,
|
|
22037
22043
|
onDragLeave: handleDragLeave,
|
|
22038
22044
|
onDrop: handleDrop,
|
|
@@ -22041,14 +22047,35 @@ function ImageUpload({
|
|
|
22041
22047
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react30.Loader2, { className: "w-6 h-6 animate-spin text-primary" }),
|
|
22042
22048
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-sm font-medium", children: "Uploading..." })
|
|
22043
22049
|
] }) }),
|
|
22044
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
22045
|
-
|
|
22046
|
-
|
|
22047
|
-
|
|
22048
|
-
|
|
22049
|
-
|
|
22050
|
-
|
|
22051
|
-
|
|
22050
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
22051
|
+
"div",
|
|
22052
|
+
{
|
|
22053
|
+
className: cn(
|
|
22054
|
+
"space-y-4",
|
|
22055
|
+
uploadAreaHeight && "flex h-full flex-col items-center justify-center gap-3 space-y-0",
|
|
22056
|
+
compactUploadArea && "flex-row items-center justify-between gap-3 text-left"
|
|
22057
|
+
),
|
|
22058
|
+
children: [
|
|
22059
|
+
/* @__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") }) }),
|
|
22060
|
+
/* @__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: [
|
|
22061
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: cn("text-muted-foreground", compactUploadArea && "text-sm leading-tight whitespace-nowrap"), children: dragDropText || t("dragDropText") }),
|
|
22062
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
22063
|
+
Button_default,
|
|
22064
|
+
{
|
|
22065
|
+
type: "button",
|
|
22066
|
+
variant: "outline",
|
|
22067
|
+
size: "sm",
|
|
22068
|
+
className: cn(compactUploadArea && "shrink-0"),
|
|
22069
|
+
onClick: handleBrowseClick,
|
|
22070
|
+
disabled: disabled || uploading,
|
|
22071
|
+
children: browseText || t("browseFiles")
|
|
22072
|
+
}
|
|
22073
|
+
)
|
|
22074
|
+
] }),
|
|
22075
|
+
!compactUploadArea && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs text-muted-foreground", children: supportedFormatsText || t("supportedFormats") })
|
|
22076
|
+
]
|
|
22077
|
+
}
|
|
22078
|
+
),
|
|
22052
22079
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
22053
22080
|
"input",
|
|
22054
22081
|
{
|