@ux-aspects/ux-aspects
Version:
Open source user interface framework for building modern, responsive, mobile big data applications
50 lines (49 loc) • 2.99 kB
TypeScript
import { FocusOrigin } from '@angular/cdk/a11y';
import { EventEmitter } from '@angular/core';
import { ControlValueAccessor } from '@angular/forms';
import { FocusIndicatorDirective } from '../../directives/accessibility';
import { FocusableControl } from '../menu/interfaces/focusable-control.interface';
import * as i0 from "@angular/core";
export declare class ToggleSwitchComponent implements ControlValueAccessor, FocusableControl {
private readonly _changeDetector;
/** Provide a default unique id value for the toggle switch */
_toggleSwitchId: string;
/** Specify a unique id for the element. */
id: string;
/** Specify a form name for the input element. */
name: string | null;
/** Binding for the state of the switch; `true` for "on" and `false` for "off." */
value: boolean;
/** Specify a tabindex. */
tabindex: number;
/** If set to `false` the switch will not be updated when clicking on it, can be used if something else is updating the state of the switch. */
clickable: boolean;
/** If this value is set to `true` then the toggle switch will be disabled. */
disabled: boolean;
/** Specify an aria label for the input element */
ariaLabel: string;
/** Specify an aria labelledby property for the input element */
ariaLabelledby: string;
/** Specified if this is a required input. */
required: boolean;
/** Emits when `value` has been changed. */
valueChange: EventEmitter<boolean>;
/** Get the focus indicator to set focus */
_focusIndicator?: FocusIndicatorDirective;
/** Determine if the underlying input component has been focused with the keyboard */
_focused: boolean;
/** Used to inform Angular forms that the component has been touched */
onTouchedCallback: () => void;
/** Used to inform Angular forms that the component value has changed */
onChangeCallback: (_: unknown) => void;
toggle(): void;
writeValue(value: boolean): void;
registerOnChange(fn: () => void): void;
registerOnTouched(fn: () => void): void;
setDisabledState(isDisabled: boolean): void;
/** Focus the input element */
focus(origin: FocusOrigin): void;
setInputTabIndex(tabindex: number): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ToggleSwitchComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ToggleSwitchComponent, "ux-toggleswitch", never, { "id": { "alias": "id"; "required": false; }; "name": { "alias": "name"; "required": false; }; "value": { "alias": "value"; "required": false; }; "tabindex": { "alias": "tabindex"; "required": false; }; "clickable": { "alias": "clickable"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "ariaLabel": { "alias": "aria-label"; "required": false; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; }; "required": { "alias": "required"; "required": false; }; }, { "valueChange": "valueChange"; }, never, ["*"], false, never>;
}