@campxdev/react-blueprint 1.7.16 → 1.8.0
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/Assets/Icons/IconComponents/ClearIcon.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/DownArrow.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/ExportIcon.tsx +3 -3
- package/src/components/DataDisplay/SidePanel/SidePanel.tsx +3 -3
- package/src/components/DataDisplay/Timeline/Timeline.tsx +1 -1
- package/src/components/Input/FileUpload/FileUpload.tsx +46 -36
- package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +5 -1
- package/src/components/Navigation/PreviewFiles/PreviewFiles.tsx +3 -1
- package/src/stories/Navigation/ManageFilters.stories.tsx +0 -116
package/package.json
CHANGED
|
@@ -30,7 +30,7 @@ export const ClearIcon = ({
|
|
|
30
30
|
>
|
|
31
31
|
<path
|
|
32
32
|
d="M9.52859 2.07129C9.43351 1.97624 9.26447 1.97624 9.16938 2.07129L5.9999 5.2396L2.83042 2.07129C2.73534 1.97624 2.5663 1.97624 2.47122 2.07129C2.37613 2.16634 2.37613 2.33531 2.47122 2.43036L5.64069 5.59868L2.47122 8.767C2.37613 8.86205 2.37613 9.03102 2.47122 9.12607C2.52404 9.17888 2.58743 9.2 2.65082 9.2C2.71421 9.2 2.7776 9.17888 2.83042 9.12607L5.9999 5.95776L9.16938 9.12607C9.22221 9.17888 9.2856 9.2 9.34899 9.2C9.41238 9.2 9.47576 9.17888 9.52859 9.12607C9.62367 9.03102 9.62367 8.86205 9.52859 8.767L6.35911 5.59868L9.52859 2.43036C9.62367 2.33531 9.62367 2.1769 9.52859 2.07129Z"
|
|
33
|
-
|
|
33
|
+
strokeWidth="1"
|
|
34
34
|
/>
|
|
35
35
|
</StyledSvg>
|
|
36
36
|
);
|
|
@@ -28,19 +28,19 @@ export const ExportIcon = ({
|
|
|
28
28
|
d="M15.5105 22.2501H8.99047C4.08047 22.2501 1.98047 20.1501 1.98047 15.2401V15.1101C1.98047 10.6701 3.73047 8.53009 7.65047 8.15809C7.84833 8.1444 8.04387 8.20739 8.19655 8.334C8.34922 8.4606 8.44731 8.64111 8.47047 8.83809C8.47997 8.93664 8.46988 9.03609 8.4408 9.13073C8.41172 9.22536 8.36422 9.31332 8.30102 9.38953C8.23782 9.46573 8.16018 9.5287 8.07256 9.57479C7.98494 9.62088 7.88907 9.64919 7.79047 9.65809C4.65047 9.94809 3.48047 11.4281 3.48047 15.1181V15.2481C3.48047 19.3181 4.92047 20.7581 8.99047 20.7581H15.5105C19.5805 20.7581 21.0205 19.3181 21.0205 15.2481V15.1181C21.0205 11.4081 19.8305 9.92809 16.6305 9.65809C16.5311 9.65155 16.4341 9.62524 16.345 9.58071C16.256 9.53617 16.1767 9.4743 16.1119 9.39873C16.047 9.32315 15.9979 9.2354 15.9675 9.1406C15.937 9.04581 15.9258 8.94589 15.9344 8.84669C15.9431 8.7475 15.9714 8.65103 16.0179 8.56295C16.0643 8.47486 16.1278 8.39693 16.2048 8.33373C16.2817 8.27052 16.3705 8.22332 16.4659 8.19487C16.5613 8.16643 16.6615 8.15733 16.7605 8.16809C20.7405 8.50809 22.5205 10.6581 22.5205 15.1281V15.2581C22.5205 20.1501 20.4205 22.2501 15.5105 22.2501Z"
|
|
29
29
|
fill={color}
|
|
30
30
|
stroke="#121212"
|
|
31
|
-
|
|
31
|
+
strokeWidth="0.4"
|
|
32
32
|
/>
|
|
33
33
|
<path
|
|
34
34
|
d="M12.25 15.7501C12.0515 15.7488 11.8615 15.6694 11.7211 15.529C11.5807 15.3886 11.5013 15.1986 11.5 15.0001V3.62012C11.5013 3.42161 11.5807 3.2316 11.7211 3.09124C11.8615 2.95087 12.0515 2.87143 12.25 2.87012C12.4485 2.87143 12.6385 2.95087 12.7789 3.09124C12.9193 3.2316 12.9987 3.42161 13 3.62012V15.0001C12.9987 15.1986 12.9193 15.3886 12.7789 15.529C12.6385 15.6694 12.4485 15.7488 12.25 15.7501Z"
|
|
35
35
|
fill={color}
|
|
36
36
|
stroke={color}
|
|
37
|
-
|
|
37
|
+
strokeWidth="0.4"
|
|
38
38
|
/>
|
|
39
39
|
<path
|
|
40
40
|
d="M15.6012 6.60012C15.5026 6.60047 15.405 6.5812 15.314 6.54343C15.223 6.50566 15.1405 6.45014 15.0712 6.38012L12.2532 3.56012L9.43317 6.38012C9.29099 6.5126 9.10295 6.58472 8.90864 6.58129C8.71434 6.57787 8.52896 6.49915 8.39155 6.36174C8.25413 6.22433 8.17542 6.03894 8.17199 5.84464C8.16856 5.65034 8.24069 5.46229 8.37317 5.32012L11.7212 1.97112C11.8623 1.83164 12.0527 1.75342 12.2512 1.75342C12.4496 1.75342 12.64 1.83164 12.7812 1.97112L16.1312 5.32112C16.2706 5.46226 16.3489 5.65269 16.3489 5.85112C16.3489 6.04955 16.2706 6.23998 16.1312 6.38112C16.0624 6.45175 15.9799 6.50759 15.8887 6.54525C15.7976 6.5829 15.6998 6.60157 15.6012 6.60012Z"
|
|
41
41
|
fill={color}
|
|
42
42
|
stroke={color}
|
|
43
|
-
|
|
43
|
+
strokeWidth="0.4"
|
|
44
44
|
/>
|
|
45
45
|
</svg>
|
|
46
46
|
</>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SxProps, Typography } from '@mui/material';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import { Fragment, ReactNode } from 'react';
|
|
3
3
|
import Image from '../../Image/Image';
|
|
4
4
|
import {
|
|
5
5
|
StyledSidePanelContainer,
|
|
@@ -29,12 +29,12 @@ export const SidePanelVariables = ({
|
|
|
29
29
|
return (
|
|
30
30
|
<>
|
|
31
31
|
{data?.map((item, index) => (
|
|
32
|
-
|
|
32
|
+
<Fragment key={index}>
|
|
33
33
|
<StyledValueContainer key={index} sx={variablesContainerSX}>
|
|
34
34
|
<Typography variant="label1">{item.label}</Typography>
|
|
35
35
|
<Typography variant="body2">{item.value}</Typography>
|
|
36
36
|
</StyledValueContainer>
|
|
37
|
-
|
|
37
|
+
</Fragment>
|
|
38
38
|
))}
|
|
39
39
|
</>
|
|
40
40
|
);
|
|
@@ -4,11 +4,10 @@ import {
|
|
|
4
4
|
Stack,
|
|
5
5
|
styled,
|
|
6
6
|
SxProps,
|
|
7
|
-
useTheme,
|
|
8
7
|
useMediaQuery,
|
|
8
|
+
useTheme,
|
|
9
9
|
} from '@mui/material';
|
|
10
10
|
import { IconButtons, Icons, PreviewFiles, Typography } from '../../export';
|
|
11
|
-
import { alpha } from '@mui/system';
|
|
12
11
|
|
|
13
12
|
export type FileUploadProps = {
|
|
14
13
|
label: string;
|
|
@@ -22,6 +21,7 @@ export type FileUploadProps = {
|
|
|
22
21
|
inputText?: string;
|
|
23
22
|
multiple?: boolean;
|
|
24
23
|
hideDeleteButton?: boolean;
|
|
24
|
+
hideInput?: boolean;
|
|
25
25
|
errorText?: string;
|
|
26
26
|
sx?: SxProps;
|
|
27
27
|
showImage?: boolean;
|
|
@@ -40,6 +40,7 @@ export const FileUpload = ({
|
|
|
40
40
|
inputText,
|
|
41
41
|
onInvalidFile,
|
|
42
42
|
hideDeleteButton = false,
|
|
43
|
+
hideInput = false,
|
|
43
44
|
multiple = true,
|
|
44
45
|
errorText,
|
|
45
46
|
showImage,
|
|
@@ -81,6 +82,7 @@ export const FileUpload = ({
|
|
|
81
82
|
onChange([validFiles[0]]);
|
|
82
83
|
}
|
|
83
84
|
}
|
|
85
|
+
event.target.value = ''; //Resets value after selection
|
|
84
86
|
}
|
|
85
87
|
};
|
|
86
88
|
|
|
@@ -93,40 +95,47 @@ export const FileUpload = ({
|
|
|
93
95
|
{' *'}
|
|
94
96
|
</span>
|
|
95
97
|
)}
|
|
96
|
-
</Typography>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
98
|
+
</Typography>
|
|
99
|
+
{!hideInput && (
|
|
100
|
+
<>
|
|
101
|
+
<input
|
|
102
|
+
accept={accept}
|
|
103
|
+
style={{ display: 'none' }}
|
|
104
|
+
id={name}
|
|
105
|
+
name={name}
|
|
106
|
+
type="file"
|
|
107
|
+
multiple={multiple}
|
|
108
|
+
disabled={disabled}
|
|
109
|
+
onChange={handleFileChange}
|
|
110
|
+
/>
|
|
111
|
+
<FormLabel htmlFor={name}>
|
|
112
|
+
<StyledFileSelectorContainer>
|
|
113
|
+
<Stack display={'flex'} alignItems={'center'}>
|
|
114
|
+
<Icons.ExportIcon size={20} />
|
|
115
|
+
<Typography
|
|
116
|
+
color={theme.palette.text.tertiary}
|
|
117
|
+
variant="label2"
|
|
118
|
+
>
|
|
119
|
+
{inputText ?? 'Upload Files'}
|
|
120
|
+
</Typography>
|
|
121
|
+
</Stack>
|
|
122
|
+
</StyledFileSelectorContainer>
|
|
123
|
+
{errorText && (
|
|
124
|
+
<Typography
|
|
125
|
+
sx={{
|
|
126
|
+
display: 'flex',
|
|
127
|
+
alignItems: 'flex-end',
|
|
128
|
+
justifyContent: 'flex-end',
|
|
129
|
+
color: theme.palette.highlight.highlightRed,
|
|
130
|
+
}}
|
|
131
|
+
variant="caption"
|
|
132
|
+
>
|
|
133
|
+
{errorText}
|
|
134
|
+
</Typography>
|
|
135
|
+
)}
|
|
136
|
+
</FormLabel>
|
|
137
|
+
</>
|
|
138
|
+
)}
|
|
130
139
|
<Box display="flex" gap="12px" flexWrap="wrap">
|
|
131
140
|
{showImage ? (
|
|
132
141
|
files.map((file, index) => (
|
|
@@ -181,6 +190,7 @@ export const FileUpload = ({
|
|
|
181
190
|
sx={previewSx}
|
|
182
191
|
files={files}
|
|
183
192
|
onChange={(newFiles) => onChange?.(newFiles)}
|
|
193
|
+
hideDelete={hideDeleteButton}
|
|
184
194
|
/>
|
|
185
195
|
</Box>
|
|
186
196
|
)}
|
|
@@ -10,6 +10,7 @@ interface FormControlWrapperProps<T extends FieldValues = FieldValues> {
|
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
containerSx?: SxProps;
|
|
12
12
|
formActionProps?: FormActionsProps;
|
|
13
|
+
disabled?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
type FormElementProps = {
|
|
@@ -32,6 +33,7 @@ export function FormControlWrapper<T extends FieldValues = FieldValues>({
|
|
|
32
33
|
children,
|
|
33
34
|
containerSx,
|
|
34
35
|
formActionProps,
|
|
36
|
+
disabled = false,
|
|
35
37
|
}: FormControlWrapperProps<T>) {
|
|
36
38
|
const wrapWithController = (
|
|
37
39
|
element: ReactElement<any>,
|
|
@@ -56,13 +58,14 @@ export function FormControlWrapper<T extends FieldValues = FieldValues>({
|
|
|
56
58
|
files: field.value || [],
|
|
57
59
|
...field,
|
|
58
60
|
errorText: error ? error.message : undefined,
|
|
61
|
+
disabled,
|
|
59
62
|
} as FileUploadProps);
|
|
60
63
|
}
|
|
61
64
|
const additionalProps =
|
|
62
65
|
element.type === 'input' && restProps.type === 'checkbox'
|
|
63
66
|
? { checked: field.value }
|
|
64
67
|
: { value: field.value };
|
|
65
|
-
|
|
68
|
+
|
|
66
69
|
return React.cloneElement(element, {
|
|
67
70
|
...restProps,
|
|
68
71
|
...field,
|
|
@@ -70,6 +73,7 @@ export function FormControlWrapper<T extends FieldValues = FieldValues>({
|
|
|
70
73
|
error: !!error,
|
|
71
74
|
helperText: error ? error.message : null,
|
|
72
75
|
children: childElements,
|
|
76
|
+
disabled,
|
|
73
77
|
} as FormElementProps);
|
|
74
78
|
}}
|
|
75
79
|
/>
|
|
@@ -16,6 +16,7 @@ export type PreviewFilesProps = {
|
|
|
16
16
|
label?: string;
|
|
17
17
|
onChange?: (newFiles: File[], deletedFile: File) => void;
|
|
18
18
|
showDownload?: boolean;
|
|
19
|
+
hideDelete?: boolean;
|
|
19
20
|
sx?: SxProps;
|
|
20
21
|
} & Omit<BoxProps, 'onChange'>;
|
|
21
22
|
|
|
@@ -24,6 +25,7 @@ export const PreviewFiles = ({
|
|
|
24
25
|
label,
|
|
25
26
|
onChange,
|
|
26
27
|
showDownload,
|
|
28
|
+
hideDelete = false,
|
|
27
29
|
sx,
|
|
28
30
|
...props
|
|
29
31
|
}: PreviewFilesProps) => {
|
|
@@ -135,7 +137,7 @@ export const PreviewFiles = ({
|
|
|
135
137
|
<Icons.DownloadIcon />
|
|
136
138
|
</IconButton>
|
|
137
139
|
)}
|
|
138
|
-
{onChange && (
|
|
140
|
+
{onChange && !hideDelete && (
|
|
139
141
|
<IconButton
|
|
140
142
|
onClick={() => {
|
|
141
143
|
onChange(
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react';
|
|
2
|
-
import { ReactNode, useState } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
ManageFilters,
|
|
5
|
-
ManageFiltersProps,
|
|
6
|
-
SingleSelect,
|
|
7
|
-
TextField,
|
|
8
|
-
} from '../../components/export';
|
|
9
|
-
import { RadioGroup } from '../../components/Input/RadioGroup/RadioGroup';
|
|
10
|
-
|
|
11
|
-
const meta: Meta<typeof ManageFilters> = {
|
|
12
|
-
title: 'Navigation/ManageFilters',
|
|
13
|
-
component: ManageFilters,
|
|
14
|
-
argTypes: {
|
|
15
|
-
options: {
|
|
16
|
-
control: { type: 'object' },
|
|
17
|
-
description: 'Array of filter options with labels and values.',
|
|
18
|
-
},
|
|
19
|
-
onChange: {
|
|
20
|
-
action: 'changed',
|
|
21
|
-
description: 'Callback when the selected values change.',
|
|
22
|
-
},
|
|
23
|
-
menuProps: {
|
|
24
|
-
control: { type: 'object' },
|
|
25
|
-
description: 'Props to customize the MUI Menu component.',
|
|
26
|
-
},
|
|
27
|
-
menuListProps: {
|
|
28
|
-
control: { type: 'object' },
|
|
29
|
-
description: 'Props to customize the MUI MenuList component.',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
parameters: {
|
|
33
|
-
controls: { expanded: true },
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default meta;
|
|
38
|
-
|
|
39
|
-
const Template: StoryFn<ManageFiltersProps> = (args) => {
|
|
40
|
-
const [selectedValues, setSelectedValues] = useState<ReactNode[]>([]);
|
|
41
|
-
|
|
42
|
-
const handleOnChange = (values: ReactNode[]) => {
|
|
43
|
-
setSelectedValues(values);
|
|
44
|
-
args.onChange(values);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return (
|
|
48
|
-
<>
|
|
49
|
-
<ManageFilters {...args} onChange={handleOnChange} />
|
|
50
|
-
<div>
|
|
51
|
-
{selectedValues.length > 0 ? (
|
|
52
|
-
<ul>{selectedValues.map((value, index) => value)}</ul>
|
|
53
|
-
) : (
|
|
54
|
-
<p>No values selected.</p>
|
|
55
|
-
)}
|
|
56
|
-
</div>
|
|
57
|
-
</>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const Default = Template.bind({});
|
|
62
|
-
Default.args = {
|
|
63
|
-
options: [
|
|
64
|
-
{
|
|
65
|
-
label: 'Option 1',
|
|
66
|
-
value: (
|
|
67
|
-
<SingleSelect
|
|
68
|
-
onChange={() => {}}
|
|
69
|
-
options={[
|
|
70
|
-
{
|
|
71
|
-
label: 'done',
|
|
72
|
-
value: 'done',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
label: 'processing',
|
|
76
|
-
value: 'processing',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
label: 'onHold',
|
|
80
|
-
value: 'onHold',
|
|
81
|
-
},
|
|
82
|
-
]}
|
|
83
|
-
/>
|
|
84
|
-
),
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
label: 'text Filed',
|
|
88
|
-
value: <TextField sx={{ width: '250px' }} />,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
label: 'Radio Group',
|
|
92
|
-
value: (
|
|
93
|
-
<RadioGroup
|
|
94
|
-
options={[
|
|
95
|
-
{
|
|
96
|
-
label: 'done',
|
|
97
|
-
value: 'done',
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
label: 'processing',
|
|
101
|
-
value: 'processing',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
label: 'onHold',
|
|
105
|
-
value: 'onHold',
|
|
106
|
-
},
|
|
107
|
-
]}
|
|
108
|
-
label={''}
|
|
109
|
-
required={false}
|
|
110
|
-
name={''}
|
|
111
|
-
disabled={false}
|
|
112
|
-
/>
|
|
113
|
-
),
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
};
|