@radix-ng/primitives 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/fesm2022/radix-ng-primitives-autocomplete.mjs +43 -9
  2. package/fesm2022/radix-ng-primitives-autocomplete.mjs.map +1 -1
  3. package/fesm2022/radix-ng-primitives-checkbox.mjs +89 -8
  4. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  5. package/fesm2022/radix-ng-primitives-combobox.mjs +43 -9
  6. package/fesm2022/radix-ng-primitives-combobox.mjs.map +1 -1
  7. package/fesm2022/radix-ng-primitives-core.mjs +208 -2
  8. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  9. package/fesm2022/radix-ng-primitives-date-field.mjs +50 -9
  10. package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
  11. package/fesm2022/radix-ng-primitives-editable.mjs +31 -5
  12. package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
  13. package/fesm2022/radix-ng-primitives-field.mjs +265 -46
  14. package/fesm2022/radix-ng-primitives-field.mjs.map +1 -1
  15. package/fesm2022/radix-ng-primitives-form.mjs +110 -26
  16. package/fesm2022/radix-ng-primitives-form.mjs.map +1 -1
  17. package/fesm2022/radix-ng-primitives-input.mjs +16 -6
  18. package/fesm2022/radix-ng-primitives-input.mjs.map +1 -1
  19. package/fesm2022/radix-ng-primitives-number-field.mjs +32 -7
  20. package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
  21. package/fesm2022/radix-ng-primitives-radio.mjs +18 -4
  22. package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
  23. package/fesm2022/radix-ng-primitives-select.mjs +26 -8
  24. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  25. package/fesm2022/radix-ng-primitives-signal-forms.mjs +184 -0
  26. package/fesm2022/radix-ng-primitives-signal-forms.mjs.map +1 -0
  27. package/fesm2022/radix-ng-primitives-slider.mjs +24 -8
  28. package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
  29. package/fesm2022/radix-ng-primitives-switch.mjs +29 -5
  30. package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
  31. package/fesm2022/radix-ng-primitives-time-field.mjs +49 -9
  32. package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
  33. package/fesm2022/radix-ng-primitives-toggle-group.mjs +23 -12
  34. package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
  35. package/package.json +11 -1
  36. package/types/radix-ng-primitives-autocomplete.d.ts +21 -2
  37. package/types/radix-ng-primitives-checkbox.d.ts +53 -4
  38. package/types/radix-ng-primitives-combobox.d.ts +51 -2
  39. package/types/radix-ng-primitives-core.d.ts +206 -3
  40. package/types/radix-ng-primitives-date-field.d.ts +27 -2
  41. package/types/radix-ng-primitives-editable.d.ts +15 -2
  42. package/types/radix-ng-primitives-field.d.ts +136 -33
  43. package/types/radix-ng-primitives-form.d.ts +115 -21
  44. package/types/radix-ng-primitives-input.d.ts +8 -1
  45. package/types/radix-ng-primitives-number-field.d.ts +14 -3
  46. package/types/radix-ng-primitives-radio.d.ts +7 -2
  47. package/types/radix-ng-primitives-select.d.ts +11 -3
  48. package/types/radix-ng-primitives-signal-forms.d.ts +97 -0
  49. package/types/radix-ng-primitives-slider.d.ts +9 -7
  50. package/types/radix-ng-primitives-switch.d.ts +15 -2
  51. package/types/radix-ng-primitives-time-field.d.ts +26 -2
  52. package/types/radix-ng-primitives-toggle-group.d.ts +6 -4
@@ -1,6 +1,7 @@
1
- import * as i0 from '@angular/core';
1
+ import * as _angular_core from '@angular/core';
2
2
  import { Signal } from '@angular/core';
3
3
  import * as _radix_ng_primitives_core from '@radix-ng/primitives/core';
4
+ import { RdxValidationMode } from '@radix-ng/primitives/core';
4
5
 
5
6
  /** A normalized external-error map: each field name maps to its message(s) in display order. */
6
7
  type RdxFormErrors = Record<string, string | string[]>;
@@ -20,8 +21,12 @@ interface RdxFormSubmitEvent {
20
21
  interface RdxFormFieldRegistration {
21
22
  /** The field's `name` (key external errors match against), or `undefined`. */
22
23
  name: () => string | undefined;
23
- /** The field's merged invalid state (includes external errors). */
24
+ /** The field's **actual** invalid state (ungated, includes external errors) — drives the submit guard
25
+ * and `anyInvalid`. */
24
26
  invalid: () => boolean;
27
+ /** The field's **displayed** tri-state validity, gated by its `validationMode` — drives the form's
28
+ * presentation `data-invalid` so it stays neutral on load while its fields are. `null` = neutral. */
29
+ displayValid?: () => boolean | null;
25
30
  /** Whether the field is dirty. */
26
31
  dirty: () => boolean;
27
32
  /** Whether the field is touched. */
@@ -32,29 +37,66 @@ interface RdxFormFieldRegistration {
32
37
  resetState: () => void;
33
38
  }
34
39
  /**
35
- * External owner of form-level state (e.g. a future Signal Forms `[rdxSignalForm]` adapter). Mirrors
36
- * Field's `RdxFieldState` seam one level up. Each member is optional: a provided accessor wins over the
37
- * built-in registry/`errors`-input behavior; absent accessors leave the built-in behavior untouched.
38
- * Kept as framework-free `() =>` accessors (no `@angular/forms/signals` dependency). See ADR 0004.
40
+ * External owner of form-level state (e.g. the Signal Forms `[rdxSignalForm]` adapter). Mirrors Field's
41
+ * `RdxFieldState` seam one level up. Each member is optional. The aggregate accessors (`dirty`/`touched`/
42
+ * `submitting`) take over the corresponding form-level state; `invalid` is **merged** with the field
43
+ * registry (so a real registered-field error still counts); the per-name accessors route a field's client
44
+ * state by `name`. Kept as framework-free `() =>` accessors (no `@angular/forms/signals` dependency). See
45
+ * ADR 0004.
39
46
  */
40
47
  interface RdxFormState {
41
48
  invalid?: () => boolean;
42
49
  dirty?: () => boolean;
43
50
  touched?: () => boolean;
44
51
  submitting?: () => boolean;
45
- /** Per-name external error source; while provided, the `errors` input + clear-on-edit are inert. */
52
+ /**
53
+ * Per-name **client** validation errors (e.g. `rdxSignalForm`'s Signal Forms name-routing). Surfaced
54
+ * through the Form's `clientErrorsFor` channel and gated by `validationMode` like any client validity.
55
+ * Independent of the Form's `errors` input (server errors), which stays eager.
56
+ */
46
57
  errorsFor?: (name: string) => string[];
58
+ /**
59
+ * Per-name `touched` / `dirty` for a name-routed field. Lets a `rdxFieldRoot` that has only a bare
60
+ * `[formField]` control (no `rdxSignalField` / `rdxFieldControl`) still reveal its error on blur under
61
+ * `validationMode="onBlur"`/`"onChange"` — the field reads its interaction state from here.
62
+ */
63
+ touchedFor?: (name: string) => boolean;
64
+ dirtyFor?: (name: string) => boolean;
47
65
  }
48
66
  interface RdxFormRootContext {
49
- errorsFor: (name: string | undefined) => string[];
67
+ /**
68
+ * **Client** validation errors routed by a form-level provider (e.g. `rdxSignalForm`'s Signal Forms
69
+ * name-routing). These are gated by `validationMode` like any client validity — adding `rdxSignalForm`
70
+ * must not change error-display timing.
71
+ */
72
+ clientErrorsFor: (name: string | undefined) => string[];
73
+ /** **Server/external** errors from the Form's `errors` input. Shown eagerly (not gated). */
74
+ externalErrorsFor: (name: string | undefined) => string[];
75
+ /** Per-name `touched` / `dirty` from a form-level provider (`rdxSignalForm`); `false` when none. */
76
+ touchedFor: (name: string | undefined) => boolean;
77
+ dirtyFor: (name: string | undefined) => boolean;
50
78
  notifyEdited: (name: string | undefined) => void;
79
+ /**
80
+ * Whether a submit has been attempted (set before the validity check on submit, cleared on reset).
81
+ * A presentation-timing seam: an adapter can reveal a field's error after a submit attempt without the
82
+ * field having been touched, so the consumer never hand-rolls "mark touched on submit". Base UI's
83
+ * submit-attempt state, kept at the form level.
84
+ */
85
+ submitAttempted: Signal<boolean>;
86
+ /** The form's default validation-display mode; a `rdxFieldRoot` may override it per field. */
87
+ validationMode: Signal<RdxValidationMode>;
51
88
  /** Registers a field; returns its unregister callback. */
52
89
  register: (field: RdxFormFieldRegistration) => () => void;
53
90
  setStateProvider: (provider: RdxFormState | null) => RdxFormState | null;
91
+ /**
92
+ * Identity-checked teardown: roll the slot back to `previous` only if `provider` is still active,
93
+ * so an old adapter's destroy can't clobber a newer one (create-before-destroy on a view swap).
94
+ */
95
+ clearStateProvider: (provider: RdxFormState | null, previous: RdxFormState | null) => void;
54
96
  hasStateProvider: Signal<boolean>;
55
97
  }
56
98
  declare const injectFormRootContext: _radix_ng_primitives_core.InjectContext<RdxFormRootContext>;
57
- declare const provideFormRootContext: (useFactory: () => RdxFormRootContext) => i0.Provider;
99
+ declare const provideFormRootContext: (useFactory: () => RdxFormRootContext) => _angular_core.Provider;
58
100
  /**
59
101
  * The top of the forms layer cake: a single directive on the native `<form>` element that aggregates
60
102
  * field state, maps external (server) errors onto fields by `name`, intercepts submit (values-as-object,
@@ -66,11 +108,20 @@ declare const provideFormRootContext: (useFactory: () => RdxFormRootContext) =>
66
108
  declare class RdxFormRoot {
67
109
  private readonly form;
68
110
  /** External/server validation errors keyed by `Field.Root` `name`. */
69
- readonly errors: i0.InputSignal<RdxFormErrors | null | undefined>;
111
+ readonly errors: _angular_core.InputSignal<RdxFormErrors | null | undefined>;
112
+ /**
113
+ * When fields reveal their validity (error styling + message). The control/adapter always reports the
114
+ * actual state; this decides *when* the Field surfaces it. A `rdxFieldRoot` can override it per field.
115
+ * Server errors (`errors` above) always show regardless. Defaults to `'onBlur'`.
116
+ *
117
+ * @group Props
118
+ * @defaultValue 'onBlur'
119
+ */
120
+ readonly validationMode: _angular_core.InputSignal<RdxValidationMode>;
70
121
  /** Emits the remaining error map after a field's external error is cleared by a user edit (or reset). */
71
- readonly onClearErrors: i0.OutputEmitterRef<RdxFormErrors>;
122
+ readonly onClearErrors: _angular_core.OutputEmitterRef<RdxFormErrors>;
72
123
  /** Emits the serialized form values when a valid form is submitted. */
73
- readonly onFormSubmit: i0.OutputEmitterRef<RdxFormSubmitEvent>;
124
+ readonly onFormSubmit: _angular_core.OutputEmitterRef<RdxFormSubmitEvent>;
74
125
  private readonly fields;
75
126
  private readonly stateProvider;
76
127
  /** Whether an external adapter currently owns form-level state. */
@@ -82,33 +133,76 @@ declare class RdxFormRoot {
82
133
  private readonly clearedNames;
83
134
  /** The `errors` input minus cleared names, normalized to `string[]`. */
84
135
  private readonly effectiveErrors;
136
+ /** **Actual** aggregate invalidity (eager) — drives the submit guard / focus-first-invalid and is the
137
+ * value to read in app logic. Merges a form-level provider with the field registry. */
85
138
  readonly anyInvalid: Signal<boolean>;
86
139
  readonly anyDirty: Signal<boolean>;
87
140
  readonly anyTouched: Signal<boolean>;
88
141
  readonly submitting: Signal<boolean>;
89
- /** Resolve a boolean aggregate: a registered provider's accessor wins, else OR over the registry. */
142
+ /**
143
+ * **Displayed** aggregate invalidity — the source for the host `data-invalid` (a presentation
144
+ * attribute). A field counts only once its own `validationMode` reveals it (`displayValid() === false`),
145
+ * so the form stays **neutral on load** while its fields are, instead of leaking the gated state.
146
+ * Distinct from {@link anyInvalid} (actual, eager).
147
+ *
148
+ * When **any** display-aware field is registered, those fields are the *authoritative* displayed
149
+ * source and win outright — a form-level provider's aggregate `invalid()` is **not** added on top
150
+ * (it would contradict a field that overrode its own `validationMode` to stay neutral; and the
151
+ * fields already reflect that provider's per-name state). The provider fallback applies only when no
152
+ * display-aware field carries the state, and then conservatively — under `validationMode="always"`
153
+ * or after a submit attempt, never from `anyTouched`.
154
+ */
155
+ readonly anyDisplayedInvalid: Signal<boolean>;
156
+ /**
157
+ * Whether a submit has been attempted on this form, exposed to fields via the context. Set true at the
158
+ * very start of {@link onSubmit} (before the validity check, so a field whose `validationMode` defers
159
+ * display, e.g. `onBlur`, reveals its error in time to block the submit) and cleared on native reset.
160
+ */
161
+ readonly submitAttempted: _angular_core.WritableSignal<boolean>;
162
+ /**
163
+ * Resolve a boolean aggregate. For `dirty` / `touched` a registered provider's accessor wins, else OR
164
+ * over the registry. For **`invalid`** the two are **merged** (`provider || registry`): a registered
165
+ * field's actual invalidity — e.g. a server `[errors]` entry — must still count (and block submit) even
166
+ * when a form-level provider (`rdxSignalForm`) reports the client model valid.
167
+ */
90
168
  private aggregate;
91
- /** Resolves the external messages for a field name (provider source wins over the `errors` input). */
92
- errorsFor(name: string | undefined): string[];
93
- /** Clears a field's external error after a user edit, emitting the remaining map. */
169
+ /** Client validation errors from a form-level provider (`rdxSignalForm`); `[]` when none. Gated. */
170
+ clientErrorsFor(name: string | undefined): string[];
171
+ /** Per-name `touched` from a form-level provider (`rdxSignalForm`); `false` when none. */
172
+ touchedFor(name: string | undefined): boolean;
173
+ /** Per-name `dirty` from a form-level provider (`rdxSignalForm`); `false` when none. */
174
+ dirtyFor(name: string | undefined): boolean;
175
+ /**
176
+ * Server/external errors from the `errors` input (eager). A separate channel from {@link clientErrorsFor}:
177
+ * the `errors` input always applies, even alongside a form-level client provider (`rdxSignalForm`), so
178
+ * adding `rdxSignalForm` never disables your server errors.
179
+ */
180
+ externalErrorsFor(name: string | undefined): string[];
181
+ /** Clears a field's server error (the `errors` input) after a user edit, emitting the remaining map.
182
+ * Client provider errors (`rdxSignalForm`) are not affected — Signal Forms re-validates them itself. */
94
183
  notifyEdited(name: string | undefined): void;
95
184
  register(field: RdxFormFieldRegistration): () => void;
96
185
  /** Register (or clear with `null`) an external owner of form-level state; returns the previous one. */
97
186
  setStateProvider(provider: RdxFormState | null): RdxFormState | null;
187
+ /**
188
+ * Identity-checked teardown — roll back to `previous` only if `provider` is still active, so an
189
+ * old adapter's destroy can't clobber a newer one (create-before-destroy on a view swap).
190
+ */
191
+ clearStateProvider(provider: RdxFormState | null, previous: RdxFormState | null): void;
98
192
  onSubmit(event: SubmitEvent): void;
99
193
  onReset(): void;
100
194
  private readonly resetTimers;
101
195
  constructor();
102
196
  private remainingErrors;
103
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxFormRoot, never>;
104
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxFormRoot, "form[rdxFormRoot]", ["rdxFormRoot"], { "errors": { "alias": "errors"; "required": false; "isSignal": true; }; }, { "onClearErrors": "onClearErrors"; "onFormSubmit": "onFormSubmit"; }, never, never, true, never>;
197
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxFormRoot, never>;
198
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxFormRoot, "form[rdxFormRoot]", ["rdxFormRoot"], { "errors": { "alias": "errors"; "required": false; "isSignal": true; }; "validationMode": { "alias": "validationMode"; "required": false; "isSignal": true; }; }, { "onClearErrors": "onClearErrors"; "onFormSubmit": "onFormSubmit"; }, never, never, true, never>;
105
199
  }
106
200
 
107
201
  declare const _importsForm: (typeof RdxFormRoot)[];
108
202
  declare class RdxFormModule {
109
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxFormModule, never>;
110
- static ɵmod: i0.ɵɵNgModuleDeclaration<RdxFormModule, never, [typeof RdxFormRoot], [typeof RdxFormRoot]>;
111
- static ɵinj: i0.ɵɵInjectorDeclaration<RdxFormModule>;
203
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxFormModule, never>;
204
+ static ɵmod: _angular_core.ɵɵNgModuleDeclaration<RdxFormModule, never, [typeof RdxFormRoot], [typeof RdxFormRoot]>;
205
+ static ɵinj: _angular_core.ɵɵInjectorDeclaration<RdxFormModule>;
112
206
  }
113
207
 
114
208
  export { RdxFormModule, RdxFormRoot, _importsForm, injectFormRootContext, provideFormRootContext };
@@ -133,7 +133,14 @@ declare class RdxInputDirective implements RdxFormValueControl<RdxInputValue | u
133
133
  * @group Emits
134
134
  */
135
135
  readonly touch: _angular_core.OutputEmitterRef<void>;
136
- protected readonly invalidState: _angular_core.Signal<boolean>;
136
+ /** The input's own binary invalidity (its `invalid` input or a non-empty `errors` list). */
137
+ private readonly ownInvalid;
138
+ /**
139
+ * Tri-state *displayed* validity: inside a `rdxFieldRoot` the field's gated `validState` is the single
140
+ * source (so a field whose `validationMode` defers display (e.g. `onBlur`) keeps the input neutral until revealed), otherwise
141
+ * the input's own binary invalidity. `true` valid / `false` invalid / `null` neutral.
142
+ */
143
+ protected readonly displayValid: _angular_core.Signal<boolean | null>;
137
144
  protected readonly disabledState: _angular_core.Signal<boolean>;
138
145
  protected readonly requiredState: _angular_core.Signal<boolean>;
139
146
  protected readonly filledState: _angular_core.Signal<boolean>;
@@ -1,7 +1,7 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal } from '@angular/core';
3
3
  import * as _radix_ng_primitives_core from '@radix-ng/primitives/core';
4
- import { RdxFormValueControl, RdxControlValueAccessor, NumberInput, BooleanInput, RdxCancelableChangeEventDetails } from '@radix-ng/primitives/core';
4
+ import { RdxFormUiControlBase, RdxFormValueControl, RdxControlValueAccessor, NumberInput, BooleanInput, RdxCancelableChangeEventDetails, RdxFormUiTouchTarget } from '@radix-ng/primitives/core';
5
5
  import * as _radix_ng_primitives_number_field from '@radix-ng/primitives/number-field';
6
6
  import { NumberFormatter, NumberParser } from '@internationalized/number';
7
7
  import * as i1 from '@radix-ng/primitives/portal';
@@ -47,7 +47,7 @@ interface RdxNumberFieldValueChangeEvent {
47
47
  *
48
48
  * @see https://base-ui.com/react/components/number-field
49
49
  */
50
- declare class RdxNumberFieldRoot implements RdxFormValueControl<number | null> {
50
+ declare class RdxNumberFieldRoot extends RdxFormUiControlBase implements RdxFormValueControl<number | null> {
51
51
  /** @ignore */
52
52
  protected readonly cva: RdxControlValueAccessor<number | null>;
53
53
  /** The id of the input element. */
@@ -138,6 +138,12 @@ declare class RdxNumberFieldRoot implements RdxFormValueControl<number | null> {
138
138
  hasPendingCommit: boolean;
139
139
  /** @ignore */
140
140
  readonly isDisabled: _angular_core.Signal<boolean>;
141
+ /** @ignore */
142
+ readonly invalidState: _angular_core.Signal<boolean>;
143
+ /** @ignore */
144
+ readonly touchedState: _angular_core.Signal<boolean>;
145
+ /** @ignore */
146
+ readonly dirtyState: _angular_core.Signal<boolean>;
141
147
  private readonly formatter;
142
148
  private readonly parser;
143
149
  /** @ignore The current numeric value (`null` when empty). */
@@ -170,8 +176,13 @@ declare class RdxNumberFieldRoot implements RdxFormValueControl<number | null> {
170
176
  registerInput(el: HTMLInputElement): void;
171
177
  /** @ignore Sets the displayed text without changing the numeric value. */
172
178
  setInputValue(text: string): void;
173
- /** @ignore */
179
+ /**
180
+ * @ignore Mark the field touched — CVA for Reactive forms, plus the `touched` model + `touch`
181
+ * output for Signal Forms.
182
+ */
174
183
  markAsTouched(): void;
184
+ /** @ignore Bridge the CVA into `markAsTouched` (dual). */
185
+ protected formUiTouchTarget(): RdxFormUiTouchTarget;
175
186
  /**
176
187
  * @ignore
177
188
  * Validates and applies a candidate value, emitting `onValueChange` when it changes.
@@ -1,7 +1,7 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal } from '@angular/core';
3
3
  import * as _radix_ng_primitives_core from '@radix-ng/primitives/core';
4
- import { RdxFormValueControl, BooleanInput, RdxCancelableChangeEventDetails } from '@radix-ng/primitives/core';
4
+ import { RdxFormUiControlBase, RdxFormValueControl, BooleanInput, RdxCancelableChangeEventDetails, RdxFormUiTouchTarget } from '@radix-ng/primitives/core';
5
5
  import { ControlValueAccessor } from '@angular/forms';
6
6
  import * as i1 from '@radix-ng/primitives/composite';
7
7
  import * as _radix_ng_primitives_radio from '@radix-ng/primitives/radio';
@@ -26,7 +26,7 @@ interface RadioRootContext {
26
26
  }
27
27
  declare const injectRadioRootContext: _radix_ng_primitives_core.InjectContext<RadioRootContext>;
28
28
  declare const provideRadioRootContext: (useFactory: () => RadioRootContext) => _angular_core.Provider;
29
- declare class RdxRadioGroupDirective implements ControlValueAccessor, RdxFormValueControl<string | null> {
29
+ declare class RdxRadioGroupDirective extends RdxFormUiControlBase implements ControlValueAccessor, RdxFormValueControl<string | null> {
30
30
  private readonly elementRef;
31
31
  private readonly compositeRoot;
32
32
  /**
@@ -51,6 +51,9 @@ declare class RdxRadioGroupDirective implements ControlValueAccessor, RdxFormVal
51
51
  readonly onValueChange: _angular_core.OutputEmitterRef<RdxRadioValueChangeEvent>;
52
52
  private readonly disable;
53
53
  readonly disabledState: Signal<boolean>;
54
+ readonly invalidState: Signal<boolean>;
55
+ readonly touchedState: Signal<boolean>;
56
+ readonly dirtyState: Signal<boolean>;
54
57
  private readonly arrowNavigation;
55
58
  private readonly itemMetadata;
56
59
  private readonly disabledIndices;
@@ -71,6 +74,8 @@ declare class RdxRadioGroupDirective implements ControlValueAccessor, RdxFormVal
71
74
  * @ignore
72
75
  */
73
76
  select(value: string | null, event?: Event, reason?: RdxRadioValueChangeReason): void;
77
+ /** @ignore Bridge the CVA `onTouched` so `markAsTouched()` also notifies Reactive/template forms. */
78
+ protected formUiTouchTarget(): RdxFormUiTouchTarget;
74
79
  /**
75
80
  * Update the value of the radio group.
76
81
  * @param value The new value of the radio group.
@@ -1,7 +1,7 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal, ElementRef, InjectionToken, OutputRef, WritableSignal } from '@angular/core';
3
3
  import * as _radix_ng_primitives_core from '@radix-ng/primitives/core';
4
- import { AcceptableValue, RdxCancelableChangeEventDetails, RdxFloatingRootContext, Direction, ItemValueComparator, RdxTransitionStatus } from '@radix-ng/primitives/core';
4
+ import { AcceptableValue, RdxCancelableChangeEventDetails, RdxFormUiControlBase, RdxFormValueControl, RdxFloatingRootContext, Direction, ItemValueComparator, RdxTransitionStatus, RdxFormUiStateContext } from '@radix-ng/primitives/core';
5
5
  import * as _radix_ng_primitives_select from '@radix-ng/primitives/select';
6
6
  import * as i1 from '@radix-ng/primitives/composite';
7
7
  import { RdxCompositeItemRegistration } from '@radix-ng/primitives/composite';
@@ -330,7 +330,7 @@ interface RdxSelectValueChangeEvent {
330
330
  value: AcceptableValue | AcceptableValue[] | undefined;
331
331
  eventDetails: RdxSelectValueChangeEventDetails;
332
332
  }
333
- interface RdxSelectRootContext {
333
+ interface RdxSelectRootContext extends RdxFormUiStateContext {
334
334
  triggerElement: WritableSignal<HTMLElement | null>;
335
335
  valueElement: WritableSignal<HTMLElement | null>;
336
336
  triggerPointerDownPosRef: WritableSignal<{
@@ -365,7 +365,7 @@ interface RdxSelectRootContext {
365
365
  }
366
366
  declare const injectSelectRootContext: _radix_ng_primitives_core.InjectContext<RdxSelectRootContext>;
367
367
  declare const provideSelectRootContext: (useFactory: () => RdxSelectRootContext) => _angular_core.Provider;
368
- declare class RdxSelectRoot {
368
+ declare class RdxSelectRoot extends RdxFormUiControlBase implements RdxFormValueControl<AcceptableValue | AcceptableValue[] | undefined> {
369
369
  readonly contentId: string;
370
370
  readonly open: _angular_core.ModelSignal<boolean>;
371
371
  /** Whether the current open was initiated by **touch** (ADR 0016 §3 — gates the anchored scroll lock). */
@@ -475,8 +475,16 @@ declare class RdxSelectTrigger {
475
475
  readonly isDisabled: _angular_core.Signal<boolean>;
476
476
  protected readonly triggerInteraction: i2.RdxTriggerInteraction;
477
477
  protected readonly invalidState: _angular_core.Signal<boolean>;
478
+ /**
479
+ * Tri-state *displayed* validity: when inside a `rdxFieldRoot` the field's gated `validState` is the
480
+ * single source (so the field's `validationMode` keeps the trigger neutral until revealed), otherwise
481
+ * the trigger's own binary invalidity.
482
+ */
483
+ protected readonly displayValid: _angular_core.Signal<boolean | null>;
478
484
  protected readonly requiredState: _angular_core.Signal<boolean>;
479
485
  protected readonly readOnlyState: _angular_core.Signal<boolean>;
486
+ protected readonly touchedState: _angular_core.Signal<boolean>;
487
+ protected readonly dirtyState: _angular_core.Signal<boolean>;
480
488
  protected readonly filledState: _angular_core.Signal<boolean>;
481
489
  protected readonly focusedState: _angular_core.Signal<boolean>;
482
490
  protected readonly describedBy: _angular_core.Signal<string | undefined>;
@@ -0,0 +1,97 @@
1
+ import * as i0 from '@angular/core';
2
+ import { FieldTree } from '@angular/forms/signals';
3
+
4
+ /**
5
+ * Bridges an Angular **Signal Forms** field into an enclosing `rdxFieldRoot` — with **no duplicate
6
+ * binding**. Place it on the control that already carries `[formField]`; it reads the bound field's
7
+ * state from that directive, so the field expression is written exactly once:
8
+ *
9
+ * ```html
10
+ * <div rdxFieldRoot>
11
+ * <label rdxFieldLabel>Email</label>
12
+ * <input rdxInput [formField]="loginForm.email" rdxSignalField />
13
+ * <p rdxFieldError>Email is required.</p>
14
+ * </div>
15
+ * ```
16
+ *
17
+ * It owns no model and runs no validation — Signal Forms remains the source of truth. It only registers
18
+ * an {@link RdxFieldState} provider on the ancestor Field context so the field's `invalid` / `disabled` /
19
+ * `required` / `dirty` / `touched` data-attributes and the error *content* (`rdxFieldError.messages()`)
20
+ * read authoritative Signal Forms state. `filled` / `focused` stay on Field's DOM heuristic (partial
21
+ * ownership — the seam supports it).
22
+ *
23
+ * It reports the **actual** Signal Forms state only; the `Field` decides *when* to display it from its
24
+ * `validationMode` (default `'onBlur'` — neutral until the field is touched or the form submitted). So an
25
+ * empty required field is neutral on load with no manual `[invalid]`/`[touched]` wiring, and a pristine
26
+ * submit reveals the errors (the `Form` records the submit attempt before checking validity and blocks).
27
+ *
28
+ * See ADR 0018.
29
+ *
30
+ * @group Components
31
+ */
32
+ declare class RdxSignalField {
33
+ /** The co-located `[formField]` directive — the single source of the bound field's state. */
34
+ private readonly formField;
35
+ private readonly fieldContext;
36
+ constructor();
37
+ /** Current Signal Forms field state, read from the co-located `[formField]` directive. */
38
+ private state;
39
+ static ɵfac: i0.ɵɵFactoryDeclaration<RdxSignalField, never>;
40
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSignalField, "[formField][rdxSignalField]", ["rdxSignalField"], {}, {}, never, never, true, never>;
41
+ }
42
+
43
+ /**
44
+ * Bridges an Angular **Signal Forms** form into an enclosing `form[rdxFormRoot]`.
45
+ *
46
+ * ```html
47
+ * <form rdxFormRoot [rdxSignalForm]="loginForm">
48
+ * <!-- fields bound with [formField] (+ rdxSignalField) -->
49
+ * </form>
50
+ * ```
51
+ *
52
+ * Registers an {@link RdxFormState} provider so the Form's aggregate `data-invalid` / `data-dirty` /
53
+ * `data-touched` / `data-submitting` attributes and the submit guard read authoritative Signal Forms
54
+ * state. This adapter owns only client-side state and `name`-routing; server errors stay a separate
55
+ * eager channel applied through `rdxFormRoot[errors]`, and Signal Forms' own `submit()` owns the
56
+ * submit lifecycle.
57
+ *
58
+ * `errorsFor(name)` routes a field's errors to a `rdxFieldRoot` by its `name`, walking the `FieldTree`
59
+ * so dotted paths into nested object/array fields resolve too (`address.street`, `items.0.name`). A
60
+ * field can surface messages from the form alone — no per-field `rdxSignalField` needed for errors.
61
+ * These are the **two modes** (per-field adapter vs form-level name routing) — prefer one per field; if
62
+ * a field carries both, `rdxFieldError.messages()` deduplicates by text so the shared message is not
63
+ * shown twice.
64
+ *
65
+ * See ADR 0018.
66
+ *
67
+ * @group Components
68
+ */
69
+ declare class RdxSignalForm {
70
+ /** The Signal Forms root field (from `form(...)`) whose aggregate state drives the enclosing Form. */
71
+ readonly form: i0.InputSignal<FieldTree<unknown>>;
72
+ private readonly formContext;
73
+ constructor();
74
+ /**
75
+ * Messages for the field at the dotted `name` path (`message ?? kind` per error). Walks the
76
+ * `FieldTree` so nested object/array fields resolve too — e.g. `address.street`, `items.0.name`.
77
+ */
78
+ private errorsFor;
79
+ /**
80
+ * The Signal Forms field *state* at the dotted `name` path, or `null` if it doesn't resolve. Walks the
81
+ * `FieldTree` so nested object/array fields work (`address.street`, `items.0.name`).
82
+ */
83
+ private fieldState;
84
+ /** The current Signal Forms root field state (a `FieldTree` is callable). */
85
+ private state;
86
+ static ɵfac: i0.ɵɵFactoryDeclaration<RdxSignalForm, never>;
87
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSignalForm, "form[rdxFormRoot][rdxSignalForm]", ["rdxSignalForm"], { "form": { "alias": "rdxSignalForm"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
88
+ }
89
+
90
+ declare const _importsSignalForms: (typeof RdxSignalField | typeof RdxSignalForm)[];
91
+ declare class RdxSignalFormsModule {
92
+ static ɵfac: i0.ɵɵFactoryDeclaration<RdxSignalFormsModule, never>;
93
+ static ɵmod: i0.ɵɵNgModuleDeclaration<RdxSignalFormsModule, never, [typeof RdxSignalField, typeof RdxSignalForm], [typeof RdxSignalField, typeof RdxSignalForm]>;
94
+ static ɵinj: i0.ɵɵInjectorDeclaration<RdxSignalFormsModule>;
95
+ }
96
+
97
+ export { RdxSignalField, RdxSignalForm, RdxSignalFormsModule, _importsSignalForms };
@@ -1,7 +1,7 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal } from '@angular/core';
3
- import * as _radix_ng_primitives_core from '@radix-ng/primitives/core';
4
- import { RdxControlValueAccessor, NumberInput, BooleanInput, RdxCancelableChangeEventDetails } from '@radix-ng/primitives/core';
3
+ import * as i2 from '@radix-ng/primitives/core';
4
+ import { RdxFormUiControlBase, RdxControlValueAccessor, NumberInput, BooleanInput, RdxCancelableChangeEventDetails, RdxFormUiTouchTarget } from '@radix-ng/primitives/core';
5
5
  export { clamp } from '@radix-ng/primitives/core';
6
6
  import * as i1 from '@radix-ng/primitives/composite';
7
7
  import * as _radix_ng_primitives_slider from '@radix-ng/primitives/slider';
@@ -131,7 +131,7 @@ interface RdxSliderThumbMetadata {
131
131
  *
132
132
  * @see https://base-ui.com/react/components/slider
133
133
  */
134
- declare class RdxSliderRoot {
134
+ declare class RdxSliderRoot extends RdxFormUiControlBase {
135
135
  /** @ignore */
136
136
  protected readonly cva: RdxControlValueAccessor<SliderValue>;
137
137
  private readonly document;
@@ -172,7 +172,7 @@ declare class RdxSliderRoot {
172
172
  * @default 'ltr'
173
173
  */
174
174
  readonly dirInput: _angular_core.InputSignal<"ltr" | "rtl" | undefined>;
175
- readonly dir: Signal<_radix_ng_primitives_core.Direction>;
175
+ readonly dir: Signal<i2.Direction>;
176
176
  /**
177
177
  * How thumbs behave when they meet in a range slider.
178
178
  * @default 'push'
@@ -272,7 +272,9 @@ declare class RdxSliderRoot {
272
272
  handleInputChange(valueInput: number, index: number, reason?: RdxSliderValueChangeReason, event?: Event): void;
273
273
  /** @ignore Emits the committed value at the end of a pointer drag. */
274
274
  commitValue(event?: Event, reason?: RdxSliderValueCommitReason): void;
275
- /** @ignore */
275
+ /** @ignore Bridge the CVA into `markAsTouched` (dual). */
276
+ protected formUiTouchTarget(): RdxFormUiTouchTarget;
277
+ /** @ignore Mark touched: CVA (Reactive/template) + `touched` model + `touch` (Signal Forms). */
276
278
  markAsTouched(): void;
277
279
  /** @ignore */
278
280
  setDragging(dragging: boolean): void;
@@ -281,7 +283,7 @@ declare class RdxSliderRoot {
281
283
  /** @ignore */
282
284
  getOwnerWindow(): Window | undefined;
283
285
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxSliderRoot, never>;
284
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxSliderRoot, "div[rdxSliderRoot]", ["rdxSliderRoot"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "largeStep": { "alias": "largeStep"; "required": false; "isSignal": true; }; "minStepsBetweenValues": { "alias": "minStepsBetweenValues"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "dirInput": { "alias": "dir"; "required": false; "isSignal": true; }; "thumbCollisionBehavior": { "alias": "thumbCollisionBehavior"; "required": false; "isSignal": true; }; "thumbAlignment": { "alias": "thumbAlignment"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "onValueChange": "onValueChange"; "onValueCommitted": "onValueCommitted"; }, never, never, true, [{ directive: typeof i1.RdxCompositeList; inputs: {}; outputs: {}; }, { directive: typeof _radix_ng_primitives_core.RdxControlValueAccessor; inputs: { "value": "value"; "disabled": "disabled"; }; outputs: {}; }]>;
286
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxSliderRoot, "div[rdxSliderRoot]", ["rdxSliderRoot"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "step": { "alias": "step"; "required": false; "isSignal": true; }; "largeStep": { "alias": "largeStep"; "required": false; "isSignal": true; }; "minStepsBetweenValues": { "alias": "minStepsBetweenValues"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "dirInput": { "alias": "dir"; "required": false; "isSignal": true; }; "thumbCollisionBehavior": { "alias": "thumbCollisionBehavior"; "required": false; "isSignal": true; }; "thumbAlignment": { "alias": "thumbAlignment"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "onValueChange": "onValueChange"; "onValueCommitted": "onValueCommitted"; }, never, never, true, [{ directive: typeof i1.RdxCompositeList; inputs: {}; outputs: {}; }, { directive: typeof i2.RdxFormUiStateHost; inputs: {}; outputs: {}; }, { directive: typeof i2.RdxControlValueAccessor; inputs: { "value": "value"; "disabled": "disabled"; }; outputs: {}; }]>;
285
287
  }
286
288
 
287
289
  /**
@@ -431,7 +433,7 @@ declare class RdxSliderValue {
431
433
  *
432
434
  * @see https://base-ui.com/react/components/slider
433
435
  */
434
- declare const injectSliderRootContext: _radix_ng_primitives_core.InjectContext<RdxSliderRoot>;
436
+ declare const injectSliderRootContext: i2.InjectContext<RdxSliderRoot>;
435
437
  declare const provideSliderRootContext: (useFactory: () => RdxSliderRoot) => _angular_core.Provider;
436
438
 
437
439
  declare class RdxSliderModule {
@@ -2,7 +2,7 @@ import * as _radix_ng_primitives_switch from '@radix-ng/primitives/switch';
2
2
  import * as _angular_core from '@angular/core';
3
3
  import { Signal } from '@angular/core';
4
4
  import * as i1 from '@radix-ng/primitives/core';
5
- import { RdxCancelableChangeEventDetails, RdxFormCheckboxControl, RdxControlValueAccessor, BooleanInput } from '@radix-ng/primitives/core';
5
+ import { RdxCancelableChangeEventDetails, RdxFormUiControlBase, RdxFormCheckboxControl, RdxControlValueAccessor, BooleanInput, RdxFormUiTouchTarget } from '@radix-ng/primitives/core';
6
6
 
7
7
  /**
8
8
  * The hidden native checkbox that mirrors the switch state for form submission and screen readers.
@@ -26,7 +26,7 @@ interface RdxSwitchCheckedChangeEvent {
26
26
  *
27
27
  * @see https://base-ui.com/react/components/switch
28
28
  */
29
- declare class RdxSwitchRoot implements RdxFormCheckboxControl {
29
+ declare class RdxSwitchRoot extends RdxFormUiControlBase implements RdxFormCheckboxControl {
30
30
  /** @ignore */
31
31
  protected readonly cva: RdxControlValueAccessor<boolean | undefined>;
32
32
  readonly id: _angular_core.InputSignal<string>;
@@ -79,7 +79,20 @@ declare class RdxSwitchRoot implements RdxFormCheckboxControl {
79
79
  readonly checkedState: _angular_core.Signal<boolean>;
80
80
  /** @ignore */
81
81
  protected readonly isDisabled: _angular_core.Signal<boolean>;
82
+ /** @ignore */
83
+ readonly invalidState: _angular_core.Signal<boolean>;
84
+ /** @ignore */
85
+ readonly touchedState: _angular_core.Signal<boolean>;
86
+ /** @ignore */
87
+ readonly dirtyState: _angular_core.Signal<boolean>;
82
88
  constructor();
89
+ /** @ignore Bridge the CVA into `markAsTouched` (dual). */
90
+ protected formUiTouchTarget(): RdxFormUiTouchTarget;
91
+ /**
92
+ * Mark the switch touched — CVA for Reactive forms, plus the `touched` model + `touch` output for
93
+ * Signal Forms. Called on blur of the root button or the hidden input.
94
+ */
95
+ markAsTouched(): void;
83
96
  /** @ignore Toggles the checked state unless disabled or read-only. */
84
97
  toggle(event?: Event): void;
85
98
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxSwitchRoot, never>;
@@ -1,10 +1,10 @@
1
1
  import * as _angular_core from '@angular/core';
2
2
  import { Signal, WritableSignal, InjectionToken, InputSignal, ModelSignal } from '@angular/core';
3
3
  import * as _radix_ng_primitives_core from '@radix-ng/primitives/core';
4
- import { TimeValue, HourCycle, Granularity, Direction, BooleanInput, DateStep, Formatter, SegmentValueObj, SegmentPart } from '@radix-ng/primitives/core';
4
+ import { RdxFormUiControlBase, RdxFormValueControl, TimeValue, HourCycle, Granularity, Direction, BooleanInput, DateStep, Formatter, SegmentValueObj, SegmentPart } from '@radix-ng/primitives/core';
5
5
  import * as _internationalized_date from '@internationalized/date';
6
6
 
7
- declare class RdxTimeFieldRootDirective {
7
+ declare class RdxTimeFieldRootDirective extends RdxFormUiControlBase implements RdxFormValueControl<TimeValue | undefined> {
8
8
  /**
9
9
  * The controlled checked state of the calendar.
10
10
  */
@@ -96,6 +96,24 @@ declare class RdxTimeFieldRootDirective {
96
96
  * @ignore
97
97
  */
98
98
  readonly isInvalid: Signal<boolean>;
99
+ /**
100
+ * @ignore Effective invalid: the built-in range check OR the form-driven `invalid` / `errors`
101
+ * (Signal Forms). Reflected on the root and segments.
102
+ */
103
+ readonly invalidState: Signal<boolean>;
104
+ /**
105
+ * @ignore Tri-state display validity: the enclosing Field's gated state when inside a `rdxFieldRoot`,
106
+ * else the time-field's own (parse + form) invalidity. Overrides the base default (`formUi` only).
107
+ */
108
+ readonly displayValid: Signal<boolean | null>;
109
+ /** @ignore */
110
+ readonly touchedState: Signal<boolean>;
111
+ /** @ignore */
112
+ readonly dirtyState: Signal<boolean>;
113
+ /** @ignore Whether the user has focused a segment — gates dirty tracking so a form/initial seed of `value` doesn't mark dirty. */
114
+ private readonly userInteracted;
115
+ /** @ignore Mark the field touched (model + `touch` output) for Signal Forms. Called on segment blur. */
116
+ markAsTouched(): void;
99
117
  /**
100
118
  * @ignore
101
119
  */
@@ -168,6 +186,8 @@ declare class RdxTimeFieldInputDirective {
168
186
  * @ignore
169
187
  */
170
188
  readonly isInvalid: _angular_core.Signal<boolean>;
189
+ /** @ignore Tri-state display validity from the root (gated by an enclosing Field). */
190
+ readonly displayValid: _angular_core.Signal<boolean | null>;
171
191
  /**
172
192
  * @ignore
173
193
  */
@@ -204,6 +224,10 @@ interface TimeFieldContextToken {
204
224
  value: ModelSignal<TimeValue | undefined>;
205
225
  placeholder: ModelSignal<TimeValue>;
206
226
  isInvalid: Signal<boolean>;
227
+ /** Effective invalid: the built-in range check OR the form-driven invalid state. */
228
+ invalidState: Signal<boolean>;
229
+ /** Tri-state displayed validity (`true`/`false`/`null`): the field's gated state inside a Field, else own. */
230
+ displayValid: Signal<boolean | null>;
207
231
  disabled: InputSignal<boolean>;
208
232
  readonly: InputSignal<boolean>;
209
233
  formatter: Signal<Formatter>;