@centreon/ui 24.4.1-MON-21276-create-basic-token.0 → 24.4.1-MON-23337-uniformize-metric-selection.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@centreon/ui",
3
- "version": "24.4.1-MON-21276-create-basic-token.0",
3
+ "version": "24.4.1-MON-23337-uniformize-metric-selection.3",
4
4
  "description": "Centreon UI Components",
5
5
  "scripts": {
6
6
  "eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx --max-warnings 0",
@@ -1,6 +1,7 @@
1
+ import { useTranslation } from 'react-i18next';
2
+
1
3
  import CheckIcon from '@mui/icons-material/Check';
2
4
  import SaveIcon from '@mui/icons-material/Save';
3
- import { Typography, TypographyTypeMap } from '@mui/material';
4
5
 
5
6
  interface Props {
6
7
  labelLoading: string;
@@ -10,42 +11,24 @@ interface Props {
10
11
  succeeded: boolean;
11
12
  }
12
13
 
13
- interface WrapperLabelProps {
14
- label: string;
15
- }
16
-
17
- const WrapperLabel = ({
18
- label,
19
- ...rest
20
- }: WrapperLabelProps & TypographyTypeMap['props']): JSX.Element => {
21
- return <Typography {...rest}>{label}</Typography>;
22
- };
23
-
24
14
  const Content = ({
25
15
  succeeded,
26
16
  labelSucceeded,
27
17
  labelSave,
28
18
  loading,
29
- labelLoading,
30
- ...rest
31
- }: Props & TypographyTypeMap['props']): JSX.Element | string | null => {
19
+ labelLoading
20
+ }: Props): JSX.Element | string | null => {
21
+ const { t } = useTranslation();
22
+
32
23
  if (loading) {
33
- return <WrapperLabel label={labelLoading} {...rest} />;
24
+ return t(labelLoading);
34
25
  }
35
26
 
36
27
  if (succeeded) {
37
- return labelSucceeded ? (
38
- <WrapperLabel label={labelSucceeded} {...rest} />
39
- ) : (
40
- <CheckIcon />
41
- );
28
+ return labelSucceeded ? t(labelSucceeded) : <CheckIcon />;
42
29
  }
43
30
 
44
- return labelSave ? (
45
- <WrapperLabel label={labelSave} {...rest} />
46
- ) : (
47
- <SaveIcon />
48
- );
31
+ return labelSave ? t(labelSave) : <SaveIcon />;
49
32
  };
50
33
 
51
34
  export default Content;
@@ -1,7 +1,7 @@
1
1
  import { any, isEmpty, isNil, not, or, pipe } from 'ramda';
2
2
  import { makeStyles } from 'tss-react/mui';
3
3
 
4
- import { Theme, Tooltip, TypographyTypeMap } from '@mui/material';
4
+ import { Theme, Tooltip } from '@mui/material';
5
5
  import { LoadingButton } from '@mui/lab';
6
6
 
7
7
  import { getNormalizedId } from '../../utils';
@@ -18,12 +18,10 @@ const useStyles = makeStyles()((theme: Theme) => ({
18
18
  interface Props extends Record<string, unknown> {
19
19
  className?: string;
20
20
  labelLoading?: string;
21
- labelProps?: TypographyTypeMap['props'];
22
21
  labelSave?: string;
23
22
  labelSucceeded?: string;
24
23
  loading?: boolean;
25
24
  size?: 'small' | 'medium' | 'large';
26
- startIcon?: boolean;
27
25
  succeeded?: boolean;
28
26
  tooltip?: string;
29
27
  tooltipLabel?: string;
@@ -47,8 +45,6 @@ const SaveButton = ({
47
45
  labelSave = '',
48
46
  size = 'small',
49
47
  className,
50
- startIcon = true,
51
- labelProps,
52
48
  ...rest
53
49
  }: Props): JSX.Element => {
54
50
  const { classes, cx } = useStyles();
@@ -77,9 +73,7 @@ const SaveButton = ({
77
73
  loading={loading}
78
74
  loadingPosition={labelLoading ? 'start' : 'center'}
79
75
  size={size}
80
- startIcon={
81
- startIcon && <StartIcon startIconConfig={startIconConfig} />
82
- }
76
+ startIcon={<StartIcon startIconConfig={startIconConfig} />}
83
77
  variant="contained"
84
78
  {...rest}
85
79
  >
@@ -88,8 +82,7 @@ const SaveButton = ({
88
82
  labelSave,
89
83
  labelSucceeded,
90
84
  loading,
91
- succeeded,
92
- ...labelProps
85
+ succeeded
93
86
  })}
94
87
  </LoadingButton>
95
88
  </div>
@@ -24,9 +24,9 @@ const useStyles = makeStyles<{
24
24
  },
25
25
  '&[data-size="fullscreen"] .MuiDialog-paper': {
26
26
  bottom: props?.bottom ?? 0,
27
+ height: 'calc(100vh - 90px)',
27
28
  left: props?.left ?? 0,
28
29
  margin: 0,
29
- maxHeight: 'unset',
30
30
  maxWidth: 'unset',
31
31
  position: 'absolute',
32
32
  right: props?.right ?? 0,
@@ -50,11 +50,13 @@ const useStyles = makeStyles<{
50
50
  },
51
51
  modalActions: {
52
52
  bottom: 0,
53
+ bottom: theme.spacing(2),
53
54
  display: 'flex',
54
55
  flexDirection: 'row',
55
56
  gap: theme.spacing(2),
56
57
  justifyContent: 'flex-end',
57
- position: 'sticky'
58
+ position: 'fixed',
59
+ right: theme.spacing(2)
58
60
  },
59
61
  modalBody: {
60
62
  '& > p': {