@@ -7,6 +7,8 @@ import Grid from '@material-ui/core/Grid';
7
7
import MuiTextField from '@material-ui/core/TextField' ;
8
8
import Checkbox from '@material-ui/core/Checkbox' ;
9
9
import FormControlLabel from '@material-ui/core/FormControlLabel' ;
10
+ import FormHelperText from '@material-ui/core/FormHelperText' ;
11
+ import FormControl from '@material-ui/core/FormControl' ;
10
12
import Switch from '@material-ui/core/Switch' ;
11
13
import FormGroup from '@material-ui/core/FormGroup' ;
12
14
import MuiSelect from './select-field' ;
@@ -39,6 +41,7 @@ const selectComponent = ({
39
41
offText,
40
42
error,
41
43
locale = 'en' ,
44
+ originalLabel,
42
45
...rest
43
46
} ) => ( {
44
47
[ componentTypes . TEXT_FIELD ] : ( ) => (
@@ -75,10 +78,20 @@ const selectComponent = ({
75
78
/>
76
79
) ,
77
80
[ componentTypes . CHECKBOX ] : ( ) => (
78
- < FormControlLabel
79
- control = { < Checkbox { ...input } disabled = { isDisabled } value = { input . name } /> }
80
- label = { label }
81
- />
81
+ < FormControl required = { isRequired } error = { invalid } component = "fieldset" >
82
+ < FormGroup error = { invalid } >
83
+ < FormControlLabel
84
+ control = { < Checkbox
85
+ { ...input }
86
+ disabled = { isDisabled || isReadOnly }
87
+ value = { input . name }
88
+ /> }
89
+ disabled = { isDisabled || isReadOnly }
90
+ label = { originalLabel }
91
+ />
92
+ { ( invalid || helperText ) && < FormHelperText > { invalid || helperText } </ FormHelperText > }
93
+ </ FormGroup >
94
+ </ FormControl >
82
95
) ,
83
96
[ componentTypes . RADIO ] : ( ) => (
84
97
< RadioGroup
@@ -183,6 +196,7 @@ const FinalFormField = ({
183
196
invalid,
184
197
label : invalid ? meta . error : label ,
185
198
helperText : helperText || description ,
199
+ originalLabel : label ,
186
200
} ) ( ) }
187
201
</ Grid >
188
202
) ;
0 commit comments