@groupeactual/ui-kit 1.7.0-beta.8 → 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.
@@ -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-beta.8",
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-beta.8"
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,7 +104,7 @@ const FileUploader = ({
103
104
  const [uploadFileError, setUploadFileError] = useState<string | boolean>(
104
105
  false,
105
106
  );
106
- const [isInitialized, setIsInitialized] = useState<boolean>(false);
107
+ const [isInitialized, setIsInitialized] = useState(false);
107
108
 
108
109
  // * Refs
109
110
  const fileInputRef = useRef<HTMLInputElement | null>(null);
@@ -316,30 +317,33 @@ const FileUploader = ({
316
317
 
317
318
  // * Initialize the component with the files passed as props
318
319
  useEffect(() => {
319
- const FilesDataDto: FileDataType[] = files.map((file) => ({
320
- name: file.name,
321
- size: Math.round(file.size / 1024), // Convert size to KB
322
- type: file.type,
323
- url: file.url,
324
- }));
325
-
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, {
333
- type: fileData.type,
334
- });
335
- }),
336
- );
337
-
338
- setCurrentFiles(initialFiles); // Now files is a File[] array
339
- };
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
+ };
340
342
 
341
- initializeFiles();
342
- setFilesData(FilesDataDto);
343
+ initializeFiles();
344
+ setFilesData(FilesDataDto);
345
+ setIsInitialized(true);
346
+ }
343
347
  }, [files]);
344
348
 
345
349
  useEffect(() => {
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
+ }