Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1490 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1490 Rev 1491
Línea 3... Línea 3...
3
import { InputAdornment, TextField } from '@mui/material'
3
import { InputAdornment, TextField } from '@mui/material'
Línea 4... Línea 4...
4
 
4
 
Línea 5... Línea 5...
5
import FormErrorFeedback from './FormErrorFeedback'
5
import FormErrorFeedback from './FormErrorFeedback'
6
 
-
 
7
const FormInputText = ({
6
 
8
  control = null,
7
const FormInputText = ({
9
  name = '',
-
 
10
  placeholder = '',
8
  name = '',
11
  defaultValue = '',
9
  control = null,
12
  rules = {
10
  rules = {
-
 
11
    required: { value: true, message: 'This field is required' }
13
    required: { value: true, message: 'This field is required' }
12
  },
14
  },
13
  defaultValue = '',
15
  error = '',
-
 
16
  icon: Icon = null,
14
  error = '',
17
  label = '',
15
  icon: Icon = null,
18
  type = 'text'
16
  ...rest
19
}) => {
17
}) => {
20
  return (
18
  return (
21
    <Controller
19
    <Controller
22
      name={name}
20
      name={name}
23
      control={control}
21
      control={control}
24
      rules={rules}
22
      rules={rules}
25
      defaultValue={defaultValue}
23
      defaultValue={defaultValue}
26
      render={({ ref, name, value, onChange, onBlur }) => (
24
      render={({ ref, name, value, onChange, onBlur }) => (
27
        <>
-
 
28
          <TextField
25
        <>
29
            type={type}
26
          <TextField
30
            id={name}
-
 
31
            name={name}
27
            id={name}
32
            placeholder={placeholder}
28
            name={name}
33
            inputRef={ref}
-
 
34
            value={value}
29
            inputRef={ref}
35
            label={label}
30
            value={value}
36
            onChange={onChange}
-
 
37
            onBlur={onBlur}
-
 
38
            sx={{
-
 
39
              mb: error ? 0 : 1
31
            onChange={onChange}
40
            }}
32
            onBlur={onBlur}
41
            InputProps={{
33
            InputProps={{
42
              startAdornment: Icon ? (
34
              startAdornment: Icon ? (
43
                <InputAdornment position='start'>
35
                <InputAdornment position='start'>
44
                  <Icon />
36
                  <Icon />
45
                </InputAdornment>
37
                </InputAdornment>
-
 
38
              ) : null
-
 
39
            }}
46
              ) : null
40
            fullWidth
Línea 47... Línea 41...
47
            }}
41
            {...rest}
48
          />
42
          />
49
 
43