import * as i0 from '@angular/core'; import { InjectionToken, Signal, InputSignal, ModelSignal, InputSignalWithTransform, OutputEmitterRef, OnInit, ElementRef } from '@angular/core'; import { ControlValueAccessor, NgControl } from '@angular/forms'; import { ErrorStateMatcher } from 'ngx-com/components/form-field'; /** Radio size variants. */ type RadioSize = 'sm' | 'md' | 'lg'; /** Radio color variants. */ type RadioVariant = 'primary' | 'accent' | 'warn'; /** Radio group orientation. */ type RadioOrientation = 'vertical' | 'horizontal'; /** * CVA variants for the visual radio circle. * * Uses `peer` selectors to style based on native input state: * - `peer-checked:` for checked state * - `peer-focus-visible:` for keyboard focus * - `peer-disabled:` for disabled state * * @tokens `--color-border`, `--color-primary`, `--color-primary-hover`, * `--color-accent`, `--color-accent-hover`, * `--color-warn`, `--color-warn-hover`, * `--color-disabled`, `--color-ring` */ declare const radioCircleVariants: (props?: { variant?: RadioVariant; size?: RadioSize; }) => string; /** Size-based classes for the inner dot indicator. */ declare const RADIO_DOT_SIZES: Record; /** Size-based classes for the label content. */ declare const RADIO_LABEL_SIZES: Record; /** Orientation-based classes for the radio group container. */ declare const RADIO_GROUP_ORIENTATIONS: Record; /** Event emitted when radio group value changes. */ interface RadioGroupChange { value: string | null; } /** Interface for radio items that register with the group. */ interface RadioItem { value: () => string; isDisabled: () => boolean; focus: () => void; } /** Context provided to child radio components via DI. */ interface ComRadioGroupContext { name: Signal; value: Signal; disabled: Signal; size: Signal; variant: Signal; orientation: Signal; focusedValue: Signal; select: (value: string) => void; focusNext: (currentValue: string) => void; focusPrevious: (currentValue: string) => void; register: (radio: RadioItem) => void; unregister: (radio: RadioItem) => void; onTouched?: () => void; } /** Injection token for radio group context. */ declare const COM_RADIO_GROUP: InjectionToken; /** * Radio group component that manages a set of radio buttons. * * Provides mutual exclusion, shared name, and roving tabindex keyboard navigation. * Implements `ControlValueAccessor` for Reactive Forms integration. * * @tokens `--color-border`, `--color-primary`, `--color-primary-foreground`, `--color-primary-hover`, * `--color-accent`, `--color-accent-foreground`, `--color-accent-hover`, * `--color-warn`, `--color-warn-foreground`, `--color-warn-hover`, * `--color-disabled`, `--color-disabled-foreground`, `--color-ring` * * @example Basic usage * ```html * * Apple * Banana * Cherry * * ``` * * @example With reactive forms * ```html * * Small * Medium * Large * * ``` * * @example Horizontal orientation * ```html * * Red * Green * Blue * * ``` * * @example With variants * ```html * * Low * Medium * High * * ``` */ declare class ComRadioGroup implements ControlValueAccessor { /** Optional NgControl for reactive forms integration. */ readonly ngControl: NgControl | null; /** Error state matcher for determining when to show validation errors. */ private readonly defaultErrorStateMatcher; private readonly parentForm; private readonly parentFormGroup; /** Unique ID for this radio group instance. */ private readonly uniqueId; /** ID for the error message element. */ readonly errorId: string; /** Registered radio items. */ private readonly registeredRadios; readonly name: InputSignal; readonly value: ModelSignal; readonly disabled: ModelSignal; readonly required: InputSignalWithTransform; readonly orientation: InputSignal; readonly size: InputSignal; readonly variant: InputSignal; readonly errorMessage: InputSignal; readonly errorStateMatcher: InputSignal; /** Tracks touched state — writable by both CVA callback and Signal Forms [formField]. */ readonly touched: ModelSignal; readonly invalid: InputSignal; readonly sfErrors: InputSignal; readonly ariaLabel: InputSignal; readonly ariaLabelledby: InputSignal; readonly ariaDescribedby: InputSignal; /** Emits when the selection changes, with full event details. */ readonly selectionChange: OutputEmitterRef; /** * Tracks the currently focused radio value for roving tabindex. * Resets to the current selection (or first focusable) when value or radios change. */ private readonly focusedValueSignal; /** * Computed error state derived from form validation. * Shows errors when control is invalid and touched/submitted. */ readonly errorState: Signal; readonly computedAriaDescribedby: Signal; protected readonly groupClasses: Signal; private onChange; private onTouchedCallback; constructor(); /** Creates the context object for child radios. */ createContext(): ComRadioGroupContext; /** Register a radio item with the group. */ private register; /** Unregister a radio item from the group. */ private unregister; writeValue(value: string | null): void; registerOnChange(fn: (value: string | null) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; /** Selects a radio by value. */ select(newValue: string): void; /** Focuses the next non-disabled radio (with cyclic wrap). */ focusNext(currentValue: string): void; /** Focuses the previous non-disabled radio (with cyclic wrap). */ focusPrevious(currentValue: string): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** Event emitted when a radio is selected. */ interface RadioChange { value: string; source: ComRadio; } /** * Production-grade radio component with full accessibility support. * * Uses a native `` for built-in keyboard handling, * `:checked` pseudo-class, and screen reader support. * * Must be used within a `ComRadioGroup` which manages the selected value * and provides the shared `name` attribute. * * @tokens `--color-border`, `--color-primary`, `--color-primary-foreground`, `--color-primary-hover`, * `--color-accent`, `--color-accent-foreground`, `--color-accent-hover`, * `--color-warn`, `--color-warn-foreground`, `--color-warn-hover`, * `--color-disabled`, `--color-disabled-foreground`, `--color-ring` * * @example Basic usage within a group * ```html * * Option 1 * Option 2 * Option 3 * * ``` * * @example Disabled option * ```html * * Enabled option * Disabled option * * ``` */ declare class ComRadio implements OnInit, RadioItem { /** Optional parent radio group context. */ private readonly group; /** DestroyRef for cleanup. */ private readonly destroyRef; /** Reference to the native input element. */ readonly inputRef: Signal | undefined>; /** Unique ID for this radio instance. */ private readonly uniqueId; readonly value: InputSignal; readonly size: InputSignal; readonly variant: InputSignal; readonly disabled: ModelSignal; readonly id: InputSignal; readonly ariaLabel: InputSignal; readonly ariaLabelledby: InputSignal; readonly ariaDescribedby: InputSignal; readonly changed: OutputEmitterRef; readonly inputId: Signal; /** Resolve size from group or local input. */ readonly resolvedSize: Signal; /** Resolve variant from group or local input. */ readonly resolvedVariant: Signal; /** Whether this radio is checked based on group value. */ readonly isChecked: Signal; /** Whether this radio is disabled (from local or group). */ readonly isDisabled: Signal; /** Get name from group. */ readonly groupName: Signal; /** Tab index for roving tabindex pattern. */ readonly tabIndex: Signal; protected readonly circleClasses: Signal; protected readonly dotSizeClass: Signal; protected readonly labelSizeClass: Signal; ngOnInit(): void; protected onInputChange(event: Event): void; protected onBlur(): void; protected onKeyDown(event: KeyboardEvent): void; /** Focuses this radio's input element. */ focus(): void; /** Selects this radio programmatically. */ select(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export { COM_RADIO_GROUP, ComRadio, ComRadioGroup, RADIO_DOT_SIZES, RADIO_GROUP_ORIENTATIONS, RADIO_LABEL_SIZES, radioCircleVariants }; export type { ComRadioGroupContext, RadioChange, RadioGroupChange, RadioItem, RadioOrientation, RadioSize, RadioVariant };