@groupeactual/ui-kit 1.7.0-beta.7 → 1.7.0
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/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.d.ts +56 -1
- package/dist/es/index.js +1 -1
- package/dist/es/index.js.map +1 -1
- package/dist/es/src/index.d.ts +1 -0
- package/dist/es/src/interfaces/theme.d.ts +55 -0
- package/package.json +2 -2
- package/src/components/UploadDocument/FileUploader.tsx +31 -22
- package/src/index.ts +1 -0
- package/src/interfaces/theme.ts +55 -0
package/dist/es/src/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export * from './components';
|
|
|
2
2
|
export { default as DesignSystemProvider } from './DesignSystemProvider';
|
|
3
3
|
export { DesignSystemContext } from './DesignSystemProvider';
|
|
4
4
|
export { type DesignSystemContextValues } from './DesignSystemProvider';
|
|
5
|
+
export { type ThemeDS } from './interfaces/theme';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
interface PaletteDS {
|
|
2
|
+
redActual: string;
|
|
3
|
+
blueClickable: string;
|
|
4
|
+
blueHoverClickable: string;
|
|
5
|
+
greyMediumInactive: string;
|
|
6
|
+
greyXDark: string;
|
|
7
|
+
greyDark: string;
|
|
8
|
+
white: string;
|
|
9
|
+
greyXLight: string;
|
|
10
|
+
greyXDarkBgModal: string;
|
|
11
|
+
blueHoverEquivalence: string;
|
|
12
|
+
blueHoverOpacity12: string;
|
|
13
|
+
greyLightDefaultBorder: string;
|
|
14
|
+
blueInfo: string;
|
|
15
|
+
greenSuccess: string;
|
|
16
|
+
redError: string;
|
|
17
|
+
orangeWarning: string;
|
|
18
|
+
blueDark: string;
|
|
19
|
+
blueMedium: string;
|
|
20
|
+
blueLight: string;
|
|
21
|
+
greenDark: string;
|
|
22
|
+
greenMedium: string;
|
|
23
|
+
green: string;
|
|
24
|
+
brown: string;
|
|
25
|
+
greenLight: string;
|
|
26
|
+
orangeLight: string;
|
|
27
|
+
yellow: string;
|
|
28
|
+
purpleDark: string;
|
|
29
|
+
purple: string;
|
|
30
|
+
pink: string;
|
|
31
|
+
pinkLight: string;
|
|
32
|
+
primary: {
|
|
33
|
+
main: string;
|
|
34
|
+
dark: string;
|
|
35
|
+
};
|
|
36
|
+
secondary: {
|
|
37
|
+
main: string;
|
|
38
|
+
};
|
|
39
|
+
success: {
|
|
40
|
+
main: string;
|
|
41
|
+
};
|
|
42
|
+
error: {
|
|
43
|
+
main: string;
|
|
44
|
+
};
|
|
45
|
+
warning: {
|
|
46
|
+
main: string;
|
|
47
|
+
};
|
|
48
|
+
infos: {
|
|
49
|
+
main: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface ThemeDS {
|
|
53
|
+
palette: PaletteDS;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groupeactual/ui-kit",
|
|
3
|
-
"version": "1.7.0
|
|
3
|
+
"version": "1.7.0",
|
|
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
|
|
60
|
+
"@groupeactual/design-tokens": "1.7.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "rollup -c",
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from '@fortawesome/pro-solid-svg-icons';
|
|
23
23
|
import { Box, IconButton } from '@mui/material';
|
|
24
24
|
import Menu from '@mui/material/Menu';
|
|
25
|
+
import { set } from 'lodash';
|
|
25
26
|
|
|
26
27
|
import Button from '@/components/Button';
|
|
27
28
|
import IconProvider from '@/components/IconProvider';
|
|
@@ -103,6 +104,7 @@ const FileUploader = ({
|
|
|
103
104
|
const [uploadFileError, setUploadFileError] = useState<string | boolean>(
|
|
104
105
|
false,
|
|
105
106
|
);
|
|
107
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
106
108
|
|
|
107
109
|
// * Refs
|
|
108
110
|
const fileInputRef = useRef<HTMLInputElement | null>(null);
|
|
@@ -315,32 +317,39 @@ const FileUploader = ({
|
|
|
315
317
|
|
|
316
318
|
// * Initialize the component with the files passed as props
|
|
317
319
|
useEffect(() => {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
320
|
+
if (!isInitialized && files.length > 0) {
|
|
321
|
+
const FilesDataDto: FileDataType[] = files.map((file) => ({
|
|
322
|
+
name: file.name,
|
|
323
|
+
size: Math.round(file.size / 1024), // Convert size to KB
|
|
324
|
+
type: file.type,
|
|
325
|
+
url: file.url,
|
|
326
|
+
}));
|
|
327
|
+
|
|
328
|
+
const initializeFiles = async () => {
|
|
329
|
+
const initialFiles = await Promise.all(
|
|
330
|
+
FilesDataDto.map(async (fileData) => {
|
|
331
|
+
const response = await fetch(fileData.url);
|
|
332
|
+
const blob = await response.blob();
|
|
333
|
+
|
|
334
|
+
return new File([blob], fileData.name, {
|
|
335
|
+
type: fileData.type,
|
|
336
|
+
});
|
|
337
|
+
}),
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
setCurrentFiles(initialFiles); // Now files is a File[] array
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
initializeFiles();
|
|
344
|
+
setFilesData(FilesDataDto);
|
|
345
|
+
setIsInitialized(true);
|
|
346
|
+
}
|
|
347
|
+
}, [files]);
|
|
339
348
|
|
|
340
349
|
useEffect(() => {
|
|
341
350
|
// * Notify parent component
|
|
342
351
|
onFilesDataChange?.(filesData, currentFiles);
|
|
343
|
-
}, [filesData]);
|
|
352
|
+
}, [filesData, currentFiles]);
|
|
344
353
|
|
|
345
354
|
useEffect(() => {
|
|
346
355
|
return () => {
|
package/src/index.ts
CHANGED
|
@@ -2,3 +2,4 @@ export * from './components';
|
|
|
2
2
|
export { default as DesignSystemProvider } from './DesignSystemProvider';
|
|
3
3
|
export { DesignSystemContext } from './DesignSystemProvider';
|
|
4
4
|
export { type DesignSystemContextValues } from './DesignSystemProvider';
|
|
5
|
+
export { type ThemeDS } from './interfaces/theme';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
interface PaletteDS {
|
|
2
|
+
redActual: string;
|
|
3
|
+
blueClickable: string;
|
|
4
|
+
blueHoverClickable: string;
|
|
5
|
+
greyMediumInactive: string;
|
|
6
|
+
greyXDark: string;
|
|
7
|
+
greyDark: string;
|
|
8
|
+
white: string;
|
|
9
|
+
greyXLight: string;
|
|
10
|
+
greyXDarkBgModal: string;
|
|
11
|
+
blueHoverEquivalence: string;
|
|
12
|
+
blueHoverOpacity12: string;
|
|
13
|
+
greyLightDefaultBorder: string;
|
|
14
|
+
blueInfo: string;
|
|
15
|
+
greenSuccess: string;
|
|
16
|
+
redError: string;
|
|
17
|
+
orangeWarning: string;
|
|
18
|
+
blueDark: string;
|
|
19
|
+
blueMedium: string;
|
|
20
|
+
blueLight: string;
|
|
21
|
+
greenDark: string;
|
|
22
|
+
greenMedium: string;
|
|
23
|
+
green: string;
|
|
24
|
+
brown: string;
|
|
25
|
+
greenLight: string;
|
|
26
|
+
orangeLight: string;
|
|
27
|
+
yellow: string;
|
|
28
|
+
purpleDark: string;
|
|
29
|
+
purple: string;
|
|
30
|
+
pink: string;
|
|
31
|
+
pinkLight: string;
|
|
32
|
+
primary: {
|
|
33
|
+
main: string;
|
|
34
|
+
dark: string;
|
|
35
|
+
};
|
|
36
|
+
secondary: {
|
|
37
|
+
main: string;
|
|
38
|
+
};
|
|
39
|
+
success: {
|
|
40
|
+
main: string;
|
|
41
|
+
};
|
|
42
|
+
error: {
|
|
43
|
+
main: string;
|
|
44
|
+
};
|
|
45
|
+
warning: {
|
|
46
|
+
main: string;
|
|
47
|
+
};
|
|
48
|
+
infos: {
|
|
49
|
+
main: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ThemeDS {
|
|
54
|
+
palette: PaletteDS;
|
|
55
|
+
}
|