@groupeactual/ui-kit 1.7.10 → 2.0.0-beta.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.
Files changed (143) hide show
  1. package/dist/cjs/index.js +15095 -66
  2. package/dist/es/{src/DesignSystemProvider.d.ts → DesignSystemProvider.d.ts} +6 -5
  3. package/dist/es/{src/components → components}/Accordion/Accordion.d.ts +1 -1
  4. package/dist/es/{src/components → components}/BannerNotification/BannerNotification.d.ts +1 -1
  5. package/dist/es/{src/components → components}/Breadcrumbs/Breadcrumbs.d.ts +2 -2
  6. package/dist/es/{src/components → components}/Button/Button.d.ts +2 -2
  7. package/dist/es/{src/components → components}/Chip/Chip.d.ts +1 -1
  8. package/dist/es/components/Datatable/Datatable.d.ts +4 -0
  9. package/dist/es/{src/components → components}/EmbbededNotification/EmbeddedNotification.d.ts +1 -1
  10. package/dist/es/{src/components/UploadDocument → components/FileUploader}/FileUploader.d.ts +1 -1
  11. package/dist/es/components/Form/AutoCompleteMulti/AutoCompleteMulti.d.ts +23 -0
  12. package/dist/es/{src/components → components}/Form/AutoCompleteSingle/AutoCompleteSingle.d.ts +8 -5
  13. package/dist/es/components/Form/Checkbox/Checkbox.d.ts +12 -0
  14. package/dist/es/components/Form/CheckboxGroup/CheckboxGroup.d.ts +12 -0
  15. package/dist/es/components/Form/CheckboxGroup/checkboxgroup.interface.d.ts +6 -0
  16. package/dist/es/{src/components → components}/Form/DatePicker/DatePicker.d.ts +6 -4
  17. package/dist/es/{src/components → components}/Form/MultiSelect/MultiSelect.d.ts +3 -3
  18. package/dist/es/components/Form/RadioGroup/RadioGroup.d.ts +16 -0
  19. package/dist/es/{src/components → components}/Form/Select/Select.d.ts +3 -3
  20. package/dist/es/components/Form/Switch/Switch.d.ts +11 -0
  21. package/dist/es/{src/components → components}/Form/TextField/TextField.d.ts +6 -5
  22. package/dist/es/{src/components → components}/Form/TimePicker/TimePicker.d.ts +3 -3
  23. package/dist/es/{src/components → components}/IconButton/IconButton.d.ts +3 -3
  24. package/dist/es/components/IconProvider/IconProvider.d.ts +24 -0
  25. package/dist/es/{src/components → components}/Link/Link.d.ts +1 -2
  26. package/dist/es/components/MenuItem/MenuItem.d.ts +9 -0
  27. package/dist/es/components/Modal/Dialog/Dialog.d.ts +4 -0
  28. package/dist/es/components/Modal/Drawer/Drawer.d.ts +4 -0
  29. package/dist/es/{src/components → components}/Navigation/Stepper/Stepper.d.ts +1 -1
  30. package/dist/es/{src/components → components}/Pagination/Pagination.d.ts +2 -1
  31. package/dist/es/{src/components → components}/Snackbar/Snackbar.d.ts +1 -1
  32. package/dist/es/components/TabsPanel/TabsPanel.d.ts +4 -0
  33. package/dist/es/components/TabsPanel/index.d.ts +1 -0
  34. package/dist/es/components/TabsPanel/tab.interface.d.ts +17 -0
  35. package/dist/es/components/Text/Text.d.ts +8 -0
  36. package/dist/es/{src/components → components}/Tooltip/Tooltip.d.ts +1 -1
  37. package/dist/es/{src/components → components}/index.d.ts +3 -2
  38. package/dist/es/index.d.ts +104 -152
  39. package/dist/es/index.js +37 -79
  40. package/package.json +20 -17
  41. package/src/DesignSystemProvider.tsx +21 -36
  42. package/src/components/Accordion/Accordion.tsx +41 -59
  43. package/src/components/BannerNotification/BannerNotification.tsx +19 -20
  44. package/src/components/Breadcrumbs/Breadcrumbs.tsx +32 -28
  45. package/src/components/Button/Button.tsx +70 -17
  46. package/src/components/Chip/Chip.tsx +88 -117
  47. package/src/components/Datatable/Datatable.tsx +49 -37
  48. package/src/components/Datatable/DatatableCellRender.tsx +1 -1
  49. package/src/components/EmbbededNotification/EmbeddedNotification.tsx +78 -69
  50. package/src/components/FileUploader/FileUploader.tsx +767 -0
  51. package/src/components/Form/AutoCompleteMulti/AutoCompleteMulti.tsx +289 -172
  52. package/src/components/Form/AutoCompleteSingle/AutoCompleteSingle.tsx +228 -126
  53. package/src/components/Form/Checkbox/Checkbox.tsx +38 -96
  54. package/src/components/Form/CheckboxGroup/CheckboxGroup.tsx +86 -60
  55. package/src/components/Form/CheckboxGroup/checkboxgroup.interface.ts +0 -15
  56. package/src/components/Form/DatePicker/DatePicker.tsx +88 -40
  57. package/src/components/Form/MultiSelect/MultiSelect.tsx +196 -171
  58. package/src/components/Form/RadioGroup/RadioGroup.tsx +76 -82
  59. package/src/components/Form/Select/Select.tsx +156 -136
  60. package/src/components/Form/Switch/Switch.tsx +87 -47
  61. package/src/components/Form/TextField/TextField.tsx +125 -76
  62. package/src/components/Form/TimePicker/TimePicker.tsx +26 -7
  63. package/src/components/IconButton/IconButton.tsx +64 -39
  64. package/src/components/IconProvider/IconProvider.tsx +88 -69
  65. package/src/components/Link/Link.tsx +6 -10
  66. package/src/components/MenuItem/MenuItem.tsx +35 -23
  67. package/src/components/Modal/Dialog/Dialog.tsx +17 -14
  68. package/src/components/Modal/Drawer/Drawer.tsx +95 -74
  69. package/src/components/Navigation/Stepper/Step.tsx +7 -6
  70. package/src/components/Navigation/Stepper/Stepper.tsx +24 -23
  71. package/src/components/NotistackAdapter/NotistackAdapter.tsx +1 -1
  72. package/src/components/Pagination/Pagination.tsx +131 -118
  73. package/src/components/Snackbar/Snackbar.tsx +29 -29
  74. package/src/components/TabsPanel/TabsPanel.tsx +151 -0
  75. package/src/components/TabsPanel/index.ts +1 -0
  76. package/src/components/TabsPanel/tab.interface.ts +20 -0
  77. package/src/components/Text/Text.tsx +25 -12
  78. package/src/components/Tooltip/Tooltip.tsx +54 -51
  79. package/src/components/index.ts +3 -2
  80. package/src/index.ts +0 -1
  81. package/dist/es/src/components/Datatable/Datatable.d.ts +0 -4
  82. package/dist/es/src/components/Form/AutoCompleteMulti/AutoCompleteMulti.d.ts +0 -19
  83. package/dist/es/src/components/Form/Checkbox/Checkbox.d.ts +0 -14
  84. package/dist/es/src/components/Form/CheckboxGroup/CheckboxGroup.d.ts +0 -12
  85. package/dist/es/src/components/Form/CheckboxGroup/checkboxgroup.interface.d.ts +0 -8
  86. package/dist/es/src/components/Form/RadioGroup/RadioGroup.d.ts +0 -18
  87. package/dist/es/src/components/Form/Switch/Switch.d.ts +0 -10
  88. package/dist/es/src/components/IconProvider/IconProvider.d.ts +0 -19
  89. package/dist/es/src/components/MenuItem/MenuItem.d.ts +0 -10
  90. package/dist/es/src/components/Modal/Dialog/Dialog.d.ts +0 -4
  91. package/dist/es/src/components/Modal/Drawer/Drawer.d.ts +0 -4
  92. package/dist/es/src/components/Text/Text.d.ts +0 -8
  93. package/dist/es/src/index.d.ts +0 -5
  94. package/dist/es/src/interfaces/theme.d.ts +0 -51
  95. package/src/components/UploadDocument/FileUploader.tsx +0 -728
  96. package/src/interfaces/theme.ts +0 -51
  97. /package/dist/es/{src/components → components}/Accordion/index.d.ts +0 -0
  98. /package/dist/es/{src/components → components}/BannerNotification/index.d.ts +0 -0
  99. /package/dist/es/{src/components → components}/Breadcrumbs/index.d.ts +0 -0
  100. /package/dist/es/{src/components → components}/Button/index.d.ts +0 -0
  101. /package/dist/es/{src/components → components}/Chip/index.d.ts +0 -0
  102. /package/dist/es/{src/components → components}/Datatable/DatatableCellRender.d.ts +0 -0
  103. /package/dist/es/{src/components → components}/Datatable/datatable.interface.d.ts +0 -0
  104. /package/dist/es/{src/components → components}/Datatable/index.d.ts +0 -0
  105. /package/dist/es/{src/components → components}/Datatable/use-pagination-props.hook.d.ts +0 -0
  106. /package/dist/es/{src/components → components}/EmbbededNotification/index.d.ts +0 -0
  107. /package/dist/es/{src/components/UploadDocument → components/FileUploader}/fileuploader.interface.d.ts +0 -0
  108. /package/dist/es/{src/components/UploadDocument → components/FileUploader}/index.d.ts +0 -0
  109. /package/dist/es/{src/components → components}/Form/AutoCompleteMulti/index.d.ts +0 -0
  110. /package/dist/es/{src/components → components}/Form/AutoCompleteSingle/index.d.ts +0 -0
  111. /package/dist/es/{src/components → components}/Form/Checkbox/index.d.ts +0 -0
  112. /package/dist/es/{src/components → components}/Form/CheckboxGroup/index.d.ts +0 -0
  113. /package/dist/es/{src/components → components}/Form/DatePicker/index.d.ts +0 -0
  114. /package/dist/es/{src/components → components}/Form/MultiSelect/index.d.ts +0 -0
  115. /package/dist/es/{src/components → components}/Form/RadioGroup/index.d.ts +0 -0
  116. /package/dist/es/{src/components → components}/Form/Select/index.d.ts +0 -0
  117. /package/dist/es/{src/components → components}/Form/Switch/index.d.ts +0 -0
  118. /package/dist/es/{src/components → components}/Form/TextField/index.d.ts +0 -0
  119. /package/dist/es/{src/components → components}/Form/TimePicker/index.d.ts +0 -0
  120. /package/dist/es/{src/components → components}/IconButton/index.d.ts +0 -0
  121. /package/dist/es/{src/components → components}/IconProvider/index.d.ts +0 -0
  122. /package/dist/es/{src/components → components}/Link/index.d.ts +0 -0
  123. /package/dist/es/{src/components → components}/MenuItem/index.d.ts +0 -0
  124. /package/dist/es/{src/components → components}/Modal/Dialog/index.d.ts +0 -0
  125. /package/dist/es/{src/components → components}/Modal/Drawer/index.d.ts +0 -0
  126. /package/dist/es/{src/components → components}/Modal/modal.interface.d.ts +0 -0
  127. /package/dist/es/{src/components → components}/Navigation/Stepper/Step.d.ts +0 -0
  128. /package/dist/es/{src/components → components}/Navigation/Stepper/index.d.ts +0 -0
  129. /package/dist/es/{src/components → components}/Navigation/Stepper/stepper.helper.d.ts +0 -0
  130. /package/dist/es/{src/components → components}/Navigation/Stepper/stepper.interface.d.ts +0 -0
  131. /package/dist/es/{src/components → components}/NotistackAdapter/NotistackAdapter.d.ts +0 -0
  132. /package/dist/es/{src/components → components}/NotistackAdapter/index.d.ts +0 -0
  133. /package/dist/es/{src/components → components}/Pagination/index.d.ts +0 -0
  134. /package/dist/es/{src/components → components}/Pagination/pagination.helper.d.ts +0 -0
  135. /package/dist/es/{src/components → components}/Snackbar/index.d.ts +0 -0
  136. /package/dist/es/{src/components → components}/Text/index.d.ts +0 -0
  137. /package/dist/es/{src/components → components}/Tooltip/index.d.ts +0 -0
  138. /package/dist/es/{src/components → components}/Tooltip/tooltip.interface.d.ts +0 -0
  139. /package/dist/es/{src/helpers → helpers}/GooglePickerWrapper.d.ts +0 -0
  140. /package/dist/es/{src/hooks → hooks}/useGooleDrivePicker.d.ts +0 -0
  141. /package/dist/es/{src/types → types}/googleDrive.d.ts +0 -0
  142. /package/src/components/{UploadDocument → FileUploader}/fileuploader.interface.ts +0 -0
  143. /package/src/components/{UploadDocument → FileUploader}/index.ts +0 -0
@@ -1,17 +1,10 @@
1
- import React, { MouseEvent, useMemo, useRef, useState } from 'react';
1
+ import React, { MouseEvent, useState } from 'react';
2
2
 
3
3
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
4
- import { ChipStyle } from '@groupeactual/design-tokens';
5
- import {
6
- Box,
7
- Chip as ChipMUI,
8
- ChipProps as ChipPropsMUI,
9
- Tooltip,
10
- styled,
11
- useTheme,
12
- } from '@mui/material';
4
+ import { Box, Chip as ChipMUI, ChipProps as ChipPropsMUI } from '@mui/material';
13
5
 
14
6
  import IconProvider from '@/components/IconProvider';
7
+ import Tooltip from '@/components/Tooltip';
15
8
 
16
9
  interface Props
17
10
  extends Omit<
@@ -29,120 +22,98 @@ interface Props
29
22
  maxLength?: number;
30
23
  }
31
24
 
32
- const Chip = ({
33
- variant,
34
- label,
35
- prefixIcon,
36
- suffixIcon,
37
- suffixTooltip,
38
- suffixAction,
39
- tooltip,
40
- maxWidth = '100%',
41
- ...props
42
- }: Props) => {
43
- const theme = useTheme();
44
- const StyledChip = useMemo(() => styled(ChipMUI)(ChipStyle(theme)), [theme]);
25
+ const Chip = React.forwardRef<HTMLDivElement, Props>(
26
+ (
27
+ {
28
+ variant,
29
+ label,
30
+ prefixIcon,
31
+ suffixIcon,
32
+ suffixTooltip,
33
+ suffixAction,
34
+ tooltip,
35
+ maxWidth = '100%',
36
+ ...props
37
+ },
38
+ ref,
39
+ ) => {
40
+ const [isTooltipOpen, setIsTooltipOpen] = useState(false);
41
+ const [isSuffixTooltipOpen, setIsSuffixTooltipOpen] = useState(false);
45
42
 
46
- const [isTooltipOpen, setIsTooltipOpen] = useState(false);
47
- const [isSuffixTooltipOpen, setIsSuffixTooltipOpen] = useState(false);
48
-
49
- const ref = useRef<HTMLDivElement>(null);
50
-
51
- let backgroundColor: string =
52
- // eslint-disable-next-line no-nested-ternary
53
- props.color && theme.palette[props.color]
54
- ? typeof theme.palette[props.color] === 'object'
55
- ? theme.palette[props.color]['main']
56
- : theme.palette[props.color]
57
- : (props.color ?? 'white');
58
-
59
- if (variant === 'filled' || variant === 'statusFilled') {
60
- // opacity 0.08
61
- backgroundColor = `${backgroundColor}14`;
62
- } else if (variant === 'status') {
63
- backgroundColor = 'white';
64
- }
65
-
66
- return (
67
- <Tooltip title={tooltip} placement="right-start" open={isTooltipOpen}>
43
+ return (
68
44
  <Box
69
- maxWidth="fit-content"
70
45
  onMouseEnter={() => setIsTooltipOpen(true)}
71
46
  onMouseLeave={() => setIsTooltipOpen(false)}
47
+ sx={{ width: 'fit-content' }}
48
+ data-testid="ds-chip-container"
72
49
  >
73
- <Tooltip
74
- title={suffixTooltip}
75
- open={isSuffixTooltipOpen}
76
- placement="bottom-end"
77
- sx={{ cursor: suffixAction ? 'pointer !important' : 'default' }}
78
- >
79
- <StyledChip
80
- label={label}
81
- ref={ref}
82
- className={`MuiChip-${variant}`}
83
- size="small"
84
- sx={{
85
- maxWidth,
86
- backgroundColor: backgroundColor,
87
- '&.MuiChip-colorSecondary': suffixIcon &&
88
- suffixAction && {
89
- '&:hover': {
90
- borderColor: '#004f88 !important',
91
- '.MuiChip-deleteIcon': {
92
- color: '#004f88 !important',
93
- },
94
- },
95
- },
96
- '&.MuiChip-colorPrimary': suffixIcon &&
97
- suffixAction && {
98
- '&:hover': {
99
- backgroundColor: '#004f88 !important',
100
- },
101
- },
102
- '&.MuiChip-colorDefault': suffixIcon &&
103
- suffixAction && {
104
- '&:hover': {
105
- '.MuiChip-deleteIcon': {
106
- color: '#004f88 !important',
107
- },
108
- },
109
- },
110
- }}
111
- avatar={
112
- prefixIcon ? <IconProvider icon={prefixIcon} size="sm" /> : <></>
113
- }
114
- deleteIcon={
115
- suffixIcon ? (
116
- <IconProvider
117
- icon={suffixIcon}
118
- onMouseEnter={() => {
119
- if (suffixTooltip) {
120
- setIsSuffixTooltipOpen(true);
121
- setIsTooltipOpen(false);
122
- }
123
- }}
124
- onMouseLeave={() => {
125
- if (suffixTooltip) {
126
- setIsSuffixTooltipOpen(false);
127
- setIsTooltipOpen(true);
50
+ <Tooltip title={tooltip} placement="right-start" open={isTooltipOpen}>
51
+ <Tooltip
52
+ title={suffixTooltip}
53
+ open={isSuffixTooltipOpen}
54
+ placement="bottom-end"
55
+ sx={{ cursor: suffixAction ? 'pointer !important' : 'default' }}
56
+ >
57
+ <ChipMUI
58
+ label={label}
59
+ ref={ref}
60
+ size="small"
61
+ variant={variant}
62
+ sx={{
63
+ maxWidth,
64
+ }}
65
+ avatar={
66
+ prefixIcon ? (
67
+ <IconProvider
68
+ color=""
69
+ icon={prefixIcon}
70
+ size="sm"
71
+ data-testid="ds-prefix-icon"
72
+ />
73
+ ) : (
74
+ <></>
75
+ )
76
+ }
77
+ deleteIcon={
78
+ suffixIcon ? (
79
+ <IconProvider
80
+ icon={suffixIcon}
81
+ className={
82
+ suffixAction ? 'MuiChip-iconAction' : 'MuiChip-icon'
128
83
  }
129
- }}
130
- sx={{
131
- cursor: suffixAction ? 'pointer !important' : 'default',
132
- }}
133
- size="sm"
134
- />
135
- ) : (
136
- <></>
137
- )
138
- }
139
- onDelete={suffixAction ?? (() => null)}
140
- {...props}
141
- />
84
+ onMouseEnter={() => {
85
+ if (suffixTooltip) {
86
+ setIsSuffixTooltipOpen(true);
87
+ setIsTooltipOpen(false);
88
+ }
89
+ }}
90
+ onMouseLeave={() => {
91
+ if (suffixTooltip) {
92
+ setIsSuffixTooltipOpen(false);
93
+ setIsTooltipOpen(true);
94
+ }
95
+ }}
96
+ sx={{
97
+ cursor: suffixAction ? 'pointer !important' : 'default',
98
+ }}
99
+ size="sm"
100
+ data-testid="ds-suffix-icon"
101
+ />
102
+ ) : (
103
+ <></>
104
+ )
105
+ }
106
+ onDelete={suffixAction ?? (() => null)}
107
+ {...props}
108
+ data-testid="ds-chip"
109
+ />
110
+ </Tooltip>
142
111
  </Tooltip>
143
112
  </Box>
144
- </Tooltip>
145
- );
146
- };
113
+ );
114
+ },
115
+ );
116
+
117
+ Chip.displayName = 'Chip';
147
118
 
148
119
  export default Chip;
@@ -1,10 +1,9 @@
1
- import React, { Fragment, useEffect, useMemo, useState } from 'react';
1
+ import React, { Fragment, useEffect, useState } from 'react';
2
2
 
3
3
  import {
4
4
  faArrowDownLong,
5
5
  faArrowUpLong,
6
6
  } from '@fortawesome/pro-regular-svg-icons';
7
- import { DatatableStyle } from '@groupeactual/design-tokens';
8
7
  import {
9
8
  Box,
10
9
  Table,
@@ -14,8 +13,6 @@ import {
14
13
  TableHead,
15
14
  TableRow,
16
15
  TableSortLabel,
17
- styled,
18
- useTheme,
19
16
  } from '@mui/material';
20
17
 
21
18
  import IconButton from '@/components/IconButton';
@@ -25,19 +22,28 @@ import Text from '@/components/Text';
25
22
  import { RowDetail as D, Props } from './datatable.interface';
26
23
  import usePaginationProps from './use-pagination-props.hook';
27
24
 
28
- const Datatable = <T extends object>({
29
- onLoad,
30
- onSort = () => undefined,
31
- sortInfo = null,
32
- withHeader = false,
33
- withPagination,
34
- columns,
35
- isTableLayoutFixed = false,
36
- ...props
37
- }: Props<T>) => {
25
+ function fixedForwardRef<T, P = {}>(
26
+ render: (_props: P, _ref: React.Ref<T>) => React.ReactNode,
27
+ ): (_props: P & React.RefAttributes<T>) => React.ReactNode {
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ return React.forwardRef(render as any) as any;
30
+ }
31
+
32
+ const DatatableComponent = <T extends object>(
33
+ {
34
+ onLoad,
35
+ onSort = () => undefined,
36
+ sortInfo = null,
37
+ withHeader = false,
38
+ withPagination,
39
+ columns,
40
+ isTableLayoutFixed = false,
41
+ ...props
42
+ }: Props<T>,
43
+ ref: React.ForwardedRef<HTMLTableElement>,
44
+ ) => {
38
45
  const { trans, limits, withTopPagination, hideTotal, setPage, setLimit } =
39
46
  usePaginationProps<T>(props);
40
- const theme = useTheme();
41
47
 
42
48
  const [currentRows, setCurrentRows] = useState<T[] | (T & D)[]>();
43
49
  const [currentPage, setCurrentPage] = useState<number>();
@@ -48,11 +54,6 @@ const Datatable = <T extends object>({
48
54
  const isAsc = sortInfo?.direction === 'asc';
49
55
  const hasTopTitle = columns.some(({ topTitle }) => topTitle);
50
56
 
51
- const StyledDatatable = useMemo(
52
- () => styled(Box)(DatatableStyle(theme)),
53
- [theme],
54
- );
55
-
56
57
  useEffect(() => {
57
58
  onLoad()
58
59
  .then((data) => {
@@ -84,19 +85,21 @@ const Datatable = <T extends object>({
84
85
  );
85
86
 
86
87
  return (
87
- <StyledDatatable>
88
+ <Box ref={ref} data-testid="ds-datatable">
88
89
  {withTopPagination && <SyncedPagination />}
89
90
  <TableContainer
90
91
  sx={{ display: 'flex', maxWidth: '100%', overflow: 'auto' }}
92
+ data-testid="ds-table-container"
91
93
  >
92
94
  <Table
93
95
  sx={{
94
96
  tableLayout: isTableLayoutFixed ? 'fixed' : 'auto',
95
97
  }}
98
+ data-testid="ds-table"
96
99
  >
97
100
  {withHeader && (
98
- <TableHead>
99
- <TableRow data-testid="datatable-head-row">
101
+ <TableHead data-testid="ds-table-head">
102
+ <TableRow data-testid="ds-datatable-head-row">
100
103
  {columns.map(
101
104
  ({
102
105
  name,
@@ -117,10 +120,14 @@ const Datatable = <T extends object>({
117
120
  width: width,
118
121
  height: hasTopTitle ? '55px' : 'inherit',
119
122
  }}
123
+ data-testid={`ds-table-cell-head-${name}`}
120
124
  >
121
125
  {hasTopTitle && (
122
- <Box height={24}>
123
- <Text variant="body2Regular">{topTitle}</Text>
126
+ <Box
127
+ sx={{ mb: 1, height: '16px' }}
128
+ data-testid={`ds-top-title-${name}`}
129
+ >
130
+ <Text variant="body1Medium">{topTitle}</Text>
124
131
  </Box>
125
132
  )}
126
133
  {(sortable && (
@@ -148,7 +155,7 @@ const Datatable = <T extends object>({
148
155
  IconComponent={() => (
149
156
  <IconButton
150
157
  icon={isAsc ? faArrowUpLong : faArrowDownLong}
151
- variant="table"
158
+ variant="plain"
152
159
  size="small"
153
160
  sx={{
154
161
  visibility:
@@ -156,30 +163,28 @@ const Datatable = <T extends object>({
156
163
  ? 'visible'
157
164
  : 'hidden',
158
165
  }}
166
+ data-testid={`ds-sort-icon-${name}`}
159
167
  />
160
168
  )}
169
+ data-testid={`ds-sort-label-${name}`}
161
170
  >
162
171
  <Box
163
172
  sx={{
164
173
  pr: 1,
165
- fontWeight: 500,
166
- lineHeight: '16px',
167
- fontSize: '13px',
168
174
  }}
175
+ data-testid={`ds-title-${name}`}
169
176
  >
170
- {title}
177
+ <Text variant="body1">{title}</Text>
171
178
  </Box>
172
179
  </TableSortLabel>
173
180
  )) || (
174
181
  <Box
175
182
  sx={{
176
183
  pr: 1,
177
- fontWeight: 500,
178
- lineHeight: '16px',
179
- fontSize: '13px',
180
184
  }}
185
+ data-testid={`ds-title-${name}`}
181
186
  >
182
- {title}
187
+ <Text variant="body1">{title}</Text>
183
188
  </Box>
184
189
  )}
185
190
  </TableCell>
@@ -189,10 +194,10 @@ const Datatable = <T extends object>({
189
194
  </TableRow>
190
195
  </TableHead>
191
196
  )}
192
- <TableBody>
197
+ <TableBody data-testid="ds-table-body">
193
198
  {currentRows?.map((record, index) => (
194
199
  <Fragment key={index}>
195
- <TableRow data-testid="datatable-body-row">
200
+ <TableRow data-testid="ds-datatable-body-row">
196
201
  {columns.map(({ name, width, render }) => (
197
202
  <TableCell
198
203
  key={name}
@@ -207,6 +212,7 @@ const Datatable = <T extends object>({
207
212
  ? '0px'
208
213
  : 'default',
209
214
  }}
215
+ data-testid={`ds-table-cell-body-${name}`}
210
216
  >
211
217
  {render(record)}
212
218
  </TableCell>
@@ -219,12 +225,14 @@ const Datatable = <T extends object>({
219
225
  width: record.width,
220
226
  borderColor: 'greyLightDefaultBorder',
221
227
  }}
228
+ data-testid={`ds-details-row-${index}`}
222
229
  >
223
230
  <TableCell
224
231
  sx={{
225
232
  columnSpan: columns.length,
226
233
  borderBottom: 'none',
227
234
  }}
235
+ data-testid={`ds-details-cell-${index}`}
228
236
  >
229
237
  {record.details}
230
238
  </TableCell>
@@ -236,8 +244,12 @@ const Datatable = <T extends object>({
236
244
  </Table>
237
245
  </TableContainer>
238
246
  {withPagination && <SyncedPagination />}
239
- </StyledDatatable>
247
+ </Box>
240
248
  );
241
249
  };
242
250
 
251
+ DatatableComponent.displayName = 'Datatable';
252
+
253
+ const Datatable = fixedForwardRef(DatatableComponent);
254
+
243
255
  export default Datatable;
@@ -11,7 +11,7 @@ const DatatableCellRender = ({ data }: { data: string }): JSX.Element => {
11
11
  return (
12
12
  <Tooltip title={data} placement="bottom-start">
13
13
  <Text
14
- variant="body2Regular"
14
+ variant="body2"
15
15
  style={{
16
16
  whiteSpace: 'nowrap',
17
17
  overflow: 'hidden',
@@ -7,7 +7,7 @@ import {
7
7
  faCircleInfo,
8
8
  faCircleXmark,
9
9
  } from '@fortawesome/pro-solid-svg-icons';
10
- import { Box, BoxProps } from '@mui/material';
10
+ import { Box, BoxProps, useTheme } from '@mui/material';
11
11
 
12
12
  import Text from '@/components//Text';
13
13
  import Icon from '@/components/IconProvider';
@@ -19,83 +19,92 @@ interface Props extends BoxProps {
19
19
  actionButton?: ReactNode;
20
20
  }
21
21
 
22
- const EmbeddedNotification = ({
23
- title,
24
- text,
25
- variant = 'infos',
26
- actionButton,
27
- ...props
28
- }: Props) => {
29
- interface EmbeddedNotifVariant {
30
- color: string;
31
- icon: IconDefinition;
32
- }
22
+ interface EmbeddedNotifVariant {
23
+ color: string;
24
+ icon: IconDefinition;
25
+ }
26
+
27
+ const EmbeddedNotification = React.forwardRef<HTMLDivElement, Props>(
28
+ ({ title, text, variant = 'infos', actionButton, ...props }, ref) => {
29
+ const { spacing } = useTheme();
33
30
 
34
- const variantNotification: Record<string, EmbeddedNotifVariant> = {
35
- warning: {
36
- color: 'orangeWarning',
37
- icon: faCircleExclamation,
38
- },
39
- error: {
40
- color: 'redError',
41
- icon: faCircleXmark,
42
- },
43
- success: {
44
- color: 'greenSuccess',
45
- icon: faCircleCheck,
46
- },
47
- infos: {
48
- color: 'blueInfo',
49
- icon: faCircleInfo,
50
- },
51
- };
31
+ const variantNotification: Record<string, EmbeddedNotifVariant> = {
32
+ warning: {
33
+ color: 'orangeWarning',
34
+ icon: faCircleExclamation,
35
+ },
36
+ error: {
37
+ color: 'redError',
38
+ icon: faCircleXmark,
39
+ },
40
+ success: {
41
+ color: 'greenSuccess',
42
+ icon: faCircleCheck,
43
+ },
44
+ infos: {
45
+ color: 'blueInfo',
46
+ icon: faCircleInfo,
47
+ },
48
+ };
52
49
 
53
- return (
54
- <Box
55
- border="1px solid"
56
- borderColor={variantNotification[variant].color}
57
- p="8px 16px"
58
- borderRadius="4px"
59
- display="flex"
60
- alignItems={text ? 'flex-start' : 'center'}
61
- justifyContent={text ? 'flex-start' : 'center'}
62
- {...props}
63
- >
64
- <Icon
65
- icon={variantNotification[variant].icon}
66
- color={variantNotification[variant].color}
67
- mr="16px"
68
- mt={text ? '1px' : 0}
69
- />
70
- <Box display="flex" flexDirection="column" paddingRight={4}>
71
- <Text
72
- align="left"
73
- variant="body1Bold"
50
+ return (
51
+ <Box
52
+ ref={ref}
53
+ border="1px solid"
54
+ borderColor={variantNotification[variant].color}
55
+ p={spacing(2, 4)}
56
+ borderRadius="4px"
57
+ display="flex"
58
+ alignItems={text ? 'flex-start' : 'center'}
59
+ justifyContent={text ? 'flex-start' : 'center'}
60
+ {...props}
61
+ data-testid="ds-embedded-notification"
62
+ >
63
+ <Icon
64
+ icon={variantNotification[variant].icon}
74
65
  color={variantNotification[variant].color}
75
- display="inline-block"
76
- >
77
- {title}
78
- </Text>
79
- {text && (
66
+ mr={4}
67
+ mt={text ? '1px' : 0}
68
+ data-testid="ds-icon"
69
+ />
70
+ <Box display="flex" flexDirection="column" paddingRight={4}>
80
71
  <Text
81
72
  align="left"
82
- variant="body1Regular"
83
- color="greyDark"
73
+ variant="body1Bold"
74
+ color={variantNotification[variant].color}
84
75
  display="inline-block"
85
- paddingTop="4px"
76
+ data-testid="ds-title"
86
77
  >
87
- {text}
78
+ {title}
88
79
  </Text>
80
+ {text && (
81
+ <Text
82
+ align="left"
83
+ variant="body1"
84
+ color="greyDark"
85
+ display="inline-block"
86
+ pt={1}
87
+ data-testid="ds-text"
88
+ >
89
+ {text}
90
+ </Text>
91
+ )}
92
+ </Box>
93
+ <Box flexGrow={2} />
94
+ {actionButton && (
95
+ <Box
96
+ alignSelf="center"
97
+ whiteSpace="nowrap"
98
+ data-testid="ds-action-button"
99
+ >
100
+ {actionButton}
101
+ </Box>
89
102
  )}
90
103
  </Box>
91
- <Box flexGrow={2} />
92
- {actionButton && (
93
- <Box alignSelf="center" whiteSpace="nowrap">
94
- {actionButton}
95
- </Box>
96
- )}
97
- </Box>
98
- );
99
- };
104
+ );
105
+ },
106
+ );
107
+
108
+ EmbeddedNotification.displayName = 'EmbeddedNotification';
100
109
 
101
110
  export default EmbeddedNotification;