/** * Official Type definitions for the JavaScript Switch * https://lemonadejs.net * Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped */ declare function Switch(el: HTMLElement, options?: Switch.Options): Switch.Instance; declare namespace Switch { interface Options { /** The 'Text' serves as the label displayed on the switch side, indicating the information associated with the switch */ text?: string; /** Value will hold the current switch internal state value */ value?: boolean; /** Checked state */ checked?: boolean; /** Color **/ color?: 'green' | 'orange' | 'red' | 'purple'; /** Identification name */ name?: string; /** Determines whether the switch can be toggled or not */ disabled?: boolean; /** Text position. Default undefined */ position?: 'right' | undefined; /** Onchange event */ onchange: (instance: object, value: string) => void; } interface Instance { /** The 'Text' serves as the label displayed on the switch side, indicating the information associated with the switch */ text?: string; /** Value will hold the current switch internal state value */ value?: boolean; /** Checked state */ checked?: boolean; /** Color **/ color?: 'green' | 'orange' | 'red' | 'purple'; /** Identification name */ name?: string; /** Determines whether the switch can be toggled or not */ disabled?: boolean; /** Text position. Default undefined */ position?: 'right' | undefined; } } // Extend the global custom elements map declare global { interface HTMLElementTagNameMap { 'lm-switch': Switch.Options; } } export default Switch;