import { FocusMonitor } from '@angular/cdk/a11y'; import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnDestroy, QueryList } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; import { CanDisable, HasTabIndex } from 'vdl-angular/core'; import { VdlError } from 'vdl-angular/form-field'; import { VdlCheckboxClickAction } from './checkbox-config'; /** * Provider Expression that allows vdl-checkbox to register as a ControlValueAccessor. * This allows it to support [(ngModel)]. * @docs-private */ export declare const VDL_CHECKBOX_CONTROL_VALUE_ACCESSOR: any; /** * Represents the different states that require custom transitions between them. * @docs-private */ export declare enum TransitionCheckState { /** The initial state of the component before any user interaction. */ Init = 0, /** The state representing the component when it's becoming checked. */ Checked = 1, /** The state representing the component when it's becoming unchecked. */ Unchecked = 2, /** The state representing the component when it's becoming indeterminate. */ Indeterminate = 3, } /** Change event object emitted by VdlCheckbox. */ export declare class VdlCheckboxChange { /** The source VdlCheckbox of the event. */ source: VdlCheckbox; /** The new `checked` value of the checkbox. */ checked: boolean; /** The state of the control (^) key that triggered this event */ ctrlKey: boolean; /** The state of the meta (⌘) key that triggered this event */ metaKey: boolean; /** The state of the shift (⇧) key that triggered this event */ shiftKey: boolean; } /** @docs-private */ export declare class VdlCheckboxBase { _elementRef: ElementRef; constructor(_elementRef: ElementRef); } export declare const _VdlCheckboxMixinBase: (new (...args: any[]) => HasTabIndex) & (new (...args: any[]) => CanDisable) & typeof VdlCheckboxBase; /** * A vdl design checkbox component. Supports all of the functionality of an HTML5 checkbox, * and exposes a similar API. A VdlCheckbox can be either checked, unchecked, indeterminate, or * disabled. Note that all additional accessibility attributes are taken care of by the component, * so there is no need to provide them yourself. However, if you want to omit a label and still * have the checkbox be accessible, you may supply an [aria-label] input. * See: https://material.io/design/components/selection-controls.html */ export declare class VdlCheckbox extends _VdlCheckboxMixinBase implements ControlValueAccessor, AfterViewInit, OnDestroy, CanDisable, HasTabIndex { private _changeDetectorRef; private _focusMonitor; private _ngZone; private _clickAction; _animationMode: string; /** * Optionally set the text to display in the event of an input validation error. */ errorText: string; /** * Optionally specify the hint text, which is rendered below the checkbox. */ hintText: string; /** * Attached to the aria-label attribute of the host element. In most cases, arial-labelledby will * take precedence so this may be omitted. */ ariaLabel: string; /** * Users can specify the `aria-labelledby` attribute which will be forwarded to the input element */ ariaLabelledby: string | null; private _uniqueId; /** A unique id for the checkbox input. If none is supplied, it will be auto-generated. */ id: string; /** Returns the unique id for the visual hidden input. */ readonly inputId: string; /** Whether the checkbox is required. */ required: boolean; private _required; /** Whether the label should appear after or before the checkbox. Defaults to 'after' */ labelPosition: 'before' | 'after'; /** Name value will be applied to the input element if present */ name: string | null; /** Event emitted when the checkbox's `checked` value changes. */ readonly change: EventEmitter; /** Event emitted when the checkbox's `indeterminate` value changes. */ readonly indeterminateChange: EventEmitter; /** The value attribute of the native input element */ value: string; _errorChildren: QueryList; /** The native `` element */ _inputElement: ElementRef; /** * Called when the checkbox is blurred. Needed to properly implement ControlValueAccessor. * @docs-private */ _onTouched: () => any; _hasFocus: boolean; private _currentAnimationClass; private _currentCheckState; private _controlValueAccessorChangeFn; constructor(elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef, _focusMonitor: FocusMonitor, _ngZone: NgZone, tabIndex: string, _clickAction: VdlCheckboxClickAction, _animationMode?: string); /** * Optional input to set the text to use for the checkbox label. * The label, also, has a required indicator that is activated by adding the `required` property to the checkbox * If you do not set the label text, you SHOULD set `aria-label` */ label: string; ngAfterViewInit(): void; ngOnDestroy(): void; /** * Whether the checkbox is checked. */ checked: boolean; private _checked; /** * Whether the checkbox is disabled. This fully overrides the implementation provided by * mixinDisabled, but the mixin is still required because mixinTabIndex requires it. */ disabled: any; private _disabled; /** * Whether the checkbox is indeterminate. This is also known as "mixed" mode and can be used to * represent a checkbox with three states, e.g. a checkbox that represents a nested list of * checkable items. Note that whenever checkbox is manually clicked, indeterminate is immediately * set to false. */ indeterminate: boolean; private _indeterminate; /** Leaving this function in VDL for easier merges */ /** Method being called whenever the label text changes. */ _onLabelTextChange(): void; writeValue(value: any): void; registerOnChange(fn: (value: any) => void): void; registerOnTouched(fn: any): void; setDisabledState(isDisabled: boolean): void; /** Determines whether to display hints or errors. */ _isError(): boolean; _getAriaChecked(): 'true' | 'false' | 'mixed'; private _transitionCheckState(newState); private _emitChangeEvent({shiftKey, ctrlKey, metaKey}); _onInputFocus(): void; _onInputBlur(): void; /** Function is called whenever the focus changes for the input element. */ private _onInputFocusChange(focusOrigin); /** Toggles the `checked` state of the checkbox. */ toggle(): void; /** * Event handler for checkbox input element. * Toggles checked state if element is not disabled. * Do not toggle on (change) event since IE doesn't fire change event when * indeterminate checkbox is clicked. * @param event */ _onInputClick(event: Event): void; /** Focuses the checkbox. */ focus(): void; _onInteractionEvent(event: Event): void; private _getAnimationClassForCheckStateTransition(oldState, newState); }