import { CheckboxChecked } from "./Icons/CheckboxChecked"; import { CheckboxEmpty } from "./Icons/CheckboxEmpty"; import { CheckboxIndeterminate } from "./Icons/CheckboxIndeterminate"; import { Props } from "./Icons/Props"; import React, { forwardRef, useEffect, useRef, type JSX } from "react"; export function Checkbox(props: { checked: boolean; // A parent whose children are only partly checked. Clicking it reports // checked, so callers select the whole group. indeterminate?: boolean; onChange: (e: React.ChangeEvent) => void; children: React.ReactNode; className?: string; small?: boolean; }) { let ref = useRef(null); let indeterminate = !props.checked && !!props.indeterminate; // Only settable on the DOM node, and it's what exposes the mixed state to // assistive tech. useEffect(() => { if (ref.current) ref.current.indeterminate = indeterminate; }, [indeterminate]); let marked = props.checked || indeterminate; return ( ); } type RadioProps = Omit; export function Radio( props: { onChange: (e: React.ChangeEvent) => void; children: React.ReactNode; radioEmptyClassName?: string; radioCheckedClassName?: string; } & JSX.IntrinsicElements["input"], ) { return ( ); } const RadioEmpty = (props: Props) => { return ( ); }; const RadioChecked = (props: Props) => { return ( ); };