import * as _angular_core from '@angular/core'; import { Provider, OnInit, Signal, WritableSignal } from '@angular/core'; import { NgpOrientation } from 'ng-primitives/common'; import { BooleanInput } from '@angular/cdk/coercion'; import * as ng_primitives_state from 'ng-primitives/state'; import { SetterOptions, StateInjectionOptions } from 'ng-primitives/state'; import * as ng_primitives_toggle_group from 'ng-primitives/toggle-group'; import { Observable } from 'rxjs'; interface NgpToggleGroupConfig { /** * The orientation of the toggle group. * @default 'horizontal' */ orientation: NgpOrientation; /** * The type of the toggle group, whether only one item can be selected or multiple. * @default 'single' */ type: 'single' | 'multiple'; /** * Whether a toggle button can be deselected. * @default true */ allowDeselection: boolean; /** * Whether focus should wrap around when reaching the end of the toggle group. * @default true */ wrap: boolean; } /** * Provide the default ToggleGroup configuration * @param config The ToggleGroup configuration * @returns The provider */ declare function provideToggleGroupConfig(config: Partial): Provider[]; declare class NgpToggleGroupItem implements OnInit { /** * The value of the item. * @required */ readonly value: _angular_core.InputSignal; /** * Whether the item is disabled. */ readonly disabled: _angular_core.InputSignalWithTransform; constructor(); ngOnInit(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵdir: _angular_core.ɵɵDirectiveDeclaration, "[ngpToggleGroupItem]", ["ngpToggleGroupItem"], { "value": { "alias": "ngpToggleGroupItemValue"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpToggleGroupItemDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } /** * The state interface for the ToggleGroupItem pattern. */ interface NgpToggleGroupItemState { selected: Signal; toggle(): void; } /** * The props interface for the ToggleGroupItem pattern. */ interface NgpToggleGroupItemProps { /** * The value of the toggle group item. */ value: Signal; /** * Whether the toggle group item is disabled, either in its own right or because the * group it belongs to is disabled. */ disabled?: Signal; } declare const ngpToggleGroupItem: ({ value, disabled: _disabled, }: NgpToggleGroupItemProps) => NgpToggleGroupItemState; declare const injectToggleGroupItemState: { (): Signal; (options: ng_primitives_state.StateInjectionOptions): Signal; (options?: ng_primitives_state.StateInjectionOptions): Signal | Signal; }; declare const provideToggleGroupItemState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; declare class NgpToggleGroup { /** * Access the global toggle group configuration. */ private readonly config; /** * The orientation of the toggle group. */ readonly orientation: _angular_core.InputSignal; /** * Whether focus should wrap around when reaching the end of the toggle group. * @default true */ readonly wrap: _angular_core.InputSignalWithTransform; /** * Whether toggle buttons can be deselected. If set to `false`, clicking a selected toggle button will not deselect it. * @default true */ readonly allowDeselection: _angular_core.InputSignalWithTransform; /** * The type of the toggle group, whether only one item can be selected or multiple. */ readonly type: _angular_core.InputSignal<"single" | "multiple">; /** * The selected value(s) of the toggle group. */ readonly value: _angular_core.InputSignal; /** * The default selected value(s) for uncontrolled usage. * @default [] */ readonly defaultValue: _angular_core.InputSignal; /** * Emits when the value of the toggle group changes. */ readonly valueChange: _angular_core.OutputEmitterRef; /** * The comparator used to determine whether two values are equal. * Useful when values are objects and equality should be checked by value rather than by reference. * @default (a, b) => a === b */ readonly compareWith: _angular_core.InputSignal<(a: T, b: T) => boolean>; /** * Whether the toggle group is disabled. */ readonly disabled: _angular_core.InputSignalWithTransform; /** * The state of the toggle group. */ protected readonly state: ng_primitives_toggle_group.NgpToggleGroupState; /** * Toggle a value in the toggle group. */ toggle(value: T): void; /** * Set the value(s) of the toggle group. */ setValue(newValue: T[], options?: SetterOptions): void; /** * Set the default value(s) of the toggle group. */ setDefaultValue(defaultValue: T[]): void; /** * Set the disabled state of the toggle group. */ setDisabled(isDisabled: boolean): void; /** * Set the orientation of the toggle group. */ setOrientation(newOrientation: NgpOrientation): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵdir: _angular_core.ɵɵDirectiveDeclaration, "[ngpToggleGroup]", ["ngpToggleGroup"], { "orientation": { "alias": "ngpToggleGroupOrientation"; "required": false; "isSignal": true; }; "wrap": { "alias": "ngpToggleGroupWrap"; "required": false; "isSignal": true; }; "allowDeselection": { "alias": "ngpToggleGroupAllowDeselection"; "required": false; "isSignal": true; }; "type": { "alias": "ngpToggleGroupType"; "required": false; "isSignal": true; }; "value": { "alias": "ngpToggleGroupValue"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "ngpToggleGroupDefaultValue"; "required": false; "isSignal": true; }; "compareWith": { "alias": "ngpToggleGroupCompareWith"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpToggleGroupDisabled"; "required": false; "isSignal": true; }; }, { "valueChange": "ngpToggleGroupValueChange"; }, never, never, true, never>; } /** * The state interface for the ToggleGroup pattern. */ interface NgpToggleGroupState { /** * The current value(s) of the toggle group. */ readonly value: WritableSignal; /** * Emit when the value changes. */ readonly valueChange: Observable; /** * Whether the toggle group is disabled. */ readonly disabled: WritableSignal; /** * The orientation of the toggle group. */ readonly orientation: WritableSignal; /** * The type of the toggle group, whether only one item can be selected or multiple. */ readonly type: Signal<'single' | 'multiple'>; /** * Select a value in the toggle group. */ select(selection: T): void; /** * De-select a value in the toggle group. */ deselect(selection: T): void; /** * Check if a value is selected in the toggle group. */ isSelected(selection: T): boolean; /** * Toggle a value in the toggle group. */ toggle(selection: T): void; /** * Set the value(s) of the toggle group. */ setValue(newValue: T[], options?: SetterOptions): void; /** * Set the default value(s) of the toggle group. */ setDefaultValue(defaultValue: T[]): void; /** * Set the disabled state of the toggle group. */ setDisabled(isDisabled: boolean): void; /** * Set the orientation of the toggle group. */ setOrientation(newOrientation: NgpOrientation): void; } /** * The props interface for the ToggleGroup pattern. */ interface NgpToggleGroupProps { /** * The orientation of the toggle-group. */ readonly orientation?: Signal; /** * Whether focus should wrap around when reaching the end of the toggle-group. */ readonly wrap?: Signal; /** * Whether deselection is allowed in the toggle-group. */ readonly allowDeselection?: Signal; /** * The type of the toggle-group (e.g., 'single' or 'multiple'). */ readonly type?: Signal<'single' | 'multiple'>; /** * The value(s) of the toggle-group. */ readonly value: Signal; /** * The default value(s) of the toggle-group for uncontrolled usage. */ readonly defaultValue?: Signal; /** * Whether the toggle-group is disabled. */ readonly disabled?: Signal; /** * The comparator used to determine whether two values are equal. * @default (a, b) => a === b */ readonly compareWith?: Signal<(a: T, b: T) => boolean>; /** * Emit when the value changes. */ readonly onValueChange?: (value: T[]) => void; } declare const ngpToggleGroup: ({ orientation: _orientation, wrap: _wrap, allowDeselection: _allowDeselection, type: _type, value: _value, defaultValue: _defaultValue, disabled: _disabled, compareWith: _compareWith, onValueChange, }: NgpToggleGroupProps) => NgpToggleGroupState; declare const provideToggleGroupState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; /** * Injects the ToggleGroup state, typed to the value type `T`. */ declare function injectToggleGroupState(options?: StateInjectionOptions): Signal>; export { NgpToggleGroup, NgpToggleGroupItem, injectToggleGroupItemState, injectToggleGroupState, ngpToggleGroup, ngpToggleGroupItem, provideToggleGroupConfig, provideToggleGroupItemState, provideToggleGroupState }; export type { NgpToggleGroupConfig, NgpToggleGroupItemProps, NgpToggleGroupItemState, NgpToggleGroupProps, NgpToggleGroupState };