import { defineWebComponent } from './define'; import { Switch } from '../ui/switch'; interface Props extends Record { /** Initial checked state. Bare attribute (``) turns it on. */ checked?: boolean; /** Disable interaction. */ disabled?: boolean; /** Accessible label. */ label?: string; } /** Events fired by ``. */ interface Events { /** The toggle changed. */ 'kc-change': { checked: boolean }; } /** * `` — a toggle switch. Self-manages its on/off state; set the initial * state with the `checked` attribute and read changes from `kc-change`. * * ```html * * * ``` */ defineWebComponent('kc-switch', { checked: undefined, disabled: undefined, label: undefined, }, (props, { dispatch, flag }) => ( dispatch('kc-change', { checked })} /> ));