@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,51 @@
|
|
|
1
|
+
import type { CSSObject, Theme } from "@mui/material";
|
|
2
|
+
import { Box, Drawer as MuiDrawer, styled } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
export const Bullet = styled(Box)(({ theme }) => ({
|
|
5
|
+
width: 7,
|
|
6
|
+
height: 7,
|
|
7
|
+
borderRadius: "50%",
|
|
8
|
+
background: theme.palette.app.color.butterflyBlue[400],
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
const drawerWidth = 300;
|
|
12
|
+
|
|
13
|
+
const openedMixin = (theme: Theme): CSSObject => ({
|
|
14
|
+
width: drawerWidth,
|
|
15
|
+
transition: theme.transitions.create("width", {
|
|
16
|
+
easing: theme.transitions.easing.sharp,
|
|
17
|
+
duration: theme.transitions.duration.enteringScreen,
|
|
18
|
+
}),
|
|
19
|
+
overflowX: "hidden",
|
|
20
|
+
backgroundColor: theme.palette.app.color.mirage[900],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const closedMixin = (theme: Theme): CSSObject => ({
|
|
24
|
+
transition: theme.transitions.create("width", {
|
|
25
|
+
easing: theme.transitions.easing.sharp,
|
|
26
|
+
duration: theme.transitions.duration.leavingScreen,
|
|
27
|
+
}),
|
|
28
|
+
overflowX: "hidden",
|
|
29
|
+
width: "80px",
|
|
30
|
+
[theme.breakpoints.up("sm")]: {
|
|
31
|
+
width: "80px",
|
|
32
|
+
},
|
|
33
|
+
backgroundColor: theme.palette.app.color.mirage[900],
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const StyledDrawer = styled(MuiDrawer, {
|
|
37
|
+
shouldForwardProp: (prop) => prop !== "open",
|
|
38
|
+
})(({ theme, open }) => ({
|
|
39
|
+
width: drawerWidth,
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
whiteSpace: "nowrap",
|
|
42
|
+
boxSizing: "border-box",
|
|
43
|
+
...(open && {
|
|
44
|
+
...openedMixin(theme),
|
|
45
|
+
"& .MuiDrawer-paper": openedMixin(theme),
|
|
46
|
+
}),
|
|
47
|
+
...(!open && {
|
|
48
|
+
...closedMixin(theme),
|
|
49
|
+
"& .MuiDrawer-paper": closedMixin(theme),
|
|
50
|
+
}),
|
|
51
|
+
}));
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Box } from "@mui/material";
|
|
4
|
+
import List from "@mui/material/List";
|
|
5
|
+
import type { ReactNode, HTMLAttributeAnchorTarget } from "react";
|
|
6
|
+
import { PadBox } from "../PadBox";
|
|
7
|
+
import { AppLogoMedium } from "../Svgs/AppLogo/AppLogoMedium";
|
|
8
|
+
import { AppLogoSmall } from "../Svgs/AppLogo/AppLogoSmall";
|
|
9
|
+
import { CloseDrawerMenuItemList } from "./CloseDrawer/CloseDrawerMenuItemList";
|
|
10
|
+
import { StyledDrawer } from "./Drawer.styled";
|
|
11
|
+
import { OpenDrawerMenuItemList } from "./OpenDrawer/OpenDrawerMenuItemList";
|
|
12
|
+
|
|
13
|
+
export type MenuItem = {
|
|
14
|
+
key: string; // this key should be unique in list
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
title: string;
|
|
17
|
+
onClick?: (href: string, target?: HTMLAttributeAnchorTarget) => void;
|
|
18
|
+
menuItems?: MenuItem[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type DrawerProps = {
|
|
22
|
+
menuItems?: MenuItem[];
|
|
23
|
+
open: boolean;
|
|
24
|
+
currentPathname: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Drawer = ({
|
|
28
|
+
menuItems = [],
|
|
29
|
+
open,
|
|
30
|
+
currentPathname,
|
|
31
|
+
}: DrawerProps) => {
|
|
32
|
+
return (
|
|
33
|
+
<StyledDrawer variant="permanent" open={open}>
|
|
34
|
+
<Box textAlign="center">
|
|
35
|
+
<PadBox padding={{ paddingTop: "1.5rem" }}>
|
|
36
|
+
{open ? <AppLogoMedium /> : <AppLogoSmall />}
|
|
37
|
+
</PadBox>
|
|
38
|
+
</Box>
|
|
39
|
+
|
|
40
|
+
<List component="nav">
|
|
41
|
+
{open ? (
|
|
42
|
+
<OpenDrawerMenuItemList
|
|
43
|
+
menuItems={menuItems}
|
|
44
|
+
currentPathname={currentPathname}
|
|
45
|
+
/>
|
|
46
|
+
) : (
|
|
47
|
+
<CloseDrawerMenuItemList
|
|
48
|
+
menuItems={menuItems}
|
|
49
|
+
currentPathname={currentPathname}
|
|
50
|
+
/>
|
|
51
|
+
)}
|
|
52
|
+
</List>
|
|
53
|
+
</StyledDrawer>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ListItemButton,
|
|
3
|
+
ListItemText,
|
|
4
|
+
Stack,
|
|
5
|
+
useTheme,
|
|
6
|
+
type SxProps,
|
|
7
|
+
type Theme,
|
|
8
|
+
type ListItemButtonProps,
|
|
9
|
+
} from "@mui/material";
|
|
10
|
+
import type { HTMLAttributeAnchorTarget, ReactNode } from "react";
|
|
11
|
+
import { Bullet } from "./Bullet";
|
|
12
|
+
|
|
13
|
+
export type MenuItemProps = Omit<ListItemButtonProps, "onClick"> & {
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
endAdornment?: ReactNode;
|
|
16
|
+
title?: string;
|
|
17
|
+
sx?: SxProps<Theme>;
|
|
18
|
+
onClick: (target?: HTMLAttributeAnchorTarget) => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const MenuItem = ({
|
|
22
|
+
selected = false,
|
|
23
|
+
icon = <Bullet />,
|
|
24
|
+
title,
|
|
25
|
+
endAdornment,
|
|
26
|
+
sx,
|
|
27
|
+
onClick,
|
|
28
|
+
...props
|
|
29
|
+
}: MenuItemProps) => {
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
|
|
32
|
+
const { butterflyBlue, iron } = theme.palette.app.color;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<ListItemButton
|
|
36
|
+
{...props}
|
|
37
|
+
onClick={(e) => onClick(e.ctrlKey ? "_blank" : "_self")}
|
|
38
|
+
onMouseDown={(e) => {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
|
|
41
|
+
if (e.button === 1) {
|
|
42
|
+
onClick("_blank");
|
|
43
|
+
}
|
|
44
|
+
}}
|
|
45
|
+
sx={{
|
|
46
|
+
...sx,
|
|
47
|
+
color: selected ? iron[600] : theme.palette.primary.light,
|
|
48
|
+
":hover": {
|
|
49
|
+
color: iron[600],
|
|
50
|
+
".bullet-hover": {
|
|
51
|
+
color: selected ? "" : butterflyBlue[900],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<Stack
|
|
57
|
+
alignItems="center"
|
|
58
|
+
direction="row"
|
|
59
|
+
flex={1}
|
|
60
|
+
gap="10px"
|
|
61
|
+
justifyContent="center"
|
|
62
|
+
>
|
|
63
|
+
{icon}
|
|
64
|
+
{title && <ListItemText primary={title} />}
|
|
65
|
+
</Stack>
|
|
66
|
+
{endAdornment}
|
|
67
|
+
</ListItemButton>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Collapse, type CollapseProps } from "@mui/material";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
|
|
4
|
+
export const OpenDrawerCollapse = ({
|
|
5
|
+
children,
|
|
6
|
+
...rest
|
|
7
|
+
}: PropsWithChildren<CollapseProps>) => {
|
|
8
|
+
return (
|
|
9
|
+
<Collapse timeout="auto" unmountOnExit {...rest}>
|
|
10
|
+
{children}
|
|
11
|
+
</Collapse>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ExpandLess, ExpandMore } from "@mui/icons-material";
|
|
2
|
+
import type { SxProps, Theme } from "@mui/material";
|
|
3
|
+
import { Box, useTheme } from "@mui/material";
|
|
4
|
+
import { Bullet } from "../Bullet";
|
|
5
|
+
import { MenuItem, type MenuItemProps } from "../MenuItem";
|
|
6
|
+
|
|
7
|
+
type OpenDrawerMenuItemProps = {
|
|
8
|
+
icon?: MenuItemProps["icon"];
|
|
9
|
+
title: MenuItemProps["title"];
|
|
10
|
+
isShowEndAdornment?: boolean;
|
|
11
|
+
selected?: MenuItemProps["selected"];
|
|
12
|
+
onClick: MenuItemProps["onClick"];
|
|
13
|
+
sx?: SxProps<Theme>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const OpenDrawerMenuItem = ({
|
|
17
|
+
icon = <Bullet />,
|
|
18
|
+
title,
|
|
19
|
+
isShowEndAdornment = false,
|
|
20
|
+
selected = false,
|
|
21
|
+
onClick,
|
|
22
|
+
sx,
|
|
23
|
+
}: OpenDrawerMenuItemProps) => {
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
|
|
26
|
+
const { butterflyBlue } = theme.palette.app.color;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Box
|
|
30
|
+
sx={{
|
|
31
|
+
bgcolor: selected && !isShowEndAdornment ? butterflyBlue[900] : "",
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<MenuItem
|
|
35
|
+
sx={sx}
|
|
36
|
+
title={title}
|
|
37
|
+
icon={icon}
|
|
38
|
+
onClick={onClick}
|
|
39
|
+
selected={selected}
|
|
40
|
+
endAdornment={
|
|
41
|
+
isShowEndAdornment && (selected ? <ExpandLess /> : <ExpandMore />)
|
|
42
|
+
}
|
|
43
|
+
/>
|
|
44
|
+
</Box>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Box, List, useTheme } from "@mui/material";
|
|
4
|
+
import { isEmpty as _isEmpty } from "lodash";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { urlToNestedObject } from "../../utils/urlToNestedObject";
|
|
7
|
+
import type { MenuItem } from "../Drawer";
|
|
8
|
+
import { OpenDrawerCollapse } from "./OpenDrawerCollapse";
|
|
9
|
+
import { OpenDrawerMenuItem } from "./OpenDrawerMenuItem";
|
|
10
|
+
|
|
11
|
+
type OpenDrawerMenuItemListProps = {
|
|
12
|
+
menuItems: MenuItem[];
|
|
13
|
+
currentPathname: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const OpenDrawerMenuItemList = ({
|
|
17
|
+
menuItems,
|
|
18
|
+
currentPathname,
|
|
19
|
+
}: OpenDrawerMenuItemListProps) => {
|
|
20
|
+
//TODO: jaydip, fix this type
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
const [subMenusOpen, setSubMenusOpen] = useState<Record<string, any>>({});
|
|
23
|
+
|
|
24
|
+
const [currentPathMenuOpen, setCurrentPathMenuOpen] = useState<
|
|
25
|
+
//TODO: jaydip, fix this type
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
Record<string, any>
|
|
28
|
+
>({});
|
|
29
|
+
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
|
|
32
|
+
const { butterflyBlue, slate } = theme.palette.app.color;
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const obj = urlToNestedObject(currentPathname);
|
|
36
|
+
|
|
37
|
+
if (_isEmpty(obj)) {
|
|
38
|
+
setSubMenusOpen({ home: true });
|
|
39
|
+
setCurrentPathMenuOpen({ home: true });
|
|
40
|
+
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
setSubMenusOpen(obj);
|
|
45
|
+
setCurrentPathMenuOpen(obj);
|
|
46
|
+
}, [currentPathname]);
|
|
47
|
+
|
|
48
|
+
return menuItems.map((menuItem) => {
|
|
49
|
+
const { menuItems = [], key: key1, icon, title, onClick } = menuItem;
|
|
50
|
+
|
|
51
|
+
const isMenuSelected = !!subMenusOpen?.[key1];
|
|
52
|
+
|
|
53
|
+
if (menuItems.length > 0) {
|
|
54
|
+
return (
|
|
55
|
+
<Box key={key1}>
|
|
56
|
+
<OpenDrawerMenuItem
|
|
57
|
+
sx={{
|
|
58
|
+
":focus-visible": {
|
|
59
|
+
border: `1px solid ${butterflyBlue[900]}`,
|
|
60
|
+
backgroundColor: slate[900],
|
|
61
|
+
},
|
|
62
|
+
}}
|
|
63
|
+
onClick={() => {
|
|
64
|
+
setSubMenusOpen((prev) => ({
|
|
65
|
+
...prev,
|
|
66
|
+
[key1]: !isMenuSelected,
|
|
67
|
+
}));
|
|
68
|
+
}}
|
|
69
|
+
icon={icon}
|
|
70
|
+
title={title}
|
|
71
|
+
isShowEndAdornment
|
|
72
|
+
selected={isMenuSelected}
|
|
73
|
+
key={key1}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
<OpenDrawerCollapse in={isMenuSelected}>
|
|
77
|
+
<List component="div" disablePadding key={key1}>
|
|
78
|
+
{menuItems.map(
|
|
79
|
+
({ key: key2, onClick, title, menuItems = [] }) => {
|
|
80
|
+
const isSubMenuSelected = menuItems.length
|
|
81
|
+
? !!subMenusOpen?.[key1]?.[key2] ||
|
|
82
|
+
!!currentPathMenuOpen?.[key1]?.[key2]?.menuItems
|
|
83
|
+
: !!subMenusOpen?.[key1]?.[key2] ||
|
|
84
|
+
!!currentPathMenuOpen?.[key1]?.[key2];
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Box
|
|
88
|
+
sx={{
|
|
89
|
+
bgcolor:
|
|
90
|
+
isSubMenuSelected && menuItems.length === 0
|
|
91
|
+
? butterflyBlue[900]
|
|
92
|
+
: "",
|
|
93
|
+
}}
|
|
94
|
+
key={key2}
|
|
95
|
+
>
|
|
96
|
+
{menuItems.length > 0 ? (
|
|
97
|
+
<>
|
|
98
|
+
<OpenDrawerMenuItem
|
|
99
|
+
sx={{
|
|
100
|
+
paddingLeft: 4.5,
|
|
101
|
+
":focus-visible": {
|
|
102
|
+
border: `1px solid ${butterflyBlue[900]}`,
|
|
103
|
+
backgroundColor: slate[900],
|
|
104
|
+
},
|
|
105
|
+
}}
|
|
106
|
+
onClick={() => {
|
|
107
|
+
// eslint-disable-next-line sonarjs/no-nested-functions
|
|
108
|
+
setSubMenusOpen((prev) => ({
|
|
109
|
+
...prev,
|
|
110
|
+
[key1]: {
|
|
111
|
+
...(prev?.[key1] || {}),
|
|
112
|
+
[key2]: !isSubMenuSelected,
|
|
113
|
+
},
|
|
114
|
+
}));
|
|
115
|
+
}}
|
|
116
|
+
key={key2}
|
|
117
|
+
title={title}
|
|
118
|
+
isShowEndAdornment
|
|
119
|
+
selected={isSubMenuSelected}
|
|
120
|
+
/>
|
|
121
|
+
<OpenDrawerCollapse in={isSubMenuSelected}>
|
|
122
|
+
<List component="div" disablePadding key={key2}>
|
|
123
|
+
{menuItems.map(
|
|
124
|
+
({ key: key3, title, onClick }) => {
|
|
125
|
+
const menuSelectedItem =
|
|
126
|
+
!!subMenusOpen[key1]?.[key2]?.[key3] ||
|
|
127
|
+
!!currentPathMenuOpen[key1]?.[key2]?.[key3];
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<Box
|
|
131
|
+
sx={{
|
|
132
|
+
bgcolor: menuSelectedItem
|
|
133
|
+
? theme.palette.app.color
|
|
134
|
+
.butterflyBlue[900]
|
|
135
|
+
: "",
|
|
136
|
+
}}
|
|
137
|
+
key={key3}
|
|
138
|
+
>
|
|
139
|
+
<OpenDrawerMenuItem
|
|
140
|
+
sx={
|
|
141
|
+
menuSelectedItem
|
|
142
|
+
? {
|
|
143
|
+
paddingLeft: menuItems.length
|
|
144
|
+
? 7.5
|
|
145
|
+
: 4.5,
|
|
146
|
+
}
|
|
147
|
+
: {
|
|
148
|
+
paddingLeft: menuItems.length
|
|
149
|
+
? 7.5
|
|
150
|
+
: 4.5,
|
|
151
|
+
":focus-visible": {
|
|
152
|
+
border: `1px solid ${butterflyBlue[900]}`,
|
|
153
|
+
backgroundColor:
|
|
154
|
+
theme.palette.app.color
|
|
155
|
+
.slate[900],
|
|
156
|
+
},
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// eslint-disable-next-line sonarjs/no-nested-functions
|
|
160
|
+
onClick={(target) => {
|
|
161
|
+
if (onClick && !menuSelectedItem) {
|
|
162
|
+
onClick(
|
|
163
|
+
`/${key1}/${key2}/${key3}`,
|
|
164
|
+
target
|
|
165
|
+
);
|
|
166
|
+
setSubMenusOpen((prev) => ({
|
|
167
|
+
...prev,
|
|
168
|
+
[key2]: {
|
|
169
|
+
...(prev?.[key2] || {}),
|
|
170
|
+
[key3]: !menuSelectedItem,
|
|
171
|
+
},
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
}}
|
|
175
|
+
key={key3}
|
|
176
|
+
title={title}
|
|
177
|
+
selected={menuSelectedItem}
|
|
178
|
+
/>
|
|
179
|
+
</Box>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
)}
|
|
183
|
+
</List>
|
|
184
|
+
</OpenDrawerCollapse>
|
|
185
|
+
</>
|
|
186
|
+
) : (
|
|
187
|
+
<OpenDrawerMenuItem
|
|
188
|
+
sx={
|
|
189
|
+
isSubMenuSelected
|
|
190
|
+
? { paddingLeft: 4.5 }
|
|
191
|
+
: {
|
|
192
|
+
paddingLeft: 4.5,
|
|
193
|
+
":focus-visible": {
|
|
194
|
+
border: `1px solid ${butterflyBlue[900]}`,
|
|
195
|
+
backgroundColor: slate[900],
|
|
196
|
+
},
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
onClick={(target) => {
|
|
200
|
+
if (onClick && !isSubMenuSelected) {
|
|
201
|
+
onClick(`/${key1}/${key2}`, target);
|
|
202
|
+
}
|
|
203
|
+
}}
|
|
204
|
+
key={key2}
|
|
205
|
+
title={title}
|
|
206
|
+
selected={isSubMenuSelected}
|
|
207
|
+
/>
|
|
208
|
+
)}
|
|
209
|
+
</Box>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
)}
|
|
213
|
+
</List>
|
|
214
|
+
</OpenDrawerCollapse>
|
|
215
|
+
</Box>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<OpenDrawerMenuItem
|
|
221
|
+
sx={
|
|
222
|
+
isMenuSelected
|
|
223
|
+
? {}
|
|
224
|
+
: {
|
|
225
|
+
":focus-within": {
|
|
226
|
+
border: `1px solid ${butterflyBlue[900]}`,
|
|
227
|
+
backgroundColor: slate[900],
|
|
228
|
+
},
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
onClick={(target) => {
|
|
232
|
+
if (onClick && !isMenuSelected) {
|
|
233
|
+
if (key1 === "home") {
|
|
234
|
+
onClick("/", target);
|
|
235
|
+
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
onClick(`/${key1}`, target);
|
|
240
|
+
}
|
|
241
|
+
}}
|
|
242
|
+
key={key1}
|
|
243
|
+
icon={icon}
|
|
244
|
+
selected={isMenuSelected}
|
|
245
|
+
title={title}
|
|
246
|
+
/>
|
|
247
|
+
);
|
|
248
|
+
});
|
|
249
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Drawer";
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import React, { useRef, useState } from "react";
|
|
2
|
+
import { Box, IconButton, Stack } from "@mui/material";
|
|
3
|
+
import type { FilterListType } from "./FilterTypeWrapper";
|
|
4
|
+
import { FilterTypeWrapper } from "./FilterTypeWrapper";
|
|
5
|
+
import { FilterPopup } from "./FilterPopup";
|
|
6
|
+
import { FilterPopupWrapper } from "./FilterPopupWrapper";
|
|
7
|
+
import type { FieldValues } from "react-hook-form";
|
|
8
|
+
import { useForm } from "react-hook-form";
|
|
9
|
+
import { SvgFilterList } from "../Svgs/SvgFilterList";
|
|
10
|
+
import { Button } from "../Button";
|
|
11
|
+
import { Tooltip } from "../Tooltip";
|
|
12
|
+
import { FilterPill } from "../Chips/FilterPill";
|
|
13
|
+
import { getFormValue } from "./getFormData";
|
|
14
|
+
|
|
15
|
+
export type FilterListProps = {
|
|
16
|
+
filterListItems: FilterListType[];
|
|
17
|
+
};
|
|
18
|
+
export const FilterList = ({ filterListItems }: FilterListProps) => {
|
|
19
|
+
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
|
|
20
|
+
|
|
21
|
+
const filterPopupAnchorElm = useRef<HTMLDivElement | null>(null);
|
|
22
|
+
|
|
23
|
+
const [openFilterPopup, setOpenFilterPopup] = useState(false);
|
|
24
|
+
|
|
25
|
+
const [filterListData, setFilterListData] = useState<FieldValues>();
|
|
26
|
+
|
|
27
|
+
const [currentFilter, setCurrentFilter] = useState<null | FilterListType>(
|
|
28
|
+
null
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const { control, handleSubmit, setValue, reset, watch } = useForm();
|
|
32
|
+
|
|
33
|
+
const handleClose = () => {
|
|
34
|
+
setAnchorEl(null);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const onSubmit = (data: FieldValues) => {
|
|
38
|
+
setOpenFilterPopup(false);
|
|
39
|
+
setCurrentFilter(null);
|
|
40
|
+
handleClose();
|
|
41
|
+
|
|
42
|
+
setFilterListData(data);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
46
|
+
setAnchorEl(event.currentTarget);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const handleCloseFilterPopup = () => {
|
|
50
|
+
setOpenFilterPopup(false);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const handleFilterItemClick = (filter: FilterListType) => {
|
|
54
|
+
setOpenFilterPopup(true);
|
|
55
|
+
setAnchorEl(null);
|
|
56
|
+
setCurrentFilter(filter);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handlerReset = () => {
|
|
60
|
+
reset();
|
|
61
|
+
setFilterListData(undefined);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const handleDelete = (key: string) => {
|
|
65
|
+
setValue(`${key}`, null);
|
|
66
|
+
setFilterListData((prevData) => {
|
|
67
|
+
const newData = { ...prevData };
|
|
68
|
+
|
|
69
|
+
delete newData[key];
|
|
70
|
+
|
|
71
|
+
return newData;
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const getFilterItem = (key: string) => {
|
|
76
|
+
return filterListItems.find((item) => item.key === key);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const currentFilterValue = currentFilter?.key
|
|
80
|
+
? watch(currentFilter.key)
|
|
81
|
+
: null;
|
|
82
|
+
|
|
83
|
+
const open = Boolean(anchorEl);
|
|
84
|
+
|
|
85
|
+
const renderChips = (data: FieldValues) => {
|
|
86
|
+
return Object.entries(data).map(([key, value]) => {
|
|
87
|
+
if (!value) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const item = getFilterItem(key);
|
|
92
|
+
|
|
93
|
+
const keyValue = item && getFormValue(value, item);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<FilterPill
|
|
97
|
+
ref={filterPopupAnchorElm}
|
|
98
|
+
key={key}
|
|
99
|
+
label={
|
|
100
|
+
<Tooltip
|
|
101
|
+
toolTipLabel={`${keyValue}`}
|
|
102
|
+
>{`${item?.label}: ${keyValue}`}</Tooltip>
|
|
103
|
+
}
|
|
104
|
+
onDelete={() => handleDelete(key)}
|
|
105
|
+
onClick={(e: { currentTarget: HTMLDivElement | null }) => {
|
|
106
|
+
setOpenFilterPopup(true);
|
|
107
|
+
filterPopupAnchorElm.current = e.currentTarget;
|
|
108
|
+
|
|
109
|
+
const item = getFilterItem(key);
|
|
110
|
+
|
|
111
|
+
if (item) {
|
|
112
|
+
setCurrentFilter(item);
|
|
113
|
+
handleFilterItemClick(item);
|
|
114
|
+
}
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<Stack>
|
|
123
|
+
<Stack direction="row" spacing={1} alignItems="center">
|
|
124
|
+
{filterListData && renderChips(filterListData)}
|
|
125
|
+
<IconButton
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
127
|
+
ref={filterPopupAnchorElm as any}
|
|
128
|
+
onClick={handleClick}
|
|
129
|
+
sx={{ height: "40px" }}
|
|
130
|
+
>
|
|
131
|
+
<SvgFilterList />
|
|
132
|
+
</IconButton>
|
|
133
|
+
<Button onClick={() => handlerReset()} variant="text">
|
|
134
|
+
Clear Filter
|
|
135
|
+
</Button>
|
|
136
|
+
</Stack>
|
|
137
|
+
<FilterPopup
|
|
138
|
+
open={open}
|
|
139
|
+
anchorEl={anchorEl}
|
|
140
|
+
onClose={handleClose}
|
|
141
|
+
onApply={() => {
|
|
142
|
+
handleSubmit(onSubmit)();
|
|
143
|
+
}}
|
|
144
|
+
>
|
|
145
|
+
{filterListItems.map((filter) => (
|
|
146
|
+
<Box
|
|
147
|
+
key={filter.key}
|
|
148
|
+
onClick={() =>
|
|
149
|
+
filter.type !== "switch" && handleFilterItemClick(filter)
|
|
150
|
+
}
|
|
151
|
+
>
|
|
152
|
+
<FilterTypeWrapper filter={filter} control={control} />
|
|
153
|
+
</Box>
|
|
154
|
+
))}
|
|
155
|
+
</FilterPopup>
|
|
156
|
+
|
|
157
|
+
{currentFilter && currentFilter.type !== "switch" && (
|
|
158
|
+
<FilterPopupWrapper
|
|
159
|
+
open={openFilterPopup}
|
|
160
|
+
onClose={handleCloseFilterPopup}
|
|
161
|
+
onApply={() => {
|
|
162
|
+
handleSubmit(onSubmit)();
|
|
163
|
+
}}
|
|
164
|
+
control={control}
|
|
165
|
+
currentFilterValue={currentFilterValue}
|
|
166
|
+
anchorEl={filterPopupAnchorElm.current}
|
|
167
|
+
filterItem={currentFilter}
|
|
168
|
+
/>
|
|
169
|
+
)}
|
|
170
|
+
</Stack>
|
|
171
|
+
);
|
|
172
|
+
};
|