import * as i0 from '@angular/core'; import { OnInit, AfterViewInit, ChangeDetectorRef } from '@angular/core'; import { ControlBaseDirective } from '@talenra/ngx-base/shared'; import { ControlValueAccessor } from '@angular/forms'; /** * Represents a single option in a ``. * * @see {@link RadioGroupDirective} for usage examples. * * ### Import * * ```typescript * import { RadioModule } from '@talenra/ngx-base/radio'; * ``` * * ../../#/on-off-controls */ declare class RadioButtonComponent extends ControlBaseDirective implements OnInit, AfterViewInit { private useTransition; private hostClass; /** Label displayed to the user. */ label: string; /** The control's checked state. */ get checked(): boolean; /** Set the control's checked state. */ set checked(value: boolean); private _checked; /** * The control's name is used to group multiple radio buttons together. * * @internal */ name: string; private group; protected changeDetector: ChangeDetectorRef; /** @internal */ ngOnInit(): void; /** @internal */ ngAfterViewInit(): void; /** * Handle user click * * @internal */ handleClick(): void; /** @internal */ handleBlur(): void; /** @internal */ setDisabledState(isDisabled: boolean): void; private updateHostClass; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_checked: unknown; } /** * Event emitted when the user changes RadioGroup's value. * * ### Import * * ```typescript * import { RadioGroupChange } from '@talenra/ngx-base/radio'; * ``` */ interface RadioGroupChange { /** Reference to the emitting RadioGroup directive */ source: RadioGroupDirective; /** Current value of the RadioGroup */ value: any; } /** * Wraps and controls a group of ``'s. * * #### Reactive form * * ```typescript * // Component class * sampleForm: FormGroup = new FormGroup({ * userChoice: new FormControl('1'), * }); * ``` * * ```html * *
* * * * * *
* ``` * * #### Template driven form * * ```typescript * // Import `FormsModule` in the declaring module * import { FormsModule } from '@angular/forms'; * @NgModule({ * // ... * imports: [FormsModule], *}) * ``` * * ```typescript * // Component class * userChoice = '2'; * ``` * * ```html * *
* * * * * *
* ``` * * ### Import * * ```typescript * import { RadioModule } from '@talenra/ngx-base/radio'; * ``` * * ../../#/on-off-controls */ declare class RadioGroupDirective extends ControlBaseDirective implements ControlValueAccessor { /** * Associated radio buttons * * @internal */ private options?; /** * The value of the associated radio button's `name` attribute. This is how radio buttons are grouped in HTML. * * @internal */ name: string; /** @internal */ id: string; /** * Event emitted when the user changes RadioGroup's value. * * ```typescript * // Component class * import { RadioGroupChange } from '@talenra/ngx-base/radio'; * public radioChange(change: RadioGroupChange): void { * console.log(`RadioGroup (id: ${change.source.id}) has updated to ${change.value}.`); * } * ``` * * ```html * * ... * ``` */ valueChange: i0.OutputEmitterRef; /** Determinates whether the control is en-/disabled. */ get disabled(): boolean; /** Set whether the control is en-/disabled. */ set disabled(value: boolean); /** The control's value. */ get value(): any; /** Set the control's value. */ set value(value: any); /** @internal */ writeValue(value: any): void; /** * Updates the associated radio buttons' `checked` state. */ private updateOptions; /** * Handle click event. Used to emit change event only if value is changed by user interaction. * * @internal */ handleClick(value: any): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; static ngAcceptInputType_disabled: unknown; } export { RadioButtonComponent, RadioGroupDirective };