import { useId, type ReactNode } from "react";
import clsx from "clsx";
import { Icon } from "./icons";
import styles from "./Checkbox.module.css";
import { useTx } from "@/platform/i18n";
export interface CheckboxProps {
checked: boolean;
onChange: (checked: boolean) => void;
label?: ReactNode;
disabled?: boolean;
/** Tri-state display. */
indeterminate?: boolean;
className?: string;
"aria-label"?: string;
}
export function Checkbox({ checked, onChange, label, disabled, indeterminate, className, ...aria }: CheckboxProps) {
const id = useId();
const tx = useTx();
return (
);
}
export interface ToggleProps {
checked: boolean;
onChange: (checked: boolean) => void;
label?: ReactNode;
disabled?: boolean;
className?: string;
"aria-label"?: string;
}
/** Switch (`role="switch"`), drawn as IDEA's ON/OFF button. */
export function Toggle({ checked, onChange, label, disabled, className, ...aria }: ToggleProps) {
return (
);
}