@campxdev/react-blueprint 1.1.8 → 1.1.10
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/package.json +2 -2
- package/src/AppContent.tsx +6 -6
- package/src/assets/fonts/heebo/index.ts +2 -2
- package/src/assets/fonts/poppins/index.ts +5 -5
- package/src/assets/images/gif/index.ts +4 -0
- package/src/assets/images/gif/upload-file.gif +0 -0
- package/src/assets/images/gif/uploading-file.gif +0 -0
- package/src/components/Assets/ErrorPages/InternalServerError.tsx +7 -7
- package/src/components/Assets/ErrorPages/NoInternetConnection.tsx +7 -7
- package/src/components/Assets/ErrorPages/NoItemFound.tsx +7 -7
- package/src/components/Assets/ErrorPages/PageNotFound.tsx +5 -5
- package/src/components/Assets/ErrorPages/UnAuthorized.tsx +6 -6
- package/src/components/Assets/ErrorPages/styles.tsx +15 -15
- package/src/components/Assets/Icons/IconComponents/AcademicIcon.tsx +7 -1
- package/src/components/Assets/Icons/IconComponents/ActiveDevicesIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AdminIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AdministratorIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AlertFilledIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ArrowBackIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/AttachmentIcon.tsx +32 -0
- package/src/components/Assets/Icons/IconComponents/BulbIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CampxFullLogoIcon.tsx +3 -3
- package/src/components/Assets/Icons/IconComponents/CampxIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/CareerIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CheckedCheckBoxIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CheckedRadioIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ClogWheelIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CollapseIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CrossIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DashBoardIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DeleteIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DeviceIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DocumentIcon.tsx +52 -0
- package/src/components/Assets/Icons/IconComponents/DownloadIcon.tsx +52 -0
- package/src/components/Assets/Icons/IconComponents/EditIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ExamResultIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ExcelIcon.tsx +56 -0
- package/src/components/Assets/Icons/IconComponents/ExpandIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ExportIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/FilterIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/HelpIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/HomeIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ImageIcon.tsx +44 -0
- package/src/components/Assets/Icons/IconComponents/InfoFilledIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/InfoIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/InstitutionsIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/LeftIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/LocationIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/LogoutIcon.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/NavigationIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/NoteIcon.tsx +7 -1
- package/src/components/Assets/Icons/IconComponents/NotificationIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/PdfIcon.tsx +52 -0
- package/src/components/Assets/Icons/IconComponents/ProductFeaturesIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ProfileIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/RedirectIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/RedoIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/RightIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/SaveIcon.tsx +39 -39
- package/src/components/Assets/Icons/IconComponents/SearchIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ShareIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/SuccessFilledIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/TicketsIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/UncheckCheckBoxIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/UncheckedRadioIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ViewIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/VisibiityOffIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/VisibilityIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/WarningFilledIcon.tsx +1 -1
- package/src/components/Assets/Icons/Icons.tsx +12 -0
- package/src/components/Assets/export.ts +6 -6
- package/src/components/Charts/BarChart/BarChart.tsx +17 -19
- package/src/components/Charts/LineChart/LineChart.tsx +12 -14
- package/src/components/Charts/PieChart/PieChart.tsx +8 -8
- package/src/components/Charts/TreeMap/TreeMap.tsx +15 -15
- package/src/components/Charts/export.ts +4 -4
- package/src/components/Charts/types/types.ts +3 -3
- package/src/components/DataDisplay/Accordion/Accordion.tsx +2 -0
- package/src/components/DataDisplay/Avatar/Avatar.tsx +14 -3
- package/src/components/DataDisplay/Card/Card.tsx +18 -18
- package/src/components/DataDisplay/Card/styles.tsx +24 -25
- package/src/components/DataDisplay/Chips/Chips.tsx +14 -14
- package/src/components/DataDisplay/DataTable/DataTable.tsx +4 -1
- package/src/components/DataDisplay/DataTable/TablePagination.tsx +10 -10
- package/src/components/DataDisplay/SidePanel/SidePanel.tsx +1 -1
- package/src/components/DataDisplay/Typography/Typography.tsx +1 -1
- package/src/components/Feedback/Alert/Alert.tsx +8 -8
- package/src/components/Feedback/Snackbar/Snackbar.tsx +27 -27
- package/src/components/Feedback/Spinner/Spinner.tsx +2 -2
- package/src/components/Feedback/Tooltip/Tooltip.tsx +6 -6
- package/src/components/Feedback/Tutorial/Tutorial.tsx +45 -45
- package/src/components/Feedback/export.ts +5 -0
- package/src/components/Image/Image.tsx +8 -8
- package/src/components/Input/Button/Button.tsx +2 -2
- package/src/components/Input/DatePicker/DatePicker.tsx +18 -4
- package/src/components/Input/FormActions/FormActions.tsx +15 -4
- package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +20 -5
- package/src/components/Input/HelpButton/HelpButton.stories.tsx +9 -9
- package/src/components/Input/HelpButton/HelpButton.tsx +4 -4
- package/src/components/Input/IconButtons/IconButtons/DeleteButton.tsx +2 -2
- package/src/components/Input/IconButtons/IconButtons/EditButton.tsx +2 -2
- package/src/components/Input/IconButtons/IconButtons/RedirectButton.tsx +2 -2
- package/src/components/Input/IconButtons/IconButtons/ViewButton.tsx +2 -2
- package/src/components/Input/LabelWrapper/LabelWrapper.tsx +5 -5
- package/src/components/Input/MultiCheckBox/MultiCheckBox.tsx +6 -6
- package/src/components/Input/OtpInput/OtpInput.tsx +17 -17
- package/src/components/Input/PasswordField/PasswordField.tsx +8 -8
- package/src/components/Input/RadioGroup/RadioGroup.tsx +5 -5
- package/src/components/Input/SearchBar/SearchBar.tsx +20 -20
- package/src/components/Input/SingleCheckBox/SIngleCheckBox.tsx +5 -5
- package/src/components/Input/SingleSelect/SingleSelect.tsx +39 -6
- package/src/components/Input/Switch/Switch.tsx +1 -1
- package/src/components/Input/TextField/TextField.tsx +3 -3
- package/src/components/Input/TimePicker/TimePicker.tsx +18 -4
- package/src/components/Input/components/FetchingOptionsLoader.tsx +3 -3
- package/src/components/Input/styles.tsx +6 -6
- package/src/components/Layout/AppHeader/AppHeader.tsx +10 -12
- package/src/components/Layout/AppHeader/AppHeaderActions/CogWheelMenu.tsx +5 -5
- package/src/components/Layout/AppHeader/AppHeaderActions/HeaderActions.tsx +6 -6
- package/src/components/Layout/AppHeader/AppHeaderActions/SwitchInstitution.tsx +37 -37
- package/src/components/Layout/AppHeader/AppHeaderActions/UserBox.tsx +28 -28
- package/src/components/Layout/AppHeader/styles/styles.tsx +24 -24
- package/src/components/Layout/PageHeader/PageHeader.tsx +8 -3
- package/src/components/Layout/TabsLayout/Tabs.tsx +16 -16
- package/src/components/Layout/TabsLayout/TabsLayout.tsx +6 -6
- package/src/components/Layout/export.ts +4 -0
- package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +35 -23
- package/src/components/Navigation/ConfirmDialog/ConfirmDialog.tsx +43 -48
- package/src/components/Navigation/Dialog/Dialog.tsx +33 -0
- package/src/components/Navigation/DialogButton/DialogButton.tsx +17 -81
- package/src/components/Navigation/DropDownMenu/DropDownButton.tsx +4 -4
- package/src/components/Navigation/DropDownMenu/DropDownIcon.tsx +4 -4
- package/src/components/Navigation/DropDownMenu/DropDownMenu.tsx +8 -8
- package/src/components/Navigation/DropDownMenu/DropdownMenuItem.tsx +3 -3
- package/src/components/Navigation/DropDownMenu/styles.tsx +13 -13
- package/src/components/Navigation/PreviewFiles/PreviewFiles.tsx +165 -0
- package/src/components/Navigation/Sidebar/Components.tsx +18 -18
- package/src/components/Navigation/Sidebar/MenuItem.tsx +1 -1
- package/src/components/Navigation/Sidebar/SubMenuItem.tsx +2 -1
- package/src/components/Navigation/Sidebar/interfaces.ts +1 -1
- package/src/components/Navigation/Sidebar/styles.tsx +64 -64
- package/src/components/Navigation/Stepper/Stepper.tsx +5 -5
- package/src/components/Navigation/Stepper/StepperComponents.tsx +15 -15
- package/src/components/Navigation/TabsContainer/TabsContainer.tsx +4 -4
- package/src/components/Navigation/UploadDialog/LoadingUploadDialogContainer.tsx +23 -0
- package/src/components/Navigation/UploadDialog/Styles.tsx +34 -0
- package/src/components/Navigation/UploadDialog/UploadDialog.tsx +143 -0
- package/src/components/Navigation/UploadDialog/UploadDialogContainer.tsx +82 -0
- package/src/components/Navigation/{exports.ts → export.ts} +4 -0
- package/src/components/export.ts +7 -7
- package/src/index.tsx +2 -2
- package/src/store/activeStore.ts +1 -1
- package/src/stories/Assets/Icons.stories.tsx +6 -6
- package/src/stories/Charts/BarChart.stories.tsx +56 -56
- package/src/stories/Charts/LineChart.stories.tsx +49 -49
- package/src/stories/Charts/PieChart.stories.tsx +53 -53
- package/src/stories/Charts/Treemap.stories.tsx +122 -122
- package/src/stories/DataDisplay/AccordionGroup.stories.tsx +11 -12
- package/src/stories/DataDisplay/Card.stories.tsx +34 -34
- package/src/stories/DataDisplay/Chips.stories.tsx +10 -10
- package/src/stories/DataDisplay/CircularAvatar.stories.tsx +6 -6
- package/src/stories/DataDisplay/DataTable.stories.tsx +32 -32
- package/src/stories/DataDisplay/SidePanel.stories.tsx +14 -14
- package/src/stories/DataDisplay/SquareAvatar.stories.tsx +15 -15
- package/src/stories/DesignSystem/colorTokens.stories.tsx +10 -10
- package/src/stories/DesignSystem/typography.stories.tsx +19 -19
- package/src/stories/Feedback/Alert.stories.tsx +9 -9
- package/src/stories/Feedback/Snackbar.stories.tsx +11 -11
- package/src/stories/Feedback/Spinner.stories.tsx +4 -4
- package/src/stories/Feedback/Tooltip.stories.tsx +5 -5
- package/src/stories/Feedback/Tutorial.stories.tsx +13 -13
- package/src/stories/Input/Button.stories.tsx +26 -26
- package/src/stories/Input/DatePicker.stories.tsx +48 -8
- package/src/stories/Input/IconButtons.stories.tsx +6 -6
- package/src/stories/Input/MultiCheckBox.stories.tsx +15 -15
- package/src/stories/Input/OtpInput.stories.tsx +5 -5
- package/src/stories/Input/Password.stories.tsx +7 -7
- package/src/stories/Input/RadioGroup.stories.tsx +14 -14
- package/src/stories/Input/SearchBar.stories.tsx +10 -10
- package/src/stories/Input/SingleCheckBox.stories.tsx +7 -7
- package/src/stories/Input/SingleSelect.stories.tsx +47 -47
- package/src/stories/Input/Switch.stories.tsx +22 -22
- package/src/stories/Input/TextField.stories.tsx +47 -47
- package/src/stories/Input/TimePicker.stories.tsx +44 -7
- package/src/stories/Layout/AppHeader.stories.tsx +13 -13
- package/src/stories/Layout/TabsLayout.stories.tsx +24 -24
- package/src/stories/Navigation/ConfirmDialog.stories.tsx +12 -2
- package/src/stories/Navigation/DialogButton.stories.tsx +38 -45
- package/src/stories/Navigation/DropDownMenu.stories.tsx +24 -24
- package/src/stories/Navigation/FloatingSidebar.stories.tsx +23 -23
- package/src/stories/Navigation/ImportDialog.stories.tsx +45 -0
- package/src/stories/Navigation/PreviewFiles.stories.tsx +80 -0
- package/src/stories/Navigation/Stepper.stories.tsx +15 -15
- package/src/stories/Navigation/TabsContainer.stories.tsx +11 -11
- package/src/themes/MuiThemeProvider.tsx +3 -3
- package/src/themes/colorTokens/colorPalette.tsx +38 -38
- package/src/themes/colorTokens/darkColorTokens.tsx +1 -1
- package/src/themes/colorTokens/lightColorTokens.ts +1 -1
- package/src/themes/commonTheme.ts +13 -3
- package/src/themes/customCssBaseline.ts +2 -2
- package/src/themes/darkTheme.ts +4 -4
- package/src/themes/export.ts +3 -3
- package/src/themes/lightTheme.ts +4 -4
- package/src/utils/constants.ts +5 -5
- package/src/utils/logout.ts +8 -8
- package/src/components/Feedback/exports.ts +0 -5
- package/src/components/Layout/exports.ts +0 -4
- package/src/stories/Navigation/Breadcrumbs.stories.tsx +0 -34
- package/src/utils/campxAxios.ts +0 -18
|
@@ -1,48 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
DialogProps,
|
|
6
|
-
DialogTitle,
|
|
7
|
-
Grow,
|
|
8
|
-
IconButton,
|
|
9
|
-
styled,
|
|
10
|
-
} from "@mui/material";
|
|
11
|
-
import { TransitionProps } from "@mui/material/transitions";
|
|
12
|
-
import { ReactNode, forwardRef, useState } from "react";
|
|
1
|
+
import { Fade } from '@mui/material';
|
|
2
|
+
import { TransitionProps } from '@mui/material/transitions';
|
|
3
|
+
import React, { ReactNode, useState } from 'react';
|
|
4
|
+
import { Dialog, DialogProps } from '../Dialog/Dialog';
|
|
13
5
|
|
|
14
|
-
const
|
|
15
|
-
height: "60px",
|
|
16
|
-
|
|
17
|
-
display: "flex",
|
|
18
|
-
justifyContent: "space-between",
|
|
19
|
-
alignItems: "center",
|
|
20
|
-
padding: "25px 20px 15px 20px",
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
export const Transition = forwardRef(function Transition(
|
|
6
|
+
const FadeTransition = React.forwardRef(function FadeTransition(
|
|
24
7
|
props: TransitionProps & {
|
|
25
|
-
children: React.ReactElement
|
|
8
|
+
children: React.ReactElement<any, any>;
|
|
26
9
|
},
|
|
27
|
-
ref: React.Ref<unknown
|
|
10
|
+
ref: React.Ref<unknown>,
|
|
28
11
|
) {
|
|
29
|
-
return <
|
|
12
|
+
return <Fade ref={ref} {...props} timeout={50} />;
|
|
30
13
|
});
|
|
31
14
|
|
|
32
|
-
export
|
|
15
|
+
export type DialogButtonProps = {
|
|
33
16
|
anchor: (props: { open: () => void }) => ReactNode;
|
|
34
|
-
|
|
35
|
-
title: string;
|
|
36
|
-
dialogProps?: Omit<DialogProps, "open">;
|
|
17
|
+
onDialogOpen?: () => void;
|
|
37
18
|
onDialogClose?: () => void;
|
|
38
|
-
}
|
|
19
|
+
} & Omit<DialogProps, 'open' | 'onClose'>;
|
|
39
20
|
|
|
40
21
|
export default function DialogButton({
|
|
41
|
-
content,
|
|
42
|
-
title,
|
|
43
|
-
dialogProps,
|
|
44
22
|
onDialogClose,
|
|
23
|
+
onDialogOpen,
|
|
45
24
|
anchor,
|
|
25
|
+
...props
|
|
46
26
|
}: DialogButtonProps) {
|
|
47
27
|
const [open, setOpen] = useState(false);
|
|
48
28
|
|
|
@@ -52,6 +32,7 @@ export default function DialogButton({
|
|
|
52
32
|
};
|
|
53
33
|
|
|
54
34
|
const onOpen = () => {
|
|
35
|
+
onDialogOpen && onDialogOpen();
|
|
55
36
|
setOpen(true);
|
|
56
37
|
};
|
|
57
38
|
|
|
@@ -60,57 +41,12 @@ export default function DialogButton({
|
|
|
60
41
|
{anchor({
|
|
61
42
|
open: onOpen,
|
|
62
43
|
})}
|
|
63
|
-
<
|
|
44
|
+
<Dialog
|
|
45
|
+
{...props}
|
|
64
46
|
open={open}
|
|
65
|
-
content={content}
|
|
66
|
-
dialogProps={dialogProps}
|
|
67
47
|
onClose={onClose}
|
|
68
|
-
|
|
48
|
+
TransitionComponent={FadeTransition}
|
|
69
49
|
/>
|
|
70
50
|
</>
|
|
71
51
|
);
|
|
72
52
|
}
|
|
73
|
-
|
|
74
|
-
interface CustomDialogProps {
|
|
75
|
-
content: (props: { close: () => void }) => ReactNode;
|
|
76
|
-
title?: string;
|
|
77
|
-
onClose: () => void;
|
|
78
|
-
open: boolean;
|
|
79
|
-
dialogProps?: Omit<DialogProps, "open">;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export const CustomDialog = ({
|
|
83
|
-
onClose,
|
|
84
|
-
dialogProps,
|
|
85
|
-
title,
|
|
86
|
-
content,
|
|
87
|
-
open,
|
|
88
|
-
}: CustomDialogProps) => {
|
|
89
|
-
const props = {
|
|
90
|
-
PaperProps: {
|
|
91
|
-
...dialogProps?.PaperProps,
|
|
92
|
-
},
|
|
93
|
-
onClose: onClose,
|
|
94
|
-
open: open,
|
|
95
|
-
transitionDuration: 140,
|
|
96
|
-
TransitionComponent: Transition,
|
|
97
|
-
sx: {
|
|
98
|
-
...dialogProps?.sx,
|
|
99
|
-
},
|
|
100
|
-
...dialogProps,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<Dialog {...props}>
|
|
105
|
-
{title && (
|
|
106
|
-
<StyledDialogHeader>
|
|
107
|
-
<DialogTitle>{title}</DialogTitle>
|
|
108
|
-
<IconButton onClick={onClose} sx={{ color: "black" }}>
|
|
109
|
-
<Close />
|
|
110
|
-
</IconButton>
|
|
111
|
-
</StyledDialogHeader>
|
|
112
|
-
)}
|
|
113
|
-
<Box sx={{ padding: "20px" }}>{content({ close: onClose })}</Box>
|
|
114
|
-
</Dialog>
|
|
115
|
-
);
|
|
116
|
-
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { KeyboardArrowDown } from '@mui/icons-material'
|
|
2
|
-
import { Button, ButtonProps } from '../../Input/Button/Button'
|
|
1
|
+
import { KeyboardArrowDown } from '@mui/icons-material';
|
|
2
|
+
import { Button, ButtonProps } from '../../Input/Button/Button';
|
|
3
3
|
|
|
4
4
|
export const DropDownButton = (props: ButtonProps) => {
|
|
5
5
|
return (
|
|
6
6
|
<Button variant="outlined" endIcon={<KeyboardArrowDown />} {...props} />
|
|
7
|
-
)
|
|
8
|
-
}
|
|
7
|
+
);
|
|
8
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MoreVert } from
|
|
2
|
-
import { IconButtonProps } from
|
|
3
|
-
import { ReactNode } from
|
|
4
|
-
import { StyledIconButton } from
|
|
1
|
+
import { MoreVert } from '@mui/icons-material';
|
|
2
|
+
import { IconButtonProps } from '@mui/material';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { StyledIconButton } from './styles';
|
|
5
5
|
|
|
6
6
|
const defaultIcon = {
|
|
7
7
|
icon: <MoreVert color="primary" />,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Divider, Menu, MenuListProps, MenuProps } from
|
|
2
|
-
import { Fragment, ReactNode, useState } from
|
|
1
|
+
import { Divider, Menu, MenuListProps, MenuProps } from '@mui/material';
|
|
2
|
+
import { Fragment, ReactNode, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
export type DropdownMenuProps = {
|
|
5
5
|
anchor: (props: { open: (e: any) => void }) => ReactNode;
|
|
6
6
|
menu: ReactNode[];
|
|
7
|
-
menuProps?: Omit<MenuProps,
|
|
7
|
+
menuProps?: Omit<MenuProps, 'open'>;
|
|
8
8
|
menuListProps?: MenuListProps;
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -37,15 +37,15 @@ export const DropdownMenu = ({
|
|
|
37
37
|
anchorEl={anchorEl}
|
|
38
38
|
keepMounted
|
|
39
39
|
anchorOrigin={{
|
|
40
|
-
vertical:
|
|
41
|
-
horizontal:
|
|
40
|
+
vertical: 'bottom',
|
|
41
|
+
horizontal: 'right',
|
|
42
42
|
}}
|
|
43
43
|
open={open}
|
|
44
44
|
onClose={handleClose}
|
|
45
45
|
transitionDuration={150}
|
|
46
46
|
transformOrigin={{
|
|
47
|
-
vertical:
|
|
48
|
-
horizontal:
|
|
47
|
+
vertical: 'top',
|
|
48
|
+
horizontal: 'right',
|
|
49
49
|
}}
|
|
50
50
|
MenuListProps={{
|
|
51
51
|
...menuListProps,
|
|
@@ -55,7 +55,7 @@ export const DropdownMenu = ({
|
|
|
55
55
|
{menu.map((item, index) => (
|
|
56
56
|
<Fragment key={index}>
|
|
57
57
|
{item}
|
|
58
|
-
<Divider flexItem sx={{ margin:
|
|
58
|
+
<Divider flexItem sx={{ margin: '0 !important' }} />
|
|
59
59
|
</Fragment>
|
|
60
60
|
))}
|
|
61
61
|
</Menu>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ListItemIcon, MenuItemProps, SxProps } from
|
|
2
|
-
import { ReactNode } from
|
|
3
|
-
import { StyledMenuItem } from
|
|
1
|
+
import { ListItemIcon, MenuItemProps, SxProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { StyledMenuItem } from './styles';
|
|
4
4
|
|
|
5
5
|
export type DropdownMenuItemProps = {
|
|
6
6
|
icon?: ReactNode;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { IconButton, MenuItem, styled } from
|
|
1
|
+
import { IconButton, MenuItem, styled } from '@mui/material';
|
|
2
2
|
|
|
3
3
|
export const StyledIconButton = styled(IconButton, {
|
|
4
|
-
shouldForwardProp: (prop) => prop !==
|
|
4
|
+
shouldForwardProp: (prop) => prop !== 'outlined',
|
|
5
5
|
})<{ outlined?: boolean }>(({ theme, outlined }) => ({
|
|
6
6
|
...(outlined && {
|
|
7
7
|
border: `1px solid ${theme.palette.primary.main}`,
|
|
8
|
-
borderRadius:
|
|
9
|
-
height:
|
|
10
|
-
width:
|
|
8
|
+
borderRadius: '5px',
|
|
9
|
+
height: '40px',
|
|
10
|
+
width: '40px',
|
|
11
11
|
}),
|
|
12
12
|
}));
|
|
13
13
|
|
|
14
14
|
export const StyledMenuItem = styled(MenuItem)(({}) => ({
|
|
15
|
-
display:
|
|
16
|
-
alignItems:
|
|
17
|
-
gap:
|
|
18
|
-
|
|
19
|
-
minWidth:
|
|
15
|
+
display: 'flex',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
gap: '5px',
|
|
18
|
+
'& .MuiListItemIcon-root': {
|
|
19
|
+
minWidth: '24px',
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
height:
|
|
23
|
-
width:
|
|
21
|
+
'& .MuiSvgIcon-root': {
|
|
22
|
+
height: '14px',
|
|
23
|
+
width: '14px',
|
|
24
24
|
},
|
|
25
25
|
}));
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
BoxProps,
|
|
4
|
+
IconButton,
|
|
5
|
+
Stack,
|
|
6
|
+
styled,
|
|
7
|
+
Typography,
|
|
8
|
+
useTheme,
|
|
9
|
+
} 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';
|
|
17
|
+
|
|
18
|
+
export type PreviewFilesProps = {
|
|
19
|
+
files: File[] | File | null;
|
|
20
|
+
label?: string;
|
|
21
|
+
setFiles?:
|
|
22
|
+
| React.Dispatch<React.SetStateAction<File | null>>
|
|
23
|
+
| React.Dispatch<React.SetStateAction<File[]>>;
|
|
24
|
+
} & BoxProps;
|
|
25
|
+
|
|
26
|
+
export const PreviewFiles = ({
|
|
27
|
+
files,
|
|
28
|
+
label,
|
|
29
|
+
setFiles,
|
|
30
|
+
...props
|
|
31
|
+
}: PreviewFilesProps) => {
|
|
32
|
+
const theme = useTheme();
|
|
33
|
+
const [previews, setPreviews] = useState<Record<string, string>>({});
|
|
34
|
+
|
|
35
|
+
const fileArray = useMemo(() => {
|
|
36
|
+
if (Array.isArray(files)) return files;
|
|
37
|
+
return files ? [files] : [];
|
|
38
|
+
}, [files]);
|
|
39
|
+
|
|
40
|
+
const handleFilePreview = useCallback(
|
|
41
|
+
(file: File) => {
|
|
42
|
+
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
|
+
);
|
|
47
|
+
} 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);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
[previews],
|
|
61
|
+
);
|
|
62
|
+
|
|
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
|
+
if (fileArray.length === 0) return null;
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<Box {...props}>
|
|
112
|
+
{label && (
|
|
113
|
+
<Typography
|
|
114
|
+
marginBottom={'8px'}
|
|
115
|
+
fontSize={'14px'}
|
|
116
|
+
color={theme.palette.text.secondary}
|
|
117
|
+
variant="body2"
|
|
118
|
+
>
|
|
119
|
+
{label}
|
|
120
|
+
</Typography>
|
|
121
|
+
)}
|
|
122
|
+
{fileArray.map((file, index) => (
|
|
123
|
+
<PreviewContainer
|
|
124
|
+
key={file.name + file.lastModified}
|
|
125
|
+
onClick={() => handleFilePreview(file)}
|
|
126
|
+
>
|
|
127
|
+
<Stack
|
|
128
|
+
direction={'row'}
|
|
129
|
+
sx={{ display: 'flex', alignItems: 'center' }}
|
|
130
|
+
>
|
|
131
|
+
{getFileIcon(file)}
|
|
132
|
+
<Stack direction={'column'} marginLeft={'8px'}>
|
|
133
|
+
<Typography
|
|
134
|
+
fontSize={'14px'}
|
|
135
|
+
color={theme.palette.primary.main}
|
|
136
|
+
variant="label1"
|
|
137
|
+
>
|
|
138
|
+
{file.name}
|
|
139
|
+
</Typography>
|
|
140
|
+
<Typography color={theme.palette.text.tertiary} variant="label2">
|
|
141
|
+
{formatFileSize(file.size)}
|
|
142
|
+
</Typography>
|
|
143
|
+
</Stack>
|
|
144
|
+
</Stack>
|
|
145
|
+
<IconButton onClick={handleDelete(file)}>
|
|
146
|
+
<DeleteIcon />
|
|
147
|
+
</IconButton>
|
|
148
|
+
</PreviewContainer>
|
|
149
|
+
))}
|
|
150
|
+
</Box>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const PreviewContainer = styled(Box)(({ theme }) => ({
|
|
155
|
+
width: '100%',
|
|
156
|
+
height: '60px',
|
|
157
|
+
cursor: 'pointer',
|
|
158
|
+
backgroundColor: theme.palette.secondary.light,
|
|
159
|
+
padding: '16px 8px',
|
|
160
|
+
borderRadius: '10px',
|
|
161
|
+
display: 'flex',
|
|
162
|
+
justifyContent: 'space-between',
|
|
163
|
+
alignItems: 'center',
|
|
164
|
+
marginBottom: '8px',
|
|
165
|
+
}));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Box, Stack } from
|
|
2
|
-
import { useMemo } from
|
|
3
|
-
import { Icons, Tooltip, Typography } from
|
|
1
|
+
import { Box, Stack } from '@mui/material';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { Icons, Tooltip, Typography } from '../../export';
|
|
4
4
|
import {
|
|
5
5
|
DefaultButtonProps,
|
|
6
6
|
InternalMenuButtonProps,
|
|
7
7
|
SubMenuButtonProps,
|
|
8
8
|
TooltipIconProps,
|
|
9
|
-
} from
|
|
10
|
-
import { createSidebarStyles } from
|
|
9
|
+
} from './interfaces';
|
|
10
|
+
import { createSidebarStyles } from './styles';
|
|
11
11
|
|
|
12
12
|
export const TooltipIcon = ({ name, icon }: TooltipIconProps) => {
|
|
13
13
|
return (
|
|
@@ -24,7 +24,7 @@ export const DefaultButton = ({
|
|
|
24
24
|
}: DefaultButtonProps) => {
|
|
25
25
|
const { StyledListItemButton, StyledListItemIcon } = useMemo(
|
|
26
26
|
() => createSidebarStyles(collapsed),
|
|
27
|
-
[collapsed]
|
|
27
|
+
[collapsed],
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
return (
|
|
@@ -42,22 +42,22 @@ export const InternalMenuButton = ({
|
|
|
42
42
|
}: InternalMenuButtonProps) => {
|
|
43
43
|
const { StyledListItemButton, StyledListItemIcon, HoverIcon } = useMemo(
|
|
44
44
|
() => createSidebarStyles(collapsed),
|
|
45
|
-
[collapsed]
|
|
45
|
+
[collapsed],
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
49
|
<StyledListItemButton collapsed={collapsed}>
|
|
50
50
|
<Stack
|
|
51
|
-
width={
|
|
51
|
+
width={'100%'}
|
|
52
52
|
direction="row"
|
|
53
|
-
alignItems={
|
|
54
|
-
justifyContent={
|
|
53
|
+
alignItems={'center'}
|
|
54
|
+
justifyContent={'space-between'}
|
|
55
55
|
>
|
|
56
|
-
<Stack direction="row" alignItems={
|
|
56
|
+
<Stack direction="row" alignItems={'center'}>
|
|
57
57
|
<StyledListItemIcon collapsed={collapsed}>{icon}</StyledListItemIcon>
|
|
58
58
|
<Typography variant="button1">{name}</Typography>
|
|
59
59
|
</Stack>
|
|
60
|
-
<HoverIcon display={
|
|
60
|
+
<HoverIcon display={'flex'} className="hoverIcon">
|
|
61
61
|
<Icons.RedoIcon size={18} />
|
|
62
62
|
</HoverIcon>
|
|
63
63
|
</Stack>
|
|
@@ -73,22 +73,22 @@ export const SubMenuButton = ({
|
|
|
73
73
|
}: SubMenuButtonProps) => {
|
|
74
74
|
const { StyledListItemButton, StyledListItemIcon } = useMemo(
|
|
75
75
|
() => createSidebarStyles(collapsed),
|
|
76
|
-
[collapsed]
|
|
76
|
+
[collapsed],
|
|
77
77
|
);
|
|
78
78
|
|
|
79
79
|
return (
|
|
80
80
|
<StyledListItemButton collapsed={collapsed}>
|
|
81
81
|
<Stack
|
|
82
|
-
width={
|
|
82
|
+
width={'100%'}
|
|
83
83
|
direction="row"
|
|
84
|
-
alignItems={
|
|
85
|
-
justifyContent={
|
|
84
|
+
alignItems={'center'}
|
|
85
|
+
justifyContent={'space-between'}
|
|
86
86
|
>
|
|
87
|
-
<Stack direction="row" alignItems={
|
|
87
|
+
<Stack direction="row" alignItems={'center'}>
|
|
88
88
|
<StyledListItemIcon collapsed={collapsed}>{icon}</StyledListItemIcon>
|
|
89
89
|
<Typography variant="button1">{name}</Typography>
|
|
90
90
|
</Stack>
|
|
91
|
-
<Box display={
|
|
91
|
+
<Box display={'flex'}>
|
|
92
92
|
{expanded ? <Icons.CollapseIcon /> : <Icons.ExpandIcon />}
|
|
93
93
|
</Box>
|
|
94
94
|
</Stack>
|
|
@@ -2,7 +2,7 @@ import { Stack } from '@mui/material';
|
|
|
2
2
|
import { motion } from 'framer-motion';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
4
|
import { useMatch, useResolvedPath } from 'react-router-dom';
|
|
5
|
-
import { SideMenuItemProps } from '../
|
|
5
|
+
import { SideMenuItemProps } from '../export';
|
|
6
6
|
import {
|
|
7
7
|
DefaultButton,
|
|
8
8
|
InternalMenuButton,
|
|
@@ -20,7 +20,8 @@ export const SidebarSubMenuItem = ({
|
|
|
20
20
|
let resolved = useResolvedPath(newPath);
|
|
21
21
|
let match = useMatch({ path: resolved.pathname, end: false });
|
|
22
22
|
|
|
23
|
-
const { StyledListItem, StyledLinkButton, StyledListItemButton } =
|
|
23
|
+
const { StyledListItem, StyledLinkButton, StyledListItemButton } =
|
|
24
|
+
createSidebarStyles(collapsed);
|
|
24
25
|
|
|
25
26
|
return (
|
|
26
27
|
<StyledListItem key={index} disablePadding className="listItem">
|