@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.mjs CHANGED
@@ -1894,7 +1894,6 @@ function MediaPickerDialog({
1894
1894
  folders = [],
1895
1895
  loading = false,
1896
1896
  total,
1897
- uploads = [],
1898
1897
  typeFilter = "all",
1899
1898
  onTypeChange,
1900
1899
  search = "",
@@ -1905,10 +1904,11 @@ function MediaPickerDialog({
1905
1904
  onLoadMore,
1906
1905
  hasMore = false,
1907
1906
  multiple = false,
1907
+ initialSelected = [],
1908
1908
  accept = "all",
1909
1909
  onSelect
1910
1910
  }) {
1911
- const [localSelected, setLocalSelected] = React20.useState(/* @__PURE__ */ new Set());
1911
+ const [localSelected, setLocalSelected] = React20.useState(new Set(initialSelected));
1912
1912
  const [isDragging, setIsDragging] = React20.useState(false);
1913
1913
  const fileInputRef = React20.useRef(null);
1914
1914
  const dragCounterRef = React20.useRef(0);
@@ -1919,6 +1919,16 @@ function MediaPickerDialog({
1919
1919
  dragCounterRef.current = 0;
1920
1920
  }
1921
1921
  }, [open]);
1922
+ const prevInitialRef = React20.useRef("");
1923
+ React20.useEffect(() => {
1924
+ if (!open) return;
1925
+ const key = initialSelected.join(",");
1926
+ if (key === prevInitialRef.current) return;
1927
+ prevInitialRef.current = key;
1928
+ if (initialSelected.length > 0) {
1929
+ setLocalSelected(new Set(initialSelected));
1930
+ }
1931
+ }, [open, initialSelected]);
1922
1932
  const handleDragEnter = (e) => {
1923
1933
  e.preventDefault();
1924
1934
  e.stopPropagation();
@@ -1975,7 +1985,6 @@ function MediaPickerDialog({
1975
1985
  onUpload(e.target.files);
1976
1986
  }
1977
1987
  };
1978
- const activeUploads = uploads.filter((u) => u.status === "uploading");
1979
1988
  const firstSelected = files.find((f) => localSelected.has(f.id));
1980
1989
  return /* @__PURE__ */ jsx34(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs20(
1981
1990
  DialogContent,
@@ -2081,20 +2090,6 @@ function MediaPickerDialog({
2081
2090
  )
2082
2091
  ] })
2083
2092
  ] }),
2084
- activeUploads.length > 0 && /* @__PURE__ */ jsx34("div", { className: "border-b px-4 py-2 space-y-1.5 shrink-0", children: activeUploads.map((u, i) => /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
2085
- /* @__PURE__ */ jsx34("span", { className: "flex-1 truncate text-xs text-muted-foreground", children: u.name }),
2086
- /* @__PURE__ */ jsx34("div", { className: "h-1.5 w-24 overflow-hidden rounded-full bg-muted", children: /* @__PURE__ */ jsx34(
2087
- "div",
2088
- {
2089
- className: "h-full rounded-full bg-primary transition-all duration-200",
2090
- style: { width: `${u.progress}%` }
2091
- }
2092
- ) }),
2093
- /* @__PURE__ */ jsxs20("span", { className: "text-[10px] text-muted-foreground w-6 text-right", children: [
2094
- u.progress,
2095
- "%"
2096
- ] })
2097
- ] }, i)) }),
2098
2093
  /* @__PURE__ */ jsxs20(
2099
2094
  "div",
2100
2095
  {