Skip to content

Commit a2fa7ca

Browse files
authored
Merge pull request #6001 from andrico1234/bugfix/typescript-error-on-checkbox-label
Bugfix: Prevent TS error on CheckboxGroupInput label styles
2 parents 727b5e2 + 57fcfdd commit a2fa7ca

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

packages/ra-ui-materialui/src/input/CheckboxGroupInput.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import InputHelperText from './InputHelperText';
1616
import classnames from 'classnames';
1717
import Labeled from './Labeled';
1818
import { LinearProgress } from '../layout';
19+
import { ClassesOverride } from '../types';
1920

2021
/**
2122
* An Input component for a checkbox group, using an array of objects for the options
@@ -79,9 +80,7 @@ import { LinearProgress } from '../layout';
7980
*
8081
* The object passed as `options` props is passed to the material-ui <Checkbox> components
8182
*/
82-
const CheckboxGroupInput: FunctionComponent<
83-
ChoicesInputProps<CheckboxProps> & FormControlProps
84-
> = props => {
83+
const CheckboxGroupInput: FunctionComponent<CheckboxGroupInputProps> = props => {
8584
const {
8685
choices = [],
8786
className,
@@ -260,4 +259,10 @@ CheckboxGroupInput.defaultProps = {
260259
row: true,
261260
};
262261

262+
export interface CheckboxGroupInputProps
263+
extends ChoicesInputProps<CheckboxProps>,
264+
FormControlProps {
265+
classes?: ClassesOverride<typeof useStyles>;
266+
}
267+
263268
export default CheckboxGroupInput;

packages/ra-ui-materialui/src/input/index.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import AutocompleteArrayInput, {
44
} from './AutocompleteArrayInput';
55
import AutocompleteInput, { AutocompleteInputProps } from './AutocompleteInput';
66
import BooleanInput from './BooleanInput';
7-
import CheckboxGroupInput from './CheckboxGroupInput';
7+
import CheckboxGroupInput, {
8+
CheckboxGroupInputProps,
9+
} from './CheckboxGroupInput';
810
import DateInput from './DateInput';
911
import DateTimeInput from './DateTimeInput';
1012
import FileInput from './FileInput';
@@ -56,4 +58,8 @@ export {
5658
sanitizeInputRestProps,
5759
};
5860

59-
export type { AutocompleteInputProps, AutocompleteArrayInputProps };
61+
export type {
62+
AutocompleteInputProps,
63+
AutocompleteArrayInputProps,
64+
CheckboxGroupInputProps,
65+
};

0 commit comments

Comments
 (0)