/**
* WordPress dependencies
*/
import { BaseControl } from '@safe-wordpress/components';
import { useInstanceId } from '@safe-wordpress/compose';
import { Icon, check } from '@safe-wordpress/icons';
/**
* Internal dependencies
*/
import './style.scss';
export type PartialCheckboxControlProps = {
readonly label: string | JSX.Element;
readonly className?: string;
readonly heading?: string;
readonly checked?: boolean;
readonly isPartialCheck?: boolean;
readonly help?: string;
readonly onChange: ( checked: boolean ) => void;
};
export const PartialCheckboxControl = ( {
label,
className,
heading,
checked,
isPartialCheck,
help,
onChange,
}: PartialCheckboxControlProps ): JSX.Element => {
const instanceId = useInstanceId( PartialCheckboxControl );
const id = `inspector-partial-checkbox-control-${ instanceId }`;
return (
onChange( !! ev.target.checked ) }
checked={ checked }
aria-describedby={ !! help ? id + '__help' : undefined }
/>
{ !! checked && ! isPartialCheck && (
) }
{ !! checked && !! isPartialCheck && (
) }
);
};
// =======
// HELPERS
// =======
const minus = (
);