@campxdev/react-blueprint 1.7.2 → 1.7.4
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/export.ts +1 -0
- package/package.json +1 -1
- package/src/assets/export.ts +2 -0
- package/src/assets/fonts/export.ts +2 -0
- package/src/assets/images/export.ts +2 -0
- package/src/assets/images/gif/index.ts +1 -1
- package/src/assets/images/svg/index.ts +12 -12
- package/src/components/Assets/ErrorPages/InternalServerError.tsx +5 -5
- package/src/components/Assets/ErrorPages/NoInternetConnection.tsx +5 -5
- package/src/components/Assets/ErrorPages/NoItemFound.tsx +6 -5
- package/src/components/Assets/ErrorPages/PageNotFound.tsx +5 -5
- package/src/components/Assets/ErrorPages/UnAuthorized.tsx +5 -5
- package/src/components/Assets/ErrorPages/styles.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CautionIcon.tsx +37 -0
- package/src/components/Assets/Icons/IconComponents/ClearIcon.tsx +37 -0
- package/src/components/Assets/Icons/IconComponents/DoneSquare.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/DownArrow.tsx +32 -0
- package/src/components/Assets/Icons/IconComponents/LIneDivider.tsx +23 -0
- package/src/components/Assets/Icons/IconComponents/PrintDesignerIcon.tsx +47 -0
- package/src/components/Assets/Icons/IconComponents/RedirectIcon.tsx +15 -7
- package/src/components/Assets/Icons/IconComponents/SettlementsIcon.tsx +53 -0
- package/src/components/Assets/Icons/Icons.tsx +12 -0
- package/src/components/DataDisplay/ActivityLogView/ActivityLogView.tsx +2 -2
- package/src/components/DataDisplay/ActivityLogView/service.tsx +1 -19
- package/src/components/DataDisplay/DataTable/DataTable.tsx +62 -39
- package/src/components/DataDisplay/DataTable/TablePagination.tsx +20 -12
- package/src/components/DataDisplay/EmptyIllustration/EmptyIllustration.tsx +40 -0
- package/src/components/DataDisplay/export.ts +1 -0
- package/src/components/Feedback/Alert/Alert.tsx +2 -3
- package/src/components/Feedback/Spinner/Spinner.css +13 -25
- package/src/components/Input/RadioGroup/RadioGroup.tsx +6 -2
- package/src/components/Input/SearchBar/SearchBar.tsx +17 -14
- package/src/components/Input/SingleSelect/SingleSelect.tsx +2 -1
- package/src/components/Input/SingleSelect/components/MenuFooter.tsx +24 -0
- package/src/components/Input/SingleSelect/components/OptionsLoader.tsx +14 -0
- package/src/components/Input/SingleSelect/components/SingleFilter.tsx +69 -62
- package/src/components/Input/SingleSelect/components/SingleInput.tsx +45 -18
- package/src/components/Input/TextField/TextField.tsx +4 -1
- package/src/components/Input/styles.tsx +5 -5
- package/src/components/Layout/PageContent/PageContent.tsx +4 -3
- package/src/components/Layout/PageHeader/PageHeader.tsx +22 -69
- package/src/components/Layout/PageHeader/components/SearchBar.tsx +69 -26
- package/src/components/Layout/PageHeader/components/TableColumnsSelector/TableColumnsSelector.tsx +125 -23
- package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +1 -0
- package/src/components/Navigation/ConfirmDialog/ConfirmDialog.tsx +3 -3
- package/src/components/Navigation/DropDownMenu/DropDownMenu.tsx +2 -2
- package/src/components/Navigation/PreviewFiles/PreviewFiles.tsx +56 -81
- package/src/components/Navigation/Sidebar/styles.tsx +2 -1
- package/src/components/Navigation/TabsContainer/TabsContainer.tsx +1 -1
- package/src/components/Navigation/UploadDialog/LoadingUploadDialogContainer.tsx +3 -3
- package/src/components/Navigation/UploadDialog/UploadDialog.tsx +46 -33
- package/src/components/Navigation/UploadDialog/UploadDialogContainer.tsx +2 -2
- package/src/redux/slices/pageHeaderSlice.ts +4 -1
- package/src/stories/Navigation/PreviewFiles.stories.tsx +43 -9
- package/src/themes/commonTheme.ts +30 -5
- package/src/themes/customCssBaseline.ts +3 -2
- package/src/components/DataDisplay/styles.tsx +0 -6
- package/src/components/Input/components/OptionsLoader.tsx +0 -22
- /package/src/assets/images/svg/{Emptylistmage.svg → empty.svg} +0 -0
- /package/src/assets/images/svg/{error-cactus.svg → error-image.svg} +0 -0
- /package/src/assets/images/svg/{Internalserverimage.svg → server-error.svg} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Box, Stack, useTheme } from '@mui/material';
|
|
2
|
-
import {
|
|
2
|
+
import { AnimatedGIFs } from '../../../assets/images/gif';
|
|
3
3
|
import { Button, Dialog, Typography } from '../../export';
|
|
4
4
|
|
|
5
5
|
export type ConfirmDialogType = 'confirm' | 'delete';
|
|
@@ -41,8 +41,8 @@ export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
|
|
41
41
|
<img
|
|
42
42
|
src={
|
|
43
43
|
type === 'delete'
|
|
44
|
-
?
|
|
45
|
-
:
|
|
44
|
+
? AnimatedGIFs.DeleteConfirmationAlert
|
|
45
|
+
: AnimatedGIFs.ConfirmationAlert
|
|
46
46
|
}
|
|
47
47
|
alt="Animated GIF"
|
|
48
48
|
style={{ width: '80px' }}
|
|
@@ -84,8 +84,8 @@ export const DropdownMenu = ({
|
|
|
84
84
|
sx={{
|
|
85
85
|
...menuListContainerSx,
|
|
86
86
|
'&::-webkit-scrollbar': {
|
|
87
|
-
width: '0.
|
|
88
|
-
height: '0.
|
|
87
|
+
width: '0.2em',
|
|
88
|
+
height: '0.2em',
|
|
89
89
|
},
|
|
90
90
|
'&::-webkit-scrollbar-thumb': {
|
|
91
91
|
backgroundColor: theme.palette.surface.paperBackground,
|
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Box,
|
|
3
3
|
BoxProps,
|
|
4
|
-
IconButton,
|
|
5
4
|
Stack,
|
|
6
5
|
styled,
|
|
7
6
|
Typography,
|
|
8
7
|
useTheme,
|
|
9
8
|
} from '@mui/material';
|
|
10
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
11
|
-
import {
|
|
12
|
-
import { DeleteIcon } from '../../Assets/Icons/IconComponents/DeleteIcon';
|
|
13
|
-
import { DocumentIcon } from '../../Assets/Icons/IconComponents/DocumentIcon';
|
|
14
|
-
import { ExcelIcon } from '../../Assets/Icons/IconComponents/ExcelIcon';
|
|
15
|
-
import { ImageIcon } from '../../Assets/Icons/IconComponents/ImageIcon';
|
|
16
|
-
import { PdfIcon } from '../../Assets/Icons/IconComponents/PdfIcon';
|
|
9
|
+
import { FC, ReactNode, useCallback, useMemo, useState } from 'react';
|
|
10
|
+
import { Icons } from '../../export';
|
|
17
11
|
|
|
18
12
|
export type PreviewFilesProps = {
|
|
19
13
|
files: File[] | File | null;
|
|
20
14
|
label?: string;
|
|
21
|
-
|
|
22
|
-
| React.Dispatch<React.SetStateAction<File | null>>
|
|
23
|
-
| React.Dispatch<React.SetStateAction<File[]>>;
|
|
15
|
+
actions?: (file: File) => ReactNode;
|
|
24
16
|
} & BoxProps;
|
|
25
17
|
|
|
26
18
|
export const PreviewFiles = ({
|
|
27
19
|
files,
|
|
28
20
|
label,
|
|
29
|
-
|
|
21
|
+
actions,
|
|
30
22
|
...props
|
|
31
23
|
}: PreviewFilesProps) => {
|
|
32
24
|
const theme = useTheme();
|
|
@@ -40,71 +32,22 @@ export const PreviewFiles = ({
|
|
|
40
32
|
const handleFilePreview = useCallback(
|
|
41
33
|
(file: File) => {
|
|
42
34
|
if (previews[file.name]) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
);
|
|
35
|
+
// Use the existing blob URL from the previews state
|
|
36
|
+
const url = previews[file.name];
|
|
37
|
+
window.open(url, '_blank')?.focus();
|
|
47
38
|
} else {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
window.open(url, '_blank')?.focus();
|
|
56
|
-
};
|
|
57
|
-
reader.readAsDataURL(file);
|
|
39
|
+
// Create a new blob URL for the file
|
|
40
|
+
const url = URL.createObjectURL(file);
|
|
41
|
+
setPreviews((prev) => ({
|
|
42
|
+
...prev,
|
|
43
|
+
[file.name]: url, // Save the blob URL in the previews state
|
|
44
|
+
}));
|
|
45
|
+
window.open(url, '_blank')?.focus();
|
|
58
46
|
}
|
|
59
47
|
},
|
|
60
48
|
[previews],
|
|
61
49
|
);
|
|
62
50
|
|
|
63
|
-
const handleDelete =
|
|
64
|
-
(fileToDelete: File) => (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
65
|
-
event.stopPropagation();
|
|
66
|
-
if (setFiles) {
|
|
67
|
-
if (Array.isArray(files)) {
|
|
68
|
-
(setFiles as React.Dispatch<React.SetStateAction<File[]>>)(
|
|
69
|
-
(prevFiles) => prevFiles.filter((file) => file !== fileToDelete),
|
|
70
|
-
);
|
|
71
|
-
} else {
|
|
72
|
-
(setFiles as React.Dispatch<React.SetStateAction<File | null>>)(null);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
setPreviews((prev) => {
|
|
76
|
-
const newPreviews = { ...prev };
|
|
77
|
-
delete newPreviews[fileToDelete.name];
|
|
78
|
-
return newPreviews;
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const getFileIcon = (file: File) => {
|
|
83
|
-
const fileTypeMap: Record<string, React.ElementType> = {
|
|
84
|
-
'image/': ImageIcon,
|
|
85
|
-
'application/pdf': PdfIcon,
|
|
86
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
87
|
-
ExcelIcon,
|
|
88
|
-
'application/vnd.ms-excel': ExcelIcon,
|
|
89
|
-
'application/msword': DocumentIcon,
|
|
90
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
91
|
-
DocumentIcon,
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const IconComponent =
|
|
95
|
-
Object.entries(fileTypeMap).find(([key]) =>
|
|
96
|
-
file.type.startsWith(key),
|
|
97
|
-
)?.[1] || AttachmentIcon;
|
|
98
|
-
return <IconComponent fontSize="large" />;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const formatFileSize = (size: number) => {
|
|
102
|
-
if (size < 1024) return `${size} bytes`;
|
|
103
|
-
if (size < 1048576) return `${(size / 1024).toFixed(2)} KB`;
|
|
104
|
-
if (size < 1073741824) return `${(size / 1048576).toFixed(2)} MB`;
|
|
105
|
-
return `${(size / 1073741824).toFixed(2)} GB`;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
51
|
if (fileArray.length === 0) return null;
|
|
109
52
|
|
|
110
53
|
return (
|
|
@@ -120,31 +63,35 @@ export const PreviewFiles = ({
|
|
|
120
63
|
</Typography>
|
|
121
64
|
)}
|
|
122
65
|
{fileArray.map((file, index) => (
|
|
123
|
-
<PreviewContainer
|
|
124
|
-
key={file.name + file.lastModified}
|
|
125
|
-
onClick={() => handleFilePreview(file)}
|
|
126
|
-
>
|
|
66
|
+
<PreviewContainer key={index} onClick={() => handleFilePreview(file)}>
|
|
127
67
|
<Stack
|
|
128
68
|
direction={'row'}
|
|
129
|
-
sx={{ display: 'flex', alignItems: 'center' }}
|
|
69
|
+
sx={{ display: 'flex', alignItems: 'center', gap: '12px' }}
|
|
130
70
|
>
|
|
131
71
|
{getFileIcon(file)}
|
|
132
72
|
<Stack direction={'column'} marginLeft={'8px'}>
|
|
133
73
|
<Typography
|
|
134
74
|
fontSize={'14px'}
|
|
135
75
|
color={theme.palette.primary.main}
|
|
136
|
-
variant="
|
|
76
|
+
variant="label2"
|
|
137
77
|
>
|
|
138
78
|
{file.name}
|
|
139
79
|
</Typography>
|
|
140
|
-
<Typography color={theme.palette.text.tertiary} variant="
|
|
80
|
+
<Typography color={theme.palette.text.tertiary} variant="caption">
|
|
141
81
|
{formatFileSize(file.size)}
|
|
142
82
|
</Typography>
|
|
143
83
|
</Stack>
|
|
144
84
|
</Stack>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
85
|
+
|
|
86
|
+
{actions && (
|
|
87
|
+
<Box
|
|
88
|
+
onClick={(event: React.MouseEvent<HTMLDivElement>) => {
|
|
89
|
+
event.stopPropagation();
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{actions(file)}
|
|
93
|
+
</Box>
|
|
94
|
+
)}
|
|
148
95
|
</PreviewContainer>
|
|
149
96
|
))}
|
|
150
97
|
</Box>
|
|
@@ -163,3 +110,31 @@ const PreviewContainer = styled(Box)(({ theme }) => ({
|
|
|
163
110
|
alignItems: 'center',
|
|
164
111
|
marginBottom: '8px',
|
|
165
112
|
}));
|
|
113
|
+
|
|
114
|
+
const formatFileSize = (size: number) => {
|
|
115
|
+
if (size < 1024) return `${size} bytes`;
|
|
116
|
+
if (size < 1048576) return `${(size / 1024).toFixed(2)} KB`;
|
|
117
|
+
if (size < 1073741824) return `${(size / 1048576).toFixed(2)} MB`;
|
|
118
|
+
return `${(size / 1073741824).toFixed(2)} GB`;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type IconWithSize = FC<{ size?: number }>;
|
|
122
|
+
|
|
123
|
+
const getFileIcon = (file: File) => {
|
|
124
|
+
const fileTypeMap: Record<string, IconWithSize> = {
|
|
125
|
+
'image/': Icons.ImageIcon,
|
|
126
|
+
'application/pdf': Icons.PdfIcon,
|
|
127
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
|
128
|
+
Icons.ExcelIcon,
|
|
129
|
+
'application/vnd.ms-excel': Icons.ExcelIcon,
|
|
130
|
+
'application/msword': Icons.DocumentIcon,
|
|
131
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
132
|
+
Icons.DocumentIcon,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const IconComponent =
|
|
136
|
+
Object.entries(fileTypeMap).find(([key]) =>
|
|
137
|
+
file.type.startsWith(key),
|
|
138
|
+
)?.[1] || Icons.AttachmentIcon;
|
|
139
|
+
return <IconComponent size={30} />;
|
|
140
|
+
};
|
|
@@ -13,6 +13,7 @@ export const createSidebarStyles = (collapsed: boolean) => {
|
|
|
13
13
|
return {
|
|
14
14
|
backgroundColor: theme.palette.surface.defaultBackground,
|
|
15
15
|
height: '100%',
|
|
16
|
+
width: collapsed ? '60px' : '250px',
|
|
16
17
|
justifyContent: 'space-between',
|
|
17
18
|
overflow: 'hidden',
|
|
18
19
|
};
|
|
@@ -57,7 +58,7 @@ export const createSidebarStyles = (collapsed: boolean) => {
|
|
|
57
58
|
display: 'flex',
|
|
58
59
|
alignItems: 'center',
|
|
59
60
|
justifyContent: collapsed ? 'center' : 'flex-start',
|
|
60
|
-
padding: '
|
|
61
|
+
padding: '16px 8px',
|
|
61
62
|
borderRadius: '8px',
|
|
62
63
|
backgroundColor: theme.palette.surface.paperBackground,
|
|
63
64
|
}),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Typography, useTheme } from '@mui/material';
|
|
2
|
-
import {
|
|
2
|
+
import { AnimatedGIFs } from '../../../assets/images/gif';
|
|
3
3
|
import { ImageContainer, UploadDialogBox } from './Styles';
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const LoadingUploadDialogContainer = () => {
|
|
6
6
|
const theme = useTheme();
|
|
7
7
|
return (
|
|
8
8
|
<UploadDialogBox dragging={false}>
|
|
9
9
|
<ImageContainer
|
|
10
|
-
src={
|
|
10
|
+
src={AnimatedGIFs.UploadingFile}
|
|
11
11
|
alt={'Import animation'}
|
|
12
12
|
/>
|
|
13
13
|
<Typography
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Divider, Stack } from '@mui/material';
|
|
1
|
+
import { Box, Divider, IconButton, Stack } from '@mui/material';
|
|
2
2
|
import { ReactNode, useEffect, useState } from 'react';
|
|
3
|
-
import { Button } from '../../export';
|
|
3
|
+
import { Button, Icons } from '../../export';
|
|
4
4
|
import { Dialog, DialogProps } from '../export';
|
|
5
5
|
import { PreviewFiles } from '../PreviewFiles/PreviewFiles';
|
|
6
|
-
import {
|
|
6
|
+
import { LoadingUploadDialogContainer } from './LoadingUploadDialogContainer';
|
|
7
7
|
import { UploadDialogContainer } from './UploadDialogContainer';
|
|
8
8
|
|
|
9
9
|
export type UploadDialogProps = {
|
|
@@ -42,6 +42,13 @@ export const UploadDialog = ({
|
|
|
42
42
|
setOpen(true);
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
const handleDelete = (fileToDelete: File) => {
|
|
46
|
+
setFile((prevFile) => {
|
|
47
|
+
if (!prevFile) return null;
|
|
48
|
+
return prevFile === fileToDelete ? null : prevFile;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
45
52
|
const handleUpload = async (close: () => void) => {
|
|
46
53
|
if (file) {
|
|
47
54
|
try {
|
|
@@ -55,6 +62,12 @@ export const UploadDialog = ({
|
|
|
55
62
|
}
|
|
56
63
|
};
|
|
57
64
|
|
|
65
|
+
const Actions = ({ file }: { file: File }) => (
|
|
66
|
+
<IconButton onClick={() => handleDelete(file)}>
|
|
67
|
+
<Icons.DeleteIcon />
|
|
68
|
+
</IconButton>
|
|
69
|
+
);
|
|
70
|
+
|
|
58
71
|
useEffect(() => {
|
|
59
72
|
setUploading(loading);
|
|
60
73
|
}, [loading]);
|
|
@@ -78,42 +91,41 @@ export const UploadDialog = ({
|
|
|
78
91
|
content={({ close }: { close: () => void }) => {
|
|
79
92
|
return (
|
|
80
93
|
<>
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
<Box sx={{ padding: '12px 16px' }}>
|
|
95
|
+
{uploading ? (
|
|
96
|
+
<LoadingUploadDialogContainer />
|
|
97
|
+
) : (
|
|
98
|
+
<UploadDialogContainer
|
|
99
|
+
setFile={setFile}
|
|
100
|
+
acceptFileType={acceptFileType}
|
|
101
|
+
/>
|
|
102
|
+
)}
|
|
89
103
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/>
|
|
110
|
-
)}
|
|
104
|
+
<Box sx={{ marginTop: '12px' }}>
|
|
105
|
+
{sampleFileUrl && (
|
|
106
|
+
<a href={sampleFileUrl} target="_blank" rel="noreferrer">
|
|
107
|
+
<Button color="secondary" fullWidth variant="contained">
|
|
108
|
+
Download Sample File
|
|
109
|
+
</Button>
|
|
110
|
+
</a>
|
|
111
|
+
)}
|
|
112
|
+
</Box>
|
|
113
|
+
{file && !uploading && (
|
|
114
|
+
<PreviewFiles
|
|
115
|
+
sx={{ marginTop: '16px' }}
|
|
116
|
+
key={file.name + file.lastModified}
|
|
117
|
+
files={file}
|
|
118
|
+
label="Selected Files"
|
|
119
|
+
actions={(file) => <Actions file={file} />}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
</Box>
|
|
111
123
|
<Divider
|
|
112
124
|
component="div"
|
|
113
125
|
variant="fullWidth"
|
|
114
126
|
orientation="horizontal"
|
|
115
127
|
/>
|
|
116
|
-
<Stack direction={'row'} gap={2} padding={'12px
|
|
128
|
+
<Stack direction={'row'} gap={2} padding={'12px 16px'}>
|
|
117
129
|
<Button
|
|
118
130
|
variant="contained"
|
|
119
131
|
disabled={!file || uploading}
|
|
@@ -128,6 +140,7 @@ export const UploadDialog = ({
|
|
|
128
140
|
setFile(null);
|
|
129
141
|
close();
|
|
130
142
|
}}
|
|
143
|
+
disableRipple
|
|
131
144
|
>
|
|
132
145
|
Cancel
|
|
133
146
|
</Button>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FormLabel, Typography, useTheme } from '@mui/material';
|
|
2
2
|
import React, { useCallback, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { AnimatedGIFs } from '../../../assets/images/gif';
|
|
4
4
|
import { ImageContainer, UploadDialogBox } from './Styles';
|
|
5
5
|
|
|
6
6
|
export const UploadDialogContainer = ({
|
|
@@ -50,7 +50,7 @@ export const UploadDialogContainer = ({
|
|
|
50
50
|
dragging={dragging}
|
|
51
51
|
>
|
|
52
52
|
<ImageContainer
|
|
53
|
-
src={
|
|
53
|
+
src={AnimatedGIFs.UploadFile}
|
|
54
54
|
alt={'Import animation'}
|
|
55
55
|
/>
|
|
56
56
|
<Typography
|
|
@@ -29,7 +29,10 @@ export const pageHeaderSlice = createSlice({
|
|
|
29
29
|
},
|
|
30
30
|
setDensityForUniqueId: (state, action) => {
|
|
31
31
|
const { uniqueId, density } = action.payload;
|
|
32
|
-
state[uniqueId] = {
|
|
32
|
+
state[uniqueId] = {
|
|
33
|
+
...state[uniqueId],
|
|
34
|
+
density,
|
|
35
|
+
};
|
|
33
36
|
},
|
|
34
37
|
setSearchForUniqueId: (state, action) => {
|
|
35
38
|
const { uniqueId, search } = action.payload;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { Box } from '@mui/material';
|
|
1
|
+
import { Box, IconButton } from '@mui/material';
|
|
2
2
|
import { Meta, StoryFn } from '@storybook/react';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Icons,
|
|
6
|
+
PreviewFiles,
|
|
7
|
+
PreviewFilesProps,
|
|
8
|
+
} from '../../components/export';
|
|
5
9
|
|
|
6
10
|
export default {
|
|
7
11
|
title: 'Navigation/PreviewFiles',
|
|
@@ -40,17 +44,47 @@ const txtFile = createTestFile('notes.txt', 'text/plain', 10 * 1024);
|
|
|
40
44
|
const Template: StoryFn<PreviewFilesProps> = (args) => {
|
|
41
45
|
const [files, setFiles] = useState<PreviewFilesProps['files']>(args.files);
|
|
42
46
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const Actions = ({ file }: { file: File }) => {
|
|
48
|
+
const handleDownload = (file: File) => {
|
|
49
|
+
const url = URL.createObjectURL(file);
|
|
50
|
+
const a = document.createElement('a');
|
|
51
|
+
a.href = url;
|
|
52
|
+
a.download = file.name;
|
|
53
|
+
document.body.appendChild(a);
|
|
54
|
+
a.click();
|
|
55
|
+
document.body.removeChild(a);
|
|
56
|
+
URL.revokeObjectURL(url);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleDelete = (fileToDelete: File) => {
|
|
60
|
+
setFiles((prevFiles) => {
|
|
61
|
+
if (!prevFiles) return null;
|
|
62
|
+
if (Array.isArray(prevFiles)) {
|
|
63
|
+
return prevFiles.filter((file) => file !== fileToDelete);
|
|
64
|
+
}
|
|
65
|
+
return prevFiles === fileToDelete ? null : prevFiles;
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<>
|
|
71
|
+
<IconButton onClick={() => handleDownload(file)}>
|
|
72
|
+
<Icons.DownloadIcon />
|
|
73
|
+
</IconButton>
|
|
74
|
+
<IconButton onClick={() => handleDelete(file)}>
|
|
75
|
+
<Icons.DeleteIcon />
|
|
76
|
+
</IconButton>
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
49
79
|
};
|
|
50
80
|
|
|
51
81
|
return (
|
|
52
82
|
<Box sx={{ width: '400px', padding: '20px' }}>
|
|
53
|
-
<PreviewFiles
|
|
83
|
+
<PreviewFiles
|
|
84
|
+
{...args}
|
|
85
|
+
files={files}
|
|
86
|
+
actions={(file) => <Actions file={file} />}
|
|
87
|
+
/>
|
|
54
88
|
</Box>
|
|
55
89
|
);
|
|
56
90
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Components } from '@mui/material';
|
|
2
2
|
import { TypographyOptions } from '@mui/material/styles/createTypography';
|
|
3
|
+
import type {} from '@mui/x-data-grid/themeAugmentation';
|
|
3
4
|
import { DarkColorTokens } from './colorTokens/darkColorTokens';
|
|
4
5
|
import { LightColorTokens } from './colorTokens/lightColorTokens';
|
|
5
6
|
import { customCssBaseline } from './customCssBaseline';
|
|
@@ -39,6 +40,21 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
39
40
|
},
|
|
40
41
|
},
|
|
41
42
|
},
|
|
43
|
+
MuiDataGrid: {
|
|
44
|
+
styleOverrides: {
|
|
45
|
+
root: {
|
|
46
|
+
backgroundColor: ColorTokens.surface.paperBackground,
|
|
47
|
+
border: 'none',
|
|
48
|
+
height: '100%',
|
|
49
|
+
minHeight: 'calc(100vh - 292px)',
|
|
50
|
+
maxHeight: 'calc(100vh - 232px)',
|
|
51
|
+
'& .MuiDataGrid-columnHeader': {
|
|
52
|
+
backgroundColor: ColorTokens.surface.grey,
|
|
53
|
+
height: '48px !important',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
42
58
|
MuiTimelineContent: {
|
|
43
59
|
styleOverrides: {
|
|
44
60
|
root: {
|
|
@@ -206,7 +222,7 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
206
222
|
height: '4px',
|
|
207
223
|
borderRadius: '10px',
|
|
208
224
|
backgroundColor: ColorTokens.tertiary.main,
|
|
209
|
-
margin: '
|
|
225
|
+
margin: '6px',
|
|
210
226
|
minWidth: '4px',
|
|
211
227
|
},
|
|
212
228
|
},
|
|
@@ -259,7 +275,7 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
259
275
|
styleOverrides: {
|
|
260
276
|
list: {
|
|
261
277
|
minWidth: '240px',
|
|
262
|
-
padding:
|
|
278
|
+
padding: '8px',
|
|
263
279
|
'& > :last-child': {
|
|
264
280
|
borderBottom: 'none',
|
|
265
281
|
'& li': {
|
|
@@ -286,13 +302,15 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
286
302
|
MuiMenuItem: {
|
|
287
303
|
styleOverrides: {
|
|
288
304
|
root: {
|
|
289
|
-
minHeight: '
|
|
290
|
-
padding: '
|
|
305
|
+
minHeight: '40px !important',
|
|
306
|
+
padding: '8px 12px',
|
|
291
307
|
},
|
|
292
308
|
},
|
|
293
309
|
},
|
|
294
310
|
MuiPagination: {
|
|
295
|
-
styleOverrides: {
|
|
311
|
+
styleOverrides: {
|
|
312
|
+
root: {},
|
|
313
|
+
},
|
|
296
314
|
},
|
|
297
315
|
MuiPaginationItem: {
|
|
298
316
|
styleOverrides: {
|
|
@@ -458,8 +476,15 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
458
476
|
padding: 0,
|
|
459
477
|
maxHeight: '40px',
|
|
460
478
|
},
|
|
479
|
+
minWidth: '200px',
|
|
461
480
|
overflowY: 'auto',
|
|
462
481
|
},
|
|
482
|
+
listbox: {
|
|
483
|
+
padding: 0,
|
|
484
|
+
},
|
|
485
|
+
option: {
|
|
486
|
+
borderBottom: `1px solid ${ColorTokens.border.secondary}`,
|
|
487
|
+
},
|
|
463
488
|
paper: {
|
|
464
489
|
borderRadius: '10px',
|
|
465
490
|
},
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { heeboMedium, heeboSemiBold } from '../assets/fonts/heebo';
|
|
2
1
|
import {
|
|
3
2
|
boldPoppins,
|
|
3
|
+
heeboMedium,
|
|
4
|
+
heeboSemiBold,
|
|
4
5
|
mediumPoppins,
|
|
5
6
|
semiboldPoppins,
|
|
6
|
-
} from '../assets/
|
|
7
|
+
} from '../assets/export';
|
|
7
8
|
|
|
8
9
|
export const customCssBaseline = `
|
|
9
10
|
@font-face {
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Typography } from '../../DataDisplay/Typography/Typography';
|
|
2
|
-
import { Spinner } from '../../Feedback/Spinner/Spinner';
|
|
3
|
-
import { FetchingOptionsLoaderContainer } from '../styles';
|
|
4
|
-
|
|
5
|
-
export const OptionsLoader = ({
|
|
6
|
-
loading,
|
|
7
|
-
isSearch,
|
|
8
|
-
}: {
|
|
9
|
-
loading: boolean;
|
|
10
|
-
isSearch: boolean;
|
|
11
|
-
}) => {
|
|
12
|
-
return loading ? (
|
|
13
|
-
<FetchingOptionsLoaderContainer direction="row" alignItems="center">
|
|
14
|
-
<Spinner />
|
|
15
|
-
<Typography variant="caption">
|
|
16
|
-
{isSearch ? 'Searching' : 'Loading Options'}
|
|
17
|
-
</Typography>
|
|
18
|
-
</FetchingOptionsLoaderContainer>
|
|
19
|
-
) : (
|
|
20
|
-
<></>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|