File tree Expand file tree Collapse file tree 11 files changed +49
-16
lines changed
packages/mui-component-mapper/src Expand file tree Collapse file tree 11 files changed +49
-16
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export const SingleCheckbox = (props) => {
3333 type : 'checkbox'
3434 } ) ;
3535 const invalid = validationError ( meta , validateOnMount ) ;
36- const text = invalid || helperText || description ;
36+ const text = invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description ;
3737
3838 return (
3939 < FormFieldGrid { ...FormFieldGridProps } >
@@ -57,7 +57,7 @@ export const SingleCheckbox = (props) => {
5757 disabled = { isDisabled || isReadOnly }
5858 label = { < FormLabel { ...FormLabelProps } > { label } </ FormLabel > }
5959 />
60- { ( invalid || text ) && < FormHelperText { ...FormHelperTextProps } > { invalid || text } </ FormHelperText > }
60+ { text && < FormHelperText { ...FormHelperTextProps } > { text } </ FormHelperText > }
6161 </ FormGroup >
6262 </ FormControl >
6363 </ FormFieldGrid >
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const DatePicker = (props) => {
3434 fullWidth
3535 margin = "normal"
3636 label = { label }
37- helperText = { invalid || helperText || description }
37+ helperText = { invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description }
3838 disabled = { isDisabled || isReadOnly }
3939 placeholder = { placeholder }
4040 required = { isRequired }
Original file line number Diff line number Diff line change @@ -309,7 +309,7 @@ const DualListSelect = ({
309309} ) => {
310310 const classes = useStyles ( ) ;
311311 const invalid = validationError ( meta , validateOnMount ) ;
312- const text = invalid || helperText || description ;
312+ const text = invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description ;
313313
314314 return (
315315 < FormFieldGrid { ...FormFieldGridProps } >
@@ -475,7 +475,7 @@ const DualListSelect = ({
475475 />
476476 </ Grid >
477477 </ Grid >
478- { ( invalid || text ) && < FormHelperText { ...FormHelperTextProps } > { invalid || text } </ FormHelperText > }
478+ { text && < FormHelperText { ...FormHelperTextProps } > { text } </ FormHelperText > }
479479 </ FormControl >
480480 </ FormFieldGrid >
481481 ) ;
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ const Radio = ({ name, ...props }) => {
7373 } ) ;
7474 const classes = useStyles ( ) ;
7575 const invalid = validationError ( meta , validateOnMount ) ;
76- const text = invalid || helperText || description ;
76+ const text = invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description ;
7777 return (
7878 < FormFieldGrid className = { classes . grid } { ...FormFieldGridProps } >
7979 < FormControl required = { isRequired } error = { ! ! invalid } component = "fieldset" { ...FormControlProps } >
@@ -83,7 +83,7 @@ const Radio = ({ name, ...props }) => {
8383 { options . map ( ( option ) => (
8484 < RadioOption key = { option . value } name = { name } option = { option } isDisabled = { isDisabled } isReadOnly = { isReadOnly } { ...rest } />
8585 ) ) }
86- { ( invalid || text ) && < FormHelperText { ...FormHelperTextProps } > { invalid || text } </ FormHelperText > }
86+ { text && < FormHelperText { ...FormHelperTextProps } > { text } </ FormHelperText > }
8787 </ FormControl >
8888 </ FormFieldGrid >
8989 ) ;
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ const InternalSelect = ({
9898 { ...params }
9999 required = { required }
100100 error = { ! ! invalid }
101- helperText = { invalid ? meta . error : helperText || description }
101+ helperText = { invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description }
102102 label = { label }
103103 margin = "normal"
104104 { ...TextFieldProps }
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ const Slider = (props) => {
3232 } = useFieldApi ( props ) ;
3333
3434 const invalid = validationError ( meta , validateOnMount ) ;
35- const text = invalid || helperText || description ;
35+ const text = invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description ;
3636
3737 return (
3838 < FormFieldGrid { ...FormFieldGridProps } >
@@ -62,7 +62,7 @@ const Slider = (props) => {
6262 </ Grid >
6363 ) }
6464 </ Grid >
65- { ( invalid || text ) && < FormHelperText { ...FormHelperTextProps } > { invalid || text } </ FormHelperText > }
65+ { text && < FormHelperText { ...FormHelperTextProps } > { text } </ FormHelperText > }
6666 </ FormGroup >
6767 </ FormControl >
6868 </ FormFieldGrid >
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export const Switch = (props) => {
3333 type : 'checkbox'
3434 } ) ;
3535 const invalid = validationError ( meta , validateOnMount ) ;
36- const text = invalid || helperText || description ;
36+ const text = invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description ;
3737
3838 return (
3939 < FormFieldGrid { ...FormFieldGridProps } >
@@ -52,7 +52,7 @@ export const Switch = (props) => {
5252 label = { < FormLabel { ...FormLabelProps } > { input . checked ? onText || label : offText || label } </ FormLabel > }
5353 { ...FormControlLabelProps }
5454 />
55- { ( invalid || text ) && < FormHelperText { ...FormHelperTextProps } > { invalid || text } </ FormHelperText > }
55+ { text && < FormHelperText { ...FormHelperTextProps } > { text } </ FormHelperText > }
5656 </ FormGroup >
5757 </ FormControl >
5858 </ FormFieldGrid >
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ const TextField = (props) => {
3131 { ...input }
3232 fullWidth
3333 error = { ! ! invalid }
34- helperText = { invalid || helperText || description }
34+ helperText = { invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description }
3535 disabled = { isDisabled }
3636 label = { label }
3737 placeholder = { placeholder }
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const Textarea = (props) => {
3030 { ...input }
3131 fullWidth
3232 error = { ! ! invalid }
33- helperText = { invalid || helperText || description }
33+ helperText = { invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description }
3434 disabled = { isDisabled }
3535 label = { label }
3636 placeholder = { placeholder }
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const TimePicker = (props) => {
3434 fullWidth
3535 margin = "normal"
3636 label = { label }
37- helperText = { invalid || helperText || description }
37+ helperText = { invalid || ( ( meta . touched || validateOnMount ) && meta . warning ) || helperText || description }
3838 disabled = { isDisabled || isReadOnly }
3939 placeholder = { placeholder }
4040 required = { isRequired }
You can’t perform that action at this time.
0 commit comments