@campxdev/react-blueprint 1.1.13 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/DataTable/DataTable.tsx +2 -0
- 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/themes/commonTheme.ts +17 -14
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;
|
|
@@ -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: () => {
|
|
@@ -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 }) => ({
|
|
@@ -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': {
|