import { SvelteComponentTyped } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; type $RestProps = SvelteHTMLElements["div"]; type $Props = { /** * Specify the value of the checkbox. * Submitted as `"on"` when empty, like a native checkbox. * @default "" */ value?: T; /** * Specify whether the checkbox is checked. * Follows the box when the owning form resets. * @default false */ checked?: boolean; /** * Specify the bound group. */ group?: ReadonlyArray | undefined; /** * Specify whether the checkbox is indeterminate. * @default false */ indeterminate?: boolean; /** * Set to `true` to display the skeleton state * @default false */ skeleton?: boolean; /** * Set to `true` to mark the field as required * @default false */ required?: boolean; /** * Set to `true` for the checkbox to be read-only * @default false */ readonly?: boolean; /** * Specify the assistive text announced to screen readers when read-only. * Exposed because VoiceOver does not announce `aria-readonly`. * @default "Read-only" */ readonlyText?: string; /** * Set to `true` to disable the checkbox * @default false */ disabled?: boolean; /** * Specify the label text * @default "" */ labelText?: string; /** * Set to `true` to visually hide the label text * @default false */ hideLabel?: boolean; /** * Set to `true` to omit the outer margin that spaces a stack of * checkboxes, as when the checkbox sits in a table cell or a row * that spaces its own content. * @default false */ noMargin?: boolean; /** * Specify the helper text * @default "" */ helperText?: string; /** * Set to `true` to indicate an invalid state * @default false */ invalid?: boolean; /** * Specify the invalid state text * @default "" */ invalidText?: string; /** * Set to `true` to indicate a warning state * @default false */ warn?: boolean; /** * Specify the warning state text * @default "" */ warnText?: string; /** * Set a name for the input element * @default "" */ name?: string; /** * Specify the id of a form element outside the component to associate * the checkbox with. */ form?: string | undefined; /** * Set the native `title` attribute on the label element. When unset, * the label takes its full text as `title` while it is truncated. */ title?: string | undefined; /** * Set an id for the input label * @default uniqueId() */ id?: string; /** * Set the tabindex for the input element. */ tabindex?: number | string | undefined; /** * Set to `true` to hide the input from the accessibility tree via CSS * (not just tabindex/aria-hidden, which axe-core's nested-interactive * check does not treat as sufficient). Use when this Checkbox is * nested inside another interactive/widget-role element that already * owns the checked-state semantics (e.g. a listbox option) and the * checkbox itself is purely decorative. * @default false */ decorative?: boolean; /** * Obtain a reference to the input HTML element. * @default null */ ref?: null | HTMLInputElement; decorator?: (this: void) => void; labelChildren?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type CheckboxProps = Omit<$RestProps, keyof $Props> & $Props; export default class Checkbox extends SvelteComponentTyped< CheckboxProps, { blur: WindowEventMap["blur"]; change: WindowEventMap["change"]; check: CustomEvent; click: WindowEventMap["click"]; focus: WindowEventMap["focus"]; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; }, { decorator: Record; labelChildren: Record; } > {}