import type { ComponentPropsWithoutRef, CSSProperties } from 'react'; import { forwardRef, useCallback, useEffect, useRef } from 'react'; import classes from './checkbox.module.scss'; import type { CommonFieldWrapperProps } from './form_field_wrapper'; import { FormFieldWrapper } from './form_field_wrapper'; type Props = Omit, 'type'> & { size?: number; indeterminate?: boolean; }; export const CheckboxField = forwardRef< HTMLInputElement, Props & CommonFieldWrapperProps >(({ id, label, hint, status, required, ...otherProps }, ref) => ( {(inputProps) => } )); CheckboxField.displayName = 'CheckboxField'; export const Checkbox = forwardRef( ({ className, size, indeterminate, ...otherProps }, ref) => { const inputRef = useRef(null); const handleRef = useCallback( (element: HTMLInputElement | null) => { inputRef.current = element; if (typeof ref === 'function') { ref(element); } else if (ref) { ref.current = element; } }, [ref], ); useEffect(() => { if (inputRef.current) { inputRef.current.indeterminate = indeterminate || false; } }, [indeterminate]); return ( ); }, ); Checkbox.displayName = 'Checkbox';