@codezee/sixtify-brahma 0.2.2 → 0.2.6
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/package.json +1 -1
- package/packages/shared-components/src/Actions/ConfigureAction.tsx +13 -0
- package/packages/shared-components/src/Actions/index.ts +2 -1
- package/packages/shared-components/src/AgGrid/ActionCell/ActionCell.tsx +3 -1
- package/packages/shared-components/src/AgGrid/AgGrid.tsx +7 -1
- package/packages/shared-components/src/Card/ProfileCard/ProfileCard.tsx +1 -1
- package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardBody.tsx +4 -4
- package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardHeader.tsx +1 -1
- package/packages/shared-components/src/Charts/PieChart.tsx +20 -8
- package/packages/shared-components/src/Charts/Skeleton.tsx +36 -0
- package/packages/shared-components/src/Drawer/Bullet.tsx +1 -1
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItem.tsx +8 -1
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItemList.tsx +11 -7
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerSubMenuItemList.tsx +96 -97
- package/packages/shared-components/src/Drawer/CloseDrawer/Popper.tsx +3 -3
- package/packages/shared-components/src/Drawer/Drawer.tsx +1 -1
- package/packages/shared-components/src/Drawer/MenuItem.tsx +8 -2
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItemList.tsx +162 -214
- package/packages/shared-components/src/FilterList/FilterListV2.tsx +24 -13
- package/packages/shared-components/src/FilterList/index.ts +2 -0
- package/packages/shared-components/src/FormFields/Autocomplete/Autocomplete.tsx +86 -4
- package/packages/shared-components/src/FormFields/DatePicker/DatePicker.tsx +14 -3
- package/packages/shared-components/src/FormFields/DatePicker/Skeleton.tsx +15 -8
- package/packages/shared-components/src/FormFields/DateTimePicker/DateTimePicker.tsx +9 -4
- package/packages/shared-components/src/FormFields/FileUpload/FileNames.tsx +32 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.tsx +13 -53
- package/packages/shared-components/src/FormFields/FileUpload/index.ts +1 -0
- package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.tsx +16 -1
- package/packages/shared-components/src/FormFields/TextField/Skeleton.tsx +13 -8
- package/packages/shared-components/src/FormFields/TextField/TextField.tsx +2 -2
- package/packages/shared-components/src/FormFields/TimePicker/TimePicker.tsx +6 -0
- package/packages/shared-components/src/Indicator/Indicator.tsx +4 -3
- package/packages/shared-components/src/Layouts/FormGridLayout.tsx +27 -0
- package/packages/shared-components/src/Layouts/index.ts +2 -1
- 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 +1 -1
- package/packages/shared-components/src/Svgs/Drawer/SettingIcon.tsx +17 -37
- 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/SvgsTransaction.tsx +72 -70
- package/packages/shared-components/src/Svgs/Drawer/index.ts +3 -0
- package/packages/shared-components/src/Svgs/ImportExcelSuccessIcon.tsx +54 -0
- package/packages/shared-components/src/Svgs/SvgConfigure.tsx +51 -0
- package/packages/shared-components/src/Svgs/SvgEmail.tsx +24 -0
- package/packages/shared-components/src/Svgs/SvgPhone.tsx +16 -0
- package/packages/shared-components/src/Svgs/SvgsHome.tsx +8 -6
- package/packages/shared-components/src/Svgs/SvgsIndicator.tsx +7 -3
- package/packages/shared-components/src/Svgs/index.ts +3 -1
- package/packages/shared-components/src/Timeline/TimelineTrackSegments.tsx +11 -2
- package/packages/shared-components/src/Tooltip/Tooltip.tsx +1 -1
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.styled.tsx +3 -7
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.tsx +76 -15
- package/packages/shared-components/src/index.ts +6 -5
- package/packages/shared-components/src/utils/colorVariant.ts +26 -6
- package/packages/shared-components/src/utils/date.ts +19 -5
- package/packages/shared-components/src/utils/index.ts +9 -11
- package/packages/shared-components/src/utils/theme/colorPalette.ts +2 -0
- package/packages/shared-components/src/utils/theme/theme.ts +8 -0
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IconButtonProps } from "@mui/material";
|
|
2
|
+
import { IconButton } from "@mui/material";
|
|
3
|
+
import { SvgConfigure } from "../Svgs";
|
|
4
|
+
|
|
5
|
+
export type ConfigureActionProps = IconButtonProps;
|
|
6
|
+
|
|
7
|
+
export const ConfigureAction = (props: ConfigureActionProps) => {
|
|
8
|
+
return (
|
|
9
|
+
<IconButton {...props}>
|
|
10
|
+
<SvgConfigure />
|
|
11
|
+
</IconButton>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export * from "./AddAction";
|
|
1
2
|
export * from "./CalendarAction";
|
|
3
|
+
export * from "./ConfigureAction";
|
|
2
4
|
export * from "./DeleteAction";
|
|
3
5
|
export * from "./DownloadAction";
|
|
4
6
|
export * from "./EditAction";
|
|
5
7
|
export * from "./HistoryAction";
|
|
6
|
-
export * from "./AddAction";
|
|
@@ -11,8 +11,9 @@ type AgGridActionColumn = {
|
|
|
11
11
|
|
|
12
12
|
type ActionColumnProps = {
|
|
13
13
|
items: AgGridActionColumn[];
|
|
14
|
+
disabled?: boolean;
|
|
14
15
|
};
|
|
15
|
-
export const ActionCell = ({ items }: ActionColumnProps) => {
|
|
16
|
+
export const ActionCell = ({ items, disabled }: ActionColumnProps) => {
|
|
16
17
|
const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>(null);
|
|
17
18
|
|
|
18
19
|
const HandleClose = () => {
|
|
@@ -29,6 +30,7 @@ export const ActionCell = ({ items }: ActionColumnProps) => {
|
|
|
29
30
|
component="div"
|
|
30
31
|
sx={{ cursor: "pointer", alignItems: "center", width: "100%" }}
|
|
31
32
|
onClick={HandleClick}
|
|
33
|
+
disabled={disabled}
|
|
32
34
|
>
|
|
33
35
|
<MoreVertIcon />
|
|
34
36
|
</IconButton>
|
|
@@ -4,7 +4,9 @@ import { AgGridReact } from "ag-grid-react";
|
|
|
4
4
|
import type { Ref } from "react";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
6
|
|
|
7
|
-
export const defaultPageSize =
|
|
7
|
+
export const defaultPageSize = 50;
|
|
8
|
+
|
|
9
|
+
export const pageSizeOptions = [20, 50, 100, 200];
|
|
8
10
|
|
|
9
11
|
//TODO: jaydip, fix unknown type
|
|
10
12
|
export type AgGridProps<T = unknown> = AgGridReactProps<T> & {
|
|
@@ -38,6 +40,7 @@ export const AgGrid = forwardRef(
|
|
|
38
40
|
// eslint-disable-next-line quotes
|
|
39
41
|
overlayNoRowsTemplate = '<span class="ag-overlay-no-rows-center">No Data Found</span>',
|
|
40
42
|
infiniteInitialRowCount = defaultPageSize,
|
|
43
|
+
pagination = false,
|
|
41
44
|
...rest
|
|
42
45
|
} = props;
|
|
43
46
|
|
|
@@ -77,6 +80,9 @@ export const AgGrid = forwardRef(
|
|
|
77
80
|
rowBuffer={rowBuffer}
|
|
78
81
|
infiniteInitialRowCount={infiniteInitialRowCount}
|
|
79
82
|
overlayNoRowsTemplate={overlayNoRowsTemplate}
|
|
83
|
+
pagination={pagination}
|
|
84
|
+
{...(pagination ? { paginationPageSize: defaultPageSize } : {})}
|
|
85
|
+
paginationPageSizeSelector={pagination ? pageSizeOptions : false}
|
|
80
86
|
{...rest}
|
|
81
87
|
/>
|
|
82
88
|
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import CallOutlinedIcon from "@mui/icons-material/CallOutlined";
|
|
2
|
-
import EmailOutlinedIcon from "@mui/icons-material/EmailOutlined";
|
|
3
1
|
import { Box, Stack } from "@mui/material";
|
|
4
2
|
import type { PropsWithChildren } from "react";
|
|
5
3
|
import { PadBox } from "../../../PadBox";
|
|
4
|
+
import { SvgEmail } from "../../../Svgs/SvgEmail";
|
|
5
|
+
import { SvgPhone } from "../../../Svgs/SvgPhone";
|
|
6
6
|
import { CardItem, CardItemValue } from "../../CardItem";
|
|
7
7
|
|
|
8
8
|
type ProfileCardBodyProps = PropsWithChildren<{
|
|
@@ -39,11 +39,11 @@ export function ProfileCardBody({
|
|
|
39
39
|
value={<CardItemValue title={subDepartment} loading={loading} />}
|
|
40
40
|
/>
|
|
41
41
|
<CardItem
|
|
42
|
-
label={<
|
|
42
|
+
label={<SvgEmail />}
|
|
43
43
|
value={<CardItemValue title={email} loading={loading} />}
|
|
44
44
|
/>
|
|
45
45
|
<CardItem
|
|
46
|
-
label={<
|
|
46
|
+
label={<SvgPhone />}
|
|
47
47
|
value={<CardItemValue title={phone} loading={loading} />}
|
|
48
48
|
/>
|
|
49
49
|
</Stack>
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { PieChartProps as MuiPieChartProps } from "@mui/x-charts/PieChart";
|
|
3
|
-
import { PieChart as MuiPieChart } from "@mui/x-charts/PieChart";
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
4
2
|
import type { PieSeriesType, PieValueType } from "@mui/x-charts";
|
|
5
|
-
import type { MakeOptional } from "@mui/x-charts/internals";
|
|
6
3
|
import { useDrawingArea } from "@mui/x-charts/hooks";
|
|
7
|
-
import {
|
|
4
|
+
import type { MakeOptional } from "@mui/x-charts/internals";
|
|
5
|
+
import type { PieChartProps as MuiPieChartProps } from "@mui/x-charts/PieChart";
|
|
6
|
+
import { PieChart as MuiPieChart } from "@mui/x-charts/PieChart";
|
|
7
|
+
import type { ReactNode } from "react";
|
|
8
|
+
import { Skeleton } from "./Skeleton";
|
|
8
9
|
|
|
9
10
|
type PieChartProps = Omit<MuiPieChartProps, "series"> & {
|
|
10
11
|
series: MakeOptional<PieSeriesType<MakeOptional<PieValueType, "id">>, "type">;
|
|
11
12
|
label?: string;
|
|
13
|
+
valueFormatter?: (item: { value: number }) => string;
|
|
14
|
+
loading?: boolean;
|
|
12
15
|
};
|
|
13
16
|
|
|
14
17
|
type PieCenterLabelProps = {
|
|
@@ -18,14 +21,13 @@ type PieCenterLabelProps = {
|
|
|
18
21
|
export const PieChart = ({
|
|
19
22
|
height = 235,
|
|
20
23
|
skipAnimation = false,
|
|
24
|
+
loading = false,
|
|
25
|
+
valueFormatter = (item: MakeOptional<PieValueType, "id">) => `${item.value}%`,
|
|
21
26
|
tooltip,
|
|
22
27
|
label,
|
|
23
28
|
series,
|
|
24
29
|
...rest
|
|
25
30
|
}: PieChartProps) => {
|
|
26
|
-
const valueFormatter = (item: MakeOptional<PieValueType, "id">) =>
|
|
27
|
-
`${item.value}%`;
|
|
28
|
-
|
|
29
31
|
const StyledText = styled("text")(({ theme }) => ({
|
|
30
32
|
fill: theme.palette.text.primary,
|
|
31
33
|
textAnchor: "middle",
|
|
@@ -33,6 +35,12 @@ export const PieChart = ({
|
|
|
33
35
|
fontSize: 20,
|
|
34
36
|
}));
|
|
35
37
|
|
|
38
|
+
const outerRadius = Number(series.outerRadius ?? 0);
|
|
39
|
+
|
|
40
|
+
const innerRadius = Number(series.innerRadius ?? 0);
|
|
41
|
+
|
|
42
|
+
const radius = outerRadius - innerRadius;
|
|
43
|
+
|
|
36
44
|
// eslint-disable-next-line sonarjs/no-unstable-nested-components
|
|
37
45
|
const PieCenterLabel = ({ children }: PieCenterLabelProps) => {
|
|
38
46
|
const { width, height, left, top } = useDrawingArea();
|
|
@@ -44,6 +52,10 @@ export const PieChart = ({
|
|
|
44
52
|
);
|
|
45
53
|
};
|
|
46
54
|
|
|
55
|
+
if (loading) {
|
|
56
|
+
return <Skeleton height={height} radius={radius} />;
|
|
57
|
+
}
|
|
58
|
+
|
|
47
59
|
return (
|
|
48
60
|
<MuiPieChart
|
|
49
61
|
height={height}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Box, Skeleton as MuiSkeleton } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const Skeleton = ({
|
|
4
|
+
height = 235,
|
|
5
|
+
radius = 18,
|
|
6
|
+
}: {
|
|
7
|
+
height?: string | number;
|
|
8
|
+
radius?: number;
|
|
9
|
+
}) => {
|
|
10
|
+
return (
|
|
11
|
+
<Box position="relative" display="flex" justifyContent="center">
|
|
12
|
+
<MuiSkeleton
|
|
13
|
+
sx={{
|
|
14
|
+
transform: "unset",
|
|
15
|
+
width: "162px",
|
|
16
|
+
height: { height },
|
|
17
|
+
borderRadius: "50%",
|
|
18
|
+
border: `${radius}px solid #e0e0e0`,
|
|
19
|
+
background: "transparent",
|
|
20
|
+
boxSizing: "border-box",
|
|
21
|
+
}}
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<MuiSkeleton
|
|
25
|
+
sx={{
|
|
26
|
+
position: "absolute",
|
|
27
|
+
top: "50%",
|
|
28
|
+
left: "50%",
|
|
29
|
+
transform: "translate(-50%, -50%)",
|
|
30
|
+
width: "80px",
|
|
31
|
+
height: "25px",
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</Box>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -29,21 +29,28 @@ export const CloseDrawerMenuItem = ({
|
|
|
29
29
|
component="li"
|
|
30
30
|
sx={{
|
|
31
31
|
bgcolor: selected && !isShowEndAdornment ? butterflyBlue[900] : "",
|
|
32
|
+
padding: !title ? "2.5px 0" : "0px",
|
|
33
|
+
wordBreak: "break-word",
|
|
32
34
|
}}
|
|
33
35
|
>
|
|
34
36
|
<MenuItem
|
|
35
37
|
sx={{
|
|
38
|
+
fontSize: "14px",
|
|
39
|
+
padding: "9.5px 16px",
|
|
36
40
|
":focus-visible": {
|
|
37
41
|
border: `1px solid ${butterflyBlue[900]}`,
|
|
38
42
|
backgroundColor: slate[900],
|
|
39
43
|
},
|
|
44
|
+
margin: "0",
|
|
40
45
|
}}
|
|
41
46
|
selected={selected}
|
|
42
47
|
title={title}
|
|
43
48
|
icon={icon}
|
|
44
49
|
onClick={onClick}
|
|
45
50
|
onMouseEnter={onMouseEnter}
|
|
46
|
-
endAdornment={
|
|
51
|
+
endAdornment={
|
|
52
|
+
isShowEndAdornment && <ChevronRight sx={{ fontSize: "16px" }} />
|
|
53
|
+
}
|
|
47
54
|
/>
|
|
48
55
|
</Box>
|
|
49
56
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Box } from "@mui/material";
|
|
1
2
|
import { isEmpty as _isEmpty } from "lodash";
|
|
2
3
|
import {
|
|
3
|
-
type MouseEvent,
|
|
4
4
|
type HTMLAttributeAnchorTarget,
|
|
5
|
+
type MouseEvent,
|
|
5
6
|
useMemo,
|
|
6
7
|
useState,
|
|
7
8
|
} from "react";
|
|
@@ -9,7 +10,10 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
9
10
|
import { urlToNestedObject } from "../../utils/urlToNestedObject";
|
|
10
11
|
import type { MenuItem } from "../Drawer";
|
|
11
12
|
import { CloseDrawerMenuItem } from "./CloseDrawerMenuItem";
|
|
12
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
CloseDrawerSubMenuItemList,
|
|
15
|
+
type MenuOpenState,
|
|
16
|
+
} from "./CloseDrawerSubMenuItemList";
|
|
13
17
|
import { Popper } from "./Popper";
|
|
14
18
|
|
|
15
19
|
type CloseDrawerMenuItemListProps = {
|
|
@@ -27,9 +31,9 @@ export const CloseDrawerMenuItemList = ({
|
|
|
27
31
|
|
|
28
32
|
const [currentMenuIndex, setCurrentMenuIndex] = useState<number>(0);
|
|
29
33
|
|
|
30
|
-
const [currentPathMenuOpen, setCurrentPathMenuOpen] = useState<
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
const [currentPathMenuOpen, setCurrentPathMenuOpen] = useState<MenuOpenState>(
|
|
35
|
+
{}
|
|
36
|
+
);
|
|
33
37
|
|
|
34
38
|
useMemo(() => {
|
|
35
39
|
const obj = urlToNestedObject(currentPathname);
|
|
@@ -86,7 +90,7 @@ export const CloseDrawerMenuItemList = ({
|
|
|
86
90
|
})}
|
|
87
91
|
|
|
88
92
|
{!!anchorEl && (
|
|
89
|
-
<
|
|
93
|
+
<Box onMouseLeave={handleClose}>
|
|
90
94
|
<Popper
|
|
91
95
|
open={true}
|
|
92
96
|
anchorEl={anchorEl}
|
|
@@ -98,7 +102,7 @@ export const CloseDrawerMenuItemList = ({
|
|
|
98
102
|
onCloseMenuPopover={handleClose}
|
|
99
103
|
/>
|
|
100
104
|
</Popper>
|
|
101
|
-
</
|
|
105
|
+
</Box>
|
|
102
106
|
)}
|
|
103
107
|
</>
|
|
104
108
|
);
|
|
@@ -1,125 +1,124 @@
|
|
|
1
1
|
import { Box, List } from "@mui/material";
|
|
2
2
|
import {
|
|
3
|
-
type HTMLAttributeAnchorTarget,
|
|
4
3
|
useState,
|
|
4
|
+
type HTMLAttributeAnchorTarget,
|
|
5
5
|
type MouseEvent,
|
|
6
6
|
} from "react";
|
|
7
|
-
import type
|
|
7
|
+
import { type MenuItem } from "../Drawer";
|
|
8
8
|
import { CloseDrawerMenuItem } from "./CloseDrawerMenuItem";
|
|
9
9
|
import { Popper } from "./Popper";
|
|
10
10
|
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
export type MenuOpenState = {
|
|
12
|
+
[key: string]: MenuOpenState | boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type RecursiveMenuItemProps = {
|
|
16
|
+
item: MenuItem;
|
|
17
|
+
parentPath: string;
|
|
18
|
+
currentPathMenuOpen: MenuOpenState;
|
|
16
19
|
onCloseMenuPopover: () => void;
|
|
20
|
+
level?: number;
|
|
17
21
|
};
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
const RecursiveMenuItem = ({
|
|
24
|
+
item,
|
|
25
|
+
parentPath,
|
|
20
26
|
currentPathMenuOpen,
|
|
21
|
-
currentMenuItem,
|
|
22
27
|
onCloseMenuPopover,
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
level = 0,
|
|
29
|
+
}: RecursiveMenuItemProps) => {
|
|
30
|
+
const [anchorEl, setAnchorEl] = useState<HTMLDivElement | null>(null);
|
|
25
31
|
|
|
26
|
-
const
|
|
32
|
+
const isOpen = Boolean(anchorEl);
|
|
27
33
|
|
|
28
|
-
const handlePopoverOpen = (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const newAnchorEls = [...anchorEls];
|
|
33
|
-
|
|
34
|
-
newAnchorEls[index] = event.currentTarget;
|
|
35
|
-
setAnchorEls(newAnchorEls);
|
|
36
|
-
|
|
37
|
-
setOpenPopoverIndex(index);
|
|
34
|
+
const handlePopoverOpen = (event: MouseEvent<HTMLDivElement>) => {
|
|
35
|
+
if (item.menuItems?.length) {
|
|
36
|
+
setAnchorEl(event.currentTarget);
|
|
37
|
+
}
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const handleClose = () => {
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
setAnchorEl(null);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const handleClick = (target: HTMLAttributeAnchorTarget = "_self") => {
|
|
45
|
+
const fullPath = `${parentPath}/${item.key}`;
|
|
46
|
+
|
|
47
|
+
if (item.onClick) {
|
|
48
|
+
item.onClick(fullPath, target);
|
|
49
|
+
|
|
50
|
+
if (target !== "_blank") {
|
|
51
|
+
handleClose();
|
|
52
|
+
onCloseMenuPopover();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
43
55
|
};
|
|
44
56
|
|
|
57
|
+
const isSelected = Boolean(currentPathMenuOpen[item.key]);
|
|
58
|
+
|
|
59
|
+
const currentPath = `${parentPath}/${item.key}`;
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Box onMouseLeave={handleClose}>
|
|
63
|
+
<CloseDrawerMenuItem
|
|
64
|
+
onClick={handleClick}
|
|
65
|
+
title={item.title}
|
|
66
|
+
icon={item.icon}
|
|
67
|
+
isShowEndAdornment={Boolean(item.menuItems?.length)}
|
|
68
|
+
selected={isSelected}
|
|
69
|
+
onMouseEnter={handlePopoverOpen}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
{item.menuItems?.length && isOpen && (
|
|
73
|
+
<Popper open={true} anchorEl={anchorEl} currentMenuIndex={level}>
|
|
74
|
+
<List disablePadding>
|
|
75
|
+
{item.menuItems.map((subItem) => (
|
|
76
|
+
<RecursiveMenuItem
|
|
77
|
+
key={subItem.key}
|
|
78
|
+
item={subItem}
|
|
79
|
+
parentPath={currentPath}
|
|
80
|
+
currentPathMenuOpen={
|
|
81
|
+
(currentPathMenuOpen[item.key] as MenuOpenState) ?? {}
|
|
82
|
+
}
|
|
83
|
+
onCloseMenuPopover={onCloseMenuPopover}
|
|
84
|
+
level={level + 1}
|
|
85
|
+
/>
|
|
86
|
+
))}
|
|
87
|
+
</List>
|
|
88
|
+
</Popper>
|
|
89
|
+
)}
|
|
90
|
+
</Box>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
type CloseDrawerSubMenuItemListProps = {
|
|
95
|
+
currentPathMenuOpen: MenuOpenState;
|
|
96
|
+
currentMenuItem?: MenuItem;
|
|
97
|
+
onCloseMenuPopover: () => void;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const CloseDrawerSubMenuItemList = ({
|
|
101
|
+
currentPathMenuOpen,
|
|
102
|
+
currentMenuItem,
|
|
103
|
+
onCloseMenuPopover,
|
|
104
|
+
}: CloseDrawerSubMenuItemListProps) => {
|
|
45
105
|
if (!currentMenuItem) {
|
|
46
106
|
return <>Loading...</>;
|
|
47
107
|
}
|
|
48
108
|
|
|
49
|
-
const { menuItems = [], key: rootKey } = currentMenuItem;
|
|
50
|
-
|
|
51
109
|
return (
|
|
52
|
-
<List>
|
|
53
|
-
{menuItems
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
)}
|
|
110
|
+
<List disablePadding>
|
|
111
|
+
{currentMenuItem.menuItems?.map((item) => (
|
|
112
|
+
<RecursiveMenuItem
|
|
113
|
+
key={item.key}
|
|
114
|
+
item={item}
|
|
115
|
+
parentPath={`/${currentMenuItem.key}`}
|
|
116
|
+
currentPathMenuOpen={
|
|
117
|
+
(currentPathMenuOpen[currentMenuItem.key] as MenuOpenState) ?? {}
|
|
118
|
+
}
|
|
119
|
+
onCloseMenuPopover={onCloseMenuPopover}
|
|
120
|
+
/>
|
|
121
|
+
))}
|
|
123
122
|
</List>
|
|
124
123
|
);
|
|
125
124
|
};
|
|
@@ -25,15 +25,15 @@ export const Popper = ({
|
|
|
25
25
|
name: "offset",
|
|
26
26
|
options: {
|
|
27
27
|
offset: [
|
|
28
|
-
currentMenuIndex ? 79 :
|
|
29
|
-
currentMenuIndex ? currentMenuIndex *
|
|
28
|
+
currentMenuIndex ? 79 : 203,
|
|
29
|
+
currentMenuIndex ? currentMenuIndex * 43.5 + 82 : -40,
|
|
30
30
|
],
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
]}
|
|
34
34
|
sx={{
|
|
35
35
|
background: mirage[900],
|
|
36
|
-
width: "
|
|
36
|
+
width: "203px",
|
|
37
37
|
zIndex: 1300,
|
|
38
38
|
}}
|
|
39
39
|
>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Box } from "@mui/material";
|
|
4
4
|
import List from "@mui/material/List";
|
|
5
|
-
import type {
|
|
5
|
+
import type { HTMLAttributeAnchorTarget, ReactNode } from "react";
|
|
6
6
|
import { PadBox } from "../PadBox";
|
|
7
7
|
import { AppLogoMedium } from "../Svgs/AppLogo/AppLogoMedium";
|
|
8
8
|
import { AppLogoSmall } from "../Svgs/AppLogo/AppLogoSmall";
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
ListItemText,
|
|
4
4
|
Stack,
|
|
5
5
|
useTheme,
|
|
6
|
+
type ListItemButtonProps,
|
|
6
7
|
type SxProps,
|
|
7
8
|
type Theme,
|
|
8
|
-
type ListItemButtonProps,
|
|
9
9
|
} from "@mui/material";
|
|
10
10
|
import type { HTMLAttributeAnchorTarget, ReactNode } from "react";
|
|
11
11
|
import { Bullet } from "./Bullet";
|
|
@@ -61,7 +61,13 @@ export const MenuItem = ({
|
|
|
61
61
|
justifyContent="center"
|
|
62
62
|
>
|
|
63
63
|
{icon}
|
|
64
|
-
{title &&
|
|
64
|
+
{title && (
|
|
65
|
+
<ListItemText
|
|
66
|
+
primary={title}
|
|
67
|
+
disableTypography={true}
|
|
68
|
+
sx={{ ...sx, padding: "0" }}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
65
71
|
</Stack>
|
|
66
72
|
{endAdornment}
|
|
67
73
|
</ListItemButton>
|