import * as i0 from '@angular/core'; import { OnInit, DoCheck, OnChanges, ElementRef, Renderer2, SimpleChanges } from '@angular/core'; import { ControlValueAccessor, NgControl } from '@angular/forms'; import { InputDirective } from '@eui/components/shared'; import { BooleanInput } from '@angular/cdk/coercion'; /** * @description * Radio input component for selecting a single value from a set of mutually exclusive options. * Integrates with Angular forms (both reactive and template-driven) and provides custom EUI styling. * Implements ControlValueAccessor for seamless form integration with validation states and error handling. * Automatically manages checked state, value binding, and form control synchronization. * Must be applied as an attribute directive to native HTML radio input elements. * * @usageNotes * ### Basic Usage * ```html * *
* * *
*
* * *
*
* * *
* ``` * * ### Reactive Forms * ```html *
*
* * *
*
* * *
*
* ``` * * ```typescript * myForm = this.fb.group({ * plan: ['basic', Validators.required] * }); * ``` * * ### With Validation * ```html *
*
* * *
*
* * *
*
* Please select an option *
*
* ``` * * ### Disabled State * ```html * * * ``` * * ### Accessibility * - Always associate radio inputs with labels using for/id attributes * - Group related radio buttons with the same name attribute * - Use fieldset and legend for radio button groups * - Provide clear, descriptive labels for each option * - Invalid state automatically applies aria-invalid * - Keyboard navigation: Tab to focus, Space to select * * ### Notes * - Radio buttons with the same name are mutually exclusive * - Automatically generates unique IDs if not provided * - Invalid state styling applied when form control is invalid * - Supports readonly mode to prevent changes * - Value can be string, number, or boolean * - Integrates with Angular form validation * - Use with eui-label components for consistent styling * * @example * * */ declare class EuiInputRadioComponent extends InputDirective implements OnInit, DoCheck, OnChanges, ControlValueAccessor { /** * Gets or sets whether the radio input is in an invalid state. * This can be set manually or will be automatically set when used with form validation. * * @property {boolean} isInvalid - The invalid state of the radio input */ get isInvalid(): boolean; set isInvalid(state: BooleanInput); protected _isInvalid: boolean; /** * Gets the CSS classes for the radio input component. * Combines base classes with invalid state modifier if applicable. * * @returns {string} Space-separated list of CSS classes */ get class(): string; protected type: string; /** * Gets or sets the default checked state of the radio input. * This is different from the current checked state and represents the initial value. * * @property {any} defaultChecked - The default checked state */ get defaultChecked(): any; set defaultChecked(value: BooleanInput); protected _defaultChecked: boolean; /** * Gets whether the radio input is currently selected. * * @returns {boolean} True if the radio input is selected, false otherwise */ get selected(): boolean; /** * Gets or sets the value of the radio input. * The value can be of any type and will be used when the radio is selected in a form group. * * @property {any} value - The value associated with this radio input */ get value(): any; set value(value: any); private _value; protected ngControl: NgControl; protected _elementRef: ElementRef; protected _renderer: Renderer2; constructor(); /** * Initializes the component. * Sets up form control validation status subscription and handles initial state. */ ngOnInit(): void; /** * Performs change detection and updates invalid state based on form control status. */ ngDoCheck(): void; /** * Handles changes to component inputs. Specifically, handles changes to * readonly and invalid states. * * @param {SimpleChanges} changes - Object containing changed properties */ ngOnChanges(changes: SimpleChanges): void; /** * Implements ControlValueAccessor.writeValue. * Updates the checked state based on the form control value. * * @param {string} obj - The value to write */ writeValue(obj: string): void; /** * Registers a callback function that is called when the control's value changes. * * @param {Function} fn - The callback function */ registerOnChange(fn: any): void; /** * Registers a callback function that is called when the control is touched. * * @param {Function} fn - The callback function */ registerOnTouched(fn: any): void; /** * Sets the disabled state of the radio input. * * @param {boolean} isDisabled - Whether the radio input should be disabled */ setDisabledState?(isDisabled: boolean): void; /** * Handles change events on the radio input. * Updates the model value when the radio selection changes. * * @param {Event} event - The change event */ protected onCheckedChanged(event: Event): void; /** * Handles space key press events. Prevents selection changes when the input * is readonly. * * @param {KeyboardEvent} event - The keyboard event */ protected onSpacePressed(event: KeyboardEvent): void; /** * Sets the invalid state of the radio input. * Updates both the internal state and the visual appearance. * * @param {boolean} state - The invalid state to set */ protected setInvalid(state: any): void; protected onChange: (_: any) => void; protected onTouched: (_: any) => void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare const EUI_INPUT_RADIO: readonly [typeof EuiInputRadioComponent]; export { EUI_INPUT_RADIO, EuiInputRadioComponent }; //# sourceMappingURL=eui-components-eui-input-radio.d.ts.map