@webdevarif/dashui 0.2.3 → 0.2.5
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.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +12 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -367,7 +367,6 @@ interface MediaPickerDialogProps {
|
|
|
367
367
|
folders?: MediaPickerDialogFolder[];
|
|
368
368
|
loading?: boolean;
|
|
369
369
|
total: number;
|
|
370
|
-
uploads?: UploadItem[];
|
|
371
370
|
typeFilter?: string;
|
|
372
371
|
onTypeChange?: (type: string) => void;
|
|
373
372
|
search?: string;
|
|
@@ -378,11 +377,12 @@ interface MediaPickerDialogProps {
|
|
|
378
377
|
onLoadMore?: () => void;
|
|
379
378
|
hasMore?: boolean;
|
|
380
379
|
multiple?: boolean;
|
|
380
|
+
initialSelected?: string[];
|
|
381
381
|
/** "images" = only show image type tabs; "all" = show all type tabs */
|
|
382
382
|
accept?: "images" | "all";
|
|
383
383
|
onSelect: (files: MediaCardFile[]) => void;
|
|
384
384
|
}
|
|
385
|
-
declare function MediaPickerDialog({ open, onOpenChange, title, files, folders, loading, total,
|
|
385
|
+
declare function MediaPickerDialog({ open, onOpenChange, title, files, folders, loading, total, typeFilter, onTypeChange, search, onSearch, activeFolderId, onFolderChange, onUpload, onLoadMore, hasMore, multiple, initialSelected, accept, onSelect, }: MediaPickerDialogProps): react_jsx_runtime.JSX.Element;
|
|
386
386
|
|
|
387
387
|
interface ImagePickerFieldProps {
|
|
388
388
|
value?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -367,7 +367,6 @@ interface MediaPickerDialogProps {
|
|
|
367
367
|
folders?: MediaPickerDialogFolder[];
|
|
368
368
|
loading?: boolean;
|
|
369
369
|
total: number;
|
|
370
|
-
uploads?: UploadItem[];
|
|
371
370
|
typeFilter?: string;
|
|
372
371
|
onTypeChange?: (type: string) => void;
|
|
373
372
|
search?: string;
|
|
@@ -378,11 +377,12 @@ interface MediaPickerDialogProps {
|
|
|
378
377
|
onLoadMore?: () => void;
|
|
379
378
|
hasMore?: boolean;
|
|
380
379
|
multiple?: boolean;
|
|
380
|
+
initialSelected?: string[];
|
|
381
381
|
/** "images" = only show image type tabs; "all" = show all type tabs */
|
|
382
382
|
accept?: "images" | "all";
|
|
383
383
|
onSelect: (files: MediaCardFile[]) => void;
|
|
384
384
|
}
|
|
385
|
-
declare function MediaPickerDialog({ open, onOpenChange, title, files, folders, loading, total,
|
|
385
|
+
declare function MediaPickerDialog({ open, onOpenChange, title, files, folders, loading, total, typeFilter, onTypeChange, search, onSearch, activeFolderId, onFolderChange, onUpload, onLoadMore, hasMore, multiple, initialSelected, accept, onSelect, }: MediaPickerDialogProps): react_jsx_runtime.JSX.Element;
|
|
386
386
|
|
|
387
387
|
interface ImagePickerFieldProps {
|
|
388
388
|
value?: string;
|
package/dist/index.js
CHANGED
|
@@ -2030,7 +2030,6 @@ function MediaPickerDialog({
|
|
|
2030
2030
|
folders = [],
|
|
2031
2031
|
loading = false,
|
|
2032
2032
|
total,
|
|
2033
|
-
uploads = [],
|
|
2034
2033
|
typeFilter = "all",
|
|
2035
2034
|
onTypeChange,
|
|
2036
2035
|
search = "",
|
|
@@ -2041,10 +2040,11 @@ function MediaPickerDialog({
|
|
|
2041
2040
|
onLoadMore,
|
|
2042
2041
|
hasMore = false,
|
|
2043
2042
|
multiple = false,
|
|
2043
|
+
initialSelected = [],
|
|
2044
2044
|
accept = "all",
|
|
2045
2045
|
onSelect
|
|
2046
2046
|
}) {
|
|
2047
|
-
const [localSelected, setLocalSelected] = React20.useState(
|
|
2047
|
+
const [localSelected, setLocalSelected] = React20.useState(new Set(initialSelected));
|
|
2048
2048
|
const [isDragging, setIsDragging] = React20.useState(false);
|
|
2049
2049
|
const fileInputRef = React20.useRef(null);
|
|
2050
2050
|
const dragCounterRef = React20.useRef(0);
|
|
@@ -2055,6 +2055,16 @@ function MediaPickerDialog({
|
|
|
2055
2055
|
dragCounterRef.current = 0;
|
|
2056
2056
|
}
|
|
2057
2057
|
}, [open]);
|
|
2058
|
+
const prevInitialRef = React20.useRef("");
|
|
2059
|
+
React20.useEffect(() => {
|
|
2060
|
+
if (!open) return;
|
|
2061
|
+
const key = initialSelected.join(",");
|
|
2062
|
+
if (key === prevInitialRef.current) return;
|
|
2063
|
+
prevInitialRef.current = key;
|
|
2064
|
+
if (initialSelected.length > 0) {
|
|
2065
|
+
setLocalSelected(new Set(initialSelected));
|
|
2066
|
+
}
|
|
2067
|
+
}, [open, initialSelected]);
|
|
2058
2068
|
const handleDragEnter = (e) => {
|
|
2059
2069
|
e.preventDefault();
|
|
2060
2070
|
e.stopPropagation();
|
|
@@ -2111,7 +2121,6 @@ function MediaPickerDialog({
|
|
|
2111
2121
|
onUpload(e.target.files);
|
|
2112
2122
|
}
|
|
2113
2123
|
};
|
|
2114
|
-
const activeUploads = uploads.filter((u) => u.status === "uploading");
|
|
2115
2124
|
const firstSelected = files.find((f) => localSelected.has(f.id));
|
|
2116
2125
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2117
2126
|
DialogContent,
|
|
@@ -2217,20 +2226,6 @@ function MediaPickerDialog({
|
|
|
2217
2226
|
)
|
|
2218
2227
|
] })
|
|
2219
2228
|
] }),
|
|
2220
|
-
activeUploads.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "border-b px-4 py-2 space-y-1.5 shrink-0", children: activeUploads.map((u, i) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2221
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "flex-1 truncate text-xs text-muted-foreground", children: u.name }),
|
|
2222
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "h-1.5 w-24 overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2223
|
-
"div",
|
|
2224
|
-
{
|
|
2225
|
-
className: "h-full rounded-full bg-primary transition-all duration-200",
|
|
2226
|
-
style: { width: `${u.progress}%` }
|
|
2227
|
-
}
|
|
2228
|
-
) }),
|
|
2229
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "text-[10px] text-muted-foreground w-6 text-right", children: [
|
|
2230
|
-
u.progress,
|
|
2231
|
-
"%"
|
|
2232
|
-
] })
|
|
2233
|
-
] }, i)) }),
|
|
2234
2229
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
2235
2230
|
"div",
|
|
2236
2231
|
{
|