@radix-ng/primitives 1.0.9 → 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 (65) hide show
  1. package/README.md +26 -5
  2. package/fesm2022/radix-ng-primitives-autocomplete.mjs +35 -19
  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 +46 -21
  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 +189 -26
  11. package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
  12. package/fesm2022/radix-ng-primitives-date-field.mjs +29 -13
  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-floating-focus-manager.mjs +9 -0
  17. package/fesm2022/radix-ng-primitives-floating-focus-manager.mjs.map +1 -1
  18. package/fesm2022/radix-ng-primitives-focus-scope.mjs +241 -95
  19. package/fesm2022/radix-ng-primitives-focus-scope.mjs.map +1 -1
  20. package/fesm2022/radix-ng-primitives-form.mjs +35 -4
  21. package/fesm2022/radix-ng-primitives-form.mjs.map +1 -1
  22. package/fesm2022/radix-ng-primitives-input.mjs +87 -15
  23. package/fesm2022/radix-ng-primitives-input.mjs.map +1 -1
  24. package/fesm2022/radix-ng-primitives-menu.mjs +131 -16
  25. package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
  26. package/fesm2022/radix-ng-primitives-navigation-menu.mjs +17 -3
  27. package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
  28. package/fesm2022/radix-ng-primitives-popper.mjs +223 -29
  29. package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
  30. package/fesm2022/radix-ng-primitives-portal.mjs +16 -5
  31. package/fesm2022/radix-ng-primitives-portal.mjs.map +1 -1
  32. package/fesm2022/radix-ng-primitives-scroll-area.mjs +6 -3
  33. package/fesm2022/radix-ng-primitives-scroll-area.mjs.map +1 -1
  34. package/fesm2022/radix-ng-primitives-select.mjs +49 -17
  35. package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
  36. package/fesm2022/radix-ng-primitives-signal-forms.mjs +27 -11
  37. package/fesm2022/radix-ng-primitives-signal-forms.mjs.map +1 -1
  38. package/fesm2022/radix-ng-primitives-time-field.mjs +24 -10
  39. package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
  40. package/package.json +8 -7
  41. package/types/radix-ng-primitives-autocomplete.d.ts +7 -2
  42. package/types/radix-ng-primitives-checkbox.d.ts +10 -1
  43. package/types/radix-ng-primitives-combobox.d.ts +29 -2
  44. package/types/radix-ng-primitives-composite.d.ts +48 -2
  45. package/types/radix-ng-primitives-core.d.ts +165 -104
  46. package/types/radix-ng-primitives-date-field.d.ts +21 -8
  47. package/types/radix-ng-primitives-field.d.ts +55 -8
  48. package/types/radix-ng-primitives-floating-focus-manager.d.ts +7 -0
  49. package/types/radix-ng-primitives-focus-scope.d.ts +61 -44
  50. package/types/radix-ng-primitives-form.d.ts +9 -0
  51. package/types/radix-ng-primitives-input.d.ts +10 -2
  52. package/types/radix-ng-primitives-menu.d.ts +59 -7
  53. package/types/radix-ng-primitives-navigation-menu.d.ts +2 -2
  54. package/types/radix-ng-primitives-popover.d.ts +2 -2
  55. package/types/radix-ng-primitives-popper.d.ts +186 -48
  56. package/types/radix-ng-primitives-portal.d.ts +18 -8
  57. package/types/radix-ng-primitives-preview-card.d.ts +2 -2
  58. package/types/radix-ng-primitives-select.d.ts +17 -3
  59. package/types/radix-ng-primitives-signal-forms.d.ts +22 -8
  60. package/types/radix-ng-primitives-time-field.d.ts +21 -10
  61. package/types/radix-ng-primitives-tooltip.d.ts +2 -2
  62. package/fesm2022/radix-ng-primitives-focus-guards.mjs +0 -53
  63. package/fesm2022/radix-ng-primitives-focus-guards.mjs.map +0 -1
  64. package/focus-guards/README.md +0 -1
  65. package/types/radix-ng-primitives-focus-guards.d.ts +0 -15
@@ -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
  */
@@ -60,6 +61,13 @@ declare class RdxTimeFieldRootDirective extends RdxFormUiControlBase implements
60
61
  * The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view
61
62
  */
62
63
  readonly placeholder: _angular_core.ModelSignal<TimeValue | undefined>;
64
+ /**
65
+ * Always-defined placeholder used for segment math. A controlled `[placeholder]` can be reset to
66
+ * `undefined`; fall back to the default time so the converted placeholder is never built from
67
+ * `undefined`.
68
+ * @ignore
69
+ */
70
+ readonly effectivePlaceholder: Signal<TimeValue>;
63
71
  /**
64
72
  * Segment input parts, collected from the projected content in DOM order. This
65
73
  * stays in sync with `segmentContents()` (granularity / locale / value changes
@@ -82,7 +90,7 @@ declare class RdxTimeFieldRootDirective extends RdxFormUiControlBase implements
82
90
  readonly inferredGranularity: Signal<Granularity>;
83
91
  readonly convertedMinValue: Signal<_internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime | undefined>;
84
92
  readonly convertedMaxValue: Signal<_internationalized_date.CalendarDateTime | _internationalized_date.ZonedDateTime | undefined>;
85
- readonly convertedModelValue: _angular_core.WritableSignal<TimeValue | undefined>;
93
+ readonly convertedModelValue: _angular_core.WritableSignal<TimeValue | null>;
86
94
  readonly convertedPlaceholder: _angular_core.WritableSignal<TimeValue>;
87
95
  /**
88
96
  * The per-segment values. Writable so segment editing (via `useDateField`) can
@@ -114,6 +122,8 @@ declare class RdxTimeFieldRootDirective extends RdxFormUiControlBase implements
114
122
  private readonly userInteracted;
115
123
  /** @ignore Mark the field touched (model + `touch` output) for Signal Forms. Called on segment blur. */
116
124
  markAsTouched(): void;
125
+ /** Reset segment interaction so the form-owned value write remains pristine. */
126
+ reset(): void;
117
127
  /**
118
128
  * @ignore
119
129
  */
@@ -221,21 +231,22 @@ declare class RdxTimeFieldInputDirective {
221
231
 
222
232
  interface TimeFieldContextToken {
223
233
  locale: InputSignal<string>;
224
- value: ModelSignal<TimeValue | undefined>;
225
- placeholder: ModelSignal<TimeValue>;
234
+ value: ModelSignal<TimeValue | null>;
235
+ /** The controlled placeholder; may be `undefined`. Use `convertedPlaceholder` for segment math. */
236
+ placeholder: Signal<TimeValue | undefined>;
226
237
  isInvalid: Signal<boolean>;
227
238
  /** Effective invalid: the built-in range check OR the form-driven invalid state. */
228
239
  invalidState: Signal<boolean>;
229
240
  /** Tri-state displayed validity (`true`/`false`/`null`): the field's gated state inside a Field, else own. */
230
241
  displayValid: Signal<boolean | null>;
231
- disabled: InputSignal<boolean>;
232
- readonly: InputSignal<boolean>;
242
+ disabled: Signal<boolean>;
243
+ readonly: Signal<boolean>;
233
244
  formatter: Signal<Formatter>;
234
- hourCycle: InputSignal<HourCycle>;
245
+ hourCycle: Signal<HourCycle | undefined>;
235
246
  segmentValues: WritableSignal<SegmentValueObj>;
236
247
  focusNext: () => void;
237
248
  setFocusedElement: (el: HTMLElement) => void;
238
- convertedModelValue: WritableSignal<TimeValue | undefined>;
249
+ convertedModelValue: WritableSignal<TimeValue | null>;
239
250
  convertedPlaceholder: WritableSignal<TimeValue>;
240
251
  step$: Signal<DateStep>;
241
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: {}; }]>;
@@ -1,53 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { inject, Injector, afterNextRender, effect, Directive } from '@angular/core';
3
-
4
- /** Number of components which have requested interest to have focus guards */
5
- let count = 0;
6
- /**
7
- * Injects a pair of focus guards at the edges of the whole DOM tree
8
- * to ensure `focusin` & `focusout` events can be caught consistently.
9
- */
10
- class RdxFocusGuards {
11
- constructor() {
12
- this.injector = inject(Injector);
13
- afterNextRender(() => {
14
- effect((onCleanup) => {
15
- const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
16
- document.body.insertAdjacentElement('afterbegin', edgeGuards[0] ?? this.createFocusGuard());
17
- document.body.insertAdjacentElement('beforeend', edgeGuards[1] ?? this.createFocusGuard());
18
- count++;
19
- onCleanup(() => {
20
- if (count === 1) {
21
- document.querySelectorAll('[data-radix-focus-guard]').forEach((node) => node.remove());
22
- }
23
- count--;
24
- });
25
- }, { injector: this.injector });
26
- });
27
- }
28
- createFocusGuard() {
29
- const element = document.createElement('span');
30
- element.setAttribute('data-radix-focus-guard', '');
31
- element.tabIndex = 0;
32
- element.style.outline = 'none';
33
- element.style.opacity = '0';
34
- element.style.position = 'fixed';
35
- element.style.pointerEvents = 'none';
36
- return element;
37
- }
38
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxFocusGuards, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
39
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.2", type: RdxFocusGuards, isStandalone: true, selector: "[rdxFocusGuards]", ngImport: i0 }); }
40
- }
41
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: RdxFocusGuards, decorators: [{
42
- type: Directive,
43
- args: [{
44
- selector: '[rdxFocusGuards]'
45
- }]
46
- }], ctorParameters: () => [] });
47
-
48
- /**
49
- * Generated bundle index. Do not edit.
50
- */
51
-
52
- export { RdxFocusGuards };
53
- //# sourceMappingURL=radix-ng-primitives-focus-guards.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"radix-ng-primitives-focus-guards.mjs","sources":["../../../packages/primitives/focus-guards/src/focus-guards.ts","../../../packages/primitives/focus-guards/radix-ng-primitives-focus-guards.ts"],"sourcesContent":["import { afterNextRender, Directive, effect, inject, Injector } from '@angular/core';\n\n/** Number of components which have requested interest to have focus guards */\nlet count = 0;\n\n/**\n * Injects a pair of focus guards at the edges of the whole DOM tree\n * to ensure `focusin` & `focusout` events can be caught consistently.\n */\n@Directive({\n selector: '[rdxFocusGuards]'\n})\nexport class RdxFocusGuards {\n private readonly injector = inject(Injector);\n\n constructor() {\n afterNextRender(() => {\n effect(\n (onCleanup) => {\n const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');\n\n document.body.insertAdjacentElement('afterbegin', edgeGuards[0] ?? this.createFocusGuard());\n\n document.body.insertAdjacentElement('beforeend', edgeGuards[1] ?? this.createFocusGuard());\n\n count++;\n\n onCleanup(() => {\n if (count === 1) {\n document.querySelectorAll('[data-radix-focus-guard]').forEach((node) => node.remove());\n }\n\n count--;\n });\n },\n { injector: this.injector }\n );\n });\n }\n\n createFocusGuard() {\n const element = document.createElement('span');\n element.setAttribute('data-radix-focus-guard', '');\n element.tabIndex = 0;\n element.style.outline = 'none';\n element.style.opacity = '0';\n element.style.position = 'fixed';\n element.style.pointerEvents = 'none';\n return element;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;AACA,IAAI,KAAK,GAAG,CAAC;AAEb;;;AAGG;MAIU,cAAc,CAAA;AAGvB,IAAA,WAAA,GAAA;AAFiB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAGxC,eAAe,CAAC,MAAK;AACjB,YAAA,MAAM,CACF,CAAC,SAAS,KAAI;gBACV,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,CAAC,0BAA0B,CAAC;AAExE,gBAAA,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,gBAAgB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,CAAA;AACP,oBAAA,QAAQ,EAAE;AACb,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -1 +0,0 @@
1
- # @radix-ng/primitives/focus-guards
@@ -1,15 +0,0 @@
1
- import * as i0 from '@angular/core';
2
-
3
- /**
4
- * Injects a pair of focus guards at the edges of the whole DOM tree
5
- * to ensure `focusin` & `focusout` events can be caught consistently.
6
- */
7
- declare class RdxFocusGuards {
8
- private readonly injector;
9
- constructor();
10
- createFocusGuard(): HTMLSpanElement;
11
- static ɵfac: i0.ɵɵFactoryDeclaration<RdxFocusGuards, never>;
12
- static ɵdir: i0.ɵɵDirectiveDeclaration<RdxFocusGuards, "[rdxFocusGuards]", never, {}, {}, never, never, true, never>;
13
- }
14
-
15
- export { RdxFocusGuards };