/** * ZUI Switch Component * Toggle switch with accessibility labels */ import { Component } from '../../core/Component'; import type { BaseProps, Rect, EventCallback } from '../../core/types'; export interface SwitchProps extends BaseProps { /** Switch value (on/off) */ value?: boolean; /** Disabled state */ disabled?: boolean; /** Show I/O labels for accessibility */ showLabels?: boolean; /** Change event handler */ onChange?: EventCallback; /** Position X */ x?: number; /** Position Y */ y?: number; } /** * Switch component for boolean toggle * * Based on ZeppOS design: * - Uses system green for on state * - Supports accessibility labels (I/O) * - Animated thumb movement * * @example * ```ts * // Basic switch * const toggle = new Switch({ * value: true, * onChange: (value) => console.log('Switched:', value), * }); * * // With accessibility labels * const accessibleSwitch = new Switch({ * value: false, * showLabels: true, * onChange: handleChange, * }); * ``` */ export declare class Switch extends Component { readonly type = "Switch"; private trackWidget; private thumbWidget; private labelWidget; private animationId; protected getDefaultProps(): Partial; protected calculateLayout(parentRect?: Rect): void; protected createWidgets(): void; protected updateWidgets(): void; protected destroyWidgets(): void; private handleTap; /** * Toggle switch state * @param animated - Whether to animate the toggle * @param emitChange - Whether to emit onChange callback (default: true) */ toggle(animated?: boolean, emitChange?: boolean): void; private updateLabel; /** * Set switch value */ setValue(value: boolean, animated?: boolean): void; /** * Get current value */ getValue(): boolean; /** * Set disabled state */ setDisabled(disabled: boolean): void; /** * Get accessibility label */ getAccessibilityLabel(): string; } /** * Create a Switch component */ export declare function createSwitch(props: SwitchProps): Switch; //# sourceMappingURL=Switch.d.ts.map