@campxdev/react-blueprint 1.5.9 → 1.6.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/Assets/Icons/IconComponents/RightIcon.tsx +9 -9
- package/src/components/DataDisplay/Card/Card.tsx +1 -0
- package/src/components/DataDisplay/EditableDataTable/EditableDataTable.tsx +0 -5
- package/src/components/Input/FormActions/FormActions.tsx +1 -2
- package/src/components/Input/FormControlWrapper/FormControlWrapper.tsx +12 -10
- package/src/components/Input/SingleSelect/SingleSelect.tsx +6 -1
- package/src/components/Layout/AppHeader/AppHeader.tsx +1 -1
- package/src/components/Layout/AppHeader/AppHeaderActions/UserBox.tsx +5 -7
- package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Navigation/DialogButton/DialogButton.tsx +3 -3
- package/src/stories/Navigation/DialogButton.stories.tsx +2 -1
- package/src/themes/commonTheme.ts +1 -1
package/package.json
CHANGED
|
@@ -26,9 +26,9 @@ export const RightIcon = ({ size = 16 }) => {
|
|
|
26
26
|
d="M0,5.363,2.682,2.682,0,0"
|
|
27
27
|
transform="translate(8.045)"
|
|
28
28
|
fill="none"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
strokeLinecap="round"
|
|
30
|
+
strokeLinejoin="round"
|
|
31
|
+
strokeWidth="1.5"
|
|
32
32
|
/>
|
|
33
33
|
<path
|
|
34
34
|
id="Vector-2"
|
|
@@ -36,9 +36,9 @@ export const RightIcon = ({ size = 16 }) => {
|
|
|
36
36
|
d="M0,0H10.653"
|
|
37
37
|
transform="translate(0 2.682)"
|
|
38
38
|
fill="none"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
strokeLinecap="round"
|
|
40
|
+
strokeLinejoin="round"
|
|
41
|
+
strokeWidth="1.5"
|
|
42
42
|
/>
|
|
43
43
|
</g>
|
|
44
44
|
<path
|
|
@@ -47,9 +47,9 @@ export const RightIcon = ({ size = 16 }) => {
|
|
|
47
47
|
d="M0,16.76A8.015,8.015,0,0,0,8.38,8.38,8.015,8.015,0,0,0,0,0"
|
|
48
48
|
transform="translate(12.246 3.62)"
|
|
49
49
|
fill="none"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
strokeLinecap="round"
|
|
51
|
+
strokeLinejoin="round"
|
|
52
|
+
strokeWidth="1.5"
|
|
53
53
|
/>
|
|
54
54
|
<path
|
|
55
55
|
id="Vector-4"
|
|
@@ -16,12 +16,7 @@ import { v4 } from 'uuid';
|
|
|
16
16
|
import { DataTable, DataTableProps, Icons } from '../../export';
|
|
17
17
|
|
|
18
18
|
export type EditableDataTableProps = {
|
|
19
|
-
limit?: number;
|
|
20
|
-
offset?: number;
|
|
21
|
-
totalCount?: number;
|
|
22
19
|
hideDelete?: boolean;
|
|
23
|
-
onPageChange?: (page: number) => void;
|
|
24
|
-
onLimitChange?: (limit: number) => void;
|
|
25
20
|
onChange: (rows: GridValidRowModel) => void;
|
|
26
21
|
onSave?: (params: any) => void;
|
|
27
22
|
onDelete?: (params: any) => void;
|
|
@@ -40,11 +40,10 @@ function FormActions({
|
|
|
40
40
|
return (
|
|
41
41
|
<Stack
|
|
42
42
|
direction="row"
|
|
43
|
-
padding={2}
|
|
44
|
-
gap={2.5}
|
|
45
43
|
borderTop={
|
|
46
44
|
showTopBorder ? `1px solid ${theme.palette.border.primary}` : 'none'
|
|
47
45
|
}
|
|
46
|
+
sx={{ p: '12px 16px' }}
|
|
48
47
|
{...stackProps}
|
|
49
48
|
>
|
|
50
49
|
{defaultSubmitProps.show && (
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Stack } from '@mui/material';
|
|
1
2
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
2
3
|
import React, { ReactElement, ReactNode, isValidElement } from 'react';
|
|
3
|
-
import { Control, Controller } from 'react-hook-form';
|
|
4
|
+
import { Control, Controller, FieldValues, Path } from 'react-hook-form';
|
|
4
5
|
import FormActions, { FormActionsProps } from '../FormActions/FormActions';
|
|
5
6
|
|
|
6
|
-
interface FormControlWrapperProps {
|
|
7
|
-
control: Control<
|
|
7
|
+
interface FormControlWrapperProps<T extends FieldValues = FieldValues> {
|
|
8
|
+
control: Control<T>;
|
|
8
9
|
children: ReactNode;
|
|
9
10
|
formActionProps?: FormActionsProps;
|
|
10
11
|
}
|
|
@@ -14,19 +15,19 @@ type FormElementProps = {
|
|
|
14
15
|
loading?: boolean;
|
|
15
16
|
} & TextFieldProps;
|
|
16
17
|
|
|
17
|
-
type ControlledElementProps = {
|
|
18
|
-
name:
|
|
18
|
+
type ControlledElementProps<T extends FieldValues = FieldValues> = {
|
|
19
|
+
name: Path<T>;
|
|
19
20
|
error?: boolean;
|
|
20
21
|
helperText?: ReactNode;
|
|
21
22
|
children?: ReactNode;
|
|
22
23
|
[key: string]: any;
|
|
23
24
|
} & TextFieldProps;
|
|
24
25
|
|
|
25
|
-
export function FormControlWrapper({
|
|
26
|
+
export function FormControlWrapper<T extends FieldValues = FieldValues>({
|
|
26
27
|
control,
|
|
27
28
|
children,
|
|
28
29
|
formActionProps,
|
|
29
|
-
}: FormControlWrapperProps) {
|
|
30
|
+
}: FormControlWrapperProps<T>) {
|
|
30
31
|
const wrapWithController = (
|
|
31
32
|
element: ReactElement<any>,
|
|
32
33
|
): ReactElement<any> => {
|
|
@@ -36,7 +37,7 @@ export function FormControlWrapper({
|
|
|
36
37
|
name,
|
|
37
38
|
children: childElements,
|
|
38
39
|
...restProps
|
|
39
|
-
} = element.props as ControlledElementProps
|
|
40
|
+
} = element.props as ControlledElementProps<T>;
|
|
40
41
|
|
|
41
42
|
if (name) {
|
|
42
43
|
return (
|
|
@@ -77,8 +78,9 @@ export function FormControlWrapper({
|
|
|
77
78
|
|
|
78
79
|
return (
|
|
79
80
|
<>
|
|
80
|
-
{
|
|
81
|
-
|
|
81
|
+
<Stack sx={{ m: '8px' }}>
|
|
82
|
+
{React.Children.map(children as any, wrapWithController) || null}
|
|
83
|
+
</Stack>
|
|
82
84
|
{formActionProps && <FormActions {...formActionProps} showTopBorder />}
|
|
83
85
|
</>
|
|
84
86
|
);
|
|
@@ -50,7 +50,7 @@ export type SingleSelectProps = {
|
|
|
50
50
|
isFloat?: boolean;
|
|
51
51
|
};
|
|
52
52
|
dbLabelProps?: { labelKey: string; subLabelKey?: string };
|
|
53
|
-
onChange
|
|
53
|
+
onChange?: (value: any) => void;
|
|
54
54
|
error?: any;
|
|
55
55
|
helperText?: string;
|
|
56
56
|
} & Omit<
|
|
@@ -423,6 +423,11 @@ export const SingleSelect = ({
|
|
|
423
423
|
/>
|
|
424
424
|
);
|
|
425
425
|
}
|
|
426
|
+
|
|
427
|
+
if (!onChange) {
|
|
428
|
+
return <Typography>onChange Missing</Typography>;
|
|
429
|
+
}
|
|
430
|
+
|
|
426
431
|
return (
|
|
427
432
|
<MuiAutocomplete
|
|
428
433
|
{...restProps}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Avatar, Box, Stack, Typography, useTheme } from '@mui/material';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import DialogButton from '../../../Navigation/DialogButton/DialogButton';
|
|
4
3
|
import { DropdownMenu } from '../../../Navigation/DropDownMenu/DropDownMenu';
|
|
5
4
|
import { DropdownMenuItem } from '../../../Navigation/DropDownMenu/DropdownMenuItem';
|
|
6
5
|
import { StyledMenuItem } from '../../../Navigation/DropDownMenu/styles';
|
|
7
|
-
import { Icons } from '../../../export';
|
|
6
|
+
import { DialogButton, Icons } from '../../../export';
|
|
8
7
|
import SwitchInstitution from './SwitchInstitution';
|
|
9
8
|
|
|
10
9
|
const getStartingLetters = (text: string) => {
|
|
@@ -23,6 +22,7 @@ export default function UserBox({
|
|
|
23
22
|
profileUrl,
|
|
24
23
|
profileSx = {},
|
|
25
24
|
institutionsData,
|
|
25
|
+
changePassword,
|
|
26
26
|
avatar = true, // Make avatar optional, default to true
|
|
27
27
|
navigationIcon = true, // Make navigationIcon optional, default to true
|
|
28
28
|
showActiveDevices = true, // Make active devices optional, default to true
|
|
@@ -30,13 +30,10 @@ export default function UserBox({
|
|
|
30
30
|
fullName: string;
|
|
31
31
|
designation?: string;
|
|
32
32
|
institutionsData?: any[];
|
|
33
|
-
actions:
|
|
34
|
-
label: ReactNode;
|
|
35
|
-
icon?: ReactNode;
|
|
36
|
-
onClick: any;
|
|
37
|
-
}[];
|
|
33
|
+
actions: ReactNode[];
|
|
38
34
|
onLogoutClick?: any;
|
|
39
35
|
profileUrl?: string;
|
|
36
|
+
changePassword?: ReactNode;
|
|
40
37
|
profileSx?: any;
|
|
41
38
|
avatar?: boolean; // Define avatar as optional
|
|
42
39
|
navigationIcon?: boolean; // Define navigationIcon as optional
|
|
@@ -122,6 +119,7 @@ export default function UserBox({
|
|
|
122
119
|
/>
|
|
123
120
|
</Box>,
|
|
124
121
|
|
|
122
|
+
actions.map((action) => action),
|
|
125
123
|
<DropdownMenuItem
|
|
126
124
|
label={
|
|
127
125
|
<Stack
|
|
@@ -30,7 +30,7 @@ export const Breadcrumbs = ({ pathTrimCount, ...rest }: BreadcrumbsProps) => {
|
|
|
30
30
|
{currentPathArray?.map((item, index) => {
|
|
31
31
|
basePath = basePath + `/${item}`;
|
|
32
32
|
return index === currentPathArray.length - 1 ? (
|
|
33
|
-
<Typography variant="subtitle2">
|
|
33
|
+
<Typography key={index} variant="subtitle2">
|
|
34
34
|
{_.startCase(decodeURIComponent(item).split(specialCharacter)[0])}
|
|
35
35
|
</Typography>
|
|
36
36
|
) : (
|
|
@@ -18,12 +18,12 @@ export type DialogButtonProps = {
|
|
|
18
18
|
onDialogClose?: () => void;
|
|
19
19
|
} & Omit<DialogProps, 'open' | 'onClose'>;
|
|
20
20
|
|
|
21
|
-
export
|
|
21
|
+
export const DialogButton = ({
|
|
22
22
|
onDialogClose,
|
|
23
23
|
onDialogOpen,
|
|
24
24
|
anchor,
|
|
25
25
|
...props
|
|
26
|
-
}: DialogButtonProps) {
|
|
26
|
+
}: DialogButtonProps) => {
|
|
27
27
|
const [open, setOpen] = useState(false);
|
|
28
28
|
|
|
29
29
|
const onClose = () => {
|
|
@@ -49,4 +49,4 @@ export default function DialogButton({
|
|
|
49
49
|
/>
|
|
50
50
|
</>
|
|
51
51
|
);
|
|
52
|
-
}
|
|
52
|
+
};
|
|
@@ -148,7 +148,6 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
148
148
|
styleOverrides: {
|
|
149
149
|
root: {
|
|
150
150
|
padding: '0px',
|
|
151
|
-
margin: '16px',
|
|
152
151
|
},
|
|
153
152
|
},
|
|
154
153
|
},
|
|
@@ -263,6 +262,7 @@ export const getCommonTheme = (mode: Theme) => {
|
|
|
263
262
|
root: {
|
|
264
263
|
textTransform: 'none',
|
|
265
264
|
padding: '10px 20px ',
|
|
265
|
+
minWidth: '120px ',
|
|
266
266
|
maxHeight: '40px ',
|
|
267
267
|
borderRadius: '5px ',
|
|
268
268
|
boxShadow: 'none ',
|