@groupeactual/ui-kit 1.7.0-beta.0 → 1.7.0-beta.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.
Files changed (84) hide show
  1. package/dist/cjs/index.js +9 -9
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/es/index.d.ts +176 -163
  4. package/dist/es/index.js +8 -18
  5. package/dist/es/index.js.map +1 -1
  6. package/dist/es/src/components/Accordion/Accordion.d.ts +1 -4
  7. package/dist/es/src/components/BannerNotification/BannerNotification.d.ts +1 -4
  8. package/dist/es/src/components/Breadcrumbs/Breadcrumbs.d.ts +1 -4
  9. package/dist/es/src/components/Button/Button.d.ts +1 -4
  10. package/dist/es/src/components/Chip/Chip.d.ts +2 -5
  11. package/dist/es/src/components/Datatable/Datatable.d.ts +1 -1
  12. package/dist/es/src/components/Datatable/datatable.interface.d.ts +5 -4
  13. package/dist/es/src/components/EmbbededNotification/EmbeddedNotification.d.ts +1 -4
  14. package/dist/es/src/components/Form/AutoCompleteMulti/AutoCompleteMulti.d.ts +7 -6
  15. package/dist/es/src/components/Form/AutoCompleteSingle/AutoCompleteSingle.d.ts +5 -7
  16. package/dist/es/src/components/Form/Checkbox/Checkbox.d.ts +4 -7
  17. package/dist/es/src/components/Form/CheckboxGroup/CheckboxGroup.d.ts +4 -12
  18. package/dist/es/src/components/Form/CheckboxGroup/checkboxgroup.interface.d.ts +8 -0
  19. package/dist/es/src/components/Form/DatePicker/DatePicker.d.ts +1 -1
  20. package/dist/es/src/components/Form/MultiSelect/MultiSelect.d.ts +4 -7
  21. package/dist/es/src/components/Form/RadioGroup/RadioGroup.d.ts +2 -5
  22. package/dist/es/src/components/Form/Select/Select.d.ts +5 -7
  23. package/dist/es/src/components/Form/Switch/Switch.d.ts +1 -4
  24. package/dist/es/src/components/Form/TextField/TextField.d.ts +5 -6
  25. package/dist/es/src/components/Form/TimePicker/TimePicker.d.ts +20 -0
  26. package/dist/es/src/components/Form/TimePicker/index.d.ts +1 -0
  27. package/dist/es/src/components/IconButton/IconButton.d.ts +5 -7
  28. package/dist/es/src/components/IconProvider/IconProvider.d.ts +1 -4
  29. package/dist/es/src/components/Link/Link.d.ts +1 -4
  30. package/dist/es/src/components/MenuItem/MenuItem.d.ts +7 -10
  31. package/dist/es/src/components/Navigation/Stepper/Step.d.ts +1 -1
  32. package/dist/es/src/components/Navigation/Stepper/Stepper.d.ts +1 -1
  33. package/dist/es/src/components/Pagination/Pagination.d.ts +3 -6
  34. package/dist/es/src/components/Snackbar/Snackbar.d.ts +1 -4
  35. package/dist/es/src/components/Text/Text.d.ts +1 -4
  36. package/dist/es/src/components/Tooltip/Tooltip.d.ts +5 -7
  37. package/dist/es/src/components/UploadDocument/FileUploaderSingle.d.ts +55 -8
  38. package/dist/es/src/components/UploadDocument/fileuploadersingle.interface.d.ts +5 -0
  39. package/dist/es/src/components/index.d.ts +2 -0
  40. package/dist/es/src/helpers/GooglePickerWrapper.d.ts +2 -1
  41. package/dist/es/src/hooks/useGooleDrivePicker.d.ts +1 -1
  42. package/package.json +20 -20
  43. package/src/components/Accordion/Accordion.tsx +4 -4
  44. package/src/components/BannerNotification/BannerNotification.tsx +0 -2
  45. package/src/components/Breadcrumbs/Breadcrumbs.tsx +0 -2
  46. package/src/components/Button/Button.tsx +0 -2
  47. package/src/components/Chip/Chip.tsx +1 -3
  48. package/src/components/Datatable/Datatable.tsx +27 -6
  49. package/src/components/Datatable/DatatableCellRender.tsx +2 -1
  50. package/src/components/Datatable/datatable.interface.ts +5 -4
  51. package/src/components/Datatable/use-pagination-props.hook.ts +2 -2
  52. package/src/components/EmbbededNotification/EmbeddedNotification.tsx +0 -2
  53. package/src/components/Form/AutoCompleteMulti/AutoCompleteMulti.tsx +24 -9
  54. package/src/components/Form/AutoCompleteSingle/AutoCompleteSingle.tsx +15 -10
  55. package/src/components/Form/Checkbox/Checkbox.tsx +22 -25
  56. package/src/components/Form/CheckboxGroup/CheckboxGroup.tsx +8 -25
  57. package/src/components/Form/CheckboxGroup/checkboxgroup.interface.ts +22 -0
  58. package/src/components/Form/DatePicker/DatePicker.tsx +15 -3
  59. package/src/components/Form/MultiSelect/MultiSelect.tsx +33 -7
  60. package/src/components/Form/RadioGroup/RadioGroup.tsx +18 -23
  61. package/src/components/Form/Select/Select.tsx +34 -6
  62. package/src/components/Form/Switch/Switch.tsx +0 -2
  63. package/src/components/Form/TextField/TextField.tsx +120 -107
  64. package/src/components/Form/TimePicker/TimePicker.tsx +228 -0
  65. package/src/components/Form/TimePicker/index.ts +1 -0
  66. package/src/components/IconButton/IconButton.tsx +12 -6
  67. package/src/components/IconProvider/IconProvider.tsx +3 -4
  68. package/src/components/Link/Link.tsx +0 -2
  69. package/src/components/MenuItem/MenuItem.tsx +10 -39
  70. package/src/components/Navigation/Stepper/Step.tsx +1 -1
  71. package/src/components/Navigation/Stepper/Stepper.tsx +1 -1
  72. package/src/components/Pagination/Pagination.tsx +4 -5
  73. package/src/components/Snackbar/Snackbar.tsx +0 -2
  74. package/src/components/Text/Text.tsx +0 -2
  75. package/src/components/Tooltip/Tooltip.tsx +41 -32
  76. package/src/components/UploadDocument/FileUploaderSingle.tsx +185 -88
  77. package/src/components/UploadDocument/fileuploadersingle.interface.ts +5 -0
  78. package/src/components/index.ts +2 -0
  79. package/src/helpers/GooglePickerWrapper.tsx +2 -2
  80. package/src/hooks/useGooleDrivePicker.ts +8 -6
  81. package/src/types/global.d.ts +6 -4
  82. package/src/types/googleDrive.ts +1 -0
  83. package/dist/es/src/helpers/dataGetValue.d.ts +0 -2
  84. package/src/helpers/dataGetValue.ts +0 -22
@@ -0,0 +1,228 @@
1
+ import React, { MouseEventHandler, useEffect, useRef, useState } from 'react';
2
+
3
+ import { faCheck, faClock } from '@fortawesome/pro-regular-svg-icons';
4
+ import { Popover, PopoverProps, TextFieldProps } from '@mui/material';
5
+ import { DigitalClock, LocalizationProvider } from '@mui/x-date-pickers-pro';
6
+ import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs';
7
+ import { enUS, frFR } from '@mui/x-date-pickers/locales';
8
+ import dayjs, { Dayjs } from 'dayjs';
9
+
10
+ import TextField from '@/components/Form/TextField';
11
+ import IconProvider from '@/components/IconProvider';
12
+
13
+ interface Props extends Omit<TextFieldProps, 'error' | 'onChange'> {
14
+ value: Dayjs | undefined;
15
+ onChange?: (_time: string | Dayjs | undefined) => void;
16
+ onTouched?: () => void;
17
+ label?: string;
18
+ helperText?: string;
19
+ minTime?: Dayjs;
20
+ maxTime?: Dayjs;
21
+ timeStep?: number;
22
+ error?: string;
23
+ disabled?: boolean;
24
+ width?: string | number;
25
+ locale?: 'fr' | 'en';
26
+ color?: 'success';
27
+ }
28
+
29
+ const TimePicker = ({
30
+ value,
31
+ label = '',
32
+ helperText = '',
33
+ error,
34
+ disabled = false,
35
+ minTime = dayjs().hour(8).minute(0),
36
+ maxTime = dayjs().hour(19).minute(0),
37
+ timeStep = 15,
38
+ locale = 'fr',
39
+ width,
40
+ color,
41
+ onTouched,
42
+ onChange,
43
+ ...props
44
+ }: Props) => {
45
+ const [customError, setCustomError] = useState<string | null>(null);
46
+ const [textHour, setTextHour] = useState<string>(
47
+ value && typeof value !== 'string' ? value.format('HH:mm') : '',
48
+ );
49
+ const [displayedMinTime, setDisplayedMinTime] = useState<Dayjs | undefined>(
50
+ undefined,
51
+ );
52
+ const [anchorEl, setAnchorEl] = useState<PopoverProps['anchorEl'] | null>(
53
+ null,
54
+ );
55
+ const [textHourFixed, setTextHourFixed] = useState<boolean>(false);
56
+ const [textfieldWidth, setTextfieldWidth] = useState<number | undefined>(
57
+ undefined,
58
+ );
59
+ const textFieldRef = useRef<HTMLDivElement>(null); // Reference for the TextField
60
+
61
+ const isOpen = Boolean(anchorEl);
62
+
63
+ const handleClick: MouseEventHandler = (_event: React.MouseEvent) => {
64
+ if (disabled) return;
65
+ if (textHour === '') setTextHour('HH:mm');
66
+ setAnchorEl(textFieldRef.current);
67
+ };
68
+
69
+ const handleClose = () => {
70
+ onTouched?.();
71
+ setAnchorEl(null);
72
+ };
73
+
74
+ const handleChange = (
75
+ e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
76
+ ) => {
77
+ if (/H/.test(e.target.value) || e.target.value === '' || !e.target.value) {
78
+ setTextHour('');
79
+ setCustomError(null);
80
+ onChange?.(undefined);
81
+ } else {
82
+ const inputValue = e.target.value;
83
+ const numericValue = inputValue.replace(/[^\d]/g, '');
84
+ const formattedValue =
85
+ numericValue.slice(0, 2) +
86
+ (numericValue.length > 2 ? ':' + numericValue.slice(2) : '');
87
+
88
+ if (formattedValue !== '') {
89
+ setTextHour(formattedValue);
90
+ } else {
91
+ setTextHour('');
92
+ }
93
+
94
+ const dayjsTime = dayjs(inputValue, 'HH:mm', true);
95
+ const isValidTime = dayjsTime.isValid();
96
+ if (!isValidTime) {
97
+ if (!e.target?.value || e.target.value === 'HH:mm') {
98
+ setCustomError(null);
99
+ return;
100
+ }
101
+ setCustomError(error || '');
102
+ onChange?.(e.target.value);
103
+ return;
104
+ }
105
+ setCustomError(null);
106
+ onChange?.(dayjsTime);
107
+ }
108
+ };
109
+
110
+ useEffect(() => {
111
+ if (minTime && !displayedMinTime) {
112
+ setDisplayedMinTime(minTime.subtract(timeStep, 'minute'));
113
+ }
114
+ }, [minTime]);
115
+
116
+ useEffect(() => {
117
+ if (!value || textHour || textHourFixed) return;
118
+ setTextHourFixed(true);
119
+ setTextHour(
120
+ value && typeof value !== 'string' ? value?.format('HH:mm') : '',
121
+ );
122
+ }, [value]);
123
+
124
+ useEffect(() => {
125
+ if (textFieldRef.current) {
126
+ setTextfieldWidth(textFieldRef.current.offsetWidth);
127
+ }
128
+ }, [textFieldRef.current, textHour]);
129
+
130
+ return (
131
+ <>
132
+ <TextField
133
+ {...props}
134
+ ref={textFieldRef}
135
+ data-testid="select-hour"
136
+ fullWidth
137
+ error={customError || error}
138
+ label={label}
139
+ helperText={customError ?? helperText}
140
+ onChange={handleChange}
141
+ focused={isOpen}
142
+ value={textHour}
143
+ disabled={disabled}
144
+ width={width}
145
+ color={color}
146
+ endAdornment={
147
+ color === 'success' ? (
148
+ <IconProvider
149
+ onClick={handleClick}
150
+ sx={{
151
+ ':hover': {
152
+ cursor: disabled ? 'auto' : 'pointer',
153
+ },
154
+ }}
155
+ icon={faCheck}
156
+ color="greenSuccess"
157
+ />
158
+ ) : (
159
+ <IconProvider
160
+ onClick={handleClick}
161
+ sx={{
162
+ ':hover': {
163
+ cursor: disabled ? 'auto' : 'pointer',
164
+ },
165
+ }}
166
+ icon={faClock}
167
+ />
168
+ )
169
+ }
170
+ />
171
+ <Popover
172
+ data-testid="select-hour_popover"
173
+ open={isOpen}
174
+ anchorEl={anchorEl}
175
+ onClose={handleClose}
176
+ slotProps={{
177
+ paper: {
178
+ sx: {
179
+ boxShadow: '0px 2px 10px 0px #2727271F',
180
+ },
181
+ },
182
+ }}
183
+ anchorOrigin={{
184
+ vertical: 'bottom',
185
+ horizontal: 'left',
186
+ }}
187
+ transformOrigin={{
188
+ vertical: 'top',
189
+ horizontal: 'left',
190
+ }}
191
+ sx={{
192
+ marginTop: helperText !== '' ? '-20px' : '0px',
193
+ }}
194
+ >
195
+ <LocalizationProvider
196
+ dateAdapter={AdapterDayjs}
197
+ adapterLocale={locale}
198
+ localeText={
199
+ locale == 'fr'
200
+ ? frFR.components.MuiLocalizationProvider.defaultProps.localeText
201
+ : enUS.components.MuiLocalizationProvider.defaultProps.localeText
202
+ }
203
+ >
204
+ <DigitalClock
205
+ data-testid="select-hour_digital_clock"
206
+ timeStep={timeStep}
207
+ value={value && typeof value === 'object' ? value : null}
208
+ onChange={(time) => {
209
+ setTextHour(time ? time.format('HH:mm') : '');
210
+ setCustomError(null);
211
+ if (time) onChange?.(time);
212
+ handleClose();
213
+ }}
214
+ ampm={false}
215
+ sx={{
216
+ width: textfieldWidth,
217
+ '& .MuiMenuItem-root.Mui-disabled': { display: 'none' },
218
+ }}
219
+ minTime={displayedMinTime}
220
+ maxTime={maxTime}
221
+ />
222
+ </LocalizationProvider>
223
+ </Popover>
224
+ </>
225
+ );
226
+ };
227
+
228
+ export default TimePicker;
@@ -0,0 +1 @@
1
+ export { default } from './TimePicker';
@@ -1,4 +1,4 @@
1
- import React, { useMemo } from 'react';
1
+ import React, { MouseEventHandler, useMemo } from 'react';
2
2
 
3
3
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
4
4
  import { IconButtonStyle } from '@groupeactual/design-tokens';
@@ -15,7 +15,7 @@ import IconProvider from '@/components/IconProvider';
15
15
  import Tooltip from '@/components/Tooltip';
16
16
  import { Placement } from '@/components/Tooltip/tooltip.interface';
17
17
 
18
- interface Props extends IconButtonProps {
18
+ interface Props extends Omit<IconButtonProps, 'color'> {
19
19
  icon: IconDefinition;
20
20
  variant?: 'default' | 'table';
21
21
  positionGroup?: 'left' | 'middle' | 'right';
@@ -23,7 +23,8 @@ interface Props extends IconButtonProps {
23
23
  tooltipPosition?: Placement;
24
24
  size?: 'small' | 'medium';
25
25
  sx?: SxProps<Theme>;
26
- onClick?: (e) => void;
26
+ color?: string;
27
+ onClick?: MouseEventHandler | undefined;
27
28
  }
28
29
 
29
30
  const IconButton = ({
@@ -33,6 +34,8 @@ const IconButton = ({
33
34
  tooltipText = '',
34
35
  tooltipPosition = 'top',
35
36
  size = 'medium',
37
+ color,
38
+ onClick,
36
39
  ...iconButtonProps
37
40
  }: Props) => {
38
41
  const theme = useTheme();
@@ -46,14 +49,17 @@ const IconButton = ({
46
49
  className={`IconButtonVariant-${variant} IconButtonSize-${size} ${
47
50
  positionGroup ? `IconButtonPositionGroup-${positionGroup}` : ''
48
51
  } `}
52
+ onClick={onClick}
49
53
  {...iconButtonProps}
50
54
  >
51
- <IconProvider icon={icon} size={size === 'small' ? 'sm' : 'md'} />
55
+ <IconProvider
56
+ color={color}
57
+ icon={icon}
58
+ size={size === 'small' ? 'sm' : 'md'}
59
+ />
52
60
  </StyledIconButton>
53
61
  </Tooltip>
54
62
  );
55
63
  };
56
64
 
57
- IconButton.displayName = 'IconButton';
58
-
59
65
  export default IconButton;
@@ -111,7 +111,8 @@ const IconProvider = ({
111
111
  ...sx,
112
112
  color: usedColor,
113
113
  width: usedFontSize,
114
- height: size,
114
+ height: usedFontSize,
115
+ lineHeight: usedFontSize + 'px',
115
116
  display: 'inline-flex',
116
117
  alignItems: 'center',
117
118
  justifyContent: 'center',
@@ -136,12 +137,10 @@ const IconProvider = ({
136
137
  }, [variant, size]);
137
138
 
138
139
  return (
139
- <Box component="span" sx={getStyles()} {...props}>
140
+ <Box className="itemIcon" component="span" sx={getStyles()} {...props}>
140
141
  <FontAwesomeSvgIcon icon={icon} fontSize={usedFontSize} />
141
142
  </Box>
142
143
  );
143
144
  };
144
145
 
145
- IconProvider.displayName = 'IconProvider';
146
-
147
146
  export default IconProvider;
@@ -15,6 +15,4 @@ const Link = (props: Props) => {
15
15
  return <StyledLink {...(props as LinkProps)} />;
16
16
  };
17
17
 
18
- Link.displayName = 'Link';
19
-
20
18
  export default Link;
@@ -1,35 +1,21 @@
1
- import React, { useMemo } from 'react';
1
+ import React, { ReactNode, useMemo } from 'react';
2
2
 
3
- import { IconDefinition } from '@fortawesome/pro-regular-svg-icons';
4
3
  import { MenuItemStyle } from '@groupeactual/design-tokens';
5
4
  import {
6
- Box,
7
5
  MenuItem as MenuItemMUI,
8
6
  MenuItemProps,
9
7
  styled,
10
8
  useTheme,
11
9
  } from '@mui/material';
12
10
 
13
- import IconProvider from '@/components/IconProvider';
14
- import Text from '@/components/Text';
15
-
16
- interface Props extends MenuItemProps {
17
- testId: string;
18
- onAction: (value?: string) => void;
19
- icon?: IconDefinition;
20
- text: string;
21
- value?: string;
11
+ interface Props extends Omit<MenuItemProps, 'onClick'> {
12
+ onClick: (_event?: React.MouseEvent<HTMLElement>) => void;
13
+ children: NonNullable<ReactNode>;
14
+ testId?: string;
22
15
  disabled?: boolean;
23
16
  }
24
17
 
25
- const MenuItemCustom = ({
26
- onAction,
27
- icon,
28
- text,
29
- testId,
30
- value,
31
- disabled,
32
- }: Props) => {
18
+ const MenuItem = ({ onClick, children, testId, disabled, ...props }: Props) => {
33
19
  const theme = useTheme();
34
20
  const StyledMenuItem = useMemo(
35
21
  () => styled(MenuItemMUI)(MenuItemStyle(theme)),
@@ -37,29 +23,14 @@ const MenuItemCustom = ({
37
23
  );
38
24
  return (
39
25
  <StyledMenuItem
26
+ {...props}
40
27
  disabled={disabled}
41
- value={value || text}
42
- onClick={() => onAction(value)}
28
+ onClick={(e) => onClick(e)}
43
29
  data-testid={testId}
44
30
  >
45
- <Box gap={1} display="flex">
46
- {icon && (
47
- <IconProvider
48
- icon={icon}
49
- size="sm"
50
- color="bleuClickable"
51
- sx={{
52
- '&:hover': {
53
- color: 'blueHoverClickable',
54
- },
55
- }}
56
- data-testid={`${testId}-icon`}
57
- />
58
- )}
59
- <Text variant="body2">{text}</Text>
60
- </Box>
31
+ {children}
61
32
  </StyledMenuItem>
62
33
  );
63
34
  };
64
35
 
65
- export default MenuItemCustom;
36
+ export default MenuItem;
@@ -17,7 +17,7 @@ export const StepComponent = ({
17
17
  }: {
18
18
  step: Step;
19
19
  canNavigate: boolean;
20
- onNavigate: (link: string) => void;
20
+ onNavigate: (_link: string) => void;
21
21
  }) => {
22
22
  const percent = stepperItemsToPercent(items);
23
23
  const isFullyValidated = percent === 100;
@@ -9,7 +9,7 @@ import { Step } from './stepper.interface';
9
9
  interface Props {
10
10
  steps: Step[];
11
11
  canNavigate: boolean;
12
- onNavigate?: (url: string) => void;
12
+ onNavigate?: (_url: string) => void;
13
13
  sx?: SxProps<Theme>;
14
14
  }
15
15
  const Stepper = ({
@@ -22,8 +22,8 @@ interface Props {
22
22
  limitsPerPage?: number[];
23
23
  page?: number;
24
24
  limit?: number;
25
- setPage?: (page: number) => void;
26
- setLimit?: (limit: number) => void;
25
+ setPage?: (_page: number) => void;
26
+ setLimit?: (_limit: number) => void;
27
27
  }
28
28
 
29
29
  const Pagination = ({
@@ -88,7 +88,7 @@ const Pagination = ({
88
88
  }}
89
89
  >
90
90
  <Box display="flex" alignItems="center">
91
- <Text variant="body1Bold">
91
+ <Text variant="body1Medium">
92
92
  {totalRows} {totalString}
93
93
  </Text>
94
94
  <Divider
@@ -104,6 +104,7 @@ const Pagination = ({
104
104
  className="dac-select-label"
105
105
  labelId="select-label"
106
106
  value={internalLimit}
107
+ inputProps={{ MenuProps: { disableScrollLock: true } }}
107
108
  onChange={handleChangeLimit}
108
109
  options={limitsPerPage}
109
110
  getRenderValue={(value) => value.toString()}
@@ -138,6 +139,4 @@ const Pagination = ({
138
139
  );
139
140
  };
140
141
 
141
- Pagination.displayName = 'Pagination';
142
-
143
142
  export default Pagination;
@@ -45,6 +45,4 @@ const Snackbar = ({ text, severity }: Props) => {
45
45
  );
46
46
  };
47
47
 
48
- Snackbar.displayName = 'Snackbar';
49
-
50
48
  export default Snackbar;
@@ -33,6 +33,4 @@ const Text = (props: Props) => (
33
33
  <Typography color="greyXDark" {...(props as TypographyProps)} />
34
34
  );
35
35
 
36
- Text.displayName = 'Text';
37
-
38
36
  export default Text;
@@ -1,65 +1,74 @@
1
- import React, { ReactElement } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
 
3
3
  import {
4
4
  Box,
5
5
  Tooltip as TooltipMui,
6
6
  TooltipProps,
7
- styled,
8
7
  tooltipClasses,
9
8
  } from '@mui/material';
10
9
 
11
10
  import { Placement } from './tooltip.interface';
12
11
 
13
12
  interface Props extends Omit<TooltipProps, 'icon' | 'children' | 'placement'> {
14
- title: string;
15
- children: ReactElement;
13
+ title: ReactNode;
14
+ children: ReactNode;
16
15
  placement?: Placement;
16
+ placementMargin?: number;
17
17
  }
18
18
 
19
19
  const Tooltip = ({
20
20
  title,
21
21
  placement = 'right',
22
22
  children,
23
+ placementMargin = 4,
23
24
  ...tooltipProps
24
25
  }: Props) => {
25
26
  if (!title) {
26
27
  return <>{children}</>;
27
28
  }
28
- const StyledTooltip = styled(({ classes, ...tooltipProps }: TooltipProps) => (
29
- <TooltipMui {...tooltipProps} classes={classes} />
30
- ))(() => ({
31
- [`& .${tooltipClasses.tooltip}`]: {
32
- backgroundColor: '#272727',
33
- padding: '4px !important',
34
- fontFamily: 'Roboto, sans-serif',
35
- fontSize: '13px',
36
- color: 'white',
37
- fontWeight: 400,
38
- },
39
- [`& .${tooltipClasses.tooltipPlacementTop}`]: {
40
- marginBottom: '4px !important',
41
- },
42
- [`& .${tooltipClasses.tooltipPlacementRight}`]: {
43
- marginLeft: '4px !important',
44
- },
45
- [`& .${tooltipClasses.tooltipPlacementBottom}`]: {
46
- marginTop: '4px !important',
47
- },
48
- [`& .${tooltipClasses.tooltipPlacementLeft}`]: {
49
- marginRight: '4px !important',
50
- },
51
- }));
52
29
 
53
30
  return (
54
- <StyledTooltip
55
- placement={placement || undefined}
31
+ <TooltipMui
56
32
  title={<>{title}</>}
57
33
  {...tooltipProps}
34
+ sx={{
35
+ display: 'inline-flex',
36
+ ...tooltipProps.sx,
37
+ }}
38
+ placement={placement || undefined}
39
+ slotProps={{
40
+ popper: {
41
+ sx: {
42
+ [`&.${tooltipClasses.popper} .MuiTooltip-tooltip`]: {
43
+ backgroundColor: 'greyXDark',
44
+ padding: '4px !important',
45
+ fontSize: '12px !important',
46
+ color: 'white',
47
+ fontWeight: 400,
48
+ },
49
+ [`&.${tooltipClasses.popper}[data-popper-placement*="bottom"] .${tooltipClasses.tooltip}`]:
50
+ {
51
+ marginTop: placementMargin + 'px',
52
+ },
53
+ [`&.${tooltipClasses.popper}[data-popper-placement*="top"] .${tooltipClasses.tooltip}`]:
54
+ {
55
+ marginBottom: placementMargin + 'px',
56
+ },
57
+ [`&.${tooltipClasses.popper}[data-popper-placement*="right"] .${tooltipClasses.tooltip}`]:
58
+ {
59
+ marginLeft: placementMargin + 'px',
60
+ },
61
+ [`&.${tooltipClasses.popper}[data-popper-placement*="left"] .${tooltipClasses.tooltip}`]:
62
+ {
63
+ marginRight: placementMargin + 'px',
64
+ },
65
+ },
66
+ },
67
+ }}
58
68
  >
59
69
  <Box component="span">{children}</Box>
60
- </StyledTooltip>
70
+ </TooltipMui>
61
71
  );
62
72
  };
63
- Tooltip.displayName = 'Tooltip';
64
73
 
65
74
  export default Tooltip;