@centreon/ui 24.4.13 → 24.4.15
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,7 +1,6 @@
|
|
|
1
|
-
import { useTranslation } from 'react-i18next';
|
|
2
|
-
|
|
3
1
|
import CheckIcon from '@mui/icons-material/Check';
|
|
4
2
|
import SaveIcon from '@mui/icons-material/Save';
|
|
3
|
+
import { Typography, TypographyProps } from '@mui/material';
|
|
5
4
|
|
|
6
5
|
interface Props {
|
|
7
6
|
labelLoading: string;
|
|
@@ -11,24 +10,42 @@ interface Props {
|
|
|
11
10
|
succeeded: boolean;
|
|
12
11
|
}
|
|
13
12
|
|
|
13
|
+
interface WrapperLabelProps {
|
|
14
|
+
label: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const WrapperLabel = ({
|
|
18
|
+
label,
|
|
19
|
+
...rest
|
|
20
|
+
}: WrapperLabelProps & TypographyProps): JSX.Element => {
|
|
21
|
+
return <Typography {...rest}>{label}</Typography>;
|
|
22
|
+
};
|
|
23
|
+
|
|
14
24
|
const Content = ({
|
|
15
25
|
succeeded,
|
|
16
26
|
labelSucceeded,
|
|
17
27
|
labelSave,
|
|
18
28
|
loading,
|
|
19
|
-
labelLoading
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
labelLoading,
|
|
30
|
+
...rest
|
|
31
|
+
}: Props & TypographyProps): JSX.Element | string | null => {
|
|
23
32
|
if (loading) {
|
|
24
|
-
return
|
|
33
|
+
return <WrapperLabel label={labelLoading} {...rest} />;
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
if (succeeded) {
|
|
28
|
-
return labelSucceeded ?
|
|
37
|
+
return labelSucceeded ? (
|
|
38
|
+
<WrapperLabel label={labelSucceeded} {...rest} />
|
|
39
|
+
) : (
|
|
40
|
+
<CheckIcon />
|
|
41
|
+
);
|
|
29
42
|
}
|
|
30
43
|
|
|
31
|
-
return labelSave ?
|
|
44
|
+
return labelSave ? (
|
|
45
|
+
<WrapperLabel label={labelSave} {...rest} />
|
|
46
|
+
) : (
|
|
47
|
+
<SaveIcon />
|
|
48
|
+
);
|
|
32
49
|
};
|
|
33
50
|
|
|
34
51
|
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 } from '@mui/material';
|
|
4
|
+
import { Theme, Tooltip, TypographyProps } from '@mui/material';
|
|
5
5
|
import { LoadingButton } from '@mui/lab';
|
|
6
6
|
|
|
7
7
|
import { getNormalizedId } from '../../utils';
|
|
@@ -18,10 +18,12 @@ const useStyles = makeStyles()((theme: Theme) => ({
|
|
|
18
18
|
interface Props extends Record<string, unknown> {
|
|
19
19
|
className?: string;
|
|
20
20
|
labelLoading?: string;
|
|
21
|
+
labelProps?: TypographyProps;
|
|
21
22
|
labelSave?: string;
|
|
22
23
|
labelSucceeded?: string;
|
|
23
24
|
loading?: boolean;
|
|
24
25
|
size?: 'small' | 'medium' | 'large';
|
|
26
|
+
startIcon?: boolean;
|
|
25
27
|
succeeded?: boolean;
|
|
26
28
|
tooltip?: string;
|
|
27
29
|
tooltipLabel?: string;
|
|
@@ -45,6 +47,8 @@ const SaveButton = ({
|
|
|
45
47
|
labelSave = '',
|
|
46
48
|
size = 'small',
|
|
47
49
|
className,
|
|
50
|
+
startIcon = true,
|
|
51
|
+
labelProps,
|
|
48
52
|
...rest
|
|
49
53
|
}: Props): JSX.Element => {
|
|
50
54
|
const { classes, cx } = useStyles();
|
|
@@ -73,7 +77,9 @@ const SaveButton = ({
|
|
|
73
77
|
loading={loading}
|
|
74
78
|
loadingPosition={labelLoading ? 'start' : 'center'}
|
|
75
79
|
size={size}
|
|
76
|
-
startIcon={
|
|
80
|
+
startIcon={
|
|
81
|
+
startIcon && <StartIcon startIconConfig={startIconConfig} />
|
|
82
|
+
}
|
|
77
83
|
variant="contained"
|
|
78
84
|
{...rest}
|
|
79
85
|
>
|
|
@@ -82,7 +88,8 @@ const SaveButton = ({
|
|
|
82
88
|
labelSave,
|
|
83
89
|
labelSucceeded,
|
|
84
90
|
loading,
|
|
85
|
-
succeeded
|
|
91
|
+
succeeded,
|
|
92
|
+
...labelProps
|
|
86
93
|
})}
|
|
87
94
|
</LoadingButton>
|
|
88
95
|
</div>
|
|
@@ -2,7 +2,7 @@ import { makeStyles } from 'tss-react/mui';
|
|
|
2
2
|
import { T, always, cond, equals } from 'ramda';
|
|
3
3
|
|
|
4
4
|
import { SvgIconComponent } from '@mui/icons-material';
|
|
5
|
-
import Typography, {
|
|
5
|
+
import Typography, { TypographyProps } from '@mui/material/Typography';
|
|
6
6
|
import { FormControlLabel, Checkbox as MuiCheckbox, Box } from '@mui/material';
|
|
7
7
|
|
|
8
8
|
export type LabelPlacement = 'bottom' | 'top' | 'end' | 'start' | undefined;
|
|
@@ -56,7 +56,7 @@ interface Props {
|
|
|
56
56
|
disabled?: boolean;
|
|
57
57
|
label: string;
|
|
58
58
|
labelPlacement?: LabelPlacement;
|
|
59
|
-
labelProps?:
|
|
59
|
+
labelProps?: TypographyProps;
|
|
60
60
|
onChange?: (e) => void;
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -2,7 +2,7 @@ import { equals, includes } from 'ramda';
|
|
|
2
2
|
import { makeStyles } from 'tss-react/mui';
|
|
3
3
|
|
|
4
4
|
import FormGroup, { FormGroupProps } from '@mui/material/FormGroup';
|
|
5
|
-
import {
|
|
5
|
+
import { TypographyProps } from '@mui/material/Typography';
|
|
6
6
|
|
|
7
7
|
import Checkbox, { LabelPlacement } from '../Checkbox';
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ interface Props {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
formGroupProps?: FormGroupProps;
|
|
15
15
|
labelPlacement?: LabelPlacement;
|
|
16
|
-
labelProps?:
|
|
16
|
+
labelProps?: TypographyProps;
|
|
17
17
|
onChange?: (e) => void;
|
|
18
18
|
options: Array<string>;
|
|
19
19
|
values: Array<string>;
|