optimized-react-component-library-xyz123 0.19.10 → 0.19.12

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
@@ -620,7 +620,10 @@ var SelectedFiles = ({
620
620
  let newFiles = questionObject.files.filter((f) => f !== file);
621
621
  const newCountOfFiles = newFiles.length;
622
622
  setNumberOfFiles(newCountOfFiles);
623
- const e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
623
+ let e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
624
+ const targetValue = e.target.value === "0 files" ? "" : e.target.value;
625
+ e = { ...e, target: { ...e.target, value: targetValue } };
626
+ console.log("Removing file, new e:", JSON.stringify(e));
624
627
  isTouched(e, questionObject);
625
628
  removeFile(newCountOfFiles);
626
629
  };
@@ -906,17 +909,19 @@ var AddFiles = ({
906
909
  });
907
910
  };
908
911
  useEffect5(() => {
912
+ let e;
909
913
  if (newFiles.length > 0) {
910
914
  const currentFiles = questionObject.files ? questionObject.files : [];
911
- const e = {
915
+ e = {
912
916
  target: {
913
917
  value: currentFiles.length + newFiles.length > 0 ? `${currentFiles.length + newFiles.length} files` : "",
914
918
  files: [...currentFiles, ...newFiles]
915
919
  }
916
920
  };
917
- if (e.target.value === "0 files") {
918
- e.target.value = "";
919
- }
921
+ console.log("Files added 1:", JSON.stringify(e));
922
+ const targetValue = e.target.value === "0 files" ? "" : e.target.value;
923
+ e = { ...e, target: { ...e.target, value: targetValue } };
924
+ console.log("Files added 2:", JSON.stringify(e));
920
925
  handleQuestionInputChange(e, questionObject);
921
926
  setNumberOfFiles(currentFiles.length + newFiles.length);
922
927
  setNewFiles([]);