Skip to content

Commit 9cf04eb

Browse files
committed
Convert invalid to bool in error prop
1 parent 09695ba commit 9cf04eb

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

packages/common/src/multiple-choice-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const MultipleChoiceList = ({ validate, FieldProvider, Wrapper, Checkbox, ...pro
2121
}) => {
2222
const { error, touched } = meta;
2323
const showError = touched && error;
24-
const groupValues = rest.input.value;
24+
const groupValues = rest.input.value || [];
2525
return (
2626
<Wrapper
2727
showError={ showError }

packages/mui-component-mapper/demo/demo-schemas/sandbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const genereateField = (component, name = 'standard', optionsOptional = {}) => [
1616
}, {
1717
name: `${component} -- ${name} -- divider 2 `,
1818
component: 'plain-text',
19-
label: `<----->`,
19+
label: '\n. \n.',
2020
}];
2121

2222
const componentList = [

packages/mui-component-mapper/src/form-fields/form-fields.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const selectComponent = ({
6363
[componentTypes.TEXTAREA_FIELD]: () => (
6464
<MuiTextField
6565
{ ...input }
66-
error={ invalid }
66+
error={ !!invalid }
6767
required={ isRequired }
6868
helperText={ helperText }
6969
disabled={ isDisabled }
@@ -78,7 +78,7 @@ const selectComponent = ({
7878
/>
7979
),
8080
[componentTypes.CHECKBOX]: () => (
81-
<FormControl required={ isRequired } error={ invalid } component="fieldset">
81+
<FormControl required={ isRequired } error={ !!invalid } component="fieldset">
8282
<FormGroup>
8383
<FormControlLabel
8484
control={ <Checkbox
@@ -129,10 +129,14 @@ const selectComponent = ({
129129
}}
130130
onChange={ option =>
131131
input.onChange(rest.multi ? selectValue(option) : option ? option.value : undefined) } // eslint-disable-line no-nested-ternary
132+
input={ input }
133+
label={ originalLabel }
134+
isRequired={ isRequired }
135+
helperText={ helperText }
132136
{ ...rest }
133137
/>),
134138
[componentTypes.SWITCH]: () => (
135-
<FormControl required={ isRequired } error={ invalid } component="fieldset">
139+
<FormControl required={ isRequired } error={ !!invalid } component="fieldset">
136140
<FormGroup>
137141
<FormControlLabel
138142
control={ <Switch
@@ -159,7 +163,7 @@ const selectComponent = ({
159163
disabled={ isDisabled || isReadOnly }
160164
placeholder={ placeholder }
161165
required={ isRequired }
162-
error={ invalid }
166+
error={ !!invalid }
163167
readOnly={ isReadOnly }
164168
{ ...input }
165169
value={ input.value || null }
@@ -176,7 +180,7 @@ const selectComponent = ({
176180
disabled={ isDisabled || isReadOnly }
177181
placeholder={ placeholder }
178182
required={ isRequired }
179-
error={ invalid }
183+
error={ !!invalid }
180184
readOnly={ isReadOnly }
181185
{ ...input }
182186
value={ input.value || null }

packages/mui-component-mapper/src/form-fields/multiple-choice-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Wrapper = ({ label, isRequired, children, meta, validateOnMount, helperTex
3434

3535
return (
3636
<Grid container>
37-
<FormControl required={ isRequired } error={ invalid } component="fieldset" >
37+
<FormControl required={ isRequired } error={ !!invalid } component="fieldset" >
3838
<FormLabel>{ label }</FormLabel>
3939
<FormGroup>
4040
{ children }

packages/mui-component-mapper/src/form-fields/radio.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const RadioGroup = ({
1818
invalid,
1919
}) => (
2020
<div className="mui-ddform-radio-group">
21-
<FormControl required={ isRequired } error={ invalid } component="fieldset">
21+
<FormControl required={ isRequired } error={ !!invalid } component="fieldset">
2222
<FormLabel component="legend">{ label }</FormLabel>
2323
{ options.map(option => (
2424
<FieldProvider

0 commit comments

Comments
 (0)