import * as React from 'react'; import { ErrorType, createComponent, useLocalRef, useUniqueId, } from '@workday/canvas-kit-react/common'; import {CheckboxCheck} from './CheckboxCheck'; import {CheckboxContainer} from './CheckboxContainer'; import {CheckboxInput, type CheckboxProps} from './CheckboxInput'; import {CheckboxRipple} from './CheckboxRipple'; export const Checkbox = createComponent('input')({ displayName: 'Checkbox', Component: ({id, label = '', ...elemProps}: CheckboxProps, ref, Element) => { const {checked = false, disabled, error, indeterminate, variant} = elemProps; const inputId = useUniqueId(id); const {localRef, elementRef} = useLocalRef(ref); React.useEffect(() => { if (typeof indeterminate === 'boolean' && localRef.current) { localRef.current.indeterminate = indeterminate; } }, [indeterminate, localRef]); return ( ); }, subComponents: { ErrorType, }, }); export {type CheckboxProps};