@campxdev/react-blueprint 1.7.1 → 1.7.3
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 -2
- 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 +1 -1
- package/src/components/Assets/ErrorPages/InternalServerError.tsx +2 -2
- package/src/components/Assets/ErrorPages/NoInternetConnection.tsx +2 -2
- package/src/components/Assets/ErrorPages/NoItemFound.tsx +21 -27
- package/src/components/Assets/ErrorPages/PageNotFound.tsx +2 -2
- package/src/components/Assets/ErrorPages/UnAuthorized.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/AcademicFeesIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/AccordionArrow.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AlertFilledIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/ApproveIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/ArrowBackIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AssignmentIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AttachmentIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CampxFullLogoIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CareerIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CautionIcon.tsx +37 -0
- package/src/components/Assets/Icons/IconComponents/CheckedRadioIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CollapseIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ColumnsIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/CommutexIcon.tsx +7 -7
- package/src/components/Assets/Icons/IconComponents/CompletedStateIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/ConfigureIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/DashBoardIcon.tsx +9 -9
- package/src/components/Assets/Icons/IconComponents/DeleteIcon.tsx +5 -5
- package/src/components/Assets/Icons/IconComponents/DocumentIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DoneSquare.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DownloadIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/EditIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/EnrollxIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/ExamResultIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ExamxIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ExpandIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/ExportMenuIcon.tsx +5 -5
- package/src/components/Assets/Icons/IconComponents/FeePaymentIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/HelpIcon.tsx +9 -9
- package/src/components/Assets/Icons/IconComponents/HomeIcon.tsx +6 -6
- package/src/components/Assets/Icons/IconComponents/HostelxIcon.tsx +8 -8
- package/src/components/Assets/Icons/IconComponents/HostlersIcon.tsx +6 -6
- package/src/components/Assets/Icons/IconComponents/ImageIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ImportIcon.tsx +5 -5
- package/src/components/Assets/Icons/IconComponents/LeftIcon.tsx +12 -12
- package/src/components/Assets/Icons/IconComponents/LocationIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/ManageUsersIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/MinusSquare.tsx +0 -2
- package/src/components/Assets/Icons/IconComponents/NavigationIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/NoteIcon.tsx +5 -5
- package/src/components/Assets/Icons/IconComponents/NoticeBoardIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/NotificationIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/ObeIcon.tsx +30 -0
- package/src/components/Assets/Icons/IconComponents/OnlineTransactions.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/OpenPaymentsIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/PayxIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/PdfIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/PeoplexIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/PrintDesignerIcon.tsx +47 -0
- package/src/components/Assets/Icons/IconComponents/ProductFeaturesIcon.tsx +12 -12
- package/src/components/Assets/Icons/IconComponents/QuizIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/RedirectIcon.tsx +16 -8
- package/src/components/Assets/Icons/IconComponents/RedoIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/RegistrationsIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/RejectIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/RoutesIcon.tsx +6 -6
- package/src/components/Assets/Icons/IconComponents/SaveIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/SettlementsIcon.tsx +53 -0
- package/src/components/Assets/Icons/IconComponents/ShareIcon.tsx +7 -7
- package/src/components/Assets/Icons/IconComponents/TicketingSystemIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/TicketsIcon.tsx +12 -12
- package/src/components/Assets/Icons/IconComponents/TimerIcon.tsx +215 -215
- package/src/components/Assets/Icons/IconComponents/TransactionCardIcon.tsx +6 -6
- package/src/components/Assets/Icons/IconComponents/UncheckedRadioIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ViewIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/ViewsIcon.tsx +4 -4
- package/src/components/Assets/Icons/IconComponents/VisibilityIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/WarningFilledIcon.tsx +2 -2
- package/src/components/Assets/Icons/Icons.tsx +8 -0
- package/src/components/Charts/BarChart/BarChart.tsx +1 -1
- package/src/components/Charts/TreeMap/TreeMap.tsx +0 -1
- package/src/components/DataDisplay/ActivityLogView/service.tsx +2 -2
- package/src/components/DataDisplay/Card/Card.tsx +72 -63
- package/src/components/DataDisplay/Timeline/Timeline.tsx +2 -2
- package/src/components/Feedback/Alert/Alert.tsx +2 -3
- package/src/components/Feedback/Spinner/Spinner.css +25 -13
- package/src/components/Input/FormActions/FormActions.tsx +5 -6
- package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +4 -2
- package/src/components/Input/FormWrapper/FormWrapper.tsx +12 -0
- package/src/components/Input/LabelWrapper/LabelWrapper.tsx +1 -1
- package/src/components/Input/export.ts +1 -0
- package/src/components/Layout/PageHeader/components/TableColumnsSelector/TableColumnsSelector.tsx +1 -1
- package/src/components/Layout/TabsLayout/Tabs.tsx +1 -0
- package/src/components/Navigation/ConfirmDialog/ConfirmDialog.tsx +3 -3
- package/src/components/Navigation/DropDownMenu/styles.tsx +1 -1
- package/src/components/Navigation/PreviewFiles/PreviewFiles.tsx +56 -81
- package/src/components/Navigation/TabsContainer/TabsContainer.tsx +8 -6
- package/src/components/Navigation/UploadDialog/LoadingUploadDialogContainer.tsx +3 -3
- package/src/components/Navigation/UploadDialog/Styles.tsx +19 -20
- package/src/components/Navigation/UploadDialog/UploadDialog.tsx +46 -33
- package/src/components/Navigation/UploadDialog/UploadDialogContainer.tsx +2 -2
- package/src/stories/Assets/Icons.stories.tsx +1 -0
- package/src/stories/DataDisplay/Card.stories.tsx +1 -2
- package/src/stories/DataDisplay/CircularAvatar.stories.tsx +2 -2
- package/src/stories/DataDisplay/SidePanel.stories.tsx +1 -1
- package/src/stories/DataDisplay/SquareAvatar.stories.tsx +2 -2
- package/src/stories/Input/Select.stories.tsx +1 -1
- package/src/stories/Navigation/PreviewFiles.stories.tsx +43 -9
- package/src/themes/commonTheme.ts +15 -0
- package/src/themes/customCssBaseline.ts +3 -2
- package/src/utils/constants.ts +3 -1
|
@@ -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
|
+
};
|
|
@@ -2,9 +2,9 @@ import { Box, styled, Tab, TabProps, Tabs, TabsProps } from '@mui/material';
|
|
|
2
2
|
import { ChangeEvent, useEffect, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
interface CustomTabProps extends Omit<TabProps, 'component'> {
|
|
5
|
+
key: string | number;
|
|
5
6
|
component: React.ReactNode;
|
|
6
7
|
highlight?: boolean;
|
|
7
|
-
key: string | number;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface TabsContainerProps {
|
|
@@ -16,7 +16,7 @@ export interface TabsContainerProps {
|
|
|
16
16
|
|
|
17
17
|
const TabContent = styled(Box)(({ theme }) => ({
|
|
18
18
|
width: '100%',
|
|
19
|
-
|
|
19
|
+
minHeight: 'calc(100vh - 200px)',
|
|
20
20
|
backgroundColor: theme.palette.surface.paperBackground,
|
|
21
21
|
}));
|
|
22
22
|
|
|
@@ -32,6 +32,7 @@ export const TabsContainer = ({
|
|
|
32
32
|
setCurrentTab(value);
|
|
33
33
|
onTabChange && onTabChange(value);
|
|
34
34
|
};
|
|
35
|
+
|
|
35
36
|
useEffect(() => {
|
|
36
37
|
setCurrentTab(tabs[currentTabIndex]?.key);
|
|
37
38
|
}, []);
|
|
@@ -48,11 +49,12 @@ export const TabsContainer = ({
|
|
|
48
49
|
}}
|
|
49
50
|
{...tabsProps}
|
|
50
51
|
>
|
|
51
|
-
{tabs.map(({ component, ...tab }) => (
|
|
52
|
+
{tabs.map(({ key, component, ...tab }, index) => (
|
|
52
53
|
<Tab
|
|
53
|
-
|
|
54
|
-
value={
|
|
55
|
-
|
|
54
|
+
key={index}
|
|
55
|
+
value={key}
|
|
56
|
+
label={tab?.label}
|
|
57
|
+
icon={tab?.highlight ? <span>{'.'}</span> : <></>}
|
|
56
58
|
iconPosition="end"
|
|
57
59
|
{...tab}
|
|
58
60
|
/>
|
|
@@ -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
|
|
@@ -5,27 +5,26 @@ interface StyledBoxProps {
|
|
|
5
5
|
dragging: boolean;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const UploadDialogBox = styled(Box)<StyledBoxProps>(
|
|
9
|
-
theme,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
? encodeURIComponent(theme.palette.primary.dark)
|
|
14
|
-
: encodeURIComponent(theme.palette.primary.main);
|
|
8
|
+
export const UploadDialogBox = styled(Box)<StyledBoxProps>(
|
|
9
|
+
({ theme, dragging }) => {
|
|
10
|
+
const strokeColor = dragging
|
|
11
|
+
? encodeURIComponent(theme.palette.primary.dark)
|
|
12
|
+
: encodeURIComponent(theme.palette.primary.main);
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
14
|
+
return {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
width: '100%',
|
|
18
|
+
height: '250px',
|
|
19
|
+
borderRadius: '7px',
|
|
20
|
+
backgroundImage: `url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='7' ry='7' stroke='${strokeColor}' stroke-width='3' stroke-dasharray='4%2c 8' stroke-dashoffset='8' strokeLinecap='round'/%3e%3c/svg%3e")`,
|
|
21
|
+
backgroundColor: theme.palette.surface.defaultBackground,
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
transition: 'background-color 0.3s, border-color 0.3s',
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
);
|
|
29
28
|
|
|
30
29
|
export const ImageContainer = React.memo(
|
|
31
30
|
styled('img')<{ size?: number }>(({ size }) => ({
|
|
@@ -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
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { Stack } from '@mui/material';
|
|
1
2
|
import { Meta } from '@storybook/react';
|
|
2
3
|
import { Card, CardProps } from '../../components/DataDisplay/Card/Card';
|
|
3
|
-
import { Stack } from '@mui/material';
|
|
4
|
-
import { GridMenuIcon } from '@mui/x-data-grid';
|
|
5
4
|
|
|
6
5
|
export default {
|
|
7
6
|
title: 'DataDisplay/Card',
|
|
@@ -15,14 +15,14 @@ export default {
|
|
|
15
15
|
} as Meta<typeof CircularAvatar>;
|
|
16
16
|
|
|
17
17
|
// Define stories directly as objects with render function
|
|
18
|
-
export const
|
|
18
|
+
export const WithText = {
|
|
19
19
|
render: (args: CircularAvatarProps) => <CircularAvatar {...args} />,
|
|
20
20
|
args: {
|
|
21
21
|
text: 'Sh auy',
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
export const
|
|
25
|
+
export const WithImage = {
|
|
26
26
|
render: (args: CircularAvatarProps) => <CircularAvatar {...args} />,
|
|
27
27
|
args: {
|
|
28
28
|
src: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwyNzM3ODF8MHwxfGFsbHwxfHx8fHx8fHwxNjM4MjM2MDg0&ixlib=rb-1.2.1&q=80&w=400',
|
|
@@ -35,14 +35,14 @@ export default {
|
|
|
35
35
|
} as Meta<typeof SquareAvatar>;
|
|
36
36
|
|
|
37
37
|
// Define stories directly as objects with render function
|
|
38
|
-
export const
|
|
38
|
+
export const WithText = {
|
|
39
39
|
render: (args: SquareAvatarProps) => <SquareAvatar {...args} />,
|
|
40
40
|
args: {
|
|
41
41
|
text: 'SQC01',
|
|
42
42
|
},
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
export const
|
|
45
|
+
export const WithImage = {
|
|
46
46
|
render: (args: SquareAvatarProps) => <SquareAvatar {...args} />,
|
|
47
47
|
args: {
|
|
48
48
|
src: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwyNzM3ODF8MHwxfGFsbHwxfHx8fHx8fHwxNjM4MjM2MDg0&ixlib=rb-1.2.1&q=80&w=400',
|
|
@@ -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
|
};
|
|
@@ -64,6 +64,21 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
|
+
MuiPaper: {
|
|
68
|
+
root: {
|
|
69
|
+
MuiAccordion: {
|
|
70
|
+
root: {
|
|
71
|
+
':last-of-type': {
|
|
72
|
+
borderBottomLeftRadius: '0px',
|
|
73
|
+
borderBottomRightRadius: '0px',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
// MuiAccordian: {
|
|
80
|
+
// root: {},
|
|
81
|
+
// },
|
|
67
82
|
MuiAccordionSummary: {
|
|
68
83
|
styleOverrides: {
|
|
69
84
|
root: {
|
|
@@ -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 {
|
package/src/utils/constants.ts
CHANGED