Skip to content

Commit 495d324

Browse files
committed
fix(mui): fixed missing rest spread on checkbox component.
1 parent 1723677 commit 495d324

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

packages/mui-component-mapper/demo/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const compositeMapper = {
2121
[componentTypes.SWITCH]: {
2222
component: componentMapper[componentTypes.SWITCH],
2323
FormControlLabelProps: {
24-
labelPlacement: 'left'
24+
labelPlacement: 'end'
2525
}
2626
}
2727
}

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ import { validationError } from './helpers';
88

99
const CheckboxContext = createContext({});
1010

11-
const FinalCheckbox = ({ isDisabled, label, ...props }) => {
12-
const { FormControlLabelProps, CheckboxProps } = useContext(CheckboxContext);
11+
const FinalCheckbox = ({ label, isDisabled: _isDisabled, ...rest }) => {
12+
const {
13+
FormControlLabelProps,
14+
CheckboxProps,
15+
props: { isRequired, isReadOnly, helperText, validate, isDisabled, ...props }
16+
} = useContext(CheckboxContext);
1317
return (
1418
<FormControlLabel
1519
{...FormControlLabelProps}
1620
control={
17-
<Checkbox {...props} {...CheckboxProps} disabled={isDisabled}>
21+
<Checkbox {...rest} {...props} {...CheckboxProps} disabled={isDisabled}>
1822
{label}
1923
</Checkbox>
2024
}
@@ -57,7 +61,7 @@ const MultipleChoiceList = ({
5761
...props
5862
}) => (
5963
<CheckboxContext.Provider
60-
value={{ FormControlProps, FormLabelProps, FormGroupProps, FormHelperTextProps, FormFieldGridProps, FormControlLabelProps, CheckboxProps }}
64+
value={{ FormControlProps, FormLabelProps, FormGroupProps, FormHelperTextProps, FormFieldGridProps, FormControlLabelProps, CheckboxProps, props }}
6165
>
6266
<MultipleChoiceListCommon {...props} Wrapper={Wrapper} Checkbox={FinalCheckbox} />
6367
</CheckboxContext.Provider>

packages/mui-component-mapper/src/files/checkbox.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export const SingleCheckbox = (props) => {
2525
FormControlLabelProps,
2626
CheckboxProps,
2727
FormLabelProps,
28-
FormHelperTextProps
28+
FormHelperTextProps,
29+
inputProps,
30+
...rest
2931
} = useFieldApi({
3032
...props,
3133
type: 'checkbox'
@@ -46,8 +48,10 @@ export const SingleCheckbox = (props) => {
4648
disabled={isDisabled || isReadOnly}
4749
value={input.name}
4850
inputProps={{
49-
readOnly: isReadOnly
51+
readOnly: isReadOnly,
52+
...inputProps
5053
}}
54+
{...rest}
5155
/>
5256
}
5357
disabled={isDisabled || isReadOnly}

0 commit comments

Comments
 (0)