@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,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Avatar,
|
|
3
|
+
Chip as MuiChip,
|
|
4
|
+
type ChipProps as MuiChipProps,
|
|
5
|
+
} from "@mui/material";
|
|
6
|
+
|
|
7
|
+
type ChipProps = {
|
|
8
|
+
imgURL?: string;
|
|
9
|
+
} & MuiChipProps;
|
|
10
|
+
|
|
11
|
+
export const Chip = ({
|
|
12
|
+
label,
|
|
13
|
+
variant = "outlined",
|
|
14
|
+
imgURL,
|
|
15
|
+
avatar,
|
|
16
|
+
...rest
|
|
17
|
+
}: ChipProps) => {
|
|
18
|
+
return (
|
|
19
|
+
<MuiChip
|
|
20
|
+
avatar={avatar && <Avatar alt="Natacha" src={imgURL} />}
|
|
21
|
+
label={label}
|
|
22
|
+
variant={variant}
|
|
23
|
+
{...rest}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ChipProps } from "@mui/material";
|
|
2
|
+
import { alpha, Chip, Tooltip } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
type ChipWithBorderProps = Omit<ChipProps, "color"> & {
|
|
5
|
+
label: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
toolTipLabel?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const ChipWithBorder = ({
|
|
11
|
+
label,
|
|
12
|
+
color = "green",
|
|
13
|
+
toolTipLabel,
|
|
14
|
+
...rest
|
|
15
|
+
}: ChipWithBorderProps) => {
|
|
16
|
+
return (
|
|
17
|
+
<Tooltip title={toolTipLabel} arrow placement="top">
|
|
18
|
+
<Chip
|
|
19
|
+
label={label}
|
|
20
|
+
{...rest}
|
|
21
|
+
sx={{
|
|
22
|
+
border: `1px solid ${color}`,
|
|
23
|
+
borderColor: color,
|
|
24
|
+
backgroundColor: alpha(color, 0.2),
|
|
25
|
+
borderRadius: "3px",
|
|
26
|
+
height: "20px",
|
|
27
|
+
width: "auto",
|
|
28
|
+
padding: "0px",
|
|
29
|
+
".MuiChip-label": {
|
|
30
|
+
color,
|
|
31
|
+
fontSize: "12px",
|
|
32
|
+
fontWeight: 600,
|
|
33
|
+
padding: "5px",
|
|
34
|
+
},
|
|
35
|
+
}}
|
|
36
|
+
></Chip>
|
|
37
|
+
</Tooltip>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { Chip } from "../Chips";
|
|
3
|
+
import { ClearIcon } from "@mui/x-date-pickers/icons";
|
|
4
|
+
import { useTheme } from "@mui/material";
|
|
5
|
+
|
|
6
|
+
type FilterPillProps = {
|
|
7
|
+
onDelete?: () => void;
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
onClick?: (e: { currentTarget: HTMLDivElement | null }) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const FilterPill = forwardRef<HTMLDivElement, FilterPillProps>(
|
|
13
|
+
({ onDelete, label, onClick }, ref) => {
|
|
14
|
+
const theme = useTheme();
|
|
15
|
+
|
|
16
|
+
const { black, sapphireBlue, iron } = theme.palette.app.color;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Chip
|
|
20
|
+
ref={ref}
|
|
21
|
+
label={label}
|
|
22
|
+
variant="filled"
|
|
23
|
+
deleteIcon={onDelete && <ClearIcon />}
|
|
24
|
+
sx={{
|
|
25
|
+
maxWidth: "200px",
|
|
26
|
+
borderRadius: "20px",
|
|
27
|
+
color: black[900],
|
|
28
|
+
backgroundColor: `${sapphireBlue[400]} !important`,
|
|
29
|
+
"&:hover": {
|
|
30
|
+
backgroundColor: sapphireBlue[500],
|
|
31
|
+
},
|
|
32
|
+
"& .MuiChip-deleteIcon": {
|
|
33
|
+
color: iron[800],
|
|
34
|
+
"&:hover": {
|
|
35
|
+
color: iron[900],
|
|
36
|
+
backgroundColor: sapphireBlue[400],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}}
|
|
40
|
+
onDelete={onDelete}
|
|
41
|
+
onClick={onClick}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
FilterPill.displayName = "FilterPill";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StyledComponent } from "@emotion/styled";
|
|
2
|
+
import type { StackProps } from "@mui/material";
|
|
3
|
+
import { Stack, styled } from "@mui/material";
|
|
4
|
+
import type { DialogProps as MuiDialogProps } from "./Dialog";
|
|
5
|
+
import { Dialog } from "./Dialog";
|
|
6
|
+
|
|
7
|
+
export const BottomDialogStyled: StyledComponent<MuiDialogProps> = styled(
|
|
8
|
+
Dialog
|
|
9
|
+
)({
|
|
10
|
+
height: "85%",
|
|
11
|
+
top: "auto",
|
|
12
|
+
"& .MuiDialogContent-root": {
|
|
13
|
+
display: "grid",
|
|
14
|
+
padding: "unset",
|
|
15
|
+
},
|
|
16
|
+
"& .MuiDialog-paper": {
|
|
17
|
+
borderTopLeftRadius: "12px",
|
|
18
|
+
borderTopRightRadius: "12px",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const BottomDialogBody: StyledComponent<StackProps> = styled(Stack)(
|
|
23
|
+
() => ({
|
|
24
|
+
"& > *": {
|
|
25
|
+
flex: "1 1 auto",
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BottomDialogBody, BottomDialogStyled } from "./BottomDialog.styled";
|
|
2
|
+
|
|
3
|
+
import type { DialogProps } from ".";
|
|
4
|
+
import { PadBox } from "../PadBox";
|
|
5
|
+
|
|
6
|
+
export type BottomDialogProps = Omit<DialogProps, "title"> & {
|
|
7
|
+
title?: string;
|
|
8
|
+
open?: boolean;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function BottomDialog({
|
|
13
|
+
children,
|
|
14
|
+
title,
|
|
15
|
+
open = false,
|
|
16
|
+
onClose,
|
|
17
|
+
...rest
|
|
18
|
+
}: BottomDialogProps) {
|
|
19
|
+
return (
|
|
20
|
+
<BottomDialogStyled
|
|
21
|
+
fullScreen
|
|
22
|
+
title={title}
|
|
23
|
+
{...rest}
|
|
24
|
+
open={open}
|
|
25
|
+
onClose={onClose}
|
|
26
|
+
PaperProps={{
|
|
27
|
+
sx: {
|
|
28
|
+
animation: open ? "slideUp 0.2s cubic-bezier(0.25, 0.8, 0.5, 1)" : "",
|
|
29
|
+
},
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<BottomDialogBody direction="row" overflow="hidden">
|
|
33
|
+
<PadBox padding={{ padding: "1rem" }}>{children}</PadBox>
|
|
34
|
+
</BottomDialogBody>
|
|
35
|
+
</BottomDialogStyled>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import InfoTwoToneIcon from "@mui/icons-material/InfoTwoTone";
|
|
2
|
+
import { Stack, Typography } from "@mui/material";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
import { Dialog } from "./Dialog";
|
|
5
|
+
|
|
6
|
+
export type DeleteDialogProps = {
|
|
7
|
+
title: string;
|
|
8
|
+
open: boolean;
|
|
9
|
+
isDeleteLoading: boolean;
|
|
10
|
+
onDelete: () => void;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const DeleteDialog = ({
|
|
15
|
+
title,
|
|
16
|
+
open,
|
|
17
|
+
isDeleteLoading,
|
|
18
|
+
onDelete,
|
|
19
|
+
onClose,
|
|
20
|
+
}: DeleteDialogProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<Dialog
|
|
23
|
+
maxWidth="xs"
|
|
24
|
+
isHideCloseIcon={true}
|
|
25
|
+
isHideDividers={true}
|
|
26
|
+
open={open}
|
|
27
|
+
actions={
|
|
28
|
+
<Stack direction="row" gap="5px">
|
|
29
|
+
<Button onClick={onClose} variant="outlined">
|
|
30
|
+
Cancel
|
|
31
|
+
</Button>
|
|
32
|
+
|
|
33
|
+
<Button onClick={onDelete} color="error" loading={isDeleteLoading}>
|
|
34
|
+
Delete
|
|
35
|
+
</Button>
|
|
36
|
+
</Stack>
|
|
37
|
+
}
|
|
38
|
+
>
|
|
39
|
+
<Stack gap="10px" direction="row">
|
|
40
|
+
<InfoTwoToneIcon color="error" sx={{ mt: "1px" }} />
|
|
41
|
+
|
|
42
|
+
<Typography variant="subtitle1" fontWeight={700}>
|
|
43
|
+
{title}
|
|
44
|
+
</Typography>
|
|
45
|
+
</Stack>
|
|
46
|
+
</Dialog>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import HighlightOffIcon from "@mui/icons-material/HighlightOff";
|
|
2
|
+
import {
|
|
3
|
+
DialogActions,
|
|
4
|
+
DialogContent,
|
|
5
|
+
DialogTitle,
|
|
6
|
+
IconButton,
|
|
7
|
+
Dialog as MuiDialog,
|
|
8
|
+
Stack,
|
|
9
|
+
Typography,
|
|
10
|
+
type DialogProps as MuiDialogProps,
|
|
11
|
+
} from "@mui/material";
|
|
12
|
+
import type { PropsWithChildren, ReactNode } from "react";
|
|
13
|
+
import { PadBox } from "../PadBox";
|
|
14
|
+
|
|
15
|
+
export type DialogProps = PropsWithChildren<
|
|
16
|
+
MuiDialogProps & {
|
|
17
|
+
isHideCloseIcon?: boolean;
|
|
18
|
+
title?: string;
|
|
19
|
+
actions?: ReactNode;
|
|
20
|
+
isHideDividers?: boolean;
|
|
21
|
+
}
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
export const Dialog = ({
|
|
25
|
+
title,
|
|
26
|
+
isHideCloseIcon = false,
|
|
27
|
+
isHideDividers = false,
|
|
28
|
+
children,
|
|
29
|
+
onClose,
|
|
30
|
+
actions,
|
|
31
|
+
...props
|
|
32
|
+
}: DialogProps) => {
|
|
33
|
+
return (
|
|
34
|
+
<MuiDialog fullWidth {...props}>
|
|
35
|
+
<DialogTitle textAlign="center">
|
|
36
|
+
<Stack direction="row" alignItems="center">
|
|
37
|
+
<Typography variant="h5" fontWeight={500} flex={1}>
|
|
38
|
+
{title}
|
|
39
|
+
</Typography>
|
|
40
|
+
|
|
41
|
+
{!isHideCloseIcon && (
|
|
42
|
+
<IconButton
|
|
43
|
+
onClick={(event) => onClose && onClose(event, "escapeKeyDown")}
|
|
44
|
+
color="secondary"
|
|
45
|
+
>
|
|
46
|
+
<HighlightOffIcon fontSize="large" />
|
|
47
|
+
</IconButton>
|
|
48
|
+
)}
|
|
49
|
+
</Stack>
|
|
50
|
+
</DialogTitle>
|
|
51
|
+
|
|
52
|
+
<DialogContent dividers={!isHideDividers}>
|
|
53
|
+
<PadBox padding={{ padding: "10px" }}>{children}</PadBox>
|
|
54
|
+
</DialogContent>
|
|
55
|
+
|
|
56
|
+
{actions && (
|
|
57
|
+
<DialogActions sx={{ py: "16px", px: "24px" }}>{actions}</DialogActions>
|
|
58
|
+
)}
|
|
59
|
+
</MuiDialog>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ChevronRight } from "@mui/icons-material";
|
|
2
|
+
import { Box, useTheme } from "@mui/material";
|
|
3
|
+
import { Bullet } from "../Bullet";
|
|
4
|
+
import { MenuItem, type MenuItemProps } from "../MenuItem";
|
|
5
|
+
|
|
6
|
+
type CloseDrawerMenuItemProps = {
|
|
7
|
+
icon?: MenuItemProps["icon"];
|
|
8
|
+
title?: MenuItemProps["title"];
|
|
9
|
+
isShowEndAdornment?: boolean;
|
|
10
|
+
onClick: MenuItemProps["onClick"];
|
|
11
|
+
selected?: MenuItemProps["selected"];
|
|
12
|
+
onMouseEnter?: MenuItemProps["onMouseEnter"];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const CloseDrawerMenuItem = ({
|
|
16
|
+
icon = <Bullet />,
|
|
17
|
+
title,
|
|
18
|
+
isShowEndAdornment = false,
|
|
19
|
+
onClick,
|
|
20
|
+
selected = false,
|
|
21
|
+
onMouseEnter,
|
|
22
|
+
}: CloseDrawerMenuItemProps) => {
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
|
|
25
|
+
const { butterflyBlue, slate } = theme.palette.app.color;
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Box
|
|
29
|
+
component="li"
|
|
30
|
+
sx={{
|
|
31
|
+
bgcolor: selected && !isShowEndAdornment ? butterflyBlue[900] : "",
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<MenuItem
|
|
35
|
+
sx={{
|
|
36
|
+
":focus-visible": {
|
|
37
|
+
border: `1px solid ${butterflyBlue[900]}`,
|
|
38
|
+
backgroundColor: slate[900],
|
|
39
|
+
},
|
|
40
|
+
}}
|
|
41
|
+
selected={selected}
|
|
42
|
+
title={title}
|
|
43
|
+
icon={icon}
|
|
44
|
+
onClick={onClick}
|
|
45
|
+
onMouseEnter={onMouseEnter}
|
|
46
|
+
endAdornment={isShowEndAdornment && <ChevronRight />}
|
|
47
|
+
/>
|
|
48
|
+
</Box>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { isEmpty as _isEmpty } from "lodash";
|
|
2
|
+
import {
|
|
3
|
+
type MouseEvent,
|
|
4
|
+
type HTMLAttributeAnchorTarget,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState,
|
|
7
|
+
} from "react";
|
|
8
|
+
import { v4 as uuidv4 } from "uuid";
|
|
9
|
+
import { urlToNestedObject } from "../../utils/urlToNestedObject";
|
|
10
|
+
import type { MenuItem } from "../Drawer";
|
|
11
|
+
import { CloseDrawerMenuItem } from "./CloseDrawerMenuItem";
|
|
12
|
+
import { CloseDrawerSubMenuItemList } from "./CloseDrawerSubMenuItemList";
|
|
13
|
+
import { Popper } from "./Popper";
|
|
14
|
+
|
|
15
|
+
type CloseDrawerMenuItemListProps = {
|
|
16
|
+
menuItems: MenuItem[];
|
|
17
|
+
currentPathname: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const CloseDrawerMenuItemList = ({
|
|
21
|
+
menuItems,
|
|
22
|
+
currentPathname,
|
|
23
|
+
}: CloseDrawerMenuItemListProps) => {
|
|
24
|
+
const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>(null);
|
|
25
|
+
|
|
26
|
+
const [currentMenuItem, setCurrentMenuItem] = useState<MenuItem>();
|
|
27
|
+
|
|
28
|
+
const [currentMenuIndex, setCurrentMenuIndex] = useState<number>(0);
|
|
29
|
+
|
|
30
|
+
const [currentPathMenuOpen, setCurrentPathMenuOpen] = useState<
|
|
31
|
+
Record<string, unknown>
|
|
32
|
+
>({});
|
|
33
|
+
|
|
34
|
+
useMemo(() => {
|
|
35
|
+
const obj = urlToNestedObject(currentPathname);
|
|
36
|
+
|
|
37
|
+
if (_isEmpty(obj)) {
|
|
38
|
+
return setCurrentPathMenuOpen({ home: true });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setCurrentPathMenuOpen(obj);
|
|
42
|
+
}, [currentPathname]);
|
|
43
|
+
|
|
44
|
+
const handleClose = () => {
|
|
45
|
+
setAnchorEl(null);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
{menuItems.map((menuItem, i) => {
|
|
51
|
+
const { onClick, key: key1, icon, menuItems = [] } = menuItem;
|
|
52
|
+
|
|
53
|
+
const handleClick = (target?: HTMLAttributeAnchorTarget) => {
|
|
54
|
+
if (onClick) {
|
|
55
|
+
if (key1 === "home") {
|
|
56
|
+
onClick("/", target);
|
|
57
|
+
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
onClick(`/${key1}`, target);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const onMouseEnter = (event: MouseEvent<HTMLDivElement>) => {
|
|
66
|
+
if (menuItems.length > 0) {
|
|
67
|
+
setAnchorEl(event.currentTarget);
|
|
68
|
+
setCurrentMenuItem(menuItem);
|
|
69
|
+
setCurrentMenuIndex(i);
|
|
70
|
+
} else {
|
|
71
|
+
handleClose();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const isMenuSelected = !!currentPathMenuOpen?.[key1];
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<CloseDrawerMenuItem
|
|
79
|
+
key={uuidv4()}
|
|
80
|
+
onClick={handleClick}
|
|
81
|
+
onMouseEnter={onMouseEnter}
|
|
82
|
+
icon={icon}
|
|
83
|
+
selected={isMenuSelected}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
})}
|
|
87
|
+
|
|
88
|
+
{!!anchorEl && (
|
|
89
|
+
<div onMouseLeave={handleClose}>
|
|
90
|
+
<Popper
|
|
91
|
+
open={true}
|
|
92
|
+
anchorEl={anchorEl}
|
|
93
|
+
currentMenuIndex={currentMenuIndex}
|
|
94
|
+
>
|
|
95
|
+
<CloseDrawerSubMenuItemList
|
|
96
|
+
currentMenuItem={currentMenuItem}
|
|
97
|
+
currentPathMenuOpen={currentPathMenuOpen}
|
|
98
|
+
onCloseMenuPopover={handleClose}
|
|
99
|
+
/>
|
|
100
|
+
</Popper>
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
</>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Box, List } from "@mui/material";
|
|
2
|
+
import {
|
|
3
|
+
type HTMLAttributeAnchorTarget,
|
|
4
|
+
useState,
|
|
5
|
+
type MouseEvent,
|
|
6
|
+
} from "react";
|
|
7
|
+
import type { MenuItem } from "../Drawer";
|
|
8
|
+
import { CloseDrawerMenuItem } from "./CloseDrawerMenuItem";
|
|
9
|
+
import { Popper } from "./Popper";
|
|
10
|
+
|
|
11
|
+
type CloseDrawerSubMenuItemListProps = {
|
|
12
|
+
//TODO: jaydip, fix unknown type
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
currentPathMenuOpen: any;
|
|
15
|
+
currentMenuItem?: MenuItem;
|
|
16
|
+
onCloseMenuPopover: () => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const CloseDrawerSubMenuItemList = ({
|
|
20
|
+
currentPathMenuOpen,
|
|
21
|
+
currentMenuItem,
|
|
22
|
+
onCloseMenuPopover,
|
|
23
|
+
}: CloseDrawerSubMenuItemListProps) => {
|
|
24
|
+
const [openPopoverIndex, setOpenPopoverIndex] = useState<number | null>(null);
|
|
25
|
+
|
|
26
|
+
const [anchorEls, setAnchorEls] = useState<(HTMLDivElement | null)[]>([]);
|
|
27
|
+
|
|
28
|
+
const handlePopoverOpen = (
|
|
29
|
+
event: MouseEvent<HTMLDivElement>,
|
|
30
|
+
index: number
|
|
31
|
+
) => {
|
|
32
|
+
const newAnchorEls = [...anchorEls];
|
|
33
|
+
|
|
34
|
+
newAnchorEls[index] = event.currentTarget;
|
|
35
|
+
setAnchorEls(newAnchorEls);
|
|
36
|
+
|
|
37
|
+
setOpenPopoverIndex(index);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleClose = () => {
|
|
41
|
+
setAnchorEls([]);
|
|
42
|
+
setOpenPopoverIndex(null);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
if (!currentMenuItem) {
|
|
46
|
+
return <>Loading...</>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { menuItems = [], key: rootKey } = currentMenuItem;
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<List>
|
|
53
|
+
{menuItems.map(
|
|
54
|
+
({ title, key: key2, onClick, icon, menuItems = [] }, index) => {
|
|
55
|
+
const handleClick = (target: HTMLAttributeAnchorTarget = "_self") => {
|
|
56
|
+
if (onClick) {
|
|
57
|
+
onClick(`/${rootKey}/${key2}`, target);
|
|
58
|
+
|
|
59
|
+
if (target != "_blank") {
|
|
60
|
+
onCloseMenuPopover();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const onMouseEnter = (event: MouseEvent<HTMLDivElement>) => {
|
|
66
|
+
if (menuItems.length > 0) {
|
|
67
|
+
handlePopoverOpen(event, index);
|
|
68
|
+
} else {
|
|
69
|
+
handleClose();
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const isMenuSelected = !!currentPathMenuOpen?.[rootKey]?.[key2];
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Box key={key2}>
|
|
77
|
+
<div onMouseLeave={handleClose}>
|
|
78
|
+
<CloseDrawerMenuItem
|
|
79
|
+
onClick={handleClick}
|
|
80
|
+
title={title}
|
|
81
|
+
icon={icon}
|
|
82
|
+
isShowEndAdornment={!!menuItems.length}
|
|
83
|
+
selected={isMenuSelected}
|
|
84
|
+
onMouseEnter={onMouseEnter}
|
|
85
|
+
/>
|
|
86
|
+
{menuItems.length > 0 && openPopoverIndex === index && (
|
|
87
|
+
<Popper
|
|
88
|
+
open={true}
|
|
89
|
+
anchorEl={anchorEls[index]}
|
|
90
|
+
currentMenuIndex={0}
|
|
91
|
+
>
|
|
92
|
+
<List>
|
|
93
|
+
{menuItems.map(({ key: key3, title, onClick }) => {
|
|
94
|
+
const isMenuSelected =
|
|
95
|
+
!!currentPathMenuOpen[rootKey]?.[key2]?.[key3];
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<CloseDrawerMenuItem
|
|
99
|
+
key={key3}
|
|
100
|
+
onClick={(target = "_self") => {
|
|
101
|
+
if (onClick) {
|
|
102
|
+
onClick(`/${rootKey}/${key2}/${key3}`, target);
|
|
103
|
+
|
|
104
|
+
if (target != "_blank") {
|
|
105
|
+
handleClose();
|
|
106
|
+
onCloseMenuPopover();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}}
|
|
110
|
+
title={title}
|
|
111
|
+
selected={isMenuSelected}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
})}
|
|
115
|
+
</List>
|
|
116
|
+
</Popper>
|
|
117
|
+
)}
|
|
118
|
+
</div>
|
|
119
|
+
</Box>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
)}
|
|
123
|
+
</List>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Popover as MuiPopover,
|
|
3
|
+
useTheme,
|
|
4
|
+
type PopoverProps,
|
|
5
|
+
} from "@mui/material";
|
|
6
|
+
import type { PropsWithChildren } from "react";
|
|
7
|
+
|
|
8
|
+
type ExtendedPopoverProps = {
|
|
9
|
+
currentMenuIndex: number; // **Added Prop**
|
|
10
|
+
} & PropsWithChildren<PopoverProps>;
|
|
11
|
+
|
|
12
|
+
export const Popover = ({
|
|
13
|
+
open,
|
|
14
|
+
anchorEl,
|
|
15
|
+
onClose,
|
|
16
|
+
children,
|
|
17
|
+
currentMenuIndex,
|
|
18
|
+
}: ExtendedPopoverProps) => {
|
|
19
|
+
const theme = useTheme();
|
|
20
|
+
|
|
21
|
+
const { mirage } = theme.palette.app.color;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<MuiPopover
|
|
25
|
+
open={open}
|
|
26
|
+
anchorEl={anchorEl}
|
|
27
|
+
anchorOrigin={{
|
|
28
|
+
vertical: "top",
|
|
29
|
+
horizontal: "right",
|
|
30
|
+
}}
|
|
31
|
+
onClose={onClose}
|
|
32
|
+
sx={{
|
|
33
|
+
"& .MuiPaper-root": {
|
|
34
|
+
background: mirage[900],
|
|
35
|
+
width: "200px",
|
|
36
|
+
// eslint-disable-next-line sonarjs/no-all-duplicated-branches
|
|
37
|
+
marginLeft: currentMenuIndex ? "64px" : "0px",
|
|
38
|
+
marginTop: currentMenuIndex ? currentMenuIndex * 3.6 + 6.2 : "10px",
|
|
39
|
+
},
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</MuiPopover>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Popper as MuiPopper, useTheme, type PopperProps } from "@mui/material";
|
|
2
|
+
import type { PropsWithChildren } from "react";
|
|
3
|
+
|
|
4
|
+
type ExtendedPopoverProps = {
|
|
5
|
+
currentMenuIndex: number;
|
|
6
|
+
} & PropsWithChildren<PopperProps>;
|
|
7
|
+
|
|
8
|
+
export const Popper = ({
|
|
9
|
+
open,
|
|
10
|
+
anchorEl,
|
|
11
|
+
children,
|
|
12
|
+
currentMenuIndex,
|
|
13
|
+
}: ExtendedPopoverProps) => {
|
|
14
|
+
const theme = useTheme();
|
|
15
|
+
|
|
16
|
+
const { mirage } = theme.palette.app.color;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<MuiPopper
|
|
20
|
+
open={open}
|
|
21
|
+
anchorEl={anchorEl}
|
|
22
|
+
placement="bottom-end"
|
|
23
|
+
modifiers={[
|
|
24
|
+
{
|
|
25
|
+
name: "offset",
|
|
26
|
+
options: {
|
|
27
|
+
offset: [
|
|
28
|
+
currentMenuIndex ? 79 : 200,
|
|
29
|
+
currentMenuIndex ? currentMenuIndex * 36 + 82 : -56,
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
]}
|
|
34
|
+
sx={{
|
|
35
|
+
background: mirage[900],
|
|
36
|
+
width: "200px",
|
|
37
|
+
zIndex: 1300,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{children}
|
|
41
|
+
</MuiPopper>
|
|
42
|
+
);
|
|
43
|
+
};
|