@campxdev/react-blueprint 1.7.3 → 1.7.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.
Files changed (45) hide show
  1. package/package.json +1 -1
  2. package/src/assets/images/svg/index.ts +13 -13
  3. package/src/components/Assets/ErrorPages/InternalServerError.tsx +5 -5
  4. package/src/components/Assets/ErrorPages/NoInternetConnection.tsx +5 -5
  5. package/src/components/Assets/ErrorPages/NoItemFound.tsx +6 -5
  6. package/src/components/Assets/ErrorPages/PageNotFound.tsx +5 -5
  7. package/src/components/Assets/ErrorPages/UnAuthorized.tsx +5 -5
  8. package/src/components/Assets/ErrorPages/styles.tsx +1 -1
  9. package/src/components/Assets/Icons/IconComponents/ClearIcon.tsx +37 -0
  10. package/src/components/Assets/Icons/IconComponents/DoneSquare.tsx +2 -2
  11. package/src/components/Assets/Icons/IconComponents/DownArrow.tsx +32 -0
  12. package/src/components/Assets/Icons/IconComponents/LIneDivider.tsx +23 -0
  13. package/src/components/Assets/Icons/IconComponents/RedirectIcon.tsx +1 -1
  14. package/src/components/Assets/Icons/Icons.tsx +6 -0
  15. package/src/components/DataDisplay/ActivityLogView/ActivityLogView.tsx +2 -2
  16. package/src/components/DataDisplay/ActivityLogView/service.tsx +1 -19
  17. package/src/components/DataDisplay/DataTable/DataTable.tsx +62 -39
  18. package/src/components/DataDisplay/DataTable/TablePagination.tsx +20 -12
  19. package/src/components/DataDisplay/EmptyIllustration/EmptyIllustration.tsx +40 -0
  20. package/src/components/DataDisplay/export.ts +1 -0
  21. package/src/components/Feedback/Spinner/Spinner.css +13 -25
  22. package/src/components/Input/RadioGroup/RadioGroup.tsx +6 -2
  23. package/src/components/Input/SearchBar/SearchBar.tsx +17 -14
  24. package/src/components/Input/SingleSelect/SingleSelect.tsx +2 -1
  25. package/src/components/Input/SingleSelect/components/MenuFooter.tsx +24 -0
  26. package/src/components/Input/SingleSelect/components/OptionsLoader.tsx +14 -0
  27. package/src/components/Input/SingleSelect/components/SingleFilter.tsx +69 -62
  28. package/src/components/Input/SingleSelect/components/SingleInput.tsx +45 -18
  29. package/src/components/Input/TextField/TextField.tsx +4 -1
  30. package/src/components/Input/styles.tsx +5 -5
  31. package/src/components/Layout/PageContent/PageContent.tsx +4 -3
  32. package/src/components/Layout/PageHeader/PageHeader.tsx +22 -69
  33. package/src/components/Layout/PageHeader/components/SearchBar.tsx +69 -26
  34. package/src/components/Layout/PageHeader/components/TableColumnsSelector/TableColumnsSelector.tsx +124 -22
  35. package/src/components/Navigation/Breadcrumbs/Breadcrumbs.tsx +1 -0
  36. package/src/components/Navigation/DropDownMenu/DropDownMenu.tsx +2 -2
  37. package/src/components/Navigation/Sidebar/styles.tsx +2 -1
  38. package/src/components/Navigation/TabsContainer/TabsContainer.tsx +4 -1
  39. package/src/redux/slices/pageHeaderSlice.ts +4 -1
  40. package/src/themes/commonTheme.ts +30 -5
  41. package/src/components/DataDisplay/styles.tsx +0 -6
  42. package/src/components/Input/components/OptionsLoader.tsx +0 -22
  43. /package/src/assets/images/svg/{Emptylistmage.svg → empty.svg} +0 -0
  44. /package/src/assets/images/svg/{error-cactus.svg → error-image.svg} +0 -0
  45. /package/src/assets/images/svg/{Internalserverimage.svg → server-error.svg} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "main": "./export.ts",
5
5
  "dependencies": {
6
6
  "@emotion/react": "^11.13.3",
@@ -1,15 +1,15 @@
1
- import assignment from './assignment.svg';
2
- import emptyListImage from './Emptylistmage.svg';
3
- import errorCactus from './error-cactus.svg';
4
- import internalServerError from './Internalserverimage.svg';
5
- import noConnection from './no-connection.svg';
6
- import unAuthorized from './unauthorized.svg';
1
+ import assignmentImage from './assignment.svg';
2
+ import emptyImage from './empty.svg';
3
+ import errorImage from './error-image.svg';
4
+ import noConnectionImage from './no-connection.svg';
5
+ import serverErrorImage from './server-error.svg';
6
+ import unauthorizedImage from './unauthorized.svg';
7
7
 
8
- export const SVGs = {
9
- assignment,
10
- emptyListImage,
11
- errorCactus,
12
- internalServerError,
13
- noConnection,
14
- unAuthorized,
8
+ export {
9
+ assignmentImage,
10
+ emptyImage,
11
+ errorImage,
12
+ noConnectionImage,
13
+ serverErrorImage,
14
+ unauthorizedImage,
15
15
  };
@@ -1,14 +1,14 @@
1
- import { SVGs } from '../../../assets/export';
1
+ import { serverErrorImage } from '../../../assets/images/svg';
2
2
  import { Typography } from '../../DataDisplay/Typography/Typography';
3
3
  import { Button } from '../../export';
4
- import { StyledBox } from './styles';
4
+ import { CenterBox } from './styles';
5
5
 
6
6
  export const InternalServerError = ({ resetBoundary }: any) => {
7
7
  return (
8
8
  <>
9
- <StyledBox>
9
+ <CenterBox>
10
10
  <img
11
- src={SVGs.internalServerError}
11
+ src={serverErrorImage}
12
12
  alt="page not found"
13
13
  width={'350px'}
14
14
  style={{ margin: '20px' }}
@@ -25,7 +25,7 @@ export const InternalServerError = ({ resetBoundary }: any) => {
25
25
  >
26
26
  Try Again
27
27
  </Button>
28
- </StyledBox>
28
+ </CenterBox>
29
29
  </>
30
30
  );
31
31
  };
@@ -1,14 +1,14 @@
1
- import { SVGs } from '../../../assets/export';
1
+ import { noConnectionImage } from '../../../assets/images/svg';
2
2
  import { Typography } from '../../DataDisplay/Typography/Typography';
3
3
  import { Button } from '../../export';
4
- import { StyledBox } from './styles';
4
+ import { CenterBox } from './styles';
5
5
 
6
6
  export const NoInterneConnection = ({ resetBoundary }: any) => {
7
7
  return (
8
8
  <>
9
- <StyledBox>
9
+ <CenterBox>
10
10
  <img
11
- src={SVGs.noConnection}
11
+ src={noConnectionImage}
12
12
  alt="page not found"
13
13
  width={'350px'}
14
14
  style={{ margin: '20px' }}
@@ -27,7 +27,7 @@ export const NoInterneConnection = ({ resetBoundary }: any) => {
27
27
  >
28
28
  Try Again
29
29
  </Button>
30
- </StyledBox>
30
+ </CenterBox>
31
31
  </>
32
32
  );
33
33
  };
@@ -1,7 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
- import { SVGs } from '../../../assets/export';
2
+
3
+ import { emptyImage } from '../../../assets/images/svg';
3
4
  import { Typography } from '../../DataDisplay/Typography/Typography';
4
- import { StyledBox } from './styles';
5
+ import { CenterBox } from './styles';
5
6
 
6
7
  interface NoItemFoundProps {
7
8
  title?: string;
@@ -13,15 +14,15 @@ export const NoItemFound = ({
13
14
  description,
14
15
  }: NoItemFoundProps) => {
15
16
  return (
16
- <StyledBox>
17
+ <CenterBox>
17
18
  <img
18
- src={SVGs.emptyListImage}
19
+ src={emptyImage}
19
20
  alt="page not found"
20
21
  width="350px"
21
22
  style={{ margin: '20px' }}
22
23
  />
23
24
  <Typography variant="subtitle1">{title}</Typography>
24
25
  <Typography variant="body2">{description}</Typography>
25
- </StyledBox>
26
+ </CenterBox>
26
27
  );
27
28
  };
@@ -1,13 +1,13 @@
1
- import { SVGs } from '../../../assets/export';
1
+ import { emptyImage } from '../../../assets/images/svg';
2
2
  import { Typography } from '../../DataDisplay/Typography/Typography';
3
- import { StyledBox } from './styles';
3
+ import { CenterBox } from './styles';
4
4
 
5
5
  export const PageNotFound = () => {
6
6
  return (
7
7
  <>
8
- <StyledBox>
8
+ <CenterBox>
9
9
  <img
10
- src={SVGs.errorCactus}
10
+ src={emptyImage}
11
11
  alt="page not found"
12
12
  width={'350px'}
13
13
  style={{ margin: '20px' }}
@@ -19,7 +19,7 @@ export const PageNotFound = () => {
19
19
  <Typography variant="body2">
20
20
  Please check the URL or return to the homepage.
21
21
  </Typography>
22
- </StyledBox>
22
+ </CenterBox>
23
23
  </>
24
24
  );
25
25
  };
@@ -1,14 +1,14 @@
1
1
  import { ReactNode } from 'react';
2
- import { SVGs } from '../../../assets/export';
2
+ import { unauthorizedImage } from '../../../assets/images/svg';
3
3
  import { Typography } from '../../DataDisplay/Typography/Typography';
4
- import { StyledBox } from './styles';
4
+ import { CenterBox } from './styles';
5
5
 
6
6
  export const UnAuthorized = ({ component }: { component?: ReactNode }) => {
7
7
  return (
8
8
  <>
9
- <StyledBox>
9
+ <CenterBox>
10
10
  <img
11
- src={SVGs.unAuthorized}
11
+ src={unauthorizedImage}
12
12
  alt="page not found"
13
13
  width={'350px'}
14
14
  style={{ margin: '20px' }}
@@ -19,7 +19,7 @@ export const UnAuthorized = ({ component }: { component?: ReactNode }) => {
19
19
  </Typography>
20
20
  <Typography variant="body2">Please log in to continue.</Typography>
21
21
  {component}
22
- </StyledBox>
22
+ </CenterBox>
23
23
  </>
24
24
  );
25
25
  };
@@ -20,7 +20,7 @@ export const StyledAlert = styled(Alert)(({ theme }) => ({
20
20
  },
21
21
  }));
22
22
 
23
- export const StyledBox = styled(Box)(({ theme }) => ({
23
+ export const CenterBox = styled(Box)(({ theme }) => ({
24
24
  width: '100%',
25
25
  display: 'flex',
26
26
  flexDirection: 'column',
@@ -0,0 +1,37 @@
1
+ import { styled } from '@mui/material';
2
+
3
+ const StyledSvg = styled('svg')(({ theme }) => ({
4
+ stroke: theme.palette.text.tertiary,
5
+ fill: theme.palette.text.tertiary,
6
+ '&:hover': {
7
+ stroke: theme.palette.primary.main,
8
+ fill: theme.palette.primary.main,
9
+ },
10
+ }));
11
+
12
+ export const ClearIcon = ({
13
+ size = 16,
14
+ onClick,
15
+ }: {
16
+ size?: number;
17
+ onClick?: (e: React.MouseEvent) => void;
18
+ }) => {
19
+ return (
20
+ <StyledSvg
21
+ width={size}
22
+ onClick={onClick}
23
+ height={size}
24
+ viewBox="0 0 12 12"
25
+ fill="none"
26
+ xmlns="http://www.w3.org/2000/svg"
27
+ style={{
28
+ cursor: onClick ? 'pointer' : 'default',
29
+ }}
30
+ >
31
+ <path
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
+ stroke-width="1"
34
+ />
35
+ </StyledSvg>
36
+ );
37
+ };
@@ -11,8 +11,8 @@ export const DoneSquare = ({
11
11
  const fill = color ?? theme.palette.highlight.highlightGreen;
12
12
  return (
13
13
  <svg
14
- width="16"
15
- height="16"
14
+ width={size}
15
+ height={size}
16
16
  viewBox="0 0 16 16"
17
17
  fill="none"
18
18
  xmlns="http://www.w3.org/2000/svg"
@@ -0,0 +1,32 @@
1
+ import { useTheme } from '@mui/material';
2
+
3
+ export const DownArrow = ({
4
+ size = 16,
5
+ disabled,
6
+ onClick,
7
+ }: {
8
+ size?: number;
9
+ disabled?: boolean;
10
+ onClick?: (e: React.MouseEvent<SVGSVGElement>) => void;
11
+ }) => {
12
+ const theme = useTheme();
13
+ return (
14
+ <svg
15
+ onClick={onClick}
16
+ width={size}
17
+ height={size}
18
+ viewBox="0 0 16 16"
19
+ fill="none"
20
+ xmlns="http://www.w3.org/2000/svg"
21
+ >
22
+ <path
23
+ d="M7.99896 11.734C8.1371 11.7329 8.2694 11.6782 8.36803 11.5815L8.37443 11.5783L14.2411 5.7116C14.3411 5.61159 14.3972 5.47595 14.3972 5.33453C14.3972 5.19311 14.3411 5.05748 14.2411 4.95747C14.1411 4.85748 14.0054 4.80131 13.864 4.80131C13.7226 4.80131 13.587 4.85748 13.487 4.95747L7.99896 10.446L2.5099 4.95693C2.40988 4.85695 2.27425 4.80078 2.13283 4.80078C1.99141 4.80078 1.85578 4.85695 1.75576 4.95693C1.65578 5.05695 1.59961 5.19258 1.59961 5.334C1.59961 5.47542 1.65578 5.61105 1.75576 5.71107L7.62243 11.5777L7.62776 11.5809C7.72699 11.6781 7.86007 11.733 7.99896 11.734Z"
24
+ fill={theme.palette.text.primary}
25
+ stroke={theme.palette.text.primary}
26
+ fillOpacity={disabled ? 0.5 : 1}
27
+ strokeOpacity={disabled ? 0.5 : 1}
28
+ stroke-width="1"
29
+ />
30
+ </svg>
31
+ );
32
+ };
@@ -0,0 +1,23 @@
1
+ import { useTheme } from '@mui/material';
2
+
3
+ export const LineDividerIcon = ({
4
+ size = 16,
5
+ height = 20, // Default height
6
+ }: {
7
+ size?: number;
8
+ height?: number;
9
+ }) => {
10
+ const theme = useTheme();
11
+ const color = theme.palette.border.primary;
12
+ return (
13
+ <svg
14
+ width={size}
15
+ height={height}
16
+ viewBox="0 0 1 20"
17
+ fill="none"
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ >
20
+ <line x1="0.0" y1="-2.18557e-08" x2="0.500001" y2="20" stroke={color} />
21
+ </svg>
22
+ );
23
+ };
@@ -1,6 +1,6 @@
1
1
  import { useTheme } from '@mui/material';
2
2
  export const RedirectIcon = ({
3
- size = 16,
3
+ size = 20,
4
4
  color,
5
5
  opacity = '0.5',
6
6
  }: {
@@ -25,6 +25,7 @@ import { CertificateIcon } from './IconComponents/CertificatesIcon';
25
25
  import { CetIcon } from './IconComponents/CetIcon';
26
26
  import { CheckedCheckboxIcon } from './IconComponents/CheckedCheckBoxIcon';
27
27
  import { CheckedRadioIcon } from './IconComponents/CheckedRadioIcon';
28
+ import { ClearIcon } from './IconComponents/ClearIcon';
28
29
  import { ClogWheelIcon } from './IconComponents/ClogWheelIcon';
29
30
  import { CollapseIcon } from './IconComponents/CollapseIcon';
30
31
  import { ColumnsIcon } from './IconComponents/ColumnsIcon';
@@ -43,6 +44,7 @@ import { DeleteIcon } from './IconComponents/DeleteIcon';
43
44
  import { DeviceIcon } from './IconComponents/DeviceIcon';
44
45
  import { DocumentIcon } from './IconComponents/DocumentIcon';
45
46
  import { DoneSquare } from './IconComponents/DoneSquare';
47
+ import { DownArrow } from './IconComponents/DownArrow';
46
48
  import { DownloadIcon } from './IconComponents/DownloadIcon';
47
49
  import { EditIcon } from './IconComponents/EditIcon';
48
50
  import { EmailIcon } from './IconComponents/EmailIcon';
@@ -65,6 +67,7 @@ import { ImportIcon } from './IconComponents/ImportIcon';
65
67
  import { InfoFilledIcon } from './IconComponents/InfoFilledIcon';
66
68
  import { InfoIcon } from './IconComponents/InfoIcon';
67
69
  import { InstitutionsIcon } from './IconComponents/InstitutionsIcon';
70
+ import { LineDividerIcon } from './IconComponents/LIneDivider';
68
71
  import { LeadsIcon } from './IconComponents/LeadsIcon';
69
72
  import { LeftIcon } from './IconComponents/LeftIcon';
70
73
  import { LocationIcon } from './IconComponents/LocationIcon';
@@ -242,4 +245,7 @@ export const Icons = {
242
245
  TransactionCardIcon,
243
246
  ObeIcon,
244
247
  SettlementsIcon,
248
+ DownArrow,
249
+ ClearIcon,
250
+ LineDividerIcon,
245
251
  };
@@ -4,10 +4,10 @@ import { format, isToday } from 'date-fns';
4
4
  import _ from 'lodash';
5
5
  import { useState } from 'react';
6
6
  import { Button, DatePicker, Spinner } from '../../export';
7
+ import { EmptyIllustration } from '../EmptyIllustration/EmptyIllustration';
7
8
  import {
8
9
  ActivityIcon,
9
10
  convertUTCtoIST,
10
- NoDataFound,
11
11
  ScrollToTopButton,
12
12
  useIntersectionObserver,
13
13
  } from './service';
@@ -175,7 +175,7 @@ export const ActivityLogView = ({
175
175
  <Spinner />
176
176
  </StyledSpinnerBox>
177
177
  ) : activitiesData.length === 0 ? (
178
- <NoDataFound message={'No data found'} />
178
+ <EmptyIllustration message={'No data found'} />
179
179
  ) : (
180
180
  Object.entries(groupedActivities).map(([section, activities]) => (
181
181
  <Box key={section}>
@@ -1,9 +1,7 @@
1
1
  import { ArrowUpward, Info } from '@mui/icons-material';
2
- import { Box, Fab, Typography } from '@mui/material';
2
+ import { Box, Fab } from '@mui/material';
3
3
  import { addHours, addMinutes, parseISO } from 'date-fns';
4
4
  import { useCallback, useRef } from 'react';
5
- import { SVGs } from '../../../assets/images/svg';
6
- import { StyledBox } from '../../Assets/ErrorPages/styles';
7
5
  import { ActivityAction } from '../../export';
8
6
  import { CreateIcon, DeleteIcon, UpdateIcon } from './Icons';
9
7
 
@@ -63,22 +61,6 @@ export const ScrollToTopButton = () => {
63
61
  );
64
62
  };
65
63
 
66
- export const NoDataFound = ({ message }: { message: string }) => {
67
- return (
68
- <>
69
- <StyledBox>
70
- <img
71
- src={SVGs.emptyListImage}
72
- alt="page not found"
73
- width={'350px'}
74
- style={{ margin: '20px' }}
75
- />
76
- <Typography variant="subtitle1">{message}</Typography>
77
- </StyledBox>
78
- </>
79
- );
80
- };
81
-
82
64
  export function useIntersectionObserver(callback: () => void) {
83
65
  const observer = useRef<IntersectionObserver | null>(null);
84
66
 
@@ -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 { limit, offset, totalCount, onPageChange, onLimitChange } = props;
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
- <DataGridContainer>
23
- <MuiDataGrid
24
- disableColumnFilter
25
- disableColumnMenu
26
- disableColumnSorting
27
- getRowId={(row) => row.id ?? v4()}
28
- {...props}
29
- slots={{
30
- ...props.slots,
31
- pagination: () => {
32
- if (
33
- limit === undefined ||
34
- offset === undefined ||
35
- totalCount === undefined ||
36
- onPageChange === undefined ||
37
- onLimitChange === undefined
38
- ) {
39
- return <></>;
40
- }
41
- const pages = Math.ceil(totalCount / limit);
42
- const currentPage = Math.ceil(offset / limit) + 1;
43
- return (
44
- <TablePagination
45
- count={pages}
46
- page={currentPage}
47
- limit={limit}
48
- offset={offset}
49
- totalCount={totalCount}
50
- onPageChange={onPageChange}
51
- onLimitChange={onLimitChange}
52
- />
53
- );
54
- },
55
- }}
56
- />
57
- </DataGridContainer>
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 } = props;
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
- <Stack
25
- direction="row"
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
- </Stack>
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';