@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.
Files changed (113) hide show
  1. package/export.ts +1 -0
  2. package/package.json +1 -2
  3. package/src/assets/export.ts +2 -0
  4. package/src/assets/fonts/export.ts +2 -0
  5. package/src/assets/images/export.ts +2 -0
  6. package/src/assets/images/gif/index.ts +1 -1
  7. package/src/assets/images/svg/index.ts +1 -1
  8. package/src/components/Assets/ErrorPages/InternalServerError.tsx +2 -2
  9. package/src/components/Assets/ErrorPages/NoInternetConnection.tsx +2 -2
  10. package/src/components/Assets/ErrorPages/NoItemFound.tsx +21 -27
  11. package/src/components/Assets/ErrorPages/PageNotFound.tsx +2 -2
  12. package/src/components/Assets/ErrorPages/UnAuthorized.tsx +2 -2
  13. package/src/components/Assets/Icons/IconComponents/AcademicFeesIcon.tsx +4 -4
  14. package/src/components/Assets/Icons/IconComponents/AccordionArrow.tsx +1 -1
  15. package/src/components/Assets/Icons/IconComponents/AlertFilledIcon.tsx +2 -2
  16. package/src/components/Assets/Icons/IconComponents/ApproveIcon.tsx +2 -2
  17. package/src/components/Assets/Icons/IconComponents/ArrowBackIcon.tsx +1 -1
  18. package/src/components/Assets/Icons/IconComponents/AssignmentIcon.tsx +1 -1
  19. package/src/components/Assets/Icons/IconComponents/AttachmentIcon.tsx +1 -1
  20. package/src/components/Assets/Icons/IconComponents/CampxFullLogoIcon.tsx +1 -1
  21. package/src/components/Assets/Icons/IconComponents/CareerIcon.tsx +1 -1
  22. package/src/components/Assets/Icons/IconComponents/CautionIcon.tsx +37 -0
  23. package/src/components/Assets/Icons/IconComponents/CheckedRadioIcon.tsx +1 -1
  24. package/src/components/Assets/Icons/IconComponents/CollapseIcon.tsx +1 -1
  25. package/src/components/Assets/Icons/IconComponents/ColumnsIcon.tsx +3 -3
  26. package/src/components/Assets/Icons/IconComponents/CommutexIcon.tsx +7 -7
  27. package/src/components/Assets/Icons/IconComponents/CompletedStateIcon.tsx +3 -3
  28. package/src/components/Assets/Icons/IconComponents/ConfigureIcon.tsx +3 -3
  29. package/src/components/Assets/Icons/IconComponents/DashBoardIcon.tsx +9 -9
  30. package/src/components/Assets/Icons/IconComponents/DeleteIcon.tsx +5 -5
  31. package/src/components/Assets/Icons/IconComponents/DocumentIcon.tsx +1 -1
  32. package/src/components/Assets/Icons/IconComponents/DoneSquare.tsx +1 -1
  33. package/src/components/Assets/Icons/IconComponents/DownloadIcon.tsx +4 -4
  34. package/src/components/Assets/Icons/IconComponents/EditIcon.tsx +3 -3
  35. package/src/components/Assets/Icons/IconComponents/EnrollxIcon.tsx +4 -4
  36. package/src/components/Assets/Icons/IconComponents/ExamResultIcon.tsx +1 -1
  37. package/src/components/Assets/Icons/IconComponents/ExamxIcon.tsx +1 -1
  38. package/src/components/Assets/Icons/IconComponents/ExpandIcon.tsx +2 -2
  39. package/src/components/Assets/Icons/IconComponents/ExportMenuIcon.tsx +5 -5
  40. package/src/components/Assets/Icons/IconComponents/FeePaymentIcon.tsx +3 -3
  41. package/src/components/Assets/Icons/IconComponents/HelpIcon.tsx +9 -9
  42. package/src/components/Assets/Icons/IconComponents/HomeIcon.tsx +6 -6
  43. package/src/components/Assets/Icons/IconComponents/HostelxIcon.tsx +8 -8
  44. package/src/components/Assets/Icons/IconComponents/HostlersIcon.tsx +6 -6
  45. package/src/components/Assets/Icons/IconComponents/ImageIcon.tsx +1 -1
  46. package/src/components/Assets/Icons/IconComponents/ImportIcon.tsx +5 -5
  47. package/src/components/Assets/Icons/IconComponents/LeftIcon.tsx +12 -12
  48. package/src/components/Assets/Icons/IconComponents/LocationIcon.tsx +4 -4
  49. package/src/components/Assets/Icons/IconComponents/ManageUsersIcon.tsx +4 -4
  50. package/src/components/Assets/Icons/IconComponents/MinusSquare.tsx +0 -2
  51. package/src/components/Assets/Icons/IconComponents/NavigationIcon.tsx +1 -1
  52. package/src/components/Assets/Icons/IconComponents/NoteIcon.tsx +5 -5
  53. package/src/components/Assets/Icons/IconComponents/NoticeBoardIcon.tsx +3 -3
  54. package/src/components/Assets/Icons/IconComponents/NotificationIcon.tsx +2 -2
  55. package/src/components/Assets/Icons/IconComponents/ObeIcon.tsx +30 -0
  56. package/src/components/Assets/Icons/IconComponents/OnlineTransactions.tsx +4 -4
  57. package/src/components/Assets/Icons/IconComponents/OpenPaymentsIcon.tsx +4 -4
  58. package/src/components/Assets/Icons/IconComponents/PayxIcon.tsx +1 -1
  59. package/src/components/Assets/Icons/IconComponents/PdfIcon.tsx +1 -1
  60. package/src/components/Assets/Icons/IconComponents/PeoplexIcon.tsx +3 -3
  61. package/src/components/Assets/Icons/IconComponents/PrintDesignerIcon.tsx +47 -0
  62. package/src/components/Assets/Icons/IconComponents/ProductFeaturesIcon.tsx +12 -12
  63. package/src/components/Assets/Icons/IconComponents/QuizIcon.tsx +4 -4
  64. package/src/components/Assets/Icons/IconComponents/RedirectIcon.tsx +16 -8
  65. package/src/components/Assets/Icons/IconComponents/RedoIcon.tsx +2 -2
  66. package/src/components/Assets/Icons/IconComponents/RegistrationsIcon.tsx +4 -4
  67. package/src/components/Assets/Icons/IconComponents/RejectIcon.tsx +3 -3
  68. package/src/components/Assets/Icons/IconComponents/RoutesIcon.tsx +6 -6
  69. package/src/components/Assets/Icons/IconComponents/SaveIcon.tsx +4 -4
  70. package/src/components/Assets/Icons/IconComponents/SettlementsIcon.tsx +53 -0
  71. package/src/components/Assets/Icons/IconComponents/ShareIcon.tsx +7 -7
  72. package/src/components/Assets/Icons/IconComponents/TicketingSystemIcon.tsx +4 -4
  73. package/src/components/Assets/Icons/IconComponents/TicketsIcon.tsx +12 -12
  74. package/src/components/Assets/Icons/IconComponents/TimerIcon.tsx +215 -215
  75. package/src/components/Assets/Icons/IconComponents/TransactionCardIcon.tsx +6 -6
  76. package/src/components/Assets/Icons/IconComponents/UncheckedRadioIcon.tsx +1 -1
  77. package/src/components/Assets/Icons/IconComponents/ViewIcon.tsx +2 -2
  78. package/src/components/Assets/Icons/IconComponents/ViewsIcon.tsx +4 -4
  79. package/src/components/Assets/Icons/IconComponents/VisibilityIcon.tsx +2 -2
  80. package/src/components/Assets/Icons/IconComponents/WarningFilledIcon.tsx +2 -2
  81. package/src/components/Assets/Icons/Icons.tsx +8 -0
  82. package/src/components/Charts/BarChart/BarChart.tsx +1 -1
  83. package/src/components/Charts/TreeMap/TreeMap.tsx +0 -1
  84. package/src/components/DataDisplay/ActivityLogView/service.tsx +2 -2
  85. package/src/components/DataDisplay/Card/Card.tsx +72 -63
  86. package/src/components/DataDisplay/Timeline/Timeline.tsx +2 -2
  87. package/src/components/Feedback/Alert/Alert.tsx +2 -3
  88. package/src/components/Feedback/Spinner/Spinner.css +25 -13
  89. package/src/components/Input/FormActions/FormActions.tsx +5 -6
  90. package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +4 -2
  91. package/src/components/Input/FormWrapper/FormWrapper.tsx +12 -0
  92. package/src/components/Input/LabelWrapper/LabelWrapper.tsx +1 -1
  93. package/src/components/Input/export.ts +1 -0
  94. package/src/components/Layout/PageHeader/components/TableColumnsSelector/TableColumnsSelector.tsx +1 -1
  95. package/src/components/Layout/TabsLayout/Tabs.tsx +1 -0
  96. package/src/components/Navigation/ConfirmDialog/ConfirmDialog.tsx +3 -3
  97. package/src/components/Navigation/DropDownMenu/styles.tsx +1 -1
  98. package/src/components/Navigation/PreviewFiles/PreviewFiles.tsx +56 -81
  99. package/src/components/Navigation/TabsContainer/TabsContainer.tsx +8 -6
  100. package/src/components/Navigation/UploadDialog/LoadingUploadDialogContainer.tsx +3 -3
  101. package/src/components/Navigation/UploadDialog/Styles.tsx +19 -20
  102. package/src/components/Navigation/UploadDialog/UploadDialog.tsx +46 -33
  103. package/src/components/Navigation/UploadDialog/UploadDialogContainer.tsx +2 -2
  104. package/src/stories/Assets/Icons.stories.tsx +1 -0
  105. package/src/stories/DataDisplay/Card.stories.tsx +1 -2
  106. package/src/stories/DataDisplay/CircularAvatar.stories.tsx +2 -2
  107. package/src/stories/DataDisplay/SidePanel.stories.tsx +1 -1
  108. package/src/stories/DataDisplay/SquareAvatar.stories.tsx +2 -2
  109. package/src/stories/Input/Select.stories.tsx +1 -1
  110. package/src/stories/Navigation/PreviewFiles.stories.tsx +43 -9
  111. package/src/themes/commonTheme.ts +15 -0
  112. package/src/themes/customCssBaseline.ts +3 -2
  113. 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 { AttachmentIcon } from '../../Assets/Icons/IconComponents/AttachmentIcon';
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
- setFiles?:
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
- setFiles,
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
- const newWindow = window.open();
44
- newWindow?.document.write(
45
- `<iframe src="${previews[file.name]}" frameborder="0" style="border:0; top:0; left:0; bottom:0; right:0; width:100%; height:100%;" allowfullscreen></iframe>`,
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
- const reader = new FileReader();
49
- reader.onloadend = () => {
50
- setPreviews((prev) => ({
51
- ...prev,
52
- [file.name]: reader.result as string,
53
- }));
54
- const url = URL.createObjectURL(file);
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="label1"
76
+ variant="label2"
137
77
  >
138
78
  {file.name}
139
79
  </Typography>
140
- <Typography color={theme.palette.text.tertiary} variant="label2">
80
+ <Typography color={theme.palette.text.tertiary} variant="caption">
141
81
  {formatFileSize(file.size)}
142
82
  </Typography>
143
83
  </Stack>
144
84
  </Stack>
145
- <IconButton onClick={handleDelete(file)}>
146
- <DeleteIcon />
147
- </IconButton>
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
- height: 'calc(100vh - 200px)',
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
- label={tab.label}
54
- value={tab?.key}
55
- icon={tab.highlight ? <span>{'.'}</span> : <></>}
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 { AnimatedGifs } from '../../../assets/images/gif';
2
+ import { AnimatedGIFs } from '../../../assets/images/gif';
3
3
  import { ImageContainer, UploadDialogBox } from './Styles';
4
4
 
5
- export const LoadingUploadDialogConatiner = () => {
5
+ export const LoadingUploadDialogContainer = () => {
6
6
  const theme = useTheme();
7
7
  return (
8
8
  <UploadDialogBox dragging={false}>
9
9
  <ImageContainer
10
- src={AnimatedGifs.UploadingFile}
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
- dragging,
11
- }) => {
12
- const strokeColor = dragging
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
- return {
17
- display: 'flex',
18
- flexDirection: 'column',
19
- width: '100%',
20
- height: '250px',
21
- borderRadius: '7px',
22
- 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' stroke-linecap='round'/%3e%3c/svg%3e")`,
23
- backgroundColor: theme.palette.surface.defaultBackground,
24
- justifyContent: 'center',
25
- alignItems: 'center',
26
- transition: 'background-color 0.3s, border-color 0.3s',
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 { LoadingUploadDialogConatiner } from './LoadingUploadDialogContainer';
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
- {uploading ? (
82
- <LoadingUploadDialogConatiner />
83
- ) : (
84
- <UploadDialogContainer
85
- setFile={setFile}
86
- acceptFileType={acceptFileType}
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
- {sampleFileUrl && (
91
- <a href={sampleFileUrl} target="_blank" rel="noreferrer">
92
- <Button
93
- sx={{ margin: '12px 0px' }}
94
- color="secondary"
95
- fullWidth
96
- variant="contained"
97
- >
98
- Download Sample File
99
- </Button>
100
- </a>
101
- )}
102
- {file && !uploading && (
103
- <PreviewFiles
104
- sx={{ margin: '16px 0px' }}
105
- key={file.name + file.lastModified}
106
- files={file}
107
- label="Selected Files"
108
- setFiles={setFile}
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 0px'}>
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 { AnimatedGifs } from '../../../assets/images/gif';
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={AnimatedGifs.UploadFile}
53
+ src={AnimatedGIFs.UploadFile}
54
54
  alt={'Import animation'}
55
55
  />
56
56
  <Typography
@@ -9,6 +9,7 @@ const IconsStory = () => {
9
9
  <Stack gap={2} direction={'column'}>
10
10
  {Object.entries(Icons).map(([key, Icon], index) => (
11
11
  <Stack
12
+ key={index}
12
13
  direction="row"
13
14
  alignItems="center"
14
15
  gap={4}
@@ -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 withText = {
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 withImage = {
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',
@@ -10,7 +10,7 @@ export default {
10
10
  component: SidePanel,
11
11
  } as Meta<typeof SidePanel>;
12
12
 
13
- export const withText = {
13
+ export const WithText = {
14
14
  render: (args: SidePanelProps) => <SidePanel {...args} />,
15
15
  args: {
16
16
  variables: [
@@ -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 withText = {
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 withImage = {
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',
@@ -55,7 +55,7 @@ export const WithPreselectedValue: Story = {
55
55
  export const WithPlaceHolder: Story = {
56
56
  args: {
57
57
  ...Default.args,
58
- placeholder: 'Select an option...',
58
+ // placeholder: 'Select an option...',
59
59
  },
60
60
  };
61
61
 
@@ -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 { PreviewFiles, PreviewFilesProps } from '../../components/export';
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 handleSetFiles: PreviewFilesProps['setFiles'] = (newFiles: any) => {
44
- if (typeof newFiles === 'function') {
45
- setFiles(newFiles(files));
46
- } else {
47
- setFiles(newFiles);
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 {...args} files={files} setFiles={handleSetFiles} />
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/fonts/poppins';
7
+ } from '../assets/export';
7
8
 
8
9
  export const customCssBaseline = `
9
10
  @font-face {
@@ -1,2 +1,4 @@
1
- export const isDevelopment: boolean = process.env.NODE_ENV === 'development';
2
1
  export const isLocal = window.location.hostname === 'localhost';
2
+
3
+ export const isDevelopment: boolean =
4
+ process.env.NODE_ENV === 'development' || isLocal;