@centreon/ui 23.10.34 → 23.10.35
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
package/src/Form/Inputs/Text.tsx
CHANGED
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
type as variableType
|
|
13
13
|
} from 'ramda';
|
|
14
14
|
|
|
15
|
+
import { InputAdornment } from '@mui/material';
|
|
16
|
+
|
|
15
17
|
import { TextField, useMemoComponent } from '../..';
|
|
16
18
|
|
|
17
19
|
import PasswordEndAdornment from './PasswordEndAdornment';
|
|
@@ -64,16 +66,24 @@ const Text = ({
|
|
|
64
66
|
? path(fieldNamePath, errors)
|
|
65
67
|
: undefined;
|
|
66
68
|
|
|
67
|
-
const
|
|
68
|
-
(
|
|
69
|
-
|
|
69
|
+
const EndAdornment = useCallback((): JSX.Element | null => {
|
|
70
|
+
if (equals(type, InputType.Password)) {
|
|
71
|
+
return (
|
|
70
72
|
<PasswordEndAdornment
|
|
71
73
|
changeVisibility={changeVisibility}
|
|
72
74
|
isVisible={isVisible}
|
|
73
75
|
/>
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (text?.endAdornment) {
|
|
80
|
+
return (
|
|
81
|
+
<InputAdornment position="end">{text?.endAdornment}</InputAdornment>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return null;
|
|
86
|
+
}, [isVisible]);
|
|
77
87
|
|
|
78
88
|
const getInputType = (): string => {
|
|
79
89
|
if (text?.type) {
|
|
@@ -97,13 +107,14 @@ const Text = ({
|
|
|
97
107
|
Component: (
|
|
98
108
|
<TextField
|
|
99
109
|
fullWidth
|
|
100
|
-
EndAdornment={
|
|
110
|
+
EndAdornment={EndAdornment}
|
|
101
111
|
ariaLabel={t(label) || ''}
|
|
102
112
|
dataTestId={dataTestId || ''}
|
|
103
113
|
disabled={disabled}
|
|
104
114
|
error={error as string | undefined}
|
|
105
115
|
label={t(label)}
|
|
106
116
|
multiline={isMultiline}
|
|
117
|
+
placeholder={text?.placeholder}
|
|
107
118
|
required={isRequired}
|
|
108
119
|
rows={rows}
|
|
109
120
|
type={getInputType()}
|
|
@@ -35,7 +35,6 @@ export const getInput = R.cond<
|
|
|
35
35
|
R.equals(InputType.Radio) as (b: InputType) => boolean,
|
|
36
36
|
R.always(RadioInput)
|
|
37
37
|
],
|
|
38
|
-
[R.equals(InputType.Text) as (b: InputType) => boolean, R.always(TextInput)],
|
|
39
38
|
[
|
|
40
39
|
R.equals(InputType.SingleAutocomplete) as (b: InputType) => boolean,
|
|
41
40
|
R.always(Autocomplete)
|
|
@@ -44,10 +43,6 @@ export const getInput = R.cond<
|
|
|
44
43
|
R.equals(InputType.MultiAutocomplete) as (b: InputType) => boolean,
|
|
45
44
|
R.always(Autocomplete)
|
|
46
45
|
],
|
|
47
|
-
[
|
|
48
|
-
R.equals(InputType.Password) as (b: InputType) => boolean,
|
|
49
|
-
R.always(TextInput)
|
|
50
|
-
],
|
|
51
46
|
[
|
|
52
47
|
R.equals(InputType.MultiConnectedAutocomplete) as (b: InputType) => boolean,
|
|
53
48
|
R.always(ConnectedAutocomplete)
|
|
@@ -71,7 +66,8 @@ export const getInput = R.cond<
|
|
|
71
66
|
[
|
|
72
67
|
R.equals(InputType.CheckboxGroup) as (b: InputType) => boolean,
|
|
73
68
|
R.always(CheckboxGroup)
|
|
74
|
-
]
|
|
69
|
+
],
|
|
70
|
+
[R.T, R.always(TextInput)]
|
|
75
71
|
]);
|
|
76
72
|
|
|
77
73
|
interface StylesProps {
|
package/src/Form/storiesData.tsx
CHANGED