Skip to content

Commit

Permalink
Merge pull request #5953 from marmelab/fix-checkboxgroup-input-error-…
Browse files Browse the repository at this point in the history
…style-in-reference-input

Fix CheckboxGroup error style when in ReferenceArrayInput
  • Loading branch information
fzaninotto authored Feb 26, 2021
2 parents 5a0903e + 5f6dab8 commit 6cd5c6a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
43 changes: 22 additions & 21 deletions packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,6 @@ import classnames from 'classnames';
import Labeled from './Labeled';
import { LinearProgress } from '../layout';

const sanitizeRestProps = ({
setFilter,
setPagination,
setSort,
loaded,
...rest
}: any) => sanitizeInputRestProps(rest);

const useStyles = makeStyles(
theme => ({
root: {},
label: {
transform: 'translate(0, 8px) scale(0.75)',
transformOrigin: `top ${
theme.direction === 'ltr' ? 'left' : 'right'
}`,
},
}),
{ name: 'RaCheckboxGroupInput' }
);

/**
* An Input component for a checkbox group, using an array of objects for the options
*
Expand Down Expand Up @@ -233,6 +212,28 @@ const CheckboxGroupInput: FunctionComponent<
);
};

const sanitizeRestProps = ({
setFilter,
setPagination,
setSort,
loaded,
touched,
...rest
}: any) => sanitizeInputRestProps(rest);

const useStyles = makeStyles(
theme => ({
root: {},
label: {
transform: 'translate(0, 8px) scale(0.75)',
transformOrigin: `top ${
theme.direction === 'ltr' ? 'left' : 'right'
}`,
},
}),
{ name: 'RaCheckboxGroupInput' }
);

CheckboxGroupInput.propTypes = {
choices: PropTypes.arrayOf(PropTypes.object),
className: PropTypes.string,
Expand Down
2 changes: 2 additions & 0 deletions packages/ra-ui-materialui/src/input/sanitizeInputRestProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const sanitizeInputRestProps = ({
component,
data,
defaultValue,
error,
format,
formatOnBlur,
formClassName,
Expand All @@ -31,6 +32,7 @@ const sanitizeInputRestProps = ({
render,
resource,
source,
submitError,
subscription,
textAlign,
translate,
Expand Down

0 comments on commit 6cd5c6a

Please sign in to comment.