12
12
import { AriaCheckboxGroupProps , AriaCheckboxProps , HoverEvents , mergeProps , useCheckbox , useCheckboxGroup , useCheckboxGroupItem , useFocusRing , useHover , VisuallyHidden } from 'react-aria' ;
13
13
import { CheckboxContext } from './RSPContexts' ;
14
14
import { CheckboxGroupState , useCheckboxGroupState , useToggleState } from 'react-stately' ;
15
- import { ContextValue , Provider , RACValidation , RenderProps , SlotProps , useContextProps , useRenderProps , useSlot , useSlottedContext } from './utils' ;
15
+ import { ContextValue , Provider , RACValidation , removeDataAttributes , RenderProps , SlotProps , useContextProps , useRenderProps , useSlot , useSlottedContext } from './utils' ;
16
16
import { FieldErrorContext } from './FieldError' ;
17
17
import { filterDOMProps , mergeRefs , useObjectRef } from '@react-aria/utils' ;
18
18
import { FormContext } from './Form' ;
@@ -180,7 +180,7 @@ function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {
180
180
let { labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState
181
181
// eslint-disable-next-line react-hooks/rules-of-hooks
182
182
? useCheckboxGroupItem ( {
183
- ...props ,
183
+ ...removeDataAttributes ( props ) ,
184
184
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
185
185
// it's passed explicitly here to avoid typescript error (requires ignore).
186
186
// @ts -ignore
@@ -190,7 +190,7 @@ function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {
190
190
} , groupState , inputRef )
191
191
// eslint-disable-next-line react-hooks/rules-of-hooks
192
192
: useCheckbox ( {
193
- ...props ,
193
+ ...removeDataAttributes ( props ) ,
194
194
children : typeof props . children === 'function' ? true : props . children ,
195
195
validationBehavior
196
196
// eslint-disable-next-line react-hooks/rules-of-hooks
@@ -204,7 +204,6 @@ function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {
204
204
} ) ;
205
205
206
206
let renderProps = useRenderProps ( {
207
- // TODO: should data attrs go on the label or on the <input>? useCheckbox passes them to the input...
208
207
...props ,
209
208
defaultClassName : 'react-aria-Checkbox' ,
210
209
values : {
0 commit comments