@campxdev/react-blueprint 1.2.0 → 1.2.2
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/src/components/Charts/BarChart/BarChart.tsx +10 -4
- package/src/components/Charts/LineChart/LineChart.tsx +10 -4
- package/src/components/Charts/PieChart/PieChart.tsx +10 -5
- package/src/components/Charts/TreeMap/TreeMap.tsx +10 -12
- package/src/components/Charts/types/types.ts +7 -1
- package/src/components/DataDisplay/Card/Card.tsx +4 -6
- package/src/components/DataDisplay/DataTable/DataTable.tsx +2 -0
- package/src/components/DataDisplay/DataTable/TablePagination.tsx +1 -1
- package/src/components/DataDisplay/SidePanel/SidePanel.tsx +73 -3
- package/src/components/DataDisplay/SidePanel/styles.tsx +33 -0
- package/src/components/DataDisplay/export.ts +1 -0
- package/src/components/Input/Button/Button.tsx +6 -2
- package/src/components/Navigation/ConfirmDialog/ConfirmDialog.tsx +9 -3
- package/src/components/Navigation/Sidebar/Sidebar.tsx +6 -3
- package/src/components/Navigation/UploadDialog/Styles.tsx +14 -12
- package/src/components/Navigation/UploadDialog/UploadDialogContainer.tsx +1 -1
- package/src/stories/DataDisplay/SidePanel.stories.tsx +57 -23
- package/src/stories/Navigation/ConfirmDialog.stories.tsx +8 -0
- package/src/themes/colorTokens/darkColorTokens.tsx +3 -0
- package/src/themes/colorTokens/lightColorTokens.ts +3 -0
- package/src/themes/commonTheme.ts +30 -27
- package/types/theme.d.ts +6 -3
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Stack, SxProps,
|
|
1
|
+
import { Stack, SxProps, useTheme } from '@mui/material';
|
|
2
2
|
import {
|
|
3
3
|
Bar,
|
|
4
4
|
CartesianGrid,
|
|
@@ -15,12 +15,14 @@ import {
|
|
|
15
15
|
CartesianGridProps,
|
|
16
16
|
LegendProps,
|
|
17
17
|
MarginProps,
|
|
18
|
+
TitleProps,
|
|
18
19
|
} from '../types/types';
|
|
19
20
|
import { LayoutType } from 'recharts/types/util/types';
|
|
21
|
+
import { Typography } from '../../export';
|
|
20
22
|
|
|
21
23
|
export type BarChartProps = {
|
|
22
24
|
title?: string;
|
|
23
|
-
|
|
25
|
+
titleProps?: TitleProps;
|
|
24
26
|
width?: number;
|
|
25
27
|
height?: number;
|
|
26
28
|
layout?: LayoutType;
|
|
@@ -48,7 +50,7 @@ type BarItem = {
|
|
|
48
50
|
|
|
49
51
|
export const BarChart = ({
|
|
50
52
|
title = 'Bar Chart',
|
|
51
|
-
|
|
53
|
+
titleProps = { variant: 'subtitle2' },
|
|
52
54
|
width = 700,
|
|
53
55
|
height = 500,
|
|
54
56
|
margin,
|
|
@@ -74,7 +76,11 @@ export const BarChart = ({
|
|
|
74
76
|
|
|
75
77
|
return (
|
|
76
78
|
<Stack alignItems={'center'} sx={{ ...containerSx }} width={'fit-content'}>
|
|
77
|
-
<Typography
|
|
79
|
+
<Typography
|
|
80
|
+
variant={titleProps.variant}
|
|
81
|
+
align={'center'}
|
|
82
|
+
sx={titleProps.sx}
|
|
83
|
+
>
|
|
78
84
|
{title}
|
|
79
85
|
</Typography>
|
|
80
86
|
<ReBarChart
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, Stack, SxProps,
|
|
1
|
+
import { Box, Stack, SxProps, useTheme } from '@mui/material';
|
|
2
2
|
import {
|
|
3
3
|
Bar,
|
|
4
4
|
CartesianGrid,
|
|
@@ -15,12 +15,14 @@ import {
|
|
|
15
15
|
CartesianGridProps,
|
|
16
16
|
LegendProps,
|
|
17
17
|
MarginProps,
|
|
18
|
+
TitleProps,
|
|
18
19
|
} from '../types/types';
|
|
19
20
|
import { CurveType } from 'recharts/types/shape/Curve';
|
|
21
|
+
import { Typography } from '../../export';
|
|
20
22
|
|
|
21
23
|
export type LineChartProps = {
|
|
22
24
|
title?: string;
|
|
23
|
-
|
|
25
|
+
titleProps?: TitleProps;
|
|
24
26
|
width?: number;
|
|
25
27
|
height?: number;
|
|
26
28
|
dataKey: string;
|
|
@@ -44,7 +46,7 @@ type LineItem = {
|
|
|
44
46
|
|
|
45
47
|
export const LineChart = ({
|
|
46
48
|
title = 'Line Chart',
|
|
47
|
-
|
|
49
|
+
titleProps = { variant: 'subtitle2' },
|
|
48
50
|
width = 700,
|
|
49
51
|
height = 500,
|
|
50
52
|
margin,
|
|
@@ -64,7 +66,11 @@ export const LineChart = ({
|
|
|
64
66
|
|
|
65
67
|
return (
|
|
66
68
|
<Stack alignItems={'center'} sx={containerSx}>
|
|
67
|
-
<Typography
|
|
69
|
+
<Typography
|
|
70
|
+
variant={titleProps.variant}
|
|
71
|
+
align={'center'}
|
|
72
|
+
sx={titleProps.sx}
|
|
73
|
+
>
|
|
68
74
|
{title}
|
|
69
75
|
</Typography>
|
|
70
76
|
<ReLineChart width={width} height={height} margin={margin} data={data}>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Stack, SxProps,
|
|
1
|
+
import { Stack, SxProps, useTheme } from '@mui/material';
|
|
2
2
|
import { Cell, Legend, Pie, PieChart as RePieChart, Tooltip } from 'recharts';
|
|
3
|
-
import { LegendProps, MarginProps } from '../types/types';
|
|
3
|
+
import { LegendProps, MarginProps, TitleProps } from '../types/types';
|
|
4
|
+
import { Typography } from '../../export';
|
|
4
5
|
|
|
5
6
|
export type PieChartProps = {
|
|
6
7
|
title?: string;
|
|
7
|
-
|
|
8
|
+
titleProps?: TitleProps;
|
|
8
9
|
margin?: MarginProps;
|
|
9
10
|
width?: number;
|
|
10
11
|
height?: number;
|
|
@@ -30,7 +31,7 @@ type PieProps = {
|
|
|
30
31
|
|
|
31
32
|
export const PieChart = ({
|
|
32
33
|
title = 'Pie Chart',
|
|
33
|
-
|
|
34
|
+
titleProps = { variant: 'subtitle2' },
|
|
34
35
|
margin,
|
|
35
36
|
width = 500,
|
|
36
37
|
height = 500,
|
|
@@ -45,7 +46,11 @@ export const PieChart = ({
|
|
|
45
46
|
|
|
46
47
|
return (
|
|
47
48
|
<Stack alignItems="center" sx={{ ...containerSx }}>
|
|
48
|
-
<Typography
|
|
49
|
+
<Typography
|
|
50
|
+
variant={titleProps.variant}
|
|
51
|
+
align={'center'}
|
|
52
|
+
sx={titleProps.sx}
|
|
53
|
+
>
|
|
49
54
|
{title}
|
|
50
55
|
</Typography>
|
|
51
56
|
<RePieChart width={width} height={height} margin={margin}>
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Box,
|
|
3
|
-
Stack,
|
|
4
|
-
styled,
|
|
5
|
-
SxProps,
|
|
6
|
-
Typography,
|
|
7
|
-
useTheme,
|
|
8
|
-
} from '@mui/material';
|
|
1
|
+
import { Box, Stack, styled, SxProps, useTheme } from '@mui/material';
|
|
9
2
|
import { Treemap as ReTreeMap, Tooltip } from 'recharts';
|
|
10
3
|
import { AnimationTiming } from 'recharts/types/util/types';
|
|
11
|
-
import { MarginProps } from '../types/types';
|
|
4
|
+
import { MarginProps, TitleProps } from '../types/types';
|
|
5
|
+
import { Typography } from '../../export';
|
|
12
6
|
|
|
13
7
|
interface TreeMapProps {
|
|
14
8
|
title?: string;
|
|
15
|
-
|
|
9
|
+
titleProps?: TitleProps;
|
|
16
10
|
data: any;
|
|
17
11
|
dataKey: string | number;
|
|
18
12
|
width?: number;
|
|
@@ -31,7 +25,7 @@ interface TreeMapProps {
|
|
|
31
25
|
|
|
32
26
|
const TreeMap = ({
|
|
33
27
|
title = 'Tree Map',
|
|
34
|
-
|
|
28
|
+
titleProps = { variant: 'subtitle2' },
|
|
35
29
|
data,
|
|
36
30
|
dataKey,
|
|
37
31
|
width = 400,
|
|
@@ -48,7 +42,11 @@ const TreeMap = ({
|
|
|
48
42
|
}: TreeMapProps) => {
|
|
49
43
|
return (
|
|
50
44
|
<Stack alignItems={'center'} sx={{ ...containerSx }}>
|
|
51
|
-
<Typography
|
|
45
|
+
<Typography
|
|
46
|
+
variant={titleProps.variant}
|
|
47
|
+
align={'center'}
|
|
48
|
+
sx={titleProps.sx}
|
|
49
|
+
>
|
|
52
50
|
{title}
|
|
53
51
|
</Typography>
|
|
54
52
|
<ReTreeMap
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Variant } from '@mui/material/styles/createTypography';
|
|
2
|
+
|
|
2
3
|
import {
|
|
3
4
|
HorizontalAlignmentType,
|
|
4
5
|
IconType,
|
|
@@ -16,6 +17,11 @@ export type AxisLabelProps = {
|
|
|
16
17
|
yLabel?: LabelProps;
|
|
17
18
|
};
|
|
18
19
|
|
|
20
|
+
export type TitleProps = {
|
|
21
|
+
variant?: Variant;
|
|
22
|
+
sx?: any;
|
|
23
|
+
};
|
|
24
|
+
|
|
19
25
|
export type MarginProps = {
|
|
20
26
|
top?: number;
|
|
21
27
|
right?: number;
|
|
@@ -31,12 +31,10 @@ export interface CardProps {
|
|
|
31
31
|
endIcon?: ReactNode;
|
|
32
32
|
buttonProps?: any;
|
|
33
33
|
};
|
|
34
|
-
fields?:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
];
|
|
34
|
+
fields?: {
|
|
35
|
+
title: string;
|
|
36
|
+
value: string;
|
|
37
|
+
}[];
|
|
40
38
|
titleProps?: {
|
|
41
39
|
variant: Variant;
|
|
42
40
|
sx?: SxProps;
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from '@mui/x-data-grid';
|
|
6
6
|
import { DataGridContainer } from '../styles';
|
|
7
7
|
import { TablePagination } from './TablePagination';
|
|
8
|
+
import { v4 } from 'uuid';
|
|
8
9
|
|
|
9
10
|
export type DataTableProps = {
|
|
10
11
|
limit?: number;
|
|
@@ -23,6 +24,7 @@ export const DataTable = (props: DataTableProps) => {
|
|
|
23
24
|
disableColumnFilter
|
|
24
25
|
disableColumnMenu
|
|
25
26
|
disableColumnSorting
|
|
27
|
+
getRowId={(row) => row.id ?? v4()}
|
|
26
28
|
{...props}
|
|
27
29
|
slots={{
|
|
28
30
|
pagination: () => {
|
|
@@ -35,7 +35,7 @@ export const TablePagination = (props: PaginationProps) => {
|
|
|
35
35
|
{...props}
|
|
36
36
|
variant="outlined"
|
|
37
37
|
shape="rounded"
|
|
38
|
-
onChange={(e, v) => onPageChange(Number(v) * limit)}
|
|
38
|
+
onChange={(e, v) => onPageChange((Number(v) - 1) * limit)}
|
|
39
39
|
/>
|
|
40
40
|
<DropdownMenu
|
|
41
41
|
anchor={({ open }) => (
|
|
@@ -1,9 +1,79 @@
|
|
|
1
|
+
import { SxProps, Typography } from '@mui/material';
|
|
1
2
|
import { ReactNode } from 'react';
|
|
3
|
+
import Image from '../../Image/Image';
|
|
4
|
+
import {
|
|
5
|
+
StyledSidePanelContainer,
|
|
6
|
+
StyledTextContainer,
|
|
7
|
+
StyledTypography,
|
|
8
|
+
StyledValueContainer,
|
|
9
|
+
} from './styles';
|
|
2
10
|
|
|
3
11
|
export interface SidePanelProps {
|
|
4
|
-
|
|
12
|
+
variables?: { label: string; value: string }[];
|
|
13
|
+
bottomChildren?: ReactNode;
|
|
14
|
+
containerSx?: SxProps;
|
|
15
|
+
variablesContainerSX?: SxProps;
|
|
16
|
+
imageUrl?: string;
|
|
17
|
+
imageWidth?: string;
|
|
18
|
+
imageHeight?: string;
|
|
19
|
+
title?: string;
|
|
5
20
|
}
|
|
21
|
+
interface variablesProps {
|
|
22
|
+
data?: { label: string; value: string }[];
|
|
23
|
+
variablesContainerSX?: SxProps;
|
|
24
|
+
}
|
|
25
|
+
export const SidePanelVariables = ({
|
|
26
|
+
data,
|
|
27
|
+
variablesContainerSX,
|
|
28
|
+
}: variablesProps) => {
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
{data?.map((item, index) => (
|
|
32
|
+
<>
|
|
33
|
+
<StyledValueContainer key={index} sx={variablesContainerSX}>
|
|
34
|
+
<Typography variant="label1">{item.label}</Typography>
|
|
35
|
+
<Typography variant="body2">{item.value}</Typography>
|
|
36
|
+
</StyledValueContainer>
|
|
37
|
+
</>
|
|
38
|
+
))}
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const SidePanel = ({
|
|
44
|
+
variables,
|
|
45
|
+
bottomChildren,
|
|
46
|
+
containerSx,
|
|
47
|
+
variablesContainerSX,
|
|
48
|
+
imageUrl,
|
|
49
|
+
imageHeight = '100%',
|
|
50
|
+
imageWidth = '100%',
|
|
51
|
+
title = 'Default Title',
|
|
52
|
+
}: SidePanelProps) => {
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<StyledSidePanelContainer sx={containerSx}>
|
|
56
|
+
{imageUrl ? (
|
|
57
|
+
<Image
|
|
58
|
+
radius={'4px'}
|
|
59
|
+
src={imageUrl || ''}
|
|
60
|
+
alt="Image"
|
|
61
|
+
width={imageWidth}
|
|
62
|
+
height={imageHeight}
|
|
63
|
+
/>
|
|
64
|
+
) : (
|
|
65
|
+
<StyledTextContainer>
|
|
66
|
+
<StyledTypography variant="subtitle1">{title}</StyledTypography>
|
|
67
|
+
</StyledTextContainer>
|
|
68
|
+
)}
|
|
69
|
+
|
|
70
|
+
<SidePanelVariables
|
|
71
|
+
data={variables}
|
|
72
|
+
variablesContainerSX={variablesContainerSX}
|
|
73
|
+
/>
|
|
6
74
|
|
|
7
|
-
|
|
8
|
-
|
|
75
|
+
{bottomChildren}
|
|
76
|
+
</StyledSidePanelContainer>
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
9
79
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Box, Stack, styled, Typography } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
export const StyledSidePanelContainer = styled(Stack)(({ theme }) => ({
|
|
4
|
+
width: '250px',
|
|
5
|
+
backgroundColor: theme.palette.surface.paperBackground,
|
|
6
|
+
padding: '12px',
|
|
7
|
+
borderRadius: '8px',
|
|
8
|
+
gap: '12px',
|
|
9
|
+
margin: '20px',
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
export const StyledValueContainer = styled(Box)(({ theme }) => ({
|
|
13
|
+
backgroundColor: theme.palette.surface.defaultBackground,
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
justifyContent: 'space-between',
|
|
17
|
+
height: '50px',
|
|
18
|
+
width: '226px',
|
|
19
|
+
padding: '14px 12px',
|
|
20
|
+
borderRadius: '4px',
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
export const StyledTextContainer = styled(Stack)(({ theme }) => ({
|
|
24
|
+
width: '226px',
|
|
25
|
+
height: '128px',
|
|
26
|
+
backgroundColor: theme.palette.surface.defaultBackground,
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
export const StyledTypography = styled(Typography)(({ theme }) => ({
|
|
32
|
+
color: theme.palette.text.tertiary,
|
|
33
|
+
}));
|
|
@@ -4,11 +4,15 @@ import {
|
|
|
4
4
|
} from '@mui/material';
|
|
5
5
|
import './ButtonLoader.css';
|
|
6
6
|
|
|
7
|
-
export type ButtonProps = {
|
|
7
|
+
export type ButtonProps = {
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
color?: string;
|
|
10
|
+
} & Omit<MuiButtonProps, 'color'>;
|
|
8
11
|
|
|
9
|
-
export const Button = ({ loading = false, ...props }: ButtonProps) => {
|
|
12
|
+
export const Button = ({ loading = false, color, ...props }: ButtonProps) => {
|
|
10
13
|
return (
|
|
11
14
|
<MuiButton
|
|
15
|
+
sx={{ color, ...props.sx }}
|
|
12
16
|
{...props}
|
|
13
17
|
endIcon={loading ? <div className="buttonLoader"></div> : props.endIcon}
|
|
14
18
|
disabled={props.disabled || loading}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, Stack } from '@mui/material';
|
|
1
|
+
import { Box, Stack, useTheme } from '@mui/material';
|
|
2
2
|
import { AnimatedGifs } from '../../../assets/images/gif';
|
|
3
3
|
import { Button, Dialog, Typography } from '../../export';
|
|
4
4
|
|
|
@@ -11,6 +11,8 @@ export type ConfirmDialogProps = {
|
|
|
11
11
|
onConfirm: () => void;
|
|
12
12
|
onCancel: () => void;
|
|
13
13
|
type: ConfirmDialogType;
|
|
14
|
+
confirmButtonText?: string;
|
|
15
|
+
cancelButtonText?: string;
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
|
@@ -20,7 +22,10 @@ export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
|
|
20
22
|
onConfirm,
|
|
21
23
|
onCancel,
|
|
22
24
|
type,
|
|
25
|
+
confirmButtonText = type === 'delete' ? 'Confirm Delete' : 'Confirm',
|
|
26
|
+
cancelButtonText = 'Cancel',
|
|
23
27
|
}) => {
|
|
28
|
+
const theme = useTheme();
|
|
24
29
|
if (!isOpen) return null;
|
|
25
30
|
|
|
26
31
|
return (
|
|
@@ -54,15 +59,16 @@ export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
|
|
54
59
|
close();
|
|
55
60
|
}}
|
|
56
61
|
variant="text"
|
|
62
|
+
color={theme.palette.text.tertiary}
|
|
57
63
|
>
|
|
58
|
-
|
|
64
|
+
{cancelButtonText}
|
|
59
65
|
</Button>
|
|
60
66
|
<Button
|
|
61
67
|
onClick={onConfirm}
|
|
62
68
|
variant="contained"
|
|
63
69
|
color={type === 'delete' ? 'error' : 'primary'}
|
|
64
70
|
>
|
|
65
|
-
{
|
|
71
|
+
{confirmButtonText}
|
|
66
72
|
</Button>
|
|
67
73
|
</Stack>
|
|
68
74
|
</>
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
MenuState,
|
|
14
14
|
} from './interfaces';
|
|
15
15
|
import { createSidebarStyles } from './styles';
|
|
16
|
+
import { Box } from '@mui/material';
|
|
16
17
|
|
|
17
18
|
export const Sidebar = ({
|
|
18
19
|
menu,
|
|
@@ -164,9 +165,11 @@ export const Sidebar = ({
|
|
|
164
165
|
direction="column"
|
|
165
166
|
className="sidebarContainer"
|
|
166
167
|
>
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
<Box>
|
|
169
|
+
<StyledLogoArea collapsed={collapsed}>
|
|
170
|
+
{collapsed ? <CampxIcon size={32} /> : <CampxFullLogoIcon />}
|
|
171
|
+
</StyledLogoArea>
|
|
172
|
+
</Box>
|
|
170
173
|
|
|
171
174
|
<motion.div
|
|
172
175
|
initial={{ x: menuPosition }}
|
|
@@ -5,25 +5,27 @@ interface StyledBoxProps {
|
|
|
5
5
|
dragging: boolean;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const UploadDialogBox = styled(Box)<StyledBoxProps>(
|
|
9
|
-
|
|
8
|
+
export const UploadDialogBox = styled(Box)<StyledBoxProps>(({
|
|
9
|
+
theme,
|
|
10
|
+
dragging,
|
|
11
|
+
}) => {
|
|
12
|
+
const strokeColor = dragging
|
|
13
|
+
? encodeURIComponent(theme.palette.primary.dark)
|
|
14
|
+
: encodeURIComponent(theme.palette.primary.main);
|
|
15
|
+
|
|
16
|
+
return {
|
|
10
17
|
display: 'flex',
|
|
11
18
|
flexDirection: 'column',
|
|
12
19
|
width: '100%',
|
|
13
20
|
height: '250px',
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
? theme.palette.primary.dark
|
|
18
|
-
: theme.palette.primary.main,
|
|
19
|
-
backgroundColor: dragging
|
|
20
|
-
? theme.palette.secondary.dark
|
|
21
|
-
: theme.palette.secondary.light,
|
|
21
|
+
borderRadius: '7px',
|
|
22
|
+
backgroundImage: `url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='7' ry='7' stroke='${strokeColor}' stroke-width='3' stroke-dasharray='4%2c 8' stroke-dashoffset='8' stroke-linecap='round'/%3e%3c/svg%3e")`,
|
|
23
|
+
backgroundColor: theme.palette.surface.defaultBackground,
|
|
22
24
|
justifyContent: 'center',
|
|
23
25
|
alignItems: 'center',
|
|
24
26
|
transition: 'background-color 0.3s, border-color 0.3s',
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
+
};
|
|
28
|
+
});
|
|
27
29
|
|
|
28
30
|
export const ImageContainer = React.memo(
|
|
29
31
|
styled('img')<{ size?: number }>(({ size }) => ({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
1
2
|
import { Meta } from '@storybook/react/*';
|
|
2
3
|
import {
|
|
3
4
|
SidePanel,
|
|
@@ -7,33 +8,66 @@ import {
|
|
|
7
8
|
export default {
|
|
8
9
|
title: 'DataDisplay/SidePanel',
|
|
9
10
|
component: SidePanel,
|
|
10
|
-
tags: ['autodocs'],
|
|
11
|
-
argTypes: {
|
|
12
|
-
children: {
|
|
13
|
-
control: 'text',
|
|
14
|
-
description: 'Content inside the Avatar component',
|
|
15
|
-
},
|
|
16
|
-
src: {
|
|
17
|
-
control: 'text',
|
|
18
|
-
description: 'Image source for the Avatar component',
|
|
19
|
-
},
|
|
20
|
-
variant: {
|
|
21
|
-
control: {
|
|
22
|
-
type: 'select',
|
|
23
|
-
options: ['circular', 'rounded', 'square'],
|
|
24
|
-
},
|
|
25
|
-
description: 'Variant of the Avatar component',
|
|
26
|
-
},
|
|
27
|
-
sx: {
|
|
28
|
-
control: 'object',
|
|
29
|
-
description: 'Custom styling for the Avatar component',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
11
|
} as Meta<typeof SidePanel>;
|
|
33
12
|
|
|
34
13
|
export const withText = {
|
|
35
14
|
render: (args: SidePanelProps) => <SidePanel {...args} />,
|
|
36
15
|
args: {
|
|
37
|
-
|
|
16
|
+
variables: [
|
|
17
|
+
{
|
|
18
|
+
label: 'Frequency',
|
|
19
|
+
value: 'Daily',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: 'Start Date',
|
|
23
|
+
value: '5 July, 2024',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: 'Time',
|
|
27
|
+
value: '04:00 PM',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const WithImage = {
|
|
34
|
+
render: (args: SidePanelProps) => <SidePanel {...args} />,
|
|
35
|
+
args: {
|
|
36
|
+
imageUrl: `https://fastly.picsum.photos/id/1063/536/354.jpg?hmac=c-ouc6pAVYGm1E0uLcnK_cavuLd8J0VPbodIe_CG8s0`,
|
|
37
|
+
variables: [
|
|
38
|
+
{
|
|
39
|
+
label: 'Frequency',
|
|
40
|
+
value: 'Daily',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: 'Start Date',
|
|
44
|
+
value: '5 July, 2024',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: 'Time',
|
|
48
|
+
value: '04:00 PM',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
export const WithBottomComponent = {
|
|
54
|
+
render: (args: SidePanelProps) => <SidePanel {...args} />,
|
|
55
|
+
args: {
|
|
56
|
+
imageUrl: `https://fastly.picsum.photos/id/1063/536/354.jpg?hmac=c-ouc6pAVYGm1E0uLcnK_cavuLd8J0VPbodIe_CG8s0`,
|
|
57
|
+
variables: [
|
|
58
|
+
{
|
|
59
|
+
label: 'Frequency',
|
|
60
|
+
value: 'Daily',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: 'Start Date',
|
|
64
|
+
value: '5 July, 2024',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: 'Time',
|
|
68
|
+
value: '04:00 PM',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
bottomChildren: <Box>here your component</Box>,
|
|
38
72
|
},
|
|
39
73
|
};
|
|
@@ -19,6 +19,14 @@ const meta: Meta<typeof ConfirmDialog> = {
|
|
|
19
19
|
description: 'Message text displayed in the dialog',
|
|
20
20
|
control: 'text',
|
|
21
21
|
},
|
|
22
|
+
cancelButtonText: {
|
|
23
|
+
description: 'Text displayed on the cancel button',
|
|
24
|
+
control: 'text',
|
|
25
|
+
},
|
|
26
|
+
confirmButtonText: {
|
|
27
|
+
description: 'Text displayed on the confirm button',
|
|
28
|
+
control: 'text',
|
|
29
|
+
},
|
|
22
30
|
type: {
|
|
23
31
|
description: "Type of confirmation dialog ('confirm' or 'delete')",
|
|
24
32
|
control: {
|
|
@@ -16,6 +16,9 @@ export const DarkColorTokens = {
|
|
|
16
16
|
primary: ColorPalette.GreyColors.White,
|
|
17
17
|
secondary: ColorPalette.GreyColors.White70,
|
|
18
18
|
tertiary: ColorPalette.GreyColors.White50,
|
|
19
|
+
black: ColorPalette.GreyColors.Black,
|
|
20
|
+
white: ColorPalette.GreyColors.White,
|
|
21
|
+
primaryContrast: ColorPalette.BlueGreyColors.BlueGrey800,
|
|
19
22
|
},
|
|
20
23
|
surface: {
|
|
21
24
|
defaultBackground: ColorPalette.BlueGreyColors.BlueGrey600,
|
|
@@ -16,6 +16,9 @@ export const LightColorTokens = {
|
|
|
16
16
|
primary: ColorPalette.GreyColors.Black,
|
|
17
17
|
secondary: ColorPalette.GreyColors.Black70,
|
|
18
18
|
tertiary: ColorPalette.GreyColors.Black50,
|
|
19
|
+
black: ColorPalette.GreyColors.Black,
|
|
20
|
+
white: ColorPalette.GreyColors.White,
|
|
21
|
+
primaryContrast: ColorPalette.GreyColors.White,
|
|
19
22
|
},
|
|
20
23
|
surface: {
|
|
21
24
|
defaultBackground: ColorPalette.BlueGreyColors.BlueGrey100,
|
|
@@ -309,25 +309,25 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
309
309
|
MuiSwitch: {
|
|
310
310
|
styleOverrides: {
|
|
311
311
|
root: {
|
|
312
|
-
width:
|
|
313
|
-
height:
|
|
312
|
+
width: 40,
|
|
313
|
+
height: 20,
|
|
314
314
|
padding: 0,
|
|
315
315
|
'& .MuiSwitch-switchBase': {
|
|
316
|
-
padding:
|
|
316
|
+
padding: 1,
|
|
317
317
|
margin: 2,
|
|
318
318
|
transitionDuration: '500ms',
|
|
319
319
|
'&.Mui-checked': {
|
|
320
|
-
transform: 'translateX(
|
|
320
|
+
transform: 'translateX(20px)',
|
|
321
321
|
'& + .MuiSwitch-track': {
|
|
322
|
-
backgroundColor: ColorTokens.surface.
|
|
322
|
+
backgroundColor: ColorTokens.surface.paperBackground,
|
|
323
|
+
border: `1px solid ${ColorTokens.highlight.highlightRed}`,
|
|
323
324
|
opacity: 1,
|
|
324
|
-
border: 0,
|
|
325
325
|
},
|
|
326
326
|
'& .MuiSwitch-thumb': {
|
|
327
327
|
boxSizing: 'border-box',
|
|
328
|
-
backgroundColor: ColorTokens.
|
|
329
|
-
width:
|
|
330
|
-
height:
|
|
328
|
+
backgroundColor: ColorTokens.highlight.highlightRed,
|
|
329
|
+
width: 14,
|
|
330
|
+
height: 14,
|
|
331
331
|
},
|
|
332
332
|
'&.Mui-disabled + .MuiSwitch-track': {
|
|
333
333
|
opacity: 0.5,
|
|
@@ -336,13 +336,16 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
336
336
|
},
|
|
337
337
|
'& .MuiSwitch-thumb': {
|
|
338
338
|
boxSizing: 'border-box',
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
boxShadow: 'none',
|
|
340
|
+
borderRadius: 4,
|
|
341
|
+
backgroundColor: ColorTokens.surface.grey,
|
|
342
|
+
width: 14,
|
|
343
|
+
height: 14,
|
|
342
344
|
},
|
|
343
345
|
'& .MuiSwitch-track': {
|
|
344
|
-
borderRadius:
|
|
345
|
-
backgroundColor: ColorTokens.surface.
|
|
346
|
+
borderRadius: 4,
|
|
347
|
+
backgroundColor: ColorTokens.surface.paperBackground,
|
|
348
|
+
border: `1px solid ${ColorTokens.border.primary}`,
|
|
346
349
|
opacity: 1,
|
|
347
350
|
},
|
|
348
351
|
'&.Mui-disabled + .MuiSwitch-track': {
|
|
@@ -476,7 +479,7 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
476
479
|
},
|
|
477
480
|
subtitle2: {
|
|
478
481
|
fontSize: '16px',
|
|
479
|
-
fontWeight:
|
|
482
|
+
fontWeight: 600,
|
|
480
483
|
fontFamily: 'Poppins',
|
|
481
484
|
color: ColorTokens.text.primary,
|
|
482
485
|
},
|
|
@@ -486,6 +489,12 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
486
489
|
fontFamily: 'Poppins',
|
|
487
490
|
color: ColorTokens.text.primary,
|
|
488
491
|
},
|
|
492
|
+
button1: {
|
|
493
|
+
fontSize: '14px',
|
|
494
|
+
fontWeight: 600,
|
|
495
|
+
fontFamily: 'Poppins',
|
|
496
|
+
color: ColorTokens.text.primary,
|
|
497
|
+
},
|
|
489
498
|
body1: {
|
|
490
499
|
fontSize: '16px',
|
|
491
500
|
fontWeight: 600,
|
|
@@ -498,12 +507,6 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
498
507
|
fontFamily: 'Heebo',
|
|
499
508
|
color: ColorTokens.text.primary,
|
|
500
509
|
},
|
|
501
|
-
caption: {
|
|
502
|
-
fontSize: '12px',
|
|
503
|
-
fontWeight: 400,
|
|
504
|
-
fontFamily: 'Heebo',
|
|
505
|
-
color: ColorTokens.text.secondary,
|
|
506
|
-
},
|
|
507
510
|
label1: {
|
|
508
511
|
fontSize: '14px',
|
|
509
512
|
fontWeight: 400,
|
|
@@ -511,16 +514,16 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
511
514
|
color: ColorTokens.text.secondary,
|
|
512
515
|
},
|
|
513
516
|
label2: {
|
|
514
|
-
fontSize: '
|
|
517
|
+
fontSize: '14px',
|
|
515
518
|
fontWeight: 400,
|
|
516
519
|
fontFamily: 'Poppins',
|
|
517
520
|
color: ColorTokens.text.secondary,
|
|
518
521
|
},
|
|
519
|
-
|
|
520
|
-
fontSize: '
|
|
521
|
-
fontWeight:
|
|
522
|
-
fontFamily: '
|
|
523
|
-
color: ColorTokens.text.
|
|
522
|
+
caption: {
|
|
523
|
+
fontSize: '12px',
|
|
524
|
+
fontWeight: 400,
|
|
525
|
+
fontFamily: 'Heebo',
|
|
526
|
+
color: ColorTokens.text.secondary,
|
|
524
527
|
},
|
|
525
528
|
} as TypographyOptions,
|
|
526
529
|
},
|
package/types/theme.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import '@mui/material/styles';
|
|
2
2
|
|
|
3
|
-
declare module
|
|
3
|
+
declare module '@mui/material/styles' {
|
|
4
4
|
interface Theme {
|
|
5
5
|
palette: {
|
|
6
6
|
[x: string]: any;
|
|
@@ -21,6 +21,9 @@ declare module "@mui/material/styles" {
|
|
|
21
21
|
primary: string;
|
|
22
22
|
secondary: string;
|
|
23
23
|
tertiary: string;
|
|
24
|
+
black: string;
|
|
25
|
+
white: string;
|
|
26
|
+
primaryContrast: string;
|
|
24
27
|
};
|
|
25
28
|
surface: {
|
|
26
29
|
defaultBackground: string;
|
|
@@ -49,7 +52,7 @@ declare module "@mui/material/styles" {
|
|
|
49
52
|
export function createTheme(options?: CustomThemeOptions): CustomTheme;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
declare module
|
|
55
|
+
declare module '@mui/material/Typography' {
|
|
53
56
|
interface TypographyPropsVariantOverrides {
|
|
54
57
|
label1: true;
|
|
55
58
|
label2: true;
|