import * as _angular_core from '@angular/core'; import { Signal } from '@angular/core'; import * as ng_primitives_state from 'ng-primitives/state'; import * as ng_primitives_utils from 'ng-primitives/utils'; import { NgpControlStatus } from 'ng-primitives/utils'; import { BooleanInput } from '@angular/cdk/coercion'; import { NgControl } from '@angular/forms'; /** * The `NgpDescription` directive is used to mark a description element within a form field. There may be multiple descriptions associated with a form control. */ declare class NgpDescription { /** * The id of the description. If not provided, a unique id will be generated. */ readonly id: _angular_core.InputSignal; /** * The description state. */ constructor(); static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * The state interface for the Description primitive. */ interface NgpDescriptionState { /** * The id of the description. */ readonly id: Signal; } /** * The props interface for the Description primitive. */ interface NgpDescriptionProps { /** * The id of the description. */ readonly id: Signal; } declare const ngpDescription: ({ id }: NgpDescriptionProps) => { id: Signal; }; declare const injectDescriptionState: { (): Signal<{ id: Signal; }>; (options: ng_primitives_state.StateInjectionOptions): Signal<{ id: Signal; } | null>; (options?: ng_primitives_state.StateInjectionOptions): Signal<{ id: Signal; }> | Signal<{ id: Signal; } | null>; }; declare const provideDescriptionState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; /** * The `NgpError` directive is used to mark an error message element within a form field. There may be multiple error messages associated with a form control. */ declare class NgpError { /** * The id of the error message. If not provided, a unique id will be generated. */ readonly id: _angular_core.InputSignal; /** * The validator associated with the error message. */ readonly validator: _angular_core.InputSignal; /** * The error state. */ constructor(); static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * The state interface for the Error primitive. */ interface NgpErrorState { /** * The id of the error message. */ readonly id: Signal; /** * Determine if there is an error message. */ readonly hasError: Signal; /** * Determine whether the validator associated with this error is failing. */ readonly state: Signal<'fail' | 'pass'>; } /** * The props interface for the Error primitive. */ interface NgpErrorProps { /** * The id of the error message. */ readonly id: Signal; /** * The validator associated with the error message. */ readonly validator?: Signal; } declare const ngpError: ({ id, validator }: NgpErrorProps) => { id: Signal; hasError: Signal; state: Signal<"fail" | "pass">; }; declare const injectErrorState: { (): Signal<{ id: Signal; hasError: Signal; state: Signal<"fail" | "pass">; }>; (options: ng_primitives_state.StateInjectionOptions): Signal<{ id: Signal; hasError: Signal; state: Signal<"fail" | "pass">; } | null>; (options?: ng_primitives_state.StateInjectionOptions): Signal<{ id: Signal; hasError: Signal; state: Signal<"fail" | "pass">; }> | Signal<{ id: Signal; hasError: Signal; state: Signal<"fail" | "pass">; } | null>; }; declare const provideErrorState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; /** * Typically this primitive would be not be used directly, but instead a more specific form control primitive would be used (e.g. `ngpInput`). All of our form control primitives use `ngpFormControl` internally so they will have the same accessibility features as described below. * * The `NgpFormControl` directive is used to mark a form control element within a form field. This element will have an `aria-labelledby` attribute set to the ID of the label element within the form field and an `aria-describedby` attribute set to the ID of the description elements within the form field. */ declare class NgpFormControl { /** * The id of the form control. If not provided, a unique id will be generated. */ readonly id: _angular_core.InputSignal; /** * Whether the form control is disabled by a parent. */ readonly disabled: _angular_core.InputSignalWithTransform; /** * The status of the form control. */ readonly status: _angular_core.Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } interface NgpFormControlProps { /** * The id of the form control. */ readonly id: Signal; /** * Whether the form control is disabled by a parent. */ readonly disabled?: Signal; } declare function ngpFormControl({ id, disabled, }: NgpFormControlProps): Signal; /** * The `NgpFormField` directive is a container for form field elements. Any labels, form controls, or descriptions should be placed within this directive. */ declare class NgpFormField { /** * Find any NgControl within the form field. * @internal */ private readonly ngControl; /** * The form field state. */ constructor(); static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * The state interface for the FormField primitive. */ interface NgpFormFieldState { /** * The form labels. */ readonly labels: Signal; /** * The form descriptions. */ readonly descriptions: Signal; /** * The id of the associated form control. */ readonly formControl: Signal; /** * The validation error messages. */ readonly errors: Signal; /** * Whether the control is pristine. */ readonly pristine: Signal; /** * Whether the control is touched. */ readonly touched: Signal; /** * Whether the control is dirty. */ readonly dirty: Signal; /** * Whether the control is valid. */ readonly valid: Signal; /** * Whether the control is invalid. */ readonly invalid: Signal; /** * Whether the control is pending. */ readonly pending: Signal; /** * Whether the control is disabled. */ readonly disabled: Signal; /** * Register the id of the associated form control, and the `NgControl` bound to it if any. */ setFormControl(id: string, ngControl?: NgControl | null): void; /** * Register a label with the form field. */ addLabel(label: string): void; /** * Register a description with the form field. */ addDescription(description: string): void; /** * Remove the associated form control. With an id, only that registration is removed. */ removeFormControl(id?: string): void; /** * Remove a label from the form field. */ removeLabel(label: string): void; /** * Remove a description from the form field. */ removeDescription(description: string): void; } /** * The props interface for the FormField primitive. */ interface NgpFormFieldProps { /** * Find any NgControl within the form field. */ readonly ngControl: Signal; } declare const ngpFormField: ({ ngControl }: NgpFormFieldProps) => { labels: _angular_core.WritableSignal; descriptions: _angular_core.WritableSignal; formControl: Signal; errors: _angular_core.WritableSignal; pristine: _angular_core.WritableSignal; touched: _angular_core.WritableSignal; dirty: _angular_core.WritableSignal; valid: _angular_core.WritableSignal; invalid: _angular_core.WritableSignal; pending: _angular_core.WritableSignal; disabled: _angular_core.WritableSignal; setFormControl: (id: string, control?: NgControl | null) => void; addLabel: (label: string) => void; addDescription: (description: string) => void; removeFormControl: (id?: string) => void; removeLabel: (label: string) => void; removeDescription: (description: string) => void; }; declare const injectFormFieldState: { (): Signal<{ labels: _angular_core.WritableSignal; descriptions: _angular_core.WritableSignal; formControl: Signal; errors: _angular_core.WritableSignal; pristine: _angular_core.WritableSignal; touched: _angular_core.WritableSignal; dirty: _angular_core.WritableSignal; valid: _angular_core.WritableSignal; invalid: _angular_core.WritableSignal; pending: _angular_core.WritableSignal; disabled: _angular_core.WritableSignal; setFormControl: (id: string, control?: NgControl | null) => void; addLabel: (label: string) => void; addDescription: (description: string) => void; removeFormControl: (id?: string) => void; removeLabel: (label: string) => void; removeDescription: (description: string) => void; }>; (options: ng_primitives_state.StateInjectionOptions): Signal<{ labels: _angular_core.WritableSignal; descriptions: _angular_core.WritableSignal; formControl: Signal; errors: _angular_core.WritableSignal; pristine: _angular_core.WritableSignal; touched: _angular_core.WritableSignal; dirty: _angular_core.WritableSignal; valid: _angular_core.WritableSignal; invalid: _angular_core.WritableSignal; pending: _angular_core.WritableSignal; disabled: _angular_core.WritableSignal; setFormControl: (id: string, control?: NgControl | null) => void; addLabel: (label: string) => void; addDescription: (description: string) => void; removeFormControl: (id?: string) => void; removeLabel: (label: string) => void; removeDescription: (description: string) => void; } | null>; (options?: ng_primitives_state.StateInjectionOptions): Signal<{ labels: _angular_core.WritableSignal; descriptions: _angular_core.WritableSignal; formControl: Signal; errors: _angular_core.WritableSignal; pristine: _angular_core.WritableSignal; touched: _angular_core.WritableSignal; dirty: _angular_core.WritableSignal; valid: _angular_core.WritableSignal; invalid: _angular_core.WritableSignal; pending: _angular_core.WritableSignal; disabled: _angular_core.WritableSignal; setFormControl: (id: string, control?: NgControl | null) => void; addLabel: (label: string) => void; addDescription: (description: string) => void; removeFormControl: (id?: string) => void; removeLabel: (label: string) => void; removeDescription: (description: string) => void; } | null> | Signal<{ labels: _angular_core.WritableSignal; descriptions: _angular_core.WritableSignal; formControl: Signal; errors: _angular_core.WritableSignal; pristine: _angular_core.WritableSignal; touched: _angular_core.WritableSignal; dirty: _angular_core.WritableSignal; valid: _angular_core.WritableSignal; invalid: _angular_core.WritableSignal; pending: _angular_core.WritableSignal; disabled: _angular_core.WritableSignal; setFormControl: (id: string, control?: NgControl | null) => void; addLabel: (label: string) => void; addDescription: (description: string) => void; removeFormControl: (id?: string) => void; removeLabel: (label: string) => void; removeDescription: (description: string) => void; }>; }; declare const provideFormFieldState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; /** * The `NgpLabel` directive is used to mark a label element within a form field. Preferably, there should use an HTML `