import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraSize}from'../../../internal/variants.js';import{type FormOwnerValue}from'../../../internal/form-associated.js';import{type LyraFormValidator}from'../form-validator.js';export interface LyraSwitchEventMap{input:InputEvent;change:Event;'lr-input':CustomEvent<{checked:boolean;}>;'lr-change':CustomEvent<{checked:boolean;}>;focus:FocusEvent;blur:FocusEvent;'lr-invalid':CustomEvent;'lr-switch-toggle-request':CustomEvent<{checked:boolean;}>;} /** * `` — a boolean toggle-switch form control. Structurally the * same idea as a checkbox (form-associated via `ElementInternals`, click and * Space toggle) but with switch semantics: `role="switch"` + * `aria-checked` read to assistive tech as an on/off state rather than a * checked/unchecked one, and there is no indeterminate state. * * `checked` is not a plain string, so this attaches `ElementInternals` * directly and implements its own `updateValidity()` rather than using the * `FormAssociated` mixin (that mixin's `value` accessor assumes a string — * see `` for the same direct-`ElementInternals` shape with a * non-string value). * * Ships an opt-in `hint`/`errorText` form-control chrome (props + matching named slots + * `hint`/`error` CSS parts), mirroring ``'s pattern for those two pieces -- left * unset, neither renders. Deliberately no separate top-of-field `label` prop/slot/part mirroring * ``'s `form-control-label`: the default slot already *is* this control's visible, * clickable label (same as ``), so a second label surface would be redundant. * Its wrapper follows flattened rendered assignment and updates through forwarding slots. Visual * elements, including decorative `aria-hidden` icons, retain the wrapper independently of their * accessibility-tree contribution. * * Host `aria-describedby` references resolve onto the internal switch before its local error/hint * guidance, tracking target changes, reconnect and document adoption. Removing `hint`, `help-text` * or `error-text` safely omits the content while preserving native null property readback. * * @customElement lr-switch * @slot - Label text, rendered next to the track. Clicking it toggles the * switch, the same as clicking a checkbox's associated `