import { cn } from '@/lib/utils/utils'; import { useTheme } from '@/lib/contexts/ThemeContext'; import CheckboxCheckedIcon from '@/assets/icons/checkbox_checked.svg?react'; import CheckboxUndeterminedIcon from '@/assets/icons/checkbox_undetermined.svg?react'; // Checkbox component with custom design interface CheckboxProps { checked: boolean; indeterminate?: boolean; onChange: (checked: boolean) => void; disabled?: boolean; className?: string; tabIndex?: number; } export function Checkbox({ checked, indeterminate = false, onChange, disabled = false, className, tabIndex, }: CheckboxProps) { const { resolvedTheme } = useTheme(); const showIcon = checked || indeterminate; return (
{/* Native checkbox (visually hidden but accessible) */} onChange(e.target.checked)} tabIndex={tabIndex} disabled={disabled} /> {/* Overlay icon with dynamic background and text color */} {showIcon && (
{indeterminate ? ( ) : ( )}
)}
); }