@kushki/ng-suka
Version:
<p align="center"> <h1 align="center">Suka Components Angular</h1> <p align="center"> An Angular implementation of the Suka Design System </p> </p>
132 lines (131 loc) • 3.74 kB
TypeScript
import { ChangeDetectorRef, ElementRef, EventEmitter } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
export declare enum ToggleState {
Init = 0,
Checked = 1,
Unchecked = 2
}
export declare class ToggleChange {
source: Toggle;
checked: boolean;
}
export declare class Toggle implements ControlValueAccessor {
protected changeDetectorRef: ChangeDetectorRef;
/**
* Variable used for creating unique ids for toggle components.
*/
static toggleCount: number;
/**
* Set to `true` for toggle to be rendered with nested styles.
*/
nested: boolean;
/**
* Set to `true` for toggle to be rendered without any classes on the host element.
*/
inline: boolean;
/**
* Set to `true` for a disabled toggle.
*/
disabled: boolean;
/**
* Set to `true` for a loading toggle.
*/
skeleton: boolean;
/**
* Set to `true` to hide the toggle labels.
*/
hideLabel: boolean;
/**
* Sets the name attribute on the `input` element.
*/
name: string;
/**
* The unique id for the toggle component.
*/
id: string;
/**
* Reflects the required attribute of the `input` element.
*/
required: boolean;
/**
* Sets the value attribute on the `input` element.
*/
value: string;
/**
* Used to set the `aria-label` attribute on the input element.
*/
ariaLabel: string;
/**
* Used to set the `aria-labelledby` attribute on the input element.
*/
ariaLabelledby: string;
/**
* Horizontal distribution of elements
*/
distribution: 'leading' | 'trailing' | 'equalSpacing' | 'center';
/**
* Returns value `true` if state is selected for the toggle.
*/
/**
* Updating the state of a toggle to match the state of the parameter passed in.
*/
checked: boolean;
readonly toggleWrapperClass: boolean;
readonly formItemClass: boolean;
/**
* Emits event notifying other classes when a change in state occurs on a toggle after a
* click.
*/
change: EventEmitter<ToggleChange>;
/**
* Set to `true` if the input toggle is selected (or checked).
*/
_checked: boolean;
currentToggleState: ToggleState;
/**
* Maintains a reference to the view DOM element of the `Toggle`.
*/
inputToggle: ElementRef;
/**
* Creates an instance of `Toggle`.
*/
constructor(changeDetectorRef: ChangeDetectorRef);
/**
* Toggle the selected state of the toggle.
*/
toggle(): void;
writeValue(value: any): void;
/**
* Sets a method in order to propagate changes back to the form.
*/
registerOnChange(fn: any): void;
/**
* Registers a callback to be triggered when the control has been touched.
* @param fn Callback to be triggered when the toggle is touched.
*/
registerOnTouched(fn: any): void;
/**
* Executes on the event of a change within `Toggle` to block propagation.
*/
onChange(event: any): void;
/**
* Handles click events on the `Toggle` and emits changes to other classes.
*/
onClick(event: any): void;
/**
* Called when toggle is blurred. Needed to properly implement `ControlValueAccessor`.
*/
onTouched: () => any;
/**
* Handles changes between toggle states.
*/
transitionToggleState(newState: ToggleState): void;
/**
* Creates instance of `ToggleChange` used to propagate the change event.
*/
emitChangeEvent(): void;
/**
* Method set in `registerOnChange` to propagate changes back to the form.
*/
propagateChange: (_: any) => void;
}