@campxdev/react-blueprint 1.1.5 → 1.1.7
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/.prettierrc +8 -0
- package/package.json +4 -1
- package/src/App.tsx +26 -10
- package/src/components/Assets/Icons/IconComponents/AcademicIcon.tsx +41 -0
- package/src/components/Assets/Icons/IconComponents/AccordionArrow.tsx +23 -0
- package/src/components/Assets/Icons/IconComponents/DeleteIcon.tsx +58 -0
- package/src/components/Assets/Icons/IconComponents/EditIcon.tsx +43 -0
- package/src/components/Assets/Icons/IconComponents/NoteIcon.tsx +41 -0
- package/src/components/Assets/Icons/IconComponents/RedirectIcon.tsx +36 -0
- package/src/components/Assets/Icons/IconComponents/ViewIcon.tsx +34 -0
- package/src/components/Assets/Icons/Icons.tsx +68 -55
- package/src/components/Charts/BarChart/BarChart.tsx +33 -9
- package/src/components/Charts/LineChart/LineChart.tsx +10 -4
- package/src/components/Charts/PieChart/PieChart.tsx +3 -2
- package/src/components/Charts/TreeMap/TreeMap.tsx +1 -0
- package/src/components/Charts/export.ts +4 -0
- package/src/components/Charts/types/types.ts +12 -2
- package/src/components/DataDisplay/Accordion/Accordion.tsx +42 -46
- package/src/components/DataDisplay/AccordionGroup/AccordionGroup.tsx +30 -0
- package/src/components/DataDisplay/Avatar/Avatar.tsx +18 -29
- package/src/components/DataDisplay/Card/Card.tsx +29 -8
- package/src/components/DataDisplay/Chips/Chips.tsx +91 -0
- package/src/components/DataDisplay/DataTable/DataTable.tsx +14 -6
- package/src/components/DataDisplay/export.ts +6 -5
- package/src/components/DataDisplay/styles.tsx +2 -3
- package/src/components/Feedback/Snackbar/Snackbar.tsx +6 -5
- package/src/components/Input/DatePicker/DatePicker.tsx +58 -0
- package/src/components/Input/FormActions/FormActions.tsx +49 -0
- package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +70 -0
- package/src/components/Input/IconButtons/IconButtons/DeleteButton.tsx +10 -0
- package/src/components/Input/IconButtons/IconButtons/EditButton.tsx +10 -0
- package/src/components/Input/IconButtons/IconButtons/RedirectButton.tsx +10 -0
- package/src/components/Input/IconButtons/IconButtons/ViewButton.tsx +10 -0
- package/src/components/Input/IconButtons/IconButtons.tsx +11 -0
- package/src/components/Input/LabelWrapper/LabelWrapper.tsx +1 -1
- package/src/components/Input/SingleSelect/SingleSelect.tsx +43 -54
- package/src/components/Input/{Chips/Chips.tsx → Tags/Tags.tsx} +14 -14
- package/src/components/Input/TimePicker/TimePicker.tsx +39 -0
- package/src/components/Input/export.ts +13 -8
- package/src/components/Layout/PageContent/PageContent.tsx +16 -0
- package/src/components/Layout/PageHeader/PageHeader.tsx +46 -0
- package/src/components/Navigation/DropDownMenu/DropDownButton.tsx +5 -5
- package/src/components/Navigation/Sidebar/Components.tsx +97 -0
- package/src/components/Navigation/Sidebar/MenuItem.tsx +76 -104
- package/src/components/Navigation/Sidebar/Sidebar.tsx +150 -55
- package/src/components/Navigation/Sidebar/SubMenuItem.tsx +34 -0
- package/src/components/Navigation/Sidebar/interfaces.ts +35 -12
- package/src/components/Navigation/Sidebar/styles.tsx +2 -2
- package/src/components/Navigation/exports.ts +2 -0
- package/src/components/export.ts +1 -1
- package/src/stories/DataDisplay/AccordionGroup.stories.tsx +131 -0
- package/src/stories/DataDisplay/Chips.stories.tsx +77 -0
- package/src/stories/Input/DatePicker.stories.tsx +138 -0
- package/src/stories/Input/IconButtons.stories.tsx +30 -0
- package/src/stories/Input/{Chips.stories.tsx → Tags.stories.tsx} +17 -17
- package/src/stories/Input/TimePicker.stories.tsx +123 -0
- package/src/themes/commonTheme.ts +171 -155
- package/src/components/DataDisplay/Accordion/utils/StandardImageList.tsx +0 -70
- package/src/components/Navigation/Sidebar/DropdownItem.tsx +0 -34
- package/src/stories/DataDisplay/Accordion.stories.tsx +0 -62
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "recharts";
|
|
12
12
|
import {
|
|
13
13
|
AxisLabelProps,
|
|
14
|
+
BaseAxisProps,
|
|
14
15
|
CartesianGridProps,
|
|
15
16
|
LegendProps,
|
|
16
17
|
MarginProps,
|
|
@@ -26,12 +27,14 @@ export type BarChartProps = {
|
|
|
26
27
|
dataKey: string;
|
|
27
28
|
data: any[];
|
|
28
29
|
bars: BarItem[];
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
domain?: any[];
|
|
31
|
+
barGap?: number | string;
|
|
32
|
+
barSize?: number | string;
|
|
31
33
|
showToolTip?: boolean;
|
|
32
34
|
showLegend?: boolean;
|
|
33
35
|
cartesianGrid?: CartesianGridProps;
|
|
34
36
|
axisLabelProps?: AxisLabelProps;
|
|
37
|
+
baseAxisProps?: BaseAxisProps;
|
|
35
38
|
legendSx?: LegendProps;
|
|
36
39
|
containerSx?: SxProps;
|
|
37
40
|
margin?: MarginProps;
|
|
@@ -51,12 +54,14 @@ export const BarChart = ({
|
|
|
51
54
|
margin,
|
|
52
55
|
layout = "horizontal",
|
|
53
56
|
dataKey,
|
|
57
|
+
domain = [0, "auto"],
|
|
54
58
|
data,
|
|
55
59
|
bars,
|
|
56
60
|
barGap = 10,
|
|
57
61
|
barSize = 20,
|
|
58
62
|
showToolTip = true,
|
|
59
63
|
showLegend = true,
|
|
64
|
+
baseAxisProps,
|
|
60
65
|
cartesianGrid = { showCartesianGrid: false },
|
|
61
66
|
axisLabelProps,
|
|
62
67
|
legendSx,
|
|
@@ -68,7 +73,7 @@ export const BarChart = ({
|
|
|
68
73
|
const theme = useTheme();
|
|
69
74
|
|
|
70
75
|
return (
|
|
71
|
-
<Stack alignItems={"center"} sx={{ ...containerSx }}>
|
|
76
|
+
<Stack alignItems={"center"} sx={{ ...containerSx }} width={"fit-content"}>
|
|
72
77
|
<Typography variant={"h5"} align={"center"} sx={{ ...titleSx }}>
|
|
73
78
|
{title}
|
|
74
79
|
</Typography>
|
|
@@ -86,12 +91,14 @@ export const BarChart = ({
|
|
|
86
91
|
)}
|
|
87
92
|
{showToolTip && (
|
|
88
93
|
<Tooltip
|
|
94
|
+
cursor={{ fill: theme.palette.secondary.light, fillOpacity: "50%" }}
|
|
89
95
|
itemStyle={{
|
|
90
|
-
color: theme.palette.text.
|
|
96
|
+
color: theme.palette.text.secondary,
|
|
91
97
|
}}
|
|
92
98
|
contentStyle={{
|
|
93
|
-
color: theme.palette.text.
|
|
99
|
+
color: theme.palette.text.primary,
|
|
94
100
|
backgroundColor: theme.palette.background.paper,
|
|
101
|
+
borderColor: theme.palette.border.primary,
|
|
95
102
|
borderRadius: "5px",
|
|
96
103
|
padding: "5px 10px",
|
|
97
104
|
}}
|
|
@@ -106,7 +113,10 @@ export const BarChart = ({
|
|
|
106
113
|
<XAxis
|
|
107
114
|
type="category"
|
|
108
115
|
dataKey={dataKey}
|
|
109
|
-
stroke={theme.palette.primary
|
|
116
|
+
stroke={theme.palette.border.primary}
|
|
117
|
+
tick={{ fill: theme.palette.text.tertiary }}
|
|
118
|
+
angle={baseAxisProps?.xAxis?.angle}
|
|
119
|
+
tickMargin={baseAxisProps?.xAxis?.tickMargin}
|
|
110
120
|
>
|
|
111
121
|
<Label
|
|
112
122
|
{...xLabel}
|
|
@@ -114,7 +124,13 @@ export const BarChart = ({
|
|
|
114
124
|
style={{ fill: theme.palette.text.primary }}
|
|
115
125
|
/>
|
|
116
126
|
</XAxis>
|
|
117
|
-
<YAxis
|
|
127
|
+
<YAxis
|
|
128
|
+
type="number"
|
|
129
|
+
stroke={theme.palette.border.primary}
|
|
130
|
+
tick={{ fill: theme.palette.text.tertiary }}
|
|
131
|
+
tickMargin={baseAxisProps?.yAxis?.tickMargin}
|
|
132
|
+
domain={domain}
|
|
133
|
+
>
|
|
118
134
|
{yLabel && (
|
|
119
135
|
<Label
|
|
120
136
|
offset={10}
|
|
@@ -129,7 +145,13 @@ export const BarChart = ({
|
|
|
129
145
|
</>
|
|
130
146
|
) : (
|
|
131
147
|
<>
|
|
132
|
-
<XAxis
|
|
148
|
+
<XAxis
|
|
149
|
+
type="number"
|
|
150
|
+
stroke={theme.palette.border.primary}
|
|
151
|
+
tick={{ fill: theme.palette.text.tertiary }}
|
|
152
|
+
angle={baseAxisProps?.xAxis?.angle}
|
|
153
|
+
tickMargin={baseAxisProps?.xAxis?.tickMargin}
|
|
154
|
+
>
|
|
133
155
|
<Label
|
|
134
156
|
{...xLabel}
|
|
135
157
|
dy={xLabel?.dy}
|
|
@@ -139,7 +161,9 @@ export const BarChart = ({
|
|
|
139
161
|
<YAxis
|
|
140
162
|
dataKey={dataKey}
|
|
141
163
|
type="category"
|
|
142
|
-
stroke={theme.palette.primary
|
|
164
|
+
stroke={theme.palette.border.primary}
|
|
165
|
+
tick={{ fill: theme.palette.text.tertiary }}
|
|
166
|
+
tickMargin={baseAxisProps?.yAxis?.tickMargin}
|
|
143
167
|
>
|
|
144
168
|
{yLabel && (
|
|
145
169
|
<Label
|
|
@@ -74,11 +74,12 @@ export const LineChart = ({
|
|
|
74
74
|
{showToolTip && (
|
|
75
75
|
<Tooltip
|
|
76
76
|
itemStyle={{
|
|
77
|
-
color: theme.palette.text.
|
|
77
|
+
color: theme.palette.text.secondary,
|
|
78
78
|
}}
|
|
79
79
|
contentStyle={{
|
|
80
|
-
color: theme.palette.text.
|
|
80
|
+
color: theme.palette.text.primary,
|
|
81
81
|
backgroundColor: theme.palette.background.paper,
|
|
82
|
+
borderColor: theme.palette.border.primary,
|
|
82
83
|
borderRadius: "5px",
|
|
83
84
|
padding: "5px 10px",
|
|
84
85
|
}}
|
|
@@ -90,7 +91,8 @@ export const LineChart = ({
|
|
|
90
91
|
padding={"gap"}
|
|
91
92
|
type="category"
|
|
92
93
|
dataKey={dataKey}
|
|
93
|
-
stroke={theme.palette.primary
|
|
94
|
+
stroke={theme.palette.border.primary}
|
|
95
|
+
tick={{ fill: theme.palette.text.tertiary }}
|
|
94
96
|
>
|
|
95
97
|
<Label
|
|
96
98
|
{...xLabel}
|
|
@@ -98,7 +100,11 @@ export const LineChart = ({
|
|
|
98
100
|
style={{ fill: theme.palette.text.primary }}
|
|
99
101
|
/>
|
|
100
102
|
</XAxis>
|
|
101
|
-
<YAxis
|
|
103
|
+
<YAxis
|
|
104
|
+
type="number"
|
|
105
|
+
stroke={theme.palette.border.primary}
|
|
106
|
+
tick={{ fill: theme.palette.text.tertiary }}
|
|
107
|
+
>
|
|
102
108
|
{yLabel && (
|
|
103
109
|
<Label
|
|
104
110
|
offset={10}
|
|
@@ -52,11 +52,12 @@ export const PieChart = ({
|
|
|
52
52
|
{showToolTip && (
|
|
53
53
|
<Tooltip
|
|
54
54
|
itemStyle={{
|
|
55
|
-
color: theme.palette.text.
|
|
55
|
+
color: theme.palette.text.secondary,
|
|
56
56
|
}}
|
|
57
57
|
contentStyle={{
|
|
58
|
-
color: theme.palette.text.
|
|
58
|
+
color: theme.palette.text.primary,
|
|
59
59
|
backgroundColor: theme.palette.background.paper,
|
|
60
|
+
borderColor: theme.palette.border.primary,
|
|
60
61
|
borderRadius: "5px",
|
|
61
62
|
padding: "5px 10px",
|
|
62
63
|
}}
|
|
@@ -146,6 +146,7 @@ const CustomTooltip = ({ active, payload }: any) => {
|
|
|
146
146
|
|
|
147
147
|
export const StyledContainer = styled(Box)(({ theme }) => ({
|
|
148
148
|
backgroundColor: theme.palette.background.paper,
|
|
149
|
+
borderColor: theme.palette.border.primary,
|
|
149
150
|
borderRadius: "5px",
|
|
150
151
|
padding: "5px 10px",
|
|
151
152
|
}));
|
|
@@ -30,6 +30,16 @@ export type LabelProps = {
|
|
|
30
30
|
angle?: number;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
export type BaseAxisProps = {
|
|
34
|
+
xAxis?: TickProps;
|
|
35
|
+
yAxis?: TickProps;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type TickProps = {
|
|
39
|
+
angle?: number;
|
|
40
|
+
tickMargin?: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
33
43
|
export type LegendProps = {
|
|
34
44
|
width?: number;
|
|
35
45
|
height?: number;
|
|
@@ -38,6 +48,6 @@ export type LegendProps = {
|
|
|
38
48
|
verticalAlign?: VerticalAlignmentType;
|
|
39
49
|
iconSize?: number;
|
|
40
50
|
iconType?: IconType;
|
|
41
|
-
margin
|
|
42
|
-
className
|
|
51
|
+
margin?: MarginProps;
|
|
52
|
+
className?: string;
|
|
43
53
|
};
|
|
@@ -1,55 +1,51 @@
|
|
|
1
|
-
import { ExpandMore } from "@mui/icons-material";
|
|
2
1
|
import {
|
|
3
|
-
AccordionDetails,
|
|
4
2
|
Box,
|
|
5
3
|
Accordion as MuiAccordion,
|
|
4
|
+
AccordionDetails as MuiAccordionDetails,
|
|
5
|
+
AccordionProps as MuiAccordionProps,
|
|
6
6
|
AccordionSummary as MuiAccordionSummary,
|
|
7
|
-
|
|
8
|
-
} from
|
|
9
|
-
import { ReactNode
|
|
10
|
-
import { Typography } from
|
|
7
|
+
Stack,
|
|
8
|
+
} from '@mui/material';
|
|
9
|
+
import { ReactNode } from 'react';
|
|
10
|
+
import { Icons, Typography } from '../../export';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
};
|
|
12
|
+
export type AccordionProps = {
|
|
13
|
+
title: ReactNode;
|
|
14
|
+
content: ReactNode;
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
index?: number;
|
|
17
|
+
expanded?: boolean | number;
|
|
18
|
+
} & Omit<
|
|
19
|
+
MuiAccordionProps,
|
|
20
|
+
'children' | 'content' | 'title' | 'index' | 'expanded' | 'actions'
|
|
21
|
+
>;
|
|
28
22
|
|
|
23
|
+
export const Accordion = (props: AccordionProps) => {
|
|
24
|
+
const { index, expanded, title, content, actions, onChange, ...restProps } =
|
|
25
|
+
props;
|
|
29
26
|
return (
|
|
30
|
-
<
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
</Box>
|
|
27
|
+
<MuiAccordion
|
|
28
|
+
key={index}
|
|
29
|
+
expanded={typeof expanded == 'number' ? expanded === index : expanded}
|
|
30
|
+
{...restProps}
|
|
31
|
+
>
|
|
32
|
+
<Stack direction="row" justifyContent="space-between" alignItems="center">
|
|
33
|
+
<MuiAccordionSummary expandIcon={<Icons.AccordionArrow />}>
|
|
34
|
+
{typeof title === 'string' ? (
|
|
35
|
+
<Typography variant="subtitle2">{title}</Typography>
|
|
36
|
+
) : (
|
|
37
|
+
title
|
|
38
|
+
)}
|
|
39
|
+
</MuiAccordionSummary>
|
|
40
|
+
<Box>{actions}</Box>
|
|
41
|
+
</Stack>
|
|
42
|
+
<MuiAccordionDetails>
|
|
43
|
+
{typeof content === 'string' ? (
|
|
44
|
+
<Typography variant="label1">{content}</Typography>
|
|
45
|
+
) : (
|
|
46
|
+
content
|
|
47
|
+
)}
|
|
48
|
+
</MuiAccordionDetails>
|
|
49
|
+
</MuiAccordion>
|
|
54
50
|
);
|
|
55
51
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Box, SxProps } from '@mui/material';
|
|
2
|
+
import { SyntheticEvent, useState } from 'react';
|
|
3
|
+
import { Accordion, AccordionProps } from '../Accordion/Accordion';
|
|
4
|
+
|
|
5
|
+
type AccordionGroupProps = {
|
|
6
|
+
data: AccordionProps[];
|
|
7
|
+
containerSx?: SxProps;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const AccordionGroup = ({ data, containerSx }: AccordionGroupProps) => {
|
|
11
|
+
const [expanded, setExpanded] = useState<number | false>(false);
|
|
12
|
+
|
|
13
|
+
const handleChange =
|
|
14
|
+
(panel: number) => (event: SyntheticEvent, isExpanded: boolean) => {
|
|
15
|
+
setExpanded(isExpanded ? panel : false);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Box sx={{ ...containerSx }}>
|
|
20
|
+
{data?.map((itemProps, index) => (
|
|
21
|
+
<Accordion
|
|
22
|
+
{...itemProps}
|
|
23
|
+
expanded={expanded}
|
|
24
|
+
index={index}
|
|
25
|
+
onChange={handleChange(index)}
|
|
26
|
+
/>
|
|
27
|
+
))}
|
|
28
|
+
</Box>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
AvatarProps as MuiAvatarProps,
|
|
4
|
-
styled,
|
|
5
|
-
useTheme,
|
|
6
|
-
} from "@mui/material";
|
|
7
|
-
import { Typography } from "../Typography/Typography";
|
|
1
|
+
import { Avatar as MuiAvatar, AvatarProps as MuiAvatarProps, styled, useTheme } from '@mui/material';
|
|
2
|
+
import { Typography } from '../Typography/Typography';
|
|
8
3
|
|
|
9
4
|
export type CircularAvatarProps = {
|
|
10
5
|
text: string;
|
|
11
|
-
} & Omit<MuiAvatarProps,
|
|
6
|
+
} & Omit<MuiAvatarProps, 'sx'>;
|
|
12
7
|
|
|
13
8
|
export const CircularAvatar = ({ text, ...rest }: CircularAvatarProps) => {
|
|
14
9
|
const stringAvatar = (text: string) => {
|
|
15
|
-
if (!text) return
|
|
10
|
+
if (!text) return '';
|
|
16
11
|
return text
|
|
17
|
-
.split(
|
|
12
|
+
.split(' ')
|
|
18
13
|
?.map((w) => w[0])
|
|
19
|
-
?.join(
|
|
14
|
+
?.join('')
|
|
20
15
|
.toUpperCase();
|
|
21
16
|
};
|
|
22
17
|
const theme = useTheme();
|
|
23
18
|
|
|
24
19
|
const StyledCircularAvatar = styled(MuiAvatar)(({ theme }) => ({
|
|
25
|
-
height:
|
|
26
|
-
width:
|
|
20
|
+
height: '42px',
|
|
21
|
+
width: '42px',
|
|
27
22
|
}));
|
|
28
23
|
|
|
29
24
|
return (
|
|
@@ -36,35 +31,29 @@ export const CircularAvatar = ({ text, ...rest }: CircularAvatarProps) => {
|
|
|
36
31
|
export type SquareAvatarProps = {
|
|
37
32
|
text: string;
|
|
38
33
|
onlyStartLetters: boolean;
|
|
39
|
-
} & Omit<MuiAvatarProps,
|
|
34
|
+
} & Omit<MuiAvatarProps, 'sx'>;
|
|
40
35
|
|
|
41
|
-
export const SquareAvatar = ({
|
|
42
|
-
onlyStartLetters = false,
|
|
43
|
-
text,
|
|
44
|
-
...rest
|
|
45
|
-
}: SquareAvatarProps) => {
|
|
36
|
+
export const SquareAvatar = ({ onlyStartLetters = false, text, ...rest }: SquareAvatarProps) => {
|
|
46
37
|
const stringAvatar = (text: string) => {
|
|
47
|
-
if (!text) return
|
|
38
|
+
if (!text) return '';
|
|
48
39
|
return text
|
|
49
|
-
.split(
|
|
40
|
+
.split(' ')
|
|
50
41
|
?.map((w) => w[0])
|
|
51
|
-
?.join(
|
|
42
|
+
?.join('')
|
|
52
43
|
.toUpperCase();
|
|
53
44
|
};
|
|
54
45
|
|
|
55
46
|
const StyledSquareAvatar = styled(MuiAvatar)(({ theme }) => ({
|
|
56
|
-
height:
|
|
57
|
-
width:
|
|
47
|
+
height: '150px',
|
|
48
|
+
width: '210px',
|
|
58
49
|
backgroundColor: theme.palette.secondary.dark,
|
|
59
|
-
borderRadius:
|
|
60
|
-
border:
|
|
50
|
+
borderRadius: '5px',
|
|
51
|
+
border: 'none',
|
|
61
52
|
}));
|
|
62
53
|
|
|
63
54
|
return (
|
|
64
55
|
<StyledSquareAvatar variant="square" {...rest}>
|
|
65
|
-
<Typography variant="h6">
|
|
66
|
-
{onlyStartLetters ? stringAvatar(text) : text}
|
|
67
|
-
</Typography>
|
|
56
|
+
<Typography variant="h6">{onlyStartLetters ? stringAvatar(text) : text}</Typography>
|
|
68
57
|
</StyledSquareAvatar>
|
|
69
58
|
);
|
|
70
59
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { ChevronRight, MoreHoriz } from "@mui/icons-material";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
CardContent,
|
|
4
5
|
Checkbox,
|
|
5
|
-
Stack,
|
|
6
|
-
Typography,
|
|
7
6
|
Card as MuiCard,
|
|
7
|
+
Stack,
|
|
8
8
|
SxProps,
|
|
9
|
-
|
|
9
|
+
Typography,
|
|
10
10
|
} from "@mui/material";
|
|
11
|
+
import { Variant } from "@mui/material/styles/createTypography";
|
|
11
12
|
import { ReactNode } from "react";
|
|
13
|
+
import { DropDownIcon, DropdownMenu } from "../../export";
|
|
12
14
|
import {
|
|
13
15
|
StyledButton,
|
|
14
16
|
StyledCardActions,
|
|
@@ -19,7 +21,6 @@ import {
|
|
|
19
21
|
StyledStack,
|
|
20
22
|
StyledStatusText,
|
|
21
23
|
} from "./styles";
|
|
22
|
-
import { DropDownIcon, DropdownMenu } from "../../export";
|
|
23
24
|
|
|
24
25
|
export interface CardProps {
|
|
25
26
|
title: string;
|
|
@@ -34,14 +35,23 @@ export interface CardProps {
|
|
|
34
35
|
{
|
|
35
36
|
title: string;
|
|
36
37
|
value: string;
|
|
37
|
-
}
|
|
38
|
+
}
|
|
38
39
|
];
|
|
40
|
+
titleProps?: {
|
|
41
|
+
variant: Variant;
|
|
42
|
+
sx?: SxProps;
|
|
43
|
+
};
|
|
44
|
+
captionProps?: {
|
|
45
|
+
variant: Variant;
|
|
46
|
+
sx?: SxProps;
|
|
47
|
+
};
|
|
39
48
|
status?: string;
|
|
40
49
|
imageSrc?: string;
|
|
41
50
|
checkBox?: boolean;
|
|
42
51
|
moreOptions?: boolean;
|
|
43
52
|
menu?: Array<ReactNode>;
|
|
44
53
|
icon?: ReactNode;
|
|
54
|
+
headerSx?: SxProps;
|
|
45
55
|
statusSx?: SxProps;
|
|
46
56
|
cardSx?: SxProps;
|
|
47
57
|
}
|
|
@@ -56,7 +66,14 @@ export const Card = ({
|
|
|
56
66
|
checkBox,
|
|
57
67
|
statusSx,
|
|
58
68
|
cardSx,
|
|
69
|
+
headerSx,
|
|
59
70
|
moreOptions,
|
|
71
|
+
titleProps = {
|
|
72
|
+
variant: "subtitle2",
|
|
73
|
+
},
|
|
74
|
+
captionProps = {
|
|
75
|
+
variant: "caption",
|
|
76
|
+
},
|
|
60
77
|
icon,
|
|
61
78
|
menu = [],
|
|
62
79
|
}: CardProps) => {
|
|
@@ -67,7 +84,7 @@ export const Card = ({
|
|
|
67
84
|
return (
|
|
68
85
|
<MuiCard sx={cardSx}>
|
|
69
86
|
{imageSrc && <StyledImage src={imageSrc} alt="Card image" />}
|
|
70
|
-
<StyledHeader>
|
|
87
|
+
<StyledHeader sx={headerSx}>
|
|
71
88
|
<Stack gap={"8px"} flexDirection={"row"}>
|
|
72
89
|
{checkBox && (
|
|
73
90
|
<StyledStack>
|
|
@@ -76,8 +93,12 @@ export const Card = ({
|
|
|
76
93
|
)}
|
|
77
94
|
|
|
78
95
|
<Stack justifyContent={"center"}>
|
|
79
|
-
<Typography variant=
|
|
80
|
-
|
|
96
|
+
<Typography variant={titleProps.variant} sx={titleProps.sx}>
|
|
97
|
+
{title}
|
|
98
|
+
</Typography>
|
|
99
|
+
<Typography variant={captionProps.variant} sx={captionProps.sx}>
|
|
100
|
+
{caption}
|
|
101
|
+
</Typography>
|
|
81
102
|
</Stack>
|
|
82
103
|
</Stack>
|
|
83
104
|
<Stack flexDirection={"row"} gap={"12px"} alignItems={"center"}>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Chip, Stack, styled } from "@mui/material";
|
|
2
|
+
import { ReactNode, useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
interface ChipsProps {
|
|
5
|
+
list: { label: string | ReactNode; value: string | number }[];
|
|
6
|
+
selected: string[] | string | number;
|
|
7
|
+
onSelected: (selected: string[] | string | number) => void;
|
|
8
|
+
direction?: "row" | "column";
|
|
9
|
+
singleSelection?: boolean;
|
|
10
|
+
toggle?: boolean;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default function Chips({
|
|
14
|
+
list = [],
|
|
15
|
+
selected: _selected,
|
|
16
|
+
onSelected,
|
|
17
|
+
direction = "row",
|
|
18
|
+
singleSelection = true,
|
|
19
|
+
toggle = false,
|
|
20
|
+
}: ChipsProps) {
|
|
21
|
+
const [selected, setSelected] = useState<string | number | string[]>(
|
|
22
|
+
singleSelection ? "" : []
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setSelected(_selected);
|
|
27
|
+
}, [_selected]);
|
|
28
|
+
|
|
29
|
+
const handleChange = (value: string | number) => {
|
|
30
|
+
if (singleSelection) {
|
|
31
|
+
if (selected === value && !toggle) {
|
|
32
|
+
setSelected("");
|
|
33
|
+
onSelected("");
|
|
34
|
+
} else {
|
|
35
|
+
setSelected(value);
|
|
36
|
+
onSelected(value);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
if (Array.isArray(selected)) {
|
|
40
|
+
const valueStr = value.toString();
|
|
41
|
+
const selectedStr = selected.map((item) => item.toString());
|
|
42
|
+
|
|
43
|
+
if (selectedStr.includes(valueStr)) {
|
|
44
|
+
const newSelected = selected.filter(
|
|
45
|
+
(item) => item.toString() !== valueStr
|
|
46
|
+
);
|
|
47
|
+
setSelected(newSelected);
|
|
48
|
+
onSelected(newSelected);
|
|
49
|
+
} else {
|
|
50
|
+
const newSelected = [...selected, value.toString()];
|
|
51
|
+
setSelected(newSelected);
|
|
52
|
+
onSelected(newSelected);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const isSelected = (value: string | number) =>
|
|
59
|
+
singleSelection
|
|
60
|
+
? selected === value
|
|
61
|
+
: Array.isArray(selected) &&
|
|
62
|
+
selected.map((item) => item.toString()).includes(value.toString());
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Stack gap="8px" direction={direction} flexWrap="wrap">
|
|
66
|
+
{list.map((item, index) => (
|
|
67
|
+
<StyledChip
|
|
68
|
+
key={index}
|
|
69
|
+
color="primary"
|
|
70
|
+
label={item.label}
|
|
71
|
+
clickable
|
|
72
|
+
variant={isSelected(item.value) ? "outlined" : "filled"}
|
|
73
|
+
onClick={() => handleChange(item.value)}
|
|
74
|
+
/>
|
|
75
|
+
))}
|
|
76
|
+
</Stack>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const StyledChip = styled(Chip)(({ theme }) => ({
|
|
81
|
+
minWidth: "100px",
|
|
82
|
+
color: theme.palette.text.primary,
|
|
83
|
+
background: theme.palette.surface.grey,
|
|
84
|
+
"&.MuiButtonBase-root.MuiChip-filled": {
|
|
85
|
+
borderColor: theme.palette.primary.main,
|
|
86
|
+
},
|
|
87
|
+
height: "40px",
|
|
88
|
+
fontSize: "14px",
|
|
89
|
+
fontWeight: 500,
|
|
90
|
+
borderRadius: "20px",
|
|
91
|
+
}));
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from
|
|
5
|
-
import { DataGridContainer } from "../styles";
|
|
6
|
-
import { TablePagination } from "./TablePagination";
|
|
1
|
+
import { Stack, styled } from '@mui/material';
|
|
2
|
+
import { DataGrid as MuiDataGrid, DataGridProps as MuiDataGridProps } from '@mui/x-data-grid';
|
|
3
|
+
import { DataGridContainer } from '../styles';
|
|
4
|
+
import { TablePagination } from './TablePagination';
|
|
7
5
|
|
|
8
6
|
export type DataTableProps = {
|
|
9
7
|
limit?: number;
|
|
@@ -19,6 +17,9 @@ export const DataTable = (props: DataTableProps) => {
|
|
|
19
17
|
return (
|
|
20
18
|
<DataGridContainer>
|
|
21
19
|
<MuiDataGrid
|
|
20
|
+
disableColumnFilter
|
|
21
|
+
disableColumnMenu
|
|
22
|
+
disableColumnSorting
|
|
22
23
|
{...props}
|
|
23
24
|
slots={{
|
|
24
25
|
pagination: () => {
|
|
@@ -50,3 +51,10 @@ export const DataTable = (props: DataTableProps) => {
|
|
|
50
51
|
</DataGridContainer>
|
|
51
52
|
);
|
|
52
53
|
};
|
|
54
|
+
|
|
55
|
+
export const CellContainer = styled(Stack)(({ theme }) => ({
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
height: '100%',
|
|
59
|
+
flexDirection: 'row',
|
|
60
|
+
}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from './AccordionGroup/AccordionGroup';
|
|
2
|
+
export * from './Avatar/Avatar';
|
|
3
|
+
export * from './Card/Card';
|
|
4
|
+
export * from './Chips/Chips';
|
|
5
|
+
export * from './DataTable/DataTable';
|
|
6
|
+
export * from './Typography/Typography';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Box, styled } from
|
|
1
|
+
import { Box, styled } from '@mui/material';
|
|
2
2
|
|
|
3
3
|
export const DataGridContainer = styled(Box)(({ theme }) => ({
|
|
4
4
|
backgroundColor: theme.palette.background.paper,
|
|
5
|
-
|
|
6
|
-
margin: "10px",
|
|
5
|
+
margin: '10px',
|
|
7
6
|
}));
|