'use client'; import { useId, type KeyboardEvent } from 'react'; import { Check } from 'lucide-react'; type CheckboxProps = { checked: boolean; onChange: (checked: boolean) => void; disabled?: boolean; label: string; id?: string; className?: string; }; /** * App design-system checkbox: primary fill when checked, rounded, focus-visible ring. * Uses a button-like label toggle so mouse clicks do not focus a hidden input (scroll jumps). */ export function Checkbox({ checked, onChange, disabled = false, label, id, className = '', }: CheckboxProps) { const genId = useId(); const inputId = id ?? genId; const toggle = () => { if (!disabled) onChange(!checked); }; const onKeyDown = (event: KeyboardEvent) => { if (disabled) return; if (event.key === ' ' || event.key === 'Enter') { event.preventDefault(); toggle(); } }; return ( ); }