@muhgholy/next-drive 4.23.11 → 4.23.14

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.
@@ -296,7 +296,7 @@ var getChunkSize = (fileSize) => {
296
296
  if (fileSize < 1024 * 1024 * 1024) return 8 * 1024 * 1024;
297
297
  return 16 * 1024 * 1024;
298
298
  };
299
- var useUpload = (apiEndpoint, activeAccountId, withCredentials = false, onUploadComplete, unauthenticated = false) => {
299
+ var useUpload = (apiEndpoint, activeAccountId, withCredentials = false, onUploadComplete) => {
300
300
  const [uploads, setUploads] = useState([]);
301
301
  const abortControllers = useRef(/* @__PURE__ */ new Map());
302
302
  const filesRef = useRef(/* @__PURE__ */ new Map());
@@ -380,7 +380,6 @@ var useUpload = (apiEndpoint, activeAccountId, withCredentials = false, onUpload
380
380
  formData.append("fileType", file.type);
381
381
  formData.append("folderId", folderId || "root");
382
382
  if (driveId) formData.append("driveId", driveId);
383
- if (unauthenticated) formData.append("unauthenticated", "true");
384
383
  let attempts = 0;
385
384
  let success = false;
386
385
  while (!success && attempts < 3 && !controller.signal.aborted) {
@@ -3130,7 +3129,7 @@ var DriveFileChooser = (props) => {
3130
3129
  onChange(uploaded);
3131
3130
  }
3132
3131
  }, [multiple, onChange]);
3133
- const { uploads, uploadFiles } = useUpload(apiEndpoint, activeAccountId, withCredentials, handleUploaded, unauthenticatedMode);
3132
+ const { uploads, uploadFiles } = useUpload(apiEndpoint, activeAccountId, withCredentials, handleUploaded);
3134
3133
  const openPicker = useCallback(() => {
3135
3134
  if (unauthenticatedMode) fileInputRef.current?.click();
3136
3135
  else setIsOpen(true);
@@ -3168,7 +3167,7 @@ var DriveFileChooser = (props) => {
3168
3167
  }, [multiple, value, onChange]);
3169
3168
  const hasSelection = value && (Array.isArray(value) ? value.length > 0 : true);
3170
3169
  const displayFiles = useMemo(() => !value ? [] : Array.isArray(value) ? value : [value], [value]);
3171
- return /* @__PURE__ */ jsxs("div", { className: cn("nd:w-full", className), children: [
3170
+ return /* @__PURE__ */ jsxs("div", { className: cn("nd:w-full nd:min-w-0", className), children: [
3172
3171
  !hasSelection ? /* @__PURE__ */ jsxs(
3173
3172
  Button,
3174
3173
  {
@@ -3194,7 +3193,7 @@ var DriveFileChooser = (props) => {
3194
3193
  ) : (
3195
3194
  /* Selected Files Display */
3196
3195
  /* @__PURE__ */ jsxs("div", { className: cn("nd:rounded-lg nd:border", error ? "nd:border-destructive" : "nd:border-border", disabled && "nd:opacity-50"), children: [
3197
- !multiple && displayFiles[0] && displayFiles[0].file && /* @__PURE__ */ jsxs("div", { className: "nd:flex nd:items-center nd:gap-3 nd:p-2.5", children: [
3196
+ !multiple && displayFiles[0] && displayFiles[0].file && /* @__PURE__ */ jsxs("div", { className: "nd:flex nd:items-center nd:gap-3 nd:p-2.5 nd:min-w-0", children: [
3198
3197
  /* @__PURE__ */ jsx("div", { className: "nd:size-12 nd:rounded-lg nd:overflow-hidden nd:bg-muted/30 nd:flex nd:items-center nd:justify-center nd:shrink-0", children: displayFiles[0].file.mime?.startsWith("image/") ? /* @__PURE__ */ jsx("img", { src: createUrl(displayFiles[0]), alt: displayFiles[0].file.name || "", className: "nd:size-full nd:object-cover" }) : getFileIcon(displayFiles[0].file.mime || "", false, "nd:size-6 nd:text-muted-foreground") }),
3199
3198
  /* @__PURE__ */ jsxs("div", { className: "nd:flex-1 nd:min-w-0", children: [
3200
3199
  /* @__PURE__ */ jsx("p", { className: "nd:text-sm nd:font-medium nd:truncate", children: displayFiles[0].file.name || "Unknown" }),
@@ -3221,7 +3220,7 @@ var DriveFileChooser = (props) => {
3221
3220
  !disabled && /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "nd:h-7 nd:text-xs nd:text-muted-foreground", onClick: () => onChange([]), children: "Clear" })
3222
3221
  ] })
3223
3222
  ] }),
3224
- /* @__PURE__ */ jsx("div", { className: "nd:max-h-40 nd:overflow-y-auto nd:divide-y nd:divide-border/50", children: displayFiles.filter((file) => file?.file).map((file) => /* @__PURE__ */ jsxs("div", { className: "nd:flex nd:items-center nd:gap-2.5 nd:px-3 nd:py-2 nd:hover:bg-muted/20", children: [
3223
+ /* @__PURE__ */ jsx("div", { className: "nd:max-h-40 nd:overflow-y-auto nd:divide-y nd:divide-border/50", children: displayFiles.filter((file) => file?.file).map((file) => /* @__PURE__ */ jsxs("div", { className: "nd:flex nd:items-center nd:gap-2.5 nd:px-3 nd:py-2 nd:hover:bg-muted/20 nd:min-w-0", children: [
3225
3224
  /* @__PURE__ */ jsx("div", { className: "nd:size-8 nd:rounded nd:overflow-hidden nd:bg-muted/30 nd:flex nd:items-center nd:justify-center nd:shrink-0", children: file.file.mime?.startsWith("image/") ? /* @__PURE__ */ jsx("img", { src: createUrl(file), alt: file.file.name || "", className: "nd:size-full nd:object-cover" }) : getFileIcon(file.file.mime || "", false, "nd:size-4 nd:text-muted-foreground") }),
3226
3225
  /* @__PURE__ */ jsxs("div", { className: "nd:flex-1 nd:min-w-0", children: [
3227
3226
  /* @__PURE__ */ jsx("p", { className: "nd:text-sm nd:truncate", children: file.file.name || "Unknown" }),
@@ -3238,9 +3237,9 @@ var DriveFileChooser = (props) => {
3238
3237
  error && helperText && /* @__PURE__ */ jsx("p", { className: "nd:text-xs nd:text-destructive nd:mt-1.5", children: helperText }),
3239
3238
  unauthenticatedMode && /* @__PURE__ */ jsx("input", { ref: fileInputRef, type: "file", accept, multiple, className: "nd:hidden", onChange: handleFilePick }),
3240
3239
  activeUploads.length > 0 && /* @__PURE__ */ jsx("div", { className: "nd:mt-2 nd:space-y-2", children: activeUploads.map((u) => /* @__PURE__ */ jsxs("div", { className: "nd:rounded-lg nd:border nd:px-3 nd:py-2", children: [
3241
- /* @__PURE__ */ jsxs("div", { className: "nd:flex nd:items-center nd:gap-2", children: [
3240
+ /* @__PURE__ */ jsxs("div", { className: "nd:flex nd:items-center nd:gap-2 nd:min-w-0", children: [
3242
3241
  u.status === "error" ? /* @__PURE__ */ jsx(X, { className: "nd:size-4 nd:text-destructive nd:shrink-0" }) : /* @__PURE__ */ jsx(Loader2, { className: "nd:size-4 nd:animate-spin nd:text-muted-foreground nd:shrink-0" }),
3243
- /* @__PURE__ */ jsx("span", { className: "nd:text-sm nd:truncate nd:flex-1", children: u.name }),
3242
+ /* @__PURE__ */ jsx("span", { className: "nd:text-sm nd:truncate nd:flex-1 nd:min-w-0", children: u.name }),
3244
3243
  /* @__PURE__ */ jsx("span", { className: "nd:text-xs nd:text-muted-foreground nd:shrink-0", children: u.status === "error" ? "Failed" : `${Math.round(u.currentChunk / Math.max(1, u.totalChunks) * 100)}%` })
3245
3244
  ] }),
3246
3245
  u.status !== "error" && /* @__PURE__ */ jsx(Progress, { value: Math.round(u.currentChunk / Math.max(1, u.totalChunks) * 100), className: "nd:mt-1.5" }),