import type { CSSResultGroup } from 'lit'; import DSAIcon from '../icon/icon'; import { ShoelaceElement } from '../../internal/shoelace-element'; import type { ShoelaceFormControl } from '../../internal/shoelace-element'; /** * @summary Switches allow the user to toggle an option on or off. * @documentation https://dsa.service-public-autonomie.fr/latest/librairie-webcomponents/switch-interrupteur/web-QfQYREPu * * @dependency dsa-icon * * @slot - The switch's label. * * @event dsa-blur - Emitted when the control loses focus. * @event dsa-change - Emitted when the control's checked state changes. * @event dsa-input - Emitted when the control receives input. * @event dsa-focus - Emitted when the control gains focus. * @event dsa-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied. */ export default class DSASwitch extends ShoelaceElement implements ShoelaceFormControl { static styles: CSSResultGroup; static dependencies: { 'dsa-icon': typeof DSAIcon; }; private readonly formControlController; private readonly localize; input: HTMLInputElement; private hasFocus; /** The name of the switch, submitted as a name/value pair with form data. */ name: string; /** The current value of the switch, submitted as a name/value pair with form data. */ value: string; /** The switch's size. */ size: 'small' | 'medium' | 'large'; /** Disables the switch. */ disabled: boolean; /** Sets the switch in readonly. */ readonly: boolean; /** Draws the switch in a checked state. */ checked: boolean; /** The default value of the form control. Primarily used for resetting the form control. */ defaultChecked: boolean; /** * By default, form controls are associated with the nearest containing `