@codezee/sixtify-brahma 0.0.0
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/check-build.yml +41 -0
- package/.github/workflows/deploy-on-npm.yml +43 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +6 -0
- package/.lintstagedrc +5 -0
- package/.prettierignore +12 -0
- package/.prettierrc +22 -0
- package/.vscode/extensions.json +22 -0
- package/.vscode/settings.json +17 -0
- package/README.md +90 -0
- package/apps/docs/.eslintrc.cjs +9 -0
- package/apps/docs/.storybook/main.ts +23 -0
- package/apps/docs/.storybook/manager.ts +6 -0
- package/apps/docs/.storybook/preview.tsx +27 -0
- package/apps/docs/.storybook/theme.ts +8 -0
- package/apps/docs/next-env.d.ts +5 -0
- package/apps/docs/next.config.mjs +4 -0
- package/apps/docs/package.json +43 -0
- package/apps/docs/public/globals.css +26 -0
- package/apps/docs/stories/Actions/Actions.stories.tsx +49 -0
- package/apps/docs/stories/AgGrid/AgGrid.stories.tsx +70 -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 +120 -0
- package/apps/docs/stories/Button/button.stories.tsx +99 -0
- package/apps/docs/stories/Card/AttendanceCard.stories.tsx +36 -0
- package/apps/docs/stories/Card/Card.stories.tsx +39 -0
- package/apps/docs/stories/Charts/PieChart.stories.tsx +265 -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 +48 -0
- package/apps/docs/stories/Dialog/DeleteDialog.stories.tsx +32 -0
- package/apps/docs/stories/Dialog/Dialog.stories.tsx +48 -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 +90 -0
- package/apps/docs/stories/FormFields/CheckBox.stories.tsx +64 -0
- package/apps/docs/stories/FormFields/DatePicker.stories.tsx +100 -0
- package/apps/docs/stories/FormFields/DateRangePicker.stories.tsx +39 -0
- package/apps/docs/stories/FormFields/DateTimePicker.stories.tsx +39 -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/PhoneInputField.stories.tsx +84 -0
- package/apps/docs/stories/FormFields/RadioGroupField.stories.tsx +172 -0
- package/apps/docs/stories/FormFields/SearchField.stories.tsx +74 -0
- package/apps/docs/stories/FormFields/TextField.stories.tsx +141 -0
- package/apps/docs/stories/FormFields/TimeField.stories.tsx +84 -0
- package/apps/docs/stories/FormFields/TimePicker.stories.tsx +84 -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 +110 -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 +28 -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 +85 -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 +51 -0
- package/packages/shared-components/src/Actions/AddAction.tsx +16 -0
- package/packages/shared-components/src/Actions/CalendarAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ConfigureAction.tsx +16 -0
- package/packages/shared-components/src/Actions/DeleteAction.tsx +16 -0
- package/packages/shared-components/src/Actions/DownloadAction.tsx +16 -0
- package/packages/shared-components/src/Actions/EditAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ExportAction.tsx +16 -0
- package/packages/shared-components/src/Actions/FilterAction.tsx +16 -0
- package/packages/shared-components/src/Actions/HistoryAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ImportAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ViewAction.tsx +16 -0
- package/packages/shared-components/src/Actions/index.ts +11 -0
- package/packages/shared-components/src/AgGrid/ActionCell/ActionCell.tsx +57 -0
- package/packages/shared-components/src/AgGrid/ActionCell/Popover.tsx +32 -0
- package/packages/shared-components/src/AgGrid/AgGrid.tsx +93 -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 +33 -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 +94 -0
- package/packages/shared-components/src/Card/index.ts +6 -0
- package/packages/shared-components/src/Charts/PieChart.tsx +81 -0
- package/packages/shared-components/src/Charts/Skeleton.tsx +36 -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 +57 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItemList.tsx +109 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerSubMenuItemList.tsx +128 -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 +63 -0
- package/packages/shared-components/src/Drawer/Drawer.tsx +56 -0
- package/packages/shared-components/src/Drawer/MenuItem.tsx +75 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerCollapse.tsx +13 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItem.tsx +48 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItemList.tsx +232 -0
- package/packages/shared-components/src/Drawer/index.ts +1 -0
- package/packages/shared-components/src/FilterList/DateRangePickerPopUp.tsx +123 -0
- package/packages/shared-components/src/FilterList/FilterList.tsx +180 -0
- package/packages/shared-components/src/FilterList/FilterListV2.tsx +661 -0
- package/packages/shared-components/src/FilterList/FilterPopup.tsx +165 -0
- package/packages/shared-components/src/FilterList/FilterPopupWrapper.tsx +110 -0
- package/packages/shared-components/src/FilterList/FilterTypeWrapper.tsx +60 -0
- package/packages/shared-components/src/FilterList/GetFilterPopupComponent.tsx +76 -0
- package/packages/shared-components/src/FilterList/getFormData.ts +29 -0
- package/packages/shared-components/src/FilterList/index.ts +6 -0
- package/packages/shared-components/src/FormFields/Autocomplete/Autocomplete.tsx +509 -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 +76 -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 +217 -0
- package/packages/shared-components/src/FormFields/DatePicker/Skeleton.tsx +28 -0
- package/packages/shared-components/src/FormFields/DatePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/DateRangePicker.tsx +97 -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 +253 -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/FileNames.tsx +32 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.styled.tsx +31 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.tsx +160 -0
- package/packages/shared-components/src/FormFields/FileUpload/Skeleton.tsx +21 -0
- package/packages/shared-components/src/FormFields/FileUpload/index.ts +2 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.styled.tsx +20 -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 +25 -0
- package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.tsx +52 -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/PhoneInputField/PhoneInputField.tsx +108 -0
- package/packages/shared-components/src/FormFields/PhoneInputField/Skeleton.tsx +31 -0
- package/packages/shared-components/src/FormFields/PhoneInputField/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 +31 -0
- package/packages/shared-components/src/FormFields/TextField/TextField.tsx +167 -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 +168 -0
- package/packages/shared-components/src/FormFields/TimePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/index.ts +16 -0
- package/packages/shared-components/src/Indicator/Indicator.tsx +18 -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/FormGridLayout.tsx +27 -0
- package/packages/shared-components/src/Layouts/FormRow/FormRow.styled.tsx +47 -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 +4 -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/Pagination/Pagination.tsx +42 -0
- package/packages/shared-components/src/Pagination/index.ts +1 -0
- package/packages/shared-components/src/Stepper/Stepper.tsx +88 -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 +31 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgBankConfig.tsx +36 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgConfiguration.tsx +16 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgPayroll.tsx +32 -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 +81 -0
- package/packages/shared-components/src/Svgs/Drawer/index.ts +7 -0
- package/packages/shared-components/src/Svgs/FormAction.tsx +118 -0
- package/packages/shared-components/src/Svgs/ImportExcelSuccessIcon.tsx +54 -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/SvgConfigure.tsx +51 -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/SvgEmail.tsx +27 -0
- package/packages/shared-components/src/Svgs/SvgExport.tsx +33 -0
- package/packages/shared-components/src/Svgs/SvgFilterList.tsx +22 -0
- package/packages/shared-components/src/Svgs/SvgImport.tsx +43 -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/SvgPhone.tsx +19 -0
- package/packages/shared-components/src/Svgs/SvgProfile.tsx +33 -0
- package/packages/shared-components/src/Svgs/SvgView.tsx +16 -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 +18 -0
- package/packages/shared-components/src/Svgs/SvgsIndicator.tsx +24 -0
- package/packages/shared-components/src/Svgs/index.ts +18 -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 +159 -0
- package/packages/shared-components/src/Timeline/TimelineTrackSegments.tsx +130 -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 +80 -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 +42 -0
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.tsx +168 -0
- package/packages/shared-components/src/UserProfileMenu/index.ts +1 -0
- package/packages/shared-components/src/index.ts +25 -0
- package/packages/shared-components/src/utils/colorVariant.ts +162 -0
- package/packages/shared-components/src/utils/date.ts +25 -0
- package/packages/shared-components/src/utils/file.ts +22 -0
- package/packages/shared-components/src/utils/index.ts +11 -0
- package/packages/shared-components/src/utils/theme/colorPalette.ts +112 -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 +297 -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/webpack/cjs.js +20 -0
- package/packages/shared-components/webpack/common.js +36 -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 +42 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ListItemButton,
|
|
3
|
+
ListItemText,
|
|
4
|
+
Stack,
|
|
5
|
+
useTheme,
|
|
6
|
+
type ListItemButtonProps,
|
|
7
|
+
type SxProps,
|
|
8
|
+
type Theme,
|
|
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 && (
|
|
65
|
+
<ListItemText
|
|
66
|
+
primary={title}
|
|
67
|
+
disableTypography={true}
|
|
68
|
+
sx={{ ...sx, padding: "0" }}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
71
|
+
</Stack>
|
|
72
|
+
{endAdornment}
|
|
73
|
+
</ListItemButton>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
@@ -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,48 @@
|
|
|
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
|
+
isExpanded?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const OpenDrawerMenuItem = ({
|
|
18
|
+
icon = <Bullet />,
|
|
19
|
+
title,
|
|
20
|
+
isShowEndAdornment = false,
|
|
21
|
+
selected = false,
|
|
22
|
+
onClick,
|
|
23
|
+
isExpanded,
|
|
24
|
+
sx,
|
|
25
|
+
}: OpenDrawerMenuItemProps) => {
|
|
26
|
+
const theme = useTheme();
|
|
27
|
+
|
|
28
|
+
const { butterflyBlue } = theme.palette.app.color;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Box
|
|
32
|
+
sx={{
|
|
33
|
+
bgcolor: selected && !isShowEndAdornment ? butterflyBlue[900] : "",
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<MenuItem
|
|
37
|
+
sx={sx}
|
|
38
|
+
title={title}
|
|
39
|
+
icon={icon}
|
|
40
|
+
onClick={onClick}
|
|
41
|
+
selected={selected}
|
|
42
|
+
endAdornment={
|
|
43
|
+
isShowEndAdornment && (isExpanded ? <ExpandLess /> : <ExpandMore />)
|
|
44
|
+
}
|
|
45
|
+
/>
|
|
46
|
+
</Box>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Box, List, useTheme } from "@mui/material";
|
|
4
|
+
import { isEmpty as _isEmpty } from "lodash";
|
|
5
|
+
import { type HTMLAttributeAnchorTarget, 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 type NestedMenuState = {
|
|
17
|
+
[K in MenuItem["key"]]?:
|
|
18
|
+
| boolean
|
|
19
|
+
| {
|
|
20
|
+
[SubK in MenuItem["key"]]?: boolean | NestedMenuState;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type MenuItemRecursiveProps = {
|
|
25
|
+
menuItem: MenuItem;
|
|
26
|
+
level?: number;
|
|
27
|
+
parentPath?: string;
|
|
28
|
+
subMenusOpen: NestedMenuState;
|
|
29
|
+
setSubMenusOpen: (
|
|
30
|
+
value: NestedMenuState | ((prev: NestedMenuState) => NestedMenuState)
|
|
31
|
+
) => void;
|
|
32
|
+
currentPathMenuOpen: NestedMenuState;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const getNestedMenuState = (state: NestedMenuState, path: string[]) => {
|
|
36
|
+
if (path.length === 0) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (typeof state !== "object") {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const [first, ...rest] = path;
|
|
45
|
+
|
|
46
|
+
if (!first) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const nextState = state[first];
|
|
51
|
+
|
|
52
|
+
if (rest.length === 0) {
|
|
53
|
+
return Boolean(nextState);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return getNestedMenuState(nextState as NestedMenuState, rest);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const isPathInCurrentSelection = (
|
|
60
|
+
state: NestedMenuState,
|
|
61
|
+
path: string[]
|
|
62
|
+
): boolean => {
|
|
63
|
+
const result = path.reduce<unknown>((acc, segment) => {
|
|
64
|
+
if (typeof acc !== "object" || acc === null || !(segment in acc)) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return (acc as Record<string, unknown>)[segment];
|
|
69
|
+
}, state);
|
|
70
|
+
|
|
71
|
+
if (result === true) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return !!(
|
|
76
|
+
typeof result === "object" &&
|
|
77
|
+
result !== null &&
|
|
78
|
+
Object.values(result).every((v) => v === true)
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const isMenuOpen = (state: NestedMenuState, path: string[]) => {
|
|
83
|
+
const value = getNestedMenuState(state, path);
|
|
84
|
+
|
|
85
|
+
return Boolean(value);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const MenuItemRecursive = ({
|
|
89
|
+
menuItem,
|
|
90
|
+
level = 0,
|
|
91
|
+
parentPath = "",
|
|
92
|
+
subMenusOpen,
|
|
93
|
+
setSubMenusOpen,
|
|
94
|
+
currentPathMenuOpen,
|
|
95
|
+
}: MenuItemRecursiveProps) => {
|
|
96
|
+
const theme = useTheme();
|
|
97
|
+
|
|
98
|
+
if (level === 3) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const { butterflyBlue, slate } = theme.palette.app.color;
|
|
103
|
+
|
|
104
|
+
const { key, icon, title, isView, onClick, menuItems = [] } = menuItem;
|
|
105
|
+
|
|
106
|
+
if (isView === false) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const currentPath = parentPath ? `${parentPath}/${key}` : key;
|
|
111
|
+
|
|
112
|
+
const pathArray = currentPath.split("/");
|
|
113
|
+
|
|
114
|
+
const isMenuExpanded = isMenuOpen(subMenusOpen, pathArray);
|
|
115
|
+
|
|
116
|
+
const isMenuSelected = isPathInCurrentSelection(
|
|
117
|
+
currentPathMenuOpen,
|
|
118
|
+
pathArray
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const dynamicPadding = level * 3 + 1.5;
|
|
122
|
+
|
|
123
|
+
const handleClick = (target?: HTMLAttributeAnchorTarget) => {
|
|
124
|
+
if (menuItems.length > 0) {
|
|
125
|
+
setSubMenusOpen((prev) => {
|
|
126
|
+
const newState = { ...prev };
|
|
127
|
+
|
|
128
|
+
let current = newState;
|
|
129
|
+
|
|
130
|
+
for (let i = 0; i < pathArray.length - 1; i++) {
|
|
131
|
+
const segment = pathArray[i];
|
|
132
|
+
|
|
133
|
+
if (!segment) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
current[segment] =
|
|
138
|
+
typeof current[segment] === "object" ? current[segment] : {};
|
|
139
|
+
current = current[segment] as NestedMenuState;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const lastSegment = pathArray[pathArray.length - 1];
|
|
143
|
+
|
|
144
|
+
if (lastSegment) {
|
|
145
|
+
current[lastSegment] = !isMenuExpanded;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return newState;
|
|
149
|
+
});
|
|
150
|
+
} else if (onClick && !isMenuSelected) {
|
|
151
|
+
const path = key === "home" ? "/" : `/${currentPath}`;
|
|
152
|
+
|
|
153
|
+
onClick(path, target);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<Box key={key}>
|
|
159
|
+
<OpenDrawerMenuItem
|
|
160
|
+
sx={{
|
|
161
|
+
paddingLeft: dynamicPadding,
|
|
162
|
+
":focus-visible": {
|
|
163
|
+
border: `1px solid ${butterflyBlue[900]}`,
|
|
164
|
+
backgroundColor: slate[900],
|
|
165
|
+
},
|
|
166
|
+
}}
|
|
167
|
+
onClick={handleClick}
|
|
168
|
+
icon={level === 0 ? icon : undefined}
|
|
169
|
+
title={title}
|
|
170
|
+
isShowEndAdornment={menuItems.length > 0 && level < 2}
|
|
171
|
+
selected={isMenuSelected}
|
|
172
|
+
isExpanded={isMenuExpanded}
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
{menuItems.length > 0 && (
|
|
176
|
+
<OpenDrawerCollapse in={isMenuExpanded}>
|
|
177
|
+
<List component="div" disablePadding>
|
|
178
|
+
{menuItems.map((subMenuItem) => (
|
|
179
|
+
<MenuItemRecursive
|
|
180
|
+
key={subMenuItem.key}
|
|
181
|
+
menuItem={subMenuItem}
|
|
182
|
+
level={level + 1}
|
|
183
|
+
parentPath={currentPath}
|
|
184
|
+
subMenusOpen={subMenusOpen}
|
|
185
|
+
setSubMenusOpen={setSubMenusOpen}
|
|
186
|
+
currentPathMenuOpen={currentPathMenuOpen}
|
|
187
|
+
/>
|
|
188
|
+
))}
|
|
189
|
+
</List>
|
|
190
|
+
</OpenDrawerCollapse>
|
|
191
|
+
)}
|
|
192
|
+
</Box>
|
|
193
|
+
);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const OpenDrawerMenuItemList = ({
|
|
197
|
+
menuItems,
|
|
198
|
+
currentPathname,
|
|
199
|
+
}: OpenDrawerMenuItemListProps) => {
|
|
200
|
+
const [subMenusOpen, setSubMenusOpen] = useState<NestedMenuState>({});
|
|
201
|
+
|
|
202
|
+
const [currentPathMenuOpen, setCurrentPathMenuOpen] =
|
|
203
|
+
useState<NestedMenuState>({});
|
|
204
|
+
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
const navObj = urlToNestedObject(currentPathname);
|
|
207
|
+
|
|
208
|
+
if (_isEmpty(navObj)) {
|
|
209
|
+
setSubMenusOpen({ home: true });
|
|
210
|
+
setCurrentPathMenuOpen({ home: true });
|
|
211
|
+
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const subState = JSON.parse(JSON.stringify(navObj));
|
|
216
|
+
|
|
217
|
+
const selState = JSON.parse(JSON.stringify(navObj));
|
|
218
|
+
|
|
219
|
+
setSubMenusOpen(subState);
|
|
220
|
+
setCurrentPathMenuOpen(selState);
|
|
221
|
+
}, [currentPathname]);
|
|
222
|
+
|
|
223
|
+
return menuItems.map((menuItem) => (
|
|
224
|
+
<MenuItemRecursive
|
|
225
|
+
key={menuItem.key}
|
|
226
|
+
menuItem={menuItem}
|
|
227
|
+
subMenusOpen={subMenusOpen}
|
|
228
|
+
setSubMenusOpen={setSubMenusOpen}
|
|
229
|
+
currentPathMenuOpen={currentPathMenuOpen}
|
|
230
|
+
/>
|
|
231
|
+
));
|
|
232
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Drawer";
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { PopoverProps } from "@mui/material";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Divider,
|
|
5
|
+
IconButton,
|
|
6
|
+
Popover,
|
|
7
|
+
Stack,
|
|
8
|
+
Typography,
|
|
9
|
+
useTheme,
|
|
10
|
+
} from "@mui/material";
|
|
11
|
+
import { ClearIcon } from "@mui/x-date-pickers";
|
|
12
|
+
import { isFunction } from "lodash";
|
|
13
|
+
import { type PropsWithChildren } from "react";
|
|
14
|
+
import { Button } from "../Button";
|
|
15
|
+
import { PadBox } from "../PadBox";
|
|
16
|
+
|
|
17
|
+
type DateRangePickerPopUpProps = Partial<
|
|
18
|
+
PropsWithChildren<PopoverProps> & {
|
|
19
|
+
onApply: () => void;
|
|
20
|
+
showFooter: boolean;
|
|
21
|
+
showDivider: boolean;
|
|
22
|
+
title: string;
|
|
23
|
+
required: boolean;
|
|
24
|
+
background: boolean;
|
|
25
|
+
open: boolean;
|
|
26
|
+
}
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export const DateRangePickerPopUp = ({
|
|
30
|
+
open = false,
|
|
31
|
+
anchorEl,
|
|
32
|
+
onClose,
|
|
33
|
+
children,
|
|
34
|
+
onApply,
|
|
35
|
+
showDivider = false,
|
|
36
|
+
showFooter = true,
|
|
37
|
+
title,
|
|
38
|
+
required,
|
|
39
|
+
background = false,
|
|
40
|
+
}: DateRangePickerPopUpProps) => {
|
|
41
|
+
const theme = useTheme();
|
|
42
|
+
|
|
43
|
+
const { slate } = theme.palette.app.color;
|
|
44
|
+
|
|
45
|
+
const handleApply = () => {
|
|
46
|
+
if (isFunction(onApply)) {
|
|
47
|
+
onApply();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const handleClose = () => {
|
|
52
|
+
if (isFunction(onClose)) {
|
|
53
|
+
onClose({}, "backdropClick");
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Popover
|
|
59
|
+
open={open}
|
|
60
|
+
anchorEl={anchorEl}
|
|
61
|
+
anchorOrigin={{ vertical: "bottom", horizontal: "left" }}
|
|
62
|
+
onClose={(_event, reason) => {
|
|
63
|
+
if (reason === "backdropClick") {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
handleClose();
|
|
67
|
+
}}
|
|
68
|
+
sx={{ "& .MuiPaper-root": { minWidth: "300px" } }}
|
|
69
|
+
>
|
|
70
|
+
{showDivider && (
|
|
71
|
+
<Stack alignItems="flex-end">
|
|
72
|
+
<PadBox padding={{ padding: "8px" }}>
|
|
73
|
+
<Stack
|
|
74
|
+
direction="row"
|
|
75
|
+
justifyContent="space-between"
|
|
76
|
+
width="100%"
|
|
77
|
+
alignItems="center"
|
|
78
|
+
>
|
|
79
|
+
<Stack direction="row" alignItems="center" gap="5px">
|
|
80
|
+
<Typography variant="h6">{title} </Typography>
|
|
81
|
+
|
|
82
|
+
{required && (
|
|
83
|
+
<Typography variant="h6" color="error">
|
|
84
|
+
*
|
|
85
|
+
</Typography>
|
|
86
|
+
)}
|
|
87
|
+
</Stack>
|
|
88
|
+
|
|
89
|
+
<IconButton onClick={handleClose}>
|
|
90
|
+
<ClearIcon />
|
|
91
|
+
</IconButton>
|
|
92
|
+
</Stack>
|
|
93
|
+
</PadBox>
|
|
94
|
+
|
|
95
|
+
<Divider sx={{ width: "100%" }} />
|
|
96
|
+
</Stack>
|
|
97
|
+
)}
|
|
98
|
+
|
|
99
|
+
<Box
|
|
100
|
+
sx={{
|
|
101
|
+
background: background ? slate[600] : "transparent",
|
|
102
|
+
borderRadius: "5px",
|
|
103
|
+
}}
|
|
104
|
+
>
|
|
105
|
+
{children}
|
|
106
|
+
</Box>
|
|
107
|
+
|
|
108
|
+
{showFooter && (
|
|
109
|
+
<PadBox padding={{ padding: "10px" }}>
|
|
110
|
+
<Box display="flex" justifyContent="flex-end">
|
|
111
|
+
<Button
|
|
112
|
+
onClick={handleApply}
|
|
113
|
+
variant="text"
|
|
114
|
+
sx={{ maxWidth: "40px" }}
|
|
115
|
+
>
|
|
116
|
+
Submit
|
|
117
|
+
</Button>
|
|
118
|
+
</Box>
|
|
119
|
+
</PadBox>
|
|
120
|
+
)}
|
|
121
|
+
</Popover>
|
|
122
|
+
);
|
|
123
|
+
};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Box, IconButton, Stack } from "@mui/material";
|
|
2
|
+
import React, { useRef, useState } from "react";
|
|
3
|
+
import type { FieldValues } from "react-hook-form";
|
|
4
|
+
import { useForm } from "react-hook-form";
|
|
5
|
+
import { Button } from "../Button";
|
|
6
|
+
import { FilterPill } from "../Chips/FilterPill";
|
|
7
|
+
import { SvgFilterList } from "../Svgs/SvgFilterList";
|
|
8
|
+
import { Tooltip } from "../Tooltip";
|
|
9
|
+
import { FilterPopup } from "./FilterPopup";
|
|
10
|
+
import { FilterPopupWrapper } from "./FilterPopupWrapper";
|
|
11
|
+
import type { FilterListType } from "./FilterTypeWrapper";
|
|
12
|
+
import { FilterTypeWrapper } from "./FilterTypeWrapper";
|
|
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 {
|
|
32
|
+
control,
|
|
33
|
+
handleSubmit,
|
|
34
|
+
setValue,
|
|
35
|
+
reset,
|
|
36
|
+
formState: { errors },
|
|
37
|
+
watch,
|
|
38
|
+
} = useForm();
|
|
39
|
+
|
|
40
|
+
const handleClose = () => {
|
|
41
|
+
setAnchorEl(null);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onSubmit = (data: FieldValues) => {
|
|
45
|
+
setOpenFilterPopup(false);
|
|
46
|
+
setCurrentFilter(null);
|
|
47
|
+
handleClose();
|
|
48
|
+
|
|
49
|
+
setFilterListData(data);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
53
|
+
setAnchorEl(event.currentTarget);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleCloseFilterPopup = () => {
|
|
57
|
+
setOpenFilterPopup(false);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const handleFilterItemClick = (filter: FilterListType) => {
|
|
61
|
+
setOpenFilterPopup(true);
|
|
62
|
+
setAnchorEl(null);
|
|
63
|
+
setCurrentFilter(filter);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handlerReset = () => {
|
|
67
|
+
reset();
|
|
68
|
+
setFilterListData(undefined);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const handleDelete = (key: string) => {
|
|
72
|
+
setValue(`${key}`, null);
|
|
73
|
+
setFilterListData((prevData) => {
|
|
74
|
+
const newData = { ...prevData };
|
|
75
|
+
|
|
76
|
+
delete newData[key];
|
|
77
|
+
|
|
78
|
+
return newData;
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const getFilterItem = (key: string) => {
|
|
83
|
+
return filterListItems.find((item) => item.key === key);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const currentFilterValue = currentFilter?.key
|
|
87
|
+
? watch(currentFilter.key)
|
|
88
|
+
: null;
|
|
89
|
+
|
|
90
|
+
const open = Boolean(anchorEl);
|
|
91
|
+
|
|
92
|
+
const renderChips = (data: FieldValues) => {
|
|
93
|
+
return Object.entries(data).map(([key, value]) => {
|
|
94
|
+
if (!value) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const item = getFilterItem(key);
|
|
99
|
+
|
|
100
|
+
const keyValue = item && getFormValue(value, item);
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<FilterPill
|
|
104
|
+
ref={filterPopupAnchorElm}
|
|
105
|
+
key={key}
|
|
106
|
+
label={
|
|
107
|
+
<Tooltip
|
|
108
|
+
toolTipLabel={`${keyValue}`}
|
|
109
|
+
>{`${item?.label}: ${keyValue}`}</Tooltip>
|
|
110
|
+
}
|
|
111
|
+
onDelete={() => handleDelete(key)}
|
|
112
|
+
onClick={(e: { currentTarget: HTMLDivElement | null }) => {
|
|
113
|
+
setOpenFilterPopup(true);
|
|
114
|
+
filterPopupAnchorElm.current = e.currentTarget;
|
|
115
|
+
|
|
116
|
+
const item = getFilterItem(key);
|
|
117
|
+
|
|
118
|
+
if (item) {
|
|
119
|
+
setCurrentFilter(item);
|
|
120
|
+
handleFilterItemClick(item);
|
|
121
|
+
}
|
|
122
|
+
}}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<Stack>
|
|
130
|
+
<Stack direction="row" spacing={1} alignItems="center">
|
|
131
|
+
{filterListData && renderChips(filterListData)}
|
|
132
|
+
<IconButton
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
|
+
ref={filterPopupAnchorElm as any}
|
|
135
|
+
onClick={handleClick}
|
|
136
|
+
sx={{ height: "40px" }}
|
|
137
|
+
>
|
|
138
|
+
<SvgFilterList />
|
|
139
|
+
</IconButton>
|
|
140
|
+
<Button onClick={() => handlerReset()} variant="text">
|
|
141
|
+
Clear Filter
|
|
142
|
+
</Button>
|
|
143
|
+
</Stack>
|
|
144
|
+
<FilterPopup
|
|
145
|
+
open={open}
|
|
146
|
+
anchorEl={anchorEl}
|
|
147
|
+
onClose={handleClose}
|
|
148
|
+
onApply={() => {
|
|
149
|
+
handleSubmit(onSubmit)();
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
{filterListItems.map((filter) => (
|
|
153
|
+
<Box
|
|
154
|
+
key={filter.key}
|
|
155
|
+
onClick={() =>
|
|
156
|
+
filter.type !== "switch" && handleFilterItemClick(filter)
|
|
157
|
+
}
|
|
158
|
+
>
|
|
159
|
+
<FilterTypeWrapper filter={filter} control={control} />
|
|
160
|
+
</Box>
|
|
161
|
+
))}
|
|
162
|
+
</FilterPopup>
|
|
163
|
+
|
|
164
|
+
{currentFilter && currentFilter.type !== "switch" && (
|
|
165
|
+
<FilterPopupWrapper
|
|
166
|
+
open={openFilterPopup}
|
|
167
|
+
onClose={handleCloseFilterPopup}
|
|
168
|
+
onApply={() => {
|
|
169
|
+
handleSubmit(onSubmit)();
|
|
170
|
+
}}
|
|
171
|
+
control={control}
|
|
172
|
+
currentFilterValue={currentFilterValue}
|
|
173
|
+
anchorEl={filterPopupAnchorElm.current}
|
|
174
|
+
filterItem={currentFilter}
|
|
175
|
+
errors={errors}
|
|
176
|
+
/>
|
|
177
|
+
)}
|
|
178
|
+
</Stack>
|
|
179
|
+
);
|
|
180
|
+
};
|