import {Checkbox as HeadlessCheckbox, Field, Label} from '@headlessui/react'; import './Checkbox.scss'; /** * A custom, headless-based Checkbox component. * Replaces WordPress CheckboxControl. * * @param {boolean} checked - The current state. * @param {boolean} indeterminate - Whether to show the "some, not all" dash state (e.g. a header "select all" checkbox with a partial selection). Takes visual precedence over `checked`. * @param {function} onChange - Callback receiving the new boolean value (true/false). * @param {string} label - Optional label text next to the checkbox. * @param {boolean} disabled - Whether the checkbox is interactive. * @param {string} className - Additional classes. */ const Checkbox = ( { checked, indeterminate = false, onChange, label, disabled = false, className = '', variantClass, ...props } ) => { const checkIcon = ( ); const dashIcon = ( ); const checkboxMarkup = ( {indeterminate ? dashIcon : checkIcon} ); if ( label ) { return ( {checkboxMarkup} ); } return checkboxMarkup; }; export default Checkbox;