@groupeactual/ui-kit 1.1.4 → 1.2.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.
Files changed (36) hide show
  1. package/dist/cjs/index.js +8 -8
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/Datatable/Datatable.d.ts +1 -4
  4. package/dist/cjs/types/components/Datatable/datatable.interface.d.ts +32 -15
  5. package/dist/cjs/types/components/Datatable/use-pagination-props.hook.d.ts +3 -0
  6. package/dist/cjs/types/components/IconButton/IconButton.d.ts +15 -0
  7. package/dist/cjs/types/components/IconButton/index.d.ts +1 -0
  8. package/dist/cjs/types/components/Pagination/Pagination.d.ts +3 -3
  9. package/dist/cjs/types/components/Tooltip/Tooltip.d.ts +5 -4
  10. package/dist/cjs/types/components/Tooltip/tooltip.interface.d.ts +1 -0
  11. package/dist/cjs/types/components/index.d.ts +1 -0
  12. package/dist/es/index.d.ts +97 -68
  13. package/dist/es/index.mjs +6 -6
  14. package/dist/es/index.mjs.map +1 -1
  15. package/dist/es/types/components/Datatable/Datatable.d.ts +1 -4
  16. package/dist/es/types/components/Datatable/datatable.interface.d.ts +32 -15
  17. package/dist/es/types/components/Datatable/use-pagination-props.hook.d.ts +3 -0
  18. package/dist/es/types/components/IconButton/IconButton.d.ts +15 -0
  19. package/dist/es/types/components/IconButton/index.d.ts +1 -0
  20. package/dist/es/types/components/Pagination/Pagination.d.ts +3 -3
  21. package/dist/es/types/components/Tooltip/Tooltip.d.ts +5 -4
  22. package/dist/es/types/components/Tooltip/tooltip.interface.d.ts +1 -0
  23. package/dist/es/types/components/index.d.ts +1 -0
  24. package/package.json +2 -2
  25. package/src/components/Datatable/Datatable.tsx +129 -144
  26. package/src/components/Datatable/datatable.interface.ts +35 -15
  27. package/src/components/Datatable/use-pagination-props.hook.ts +44 -0
  28. package/src/components/IconButton/IconButton.tsx +50 -0
  29. package/src/components/IconButton/index.ts +1 -0
  30. package/src/components/Pagination/Pagination.tsx +8 -6
  31. package/src/components/Tooltip/Tooltip.tsx +18 -42
  32. package/src/components/Tooltip/tooltip.interface.ts +14 -0
  33. package/src/components/index.ts +1 -0
  34. package/dist/cjs/types/components/Datatable/datatable.helper.d.ts +0 -10
  35. package/dist/es/types/components/Datatable/datatable.helper.d.ts +0 -10
  36. package/src/components/Datatable/datatable.helper.ts +0 -21
@@ -16,18 +16,18 @@ import { getTotalPages } from './pagination.helper';
16
16
  interface Props {
17
17
  totalString: string;
18
18
  totalPerPageString: string;
19
- limitsPerPage: number[];
20
19
  totalRows: number;
21
- setLimit?: (limit: number) => void;
22
- setPage?: (page: number) => void;
20
+ limitsPerPage?: number[];
23
21
  page?: number;
24
22
  limit?: number;
23
+ setPage?: (page: number) => void;
24
+ setLimit?: (limit: number) => void;
25
25
  }
26
26
 
27
27
  const Pagination = ({
28
28
  totalString,
29
29
  totalPerPageString,
30
- limitsPerPage,
30
+ limitsPerPage = [5, 10, 20],
31
31
  setLimit,
32
32
  setPage,
33
33
  page = 1,
@@ -83,6 +83,7 @@ const Pagination = ({
83
83
  display="flex"
84
84
  flexDirection="row"
85
85
  justifyContent="flex-end"
86
+ alignItems="center"
86
87
  sx={{
87
88
  paddingTop: '16px',
88
89
  paddingBottom: '24px'
@@ -108,6 +109,7 @@ const Pagination = ({
108
109
  getRenderValue={(value) => value.toString()}
109
110
  width={75}
110
111
  sx={{
112
+ backgroundColor: 'white',
111
113
  '&.MuiInputBase-root': {
112
114
  height: '32px !important'
113
115
  }
@@ -116,8 +118,8 @@ const Pagination = ({
116
118
  <Text
117
119
  color="greyXDark"
118
120
  variant="body1Regular"
119
- pt="6px"
120
- pl="6px"
121
+ pt="10px"
122
+ pl="8px"
121
123
  pr="16px"
122
124
  >
123
125
  {totalPerPageString}
@@ -1,45 +1,30 @@
1
- import React, { ReactNode, useMemo } from 'react';
1
+ import { ReactElement, useMemo } from 'react';
2
+
2
3
  import {
3
- IconButton,
4
4
  Tooltip as TooltipMui,
5
5
  TooltipProps,
6
- tooltipClasses,
7
- styled
6
+ styled,
7
+ tooltipClasses
8
8
  } from '@mui/material';
9
-
10
-
9
+ import { Box } from '@mui/material';
11
10
 
12
11
  import Text from '../Text/Text';
12
+ import { Placement } from './tooltip.interface';
13
13
 
14
14
  interface Props extends Omit<TooltipProps, 'icon' | 'children' | 'placement'> {
15
15
  title: string;
16
- children: ReactNode;
17
- placement?:
18
- | 'right'
19
- | 'bottom'
20
- | 'left'
21
- | 'top'
22
- | 'bottom-end'
23
- | 'bottom-start'
24
- | 'left-end'
25
- | 'left-start'
26
- | 'right-end'
27
- | 'right-start'
28
- | 'top-end'
29
- | 'top-start'
30
- | undefined;
16
+ children: ReactElement;
17
+ placement?: Placement;
31
18
  }
32
19
 
33
- const Tooltip = ({
34
- title,
35
- children,
36
- placement,
37
- ...props
38
- }: Props) => {
20
+ const Tooltip = ({ title, children, placement, ...tooltipProps }: Props) => {
21
+ if (!title) {
22
+ return <>{children}</>;
23
+ }
39
24
  const StyledTooltip = useMemo(
40
25
  () =>
41
- styled(({ className, ...props }: TooltipProps) => (
42
- <TooltipMui {...props} classes={{ popper: className }} />
26
+ styled(({ className, ...tooltipProps }: TooltipProps) => (
27
+ <TooltipMui {...tooltipProps} classes={{ popper: className }} />
43
28
  ))(({ theme }) => ({
44
29
  [`& .${tooltipClasses.tooltip}`]: {
45
30
  backgroundColor: theme.palette.greyXDark,
@@ -72,6 +57,7 @@ const Tooltip = ({
72
57
  })),
73
58
  []
74
59
  );
60
+
75
61
  return (
76
62
  <StyledTooltip
77
63
  {...(placement ? { placement } : {})}
@@ -80,21 +66,11 @@ const Tooltip = ({
80
66
  {title}
81
67
  </Text>
82
68
  }
83
- {...props}
69
+ {...tooltipProps}
84
70
  >
85
- <IconButton
86
- sx={{
87
- padding: '4px !important',
88
- '&.MuiIconButton-root:hover': {
89
- backgroundColor: 'unset'
90
- },
91
- '.MuiTouchRipple-root': {
92
- display: 'none'
93
- }
94
- }}
95
- >
71
+ <Box p={1} component="span">
96
72
  {children}
97
- </IconButton>
73
+ </Box>
98
74
  </StyledTooltip>
99
75
  );
100
76
  };
@@ -0,0 +1,14 @@
1
+ export type Placement =
2
+ | 'right'
3
+ | 'bottom'
4
+ | 'left'
5
+ | 'top'
6
+ | 'bottom-end'
7
+ | 'bottom-start'
8
+ | 'left-end'
9
+ | 'left-start'
10
+ | 'right-end'
11
+ | 'right-start'
12
+ | 'top-end'
13
+ | 'top-start'
14
+ | undefined;
@@ -24,3 +24,4 @@ export { default as Stepper } from './Stepper/Stepper';
24
24
  export { default as Switch } from './Form/Switch/Switch';
25
25
  export { default as DatePicker } from './Form/DatePicker';
26
26
  export { default as Datatable } from './Datatable/Datatable';
27
+ export { default as IconButton } from './IconButton/IconButton';
@@ -1,10 +0,0 @@
1
- import { Row } from './datatable.interface';
2
- /**
3
- * Compares two objects based on a specified property in descending order.
4
- *
5
- * @param a - The first object in the comparison.
6
- * @param b - The second object in the comparison.
7
- * @param orderBy - The property of the objects to base the comparison on.
8
- * @returns A number indicating the order of the objects.
9
- */
10
- export declare const descendingComparator: <T>(a: T | (T & Row), b: T | (T & Row), orderBy?: string) => number;
@@ -1,10 +0,0 @@
1
- import { Row } from './datatable.interface';
2
- /**
3
- * Compares two objects based on a specified property in descending order.
4
- *
5
- * @param a - The first object in the comparison.
6
- * @param b - The second object in the comparison.
7
- * @param orderBy - The property of the objects to base the comparison on.
8
- * @returns A number indicating the order of the objects.
9
- */
10
- export declare const descendingComparator: <T>(a: T | (T & Row), b: T | (T & Row), orderBy?: string) => number;
@@ -1,21 +0,0 @@
1
- import { Row } from './datatable.interface';
2
-
3
- /**
4
- * Compares two objects based on a specified property in descending order.
5
- *
6
- * @param a - The first object in the comparison.
7
- * @param b - The second object in the comparison.
8
- * @param orderBy - The property of the objects to base the comparison on.
9
- * @returns A number indicating the order of the objects.
10
- */
11
- export const descendingComparator = <T>(
12
- a: T | (T & Row),
13
- b: T | (T & Row),
14
- orderBy?: string
15
- ): number => {
16
- if (!orderBy) {
17
- return 0;
18
- }
19
-
20
- return b[orderBy] < a[orderBy] ? -1 : b[orderBy] > a[orderBy] ? 1 : 0;
21
- };