/** * Boolean entry as an ARIA switch. * * @packageDocumentation */ import { AbstractCellEditor } from './base/abstract-editor'; /** `cellEditorParams` for {@link SwitchEditor}. */ export interface SwitchEditorParams { /** * Accessible label for the control. * * Defaults to the column header. A switch with no name is announced as "on, * switch" and nothing else, which does not identify the setting being changed. */ readonly label?: string; /** * Close the session as soon as the switch is thrown. * * @default false. A switch reads as an immediate action, so turning this on * usually matches the user's expectation; leave it off inside a row-level * edit that should stay open across several fields. */ readonly commitOnToggle?: boolean; } /** * A two-state switch that commits a real `boolean`. * * ### Switch, not checkbox * The distinction is not decorative. A checkbox means "this item is selected"; * a switch means "this setting is on", takes effect immediately, and is * announced as `"on"` / `"off"` rather than `"checked"` / `"not checked"`. That * is exactly what `role="switch"` plus `aria-checked` conveys, and it is the * reason this is a separate editor rather than a skin over * {@link CheckboxEditor}. * * ### Built on a `