/*! Strand UI | MIT License | dillingerstaffing.com */ import type { JSX } from "preact"; import { forwardRef } from "preact/compat"; import { cx } from "../../internal/index.js"; export interface CheckboxProps extends Omit, "checked" | "onChange" | "label" | "type" | "role"> { /** Controlled state; leave unset to let the input own it. */ checked?: boolean; /** Initial state of an uncontrolled checkbox. */ defaultChecked?: boolean; /** Mixed state; the DOM property, so :indeterminate paints and announces it. */ indeterminate?: boolean; onChange?: (e: Event) => void; disabled?: boolean; label?: string; /** `compact` drops the row to 30px on a fine pointer only (DL 14.7). */ density?: "comfortable" | "compact"; className?: string; } /** * Toggle for a boolean or mixed selection; the native input carries the state and the sheet reads it. * * @example * setAgreed((a) => !a)} label="Accept terms" /> */ export const Checkbox = forwardRef( ({ checked, defaultChecked, indeterminate = false, onChange, disabled = false, label, density = "comfortable", className = "", ...rest }, ref) => ( ), ); Checkbox.displayName = "Checkbox";