| 
1 | 1 | import {clsx} from 'clsx'  | 
2 | 2 | import {useProvidedRefOrCreate} from '../hooks'  | 
3 | 3 | import React, {useContext, useEffect, type ChangeEventHandler, type InputHTMLAttributes, type ReactElement} from 'react'  | 
4 |  | -import {type SxProp} from '../sx'  | 
5 | 4 | import useLayoutEffect from '../utils/useIsomorphicLayoutEffect'  | 
6 | 5 | import type {FormValidationStatus} from '../utils/types/FormValidationStatus'  | 
7 | 6 | import {CheckboxGroupContext} from '../CheckboxGroup/CheckboxGroupContext'  | 
8 | 7 | import classes from './Checkbox.module.css'  | 
9 | 8 | import sharedClasses from './shared.module.css'  | 
10 |  | -import Box from '../Box'  | 
11 | 9 | 
 
  | 
12 | 10 | export type CheckboxProps = {  | 
13 | 11 |   /**  | 
@@ -35,27 +33,14 @@ export type CheckboxProps = {  | 
35 | 33 |    * Used during form submission and to identify which checkbox inputs are selected  | 
36 | 34 |    */  | 
37 | 35 |   value?: string  | 
38 |  | -} & Exclude<InputHTMLAttributes<HTMLInputElement>, 'value'> &  | 
39 |  | -  SxProp  | 
 | 36 | +} & Exclude<InputHTMLAttributes<HTMLInputElement>, 'value'>  | 
40 | 37 | 
 
  | 
41 | 38 | /**  | 
42 | 39 |  * An accessible, native checkbox component  | 
43 | 40 |  */  | 
44 | 41 | const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(  | 
45 | 42 |   (  | 
46 |  | -    {  | 
47 |  | -      checked,  | 
48 |  | -      className,  | 
49 |  | -      defaultChecked,  | 
50 |  | -      indeterminate,  | 
51 |  | -      disabled,  | 
52 |  | -      onChange,  | 
53 |  | -      sx: sxProp,  | 
54 |  | -      required,  | 
55 |  | -      validationStatus,  | 
56 |  | -      value,  | 
57 |  | -      ...rest  | 
58 |  | -    },  | 
 | 43 | +    {checked, className, defaultChecked, indeterminate, disabled, onChange, required, validationStatus, value, ...rest},  | 
59 | 44 |     ref,  | 
60 | 45 |   ): ReactElement => {  | 
61 | 46 |     const checkboxRef = useProvidedRefOrCreate(ref as React.RefObject<HTMLInputElement>)  | 
@@ -99,16 +84,6 @@ const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(  | 
99 | 84 |       }  | 
100 | 85 |     })  | 
101 | 86 | 
 
  | 
102 |  | -    if (sxProp) {  | 
103 |  | -      return (  | 
104 |  | -        <Box  | 
105 |  | -          as="input"  | 
106 |  | -          {...inputProps}  | 
107 |  | -          className={clsx(className, sharedClasses.Input, classes.Checkbox)}  | 
108 |  | -          sx={sxProp}  | 
109 |  | -        />  | 
110 |  | -      )  | 
111 |  | -    }  | 
112 | 87 |     return <input {...inputProps} className={clsx(className, sharedClasses.Input, classes.Checkbox)} />  | 
113 | 88 |   },  | 
114 | 89 | )  | 
 | 
0 commit comments