UNPKG

@mobilelivenpm/fds-angular-qa

Version:

This library was generated with [Nx](https://nx.dev).

226 lines (225 loc) 9.76 kB
import { FocusMonitor } from '@angular/cdk/a11y'; import { UniqueSelectionDispatcher } from '@angular/cdk/collections'; import { AfterContentInit, AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, InjectionToken, OnDestroy, OnInit, QueryList } from '@angular/core'; import { ControlValueAccessor } from '@angular/forms'; /** * Provider Expression that allows mat-radio-group to register as a ControlValueAccessor. This * allows it to support [(ngModel)] and ngControl. * @docs-private */ export declare const FDS_RADIO_GROUP_CONTROL_VALUE_ACCESSOR: any; /** Change event object emitted by MatRadio and FdsRadioGroup. */ export declare class FdsRadioChange { /** The MatFdsRadioButton that emits the change event. */ source: _FdsFdsRadioButtonBase; /** The value of the MatFdsRadioButton. */ value: any; constructor( /** The MatFdsRadioButton that emits the change event. */ source: _FdsFdsRadioButtonBase, /** The value of the MatFdsRadioButton. */ value: any); } /** * Injection token that can be used to inject instances of `FdsRadioGroup`. It serves as * alternative token to the actual `FdsRadioGroup` class which could cause unnecessary * retention of the class and its component metadata. */ export declare const FDS_RADIO_GROUP: InjectionToken<_FdsRadioGroupBase<_FdsFdsRadioButtonBase>>; /** * Base class with all of the `FdsRadioGroup` functionality. * @docs-private */ export declare abstract class _FdsRadioGroupBase<T extends _FdsFdsRadioButtonBase> implements AfterContentInit, ControlValueAccessor { private _changeDetector; /** * Event emitted when the group value changes. * Change events are only emitted when the value changes due to user interaction with * a radio button (the same behavior as `<input type-"radio">`). */ readonly change: EventEmitter<FdsRadioChange>; /** Child radio buttons. */ abstract _radios: QueryList<T>; /** Whether the `value` has been set to its initial value. */ private _isInitialized; constructor(_changeDetector: ChangeDetectorRef); /** Selected value for the radio group. */ private _value; /** * Value for the radio-group. Should equal the value of the selected radio button if there is * a corresponding radio button with a matching value. If there is not such a corresponding * radio button, this value persists to be applied in case a new radio button is added with a * matching value. */ get value(): any; set value(newValue: any); /** The HTML name attribute applied to radio buttons in this group. */ private _name; /** Name of the radio button group. All radio buttons inside this group will use this name. */ get name(): string; set name(value: string); /** The currently selected radio button. Should match value. */ private _selected; /** * The currently selected radio button. If set to a new radio button, the radio group value * will be updated to match the new selected button. */ get selected(): T | null; set selected(selected: T | null); /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */ private _labelPosition; /** Whether the labels should appear after or before the radio-buttons. Defaults to 'after' */ get labelPosition(): 'before' | 'after'; set labelPosition(v: 'before' | 'after'); /** Whether the radio group is disabled. */ private _disabled; /** Whether the radio group is disabled */ get disabled(): boolean; set disabled(value: boolean); /** Whether the radio group is required. */ private _required; /** Whether the radio group is required */ get required(): boolean; set required(value: boolean); /** The method to be called in order to update ngModel */ _controlValueAccessorChangeFn: (value: any) => void; /** * onTouch function registered via registerOnTouch (ControlValueAccessor). * @docs-private */ onTouched: () => any; _checkSelectedFdsRadioButton(): void; /** * Initialize properties once content children are available. * This allows us to propagate relevant attributes to associated buttons. */ ngAfterContentInit(): void; /** * Mark this group as being "touched" (for ngModel). Meant to be called by the contained * radio buttons upon their blur. */ _touch(): void; /** Dispatch change event with current selection and group value. */ _emitChangeEvent(): void; _markRadiosForCheck(): void; /** * Sets the model value. Implemented as part of ControlValueAccessor. * @param value */ writeValue(value: any): void; /** * Registers a callback to be triggered when the model value changes. * Implemented as part of ControlValueAccessor. * @param fn Callback to be registered. */ registerOnChange(fn: (value: any) => void): void; /** * Registers a callback to be triggered when the control is touched. * Implemented as part of ControlValueAccessor. * @param fn Callback to be registered. */ registerOnTouched(fn: any): void; /** * Sets the disabled state of the control. Implemented as a part of ControlValueAccessor. * @param isDisabled Whether the control should be disabled. */ setDisabledState(isDisabled: boolean): void; private _updateFdsRadioButtonNames; /** Updates the `selected` radio button from the internal _value state. */ private _updateSelectedRadioFromValue; } /** * A group of radio buttons. May contain one or more `<mat-radio-button>` elements. */ export declare class FdsRadioGroup extends _FdsRadioGroupBase<FdsRadioButton> { _radios: QueryList<FdsRadioButton>; } /** * Base class with all of the `MatFdsRadioButton` functionality. * @docs-private */ export declare abstract class _FdsFdsRadioButtonBase implements OnInit, AfterViewInit, OnDestroy { private elementRef; protected _changeDetector: ChangeDetectorRef; private _focusMonitor; private _radioDispatcher; /** Analog to HTML 'name' attribute used to group radios for unique selection. */ name: string; /** Used to set the 'aria-label' attribute on the underlying input element. */ ariaLabel: string; /** The 'aria-labelledby' attribute takes precedence as the element's text alternative. */ ariaLabelledby: string; /** The 'aria-describedby' attribute is read after the element's label and field type. */ ariaDescribedby: string; /** * Event emitted when the checked state of this radio button changes. * Change events are only emitted when the value changes due to user interaction with * the radio button (the same behavior as `<input type-"radio">`). */ readonly change: EventEmitter<FdsRadioChange>; /** The parent radio group. May or may not be present. */ radioGroup: _FdsRadioGroupBase<_FdsFdsRadioButtonBase>; /** The native `<input type=radio>` element */ _inputElement: ElementRef<HTMLInputElement>; private _uniqueId; /** The unique ID for the radio button. */ id: string; constructor(radioGroup: _FdsRadioGroupBase<_FdsFdsRadioButtonBase>, elementRef: ElementRef, _changeDetector: ChangeDetectorRef, _focusMonitor: FocusMonitor, _radioDispatcher: UniqueSelectionDispatcher); private _tabIndex; get tabIndex(): number; set tabIndex(value: number); private _labelPosition; /** Whether the label should appear after or before the radio button. Defaults to 'after' */ get labelPosition(): 'before' | 'after'; set labelPosition(value: 'before' | 'after'); /** ID of the native input element inside `<mat-radio-button>` */ get inputId(): string; /** Whether this radio is checked. */ private _checked; /** Whether this radio button is checked. */ get checked(): boolean; set checked(value: boolean); private _disabled; /** Whether the radio button is disabled. */ get disabled(): boolean; set disabled(value: boolean); /** Whether this radio is required. */ private _required; /** Whether the radio button is required. */ get required(): boolean; set required(value: boolean); /** Value assigned to this radio. */ private _value; /** The value of this radio button. */ get value(): any; set value(value: any); /** Focuses the radio button. */ focus(options?: FocusOptions): void; /** * Marks the radio button as needing checking for change detection. * This method is exposed because the parent radio group will directly * update bound properties of the radio button. */ _markForCheck(): void; ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; _onInputClick(event: Event): void; /** * Triggered when the radio button received a click or the input recognized any change. * Clicking on a label element, will trigger a change event on the associated input. */ _onInputChange(event: Event): void; /** Sets the disabled state and marks for check if a change occurred. */ protected _setDisabled(value: boolean): void; /** Unregister function for _radioDispatcher */ private _removeUniqueSelectionListener; /** Dispatch change event with current value. */ private _emitChangeEvent; } /** * A Material design radio-button. Typically placed inside of `<mat-radio-group>` elements. */ export declare class FdsRadioButton extends _FdsFdsRadioButtonBase { constructor(radioGroup: FdsRadioGroup, elementRef: ElementRef, changeDetector: ChangeDetectorRef, focusMonitor: FocusMonitor, radioDispatcher: UniqueSelectionDispatcher); }