Add support for clicking checkboxes via their labels (#2667)

This commit is contained in:
Keavon Chambers
2025-05-24 04:46:15 -07:00
committed by GitHub
parent 80f38d91c0
commit c4678336e5
13 changed files with 320 additions and 163 deletions
@@ -12,11 +12,13 @@
export let disabled = false;
export let icon: IconName = "Checkmark";
export let tooltip: string | undefined = undefined;
export let forLabel: bigint | undefined = undefined;
let inputElement: HTMLInputElement | undefined;
let id = String(Math.random()).substring(2);
const backupId = String(Math.random()).substring(2);
$: id = forLabel !== undefined ? String(forLabel) : backupId;
$: displayIcon = (!checked && icon === "Checkmark" ? "Empty12px" : icon) as IconName;
export function isChecked() {