1212import { AriaCheckboxGroupProps , AriaCheckboxProps , HoverEvents , mergeProps , useCheckbox , useCheckboxGroup , useCheckboxGroupItem , useFocusRing , useHover , VisuallyHidden } from 'react-aria' ;
1313import { CheckboxContext } from './RSPContexts' ;
1414import { 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' ;
1616import { FieldErrorContext } from './FieldError' ;
1717import { filterDOMProps , mergeRefs , useObjectRef } from '@react-aria/utils' ;
1818import { FormContext } from './Form' ;
@@ -180,7 +180,7 @@ function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {
180180 let { labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid} = groupState
181181 // eslint-disable-next-line react-hooks/rules-of-hooks
182182 ? useCheckboxGroupItem ( {
183- ...props ,
183+ ...removeDataAttributes ( props ) ,
184184 // Value is optional for standalone checkboxes, but required for CheckboxGroup items;
185185 // it's passed explicitly here to avoid typescript error (requires ignore).
186186 // @ts -ignore
@@ -190,7 +190,7 @@ function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {
190190 } , groupState , inputRef )
191191 // eslint-disable-next-line react-hooks/rules-of-hooks
192192 : useCheckbox ( {
193- ...props ,
193+ ...removeDataAttributes ( props ) ,
194194 children : typeof props . children === 'function' ? true : props . children ,
195195 validationBehavior
196196 // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -204,7 +204,6 @@ function Checkbox(props: CheckboxProps, ref: ForwardedRef<HTMLLabelElement>) {
204204 } ) ;
205205
206206 let renderProps = useRenderProps ( {
207- // TODO: should data attrs go on the label or on the <input>? useCheckbox passes them to the input...
208207 ...props ,
209208 defaultClassName : 'react-aria-Checkbox' ,
210209 values : {
0 commit comments