import * as ng_primitives_radio from 'ng-primitives/radio'; import * as _angular_core from '@angular/core'; import { Signal, WritableSignal, OnInit } from '@angular/core'; import { BooleanInput } from '@angular/cdk/coercion'; import { NgpOrientation } from 'ng-primitives/common'; import { StateInjectionOptions, SetterOptions } from 'ng-primitives/state'; import { Observable } from 'rxjs'; /** * Apply the `ngpRadioGroup` directive to an element that represents the group of radio items. */ declare class NgpRadioGroup { /** * The id of the radio group. If not provided, a unique id will be generated. */ readonly id: _angular_core.InputSignal; /** * The value of the radio group. Leave unset for uncontrolled usage. */ readonly value: _angular_core.InputSignal; /** * The default value of the radio group for uncontrolled usage. */ readonly defaultValue: _angular_core.InputSignal; /** * Event emitted when the radio group value changes. */ readonly valueChange: _angular_core.OutputEmitterRef; /** * Whether the radio group is disabled. */ readonly disabled: _angular_core.InputSignalWithTransform; /** * The orientation of the radio group. * @default 'horizontal' */ readonly orientation: _angular_core.InputSignal; /** * The comparator function for the radio group. This is useful if values are objects and you want to compare them by value, not by reference. * @default (a, b) => a === b */ readonly compareWith: _angular_core.InputSignal<(a: T | null, b: T | null) => boolean>; /** * The state of the radio group. */ protected readonly state: ng_primitives_radio.NgpRadioGroupState; /** * Select a radio item. * @param value The value of the radio item to select. */ select(value: T): void; /** * Set the default value of the radio group. */ setDefaultValue(value: T | null): void; /** * Set the orientation of the radio group. */ setOrientation(orientation: NgpOrientation): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵdir: _angular_core.ɵɵDirectiveDeclaration, "[ngpRadioGroup]", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "ngpRadioGroupValue"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "ngpRadioGroupDefaultValue"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpRadioGroupDisabled"; "required": false; "isSignal": true; }; "orientation": { "alias": "ngpRadioGroupOrientation"; "required": false; "isSignal": true; }; "compareWith": { "alias": "ngpRadioGroupCompareWith"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpRadioGroupValueChange"; }, never, never, true, never>; } /** * Public state surface for the RadioGroup primitive. */ interface NgpRadioGroupState { /** * The id of the radio group. */ readonly id: Signal; /** * The selected value of the radio group. */ readonly value: WritableSignal; /** * Whether the radio group is disabled. */ readonly disabled: WritableSignal; /** * The orientation of the radio group. */ readonly orientation: WritableSignal; /** * The comparator function used to compare values. */ readonly compareWith: Signal<(a: T | null, b: T | null) => boolean>; /** * Emits when the selected value changes. */ readonly valueChange: Observable; /** * Select a value in the radio group. */ select(value: T): void; /** * Set the value of the radio group. Fires `onValueChange` and emits on the * `valueChange` observable by default. Pass `{ emit: false }` for cases like * form `writeValue` where the internal state should sync without notifying. */ setValue(value: T | null, options?: SetterOptions): void; /** * Set the default value used for uncontrolled usage. */ setDefaultValue(value: T | null): void; /** * Set the disabled value. */ setDisabled(value: boolean): void; /** * Set the orientation of the radio group. */ setOrientation(value: NgpOrientation): void; } /** * Inputs for configuring the RadioGroup primitive. */ interface NgpRadioGroupProps { /** * The id of the radio group. */ readonly id?: Signal; /** * The selected value of the radio group. Leave `undefined` for uncontrolled * usage (the group manages its own value from `defaultValue`). */ readonly value?: Signal; /** * The default value for uncontrolled usage. */ readonly defaultValue?: Signal; /** * Whether the radio group is disabled. */ readonly disabled?: Signal; /** * The orientation of the radio group. */ readonly orientation?: Signal; /** * The comparator function used to compare values. */ readonly compareWith?: Signal<(a: T | null, b: T | null) => boolean>; /** * Callback fired when the selected value changes. */ readonly onValueChange?: (value: T | null) => void; } declare const ngpRadioGroup: ({ id, value: _value, defaultValue: _defaultValue, disabled: _disabled, orientation: _orientation, compareWith, onValueChange, }: NgpRadioGroupProps) => NgpRadioGroupState; declare const provideRadioGroupState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; /** * Injects the RadioGroup state. */ declare function injectRadioGroupState(options?: StateInjectionOptions): Signal>; /** * Apply the `ngpRadioIndicator` directive to an element that represents the radio indicator (i.e. the dot). */ declare class NgpRadioIndicator { /** * Access the radio group item state */ protected readonly radioItemState: _angular_core.Signal>; /** * Determine if the radio indicator is checked. Delegates to the item's * checked state so it honours the group's `compareWith` comparator. */ protected readonly checked: _angular_core.Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵdir: _angular_core.ɵɵDirectiveDeclaration, "[ngpRadioIndicator]", never, {}, {}, never, never, true, never>; } /** * Apply the `ngpRadioItem` directive to an element that represents a radio item. This would typically be a `button` element. */ declare class NgpRadioItem implements OnInit { /** * The value of the radio item. * @required */ readonly value: _angular_core.InputSignal; /** * Whether the radio item is disabled. * @default false */ readonly disabled: _angular_core.InputSignalWithTransform; constructor(); ngOnInit(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵdir: _angular_core.ɵɵDirectiveDeclaration, "[ngpRadioItem]", never, { "value": { "alias": "ngpRadioItemValue"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpRadioItemDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } /** * Public state surface for the RadioItem primitive. */ interface NgpRadioItemState { /** * The value of the radio item. */ readonly value: Signal; /** * Whether the radio item is disabled, either in its own right or because the * group it belongs to is disabled. */ readonly disabled: Signal; /** * Whether the radio item is checked. */ readonly checked: Signal; } /** * Inputs for configuring the RadioItem primitive. */ interface NgpRadioItemProps { /** * The value of the radio item. */ readonly value: Signal; /** * Whether the radio item is disabled. */ readonly disabled?: Signal; } declare const ngpRadioItem: ({ value, disabled: _disabled, }: NgpRadioItemProps) => NgpRadioItemState; declare const provideRadioItemState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; /** * Injects the RadioItem state. */ declare function injectRadioItemState(options?: StateInjectionOptions): Signal>; export { NgpRadioGroup, NgpRadioIndicator, NgpRadioItem, injectRadioGroupState, injectRadioItemState, ngpRadioGroup, ngpRadioItem, provideRadioGroupState, provideRadioItemState }; export type { NgpRadioGroupProps, NgpRadioGroupState, NgpRadioItemProps, NgpRadioItemState };