@campxdev/react-blueprint 1.0.4 → 1.0.5
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 +5 -2
- package/public/index.html +3 -4
- package/src/components/Assets/Icons/IconComponents/CompletedStateIcon.tsx +35 -0
- package/src/components/Assets/Icons/IconComponents/SaveIcon.tsx +42 -0
- package/src/components/Assets/Icons/IconComponents/ShareIcon.tsx +61 -0
- package/src/components/Assets/Icons/Icons.tsx +6 -0
- package/src/components/Charts/BarChart/BarChart.tsx +160 -0
- package/src/components/Charts/LineChart/LineChart.tsx +119 -0
- package/src/components/Charts/PieChart/PieChart.tsx +95 -0
- package/src/components/Charts/TreeMap/TreeMap.tsx +151 -0
- package/src/components/Charts/types/types.ts +43 -0
- package/src/components/DataDisplay/Accordion/Accordion.tsx +55 -0
- package/src/components/DataDisplay/Accordion/utils/StandardImageList.tsx +70 -0
- package/src/components/DataDisplay/export.ts +4 -1
- package/src/components/Input/export.ts +1 -0
- package/src/components/Layout/TabsLayout/Tabs.tsx +67 -0
- package/src/components/Layout/TabsLayout/TabsLayout.tsx +56 -0
- package/src/components/Layout/exports.ts +4 -0
- package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +40 -0
- package/src/components/Navigation/Sidebar/styles.tsx +1 -1
- package/src/components/Navigation/Stepper/Stepper.tsx +59 -0
- package/src/components/Navigation/Stepper/StepperComponents.tsx +72 -0
- package/src/components/Navigation/exports.ts +4 -0
- package/src/components/export.ts +1 -1
- package/src/stories/Charts/BarChart.stories.tsx +142 -0
- package/src/stories/Charts/LineChart.stories.tsx +112 -0
- package/src/stories/Charts/PieChart.stories.tsx +137 -0
- package/src/stories/Charts/Treemap.stories.tsx +224 -0
- package/src/stories/DataDisplay/Accordion.stories.tsx +62 -0
- package/src/stories/Layout/TabsLayout.stories.tsx +53 -0
- package/src/stories/Navigation/Breadcrumbs.stories.tsx +34 -0
- package/src/stories/Navigation/Stepper.stories.tsx +51 -0
- package/src/themes/commonTheme.ts +47 -1
- package/types/theme.d.ts +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Stack,
|
|
4
|
+
styled,
|
|
5
|
+
SxProps,
|
|
6
|
+
Typography,
|
|
7
|
+
useTheme,
|
|
8
|
+
} from "@mui/material";
|
|
9
|
+
import { Treemap as ReTreeMap, Tooltip } from "recharts";
|
|
10
|
+
import { AnimationTiming } from "recharts/types/util/types";
|
|
11
|
+
import { MarginProps } from "../types/types";
|
|
12
|
+
|
|
13
|
+
interface TreeMapProps {
|
|
14
|
+
title?: string;
|
|
15
|
+
titleSx?: any;
|
|
16
|
+
data: any;
|
|
17
|
+
dataKey: string | number;
|
|
18
|
+
width?: number;
|
|
19
|
+
height?: number;
|
|
20
|
+
margin?: MarginProps;
|
|
21
|
+
aspectRatio?: number;
|
|
22
|
+
fill?: string;
|
|
23
|
+
stroke?: string;
|
|
24
|
+
colors?: string[];
|
|
25
|
+
showToolTip?: boolean;
|
|
26
|
+
isAnimationActive?: boolean;
|
|
27
|
+
animationEasing?: AnimationTiming;
|
|
28
|
+
treeMapStyle?: SxProps;
|
|
29
|
+
containerSx?: any;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const TreeMap = ({
|
|
33
|
+
title = "Tree Map",
|
|
34
|
+
titleSx,
|
|
35
|
+
data,
|
|
36
|
+
dataKey,
|
|
37
|
+
width = 400,
|
|
38
|
+
height = 200,
|
|
39
|
+
aspectRatio,
|
|
40
|
+
fill = "#F8C12D",
|
|
41
|
+
stroke = "#fff",
|
|
42
|
+
colors,
|
|
43
|
+
showToolTip = true,
|
|
44
|
+
animationEasing = "linear",
|
|
45
|
+
isAnimationActive = false,
|
|
46
|
+
treeMapStyle,
|
|
47
|
+
containerSx,
|
|
48
|
+
}: TreeMapProps) => {
|
|
49
|
+
return (
|
|
50
|
+
<Stack alignItems={"center"} sx={{ ...containerSx }}>
|
|
51
|
+
<Typography variant={"h5"} align={"center"} sx={{ ...titleSx }}>
|
|
52
|
+
{title}
|
|
53
|
+
</Typography>
|
|
54
|
+
<ReTreeMap
|
|
55
|
+
data={data}
|
|
56
|
+
dataKey={dataKey}
|
|
57
|
+
width={width}
|
|
58
|
+
height={height}
|
|
59
|
+
aspectRatio={aspectRatio}
|
|
60
|
+
fill={fill}
|
|
61
|
+
stroke={stroke}
|
|
62
|
+
style={treeMapStyle}
|
|
63
|
+
isAnimationActive={isAnimationActive}
|
|
64
|
+
animationEasing={animationEasing}
|
|
65
|
+
content={<CustomizedContent colors={colors} />}
|
|
66
|
+
>
|
|
67
|
+
{showToolTip && <Tooltip content={CustomTooltip} />}
|
|
68
|
+
</ReTreeMap>
|
|
69
|
+
</Stack>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default TreeMap;
|
|
74
|
+
|
|
75
|
+
const CustomizedContent = (props: any) => {
|
|
76
|
+
const theme = useTheme();
|
|
77
|
+
const {
|
|
78
|
+
root,
|
|
79
|
+
depth,
|
|
80
|
+
x,
|
|
81
|
+
y,
|
|
82
|
+
width,
|
|
83
|
+
height,
|
|
84
|
+
index,
|
|
85
|
+
payload,
|
|
86
|
+
colors,
|
|
87
|
+
rank,
|
|
88
|
+
name,
|
|
89
|
+
} = props;
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<g {...props}>
|
|
93
|
+
<rect
|
|
94
|
+
x={x}
|
|
95
|
+
y={y}
|
|
96
|
+
width={width}
|
|
97
|
+
height={height}
|
|
98
|
+
style={{
|
|
99
|
+
fill:
|
|
100
|
+
depth < 2
|
|
101
|
+
? colors[
|
|
102
|
+
Math.floor((index / root.children.length) * colors.length)
|
|
103
|
+
]
|
|
104
|
+
: "#ffffff00",
|
|
105
|
+
stroke: theme.palette.surface.grey,
|
|
106
|
+
strokeWidth: 2,
|
|
107
|
+
strokeOpacity: 1,
|
|
108
|
+
}}
|
|
109
|
+
/>
|
|
110
|
+
{depth === 1 ? (
|
|
111
|
+
<text
|
|
112
|
+
x={x + width / 2}
|
|
113
|
+
y={y + height / 2}
|
|
114
|
+
textAnchor="middle"
|
|
115
|
+
fill={theme.palette.text.primary}
|
|
116
|
+
fontSize={14}
|
|
117
|
+
strokeOpacity={0}
|
|
118
|
+
>
|
|
119
|
+
{name}
|
|
120
|
+
</text>
|
|
121
|
+
) : null}
|
|
122
|
+
</g>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const CustomTooltip = ({ active, payload }: any) => {
|
|
127
|
+
const theme = useTheme();
|
|
128
|
+
if (active && payload && payload.length) {
|
|
129
|
+
return (
|
|
130
|
+
<StyledContainer>
|
|
131
|
+
<Typography variant="body2">{`${payload[0].payload.root.name}`}</Typography>
|
|
132
|
+
<Typography variant="caption">
|
|
133
|
+
<span>{`${payload[0].payload.name}`}</span>
|
|
134
|
+
<span
|
|
135
|
+
style={{ fontWeight: "bold", color: theme.palette.text.primary }}
|
|
136
|
+
>
|
|
137
|
+
{"\xa0\xa0" + `${payload[0].value}`}
|
|
138
|
+
</span>
|
|
139
|
+
</Typography>
|
|
140
|
+
</StyledContainer>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return null;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const StyledContainer = styled(Box)(({ theme }) => ({
|
|
148
|
+
backgroundColor: theme.palette.background.paper,
|
|
149
|
+
borderRadius: "5px",
|
|
150
|
+
padding: "5px 10px",
|
|
151
|
+
}));
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SxProps } from "@mui/material";
|
|
2
|
+
import {
|
|
3
|
+
HorizontalAlignmentType,
|
|
4
|
+
IconType,
|
|
5
|
+
VerticalAlignmentType,
|
|
6
|
+
} from "recharts/types/component/DefaultLegendContent";
|
|
7
|
+
import { LayoutType } from "recharts/types/util/types";
|
|
8
|
+
|
|
9
|
+
export type CartesianGridProps = {
|
|
10
|
+
showCartesianGrid: boolean;
|
|
11
|
+
size?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type AxisLabelProps = {
|
|
15
|
+
xLabel?: LabelProps;
|
|
16
|
+
yLabel?: LabelProps;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type MarginProps = {
|
|
20
|
+
top?: number;
|
|
21
|
+
right?: number;
|
|
22
|
+
bottom?: number;
|
|
23
|
+
left?: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type LabelProps = {
|
|
27
|
+
value: string;
|
|
28
|
+
dx?: number;
|
|
29
|
+
dy?: number;
|
|
30
|
+
angle?: number;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type LegendProps = {
|
|
34
|
+
width?: number;
|
|
35
|
+
height?: number;
|
|
36
|
+
layout?: LayoutType;
|
|
37
|
+
align?: HorizontalAlignmentType;
|
|
38
|
+
verticalAlign?: VerticalAlignmentType;
|
|
39
|
+
iconSize?: number;
|
|
40
|
+
iconType?: IconType;
|
|
41
|
+
margin: MarginProps;
|
|
42
|
+
className: string;
|
|
43
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ExpandMore } from "@mui/icons-material";
|
|
2
|
+
import {
|
|
3
|
+
AccordionDetails,
|
|
4
|
+
Box,
|
|
5
|
+
Accordion as MuiAccordion,
|
|
6
|
+
AccordionSummary as MuiAccordionSummary,
|
|
7
|
+
SxProps,
|
|
8
|
+
} from "@mui/material";
|
|
9
|
+
import { ReactNode, SyntheticEvent, useState } from "react";
|
|
10
|
+
import { Typography } from "../Typography/Typography";
|
|
11
|
+
|
|
12
|
+
interface AccordionProps {
|
|
13
|
+
data: AccordionItem[];
|
|
14
|
+
containerSx?: SxProps;
|
|
15
|
+
}
|
|
16
|
+
interface AccordionItem {
|
|
17
|
+
title: string | ReactNode;
|
|
18
|
+
content: string | ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Accordion = ({ data, containerSx }: AccordionProps) => {
|
|
22
|
+
const [expanded, setExpanded] = useState<number | false>(false);
|
|
23
|
+
|
|
24
|
+
const handleChange =
|
|
25
|
+
(panel: number) => (event: SyntheticEvent, isExpanded: boolean) => {
|
|
26
|
+
setExpanded(isExpanded ? panel : false);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Box sx={{ ...containerSx }}>
|
|
31
|
+
{data?.map((item, index) => (
|
|
32
|
+
<MuiAccordion
|
|
33
|
+
key={index}
|
|
34
|
+
expanded={expanded === index}
|
|
35
|
+
onChange={handleChange(index)}
|
|
36
|
+
>
|
|
37
|
+
<MuiAccordionSummary expandIcon={<ExpandMore />}>
|
|
38
|
+
{typeof item?.title === "string" ? (
|
|
39
|
+
<Typography variant="subtitle2">{item?.title}</Typography>
|
|
40
|
+
) : (
|
|
41
|
+
item?.title
|
|
42
|
+
)}
|
|
43
|
+
</MuiAccordionSummary>
|
|
44
|
+
<AccordionDetails>
|
|
45
|
+
{typeof item?.content === "string" ? (
|
|
46
|
+
<Typography variant="label1">{item?.content}</Typography>
|
|
47
|
+
) : (
|
|
48
|
+
item?.content
|
|
49
|
+
)}
|
|
50
|
+
</AccordionDetails>
|
|
51
|
+
</MuiAccordion>
|
|
52
|
+
))}
|
|
53
|
+
</Box>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import ImageList from "@mui/material/ImageList";
|
|
2
|
+
import ImageListItem from "@mui/material/ImageListItem";
|
|
3
|
+
|
|
4
|
+
export default function StandardImageList() {
|
|
5
|
+
return (
|
|
6
|
+
<ImageList sx={{ width: 500, height: 450 }} cols={3} rowHeight={164}>
|
|
7
|
+
{itemData.map((item) => (
|
|
8
|
+
<ImageListItem key={item.img}>
|
|
9
|
+
<img
|
|
10
|
+
srcSet={`${item.img}?w=164&h=164&fit=crop&auto=format&dpr=2 2x`}
|
|
11
|
+
src={`${item.img}?w=164&h=164&fit=crop&auto=format`}
|
|
12
|
+
alt={item.title}
|
|
13
|
+
loading="lazy"
|
|
14
|
+
/>
|
|
15
|
+
</ImageListItem>
|
|
16
|
+
))}
|
|
17
|
+
</ImageList>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const itemData = [
|
|
22
|
+
{
|
|
23
|
+
img: "https://images.unsplash.com/photo-1551963831-b3b1ca40c98e",
|
|
24
|
+
title: "Breakfast",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
img: "https://images.unsplash.com/photo-1551782450-a2132b4ba21d",
|
|
28
|
+
title: "Burger",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
img: "https://images.unsplash.com/photo-1522770179533-24471fcdba45",
|
|
32
|
+
title: "Camera",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
img: "https://images.unsplash.com/photo-1444418776041-9c7e33cc5a9c",
|
|
36
|
+
title: "Coffee",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
img: "https://images.unsplash.com/photo-1533827432537-70133748f5c8",
|
|
40
|
+
title: "Hats",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
img: "https://images.unsplash.com/photo-1558642452-9d2a7deb7f62",
|
|
44
|
+
title: "Honey",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
img: "https://images.unsplash.com/photo-1516802273409-68526ee1bdd6",
|
|
48
|
+
title: "Basketball",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
img: "https://images.unsplash.com/photo-1518756131217-31eb79b20e8f",
|
|
52
|
+
title: "Fern",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
img: "https://images.unsplash.com/photo-1597645587822-e99fa5d45d25",
|
|
56
|
+
title: "Mushrooms",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
img: "https://images.unsplash.com/photo-1567306301408-9b74779a11af",
|
|
60
|
+
title: "Tomato basil",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
img: "https://images.unsplash.com/photo-1471357674240-e1a485acb3e1",
|
|
64
|
+
title: "Sea star",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
img: "https://images.unsplash.com/photo-1589118949245-7d38baf380d6",
|
|
68
|
+
title: "Bike",
|
|
69
|
+
},
|
|
70
|
+
];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Box, Divider, styled } from "@mui/material";
|
|
2
|
+
import { NavLink } from "react-router-dom";
|
|
3
|
+
|
|
4
|
+
interface TabProps {
|
|
5
|
+
index: number;
|
|
6
|
+
path: string;
|
|
7
|
+
title: string;
|
|
8
|
+
handleTabChange: (index: number) => void;
|
|
9
|
+
isActiveTab: boolean;
|
|
10
|
+
isPrevTab: boolean;
|
|
11
|
+
isLastTab: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Tab = ({
|
|
15
|
+
index,
|
|
16
|
+
path,
|
|
17
|
+
title,
|
|
18
|
+
isActiveTab,
|
|
19
|
+
isPrevTab,
|
|
20
|
+
isLastTab,
|
|
21
|
+
handleTabChange,
|
|
22
|
+
}: TabProps) => {
|
|
23
|
+
return (
|
|
24
|
+
<Box
|
|
25
|
+
key={index}
|
|
26
|
+
sx={{
|
|
27
|
+
display: "flex",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
}}
|
|
30
|
+
onClick={() => handleTabChange(index)}
|
|
31
|
+
>
|
|
32
|
+
<StyledNavLink to={path} key={path}>
|
|
33
|
+
{title}
|
|
34
|
+
</StyledNavLink>
|
|
35
|
+
{!isActiveTab && !isPrevTab && !isLastTab && (
|
|
36
|
+
<Divider orientation="vertical" variant="middle" flexItem />
|
|
37
|
+
)}
|
|
38
|
+
</Box>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const StyledNavLink = styled(NavLink)(({ theme }) => ({
|
|
43
|
+
width: "204px",
|
|
44
|
+
padding: "12px 26px",
|
|
45
|
+
textAlign: "center",
|
|
46
|
+
textDecoration: "none",
|
|
47
|
+
fontWeight: 400,
|
|
48
|
+
color: theme.palette.text.secondary,
|
|
49
|
+
borderTopRightRadius: "12px",
|
|
50
|
+
borderTopLeftRadius: "12px",
|
|
51
|
+
backgroundColor: theme.palette.surface.defaultBackground,
|
|
52
|
+
position: "relative",
|
|
53
|
+
|
|
54
|
+
"&.active": {
|
|
55
|
+
fontWeight: 600,
|
|
56
|
+
color: theme.palette.text.primary,
|
|
57
|
+
backgroundColor: theme.palette.surface.paperBackground,
|
|
58
|
+
"&::after": {
|
|
59
|
+
content: '""',
|
|
60
|
+
position: "absolute",
|
|
61
|
+
bottom: 0,
|
|
62
|
+
left: "25%",
|
|
63
|
+
width: "50%",
|
|
64
|
+
borderBottom: `4px solid ${theme.palette.tertiary.main}`,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
}));
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Box, Stack, useTheme } from "@mui/material";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { ErrorBoundary } from "react-error-boundary";
|
|
4
|
+
import { Outlet } from "react-router-dom";
|
|
5
|
+
import { Tab } from "./Tabs";
|
|
6
|
+
|
|
7
|
+
interface TabsLayoutProps {
|
|
8
|
+
menu: MenuItem[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface MenuItem {
|
|
12
|
+
title: string;
|
|
13
|
+
path: string;
|
|
14
|
+
permissionKey?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const TabsLayout = ({ menu }: TabsLayoutProps) => {
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
const [activeTab, setActiveTab] = useState<number | null>(null);
|
|
20
|
+
const handleTabChange = (index: number) => {
|
|
21
|
+
setActiveTab(index);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Stack>
|
|
26
|
+
<Stack
|
|
27
|
+
direction={"row"}
|
|
28
|
+
sx={{
|
|
29
|
+
backgroundColor: theme.palette.surface.defaultBackground,
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
{menu?.map((item, index) => {
|
|
33
|
+
return (
|
|
34
|
+
<Tab
|
|
35
|
+
key={index}
|
|
36
|
+
index={index}
|
|
37
|
+
path={item?.path}
|
|
38
|
+
title={item?.title}
|
|
39
|
+
handleTabChange={handleTabChange}
|
|
40
|
+
isActiveTab={index === activeTab}
|
|
41
|
+
isPrevTab={activeTab !== null && index === activeTab - 1}
|
|
42
|
+
isLastTab={index === menu?.length - 1}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
})}
|
|
46
|
+
</Stack>
|
|
47
|
+
<ErrorBoundary
|
|
48
|
+
fallbackRender={(error: any) => (
|
|
49
|
+
<Box>Error: {error?.response?.data?.message ?? error?.message}</Box>
|
|
50
|
+
)}
|
|
51
|
+
>
|
|
52
|
+
<Outlet />
|
|
53
|
+
</ErrorBoundary>
|
|
54
|
+
</Stack>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Link,
|
|
3
|
+
Breadcrumbs as MuiBreadcrumbs,
|
|
4
|
+
Stack,
|
|
5
|
+
styled,
|
|
6
|
+
} from "@mui/material";
|
|
7
|
+
import { ReactNode } from "react";
|
|
8
|
+
import { Typography } from "../../DataDisplay/Typography/Typography";
|
|
9
|
+
|
|
10
|
+
interface BreadcrumbsProps {
|
|
11
|
+
links: {
|
|
12
|
+
name: string | ReactNode;
|
|
13
|
+
to: string;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Breadcrumbs = ({ links }: BreadcrumbsProps) => {
|
|
18
|
+
const linksArray = links?.slice(0, -1);
|
|
19
|
+
const currentPage = links?.slice(-1)[0];
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Stack direction={"row"} alignItems={"center"}>
|
|
23
|
+
<MuiBreadcrumbs>
|
|
24
|
+
{linksArray?.map((item, index) => (
|
|
25
|
+
<StyledLink key={index} href={item?.to}>
|
|
26
|
+
{item?.name}
|
|
27
|
+
</StyledLink>
|
|
28
|
+
))}
|
|
29
|
+
<Typography variant="subtitle2">{currentPage?.name}</Typography>
|
|
30
|
+
</MuiBreadcrumbs>
|
|
31
|
+
</Stack>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const StyledLink = styled(Link)(({ theme }) => ({
|
|
36
|
+
transition: "color 0.3s ease-in-out",
|
|
37
|
+
"&:hover": {
|
|
38
|
+
color: theme.palette.primary.light,
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
@@ -50,7 +50,7 @@ export const createSidebarStyles = (collapsed: boolean) => {
|
|
|
50
50
|
const StyledListItem = styled(ListItem)<StyledListItemProps>(
|
|
51
51
|
({ theme, match }) => ({
|
|
52
52
|
backgroundColor: match ? theme.palette.secondary.main : "none",
|
|
53
|
-
width: "auto",
|
|
53
|
+
width: collapsed ? "min-content" : "auto",
|
|
54
54
|
margin: "5px 8px",
|
|
55
55
|
borderRadius: "4px",
|
|
56
56
|
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Stepper as MuiStepper,
|
|
4
|
+
Step,
|
|
5
|
+
StepLabel,
|
|
6
|
+
SxProps,
|
|
7
|
+
Typography,
|
|
8
|
+
} from "@mui/material";
|
|
9
|
+
import { Connector, StepIcon, StyledStepContent } from "./StepperComponents";
|
|
10
|
+
|
|
11
|
+
interface StepperProps {
|
|
12
|
+
orientation: "vertical" | "horizontal";
|
|
13
|
+
activeStep: number;
|
|
14
|
+
steps: StepItem[];
|
|
15
|
+
containerSx: SxProps;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface StepItem {
|
|
19
|
+
label: string;
|
|
20
|
+
description: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const Stepper = ({
|
|
24
|
+
orientation,
|
|
25
|
+
steps,
|
|
26
|
+
activeStep = 0,
|
|
27
|
+
containerSx,
|
|
28
|
+
}: StepperProps) => {
|
|
29
|
+
const isVertical = orientation === "vertical";
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Box
|
|
33
|
+
sx={{
|
|
34
|
+
...(isVertical ? { maxWidth: "300px" } : {}),
|
|
35
|
+
...containerSx,
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<MuiStepper
|
|
39
|
+
activeStep={activeStep}
|
|
40
|
+
orientation={orientation}
|
|
41
|
+
alternativeLabel={!isVertical}
|
|
42
|
+
connector={<Connector isVertical={isVertical} />}
|
|
43
|
+
>
|
|
44
|
+
{steps?.map((item, index) => (
|
|
45
|
+
<Step key={index} expanded>
|
|
46
|
+
<StepLabel StepIconComponent={StepIcon}>{item?.label}</StepLabel>
|
|
47
|
+
<StyledStepContent
|
|
48
|
+
isVertical={isVertical}
|
|
49
|
+
activeStep={index < activeStep}
|
|
50
|
+
isLastStep={index === steps?.length - 1}
|
|
51
|
+
>
|
|
52
|
+
<Typography variant="label2">{item?.description}</Typography>
|
|
53
|
+
</StyledStepContent>
|
|
54
|
+
</Step>
|
|
55
|
+
))}
|
|
56
|
+
</MuiStepper>
|
|
57
|
+
</Box>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StepConnector,
|
|
3
|
+
stepConnectorClasses,
|
|
4
|
+
StepContent,
|
|
5
|
+
StepIconProps,
|
|
6
|
+
styled,
|
|
7
|
+
} from "@mui/material";
|
|
8
|
+
import { CheckedRadioIcon } from "../../Assets/Icons/IconComponents/CheckedRadioIcon";
|
|
9
|
+
import { CompletedStateIcon } from "../../Assets/Icons/IconComponents/CompletedStateIcon";
|
|
10
|
+
import { UnCheckedRadioIcon } from "../../Assets/Icons/IconComponents/UncheckedRadioIcon";
|
|
11
|
+
|
|
12
|
+
interface StepContentProps {
|
|
13
|
+
isVertical: boolean;
|
|
14
|
+
activeStep: boolean;
|
|
15
|
+
isLastStep: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const StyledStepContent = styled(StepContent)<StepContentProps>(
|
|
19
|
+
({ theme, isVertical, activeStep, isLastStep }) => ({
|
|
20
|
+
...(isVertical &&
|
|
21
|
+
activeStep &&
|
|
22
|
+
!isLastStep && {
|
|
23
|
+
borderLeft: `2px solid ${theme.palette.primary.light}`,
|
|
24
|
+
}),
|
|
25
|
+
...(!isVertical && {
|
|
26
|
+
borderLeft: "none",
|
|
27
|
+
paddingLeft: "20px",
|
|
28
|
+
margin: "20px 0px 0px 20px",
|
|
29
|
+
}),
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
interface ConnectorProps {
|
|
34
|
+
isVertical: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const Connector = styled(StepConnector)<ConnectorProps>(
|
|
38
|
+
({ theme, isVertical }) => ({
|
|
39
|
+
[`&.${stepConnectorClasses.active}`]: {
|
|
40
|
+
[`& .${stepConnectorClasses.line}`]: {
|
|
41
|
+
[isVertical ? "borderLeft" : "border"]:
|
|
42
|
+
`2px solid ${theme.palette.primary.light}`,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
[`&.${stepConnectorClasses.completed}`]: {
|
|
46
|
+
[`& .${stepConnectorClasses.line}`]: {
|
|
47
|
+
[isVertical ? "borderLeft" : "border"]:
|
|
48
|
+
`2px solid ${theme.palette.primary.light}`,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export function StepIcon(props: StepIconProps) {
|
|
55
|
+
const { active, completed, className } = props;
|
|
56
|
+
|
|
57
|
+
const getIcon = () => {
|
|
58
|
+
if (completed) return <CompletedStateIcon />;
|
|
59
|
+
if (active) return <CheckedRadioIcon />;
|
|
60
|
+
return <UnCheckedRadioIcon />;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return <StepIconRoot className={className}>{getIcon()}</StepIconRoot>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const StepIconRoot = styled("div")<{}>(({ theme }) => ({
|
|
67
|
+
width: 20,
|
|
68
|
+
height: 20,
|
|
69
|
+
display: "flex",
|
|
70
|
+
justifyContent: "center",
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
}));
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
import { Breadcrumbs } from "./Breadcrumbs/Breadcrumbs";
|
|
1
2
|
import { CustomDialog } from "./DialogButton/DialogButton";
|
|
2
3
|
import { DropDownButton } from "./DropDownMenu/DropDownButton";
|
|
3
4
|
import { DropDownIcon } from "./DropDownMenu/DropDownIcon";
|
|
4
5
|
import { DropdownMenu } from "./DropDownMenu/DropDownMenu";
|
|
5
6
|
import { DropdownMenuItem } from "./DropDownMenu/DropdownMenuItem";
|
|
6
7
|
import { Sidebar } from "./Sidebar/Sidebar";
|
|
8
|
+
import { Stepper } from "./Stepper/Stepper";
|
|
7
9
|
import { TabsContainer } from "./TabsContainer/TabsContainer";
|
|
8
10
|
|
|
9
11
|
export {
|
|
12
|
+
Breadcrumbs,
|
|
10
13
|
CustomDialog,
|
|
11
14
|
DropDownButton,
|
|
12
15
|
DropDownIcon,
|
|
13
16
|
DropdownMenu,
|
|
14
17
|
DropdownMenuItem,
|
|
15
18
|
Sidebar,
|
|
19
|
+
Stepper,
|
|
16
20
|
TabsContainer,
|
|
17
21
|
};
|
package/src/components/export.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./Assets/export";
|
|
2
2
|
export * from "./DataDisplay/export";
|
|
3
3
|
export * from "./Input/export";
|
|
4
|
-
export * from "./Layout/AppHeader/AppHeader";
|
|
5
4
|
|
|
6
5
|
export * from "./Feedback/exports";
|
|
6
|
+
export * from "./Layout/exports";
|
|
7
7
|
export * from "./Navigation/exports";
|