@campxdev/react-blueprint 1.9.4 → 1.9.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
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { useTheme } from '@mui/material';
|
|
2
2
|
|
|
3
|
-
export const SearchIcon = ({
|
|
3
|
+
export const SearchIcon = ({
|
|
4
|
+
size = 16,
|
|
5
|
+
backgroundColor,
|
|
6
|
+
}: {
|
|
7
|
+
size?: number;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
}) => {
|
|
4
10
|
const theme = useTheme();
|
|
5
|
-
const color = theme.palette.primary.main;
|
|
11
|
+
const color = backgroundColor ?? theme.palette.primary.main;
|
|
6
12
|
return (
|
|
7
13
|
<svg
|
|
8
14
|
width={size}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Box, BoxProps, styled } from '@mui/material';
|
|
2
2
|
|
|
3
3
|
export type PageContentProps = {
|
|
4
|
-
variant?: 'stepper' | 'standard';
|
|
4
|
+
variant?: 'stepper' | 'standard' | 'side-panel';
|
|
5
5
|
} & BoxProps;
|
|
6
6
|
|
|
7
7
|
const PageContentContainer = styled(Box)(({ theme }) => ({
|
|
@@ -23,15 +23,35 @@ const PageStepperContainer = styled(Box)(({ theme }) => ({
|
|
|
23
23
|
gap: '10px',
|
|
24
24
|
}));
|
|
25
25
|
|
|
26
|
+
const PageContentSidePanelContainer = styled(Box)(({ theme }) => ({
|
|
27
|
+
display: 'flex',
|
|
28
|
+
backgroundColor: theme.palette.surface.defaultBackground,
|
|
29
|
+
gap: '12px',
|
|
30
|
+
}));
|
|
31
|
+
|
|
26
32
|
export const PageContent = ({
|
|
27
33
|
variant = 'standard',
|
|
28
34
|
...props
|
|
29
35
|
}: PageContentProps) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
switch (variant) {
|
|
37
|
+
case 'stepper':
|
|
38
|
+
return (
|
|
39
|
+
<PageStepperContainer {...props}>{props.children}</PageStepperContainer>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
case 'side-panel':
|
|
43
|
+
return (
|
|
44
|
+
<PageContentSidePanelContainer {...props}>
|
|
45
|
+
{props.children}
|
|
46
|
+
</PageContentSidePanelContainer>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
case 'standard':
|
|
50
|
+
default:
|
|
51
|
+
return (
|
|
52
|
+
<PageContentContainer gap="12px" {...props}>
|
|
53
|
+
{props.children}
|
|
54
|
+
</PageContentContainer>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
37
57
|
};
|
|
@@ -8,17 +8,20 @@ import {
|
|
|
8
8
|
import _ from 'lodash';
|
|
9
9
|
import { Link } from 'react-router-dom';
|
|
10
10
|
|
|
11
|
+
import { ReactNode } from 'react';
|
|
11
12
|
import { getBreadcrumbsCharacter } from '../../../utils/export';
|
|
12
13
|
import { Typography } from '../../export';
|
|
13
14
|
|
|
14
15
|
export type BreadcrumbsProps = {
|
|
15
16
|
pathTrimCount: number;
|
|
16
17
|
containerProps?: SxProps;
|
|
18
|
+
actions?: ReactNode[];
|
|
17
19
|
} & MuiBreadcrumbsProps;
|
|
18
20
|
|
|
19
21
|
export const Breadcrumbs = ({
|
|
20
22
|
pathTrimCount,
|
|
21
23
|
containerProps,
|
|
24
|
+
actions = [],
|
|
22
25
|
...rest
|
|
23
26
|
}: BreadcrumbsProps) => {
|
|
24
27
|
const specialCharacter = getBreadcrumbsCharacter();
|
|
@@ -32,38 +35,56 @@ export const Breadcrumbs = ({
|
|
|
32
35
|
|
|
33
36
|
return (
|
|
34
37
|
<BreadcrumbContainer sx={containerProps}>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
<BreadcrumbsWrapper>
|
|
39
|
+
<MuiBreadcrumbs {...rest}>
|
|
40
|
+
{currentPathArray?.map((item, index) => {
|
|
41
|
+
basePath = basePath + `/${item}`;
|
|
42
|
+
return index === currentPathArray.length - 1 ? (
|
|
43
|
+
<Typography key={index} variant="subtitle2">
|
|
44
|
+
{_.startCase(
|
|
45
|
+
decodeURIComponent(item).split(specialCharacter)[0],
|
|
46
|
+
)}
|
|
47
|
+
</Typography>
|
|
48
|
+
) : (
|
|
49
|
+
<BreadcrumbLink key={index} to={basePath}>
|
|
50
|
+
{_.startCase(
|
|
51
|
+
decodeURIComponent(item).split(specialCharacter)[0],
|
|
52
|
+
)}
|
|
53
|
+
</BreadcrumbLink>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</MuiBreadcrumbs>
|
|
57
|
+
</BreadcrumbsWrapper>
|
|
58
|
+
<ActionsContainer>
|
|
59
|
+
{actions.map((action, index) => action)}
|
|
60
|
+
</ActionsContainer>
|
|
49
61
|
</BreadcrumbContainer>
|
|
50
62
|
);
|
|
51
63
|
};
|
|
52
64
|
|
|
53
65
|
const BreadcrumbContainer = styled(Stack)(({ theme }) => ({
|
|
54
66
|
flexDirection: 'row',
|
|
55
|
-
alignItems: 'center',
|
|
56
67
|
width: '100%',
|
|
57
|
-
justifyContent: '
|
|
68
|
+
justifyContent: 'space-between',
|
|
58
69
|
height: '52px',
|
|
59
70
|
paddingLeft: '12px',
|
|
60
71
|
backgroundColor: theme.palette.surface.defaultBackground,
|
|
61
|
-
|
|
62
72
|
[theme.breakpoints.down('md')]: {
|
|
63
73
|
paddingLeft: '0px',
|
|
64
74
|
},
|
|
65
75
|
}));
|
|
66
76
|
|
|
77
|
+
const BreadcrumbsWrapper = styled(Stack)(({ theme }) => ({
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
const ActionsContainer = styled(Stack)(({ theme }) => ({
|
|
83
|
+
flexDirection: 'row',
|
|
84
|
+
alignItems: 'flex-start',
|
|
85
|
+
gap: '12px',
|
|
86
|
+
}));
|
|
87
|
+
|
|
67
88
|
const BreadcrumbLink = styled(Link)(({ theme }) => ({
|
|
68
89
|
textDecoration: 'none',
|
|
69
90
|
transition: 'color 0.3s ease-in-out',
|