import { forwardRef } from 'react'; import { useDOMRef } from '../../utils/dom'; import { StyledCheckbox, StyledCheckboxContainer, StyledCheckboxContent, StyledCheckboxLabel, StyledCheckboxOuterContainer, } from './Checkbox.style'; import { useCheckboxContext } from './Checkbox.context'; export type CheckboxProps = Omit, 'size'> & { children?: React.ReactNode; label?: React.ReactNode; size?: 'small' | 'regular' | 'medium'; width?: string; }; export const Checkbox = forwardRef((props, ref) => { const domRef = useDOMRef(ref); const { children, name, disabled = false, size = 'regular', width = '100%', ...rest } = props; const context = useCheckboxContext(); return ( {props.label && {props.label}} {children && ( domRef.current?.click()}> {children} )} ); });