@campxdev/react-blueprint 1.7.2 → 1.7.4
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/export.ts +1 -0
- package/package.json +1 -1
- package/src/assets/export.ts +2 -0
- package/src/assets/fonts/export.ts +2 -0
- package/src/assets/images/export.ts +2 -0
- package/src/assets/images/gif/index.ts +1 -1
- package/src/assets/images/svg/index.ts +12 -12
- package/src/components/Assets/ErrorPages/InternalServerError.tsx +5 -5
- package/src/components/Assets/ErrorPages/NoInternetConnection.tsx +5 -5
- package/src/components/Assets/ErrorPages/NoItemFound.tsx +6 -5
- package/src/components/Assets/ErrorPages/PageNotFound.tsx +5 -5
- package/src/components/Assets/ErrorPages/UnAuthorized.tsx +5 -5
- package/src/components/Assets/ErrorPages/styles.tsx +1 -1
- package/src/components/Assets/Icons/IconComponents/CautionIcon.tsx +37 -0
- package/src/components/Assets/Icons/IconComponents/ClearIcon.tsx +37 -0
- package/src/components/Assets/Icons/IconComponents/DoneSquare.tsx +2 -2
- package/src/components/Assets/Icons/IconComponents/DownArrow.tsx +32 -0
- package/src/components/Assets/Icons/IconComponents/LIneDivider.tsx +23 -0
- package/src/components/Assets/Icons/IconComponents/PrintDesignerIcon.tsx +47 -0
- package/src/components/Assets/Icons/IconComponents/RedirectIcon.tsx +15 -7
- package/src/components/Assets/Icons/IconComponents/SettlementsIcon.tsx +53 -0
- package/src/components/Assets/Icons/Icons.tsx +12 -0
- package/src/components/DataDisplay/ActivityLogView/ActivityLogView.tsx +2 -2
- package/src/components/DataDisplay/ActivityLogView/service.tsx +1 -19
- package/src/components/DataDisplay/DataTable/DataTable.tsx +62 -39
- package/src/components/DataDisplay/DataTable/TablePagination.tsx +20 -12
- package/src/components/DataDisplay/EmptyIllustration/EmptyIllustration.tsx +40 -0
- package/src/components/DataDisplay/export.ts +1 -0
- package/src/components/Feedback/Alert/Alert.tsx +2 -3
- package/src/components/Feedback/Spinner/Spinner.css +13 -25
- package/src/components/Input/RadioGroup/RadioGroup.tsx +6 -2
- package/src/components/Input/SearchBar/SearchBar.tsx +17 -14
- package/src/components/Input/SingleSelect/SingleSelect.tsx +2 -1
- package/src/components/Input/SingleSelect/components/MenuFooter.tsx +24 -0
- package/src/components/Input/SingleSelect/components/OptionsLoader.tsx +14 -0
- package/src/components/Input/SingleSelect/components/SingleFilter.tsx +69 -62
- package/src/components/Input/SingleSelect/components/SingleInput.tsx +45 -18
- package/src/components/Input/TextField/TextField.tsx +4 -1
- package/src/components/Input/styles.tsx +5 -5
- package/src/components/Layout/PageContent/PageContent.tsx +4 -3
- package/src/components/Layout/PageHeader/PageHeader.tsx +22 -69
- package/src/components/Layout/PageHeader/components/SearchBar.tsx +69 -26
- package/src/components/Layout/PageHeader/components/TableColumnsSelector/TableColumnsSelector.tsx +125 -23
- package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +1 -0
- package/src/components/Navigation/ConfirmDialog/ConfirmDialog.tsx +3 -3
- package/src/components/Navigation/DropDownMenu/DropDownMenu.tsx +2 -2
- package/src/components/Navigation/PreviewFiles/PreviewFiles.tsx +56 -81
- package/src/components/Navigation/Sidebar/styles.tsx +2 -1
- package/src/components/Navigation/TabsContainer/TabsContainer.tsx +1 -1
- package/src/components/Navigation/UploadDialog/LoadingUploadDialogContainer.tsx +3 -3
- package/src/components/Navigation/UploadDialog/UploadDialog.tsx +46 -33
- package/src/components/Navigation/UploadDialog/UploadDialogContainer.tsx +2 -2
- package/src/redux/slices/pageHeaderSlice.ts +4 -1
- package/src/stories/Navigation/PreviewFiles.stories.tsx +43 -9
- package/src/themes/commonTheme.ts +30 -5
- package/src/themes/customCssBaseline.ts +3 -2
- package/src/components/DataDisplay/styles.tsx +0 -6
- package/src/components/Input/components/OptionsLoader.tsx +0 -22
- /package/src/assets/images/svg/{Emptylistmage.svg → empty.svg} +0 -0
- /package/src/assets/images/svg/{error-cactus.svg → error-image.svg} +0 -0
- /package/src/assets/images/svg/{Internalserverimage.svg → server-error.svg} +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Stack, styled } from '@mui/material';
|
|
1
|
+
import { Stack, styled, useTheme } from '@mui/material';
|
|
2
2
|
import {
|
|
3
3
|
DataGrid as MuiDataGrid,
|
|
4
4
|
DataGridProps as MuiDataGridProps,
|
|
5
5
|
} from '@mui/x-data-grid';
|
|
6
6
|
import { v4 } from 'uuid';
|
|
7
|
-
import { DataGridContainer } from '../styles';
|
|
8
7
|
import { TablePagination } from './TablePagination';
|
|
9
8
|
|
|
10
9
|
export type DataTableProps = {
|
|
@@ -16,45 +15,69 @@ export type DataTableProps = {
|
|
|
16
15
|
} & MuiDataGridProps;
|
|
17
16
|
|
|
18
17
|
export const DataTable = (props: DataTableProps) => {
|
|
19
|
-
const {
|
|
18
|
+
const {
|
|
19
|
+
limit,
|
|
20
|
+
offset,
|
|
21
|
+
totalCount,
|
|
22
|
+
onPageChange,
|
|
23
|
+
onLimitChange,
|
|
24
|
+
density,
|
|
25
|
+
rows,
|
|
26
|
+
} = props;
|
|
27
|
+
|
|
28
|
+
const getRowHeightByDensity = (): number => {
|
|
29
|
+
switch (density) {
|
|
30
|
+
case 'standard':
|
|
31
|
+
return 48;
|
|
32
|
+
case 'compact':
|
|
33
|
+
return 36;
|
|
34
|
+
case 'comfortable':
|
|
35
|
+
return 60;
|
|
36
|
+
default:
|
|
37
|
+
return 48;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const theme = useTheme();
|
|
20
42
|
|
|
21
43
|
return (
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
44
|
+
<MuiDataGrid
|
|
45
|
+
disableColumnFilter
|
|
46
|
+
disableColumnMenu
|
|
47
|
+
disableColumnSorting
|
|
48
|
+
getRowId={(row) => row.id ?? v4()}
|
|
49
|
+
getRowHeight={getRowHeightByDensity}
|
|
50
|
+
rows={rows}
|
|
51
|
+
{...props}
|
|
52
|
+
slots={{
|
|
53
|
+
...props.slots,
|
|
54
|
+
pagination: () => {
|
|
55
|
+
if (
|
|
56
|
+
limit === undefined ||
|
|
57
|
+
offset === undefined ||
|
|
58
|
+
totalCount === undefined ||
|
|
59
|
+
onPageChange === undefined ||
|
|
60
|
+
onLimitChange === undefined
|
|
61
|
+
) {
|
|
62
|
+
return <></>;
|
|
63
|
+
}
|
|
64
|
+
const pages = Math.ceil(totalCount / limit);
|
|
65
|
+
const currentPage = Math.ceil(offset / limit) + 1;
|
|
66
|
+
return (
|
|
67
|
+
<TablePagination
|
|
68
|
+
count={pages}
|
|
69
|
+
page={currentPage}
|
|
70
|
+
limit={limit}
|
|
71
|
+
offset={offset}
|
|
72
|
+
totalCount={totalCount}
|
|
73
|
+
onPageChange={onPageChange}
|
|
74
|
+
onLimitChange={onLimitChange}
|
|
75
|
+
rowCount={rows?.length || 0}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
},
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
58
81
|
);
|
|
59
82
|
};
|
|
60
83
|
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
Pagination as MuiPagination,
|
|
3
3
|
PaginationProps as MuiPaginationProps,
|
|
4
4
|
Stack,
|
|
5
|
+
styled,
|
|
5
6
|
} from '@mui/material';
|
|
6
7
|
import { DropdownMenuItem } from '../../Navigation/DropDownMenu/DropdownMenuItem';
|
|
7
8
|
|
|
@@ -15,22 +16,29 @@ export type PaginationProps = {
|
|
|
15
16
|
totalCount: number;
|
|
16
17
|
onPageChange: (offset: number) => void;
|
|
17
18
|
onLimitChange: (limit: number) => void;
|
|
19
|
+
rowCount: number;
|
|
18
20
|
} & MuiPaginationProps;
|
|
19
21
|
|
|
22
|
+
const TablePaginationContainer = styled(Stack)(({ theme }) => ({
|
|
23
|
+
justifyContent: 'space-between',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
width: '100%',
|
|
26
|
+
padding: '10px 30px',
|
|
27
|
+
backgroundColor: theme.palette.surface.grey,
|
|
28
|
+
}));
|
|
29
|
+
|
|
20
30
|
export const TablePagination = (props: PaginationProps) => {
|
|
21
|
-
const { limit, offset, totalCount, onPageChange, onLimitChange } =
|
|
31
|
+
const { limit, offset, totalCount, onPageChange, onLimitChange, rowCount } =
|
|
32
|
+
props;
|
|
33
|
+
|
|
34
|
+
const getPaginationText = () => {
|
|
35
|
+
if (rowCount == 0) return 'No records';
|
|
36
|
+
return `Showing ${offset + 1} - ${offset + rowCount} rows of ${totalCount}`;
|
|
37
|
+
};
|
|
22
38
|
|
|
23
39
|
return (
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
justifyContent="space-between"
|
|
27
|
-
alignItems="center"
|
|
28
|
-
width="100%"
|
|
29
|
-
padding="10px 30px"
|
|
30
|
-
>
|
|
31
|
-
<Typography variant="caption">{`Showing ${offset + 1} - ${
|
|
32
|
-
offset + limit
|
|
33
|
-
} rows of ${totalCount}`}</Typography>
|
|
40
|
+
<TablePaginationContainer direction="row">
|
|
41
|
+
<Typography variant="caption">{getPaginationText()}</Typography>
|
|
34
42
|
<MuiPagination
|
|
35
43
|
{...props}
|
|
36
44
|
variant="outlined"
|
|
@@ -79,6 +87,6 @@ export const TablePagination = (props: PaginationProps) => {
|
|
|
79
87
|
/>,
|
|
80
88
|
]}
|
|
81
89
|
/>
|
|
82
|
-
</
|
|
90
|
+
</TablePaginationContainer>
|
|
83
91
|
);
|
|
84
92
|
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Box, styled, SxProps, TypographyOwnProps } from '@mui/material';
|
|
2
|
+
import { emptyImage } from '../../../assets/images/svg';
|
|
3
|
+
|
|
4
|
+
import { Typography } from '../export';
|
|
5
|
+
|
|
6
|
+
export const CenterBox = styled(Box)(({ theme }) => ({
|
|
7
|
+
width: '100%',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexDirection: 'column',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
export const EmptyIllustration = ({
|
|
15
|
+
message,
|
|
16
|
+
imageSize = '250px',
|
|
17
|
+
messageProps,
|
|
18
|
+
containerProps,
|
|
19
|
+
}: {
|
|
20
|
+
message: string;
|
|
21
|
+
imageSize?: string;
|
|
22
|
+
messageProps?: TypographyOwnProps;
|
|
23
|
+
containerProps?: SxProps;
|
|
24
|
+
}) => {
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<CenterBox sx={containerProps}>
|
|
28
|
+
<img
|
|
29
|
+
src={emptyImage}
|
|
30
|
+
alt="no-items"
|
|
31
|
+
width={imageSize}
|
|
32
|
+
style={{ margin: '20px' }}
|
|
33
|
+
/>
|
|
34
|
+
<Typography variant="subtitle2" {...messageProps}>
|
|
35
|
+
{message}
|
|
36
|
+
</Typography>
|
|
37
|
+
</CenterBox>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
@@ -5,6 +5,7 @@ export * from './Card/Card';
|
|
|
5
5
|
export * from './Chips/Chips';
|
|
6
6
|
export * from './DataTable/DataTable';
|
|
7
7
|
export * from './EditableDataTable/EditableDataTable';
|
|
8
|
+
export * from './EmptyIllustration/EmptyIllustration';
|
|
8
9
|
export * from './SidePanel/SidePanel';
|
|
9
10
|
export * from './Timeline/Timeline';
|
|
10
11
|
export * from './Typography/Typography';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Alert as MuiAlert, AlertProps as MuiAlertProps } from '@mui/material';
|
|
2
|
-
import { Icons } from '../../export';
|
|
2
|
+
import { Icons, Typography } from '../../export';
|
|
3
3
|
|
|
4
4
|
export type AlertProps = {
|
|
5
5
|
message: string;
|
|
6
|
-
severity: MuiAlertProps['severity'];
|
|
7
6
|
} & MuiAlertProps;
|
|
8
7
|
|
|
9
8
|
const getIcon = (severity: MuiAlertProps['severity']) => {
|
|
@@ -22,7 +21,7 @@ const getIcon = (severity: MuiAlertProps['severity']) => {
|
|
|
22
21
|
export const Alert = ({ severity, message, ...rest }: AlertProps) => {
|
|
23
22
|
return (
|
|
24
23
|
<MuiAlert severity={severity} icon={getIcon(severity)} {...rest}>
|
|
25
|
-
{message}
|
|
24
|
+
<Typography variant="caption">{message}</Typography>
|
|
26
25
|
</MuiAlert>
|
|
27
26
|
);
|
|
28
27
|
};
|
|
@@ -6,39 +6,27 @@
|
|
|
6
6
|
animation: rotate 1s linear infinite;
|
|
7
7
|
scale: 0.4;
|
|
8
8
|
}
|
|
9
|
-
.spinner::before,
|
|
10
|
-
|
|
11
|
-
content: '';
|
|
9
|
+
.spinner::before , .spinner::after {
|
|
10
|
+
content: "";
|
|
12
11
|
box-sizing: border-box;
|
|
13
12
|
position: absolute;
|
|
14
13
|
inset: 0px;
|
|
15
14
|
border-radius: 50%;
|
|
16
|
-
border: 5px solid #
|
|
17
|
-
animation: prixClipFix 1.5s linear infinite;
|
|
15
|
+
border: 5px solid #7D60D9;
|
|
16
|
+
animation: prixClipFix 1.5s linear infinite ;
|
|
18
17
|
}
|
|
19
|
-
.spinner::after
|
|
20
|
-
transform: rotate3d(90, 90, 0, 180deg);
|
|
21
|
-
border-color: #
|
|
18
|
+
.spinner::after{
|
|
19
|
+
transform: rotate3d(90, 90, 0, 180deg );
|
|
20
|
+
border-color: #FF3D00;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
@keyframes rotate {
|
|
25
|
-
0%
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
100% {
|
|
29
|
-
transform: rotate(360deg);
|
|
30
|
-
}
|
|
24
|
+
0% {transform: rotate(0deg)}
|
|
25
|
+
100% {transform: rotate(360deg)}
|
|
31
26
|
}
|
|
32
27
|
|
|
33
28
|
@keyframes prixClipFix {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
clippath: polygon(50% 50%, 0 0, 100% 0, 100% 0, 100% 0, 100% 0);
|
|
39
|
-
}
|
|
40
|
-
75%,
|
|
41
|
-
100% {
|
|
42
|
-
clippath: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 100% 100%, 100% 100%);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
29
|
+
0% {clip-path:polygon(50% 50%,0 0,0 0,0 0,0 0,0 0)}
|
|
30
|
+
50% {clip-path:polygon(50% 50%,0 0,100% 0,100% 0,100% 0,100% 0)}
|
|
31
|
+
75%, 100% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,100% 100%,100% 100%)}
|
|
32
|
+
}
|
|
@@ -36,7 +36,12 @@ export const RadioGroup = ({
|
|
|
36
36
|
name={name}
|
|
37
37
|
containerProps={containerProps}
|
|
38
38
|
>
|
|
39
|
-
<MuiRadioGroup
|
|
39
|
+
<MuiRadioGroup
|
|
40
|
+
onChange={onChange}
|
|
41
|
+
name={name}
|
|
42
|
+
{...rest}
|
|
43
|
+
sx={{ height: '100%', ...rest.sx }}
|
|
44
|
+
>
|
|
40
45
|
{options?.map((item, index) => (
|
|
41
46
|
<FormControlLabel
|
|
42
47
|
key={index}
|
|
@@ -49,7 +54,6 @@ export const RadioGroup = ({
|
|
|
49
54
|
/>
|
|
50
55
|
}
|
|
51
56
|
label={<Typography variant="body2">{item.label}</Typography>}
|
|
52
|
-
sx={{ marginBottom: '32px' }}
|
|
53
57
|
/>
|
|
54
58
|
))}
|
|
55
59
|
</MuiRadioGroup>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Box,
|
|
2
3
|
InputAdornment,
|
|
3
4
|
TextField,
|
|
4
5
|
TextFieldProps,
|
|
@@ -34,20 +35,22 @@ export const SearchBar = ({
|
|
|
34
35
|
};
|
|
35
36
|
|
|
36
37
|
return (
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
38
|
+
<Box margin="8px">
|
|
39
|
+
<StyledTextField
|
|
40
|
+
placeholder={placeholder}
|
|
41
|
+
label={label}
|
|
42
|
+
value={search}
|
|
43
|
+
InputProps={{
|
|
44
|
+
endAdornment: (
|
|
45
|
+
<InputAdornment position="end">
|
|
46
|
+
<SearchIcon />
|
|
47
|
+
</InputAdornment>
|
|
48
|
+
),
|
|
49
|
+
}}
|
|
50
|
+
{...rest}
|
|
51
|
+
onChange={handleChange}
|
|
52
|
+
/>
|
|
53
|
+
</Box>
|
|
51
54
|
);
|
|
52
55
|
};
|
|
53
56
|
|
|
@@ -51,11 +51,12 @@ export type SingleSelectProps = {
|
|
|
51
51
|
error?: any;
|
|
52
52
|
helperText?: string;
|
|
53
53
|
type?: 'input' | 'filter';
|
|
54
|
+
disableClear?: boolean;
|
|
54
55
|
} & Omit<
|
|
55
56
|
AutocompleteProps<
|
|
56
57
|
{ label: string; subLabel?: string; value: any } | any,
|
|
57
58
|
false,
|
|
58
|
-
|
|
59
|
+
true,
|
|
59
60
|
false
|
|
60
61
|
>,
|
|
61
62
|
| 'options'
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useTheme } from '@mui/material';
|
|
2
|
+
import { Button } from '../../export';
|
|
3
|
+
import { FooterContainer } from '../../styles';
|
|
4
|
+
|
|
5
|
+
export const MenuFooter = ({ onClick }: { onClick: () => void }) => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
return (
|
|
8
|
+
<FooterContainer direction="row" alignItems="center">
|
|
9
|
+
<Button
|
|
10
|
+
variant="text"
|
|
11
|
+
onClick={onClick}
|
|
12
|
+
sx={{
|
|
13
|
+
fontFamily: 'Heebo',
|
|
14
|
+
minWidth: '0px',
|
|
15
|
+
margin: '0px 16px',
|
|
16
|
+
}}
|
|
17
|
+
disableRipple
|
|
18
|
+
color={theme.palette.text.tertiary}
|
|
19
|
+
>
|
|
20
|
+
Clear
|
|
21
|
+
</Button>
|
|
22
|
+
</FooterContainer>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Typography } from '../../../DataDisplay/Typography/Typography';
|
|
2
|
+
import { Spinner } from '../../../Feedback/Spinner/Spinner';
|
|
3
|
+
import { FooterContainer } from '../../styles';
|
|
4
|
+
|
|
5
|
+
export const OptionsLoader = ({ isSearch }: { isSearch: boolean }) => {
|
|
6
|
+
return (
|
|
7
|
+
<FooterContainer direction="row" alignItems="center">
|
|
8
|
+
<Spinner />
|
|
9
|
+
<Typography variant="caption">
|
|
10
|
+
{isSearch ? 'Searching' : 'Loading Options'}
|
|
11
|
+
</Typography>
|
|
12
|
+
</FooterContainer>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
AutocompleteCloseReason,
|
|
4
4
|
FormControlLabel,
|
|
5
5
|
RadioGroup as MuiRadioGroup,
|
|
6
|
-
Paper,
|
|
7
6
|
Radio,
|
|
8
7
|
useTheme,
|
|
9
8
|
} from '@mui/material';
|
|
10
9
|
import { startCase } from 'lodash';
|
|
11
10
|
import { SyntheticEvent, useState } from 'react';
|
|
11
|
+
import { EmptyIllustration } from '../../../DataDisplay/EmptyIllustration/EmptyIllustration';
|
|
12
12
|
import {
|
|
13
13
|
Button,
|
|
14
14
|
DropdownMenu,
|
|
@@ -17,9 +17,10 @@ import {
|
|
|
17
17
|
SingleSelectProps,
|
|
18
18
|
Typography,
|
|
19
19
|
} from '../../../export';
|
|
20
|
-
import {
|
|
21
|
-
import { OptionContainer } from '../../styles';
|
|
20
|
+
import { FilterOptionContainer } from '../../styles';
|
|
22
21
|
import { SingleSelectState } from '../singleSelectReducer';
|
|
22
|
+
import { MenuFooter } from './MenuFooter';
|
|
23
|
+
import { OptionsLoader } from './OptionsLoader';
|
|
23
24
|
|
|
24
25
|
declare module '@mui/material/Autocomplete' {
|
|
25
26
|
interface AutocompletePaperSlotPropsOverrides {
|
|
@@ -28,19 +29,6 @@ declare module '@mui/material/Autocomplete' {
|
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
const CustomPaper = (props: any) => (
|
|
32
|
-
<Paper
|
|
33
|
-
{...props}
|
|
34
|
-
sx={{
|
|
35
|
-
boxShadow: 'none',
|
|
36
|
-
borderRadius: '0px 0px 4px 4px',
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
{props.children}
|
|
40
|
-
<OptionsLoader loading={props.loadingOptions} isSearch={props.isSearch} />
|
|
41
|
-
</Paper>
|
|
42
|
-
);
|
|
43
|
-
|
|
44
32
|
export type SingleFilterProps = {
|
|
45
33
|
onChange: (value: any) => void;
|
|
46
34
|
searchDb: (searchValue: string) => Promise<void>;
|
|
@@ -81,6 +69,7 @@ export const SingleFilter = ({
|
|
|
81
69
|
handleClose,
|
|
82
70
|
handleScroll,
|
|
83
71
|
state,
|
|
72
|
+
disableClear = false,
|
|
84
73
|
...restProps
|
|
85
74
|
}: SingleFilterProps) => {
|
|
86
75
|
const {
|
|
@@ -106,7 +95,7 @@ export const SingleFilter = ({
|
|
|
106
95
|
<DropdownMenu
|
|
107
96
|
menuListProps={{
|
|
108
97
|
sx: {
|
|
109
|
-
padding: '
|
|
98
|
+
padding: '0px',
|
|
110
99
|
width: '250px',
|
|
111
100
|
},
|
|
112
101
|
}}
|
|
@@ -159,15 +148,28 @@ export const SingleFilter = ({
|
|
|
159
148
|
/>
|
|
160
149
|
}
|
|
161
150
|
menuListContainerSx={{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
overflow: 'scroll',
|
|
166
|
-
overflowY: 'auto',
|
|
167
|
-
marginTop: '10px',
|
|
151
|
+
margin: '10px 5px 0px 5px',
|
|
152
|
+
height: '310px',
|
|
153
|
+
overflowY: 'scroll',
|
|
168
154
|
}}
|
|
169
155
|
handleMenuScroll={handleScroll}
|
|
170
156
|
menuSlot={({ close }) => {
|
|
157
|
+
const filteredOptions = internalOptions?.filter(
|
|
158
|
+
(option) =>
|
|
159
|
+
(localSearch && option.label.includes(localSearch)) ||
|
|
160
|
+
!localSearch,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
if (filteredOptions.length === 0 && !loadingInitialInternalOptions)
|
|
164
|
+
return (
|
|
165
|
+
<EmptyIllustration
|
|
166
|
+
message="No Options Found"
|
|
167
|
+
imageSize="100px"
|
|
168
|
+
containerProps={{
|
|
169
|
+
height: '310px',
|
|
170
|
+
}}
|
|
171
|
+
/>
|
|
172
|
+
);
|
|
171
173
|
return (
|
|
172
174
|
<MuiRadioGroup
|
|
173
175
|
onChange={(e) => {
|
|
@@ -176,50 +178,55 @@ export const SingleFilter = ({
|
|
|
176
178
|
name={name}
|
|
177
179
|
value={value}
|
|
178
180
|
>
|
|
179
|
-
{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
?.map((option, index) => (
|
|
186
|
-
<FormControlLabel
|
|
187
|
-
sx={{
|
|
188
|
-
margin: '0px',
|
|
181
|
+
{filteredOptions?.map((option, index) => (
|
|
182
|
+
<FormControlLabel
|
|
183
|
+
sx={{
|
|
184
|
+
margin: '0px',
|
|
185
|
+
width: '100%',
|
|
186
|
+
'.MuiFormControlLabel-label': {
|
|
189
187
|
width: '100%',
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
))}
|
|
188
|
+
},
|
|
189
|
+
}}
|
|
190
|
+
key={index}
|
|
191
|
+
value={option.value}
|
|
192
|
+
control={
|
|
193
|
+
<Radio
|
|
194
|
+
checkedIcon={<Icons.CheckedRadioIcon />}
|
|
195
|
+
icon={<Icons.UnCheckedRadioIcon />}
|
|
196
|
+
checked={value == option.value}
|
|
197
|
+
/>
|
|
198
|
+
}
|
|
199
|
+
label={
|
|
200
|
+
<FilterOptionContainer>
|
|
201
|
+
<Typography variant="subtitle3">
|
|
202
|
+
{dbLabelProps.useLabelStartCase
|
|
203
|
+
? startCase(option.label)
|
|
204
|
+
: option.label}
|
|
205
|
+
</Typography>
|
|
206
|
+
<Typography variant="caption">
|
|
207
|
+
{dbLabelProps.useSubLabelStartCase
|
|
208
|
+
? startCase(option?.subLabel)
|
|
209
|
+
: option?.subLabel}
|
|
210
|
+
</Typography>
|
|
211
|
+
</FilterOptionContainer>
|
|
212
|
+
}
|
|
213
|
+
/>
|
|
214
|
+
))}
|
|
218
215
|
</MuiRadioGroup>
|
|
219
216
|
);
|
|
220
217
|
}}
|
|
221
218
|
menuFooter={
|
|
222
|
-
|
|
219
|
+
loadingInternalOptions ? (
|
|
220
|
+
<OptionsLoader isSearch={!!search} />
|
|
221
|
+
) : disableClear ? (
|
|
222
|
+
<></>
|
|
223
|
+
) : (
|
|
224
|
+
<MenuFooter
|
|
225
|
+
onClick={() => {
|
|
226
|
+
onChange(null);
|
|
227
|
+
}}
|
|
228
|
+
/>
|
|
229
|
+
)
|
|
223
230
|
}
|
|
224
231
|
useMenuSlot
|
|
225
232
|
/>
|