@shipstatic/drop 0.1.13 → 0.1.15

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.cjs CHANGED
@@ -11702,7 +11702,7 @@ var require_mime_db = __commonJS({
11702
11702
  }
11703
11703
  });
11704
11704
 
11705
- // node_modules/.pnpm/@shipstatic+types@0.3.18/node_modules/@shipstatic/types/dist/index.js
11705
+ // node_modules/.pnpm/@shipstatic+types@0.3.21/node_modules/@shipstatic/types/dist/index.js
11706
11706
  var ErrorType;
11707
11707
  (function(ErrorType2) {
11708
11708
  ErrorType2["Validation"] = "validation_failed";
@@ -11814,7 +11814,7 @@ function isZipFile(file) {
11814
11814
  return file.type === "application/zip" || file.type === "application/x-zip-compressed" || file.name.toLowerCase().endsWith(".zip");
11815
11815
  }
11816
11816
  var formatFileSize = ship.formatFileSize;
11817
- async function createProcessedFile(file, options) {
11817
+ function createProcessedFile(file, options) {
11818
11818
  const webkitPath = file.webkitRelativePath || "";
11819
11819
  const path = options?.path || (webkitPath && webkitPath.trim() ? webkitPath : file.name);
11820
11820
  const type = file.type || getMimeType(path);
@@ -11971,9 +11971,7 @@ function useDrop(options) {
11971
11971
  ...prev,
11972
11972
  status: { title: "Processing...", details: "Processing files..." }
11973
11973
  }));
11974
- const processedFiles = await Promise.all(
11975
- cleanFiles.map((file) => createProcessedFile(file))
11976
- );
11974
+ const processedFiles = cleanFiles.map((file) => createProcessedFile(file));
11977
11975
  const finalFiles = stripPrefix ? stripCommonPrefix(processedFiles) : processedFiles;
11978
11976
  const config = await ship$1.getConfig();
11979
11977
  const validation = ship.validateFiles(finalFiles, config);
@@ -12109,15 +12107,16 @@ function useDrop(options) {
12109
12107
  }
12110
12108
  if (files.length > 0) {
12111
12109
  await processFiles(files);
12112
- } else if (state.value === "dragging") {
12113
- setState((prev) => ({ ...prev, value: "idle" }));
12110
+ } else {
12111
+ setState((prev) => prev.value === "dragging" ? { ...prev, value: "idle" } : prev);
12114
12112
  }
12115
- }, [processFiles, state.value]);
12113
+ }, [processFiles]);
12116
12114
  const handleInputChange = react.useCallback((e) => {
12117
12115
  const files = Array.from(e.target.files || []);
12118
12116
  if (files.length > 0) {
12119
12117
  processFiles(files);
12120
12118
  }
12119
+ e.target.value = "";
12121
12120
  }, [processFiles]);
12122
12121
  const open = react.useCallback(() => {
12123
12122
  inputRef.current?.click();