@blox/material
Version:
Material Components for Angular
70 lines (69 loc) • 2.49 kB
TypeScript
import { ElementRef, Renderer2, OnInit, OnDestroy } from '@angular/core';
import { NgControl } from '@angular/forms';
import { AbstractMdcInput } from '../abstract/abstract.mdc.input';
/**
* Directive for the native input element of an <code>MdcSwitchDirective</code>.
*/
export declare class MdcSwitchInputDirective extends AbstractMdcInput implements OnInit, OnDestroy {
_elm: ElementRef;
_cntr: NgControl;
private onDestroy$;
private _id;
private _disabled;
private _checked;
constructor(_elm: ElementRef, _cntr: NgControl);
ngOnInit(): void;
ngOnDestroy(): void;
/** @docs-private */
get id(): string | null;
set id(value: string | null);
/** @docs-private */
get disabled(): boolean;
set disabled(value: boolean);
static ngAcceptInputType_disabled: boolean | '';
/** @docs-private */
get checked(): boolean;
set checked(value: boolean);
static ngAcceptInputType_checked: boolean | '';
private updateValue;
}
/**
* Directive for the mandatory thumb element of an `mdcSwitch`. See `mdcSwitch` for more
* information.
*/
export declare class MdcSwitchThumbDirective {
private elm;
private rndr;
constructor(elm: ElementRef, rndr: Renderer2);
private addThumb;
}
/**
* Directive for creating a Material Design switch component. The switch is driven by an
* underlying native checkbox input, which must use the `mdcSwitchInput` directive. The
* `mdcSwitchInput` must be wrapped by an `mdcSwitchThumb`, which must be a direct child of this
* `mdcSwitch` directive.
*
* The current implementation will add all other required DOM elements (such as the
* switch-track). Future implementations will also support supplying (customized) elements
* for those.
*
* This directive can be used together with an <code>mdcFormField</code> to
* easily position switches and their labels, see
* <a href="/components/form-field">mdcFormField</a>.
*/
export declare class MdcSwitchDirective {
private rndr;
private root;
private onDestroy$;
private onInputChange$;
private mdcAdapter;
private foundation;
constructor(rndr: Renderer2, root: ElementRef);
ngAfterContentInit(): void;
ngOnDestroy(): void;
private initFoundation;
private addTrack;
private subscribeInputChanges;
private get _input();
}
export declare const SWITCH_DIRECTIVES: (typeof MdcSwitchInputDirective | typeof MdcSwitchThumbDirective | typeof MdcSwitchDirective)[];