@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,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "main": "./export.ts",
5
5
  "dependencies": {
6
6
  "@emotion/react": "^11.13.3",
@@ -1,8 +1,14 @@
1
1
  import { useTheme } from '@mui/material';
2
2
 
3
- export const SearchIcon = ({ size = 16 }) => {
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}
@@ -6,7 +6,6 @@ export const StyledSidePanelContainer = styled(Stack)(({ theme }) => ({
6
6
  padding: '12px',
7
7
  borderRadius: '8px',
8
8
  gap: '12px',
9
- margin: '12px',
10
9
  }));
11
10
 
12
11
  export const StyledValueContainer = styled(Box)(({ theme }) => ({
@@ -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
- return variant == 'stepper' ? (
31
- <PageStepperContainer {...props}>{props.children}</PageStepperContainer>
32
- ) : (
33
- <PageContentContainer gap="12px" {...props}>
34
- {props.children}
35
- </PageContentContainer>
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
- <MuiBreadcrumbs {...rest}>
36
- {currentPathArray?.map((item, index) => {
37
- basePath = basePath + `/${item}`;
38
- return index === currentPathArray.length - 1 ? (
39
- <Typography key={index} variant="subtitle2">
40
- {_.startCase(decodeURIComponent(item).split(specialCharacter)[0])}
41
- </Typography>
42
- ) : (
43
- <BreadcrumbLink key={index} to={basePath}>
44
- {_.startCase(decodeURIComponent(item).split(specialCharacter)[0])}
45
- </BreadcrumbLink>
46
- );
47
- })}
48
- </MuiBreadcrumbs>
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: 'flex-start',
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',