@angular/aria 22.0.0-next.6 → 22.0.0-next.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 (105) hide show
  1. package/fesm2022/_accordion-chunk.mjs +1 -1
  2. package/fesm2022/_accordion-chunk.mjs.map +1 -1
  3. package/fesm2022/_click-event-manager-chunk.mjs +1 -1
  4. package/fesm2022/_click-event-manager-chunk.mjs.map +1 -1
  5. package/fesm2022/{_signal-like-chunk.mjs → _collection-chunk.mjs} +51 -3
  6. package/fesm2022/_collection-chunk.mjs.map +1 -0
  7. package/fesm2022/_deferred-content-chunk.mjs +16 -14
  8. package/fesm2022/_deferred-content-chunk.mjs.map +1 -1
  9. package/fesm2022/_expansion-chunk.mjs.map +1 -1
  10. package/fesm2022/_list-chunk.mjs +4 -1
  11. package/fesm2022/_list-chunk.mjs.map +1 -1
  12. package/fesm2022/_list-navigation-chunk.mjs +4 -2
  13. package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
  14. package/fesm2022/_list-typeahead-chunk.mjs +1 -1
  15. package/fesm2022/_list-typeahead-chunk.mjs.map +1 -1
  16. package/fesm2022/_menu-chunk.mjs +1 -1
  17. package/fesm2022/_menu-chunk.mjs.map +1 -1
  18. package/fesm2022/{_combobox-listbox-chunk.mjs → _option-chunk.mjs} +6 -50
  19. package/fesm2022/_option-chunk.mjs.map +1 -0
  20. package/fesm2022/_tabs-chunk.mjs +22 -47
  21. package/fesm2022/_tabs-chunk.mjs.map +1 -1
  22. package/fesm2022/_toolbar-widget-group-chunk.mjs +1 -1
  23. package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
  24. package/fesm2022/_transforms-chunk.mjs +8 -0
  25. package/fesm2022/_transforms-chunk.mjs.map +1 -0
  26. package/fesm2022/{_combobox-tree-chunk.mjs → _tree-chunk.mjs} +3 -48
  27. package/fesm2022/_tree-chunk.mjs.map +1 -0
  28. package/fesm2022/_widget-chunk.mjs +84 -21
  29. package/fesm2022/_widget-chunk.mjs.map +1 -1
  30. package/fesm2022/accordion-testing.mjs.map +1 -1
  31. package/fesm2022/accordion.mjs +32 -57
  32. package/fesm2022/accordion.mjs.map +1 -1
  33. package/fesm2022/aria.mjs +1 -1
  34. package/fesm2022/aria.mjs.map +1 -1
  35. package/fesm2022/combobox-testing.mjs +79 -0
  36. package/fesm2022/combobox-testing.mjs.map +1 -0
  37. package/fesm2022/combobox.mjs +287 -296
  38. package/fesm2022/combobox.mjs.map +1 -1
  39. package/fesm2022/grid-testing.mjs +80 -0
  40. package/fesm2022/grid-testing.mjs.map +1 -0
  41. package/fesm2022/grid.mjs +113 -86
  42. package/fesm2022/grid.mjs.map +1 -1
  43. package/fesm2022/listbox-testing.mjs +4 -0
  44. package/fesm2022/listbox-testing.mjs.map +1 -1
  45. package/fesm2022/listbox.mjs +231 -225
  46. package/fesm2022/listbox.mjs.map +1 -1
  47. package/fesm2022/menu-testing.mjs +11 -0
  48. package/fesm2022/menu-testing.mjs.map +1 -1
  49. package/fesm2022/menu.mjs +66 -84
  50. package/fesm2022/menu.mjs.map +1 -1
  51. package/fesm2022/private.mjs +166 -9
  52. package/fesm2022/private.mjs.map +1 -1
  53. package/fesm2022/tabs-testing.mjs.map +1 -1
  54. package/fesm2022/tabs.mjs +241 -222
  55. package/fesm2022/tabs.mjs.map +1 -1
  56. package/fesm2022/toolbar-testing.mjs +5 -1
  57. package/fesm2022/toolbar-testing.mjs.map +1 -1
  58. package/fesm2022/toolbar.mjs +23 -33
  59. package/fesm2022/toolbar.mjs.map +1 -1
  60. package/fesm2022/tree-testing.mjs +12 -0
  61. package/fesm2022/tree-testing.mjs.map +1 -1
  62. package/fesm2022/tree.mjs +160 -156
  63. package/fesm2022/tree.mjs.map +1 -1
  64. package/package.json +10 -2
  65. package/types/_accordion-chunk.d.ts +2 -2
  66. package/types/_collection-chunk.d.ts +42 -0
  67. package/types/_expansion-chunk.d.ts +1 -1
  68. package/types/_grid-chunk.d.ts +23 -9
  69. package/types/_keyboard-event-manager-chunk.d.ts +1 -1
  70. package/types/_list-chunk.d.ts +1 -1
  71. package/types/_list-navigation-chunk.d.ts +1 -1
  72. package/types/_listbox-chunk.d.ts +1 -1
  73. package/types/_menu-chunk.d.ts +1 -1
  74. package/types/_tabs-chunk.d.ts +8 -43
  75. package/types/_toolbar-chunk.d.ts +1 -1
  76. package/types/_tree-chunk.d.ts +1 -1
  77. package/types/accordion.d.ts +7 -13
  78. package/types/combobox-testing.d.ts +63 -0
  79. package/types/combobox.d.ts +96 -192
  80. package/types/grid-testing.d.ts +83 -0
  81. package/types/grid.d.ts +102 -90
  82. package/types/listbox-testing.d.ts +25 -0
  83. package/types/listbox.d.ts +60 -63
  84. package/types/menu-testing.d.ts +6 -0
  85. package/types/menu.d.ts +24 -17
  86. package/types/private.d.ts +115 -133
  87. package/types/tabs.d.ts +26 -24
  88. package/types/toolbar-testing.d.ts +4 -0
  89. package/types/toolbar.d.ts +5 -6
  90. package/types/tree-testing.d.ts +8 -0
  91. package/types/tree.d.ts +11 -15
  92. package/fesm2022/_combobox-chunk.mjs +0 -429
  93. package/fesm2022/_combobox-chunk.mjs.map +0 -1
  94. package/fesm2022/_combobox-listbox-chunk.mjs.map +0 -1
  95. package/fesm2022/_combobox-tree-chunk.mjs.map +0 -1
  96. package/fesm2022/_element-chunk.mjs +0 -6
  97. package/fesm2022/_element-chunk.mjs.map +0 -1
  98. package/fesm2022/_pointer-event-manager-chunk.mjs +0 -54
  99. package/fesm2022/_pointer-event-manager-chunk.mjs.map +0 -1
  100. package/fesm2022/_signal-like-chunk.mjs.map +0 -1
  101. package/resources/code-examples.db +0 -0
  102. package/types/_combobox-chunk.d.ts +0 -194
  103. package/types/_element-chunk.d.ts +0 -10
  104. package/types/_pointer-event-manager-chunk.d.ts +0 -34
  105. package/types/_signal-like-chunk.d.ts +0 -14
@@ -1,224 +1,128 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import * as _angular_cdk_bidi from '@angular/cdk/bidi';
3
- import { ComboboxListboxControls, ComboboxTreeControls, ComboboxDialogPattern, ComboboxPattern } from './_combobox-chunk.js';
4
- import { DeferredContentAware, DeferredContent } from './_deferred-content-chunk.js';
5
- import './_keyboard-event-manager-chunk.js';
6
- import './_signal-like-chunk.js';
7
- import './_pointer-event-manager-chunk.js';
8
- import './_list-chunk.js';
9
- import './_list-navigation-chunk.js';
2
+ import { OnInit, OnDestroy } from '@angular/core';
3
+ import * as i1 from '@angular/aria/private';
4
+ import { ComboboxPopupPattern, DeferredContentAware, ComboboxPattern } from '@angular/aria/private';
5
+ export { DeferredContent as ɵɵDeferredContent, DeferredContentAware as ɵɵDeferredContentAware } from './_deferred-content-chunk.js';
10
6
 
11
7
  /**
12
- * Identifies an element as a popup for an `ngCombobox`.
8
+ * Identifies an element as a widget within a combobox popup.
13
9
  *
14
- * This directive acts as a bridge, allowing the `ngCombobox` to discover and interact
15
- * with the underlying control (e.g., `ngListbox`, `ngTree`, or `ngComboboxDialog`) that
16
- * manages the options. It's primarily used as a host directive and is responsible for
17
- * exposing the popup's control pattern to the parent combobox.
18
- *
19
- * @developerPreview 21.0
20
- *
21
- * @see [Combobox](guide/aria/combobox)
22
- * @see [Select](guide/aria/select)
23
- * @see [Multiselect](guide/aria/multiselect)
24
- * @see [Autocomplete](guide/aria/autocomplete)
25
- */
26
- declare class ComboboxPopup<V> {
27
- /** The combobox that the popup belongs to. */
28
- readonly combobox: Combobox<V> | null;
29
- /** The popup controls exposed to the combobox. */
30
- readonly _controls: _angular_core.WritableSignal<ComboboxListboxControls<any, V> | ComboboxTreeControls<any, V> | ComboboxDialogPattern | undefined>;
31
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxPopup<any>, never>;
32
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxPopup<any>, "[ngComboboxPopup]", ["ngComboboxPopup"], {}, {}, never, never, true, never>;
33
- }
34
-
35
- /**
36
- * The container element that wraps a combobox input and popup, and orchestrates its behavior.
37
- *
38
- * The `ngCombobox` directive is the main entry point for creating a combobox and customizing its
39
- * behavior. It coordinates the interactions between the `ngComboboxInput` and the popup, which
40
- * is defined by a `ng-template` with the `ngComboboxPopupContainer` directive. If using the
41
- * `CdkOverlay`, the `cdkConnectedOverlay` directive takes the place of `ngComboboxPopupContainer`.
42
- *
43
- * ```html
44
- * <div ngCombobox filterMode="highlight">
45
- * <input
46
- * ngComboboxInput
47
- * placeholder="Search for a state..."
48
- * [(value)]="searchString"
49
- * />
50
- *
51
- * <ng-template ngComboboxPopupContainer>
52
- * <div ngListbox [(value)]="selectedValue">
53
- * @for (option of filteredOptions(); track option) {
54
- * <div ngOption [value]="option" [label]="option">
55
- * <span>{{option}}</span>
56
- * </div>
57
- * }
58
- * </div>
59
- * </ng-template>
60
- * </div>
61
- * ```
62
- *
63
- * @developerPreview 21.0
64
- *
65
- * @see [Combobox](guide/aria/combobox)
66
- * @see [Select](guide/aria/select)
67
- * @see [Multiselect](guide/aria/multiselect)
68
- * @see [Autocomplete](guide/aria/autocomplete)
10
+ * This directive should be applied to the element that contains the options or content
11
+ * of the popup. It handles the communication of ID and active descendant information
12
+ * to the combobox.
69
13
  */
70
- declare class Combobox<V> {
71
- /** A signal wrapper for directionality. */
72
- protected readonly textDirection: _angular_core.Signal<_angular_cdk_bidi.Direction>;
73
- /** The element that the combobox is attached to. */
14
+ declare class ComboboxWidget implements OnInit, OnDestroy {
15
+ /** The element that the popup widget is attached to. */
74
16
  private readonly _elementRef;
75
- /** A reference to the combobox element. */
17
+ private readonly _popup;
18
+ /** A reference to the popup widget element. */
76
19
  readonly element: HTMLElement;
77
- /** The DeferredContentAware host directive. */
78
- private readonly _deferredContentAware;
79
- /** The combobox popup. */
80
- readonly popup: _angular_core.Signal<ComboboxPopup<V> | undefined>;
81
- /**
82
- * The filter mode for the combobox.
83
- * - `manual`: The consumer is responsible for filtering the options.
84
- * - `auto-select`: The combobox automatically selects the first matching option.
85
- * - `highlight`: The combobox highlights matching text in the options without changing selection.
86
- */
87
- readonly filterMode: _angular_core.InputSignal<"manual" | "auto-select" | "highlight">;
88
- /** Whether the combobox is disabled. */
89
- readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
90
- /** Whether the combobox is read-only. */
91
- readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
92
- /** The value of the first matching item in the popup. */
93
- readonly firstMatch: _angular_core.InputSignal<V | undefined>;
94
- /** Whether the combobox is expanded. */
95
- readonly expanded: _angular_core.Signal<boolean>;
96
- /** Whether the combobox popup should always be expanded, regardless of user interaction. */
97
- readonly alwaysExpanded: _angular_core.InputSignalWithTransform<boolean, unknown>;
98
- /** Input element connected to the combobox, if any. */
99
- readonly inputElement: _angular_core.Signal<HTMLInputElement | undefined>;
100
- /** The combobox ui pattern. */
101
- readonly _pattern: ComboboxPattern<any, V>;
20
+ /** The ID of the popup widget. */
21
+ readonly popupId: _angular_core.WritableSignal<string | undefined>;
22
+ /** The ID of the active descendant in the widget. */
23
+ readonly activeDescendant: _angular_core.InputSignal<string | undefined>;
24
+ private _observer;
102
25
  constructor();
103
- /** Opens the combobox to the selected item. */
104
- open(): void;
105
- /** Closes the combobox. */
106
- close(): void;
107
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<Combobox<any>, never>;
108
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Combobox<any>, "[ngCombobox]", ["ngCombobox"], { "filterMode": { "alias": "filterMode"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "firstMatch": { "alias": "firstMatch"; "required": false; "isSignal": true; }; "alwaysExpanded": { "alias": "alwaysExpanded"; "required": false; "isSignal": true; }; }, {}, ["popup"], never, true, [{ directive: typeof DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
26
+ ngOnInit(): void;
27
+ ngOnDestroy(): void;
28
+ /** Handles focus in events for the widget. */
29
+ onFocusin(): void;
30
+ /** Handles focus out events for the widget. */
31
+ onFocusout(event: FocusEvent): void;
32
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxWidget, never>;
33
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxWidget, "[ngComboboxWidget]", ["ngComboboxWidget"], { "activeDescendant": { "alias": "activeDescendant"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
109
34
  }
110
35
 
111
36
  /**
112
- * Integrates a native `<dialog>` element with the combobox, allowing for
113
- * a modal or non-modal popup experience. It handles the opening and closing of the dialog
114
- * based on the combobox's expanded state.
37
+ * A structural directive that marks the `ng-template` to be used as the popup
38
+ * for a combobox. This content is conditionally rendered.
39
+ *
40
+ * The content of the popup can be any element with the `ngComboboxWidget` directive.
115
41
  *
116
42
  * ```html
117
- * <ng-template ngComboboxPopupContainer>
118
- * <dialog ngComboboxDialog class="example-dialog">
119
- * <!-- ... dialog content ... -->
120
- * </dialog>
43
+ * <ng-template ngComboboxPopup>
44
+ * <div ngComboboxWidget>
45
+ * <!-- ... options ... -->
46
+ * </div>
121
47
  * </ng-template>
122
48
  * ```
123
- *
124
- * @developerPreview 21.0
125
- *
126
- * @see [Combobox](guide/aria/combobox)
127
- * @see [Select](guide/aria/select)
128
- * @see [Multiselect](guide/aria/multiselect)
129
- * @see [Autocomplete](guide/aria/autocomplete)
130
49
  */
131
- declare class ComboboxDialog {
132
- /** The dialog element. */
133
- private readonly _elementRef;
134
- /** A reference to the dialog element. */
135
- readonly element: HTMLElement;
136
- /** The combobox that the dialog belongs to. */
137
- readonly combobox: Combobox<any>;
138
- /** A reference to the parent combobox popup, if one exists. */
139
- private readonly _popup;
140
- readonly _pattern: ComboboxDialogPattern;
141
- constructor();
142
- close(): void;
143
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxDialog, never>;
144
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxDialog, "dialog[ngComboboxDialog]", ["ngComboboxDialog"], {}, {}, never, never, true, [{ directive: typeof ComboboxPopup; inputs: {}; outputs: {}; }]>;
50
+ declare class ComboboxPopup implements OnInit, OnDestroy {
51
+ private readonly _deferredContent;
52
+ /** The combobox that the popup belongs to. */
53
+ readonly combobox: _angular_core.InputSignal<Combobox>;
54
+ /** The widget contained within the popup. */
55
+ readonly _widget: _angular_core.WritableSignal<ComboboxWidget | undefined>;
56
+ /** The element that serves as the control target for the popup. */
57
+ readonly controlTarget: _angular_core.Signal<HTMLElement | undefined>;
58
+ /** The ID of the popup. */
59
+ readonly popupId: _angular_core.Signal<string | undefined>;
60
+ /** The ID of the active descendant in the popup. */
61
+ readonly activeDescendant: _angular_core.Signal<string | undefined>;
62
+ /** The type of the popup (e.g., listbox, tree, grid, dialog). */
63
+ readonly popupType: _angular_core.InputSignal<"listbox" | "tree" | "grid" | "dialog">;
64
+ /** The popup pattern. */
65
+ readonly _pattern: ComboboxPopupPattern;
66
+ ngOnInit(): void;
67
+ ngOnDestroy(): void;
68
+ /** Registers a widget with the popup. */
69
+ _registerWidget(widget: ComboboxWidget): void;
70
+ /** Unregisters the widget from the popup. */
71
+ _unregisterWidget(): void;
72
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxPopup, never>;
73
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxPopup, "ng-template[ngComboboxPopup]", ["ngComboboxPopup"], { "combobox": { "alias": "combobox"; "required": true; "isSignal": true; }; "popupType": { "alias": "popupType"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.DeferredContent; inputs: {}; outputs: {}; }]>;
145
74
  }
146
75
 
147
76
  /**
148
- * An input that is part of a combobox. It is responsible for displaying the
149
- * current value and handling user input for filtering and selection.
77
+ * The container element that wraps a combobox input and popup, and orchestrates its behavior.
150
78
  *
151
- * This directive should be applied to an `<input>` element within an `ngCombobox`
152
- * container. It automatically handles keyboard interactions, such as opening the
153
- * popup and navigating through the options.
79
+ * The `ngCombobox` directive is the main entry point for creating a combobox and customizing its
80
+ * behavior. It coordinates the interactions between the input and the popup.
154
81
  *
155
82
  * ```html
156
- * <input
157
- * ngComboboxInput
158
- * placeholder="Search..."
159
- * [(value)]="searchString"
160
- * />
161
- * ```
162
- *
163
- * @developerPreview 21.0
83
+ * <div ngCombobox [(expanded)]="expanded">
84
+ * <input ngComboboxInput />
164
85
  *
165
- * @see [Combobox](guide/aria/combobox)
166
- * @see [Select](guide/aria/select)
167
- * @see [Multiselect](guide/aria/multiselect)
168
- * @see [Autocomplete](guide/aria/autocomplete)
86
+ * <ng-template ngComboboxPopup>
87
+ * <div ngComboboxWidget>
88
+ * <!-- ... options ... -->
89
+ * </div>
90
+ * </ng-template>
91
+ * </div>
92
+ * ```
169
93
  */
170
- declare class ComboboxInput {
94
+ declare class Combobox extends DeferredContentAware implements OnInit {
95
+ private readonly _renderer;
171
96
  /** The element that the combobox is attached to. */
172
97
  private readonly _elementRef;
173
98
  /** A reference to the input element. */
174
99
  readonly element: HTMLElement;
175
- /** The combobox that the input belongs to. */
176
- readonly combobox: Combobox<any>;
177
- /** The value of the input. */
100
+ /** The popup associated with the combobox. */
101
+ readonly _popup: _angular_core.WritableSignal<ComboboxPopup | undefined>;
102
+ /** Whether the combobox is disabled. */
103
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
104
+ /** Whether the combobox is soft disabled (remains focusable). */
105
+ readonly softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
106
+ /** Whether the combobox should always remain expanded. */
107
+ readonly alwaysExpanded: _angular_core.InputSignalWithTransform<boolean, unknown>;
108
+ /** The tabindex of the combobox. */
109
+ readonly tabIndex: _angular_core.InputSignalWithTransform<number | undefined, string | number | undefined>;
110
+ /** Whether the combobox is expanded. */
111
+ readonly expanded: _angular_core.ModelSignal<boolean>;
112
+ /** The value of the combobox input. */
178
113
  readonly value: _angular_core.ModelSignal<string>;
114
+ /** An inline suggestion to be displayed in the input. */
115
+ readonly inlineSuggestion: _angular_core.InputSignal<string | undefined>;
116
+ /** The combobox ui pattern. */
117
+ readonly _pattern: ComboboxPattern;
179
118
  constructor();
180
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxInput, never>;
181
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxInput, "input[ngComboboxInput]", ["ngComboboxInput"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
182
- }
183
-
184
- /**
185
- * A structural directive that marks the `ng-template` to be used as the popup
186
- * for a combobox. This content is conditionally rendered.
187
- *
188
- * The content of the popup can be a `ngListbox`, `ngTree`, or `role="dialog"`, allowing for
189
- * flexible and complex combobox implementations. The consumer is responsible for
190
- * implementing the filtering logic based on the `ngComboboxInput`'s value.
191
- *
192
- * ```html
193
- * <ng-template ngComboboxPopupContainer>
194
- * <div ngListbox [(value)]="selectedValue">
195
- * <!-- ... options ... -->
196
- * </div>
197
- * </ng-template>
198
- * ```
199
- *
200
- * When using CdkOverlay, this directive can be replaced by `cdkConnectedOverlay`.
201
- *
202
- * ```html
203
- * <ng-template
204
- * [cdkConnectedOverlay]="{origin: inputElement, usePopover: 'inline' matchWidth: true}"
205
- * [cdkConnectedOverlayOpen]="combobox.expanded()">
206
- * <div ngListbox [(value)]="selectedValue">
207
- * <!-- ... options ... -->
208
- * </div>
209
- * </ng-template>
210
- * ```
211
- *
212
- * @developerPreview 21.0
213
- *
214
- * @see [Combobox](guide/aria/combobox)
215
- * @see [Select](guide/aria/select)
216
- * @see [Multiselect](guide/aria/multiselect)
217
- * @see [Autocomplete](guide/aria/autocomplete)
218
- */
219
- declare class ComboboxPopupContainer {
220
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxPopupContainer, never>;
221
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxPopupContainer, "ng-template[ngComboboxPopupContainer]", ["ngComboboxPopupContainer"], {}, {}, never, never, true, [{ directive: typeof DeferredContent; inputs: {}; outputs: {}; }]>;
119
+ ngOnInit(): void;
120
+ /** Registers a popup with the combobox. */
121
+ _registerPopup(popup: ComboboxPopup): void;
122
+ /** Unregisters the popup from the combobox. */
123
+ _unregisterPopup(): void;
124
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Combobox, never>;
125
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Combobox, "[ngCombobox]", ["ngCombobox"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "alwaysExpanded": { "alias": "alwaysExpanded"; "required": false; "isSignal": true; }; "tabIndex": { "alias": "tabindex"; "required": false; "isSignal": true; }; "expanded": { "alias": "expanded"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "inlineSuggestion": { "alias": "inlineSuggestion"; "required": false; "isSignal": true; }; }, { "expanded": "expandedChange"; "value": "valueChange"; }, never, never, true, never>;
222
126
  }
223
127
 
224
- export { Combobox, ComboboxDialog, ComboboxInput, ComboboxPopup, ComboboxPopupContainer, DeferredContent as ɵɵDeferredContent, DeferredContentAware as ɵɵDeferredContentAware };
128
+ export { Combobox, ComboboxPopup, ComboboxWidget };
@@ -0,0 +1,83 @@
1
+ import { BaseHarnessFilters, ContentContainerComponentHarness, HarnessPredicate, ComponentHarness } from '@angular/cdk/testing';
2
+
3
+ /** Filters for locating a `GridCellHarness`. */
4
+ interface GridCellHarnessFilters extends BaseHarnessFilters {
5
+ /** Only find instances whose text matches the given value. */
6
+ text?: string | RegExp;
7
+ /** Only find instances whose selected state matches the given value. */
8
+ selected?: boolean;
9
+ /** Only find instances whose disabled state matches the given value. */
10
+ disabled?: boolean;
11
+ }
12
+ /** Filters for locating a `GridRowHarness`. */
13
+ interface GridRowHarnessFilters extends BaseHarnessFilters {
14
+ }
15
+ /** Filters for locating a `GridHarness`. */
16
+ interface GridHarnessFilters extends BaseHarnessFilters {
17
+ /** Only find instances whose disabled state matches the given value. */
18
+ disabled?: boolean;
19
+ }
20
+
21
+ /** Harness for interacting with a standard ngGridCell in tests. */
22
+ declare class GridCellHarness extends ContentContainerComponentHarness {
23
+ static hostSelector: string;
24
+ /**
25
+ * Gets a `HarnessPredicate` that can be used to search for a grid cell with specific attributes.
26
+ * @param options Options for filtering which cell instances are considered a match.
27
+ * @return a `HarnessPredicate` configured with the given options.
28
+ */
29
+ static with(options?: GridCellHarnessFilters): HarnessPredicate<GridCellHarness>;
30
+ /** Whether the cell is selected. */
31
+ isSelected(): Promise<boolean>;
32
+ /** Whether the cell is disabled. */
33
+ isDisabled(): Promise<boolean>;
34
+ /** Gets the text content of the cell. */
35
+ getText(): Promise<string>;
36
+ /** Clicks the cell. */
37
+ click(): Promise<void>;
38
+ /** Focuses the cell. */
39
+ focus(): Promise<void>;
40
+ /** Blurs the cell. */
41
+ blur(): Promise<void>;
42
+ /** Whether the cell is active. */
43
+ isActive(): Promise<boolean>;
44
+ /** Whether the cell is focused. */
45
+ isFocused(): Promise<boolean>;
46
+ }
47
+ /** Harness for interacting with a standard ngGridRow in tests. */
48
+ declare class GridRowHarness extends ComponentHarness {
49
+ static hostSelector: string;
50
+ /**
51
+ * Gets a `HarnessPredicate` that can be used to search for a grid row with specific attributes.
52
+ * @param options Options for filtering which row instances are considered a match.
53
+ * @return a `HarnessPredicate` configured with the given options.
54
+ */
55
+ static with(options?: GridRowHarnessFilters): HarnessPredicate<GridRowHarness>;
56
+ /** Gets all cells in the row. */
57
+ getCells(filters?: GridCellHarnessFilters): Promise<GridCellHarness[]>;
58
+ /** Gets the text of the cells in the row. */
59
+ getCellTextByIndex(filters?: GridCellHarnessFilters): Promise<string[]>;
60
+ }
61
+ /** Harness for interacting with a standard ngGrid in tests. */
62
+ declare class GridHarness extends ComponentHarness {
63
+ static hostSelector: string;
64
+ /**
65
+ * Gets a `HarnessPredicate` that can be used to search for a grid with specific attributes.
66
+ * @param options Options for filtering which grid instances are considered a match.
67
+ * @return a `HarnessPredicate` configured with the given options.
68
+ */
69
+ static with(options?: GridHarnessFilters): HarnessPredicate<GridHarness>;
70
+ /** Whether the grid is disabled. */
71
+ isDisabled(): Promise<boolean>;
72
+ /** Whether the grid is multi-selectable. */
73
+ isMultiSelectable(): Promise<boolean>;
74
+ /** Gets all rows in the grid. */
75
+ getRows(filters?: GridRowHarnessFilters): Promise<GridRowHarness[]>;
76
+ /** Gets all cells in the grid. */
77
+ getCells(filters?: GridCellHarnessFilters): Promise<GridCellHarness[]>;
78
+ /** Gets the text inside the entire grid organized by rows. */
79
+ getCellTextByIndex(): Promise<string[][]>;
80
+ }
81
+
82
+ export { GridCellHarness, GridHarness, GridRowHarness };
83
+ export type { GridCellHarnessFilters, GridHarnessFilters, GridRowHarnessFilters };
package/types/grid.d.ts CHANGED
@@ -1,90 +1,10 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { Signal, ElementRef } from '@angular/core';
2
+ import { OnInit, OnDestroy, Signal } from '@angular/core';
3
3
  import * as _angular_cdk_bidi from '@angular/cdk/bidi';
4
- import { GridPattern, GridCellPattern, GridRowPattern, GridCellWidgetPattern } from './_grid-chunk.js';
5
- import './_signal-like-chunk.js';
4
+ import { GridCellPattern, GridPattern, GridRowPattern, ElementResolver, GridCellWidgetPattern } from './_grid-chunk.js';
5
+ import { SortedCollection } from './_collection-chunk.js';
6
6
  import './_keyboard-event-manager-chunk.js';
7
- import './_pointer-event-manager-chunk.js';
8
-
9
- /**
10
- * The container for a grid. It provides keyboard navigation and focus management for the grid's
11
- * rows and cells. It manages the overall behavior of the grid, including focus
12
- * wrapping, selection, and disabled states.
13
- *
14
- * ```html
15
- * <table ngGrid [multi]="true" [enableSelection]="true">
16
- * @for (row of gridData; track row) {
17
- * <tr ngGridRow>
18
- * @for (cell of row; track cell) {
19
- * <td ngGridCell [disabled]="cell.disabled">
20
- * {{cell.value}}
21
- * </td>
22
- * }
23
- * </tr>
24
- * }
25
- * </table>
26
- * ```
27
- *
28
- * @developerPreview 21.0
29
- *
30
- * @see [Grid](guide/aria/grid)
31
- */
32
- declare class Grid {
33
- /** A reference to the host element. */
34
- private readonly _elementRef;
35
- /** A reference to the host element. */
36
- readonly element: HTMLElement;
37
- /** The rows that make up the grid. */
38
- private readonly _rows;
39
- /** The UI patterns for the rows in the grid. */
40
- private readonly _rowPatterns;
41
- /** Text direction. */
42
- readonly textDirection: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
43
- /** Whether selection is enabled for the grid. */
44
- readonly enableSelection: _angular_core.InputSignalWithTransform<boolean, unknown>;
45
- /** Whether the grid is disabled. */
46
- readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
47
- /**
48
- * Whether to allow disabled items to receive focus. When `true`, disabled items are
49
- * focusable but not interactive. When `false`, disabled items are skipped during navigation.
50
- */
51
- readonly softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
52
- /**
53
- * The focus strategy used by the grid.
54
- * - `roving`: Focus is moved to the active cell using `tabindex`.
55
- * - `activedescendant`: Focus remains on the grid container, and `aria-activedescendant` is used to indicate the active cell.
56
- */
57
- readonly focusMode: _angular_core.InputSignal<"roving" | "activedescendant">;
58
- /**
59
- * The wrapping behavior for keyboard navigation along the row axis.
60
- * - `continuous`: Navigation wraps from the last row to the first, and vice-versa.
61
- * - `loop`: Navigation wraps within the current row.
62
- * - `nowrap`: Navigation stops at the first/last item in the row.
63
- */
64
- readonly rowWrap: _angular_core.InputSignal<"continuous" | "loop" | "nowrap">;
65
- /**
66
- * The wrapping behavior for keyboard navigation along the column axis.
67
- * - `continuous`: Navigation wraps from the last column to the first, and vice-versa.
68
- * - `loop`: Navigation wraps within the current column.
69
- * - `nowrap`: Navigation stops at the first/last item in the column.
70
- */
71
- readonly colWrap: _angular_core.InputSignal<"continuous" | "loop" | "nowrap">;
72
- /** Whether multiple cells in the grid can be selected. */
73
- readonly multi: _angular_core.InputSignalWithTransform<boolean, unknown>;
74
- /**
75
- * The selection strategy used by the grid.
76
- * - `follow`: The focused cell is automatically selected.
77
- * - `explicit`: Cells are selected explicitly by the user (e.g., via click or spacebar).
78
- */
79
- readonly selectionMode: _angular_core.InputSignal<"follow" | "explicit">;
80
- /** The UI pattern for the grid. */
81
- readonly _pattern: GridPattern;
82
- constructor();
83
- /** Gets the cell pattern for a given element. */
84
- private _getCell;
85
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<Grid, never>;
86
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Grid, "[ngGrid]", ["ngGrid"], { "enableSelection": { "alias": "enableSelection"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "focusMode": { "alias": "focusMode"; "required": false; "isSignal": true; }; "rowWrap": { "alias": "rowWrap"; "required": false; "isSignal": true; }; "colWrap": { "alias": "colWrap"; "required": false; "isSignal": true; }; "multi": { "alias": "multi"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; }, {}, ["_rows"], never, true, never>;
87
- }
7
+ import './_click-event-manager-chunk.js';
88
8
 
89
9
  /**
90
10
  * Represents a cell within a grid row. It is the primary focusable element
@@ -101,7 +21,7 @@ declare class Grid {
101
21
  *
102
22
  * @see [Grid](guide/aria/grid)
103
23
  */
104
- declare class GridCell {
24
+ declare class GridCell implements OnInit, OnDestroy {
105
25
  private readonly _elementRef;
106
26
  private readonly _renderer;
107
27
  /** A reference to the host element. */
@@ -144,6 +64,8 @@ declare class GridCell {
144
64
  /** The UI pattern for the grid cell. */
145
65
  readonly _pattern: GridCellPattern;
146
66
  constructor();
67
+ ngOnInit(): void;
68
+ ngOnDestroy(): void;
147
69
  private _toggleAttribute;
148
70
  /** Gets the cell widget pattern for a given element. */
149
71
  private _getWidget;
@@ -164,13 +86,13 @@ declare class GridCell {
164
86
  *
165
87
  * @see [Grid](guide/aria/grid)
166
88
  */
167
- declare class GridRow {
89
+ declare class GridRow implements OnInit, OnDestroy {
168
90
  /** A reference to the host element. */
169
91
  private readonly _elementRef;
170
92
  /** A reference to the host element. */
171
93
  readonly element: HTMLElement;
172
- /** The cells that make up this row. */
173
- private readonly _cells;
94
+ /** The collection of cells in this row. */
95
+ readonly _collection: SortedCollection<GridCell>;
174
96
  /** The UI patterns for the cells in this row. */
175
97
  private readonly _cellPatterns;
176
98
  /** The parent grid. */
@@ -181,8 +103,98 @@ declare class GridRow {
181
103
  readonly rowIndex: _angular_core.InputSignal<number | undefined>;
182
104
  /** The UI pattern for the grid row. */
183
105
  readonly _pattern: GridRowPattern;
106
+ constructor();
107
+ ngOnInit(): void;
108
+ ngOnDestroy(): void;
184
109
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<GridRow, never>;
185
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridRow, "[ngGridRow]", ["ngGridRow"], { "rowIndex": { "alias": "rowIndex"; "required": false; "isSignal": true; }; }, {}, ["_cells"], never, true, never>;
110
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridRow, "[ngGridRow]", ["ngGridRow"], { "rowIndex": { "alias": "rowIndex"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
111
+ }
112
+
113
+ /**
114
+ * The container for a grid. It provides keyboard navigation and focus management for the grid's
115
+ * rows and cells. It manages the overall behavior of the grid, including focus
116
+ * wrapping, selection, and disabled states.
117
+ *
118
+ * ```html
119
+ * <table ngGrid [multi]="true" [enableSelection]="true">
120
+ * @for (row of gridData; track row) {
121
+ * <tr ngGridRow>
122
+ * @for (cell of row; track cell) {
123
+ * <td ngGridCell [disabled]="cell.disabled">
124
+ * {{cell.value}}
125
+ * </td>
126
+ * }
127
+ * </tr>
128
+ * }
129
+ * </table>
130
+ * ```
131
+ *
132
+ * @developerPreview 21.0
133
+ *
134
+ * @see [Grid](guide/aria/grid)
135
+ */
136
+ declare class Grid implements OnDestroy {
137
+ /** A reference to the host element. */
138
+ private readonly _elementRef;
139
+ /** A reference to the host element. */
140
+ readonly element: HTMLElement;
141
+ /** The collection of rows in the grid. */
142
+ readonly _collection: SortedCollection<GridRow>;
143
+ /** The UI patterns for the rows in the grid. */
144
+ private readonly _rowPatterns;
145
+ /** Text direction. */
146
+ readonly textDirection: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
147
+ /** Whether selection is enabled for the grid. */
148
+ readonly enableSelection: _angular_core.InputSignalWithTransform<boolean, unknown>;
149
+ /** Whether the grid is disabled. */
150
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
151
+ /**
152
+ * Whether to allow disabled items to receive focus. When `true`, disabled items are
153
+ * focusable but not interactive. When `false`, disabled items are skipped during navigation.
154
+ */
155
+ readonly softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
156
+ /**
157
+ * The focus strategy used by the grid.
158
+ * - `roving`: Focus is moved to the active cell using `tabindex`.
159
+ * - `activedescendant`: Focus remains on the grid container, and `aria-activedescendant` is used to indicate the active cell.
160
+ */
161
+ readonly focusMode: _angular_core.InputSignal<"roving" | "activedescendant">;
162
+ /**
163
+ * The wrapping behavior for keyboard navigation along the row axis.
164
+ * - `continuous`: Navigation wraps from the last row to the first, and vice-versa.
165
+ * - `loop`: Navigation wraps within the current row.
166
+ * - `nowrap`: Navigation stops at the first/last item in the row.
167
+ */
168
+ readonly rowWrap: _angular_core.InputSignal<"continuous" | "loop" | "nowrap">;
169
+ /**
170
+ * The wrapping behavior for keyboard navigation along the column axis.
171
+ * - `continuous`: Navigation wraps from the last column to the first, and vice-versa.
172
+ * - `loop`: Navigation wraps within the current column.
173
+ * - `nowrap`: Navigation stops at the first/last item in the column.
174
+ */
175
+ readonly colWrap: _angular_core.InputSignal<"continuous" | "loop" | "nowrap">;
176
+ /** Whether multiple cells in the grid can be selected. */
177
+ readonly multi: _angular_core.InputSignalWithTransform<boolean, unknown>;
178
+ /**
179
+ * The selection strategy used by the grid.
180
+ * - `follow`: The focused cell is automatically selected.
181
+ * - `explicit`: Cells are selected explicitly by the user (e.g., via click or spacebar).
182
+ */
183
+ readonly selectionMode: _angular_core.InputSignal<"follow" | "explicit">;
184
+ /** The tabindex of the grid. */
185
+ readonly tabIndex: _angular_core.InputSignalWithTransform<number | undefined, string | number | undefined>;
186
+ /** The UI pattern for the grid. */
187
+ readonly _pattern: GridPattern;
188
+ /** The ID of the active descendant in the grid. */
189
+ readonly activeDescendant: Signal<string | undefined>;
190
+ constructor();
191
+ ngOnDestroy(): void;
192
+ /** Scrolls the active cell into view. */
193
+ scrollActiveCellIntoView(options?: ScrollIntoViewOptions): void;
194
+ /** Gets the cell pattern for a given element. */
195
+ private _getCell;
196
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Grid, never>;
197
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Grid, "[ngGrid]", ["ngGrid"], { "enableSelection": { "alias": "enableSelection"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "focusMode": { "alias": "focusMode"; "required": false; "isSignal": true; }; "rowWrap": { "alias": "rowWrap"; "required": false; "isSignal": true; }; "colWrap": { "alias": "colWrap"; "required": false; "isSignal": true; }; "multi": { "alias": "multi"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "tabIndex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
186
198
  }
187
199
 
188
200
  /**
@@ -219,7 +231,7 @@ declare class GridCellWidget {
219
231
  /** Whether the widget is disabled. */
220
232
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
221
233
  /** The target that will receive focus instead of the widget. */
222
- readonly focusTarget: _angular_core.InputSignal<ElementRef<any> | HTMLElement | undefined>;
234
+ readonly focusTarget: _angular_core.InputSignal<ElementResolver<HTMLElement>>;
223
235
  /** Emits when the widget is activated. */
224
236
  readonly activated: _angular_core.OutputEmitterRef<KeyboardEvent | FocusEvent | undefined>;
225
237
  /** Emits when the widget is deactivated. */