@groupeactual/ui-kit 1.7.0-beta.7 → 1.7.0-beta.8
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groupeactual/ui-kit",
|
|
3
|
-
"version": "1.7.0-beta.
|
|
3
|
+
"version": "1.7.0-beta.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A simple template for a custom React component library",
|
|
6
6
|
"devDependencies": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"react-dom": "^18.3.1",
|
|
58
58
|
"react-google-picker": "^0.1.0",
|
|
59
59
|
"react-dropzone": "^14.3.5",
|
|
60
|
-
"@groupeactual/design-tokens": "1.7.0-beta.
|
|
60
|
+
"@groupeactual/design-tokens": "1.7.0-beta.8"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "rollup -c",
|
|
@@ -103,6 +103,7 @@ const FileUploader = ({
|
|
|
103
103
|
const [uploadFileError, setUploadFileError] = useState<string | boolean>(
|
|
104
104
|
false,
|
|
105
105
|
);
|
|
106
|
+
const [isInitialized, setIsInitialized] = useState<boolean>(false);
|
|
106
107
|
|
|
107
108
|
// * Refs
|
|
108
109
|
const fileInputRef = useRef<HTMLInputElement | null>(null);
|
|
@@ -322,25 +323,29 @@ const FileUploader = ({
|
|
|
322
323
|
url: file.url,
|
|
323
324
|
}));
|
|
324
325
|
|
|
325
|
-
const
|
|
326
|
-
(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
326
|
+
const initializeFiles = async () => {
|
|
327
|
+
const initialFiles = await Promise.all(
|
|
328
|
+
FilesDataDto.map(async (fileData) => {
|
|
329
|
+
const response = await fetch(fileData.url);
|
|
330
|
+
const blob = await response.blob();
|
|
331
|
+
|
|
332
|
+
return new File([blob], fileData.name, {
|
|
331
333
|
type: fileData.type,
|
|
332
|
-
}
|
|
333
|
-
),
|
|
334
|
-
|
|
334
|
+
});
|
|
335
|
+
}),
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
setCurrentFiles(initialFiles); // Now files is a File[] array
|
|
339
|
+
};
|
|
335
340
|
|
|
336
|
-
|
|
341
|
+
initializeFiles();
|
|
337
342
|
setFilesData(FilesDataDto);
|
|
338
|
-
}, []);
|
|
343
|
+
}, [files]);
|
|
339
344
|
|
|
340
345
|
useEffect(() => {
|
|
341
346
|
// * Notify parent component
|
|
342
347
|
onFilesDataChange?.(filesData, currentFiles);
|
|
343
|
-
}, [filesData]);
|
|
348
|
+
}, [filesData, currentFiles]);
|
|
344
349
|
|
|
345
350
|
useEffect(() => {
|
|
346
351
|
return () => {
|