@codezee/sixtify-brahma 0.1.1
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/.github/workflows/deploy-storybook.yml +40 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +4 -0
- package/.lintstagedrc +5 -0
- package/.prettierignore +11 -0
- package/.prettierrc +22 -0
- package/.vscode/extensions.json +22 -0
- package/.vscode/settings.json +17 -0
- package/README.md +81 -0
- package/apps/docs/.eslintrc.cjs +4 -0
- package/apps/docs/.eslintrc.js +9 -0
- package/apps/docs/.storybook/main.ts +23 -0
- package/apps/docs/.storybook/preview.tsx +27 -0
- package/apps/docs/next-env.d.ts +5 -0
- package/apps/docs/next.config.mjs +4 -0
- package/apps/docs/package.json +38 -0
- package/apps/docs/public/globals.css +25 -0
- package/apps/docs/stories/AgGrid/AgGrid.stories.tsx +69 -0
- package/apps/docs/stories/AppBar/AppBar.stories.tsx +39 -0
- package/apps/docs/stories/Breadcrumbs/Breadcrumbs.stories.tsx +37 -0
- package/apps/docs/stories/Button/ButtonGroup.stories.tsx +99 -0
- package/apps/docs/stories/Button/button.stories.tsx +99 -0
- package/apps/docs/stories/Card/AttendanceCard.stories.tsx +37 -0
- package/apps/docs/stories/Card/Card.stories.tsx +39 -0
- package/apps/docs/stories/Charts/PieChart.stories.tsx +264 -0
- package/apps/docs/stories/Chips/Chip.stories.tsx +141 -0
- package/apps/docs/stories/Chips/ChipWithBorder.stories.tsx +18 -0
- package/apps/docs/stories/Chips/FilterPill.stories.tsx +24 -0
- package/apps/docs/stories/Color/Color.stories.tsx +14 -0
- package/apps/docs/stories/Dialog/ButtomDialog.stories.tsx +47 -0
- package/apps/docs/stories/Dialog/DeleteDialog.stories.tsx +31 -0
- package/apps/docs/stories/Dialog/Dialog.stories.tsx +47 -0
- package/apps/docs/stories/Drawer/Drawer.stories.tsx +94 -0
- package/apps/docs/stories/FilterList/FilterList.stories.tsx +88 -0
- package/apps/docs/stories/FilterList/FilterListV2.stories.tsx +92 -0
- package/apps/docs/stories/FormFields/AutoComplete.stories.tsx +87 -0
- package/apps/docs/stories/FormFields/CheckBox.stories.tsx +61 -0
- package/apps/docs/stories/FormFields/DatePicker.stories.tsx +98 -0
- package/apps/docs/stories/FormFields/DateRangePicker.stories.tsx +37 -0
- package/apps/docs/stories/FormFields/FileUpload.stories.tsx +83 -0
- package/apps/docs/stories/FormFields/ImageUpload.stories.tsx +69 -0
- package/apps/docs/stories/FormFields/ListItemButton.stories.tsx +59 -0
- package/apps/docs/stories/FormFields/RadioGroupField.stories.tsx +170 -0
- package/apps/docs/stories/FormFields/SearchField.stories.tsx +72 -0
- package/apps/docs/stories/FormFields/TextField.stories.tsx +111 -0
- package/apps/docs/stories/FormFields/TimeField.stories.tsx +82 -0
- package/apps/docs/stories/FormFields/TimePicker.stories.tsx +82 -0
- package/apps/docs/stories/Indicator/Indicator.stories.tsx +33 -0
- package/apps/docs/stories/Indicator/SeverityIndicator.stories.tsx +27 -0
- package/apps/docs/stories/Layouts/FormRow.stories.tsx +45 -0
- package/apps/docs/stories/PadBox/PadBox.stories.tsx +49 -0
- package/apps/docs/stories/Stepper/Stepper.stories.tsx +75 -0
- package/apps/docs/stories/Stepper/StepperV2.stories.tsx +44 -0
- package/apps/docs/stories/Timeline/AttendanceStatus.stories.tsx +29 -0
- package/apps/docs/stories/Timeline/Timeline.stories.tsx +38 -0
- package/apps/docs/stories/Tooltip/Tooltip.stories.tsx +30 -0
- package/apps/docs/stories/UserProfileMenu/UserProfileMenu.stories.tsx +112 -0
- package/apps/docs/tsconfig.json +19 -0
- package/commitlint.config.cjs +6 -0
- package/index.ts +1 -0
- package/package.json +74 -0
- package/packages/eslint-config/README.md +3 -0
- package/packages/eslint-config/library.js +88 -0
- package/packages/eslint-config/next.js +85 -0
- package/packages/eslint-config/package.json +19 -0
- package/packages/eslint-config/react-internal.js +89 -0
- package/packages/shared-components/.eslintrc.js +10 -0
- package/packages/shared-components/package.json +22 -0
- package/packages/shared-components/src/Actions/AddAction.tsx +13 -0
- package/packages/shared-components/src/Actions/CalendarAction.tsx +13 -0
- package/packages/shared-components/src/Actions/DeleteAction.tsx +13 -0
- package/packages/shared-components/src/Actions/DownloadAction.tsx +13 -0
- package/packages/shared-components/src/Actions/EditAction.tsx +13 -0
- package/packages/shared-components/src/Actions/HistoryAction.tsx +13 -0
- package/packages/shared-components/src/Actions/index.ts +6 -0
- package/packages/shared-components/src/AgGrid/ActionCell/ActionCell.tsx +55 -0
- package/packages/shared-components/src/AgGrid/ActionCell/Popover.tsx +32 -0
- package/packages/shared-components/src/AgGrid/AgGrid.tsx +87 -0
- package/packages/shared-components/src/AgGrid/LoadingCell.tsx +5 -0
- package/packages/shared-components/src/AgGrid/index.ts +3 -0
- package/packages/shared-components/src/AppBar/AppBar.styled.tsx +25 -0
- package/packages/shared-components/src/AppBar/AppBar.tsx +20 -0
- package/packages/shared-components/src/AppBar/index.ts +1 -0
- package/packages/shared-components/src/Breadcrumbs/Breadcrumbs.tsx +76 -0
- package/packages/shared-components/src/Breadcrumbs/index.ts +1 -0
- package/packages/shared-components/src/Button/ActionButton.tsx +38 -0
- package/packages/shared-components/src/Button/Button.tsx +19 -0
- package/packages/shared-components/src/Button/ButtonGroup.tsx +37 -0
- package/packages/shared-components/src/Button/index.ts +3 -0
- package/packages/shared-components/src/Card/AttendanceCard.tsx +51 -0
- package/packages/shared-components/src/Card/Card.tsx +34 -0
- package/packages/shared-components/src/Card/CardItem/CardItem.tsx +33 -0
- package/packages/shared-components/src/Card/CardItem/CardItemValue.tsx +98 -0
- package/packages/shared-components/src/Card/CardItem/index.ts +2 -0
- package/packages/shared-components/src/Card/ProfileCard/ProfileCard.tsx +40 -0
- package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardBody.tsx +53 -0
- package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardHeader.tsx +96 -0
- package/packages/shared-components/src/Card/index.ts +6 -0
- package/packages/shared-components/src/Charts/PieChart.tsx +69 -0
- package/packages/shared-components/src/Charts/index.ts +1 -0
- package/packages/shared-components/src/Chips/Chip.tsx +26 -0
- package/packages/shared-components/src/Chips/ChipWithBorder.tsx +39 -0
- package/packages/shared-components/src/Chips/FilterPill.tsx +47 -0
- package/packages/shared-components/src/Chips/index.ts +3 -0
- package/packages/shared-components/src/Dialog/BottomDialog.styled.tsx +28 -0
- package/packages/shared-components/src/Dialog/BottomDialog.tsx +37 -0
- package/packages/shared-components/src/Dialog/DeleteDialog.tsx +48 -0
- package/packages/shared-components/src/Dialog/Dialog.tsx +61 -0
- package/packages/shared-components/src/Dialog/index.ts +3 -0
- package/packages/shared-components/src/Drawer/Bullet.tsx +12 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItem.tsx +50 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItemList.tsx +105 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerSubMenuItemList.tsx +125 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/MenuItem.tsx +0 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/Popover.tsx +45 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/Popper.tsx +43 -0
- package/packages/shared-components/src/Drawer/Drawer.styled.tsx +51 -0
- package/packages/shared-components/src/Drawer/Drawer.tsx +55 -0
- package/packages/shared-components/src/Drawer/MenuItem.tsx +69 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerCollapse.tsx +13 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItem.tsx +46 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItemList.tsx +249 -0
- package/packages/shared-components/src/Drawer/index.ts +1 -0
- package/packages/shared-components/src/FilterList/FilterList.tsx +172 -0
- package/packages/shared-components/src/FilterList/FilterListV2.tsx +504 -0
- package/packages/shared-components/src/FilterList/FilterPopup.tsx +148 -0
- package/packages/shared-components/src/FilterList/FilterPopupWrapper.tsx +113 -0
- package/packages/shared-components/src/FilterList/FilterTypeWrapper.tsx +58 -0
- package/packages/shared-components/src/FilterList/getFormData.ts +29 -0
- package/packages/shared-components/src/FilterList/index.ts +3 -0
- package/packages/shared-components/src/FormFields/Autocomplete/Autocomplete.tsx +428 -0
- package/packages/shared-components/src/FormFields/Autocomplete/Skeleton.tsx +26 -0
- package/packages/shared-components/src/FormFields/Autocomplete/index.ts +1 -0
- package/packages/shared-components/src/FormFields/CheckBox/CheckBox.styled.tsx +67 -0
- package/packages/shared-components/src/FormFields/CheckBox/CheckBox.tsx +44 -0
- package/packages/shared-components/src/FormFields/CheckBox/Skeleton.tsx +12 -0
- package/packages/shared-components/src/FormFields/CheckBox/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DatePicker/DatePicker.tsx +206 -0
- package/packages/shared-components/src/FormFields/DatePicker/Skeleton.tsx +21 -0
- package/packages/shared-components/src/FormFields/DatePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/DateRangePicker.tsx +96 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/Skeleton.tsx +38 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DateTimePicker/DateTimePicker.tsx +245 -0
- package/packages/shared-components/src/FormFields/DateTimePicker/Skeleton.tsx +24 -0
- package/packages/shared-components/src/FormFields/DateTimePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.styled.tsx +22 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.tsx +197 -0
- package/packages/shared-components/src/FormFields/FileUpload/Skeleton.tsx +21 -0
- package/packages/shared-components/src/FormFields/FileUpload/UploadedFileName.tsx +27 -0
- package/packages/shared-components/src/FormFields/FileUpload/index.ts +1 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.styled.tsx +16 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.tsx +181 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUploadView.tsx +65 -0
- package/packages/shared-components/src/FormFields/ImageUpload/PhotoCaptureDialog.tsx +74 -0
- package/packages/shared-components/src/FormFields/ImageUpload/Skeleton.tsx +31 -0
- package/packages/shared-components/src/FormFields/ImageUpload/index.ts +2 -0
- package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.styled.tsx +22 -0
- package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.tsx +37 -0
- package/packages/shared-components/src/FormFields/ListItemButton/index.ts +1 -0
- package/packages/shared-components/src/FormFields/PasswordField/PasswordField.tsx +50 -0
- package/packages/shared-components/src/FormFields/PasswordField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/RadioGroupField/RadioGroupField.tsx +105 -0
- package/packages/shared-components/src/FormFields/RadioGroupField/Skeleton.tsx +26 -0
- package/packages/shared-components/src/FormFields/RadioGroupField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/SearchField/SearchField.tsx +21 -0
- package/packages/shared-components/src/FormFields/SearchField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/Switch/Skeleton.tsx +12 -0
- package/packages/shared-components/src/FormFields/Switch/Switch.tsx +33 -0
- package/packages/shared-components/src/FormFields/Switch/index.ts +1 -0
- package/packages/shared-components/src/FormFields/TextField/Skeleton.tsx +26 -0
- package/packages/shared-components/src/FormFields/TextField/TextField.tsx +92 -0
- package/packages/shared-components/src/FormFields/TextField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/TimeField/Skeleton.tsx +24 -0
- package/packages/shared-components/src/FormFields/TimeField/TimeField.tsx +120 -0
- package/packages/shared-components/src/FormFields/TimeField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/TimePicker/Skeleton.tsx +24 -0
- package/packages/shared-components/src/FormFields/TimePicker/TimePicker.tsx +162 -0
- package/packages/shared-components/src/FormFields/TimePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/index.ts +13 -0
- package/packages/shared-components/src/Indicator/Indicator.tsx +17 -0
- package/packages/shared-components/src/Indicator/SeverityIndicator.tsx +34 -0
- package/packages/shared-components/src/Indicator/index.ts +2 -0
- package/packages/shared-components/src/Layouts/FormContainer.tsx +6 -0
- package/packages/shared-components/src/Layouts/FormRow/FormRow.styled.tsx +39 -0
- package/packages/shared-components/src/Layouts/FormRow/FormRow.tsx +20 -0
- package/packages/shared-components/src/Layouts/FormRow/index.ts +1 -0
- package/packages/shared-components/src/Layouts/FormSection.tsx +22 -0
- package/packages/shared-components/src/Layouts/index.ts +3 -0
- package/packages/shared-components/src/Loader/FacebookCircularProgress.tsx +41 -0
- package/packages/shared-components/src/Loader/index.ts +1 -0
- package/packages/shared-components/src/PadBox/PadBox.tsx +21 -0
- package/packages/shared-components/src/PadBox/index.ts +1 -0
- package/packages/shared-components/src/Stepper/Stepper.tsx +54 -0
- package/packages/shared-components/src/Stepper/StepperV2.tsx +115 -0
- package/packages/shared-components/src/Stepper/StepperV3.tsx +72 -0
- package/packages/shared-components/src/Stepper/index.ts +3 -0
- package/packages/shared-components/src/Svgs/AppLogo/AppLogoMedium.tsx +65 -0
- package/packages/shared-components/src/Svgs/AppLogo/AppLogoSmall.tsx +48 -0
- package/packages/shared-components/src/Svgs/ArrowUp.tsx +11 -0
- package/packages/shared-components/src/Svgs/Company/CompanyBanner.tsx +480 -0
- package/packages/shared-components/src/Svgs/Company/index.ts +1 -0
- package/packages/shared-components/src/Svgs/Drawer/SettingIcon.tsx +51 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgsEmployees.tsx +25 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgsOrganization.tsx +36 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgsTransaction.tsx +79 -0
- package/packages/shared-components/src/Svgs/Drawer/index.ts +4 -0
- package/packages/shared-components/src/Svgs/FormAction.tsx +118 -0
- package/packages/shared-components/src/Svgs/LogoIcon.tsx +74 -0
- package/packages/shared-components/src/Svgs/SvgAdd.tsx +28 -0
- package/packages/shared-components/src/Svgs/SvgCalendar.tsx +89 -0
- package/packages/shared-components/src/Svgs/SvgDelete.tsx +55 -0
- package/packages/shared-components/src/Svgs/SvgDownload.tsx +20 -0
- package/packages/shared-components/src/Svgs/SvgFilterList.tsx +19 -0
- package/packages/shared-components/src/Svgs/SvgNoLogo.tsx +66 -0
- package/packages/shared-components/src/Svgs/SvgNoSign.tsx +28 -0
- package/packages/shared-components/src/Svgs/SvgsDrop.tsx +44 -0
- package/packages/shared-components/src/Svgs/SvgsEdit.tsx +42 -0
- package/packages/shared-components/src/Svgs/SvgsHistory.tsx +40 -0
- package/packages/shared-components/src/Svgs/SvgsHome.tsx +16 -0
- package/packages/shared-components/src/Svgs/SvgsIndicator.tsx +20 -0
- package/packages/shared-components/src/Svgs/index.ts +12 -0
- package/packages/shared-components/src/Tab/Skeleton.tsx +15 -0
- package/packages/shared-components/src/Tab/Tabs.tsx +64 -0
- package/packages/shared-components/src/Tab/index.ts +1 -0
- package/packages/shared-components/src/Timeline/AttendanceStatus.tsx +56 -0
- package/packages/shared-components/src/Timeline/Timeline.tsx +171 -0
- package/packages/shared-components/src/Timeline/TimelineTrackSegments.tsx +121 -0
- package/packages/shared-components/src/Timeline/index.ts +2 -0
- package/packages/shared-components/src/Toast/Toast.tsx +59 -0
- package/packages/shared-components/src/Toast/ToastBody.tsx +26 -0
- package/packages/shared-components/src/Toast/ToastFooterLink.tsx +19 -0
- package/packages/shared-components/src/Toast/Toaster.styled.tsx +76 -0
- package/packages/shared-components/src/Toast/Toaster.tsx +21 -0
- package/packages/shared-components/src/Toast/index.ts +3 -0
- package/packages/shared-components/src/Toast/toasts.tsx +28 -0
- package/packages/shared-components/src/Toast/types.ts +13 -0
- package/packages/shared-components/src/Tooltip/Tooltip.tsx +36 -0
- package/packages/shared-components/src/Tooltip/index.ts +1 -0
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.styled.tsx +37 -0
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.tsx +107 -0
- package/packages/shared-components/src/UserProfileMenu/index.ts +1 -0
- package/packages/shared-components/src/index.ts +24 -0
- package/packages/shared-components/src/utils/colorVariant.ts +142 -0
- package/packages/shared-components/src/utils/date.ts +11 -0
- package/packages/shared-components/src/utils/file.ts +20 -0
- package/packages/shared-components/src/utils/fileSizeValidate.ts +5 -0
- package/packages/shared-components/src/utils/index.ts +5 -0
- package/packages/shared-components/src/utils/theme/colorPalette.ts +110 -0
- package/packages/shared-components/src/utils/theme/colorPaletteUI.tsx +44 -0
- package/packages/shared-components/src/utils/theme/paletteDark.ts +10 -0
- package/packages/shared-components/src/utils/theme/paletteLight.ts +31 -0
- package/packages/shared-components/src/utils/theme/theme.ts +289 -0
- package/packages/shared-components/src/utils/theme/types.ts +18 -0
- package/packages/shared-components/src/utils/theme/typography.ts +52 -0
- package/packages/shared-components/src/utils/urlToNestedObject.ts +9 -0
- package/packages/shared-components/tsconfig.json +8 -0
- package/packages/shared-components/tsconfig.lint.json +8 -0
- package/packages/shared-components/turbo/generators/config.ts +33 -0
- package/packages/shared-components/turbo/generators/templates/component.hbs +8 -0
- package/packages/typescript-config/base.json +20 -0
- package/packages/typescript-config/nextjs.json +13 -0
- package/packages/typescript-config/package.json +9 -0
- package/packages/typescript-config/react-library.json +8 -0
- package/pnpm-workspace.yaml +3 -0
- package/turbo.json +44 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
IconButton,
|
|
4
|
+
Link,
|
|
5
|
+
Breadcrumbs as MuiBreadcrumbs,
|
|
6
|
+
Typography,
|
|
7
|
+
useTheme,
|
|
8
|
+
} from "@mui/material";
|
|
9
|
+
import type { ReactNode } from "react";
|
|
10
|
+
import { v4 as uuidv4 } from "uuid";
|
|
11
|
+
|
|
12
|
+
type BreadcrumbItem = {
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
text?: string;
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type BreadcrumbProps = {
|
|
19
|
+
items: BreadcrumbItem[];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Breadcrumbs = ({ items }: BreadcrumbProps) => {
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
|
|
25
|
+
const { butterflyBlue } = theme.palette.app.color;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<MuiBreadcrumbs>
|
|
29
|
+
{items.map((item) => {
|
|
30
|
+
const { icon, text, onClick } = item;
|
|
31
|
+
|
|
32
|
+
if (onClick) {
|
|
33
|
+
return (
|
|
34
|
+
<Link
|
|
35
|
+
key={uuidv4()}
|
|
36
|
+
underline="hover"
|
|
37
|
+
sx={{ display: "flex", alignItems: "center" }}
|
|
38
|
+
onClick={(e) => {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
|
|
41
|
+
onClick();
|
|
42
|
+
}}
|
|
43
|
+
href="#"
|
|
44
|
+
>
|
|
45
|
+
{icon && (
|
|
46
|
+
<IconButton
|
|
47
|
+
sx={{
|
|
48
|
+
color: butterflyBlue[900],
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{icon}
|
|
52
|
+
</IconButton>
|
|
53
|
+
)}
|
|
54
|
+
{text && <Typography>{text}</Typography>}
|
|
55
|
+
</Link>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Box key={uuidv4()}>
|
|
61
|
+
{icon && (
|
|
62
|
+
<IconButton
|
|
63
|
+
sx={{
|
|
64
|
+
color: butterflyBlue[900],
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
{icon}
|
|
68
|
+
</IconButton>
|
|
69
|
+
)}
|
|
70
|
+
{text && <Typography>{text}</Typography>}
|
|
71
|
+
</Box>
|
|
72
|
+
);
|
|
73
|
+
})}
|
|
74
|
+
</MuiBreadcrumbs>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Breadcrumbs";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ExpandMoreRoundedIcon from "@mui/icons-material/ExpandMoreRounded";
|
|
2
|
+
import type { ButtonProps as MuiButtonProps } from "@mui/material";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
CircularProgress,
|
|
6
|
+
Divider,
|
|
7
|
+
Stack,
|
|
8
|
+
useTheme,
|
|
9
|
+
} from "@mui/material";
|
|
10
|
+
export type ActionButtonProps = MuiButtonProps & {
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const ActionButton = ({
|
|
15
|
+
loading = false,
|
|
16
|
+
children,
|
|
17
|
+
...rest
|
|
18
|
+
}: ActionButtonProps) => {
|
|
19
|
+
const theme = useTheme();
|
|
20
|
+
|
|
21
|
+
const { lightBlue } = theme.palette.app.color;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Button {...rest}>
|
|
25
|
+
<Stack gap="10px" flexDirection="row" alignItems="center">
|
|
26
|
+
{loading ? <CircularProgress size={28} /> : children}
|
|
27
|
+
<Divider
|
|
28
|
+
orientation="vertical"
|
|
29
|
+
sx={{
|
|
30
|
+
borderColor: lightBlue[100],
|
|
31
|
+
height: "22px",
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
<ExpandMoreRoundedIcon fontSize="small" />
|
|
35
|
+
</Stack>
|
|
36
|
+
</Button>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ButtonProps as MuiButtonProps } from "@mui/material";
|
|
2
|
+
import { CircularProgress, Button as MuiButton } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
export type ButtonProps = MuiButtonProps & {
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Button = ({
|
|
9
|
+
loading = false,
|
|
10
|
+
children,
|
|
11
|
+
disabled = false,
|
|
12
|
+
...rest
|
|
13
|
+
}: ButtonProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<MuiButton disabled={loading || disabled} {...rest}>
|
|
16
|
+
{loading ? <CircularProgress size={28} /> : children}
|
|
17
|
+
</MuiButton>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ButtonGroup as MuiButtonGroup } from "@mui/material";
|
|
2
|
+
import { isFunction } from "lodash";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import { Button } from "./Button";
|
|
5
|
+
|
|
6
|
+
type ButtonObject = {
|
|
7
|
+
icon: ReactNode;
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
selected: boolean;
|
|
11
|
+
onClick: (value: string) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type ButtonGroupProps = {
|
|
15
|
+
renderButtons: ButtonObject[];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const ButtonGroup = ({ renderButtons }: ButtonGroupProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<MuiButtonGroup sx={{ boxShadow: "none" }} aria-label="Basic button group">
|
|
21
|
+
{renderButtons?.map(({ icon, value, label, selected, onClick }) => (
|
|
22
|
+
<Button
|
|
23
|
+
variant={!selected ? "outlined" : "contained"}
|
|
24
|
+
key={value}
|
|
25
|
+
onClick={() => {
|
|
26
|
+
if (isFunction(onClick)) {
|
|
27
|
+
onClick(value);
|
|
28
|
+
}
|
|
29
|
+
}}
|
|
30
|
+
startIcon={icon}
|
|
31
|
+
>
|
|
32
|
+
{label}
|
|
33
|
+
</Button>
|
|
34
|
+
))}
|
|
35
|
+
</MuiButtonGroup>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Box, Skeleton, Stack, Typography } from "@mui/material";
|
|
2
|
+
import { PadBox } from "../PadBox";
|
|
3
|
+
import { SvgsIndicator } from "../Svgs/SvgsIndicator";
|
|
4
|
+
import { getColorByVariant, type WorkDayType } from "../utils/colorVariant";
|
|
5
|
+
|
|
6
|
+
type AttendanceCardProps = {
|
|
7
|
+
variant: WorkDayType;
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
};
|
|
12
|
+
export const AttendanceCard = ({
|
|
13
|
+
variant,
|
|
14
|
+
label,
|
|
15
|
+
value,
|
|
16
|
+
isLoading = false,
|
|
17
|
+
}: AttendanceCardProps) => {
|
|
18
|
+
return (
|
|
19
|
+
<Box
|
|
20
|
+
sx={{
|
|
21
|
+
width: "223px",
|
|
22
|
+
height: "93px",
|
|
23
|
+
borderRadius: "8px",
|
|
24
|
+
border: `1px solid ${getColorByVariant(variant)}`,
|
|
25
|
+
backgroundColor: `${getColorByVariant(variant, "light")}`,
|
|
26
|
+
position: "relative",
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<PadBox padding={{ padding: "15px" }}>
|
|
30
|
+
<Stack gap="15px">
|
|
31
|
+
<Typography>{label}</Typography>
|
|
32
|
+
{isLoading ? (
|
|
33
|
+
<Skeleton
|
|
34
|
+
width={80}
|
|
35
|
+
height={25}
|
|
36
|
+
sx={{
|
|
37
|
+
transform: "scale(1)",
|
|
38
|
+
borderRadius: "4px",
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
) : (
|
|
42
|
+
<Typography variant="h6">{value}</Typography>
|
|
43
|
+
)}
|
|
44
|
+
</Stack>
|
|
45
|
+
<Box sx={{ position: "absolute", top: "0px", right: "5px" }}>
|
|
46
|
+
<SvgsIndicator variant={variant} />
|
|
47
|
+
</Box>
|
|
48
|
+
</PadBox>
|
|
49
|
+
</Box>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Box, Stack, Typography, useTheme } from "@mui/material";
|
|
2
|
+
import type { PropsWithChildren, ReactNode } from "react";
|
|
3
|
+
import { PadBox } from "../PadBox";
|
|
4
|
+
|
|
5
|
+
type CardProps = PropsWithChildren<{
|
|
6
|
+
heading?: ReactNode;
|
|
7
|
+
action?: ReactNode;
|
|
8
|
+
}>;
|
|
9
|
+
|
|
10
|
+
export function Card({ heading, children, action }: Readonly<CardProps>) {
|
|
11
|
+
const theme = useTheme();
|
|
12
|
+
|
|
13
|
+
const { lightBlue } = theme.palette.app.color;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Box bgcolor={lightBlue[50]} flex={1} sx={{ borderRadius: "5px" }}>
|
|
17
|
+
<PadBox padding={{ padding: 2 }}>
|
|
18
|
+
<Stack gap="10px">
|
|
19
|
+
<Stack
|
|
20
|
+
flexDirection="row"
|
|
21
|
+
alignItems="center"
|
|
22
|
+
justifyContent="space-between"
|
|
23
|
+
>
|
|
24
|
+
<Typography variant="h6">{heading}</Typography>
|
|
25
|
+
|
|
26
|
+
<Box>{action}</Box>
|
|
27
|
+
</Stack>
|
|
28
|
+
|
|
29
|
+
{children}
|
|
30
|
+
</Stack>
|
|
31
|
+
</PadBox>
|
|
32
|
+
</Box>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Stack, Typography } from "@mui/material";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
type CardItemProps = Readonly<{
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
value?: ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
|
|
9
|
+
export function CardItem({ label, value }: CardItemProps) {
|
|
10
|
+
return (
|
|
11
|
+
<Stack
|
|
12
|
+
direction="row"
|
|
13
|
+
justifyContent="space-between"
|
|
14
|
+
alignItems="center"
|
|
15
|
+
gap="5px"
|
|
16
|
+
>
|
|
17
|
+
{typeof label === "string" ? (
|
|
18
|
+
<Typography
|
|
19
|
+
variant="body1"
|
|
20
|
+
sx={{ fontWeight: 500 }}
|
|
21
|
+
flex={1}
|
|
22
|
+
maxWidth="400px"
|
|
23
|
+
>
|
|
24
|
+
{label} :
|
|
25
|
+
</Typography>
|
|
26
|
+
) : (
|
|
27
|
+
<> {label} :</>
|
|
28
|
+
)}
|
|
29
|
+
|
|
30
|
+
{value}
|
|
31
|
+
</Stack>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { AvatarOwnProps, SxProps, Theme } from "@mui/material";
|
|
2
|
+
import { Avatar, Skeleton, Stack, Typography, useTheme } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
type CardItemValueProps = {
|
|
5
|
+
title?: string;
|
|
6
|
+
subTitle?: string;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
showAvatar?: boolean;
|
|
10
|
+
sx?: SxProps<Theme>;
|
|
11
|
+
isHideTitle?: boolean;
|
|
12
|
+
variant?: AvatarOwnProps["variant"];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const CardItemValue = ({
|
|
16
|
+
title,
|
|
17
|
+
subTitle,
|
|
18
|
+
avatar,
|
|
19
|
+
loading = false,
|
|
20
|
+
showAvatar = false,
|
|
21
|
+
isHideTitle = false,
|
|
22
|
+
variant = "circular",
|
|
23
|
+
sx,
|
|
24
|
+
}: CardItemValueProps) => {
|
|
25
|
+
const theme = useTheme();
|
|
26
|
+
|
|
27
|
+
const { slate, iron } = theme.palette.app.color;
|
|
28
|
+
|
|
29
|
+
if (loading) {
|
|
30
|
+
return (
|
|
31
|
+
<Stack gap="10px " flex="1">
|
|
32
|
+
<Stack direction="row" gap="10px" alignItems="center">
|
|
33
|
+
{avatar && (
|
|
34
|
+
<Skeleton
|
|
35
|
+
variant="circular"
|
|
36
|
+
height="30px"
|
|
37
|
+
animation="wave"
|
|
38
|
+
width="30px"
|
|
39
|
+
/>
|
|
40
|
+
)}
|
|
41
|
+
<Skeleton
|
|
42
|
+
variant="rounded"
|
|
43
|
+
height={20}
|
|
44
|
+
animation="wave"
|
|
45
|
+
width="150px"
|
|
46
|
+
/>
|
|
47
|
+
</Stack>
|
|
48
|
+
|
|
49
|
+
{subTitle && (
|
|
50
|
+
<Skeleton
|
|
51
|
+
variant="rounded"
|
|
52
|
+
height={20}
|
|
53
|
+
animation="wave"
|
|
54
|
+
width="200px"
|
|
55
|
+
/>
|
|
56
|
+
)}
|
|
57
|
+
</Stack>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Stack gap="10px" flex="1">
|
|
63
|
+
<Stack gap="10px" direction="row" alignItems="center">
|
|
64
|
+
{showAvatar && <Avatar alt={title} src={avatar} variant={variant} />}
|
|
65
|
+
|
|
66
|
+
{!isHideTitle && (
|
|
67
|
+
<Typography
|
|
68
|
+
variant="body1"
|
|
69
|
+
sx={{
|
|
70
|
+
fontWeight: 400,
|
|
71
|
+
color: slate[900],
|
|
72
|
+
overflow: "hidden",
|
|
73
|
+
textOverflow: "ellipsis",
|
|
74
|
+
display: "-webkit-box",
|
|
75
|
+
WebkitLineClamp: 1,
|
|
76
|
+
WebkitBoxOrient: "vertical",
|
|
77
|
+
width: "min-contact",
|
|
78
|
+
...sx,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
{title ? title : "-"}
|
|
82
|
+
</Typography>
|
|
83
|
+
)}
|
|
84
|
+
</Stack>
|
|
85
|
+
|
|
86
|
+
{subTitle && (
|
|
87
|
+
<Typography
|
|
88
|
+
variant="body1"
|
|
89
|
+
sx={{
|
|
90
|
+
color: iron[500],
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
{subTitle}
|
|
94
|
+
</Typography>
|
|
95
|
+
)}
|
|
96
|
+
</Stack>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Box, Stack, useTheme } from "@mui/material";
|
|
2
|
+
import type { PropsWithChildren, ReactNode } from "react";
|
|
3
|
+
import { PadBox } from "../../PadBox";
|
|
4
|
+
|
|
5
|
+
type ProfileCardProps = PropsWithChildren<{
|
|
6
|
+
header: ReactNode;
|
|
7
|
+
body: ReactNode;
|
|
8
|
+
onClick: (e: React.MouseEvent) => void;
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
export function ProfileCard({
|
|
12
|
+
onClick,
|
|
13
|
+
header,
|
|
14
|
+
body,
|
|
15
|
+
}: Readonly<ProfileCardProps>) {
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
|
|
18
|
+
const { lightBlue, butterflyBlue } = theme.palette.app.color;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Box
|
|
22
|
+
bgcolor={lightBlue[50]}
|
|
23
|
+
flex={1}
|
|
24
|
+
sx={{
|
|
25
|
+
borderRadius: "10px",
|
|
26
|
+
cursor: "pointer",
|
|
27
|
+
":hover": { background: butterflyBlue[600] },
|
|
28
|
+
}}
|
|
29
|
+
height="400px"
|
|
30
|
+
onClick={onClick}
|
|
31
|
+
>
|
|
32
|
+
<PadBox padding={{ padding: "5px" }}>
|
|
33
|
+
<Stack height="100%" justifyContent="space-between">
|
|
34
|
+
{header}
|
|
35
|
+
{body}
|
|
36
|
+
</Stack>
|
|
37
|
+
</PadBox>
|
|
38
|
+
</Box>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import CallOutlinedIcon from "@mui/icons-material/CallOutlined";
|
|
2
|
+
import EmailOutlinedIcon from "@mui/icons-material/EmailOutlined";
|
|
3
|
+
import { Box, Stack } from "@mui/material";
|
|
4
|
+
import type { PropsWithChildren } from "react";
|
|
5
|
+
import { PadBox } from "../../../PadBox";
|
|
6
|
+
import { CardItem, CardItemValue } from "../../CardItem";
|
|
7
|
+
|
|
8
|
+
type ProfileCardBodyProps = PropsWithChildren<{
|
|
9
|
+
joiningDate: string;
|
|
10
|
+
department: string;
|
|
11
|
+
subDepartment: string;
|
|
12
|
+
email: string;
|
|
13
|
+
phone: string;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export function ProfileCardBody({
|
|
18
|
+
joiningDate,
|
|
19
|
+
department,
|
|
20
|
+
subDepartment,
|
|
21
|
+
email,
|
|
22
|
+
phone,
|
|
23
|
+
loading,
|
|
24
|
+
}: ProfileCardBodyProps) {
|
|
25
|
+
return (
|
|
26
|
+
<Box bgcolor="#F3F5F7" sx={{ borderRadius: "10px" }}>
|
|
27
|
+
<PadBox padding={{ padding: "12px" }}>
|
|
28
|
+
<Stack gap="10px">
|
|
29
|
+
<CardItem
|
|
30
|
+
label="Date of Joining"
|
|
31
|
+
value={<CardItemValue title={joiningDate} loading={loading} />}
|
|
32
|
+
/>
|
|
33
|
+
<CardItem
|
|
34
|
+
label="Department"
|
|
35
|
+
value={<CardItemValue title={department} loading={loading} />}
|
|
36
|
+
/>
|
|
37
|
+
<CardItem
|
|
38
|
+
label="Sub Department"
|
|
39
|
+
value={<CardItemValue title={subDepartment} loading={loading} />}
|
|
40
|
+
/>
|
|
41
|
+
<CardItem
|
|
42
|
+
label={<EmailOutlinedIcon />}
|
|
43
|
+
value={<CardItemValue title={email} loading={loading} />}
|
|
44
|
+
/>
|
|
45
|
+
<CardItem
|
|
46
|
+
label={<CallOutlinedIcon />}
|
|
47
|
+
value={<CardItemValue title={phone} loading={loading} />}
|
|
48
|
+
/>
|
|
49
|
+
</Stack>
|
|
50
|
+
</PadBox>
|
|
51
|
+
</Box>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { SxProps, Theme } from "@mui/material";
|
|
2
|
+
import { Box, Skeleton, Stack, Typography } from "@mui/material";
|
|
3
|
+
import type { PropsWithChildren, ReactNode } from "react";
|
|
4
|
+
import { DeleteAction } from "../../../Actions";
|
|
5
|
+
import { Chip } from "../../../Chips";
|
|
6
|
+
import { PadBox } from "../../../PadBox";
|
|
7
|
+
import { CardItemValue } from "../../CardItem";
|
|
8
|
+
|
|
9
|
+
type ProfileCardHeaderProps = PropsWithChildren<{
|
|
10
|
+
avatar: ReactNode;
|
|
11
|
+
employeeName: string;
|
|
12
|
+
designation: string;
|
|
13
|
+
employeeCode: string;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
isDraft?: boolean;
|
|
16
|
+
sx?: SxProps<Theme>;
|
|
17
|
+
onDeleteClick?: (e: React.MouseEvent) => void;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
export function ProfileCardHeader({
|
|
21
|
+
avatar,
|
|
22
|
+
employeeName,
|
|
23
|
+
designation,
|
|
24
|
+
employeeCode,
|
|
25
|
+
loading,
|
|
26
|
+
isDraft = false,
|
|
27
|
+
onDeleteClick,
|
|
28
|
+
}: ProfileCardHeaderProps) {
|
|
29
|
+
return (
|
|
30
|
+
<Box>
|
|
31
|
+
<PadBox padding={{ padding: "10px 5px 0px 10px" }}>
|
|
32
|
+
<Stack
|
|
33
|
+
gap="10px"
|
|
34
|
+
direction="row"
|
|
35
|
+
alignItems="center"
|
|
36
|
+
justifyContent="space-between"
|
|
37
|
+
>
|
|
38
|
+
{loading ? (
|
|
39
|
+
<Skeleton
|
|
40
|
+
variant="rounded"
|
|
41
|
+
height={20}
|
|
42
|
+
animation="wave"
|
|
43
|
+
width="100px"
|
|
44
|
+
/>
|
|
45
|
+
) : // eslint-disable-next-line sonarjs/no-nested-conditional
|
|
46
|
+
isDraft ? (
|
|
47
|
+
<Chip label="Draft" size="small" color="error" variant="outlined" />
|
|
48
|
+
) : (
|
|
49
|
+
<CardItemValue title={employeeCode} loading={loading} />
|
|
50
|
+
)}
|
|
51
|
+
|
|
52
|
+
{isDraft &&
|
|
53
|
+
(loading ? (
|
|
54
|
+
<Skeleton
|
|
55
|
+
variant="rounded"
|
|
56
|
+
height={20}
|
|
57
|
+
animation="wave"
|
|
58
|
+
width="50px"
|
|
59
|
+
/>
|
|
60
|
+
) : (
|
|
61
|
+
<DeleteAction onClick={onDeleteClick} />
|
|
62
|
+
))}
|
|
63
|
+
</Stack>
|
|
64
|
+
</PadBox>
|
|
65
|
+
<Stack alignItems="center" gap="8px">
|
|
66
|
+
{avatar}
|
|
67
|
+
{loading ? (
|
|
68
|
+
<Skeleton
|
|
69
|
+
variant="rounded"
|
|
70
|
+
height={30}
|
|
71
|
+
animation="wave"
|
|
72
|
+
width="300px"
|
|
73
|
+
/>
|
|
74
|
+
) : (
|
|
75
|
+
<Typography
|
|
76
|
+
variant="h6"
|
|
77
|
+
sx={{
|
|
78
|
+
overflow: "hidden",
|
|
79
|
+
textOverflow: "ellipsis",
|
|
80
|
+
display: "-webkit-box",
|
|
81
|
+
WebkitLineClamp: 1,
|
|
82
|
+
WebkitBoxOrient: "vertical",
|
|
83
|
+
}}
|
|
84
|
+
width="330px"
|
|
85
|
+
fontWeight="600"
|
|
86
|
+
textAlign="center"
|
|
87
|
+
>
|
|
88
|
+
{employeeName ?? "-"}
|
|
89
|
+
</Typography>
|
|
90
|
+
)}
|
|
91
|
+
|
|
92
|
+
<CardItemValue title={designation} loading={loading} />
|
|
93
|
+
</Stack>
|
|
94
|
+
</Box>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { PieChartProps as MuiPieChartProps } from "@mui/x-charts/PieChart";
|
|
3
|
+
import { PieChart as MuiPieChart } from "@mui/x-charts/PieChart";
|
|
4
|
+
import type { PieSeriesType, PieValueType } from "@mui/x-charts";
|
|
5
|
+
import type { MakeOptional } from "@mui/x-charts/internals";
|
|
6
|
+
import { useDrawingArea } from "@mui/x-charts/hooks";
|
|
7
|
+
import { styled } from "@mui/material/styles";
|
|
8
|
+
|
|
9
|
+
type PieChartProps = Omit<MuiPieChartProps, "series"> & {
|
|
10
|
+
series: MakeOptional<PieSeriesType<MakeOptional<PieValueType, "id">>, "type">;
|
|
11
|
+
label?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type PieCenterLabelProps = {
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const PieChart = ({
|
|
19
|
+
height = 235,
|
|
20
|
+
skipAnimation = false,
|
|
21
|
+
tooltip,
|
|
22
|
+
label,
|
|
23
|
+
series,
|
|
24
|
+
...rest
|
|
25
|
+
}: PieChartProps) => {
|
|
26
|
+
const valueFormatter = (item: MakeOptional<PieValueType, "id">) =>
|
|
27
|
+
`${item.value}%`;
|
|
28
|
+
|
|
29
|
+
const StyledText = styled("text")(({ theme }) => ({
|
|
30
|
+
fill: theme.palette.text.primary,
|
|
31
|
+
textAnchor: "middle",
|
|
32
|
+
dominantBaseline: "central",
|
|
33
|
+
fontSize: 20,
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
// eslint-disable-next-line sonarjs/no-unstable-nested-components
|
|
37
|
+
const PieCenterLabel = ({ children }: PieCenterLabelProps) => {
|
|
38
|
+
const { width, height, left, top } = useDrawingArea();
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<StyledText x={left + width / 2} y={top + height / 2}>
|
|
42
|
+
{children}
|
|
43
|
+
</StyledText>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<MuiPieChart
|
|
49
|
+
height={height}
|
|
50
|
+
sx={{
|
|
51
|
+
transform: "translate(50px, 0px)",
|
|
52
|
+
overflow: "visible",
|
|
53
|
+
}}
|
|
54
|
+
series={[
|
|
55
|
+
{
|
|
56
|
+
arcLabel: (params) => params.label ?? "",
|
|
57
|
+
arcLabelMinAngle: 20,
|
|
58
|
+
valueFormatter,
|
|
59
|
+
...series,
|
|
60
|
+
},
|
|
61
|
+
]}
|
|
62
|
+
{...rest}
|
|
63
|
+
tooltip={tooltip}
|
|
64
|
+
skipAnimation={skipAnimation}
|
|
65
|
+
>
|
|
66
|
+
<PieCenterLabel>{label}</PieCenterLabel>
|
|
67
|
+
</MuiPieChart>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PieChart";
|