import { FocusMonitor } from '@angular/cdk/a11y'; import { Platform } from '@angular/cdk/platform'; import { AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy, QueryList } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { CanDisable, HammerInput, HasTabIndex } from 'vdl-angular/core'; import { VdlError } from 'vdl-angular/form-field'; import { VdlSlideToggleDefaultOptions } from './slide-toggle-config'; export declare const VDL_SLIDE_TOGGLE_VALUE_ACCESSOR: any; /** Change event object emitted by a VdlSlideToggle. */ export declare class VdlSlideToggleChange { /** The source VdlSlideToggle of the event. */ source: VdlSlideToggle; /** The new `checked` value of the VdlSlideToggle. */ checked: boolean; constructor( /** The source VdlSlideToggle of the event. */ source: VdlSlideToggle, /** The new `checked` value of the VdlSlideToggle. */ checked: boolean); } /** @docs-private */ export declare class VdlSlideToggleBase { _elementRef: ElementRef; constructor(_elementRef: ElementRef); } export declare const _VdlSlideToggleMixinBase: (new (...args: any[]) => HasTabIndex) & (new (...args: any[]) => CanDisable) & typeof VdlSlideToggleBase; /** Represents a slidable "switch" toggle that can be moved between on and off. */ export declare class VdlSlideToggle extends _VdlSlideToggleMixinBase implements OnDestroy, AfterContentInit, ControlValueAccessor, CanDisable, HasTabIndex { private _focusMonitor; private _changeDetectorRef; private _ngZone; defaults: VdlSlideToggleDefaultOptions; _animationMode: string; private onChange; private onTouched; private _uniqueId; private _required; private _checked; /** * focusRipple was removed and replaced with VDLs own focusRing * @docs-private */ _enableFocusRing: boolean; /** Whether the thumb is currently being dragged. */ private _dragging; /** Previous checked state before drag started. */ private _previousChecked; /** Width of the thumb bar of the slide-toggle. */ private _thumbBarWidth; /** Percentage of the thumb while dragging. Percentage as fraction of 100. */ private _dragPercentage; /** Reference to the thumb HTMLElement. */ _thumbEl: ElementRef; /** Reference to the thumb bar HTMLElement. */ _thumbBarEl: ElementRef; /** Name value will be applied to the input element if present */ name: string | null; /** A unique id for the slide-toggle input. If none is supplied, it will be auto-generated. */ id: string; /** * Optionally set the text to display in the event of an input validation error. Will set error flag */ errorText: string; /** * Optionally specify the hint text, which is rendered below the checkbox. */ hintText: string; /** * Optional input to set the text to use for the slide-toggle label. * * The label, also, has a required indicator that is activated by adding the `required` property to the slide-toggle * * If you do not set the label text, you SHOULD set `aria-label` */ label: string; /** Whether the label should appear after or before the slide-toggle. Defaults to 'after' */ labelPosition: 'before' | 'after'; /** Whether the slide-toggle element is checked or not */ /** Used to set the aria-label attribute on the underlying input element. */ ariaLabel: string | null; /** Used to set the aria-labelledby attribute on the underlying input element. */ ariaLabelledby: string | null; /** Whether the slide-toggle is required. */ required: boolean; /** Whether the slide-toggle element is checked or not */ checked: boolean; /** An event will be dispatched each time the slide-toggle changes its value. */ readonly change: EventEmitter; /** * An event will be dispatched each time the slide-toggle input is toggled. * This event always fire when user toggle the slide toggle, but does not mean the slide toggle's * value is changed. The event does not fire when user drag to change the slide toggle value. */ readonly toggleChange: EventEmitter; /** * An event will be dispatched each time the slide-toggle is dragged. * This event always fire when user drag the slide toggle to make a change that greater than 50%. * It does not mean the slide toggle's value is changed. The event does not fire when user toggle * the slide toggle to change the slide toggle's value. */ readonly dragChange: EventEmitter; /** Returns the unique id for the visual hidden input. */ readonly inputId: string; /** Reference to the underlying input element. */ _inputElement: ElementRef; _errorChildren: QueryList; constructor(elementRef: ElementRef, /** * @deprecated The `_platform` parameter to be removed. * @deletion-target 7.0.0 */ _platform: Platform, _focusMonitor: FocusMonitor, _changeDetectorRef: ChangeDetectorRef, tabIndex: string, _ngZone: NgZone, defaults: VdlSlideToggleDefaultOptions, _animationMode?: string); ngAfterContentInit(): void; ngOnDestroy(): void; /** Method being called whenever the underlying input emits a change event. */ _onChangeEvent(event: Event): void; /** Method being called whenever the slide-toggle has been clicked. */ _onInputClick(event: Event): void; /** Implemented as part of ControlValueAccessor. */ writeValue(value: any): void; /** Implemented as part of ControlValueAccessor. */ registerOnChange(fn: any): void; /** Implemented as part of ControlValueAccessor. */ registerOnTouched(fn: any): void; /** Implemented as a part of ControlValueAccessor. */ setDisabledState(isDisabled: boolean): void; /** Focuses the slide-toggle. */ focus(): void; /** Toggles the checked state of the slide-toggle. */ toggle(): void; /** Function is called whenever the focus changes for the input element. */ private _onInputFocusChange(focusOrigin); /** * Emits a change event on the `change` output. Also notifies the FormControl about the change. */ private _emitChangeEvent(); /** Retrieves the percentage of thumb from the moved distance. Percentage as fraction of 100. */ private _getDragPercentage(distance); /** Determines whether to display hints or errors. */ _isError(): boolean; _onDragStart(): void; _onDrag(event: HammerInput): void; _onDragEnd(): void; }