@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,165 @@
|
|
|
1
|
+
import ClearIcon from "@mui/icons-material/Clear";
|
|
2
|
+
import type { PopoverProps } from "@mui/material";
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
Divider,
|
|
6
|
+
IconButton,
|
|
7
|
+
Popover,
|
|
8
|
+
Stack,
|
|
9
|
+
Typography,
|
|
10
|
+
useTheme,
|
|
11
|
+
} from "@mui/material";
|
|
12
|
+
import { isFunction, sortBy } from "lodash";
|
|
13
|
+
import { useEffect, useState, type PropsWithChildren } from "react";
|
|
14
|
+
import { Button } from "../Button";
|
|
15
|
+
import { PadBox } from "../PadBox";
|
|
16
|
+
import type { FilterListType } from "./FilterTypeWrapper";
|
|
17
|
+
|
|
18
|
+
type FilterPopupProps = PropsWithChildren<PopoverProps> & {
|
|
19
|
+
onApply?: () => void;
|
|
20
|
+
showFooter?: boolean;
|
|
21
|
+
showDivider?: boolean;
|
|
22
|
+
title?: string;
|
|
23
|
+
required?: boolean;
|
|
24
|
+
background?: boolean;
|
|
25
|
+
filterItem?: FilterListType;
|
|
26
|
+
currentFilterValue?: string | string[] | null;
|
|
27
|
+
reset?: () => void;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const FilterPopup = ({
|
|
31
|
+
open,
|
|
32
|
+
anchorEl,
|
|
33
|
+
onClose,
|
|
34
|
+
children,
|
|
35
|
+
onApply,
|
|
36
|
+
showDivider = false,
|
|
37
|
+
showFooter = true,
|
|
38
|
+
title,
|
|
39
|
+
required,
|
|
40
|
+
filterItem,
|
|
41
|
+
reset,
|
|
42
|
+
background = false,
|
|
43
|
+
currentFilterValue,
|
|
44
|
+
}: FilterPopupProps) => {
|
|
45
|
+
const theme = useTheme();
|
|
46
|
+
|
|
47
|
+
const { slate } = theme.palette.app.color;
|
|
48
|
+
|
|
49
|
+
const [initialValue, setInitialValue] = useState<string | string[] | null>(
|
|
50
|
+
null
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const [isDisabled, setIsDisabled] = useState(true);
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (open) {
|
|
57
|
+
if (!initialValue && !!currentFilterValue) {
|
|
58
|
+
const changedValue = filterItem?.multiSelect
|
|
59
|
+
? sortBy(currentFilterValue)
|
|
60
|
+
: currentFilterValue;
|
|
61
|
+
|
|
62
|
+
setInitialValue(changedValue);
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
setInitialValue(null);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!!currentFilterValue && !!initialValue) {
|
|
69
|
+
const isChanged = filterItem?.multiSelect
|
|
70
|
+
? JSON.stringify(sortBy(currentFilterValue)) !==
|
|
71
|
+
JSON.stringify(initialValue)
|
|
72
|
+
: currentFilterValue !== initialValue;
|
|
73
|
+
|
|
74
|
+
setIsDisabled(!isChanged);
|
|
75
|
+
}
|
|
76
|
+
}, [open, currentFilterValue, initialValue, filterItem?.multiSelect]);
|
|
77
|
+
|
|
78
|
+
const handleApply = () => {
|
|
79
|
+
setInitialValue(null);
|
|
80
|
+
|
|
81
|
+
if (isFunction(onApply)) {
|
|
82
|
+
onApply();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const handleClose = () => {
|
|
87
|
+
setInitialValue(null);
|
|
88
|
+
|
|
89
|
+
if (isFunction(reset)) {
|
|
90
|
+
reset();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (isFunction(onClose)) {
|
|
94
|
+
onClose({}, "backdropClick");
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<Popover
|
|
100
|
+
open={open}
|
|
101
|
+
anchorEl={anchorEl}
|
|
102
|
+
anchorOrigin={{ vertical: "bottom", horizontal: "left" }}
|
|
103
|
+
onClose={(_event, reason) => {
|
|
104
|
+
if (reason === "backdropClick") {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
handleClose();
|
|
108
|
+
}}
|
|
109
|
+
sx={{ "& .MuiPaper-root": { minWidth: "300px" } }}
|
|
110
|
+
>
|
|
111
|
+
{showDivider && (
|
|
112
|
+
<Stack alignItems="flex-end">
|
|
113
|
+
<PadBox padding={{ padding: "8px" }}>
|
|
114
|
+
<Stack
|
|
115
|
+
direction="row"
|
|
116
|
+
justifyContent="space-between"
|
|
117
|
+
width="100%"
|
|
118
|
+
alignItems="center"
|
|
119
|
+
>
|
|
120
|
+
<Stack direction="row" alignItems="center" gap="5px">
|
|
121
|
+
<Typography variant="h6">{title}</Typography>
|
|
122
|
+
|
|
123
|
+
{required && (
|
|
124
|
+
<Typography variant="h6" color="error">
|
|
125
|
+
*
|
|
126
|
+
</Typography>
|
|
127
|
+
)}
|
|
128
|
+
</Stack>
|
|
129
|
+
|
|
130
|
+
<IconButton onClick={handleClose}>
|
|
131
|
+
<ClearIcon />
|
|
132
|
+
</IconButton>
|
|
133
|
+
</Stack>
|
|
134
|
+
</PadBox>
|
|
135
|
+
<Divider sx={{ width: "100%" }} />
|
|
136
|
+
</Stack>
|
|
137
|
+
)}
|
|
138
|
+
|
|
139
|
+
<Box
|
|
140
|
+
sx={{
|
|
141
|
+
background: background ? slate[600] : "transparent",
|
|
142
|
+
borderRadius: "5px",
|
|
143
|
+
maxWidth: "300px",
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
{children}
|
|
147
|
+
</Box>
|
|
148
|
+
|
|
149
|
+
{showFooter && (
|
|
150
|
+
<PadBox padding={{ padding: "10px" }}>
|
|
151
|
+
<Box display="flex" justifyContent="flex-end">
|
|
152
|
+
<Button
|
|
153
|
+
onClick={handleApply}
|
|
154
|
+
disabled={isDisabled}
|
|
155
|
+
variant="text"
|
|
156
|
+
sx={{ maxWidth: "40px" }}
|
|
157
|
+
>
|
|
158
|
+
Apply
|
|
159
|
+
</Button>
|
|
160
|
+
</Box>
|
|
161
|
+
</PadBox>
|
|
162
|
+
)}
|
|
163
|
+
</Popover>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Stack, Typography, type PopoverProps } from "@mui/material";
|
|
2
|
+
import { type PropsWithChildren } from "react";
|
|
3
|
+
import type { Control, FieldErrors, FieldValues } from "react-hook-form";
|
|
4
|
+
import { Switch } from "../FormFields";
|
|
5
|
+
import { PadBox } from "../PadBox";
|
|
6
|
+
import { DateRangePickerPopUp } from "./DateRangePickerPopUp";
|
|
7
|
+
import { FilterPopup } from "./FilterPopup";
|
|
8
|
+
import type { FilterListType } from "./FilterTypeWrapper";
|
|
9
|
+
import { getFilterPopupComponent } from "./GetFilterPopupComponent";
|
|
10
|
+
|
|
11
|
+
type FilterPopupWrapperProp = PropsWithChildren<PopoverProps> & {
|
|
12
|
+
filterItem: FilterListType;
|
|
13
|
+
control: Control<FieldValues>;
|
|
14
|
+
errors: FieldErrors<FieldValues>;
|
|
15
|
+
currentFilterValue?: string | string[] | null;
|
|
16
|
+
onApply: () => void;
|
|
17
|
+
reset?: () => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type FilterDateRangePickerWrapperProp = PropsWithChildren<PopoverProps> & {
|
|
21
|
+
filterItem: FilterListType;
|
|
22
|
+
control: Control<FieldValues>;
|
|
23
|
+
errors: FieldErrors<FieldValues>;
|
|
24
|
+
onApply: () => void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type FilterPopupComponentType = {
|
|
28
|
+
autoComplete?: JSX.Element;
|
|
29
|
+
text: JSX.Element;
|
|
30
|
+
date: JSX.Element;
|
|
31
|
+
checkbox?: JSX.Element;
|
|
32
|
+
dateRange?: JSX.Element;
|
|
33
|
+
switch?: JSX.Element;
|
|
34
|
+
radio?: JSX.Element;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const FilterPopupWrapper = ({
|
|
38
|
+
open,
|
|
39
|
+
anchorEl,
|
|
40
|
+
filterItem,
|
|
41
|
+
onClose,
|
|
42
|
+
control,
|
|
43
|
+
errors,
|
|
44
|
+
onApply,
|
|
45
|
+
currentFilterValue,
|
|
46
|
+
reset,
|
|
47
|
+
}: FilterPopupWrapperProp) => {
|
|
48
|
+
return (
|
|
49
|
+
<FilterPopup
|
|
50
|
+
title={filterItem.label}
|
|
51
|
+
required={filterItem.required}
|
|
52
|
+
filterItem={filterItem}
|
|
53
|
+
open={open}
|
|
54
|
+
onClose={onClose}
|
|
55
|
+
anchorEl={anchorEl}
|
|
56
|
+
onApply={onApply}
|
|
57
|
+
currentFilterValue={currentFilterValue}
|
|
58
|
+
reset={reset}
|
|
59
|
+
showFooter
|
|
60
|
+
showDivider
|
|
61
|
+
background
|
|
62
|
+
>
|
|
63
|
+
<PadBox padding={{ padding: "10px" }}>
|
|
64
|
+
{getFilterPopupComponent(filterItem, control, errors)[filterItem.type]}
|
|
65
|
+
|
|
66
|
+
{filterItem.type === "switch" && (
|
|
67
|
+
<Stack
|
|
68
|
+
key={filterItem.key}
|
|
69
|
+
direction="row"
|
|
70
|
+
justifyContent="space-between"
|
|
71
|
+
alignItems="center"
|
|
72
|
+
sx={{ padding: "10px 5px 10px 20px", margin: "auto" }}
|
|
73
|
+
>
|
|
74
|
+
<Typography variant="body2">{filterItem.label}</Typography>
|
|
75
|
+
|
|
76
|
+
<Switch control={control} name={filterItem.key} />
|
|
77
|
+
</Stack>
|
|
78
|
+
)}
|
|
79
|
+
</PadBox>
|
|
80
|
+
</FilterPopup>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const FilterPopUpDateRangeWrapper = ({
|
|
85
|
+
open,
|
|
86
|
+
anchorEl,
|
|
87
|
+
filterItem,
|
|
88
|
+
onClose,
|
|
89
|
+
control,
|
|
90
|
+
errors,
|
|
91
|
+
onApply,
|
|
92
|
+
}: FilterDateRangePickerWrapperProp) => {
|
|
93
|
+
return (
|
|
94
|
+
<DateRangePickerPopUp
|
|
95
|
+
title={filterItem.label}
|
|
96
|
+
required={filterItem.required}
|
|
97
|
+
open={open}
|
|
98
|
+
onClose={onClose}
|
|
99
|
+
anchorEl={anchorEl}
|
|
100
|
+
onApply={onApply}
|
|
101
|
+
showFooter
|
|
102
|
+
showDivider
|
|
103
|
+
background
|
|
104
|
+
>
|
|
105
|
+
<PadBox padding={{ padding: "10px" }}>
|
|
106
|
+
{getFilterPopupComponent(filterItem, control, errors)[filterItem.type]}
|
|
107
|
+
</PadBox>
|
|
108
|
+
</DateRangePickerPopUp>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ListItemButton, Stack, Typography } from "@mui/material";
|
|
2
|
+
import type { Control, FieldValues } from "react-hook-form";
|
|
3
|
+
import { Switch } from "../FormFields/Switch";
|
|
4
|
+
|
|
5
|
+
export type FilterComponentType =
|
|
6
|
+
| "autoComplete"
|
|
7
|
+
| "text"
|
|
8
|
+
| "date"
|
|
9
|
+
| "dateRange"
|
|
10
|
+
| "checkbox"
|
|
11
|
+
| "radio"
|
|
12
|
+
| "switch";
|
|
13
|
+
|
|
14
|
+
type Options = readonly {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
avatar?: string;
|
|
19
|
+
}[];
|
|
20
|
+
|
|
21
|
+
export type FilterListType = {
|
|
22
|
+
label: string;
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
key: string;
|
|
25
|
+
value: string;
|
|
26
|
+
type: FilterComponentType;
|
|
27
|
+
menuInfo?: string;
|
|
28
|
+
options?: Options;
|
|
29
|
+
multiSelect?: boolean;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
};
|
|
32
|
+
type FilterTypeWrapperProps = {
|
|
33
|
+
filter: FilterListType;
|
|
34
|
+
control: Control<FieldValues>;
|
|
35
|
+
};
|
|
36
|
+
export const FilterTypeWrapper = ({
|
|
37
|
+
filter,
|
|
38
|
+
control,
|
|
39
|
+
}: FilterTypeWrapperProps) => {
|
|
40
|
+
const getFilterByType = (type: FilterComponentType) => {
|
|
41
|
+
return (
|
|
42
|
+
<Stack
|
|
43
|
+
direction="row"
|
|
44
|
+
width="100%"
|
|
45
|
+
justifyContent="space-between"
|
|
46
|
+
alignItems="center"
|
|
47
|
+
>
|
|
48
|
+
<Typography variant="body2">{filter.label}</Typography>
|
|
49
|
+
|
|
50
|
+
{type === "switch" ? (
|
|
51
|
+
<Switch control={control} name={filter.key} />
|
|
52
|
+
) : (
|
|
53
|
+
<Typography variant="body2">{filter.menuInfo}</Typography>
|
|
54
|
+
)}
|
|
55
|
+
</Stack>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return <ListItemButton>{getFilterByType(filter.type)}</ListItemButton>;
|
|
60
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useTheme } from "@mui/material";
|
|
2
|
+
import type { Control, FieldErrors, FieldValues } from "react-hook-form";
|
|
3
|
+
import {
|
|
4
|
+
Autocomplete,
|
|
5
|
+
DatePicker,
|
|
6
|
+
DateRangePicker,
|
|
7
|
+
TextField,
|
|
8
|
+
} from "../FormFields";
|
|
9
|
+
import type { FilterPopupComponentType } from "./FilterPopupWrapper";
|
|
10
|
+
import type { FilterListType } from "./FilterTypeWrapper";
|
|
11
|
+
|
|
12
|
+
export const getFilterPopupComponent = (
|
|
13
|
+
selectedFilter: FilterListType,
|
|
14
|
+
control: Control<FieldValues>,
|
|
15
|
+
errors: FieldErrors<FieldValues>
|
|
16
|
+
): FilterPopupComponentType => {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
|
|
19
|
+
const { sapphireBlue, black } = theme.palette.app.color;
|
|
20
|
+
|
|
21
|
+
const errorSelectedKey = errors[selectedFilter.key];
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
autoComplete: selectedFilter.options && (
|
|
25
|
+
<Autocomplete
|
|
26
|
+
disableClearable
|
|
27
|
+
multiple={selectedFilter.multiSelect ?? false}
|
|
28
|
+
placeholder={`Select ${selectedFilter.label}`}
|
|
29
|
+
name={`${selectedFilter.key}`}
|
|
30
|
+
disabled={selectedFilter.isDisabled}
|
|
31
|
+
shouldCloseOnSelect={selectedFilter.multiSelect ?? false}
|
|
32
|
+
control={control}
|
|
33
|
+
options={selectedFilter.options ?? []}
|
|
34
|
+
sx={{
|
|
35
|
+
maxHeight: "250px",
|
|
36
|
+
overflowY: "auto",
|
|
37
|
+
width: "100%",
|
|
38
|
+
"& .MuiAutocomplete-tag": {
|
|
39
|
+
backgroundColor: sapphireBlue[300],
|
|
40
|
+
color: black[900],
|
|
41
|
+
},
|
|
42
|
+
}}
|
|
43
|
+
error={!!errorSelectedKey}
|
|
44
|
+
helperText={errorSelectedKey?.message as string}
|
|
45
|
+
/>
|
|
46
|
+
),
|
|
47
|
+
text: (
|
|
48
|
+
<TextField
|
|
49
|
+
name={selectedFilter.key}
|
|
50
|
+
control={control}
|
|
51
|
+
disabled={selectedFilter.isDisabled}
|
|
52
|
+
placeholder={selectedFilter.label}
|
|
53
|
+
error={!!errorSelectedKey}
|
|
54
|
+
helperText={errorSelectedKey?.message as string}
|
|
55
|
+
/>
|
|
56
|
+
),
|
|
57
|
+
date: (
|
|
58
|
+
<DatePicker
|
|
59
|
+
name={selectedFilter.key}
|
|
60
|
+
control={control}
|
|
61
|
+
disabled={selectedFilter.isDisabled}
|
|
62
|
+
error={!!errorSelectedKey}
|
|
63
|
+
helperText={errorSelectedKey?.message as string}
|
|
64
|
+
/>
|
|
65
|
+
),
|
|
66
|
+
dateRange: (
|
|
67
|
+
<DateRangePicker
|
|
68
|
+
name={selectedFilter.key}
|
|
69
|
+
control={control}
|
|
70
|
+
disabled={selectedFilter.isDisabled}
|
|
71
|
+
error={!!errorSelectedKey}
|
|
72
|
+
helperText={errorSelectedKey?.message as string}
|
|
73
|
+
/>
|
|
74
|
+
),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FilterListType } from "./FilterTypeWrapper";
|
|
2
|
+
|
|
3
|
+
export const getFormValue = (value: unknown, item: FilterListType) => {
|
|
4
|
+
let keyValue = value;
|
|
5
|
+
|
|
6
|
+
if (item && item.type === "autoComplete") {
|
|
7
|
+
if (item.multiSelect && Array.isArray(value)) {
|
|
8
|
+
keyValue = item.options
|
|
9
|
+
?.filter((option) => value.includes(option.value))
|
|
10
|
+
.map((option) => option.label)
|
|
11
|
+
.join(", ");
|
|
12
|
+
} else {
|
|
13
|
+
keyValue = item.options
|
|
14
|
+
?.filter((option) => option.value === value)
|
|
15
|
+
.map((option) => option.label)
|
|
16
|
+
.join(", ");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (item.type === "dateRange" && Array.isArray(value) && value.length === 2) {
|
|
21
|
+
const startDate = value[0];
|
|
22
|
+
|
|
23
|
+
const endDate = value[1];
|
|
24
|
+
|
|
25
|
+
keyValue = `${startDate} <= Start Date <= ${endDate}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return keyValue;
|
|
29
|
+
};
|