@radix-ng/primitives 1.0.10 → 1.1.0

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 (50) hide show
  1. package/README.md +26 -5
  2. package/fesm2022/radix-ng-primitives-autocomplete.mjs +24 -16
  3. package/fesm2022/radix-ng-primitives-autocomplete.mjs.map +1 -1
  4. package/fesm2022/radix-ng-primitives-checkbox.mjs +55 -7
  5. package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
  6. package/fesm2022/radix-ng-primitives-combobox.mjs +35 -18
  7. package/fesm2022/radix-ng-primitives-combobox.mjs.map +1 -1
  8. package/fesm2022/radix-ng-primitives-composite.mjs +221 -36
  9. package/fesm2022/radix-ng-primitives-composite.mjs.map +1 -1
  10. package/fesm2022/radix-ng-primitives-core.mjs +181 -21
  11. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  12. package/fesm2022/radix-ng-primitives-date-field.mjs +11 -5
  13. package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
  14. package/fesm2022/radix-ng-primitives-field.mjs +127 -23
  15. package/fesm2022/radix-ng-primitives-field.mjs.map +1 -1
  16. package/fesm2022/radix-ng-primitives-form.mjs +35 -4
  17. package/fesm2022/radix-ng-primitives-form.mjs.map +1 -1
  18. package/fesm2022/radix-ng-primitives-input.mjs +87 -15
  19. package/fesm2022/radix-ng-primitives-input.mjs.map +1 -1
  20. package/fesm2022/radix-ng-primitives-menu.mjs +34 -7
  21. package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
  22. package/fesm2022/radix-ng-primitives-popper.mjs +80 -11
  23. package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
  24. package/fesm2022/radix-ng-primitives-scroll-area.mjs +6 -3
  25. package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
  26. package/fesm2022/radix-ng-primitives-select.mjs +36 -12
  27. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  28. package/fesm2022/radix-ng-primitives-signal-forms.mjs +27 -11
  29. package/fesm2022/radix-ng-primitives-signal-forms.mjs.map +1 -1
  30. package/fesm2022/radix-ng-primitives-time-field.mjs +12 -6
  31. package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
  32. package/package.json +8 -3
  33. package/types/radix-ng-primitives-autocomplete.d.ts +7 -2
  34. package/types/radix-ng-primitives-checkbox.d.ts +10 -1
  35. package/types/radix-ng-primitives-combobox.d.ts +29 -2
  36. package/types/radix-ng-primitives-composite.d.ts +48 -2
  37. package/types/radix-ng-primitives-core.d.ts +152 -94
  38. package/types/radix-ng-primitives-date-field.d.ts +7 -4
  39. package/types/radix-ng-primitives-field.d.ts +55 -8
  40. package/types/radix-ng-primitives-form.d.ts +9 -0
  41. package/types/radix-ng-primitives-input.d.ts +10 -2
  42. package/types/radix-ng-primitives-menu.d.ts +45 -4
  43. package/types/radix-ng-primitives-navigation-menu.d.ts +2 -2
  44. package/types/radix-ng-primitives-popover.d.ts +2 -2
  45. package/types/radix-ng-primitives-popper.d.ts +60 -15
  46. package/types/radix-ng-primitives-preview-card.d.ts +2 -2
  47. package/types/radix-ng-primitives-select.d.ts +17 -3
  48. package/types/radix-ng-primitives-signal-forms.d.ts +22 -8
  49. package/types/radix-ng-primitives-time-field.d.ts +9 -6
  50. package/types/radix-ng-primitives-tooltip.d.ts +2 -2
@@ -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, RdxFormUiControlBase, RdxFormValueControl, RdxFloatingRootContext, Direction, ItemValueComparator, RdxTransitionStatus, RdxFormUiStateContext } from '@radix-ng/primitives/core';
4
+ import { AcceptableValue, RdxCancelableChangeEventDetails, RdxFormUiControlBase, RdxFormValueControl, RdxFloatingRootContext, Direction, ItemValueComparator, RdxTransitionStatus, RdxFormUiTouchTarget, 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';
@@ -11,6 +11,7 @@ import { RdxPopperContentWrapper } from '@radix-ng/primitives/popper';
11
11
  import * as i2 from '@radix-ng/primitives/floating-focus-manager';
12
12
  import { RdxInteractionType } from '@radix-ng/primitives/floating-focus-manager';
13
13
  import * as _radix_ng_primitives_types_radix_ng_primitives_core from '@radix-ng/primitives/types/radix-ng-primitives-core';
14
+ import { ControlValueAccessor } from '@angular/forms';
14
15
  import * as i1$2 from '@radix-ng/primitives/portal';
15
16
 
16
17
  declare class RdxSelectGroupLabel {
@@ -365,7 +366,7 @@ interface RdxSelectRootContext extends RdxFormUiStateContext {
365
366
  }
366
367
  declare const injectSelectRootContext: _radix_ng_primitives_core.InjectContext<RdxSelectRootContext>;
367
368
  declare const provideSelectRootContext: (useFactory: () => RdxSelectRootContext) => _angular_core.Provider;
368
- declare class RdxSelectRoot extends RdxFormUiControlBase implements RdxFormValueControl<AcceptableValue | AcceptableValue[] | undefined> {
369
+ declare class RdxSelectRoot extends RdxFormUiControlBase implements ControlValueAccessor, RdxFormValueControl<AcceptableValue | AcceptableValue[] | undefined> {
369
370
  readonly contentId: string;
370
371
  readonly open: _angular_core.ModelSignal<boolean>;
371
372
  /** Whether the current open was initiated by **touch** (ADR 0016 §3 — gates the anchored scroll lock). */
@@ -385,6 +386,8 @@ declare class RdxSelectRoot extends RdxFormUiControlBase implements RdxFormValue
385
386
  readonly defaultOpen: _angular_core.InputSignalWithTransform<boolean, unknown>;
386
387
  readonly multiple: _angular_core.InputSignalWithTransform<boolean, unknown>;
387
388
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
389
+ private readonly cvaDisabled;
390
+ readonly disabledState: Signal<boolean>;
388
391
  /** When `true`, the value cannot be changed by the user (the popup can still be opened to view it). */
389
392
  readonly readOnly: _angular_core.InputSignalWithTransform<boolean, unknown>;
390
393
  /** Marks the control as required — reflected on the trigger as `aria-required` / `data-required`. */
@@ -423,6 +426,18 @@ declare class RdxSelectRoot extends RdxFormUiControlBase implements RdxFormValue
423
426
  getOption(value: SelectOption['value']): SelectOption | undefined;
424
427
  setValue(value: AcceptableValue | undefined, reason?: RdxSelectValueChangeReason, event?: Event): boolean;
425
428
  setOpen(open: boolean, reason?: RdxSelectOpenChangeReason, event?: Event): boolean;
429
+ /** @ignore Bridge the CVA touched callback into the shared Signal Forms UI-state path. */
430
+ protected formUiTouchTarget(): RdxFormUiTouchTarget;
431
+ /** @ignore Write a form-owned value without emitting a user change. */
432
+ writeValue(value: AcceptableValue | AcceptableValue[] | undefined): void;
433
+ /** @ignore Register the Reactive Forms / ngModel value callback. */
434
+ registerOnChange(fn: (value: AcceptableValue | AcceptableValue[] | undefined) => void): void;
435
+ /** @ignore Register the Reactive Forms / ngModel touched callback. */
436
+ registerOnTouched(fn: () => void): void;
437
+ /** @ignore Merge form-owned disabled state with the public disabled input. */
438
+ setDisabledState(isDisabled: boolean): void;
439
+ private onChange?;
440
+ private onTouched?;
426
441
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxSelectRoot, never>;
427
442
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxSelectRoot, "[rdxSelectRoot]", ["rdxSelectRoot"], { "open": { "alias": "open"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "defaultValue": { "alias": "defaultValue"; "required": false; "isSignal": true; }; "defaultOpen": { "alias": "defaultOpen"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "modal": { "alias": "modal"; "required": false; "isSignal": true; }; "dirInput": { "alias": "dir"; "required": false; "isSignal": true; }; "isItemEqualToValue": { "alias": "isItemEqualToValue"; "required": false; "isSignal": true; }; "itemToStringLabel": { "alias": "itemToStringLabel"; "required": false; "isSignal": true; }; }, { "open": "openChange"; "value": "valueChange"; "onOpenChange": "onOpenChange"; "onValueChange": "onValueChange"; "onOpenChangeComplete": "onOpenChangeComplete"; }, never, never, true, [{ directive: typeof i1$1.RdxPopper; inputs: {}; outputs: {}; }]>;
428
443
  }
@@ -474,7 +489,6 @@ declare class RdxSelectTrigger {
474
489
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
475
490
  readonly isDisabled: _angular_core.Signal<boolean>;
476
491
  protected readonly triggerInteraction: i2.RdxTriggerInteraction;
477
- protected readonly invalidState: _angular_core.Signal<boolean>;
478
492
  /**
479
493
  * Tri-state *displayed* validity: when inside a `rdxFieldRoot` the field's gated `validState` is the
480
494
  * single source (so the field's `validationMode` keeps the trigger neutral until revealed), otherwise
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { FieldTree } from '@angular/forms/signals';
3
+ import { BooleanInput } from '@radix-ng/primitives/core';
3
4
 
4
5
  /**
5
6
  * Bridges an Angular **Signal Forms** field into an enclosing `rdxFieldRoot` — with **no duplicate
@@ -16,9 +17,9 @@ import { FieldTree } from '@angular/forms/signals';
16
17
  *
17
18
  * It owns no model and runs no validation — Signal Forms remains the source of truth. It only registers
18
19
  * 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).
20
+ * `required` / `dirty` / `touched` data-attributes, tri-state pending validity, and the error *content*
21
+ * (`rdxFieldError.messages()`) read authoritative Signal Forms state. `filled` / `focused` stay on
22
+ * Field's DOM heuristic (partial ownership — the seam supports it).
22
23
  *
23
24
  * It reports the **actual** Signal Forms state only; the `Field` decides *when* to display it from its
24
25
  * `validationMode` (default `'onBlur'` — neutral until the field is touched or the form submitted). So an
@@ -51,9 +52,13 @@ declare class RdxSignalField {
51
52
  *
52
53
  * Registers an {@link RdxFormState} provider so the Form's aggregate `data-invalid` / `data-dirty` /
53
54
  * `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.
55
+ * state. By default this adapter owns only client-side state and `name`-routing; server errors stay a
56
+ * separate eager channel applied through `rdxFormRoot[errors]`. Add `rdxSignalSubmit` to delegate native
57
+ * submission to Signal Forms' own `submit()` lifecycle instead of `rdxFormRoot.onFormSubmit`:
58
+ *
59
+ * ```html
60
+ * <form rdxFormRoot [rdxSignalForm]="loginForm" rdxSignalSubmit>…</form>
61
+ * ```
57
62
  *
58
63
  * `errorsFor(name)` routes a field's errors to a `rdxFieldRoot` by its `name`, walking the `FieldTree`
59
64
  * so dotted paths into nested object/array fields resolve too (`address.street`, `items.0.name`). A
@@ -62,13 +67,22 @@ declare class RdxSignalField {
62
67
  * a field carries both, `rdxFieldError.messages()` deduplicates by text so the shared message is not
63
68
  * shown twice.
64
69
  *
65
- * See ADR 0018.
70
+ * See ADR 0018 and ADR 0020.
66
71
  *
67
72
  * @group Components
68
73
  */
69
74
  declare class RdxSignalForm {
70
75
  /** The Signal Forms root field (from `form(...)`) whose aggregate state drives the enclosing Form. */
71
76
  readonly form: i0.InputSignal<FieldTree<unknown>>;
77
+ /**
78
+ * Delegate native submission to Angular Signal Forms' `submit()` lifecycle. Opt-in so adding the
79
+ * state adapter to an existing 1.x form cannot silently replace its `(onFormSubmit)` side effects.
80
+ * The bound `form()` must define `submission.action`; Angular reports a descriptive error otherwise.
81
+ *
82
+ * @group Props
83
+ * @defaultValue false
84
+ */
85
+ readonly signalSubmit: i0.InputSignalWithTransform<boolean, BooleanInput>;
72
86
  private readonly formContext;
73
87
  constructor();
74
88
  /**
@@ -84,7 +98,7 @@ declare class RdxSignalForm {
84
98
  /** The current Signal Forms root field state (a `FieldTree` is callable). */
85
99
  private state;
86
100
  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>;
101
+ static ɵdir: i0.ɵɵDirectiveDeclaration<RdxSignalForm, "form[rdxFormRoot][rdxSignalForm]", ["rdxSignalForm"], { "form": { "alias": "rdxSignalForm"; "required": true; "isSignal": true; }; "signalSubmit": { "alias": "rdxSignalSubmit"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
88
102
  }
89
103
 
90
104
  declare const _importsSignalForms: (typeof RdxSignalField | typeof RdxSignalForm)[];
@@ -4,11 +4,12 @@ import * as _radix_ng_primitives_core from '@radix-ng/primitives/core';
4
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 extends RdxFormUiControlBase implements RdxFormValueControl<TimeValue | undefined> {
7
+ declare class RdxTimeFieldRootDirective extends RdxFormUiControlBase implements RdxFormValueControl<TimeValue | null> {
8
8
  /**
9
- * The controlled checked state of the calendar.
9
+ * The controlled time value. `null` represents an empty field and keeps the value addressable as
10
+ * an Angular Signal Forms child field (`undefined` denotes an absent optional path).
10
11
  */
11
- readonly value: _angular_core.ModelSignal<TimeValue | undefined>;
12
+ readonly value: _angular_core.ModelSignal<TimeValue | null>;
12
13
  /**
13
14
  * The hour cycle to use for formatting times. Defaults to the locale preference
14
15
  */
@@ -89,7 +90,7 @@ declare class RdxTimeFieldRootDirective extends RdxFormUiControlBase implements
89
90
  readonly inferredGranularity: Signal<Granularity>;
90
91
  readonly convertedMinValue: Signal<_internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime | undefined>;
91
92
  readonly convertedMaxValue: Signal<_internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime | undefined>;
92
- readonly convertedModelValue: _angular_core.WritableSignal<TimeValue | undefined>;
93
+ readonly convertedModelValue: _angular_core.WritableSignal<TimeValue | null>;
93
94
  readonly convertedPlaceholder: _angular_core.WritableSignal<TimeValue>;
94
95
  /**
95
96
  * The per-segment values. Writable so segment editing (via `useDateField`) can
@@ -121,6 +122,8 @@ declare class RdxTimeFieldRootDirective extends RdxFormUiControlBase implements
121
122
  private readonly userInteracted;
122
123
  /** @ignore Mark the field touched (model + `touch` output) for Signal Forms. Called on segment blur. */
123
124
  markAsTouched(): void;
125
+ /** Reset segment interaction so the form-owned value write remains pristine. */
126
+ reset(): void;
124
127
  /**
125
128
  * @ignore
126
129
  */
@@ -228,7 +231,7 @@ declare class RdxTimeFieldInputDirective {
228
231
 
229
232
  interface TimeFieldContextToken {
230
233
  locale: InputSignal<string>;
231
- value: ModelSignal<TimeValue | undefined>;
234
+ value: ModelSignal<TimeValue | null>;
232
235
  /** The controlled placeholder; may be `undefined`. Use `convertedPlaceholder` for segment math. */
233
236
  placeholder: Signal<TimeValue | undefined>;
234
237
  isInvalid: Signal<boolean>;
@@ -243,7 +246,7 @@ interface TimeFieldContextToken {
243
246
  segmentValues: WritableSignal<SegmentValueObj>;
244
247
  focusNext: () => void;
245
248
  setFocusedElement: (el: HTMLElement) => void;
246
- convertedModelValue: WritableSignal<TimeValue | undefined>;
249
+ convertedModelValue: WritableSignal<TimeValue | null>;
247
250
  convertedPlaceholder: WritableSignal<TimeValue>;
248
251
  step$: Signal<DateStep>;
249
252
  }
@@ -231,7 +231,7 @@ declare class RdxTooltip {
231
231
  declare class RdxTooltipArrow {
232
232
  protected readonly rootContext: _radix_ng_primitives_tooltip.RdxTooltipContext;
233
233
  private readonly wrapper;
234
- protected readonly side: _angular_core.Signal<"top" | "right" | "bottom" | "left" | undefined>;
234
+ protected readonly side: _angular_core.Signal<i1$1.SideOrLogical | undefined>;
235
235
  protected readonly align: _angular_core.Signal<"start" | "center" | "end" | undefined>;
236
236
  protected readonly uncentered: _angular_core.Signal<boolean>;
237
237
  protected readonly isVisuallyHidden: boolean;
@@ -245,7 +245,7 @@ declare class RdxTooltipArrow {
245
245
  declare class RdxTooltipPopup {
246
246
  protected readonly rootContext: _radix_ng_primitives_tooltip.RdxTooltipContext;
247
247
  private readonly wrapper;
248
- protected readonly side: _angular_core.Signal<"top" | "right" | "bottom" | "left" | undefined>;
248
+ protected readonly side: _angular_core.Signal<i1$1.SideOrLogical | undefined>;
249
249
  protected readonly align: _angular_core.Signal<"start" | "center" | "end" | undefined>;
250
250
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<RdxTooltipPopup, never>;
251
251
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<RdxTooltipPopup, "[rdxTooltipPopup]", never, {}, {}, never, never, true, [{ directive: typeof i1$1.RdxPopperContent; inputs: {}; outputs: {}; }]>;