@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/dist/index.d.cts
CHANGED
|
@@ -2197,13 +2197,14 @@ interface ImageUploadProps {
|
|
|
2197
2197
|
disabled?: boolean;
|
|
2198
2198
|
className?: string;
|
|
2199
2199
|
showPreview?: boolean;
|
|
2200
|
-
previewSize?: "sm" | "md" | "lg";
|
|
2200
|
+
previewSize?: "sx" | "sm" | "md" | "lg";
|
|
2201
2201
|
dragDropText?: string;
|
|
2202
2202
|
browseText?: string;
|
|
2203
2203
|
supportedFormatsText?: string;
|
|
2204
|
+
uploadAreaHeight?: string | number;
|
|
2204
2205
|
}
|
|
2205
2206
|
declare function ImageUpload({ onUpload, onRemove, maxSize, // Convert bytes to MB
|
|
2206
|
-
accept, multiple, disabled, className, showPreview, previewSize, dragDropText, browseText, supportedFormatsText, }: ImageUploadProps): react_jsx_runtime.JSX.Element;
|
|
2207
|
+
accept, multiple, disabled, className, showPreview, previewSize, dragDropText, browseText, supportedFormatsText, uploadAreaHeight, }: ImageUploadProps): react_jsx_runtime.JSX.Element;
|
|
2207
2208
|
|
|
2208
2209
|
interface UploadedFile {
|
|
2209
2210
|
id: string | number;
|
package/dist/index.d.ts
CHANGED
|
@@ -2197,13 +2197,14 @@ interface ImageUploadProps {
|
|
|
2197
2197
|
disabled?: boolean;
|
|
2198
2198
|
className?: string;
|
|
2199
2199
|
showPreview?: boolean;
|
|
2200
|
-
previewSize?: "sm" | "md" | "lg";
|
|
2200
|
+
previewSize?: "sx" | "sm" | "md" | "lg";
|
|
2201
2201
|
dragDropText?: string;
|
|
2202
2202
|
browseText?: string;
|
|
2203
2203
|
supportedFormatsText?: string;
|
|
2204
|
+
uploadAreaHeight?: string | number;
|
|
2204
2205
|
}
|
|
2205
2206
|
declare function ImageUpload({ onUpload, onRemove, maxSize, // Convert bytes to MB
|
|
2206
|
-
accept, multiple, disabled, className, showPreview, previewSize, dragDropText, browseText, supportedFormatsText, }: ImageUploadProps): react_jsx_runtime.JSX.Element;
|
|
2207
|
+
accept, multiple, disabled, className, showPreview, previewSize, dragDropText, browseText, supportedFormatsText, uploadAreaHeight, }: ImageUploadProps): react_jsx_runtime.JSX.Element;
|
|
2207
2208
|
|
|
2208
2209
|
interface UploadedFile {
|
|
2209
2210
|
id: string | number;
|
package/dist/index.js
CHANGED
|
@@ -21708,7 +21708,8 @@ function ImageUpload({
|
|
|
21708
21708
|
previewSize = "md",
|
|
21709
21709
|
dragDropText,
|
|
21710
21710
|
browseText,
|
|
21711
|
-
supportedFormatsText
|
|
21711
|
+
supportedFormatsText,
|
|
21712
|
+
uploadAreaHeight
|
|
21712
21713
|
}) {
|
|
21713
21714
|
const [isDragging, setIsDragging] = useState34(false);
|
|
21714
21715
|
const [uploading, setUploading] = useState34(false);
|
|
@@ -21717,10 +21718,12 @@ function ImageUpload({
|
|
|
21717
21718
|
const { addToast } = useToast();
|
|
21718
21719
|
const t = useSmartTranslations("OCR.imageUpload");
|
|
21719
21720
|
const previewSizes = {
|
|
21721
|
+
sx: "w-12 h-12",
|
|
21720
21722
|
sm: "w-16 h-16",
|
|
21721
21723
|
md: "w-24 h-24",
|
|
21722
21724
|
lg: "w-32 h-32"
|
|
21723
21725
|
};
|
|
21726
|
+
const compactUploadArea = typeof uploadAreaHeight === "number" ? uploadAreaHeight <= 150 : typeof uploadAreaHeight === "string" && /^\s*\d+(?:\.\d+)?px\s*$/.test(uploadAreaHeight) ? parseFloat(uploadAreaHeight) <= 150 : false;
|
|
21724
21727
|
const handleDragOver = useCallback19(
|
|
21725
21728
|
(e) => {
|
|
21726
21729
|
e.preventDefault();
|
|
@@ -21833,11 +21836,14 @@ function ImageUpload({
|
|
|
21833
21836
|
"div",
|
|
21834
21837
|
{
|
|
21835
21838
|
className: cn(
|
|
21836
|
-
"relative border-2 border-dashed rounded-2xl md:rounded-3xl
|
|
21839
|
+
"relative border-2 border-dashed rounded-2xl md:rounded-3xl text-center transition-all duration-200",
|
|
21840
|
+
uploadAreaHeight ? "px-4 py-3 sm:px-6 sm:py-4" : "p-8",
|
|
21841
|
+
compactUploadArea && "px-3 py-2 sm:px-4 sm:py-3",
|
|
21837
21842
|
isDragging && !disabled ? "border-primary bg-primary/5 scale-[1.02]" : "border-border/50 hover:border-primary/50",
|
|
21838
21843
|
disabled && "opacity-50 cursor-not-allowed",
|
|
21839
21844
|
uploading && "pointer-events-none"
|
|
21840
21845
|
),
|
|
21846
|
+
style: uploadAreaHeight ? { height: uploadAreaHeight } : void 0,
|
|
21841
21847
|
onDragOver: handleDragOver,
|
|
21842
21848
|
onDragLeave: handleDragLeave,
|
|
21843
21849
|
onDrop: handleDrop,
|
|
@@ -21846,14 +21852,35 @@ function ImageUpload({
|
|
|
21846
21852
|
/* @__PURE__ */ jsx54(Loader24, { className: "w-6 h-6 animate-spin text-primary" }),
|
|
21847
21853
|
/* @__PURE__ */ jsx54("span", { className: "text-sm font-medium", children: "Uploading..." })
|
|
21848
21854
|
] }) }),
|
|
21849
|
-
/* @__PURE__ */ jsxs42(
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21853
|
-
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21855
|
+
/* @__PURE__ */ jsxs42(
|
|
21856
|
+
"div",
|
|
21857
|
+
{
|
|
21858
|
+
className: cn(
|
|
21859
|
+
"space-y-4",
|
|
21860
|
+
uploadAreaHeight && "flex h-full flex-col items-center justify-center gap-3 space-y-0",
|
|
21861
|
+
compactUploadArea && "flex-row items-center justify-between gap-3 text-left"
|
|
21862
|
+
),
|
|
21863
|
+
children: [
|
|
21864
|
+
/* @__PURE__ */ jsx54("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__ */ jsx54(Upload, { className: cn("text-primary", compactUploadArea ? "w-4 h-4" : "w-6 h-6") }) }),
|
|
21865
|
+
/* @__PURE__ */ jsxs42("div", { className: cn("space-y-2", compactUploadArea && "flex min-w-0 flex-1 items-center justify-between gap-3 space-y-0"), children: [
|
|
21866
|
+
/* @__PURE__ */ jsx54("p", { className: cn("text-muted-foreground", compactUploadArea && "text-sm leading-tight whitespace-nowrap"), children: dragDropText || t("dragDropText") }),
|
|
21867
|
+
/* @__PURE__ */ jsx54(
|
|
21868
|
+
Button_default,
|
|
21869
|
+
{
|
|
21870
|
+
type: "button",
|
|
21871
|
+
variant: "outline",
|
|
21872
|
+
size: "sm",
|
|
21873
|
+
className: cn(compactUploadArea && "shrink-0"),
|
|
21874
|
+
onClick: handleBrowseClick,
|
|
21875
|
+
disabled: disabled || uploading,
|
|
21876
|
+
children: browseText || t("browseFiles")
|
|
21877
|
+
}
|
|
21878
|
+
)
|
|
21879
|
+
] }),
|
|
21880
|
+
!compactUploadArea && /* @__PURE__ */ jsx54("p", { className: "text-xs text-muted-foreground", children: supportedFormatsText || t("supportedFormats") })
|
|
21881
|
+
]
|
|
21882
|
+
}
|
|
21883
|
+
),
|
|
21857
21884
|
/* @__PURE__ */ jsx54(
|
|
21858
21885
|
"input",
|
|
21859
21886
|
{
|