@angular/aria 21.0.0-rc.1 → 21.0.0-rc.3

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 (41) hide show
  1. package/_adev_assets/aria-accordion.json +429 -59
  2. package/_adev_assets/aria-combobox.json +261 -41
  3. package/_adev_assets/aria-grid.json +339 -85
  4. package/_adev_assets/aria-listbox.json +99 -70
  5. package/_adev_assets/aria-menu.json +355 -158
  6. package/_adev_assets/aria-tabs.json +198 -305
  7. package/_adev_assets/aria-toolbar.json +70 -221
  8. package/_adev_assets/aria-tree.json +153 -363
  9. package/fesm2022/_widget-chunk.mjs +388 -57
  10. package/fesm2022/_widget-chunk.mjs.map +1 -1
  11. package/fesm2022/accordion.mjs +125 -72
  12. package/fesm2022/accordion.mjs.map +1 -1
  13. package/fesm2022/aria.mjs +1 -1
  14. package/fesm2022/aria.mjs.map +1 -1
  15. package/fesm2022/combobox.mjs +129 -24
  16. package/fesm2022/combobox.mjs.map +1 -1
  17. package/fesm2022/grid.mjs +203 -65
  18. package/fesm2022/grid.mjs.map +1 -1
  19. package/fesm2022/listbox.mjs +50 -39
  20. package/fesm2022/listbox.mjs.map +1 -1
  21. package/fesm2022/menu.mjs +179 -71
  22. package/fesm2022/menu.mjs.map +1 -1
  23. package/fesm2022/private.mjs +418 -440
  24. package/fesm2022/private.mjs.map +1 -1
  25. package/fesm2022/tabs.mjs +105 -73
  26. package/fesm2022/tabs.mjs.map +1 -1
  27. package/fesm2022/toolbar.mjs +52 -44
  28. package/fesm2022/toolbar.mjs.map +1 -1
  29. package/fesm2022/tree.mjs +106 -63
  30. package/fesm2022/tree.mjs.map +1 -1
  31. package/package.json +2 -2
  32. package/types/_grid-chunk.d.ts +216 -35
  33. package/types/accordion.d.ts +134 -35
  34. package/types/combobox.d.ts +141 -12
  35. package/types/grid.d.ts +150 -32
  36. package/types/listbox.d.ts +60 -28
  37. package/types/menu.d.ts +133 -49
  38. package/types/private.d.ts +210 -250
  39. package/types/tabs.d.ts +124 -44
  40. package/types/toolbar.d.ts +58 -36
  41. package/types/tree.d.ts +121 -49
@@ -2,8 +2,38 @@ import * as _angular_core from '@angular/core';
2
2
  import { WritableSignal } from '@angular/core';
3
3
  import * as _angular_cdk_bidi from '@angular/cdk/bidi';
4
4
  import * as i1 from '@angular/aria/private';
5
- import { ComboboxPattern, ComboboxListboxControls, ComboboxTreeControls } from '@angular/aria/private';
5
+ import { ComboboxPattern, ComboboxDialogPattern, ComboboxListboxControls, ComboboxTreeControls } from '@angular/aria/private';
6
6
 
7
+ /**
8
+ * The container element that wraps a combobox input and popup, and orchestrates its behavior.
9
+ *
10
+ * The `ngCombobox` directive is the main entry point for creating a combobox and customizing its
11
+ * behavior. It coordinates the interactions between the `ngComboboxInput` and the popup, which
12
+ * is defined by a `ng-template` with the `ngComboboxPopupContainer` directive. If using the
13
+ * `CdkOverlay`, the `cdkConnectedOverlay` directive takes the place of `ngComboboxPopupContainer`.
14
+ *
15
+ * ```html
16
+ * <div ngCombobox filterMode="highlight">
17
+ * <input
18
+ * ngComboboxInput
19
+ * placeholder="Search for a state..."
20
+ * [(value)]="searchString"
21
+ * />
22
+ *
23
+ * <ng-template ngComboboxPopupContainer>
24
+ * <div ngListbox [(value)]="selectedValue">
25
+ * @for (option of filteredOptions(); track option) {
26
+ * <div ngOption [value]="option" [label]="option">
27
+ * <span>{{option}}</span>
28
+ * </div>
29
+ * }
30
+ * </div>
31
+ * </ng-template>
32
+ * </div>
33
+ * ```
34
+ *
35
+ * @developerPreview 21.0
36
+ */
7
37
  declare class Combobox<V> {
8
38
  /** The directionality (LTR / RTL) context for the application (or a subtree of it). */
9
39
  private readonly _directionality;
@@ -11,35 +41,64 @@ declare class Combobox<V> {
11
41
  protected textDirection: _angular_core.Signal<_angular_cdk_bidi.Direction>;
12
42
  /** The element that the combobox is attached to. */
13
43
  private readonly _elementRef;
44
+ /** A reference to the combobox element. */
45
+ readonly element: HTMLElement;
14
46
  /** The DeferredContentAware host directive. */
15
47
  private readonly _deferredContentAware;
16
48
  /** The combobox popup. */
17
49
  readonly popup: _angular_core.Signal<ComboboxPopup<V> | undefined>;
18
- /** The filter mode for the combobox. */
50
+ /**
51
+ * The filter mode for the combobox.
52
+ * - `manual`: The consumer is responsible for filtering the options.
53
+ * - `auto-select`: The combobox automatically selects the first matching option.
54
+ * - `highlight`: The combobox highlights matching text in the options without changing selection.
55
+ */
19
56
  filterMode: _angular_core.InputSignal<"manual" | "auto-select" | "highlight">;
20
- /** Whether the combobox is focused. */
21
- readonly isFocused: WritableSignal<boolean>;
22
- /** Whether the combobox has received focus yet. */
23
- private _hasBeenFocused;
24
57
  /** Whether the combobox is disabled. */
25
- readonly disabled: _angular_core.InputSignal<boolean>;
58
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
26
59
  /** Whether the combobox is read-only. */
27
- readonly readonly: _angular_core.InputSignal<boolean>;
60
+ readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
28
61
  /** The value of the first matching item in the popup. */
29
62
  readonly firstMatch: _angular_core.InputSignal<V | undefined>;
30
63
  /** Whether the combobox is expanded. */
31
64
  readonly expanded: _angular_core.Signal<boolean>;
65
+ /** Whether the combobox popup should always be expanded, regardless of user interaction. */
66
+ readonly alwaysExpanded: _angular_core.InputSignalWithTransform<boolean, unknown>;
32
67
  /** Input element connected to the combobox, if any. */
33
68
  readonly inputElement: _angular_core.Signal<HTMLInputElement | undefined>;
34
69
  /** The combobox ui pattern. */
35
70
  readonly _pattern: ComboboxPattern<any, V>;
36
71
  constructor();
72
+ /** Opens the combobox to the selected item. */
73
+ open(): void;
74
+ /** Closes the combobox. */
75
+ close(): void;
37
76
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Combobox<any>, never>;
38
- 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; }; }, {}, ["popup"], never, true, [{ directive: typeof i1.DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
77
+ 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 i1.DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
39
78
  }
79
+ /**
80
+ * An input that is part of a combobox. It is responsible for displaying the
81
+ * current value and handling user input for filtering and selection.
82
+ *
83
+ * This directive should be applied to an `<input>` element within an `ngCombobox`
84
+ * container. It automatically handles keyboard interactions, such as opening the
85
+ * popup and navigating through the options.
86
+ *
87
+ * ```html
88
+ * <input
89
+ * ngComboboxInput
90
+ * placeholder="Search..."
91
+ * [(value)]="searchString"
92
+ * />
93
+ * ```
94
+ *
95
+ * @developerPreview 21.0
96
+ */
40
97
  declare class ComboboxInput {
41
98
  /** The element that the combobox is attached to. */
42
99
  private readonly _elementRef;
100
+ /** A reference to the input element. */
101
+ readonly element: HTMLElement;
43
102
  /** The combobox that the input belongs to. */
44
103
  readonly combobox: Combobox<any>;
45
104
  /** The value of the input. */
@@ -48,17 +107,87 @@ declare class ComboboxInput {
48
107
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxInput, never>;
49
108
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxInput, "input[ngComboboxInput]", ["ngComboboxInput"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
50
109
  }
110
+ /**
111
+ * A structural directive that marks the `ng-template` to be used as the popup
112
+ * for a combobox. This content is conditionally rendered.
113
+ *
114
+ * The content of the popup can be a `ngListbox`, `ngTree`, or `role="dialog"`, allowing for
115
+ * flexible and complex combobox implementations. The consumer is responsible for
116
+ * implementing the filtering logic based on the `ngComboboxInput`'s value.
117
+ *
118
+ * ```html
119
+ * <ng-template ngComboboxPopupContainer>
120
+ * <div ngListbox [(value)]="selectedValue">
121
+ * <!-- ... options ... -->
122
+ * </div>
123
+ * </ng-template>
124
+ * ```
125
+ *
126
+ * When using CdkOverlay, this directive can be replaced by `cdkConnectedOverlay`.
127
+ *
128
+ * ```html
129
+ * <ng-template
130
+ * [cdkConnectedOverlay]="{origin: inputElement, usePopover: 'inline' matchWidth: true}"
131
+ * [cdkConnectedOverlayOpen]="combobox.expanded()">
132
+ * <div ngListbox [(value)]="selectedValue">
133
+ * <!-- ... options ... -->
134
+ * </div>
135
+ * </ng-template>
136
+ * ```
137
+ *
138
+ * @developerPreview 21.0
139
+ */
51
140
  declare class ComboboxPopupContainer {
52
141
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxPopupContainer, never>;
53
142
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxPopupContainer, "ng-template[ngComboboxPopupContainer]", ["ngComboboxPopupContainer"], {}, {}, never, never, true, [{ directive: typeof i1.DeferredContent; inputs: {}; outputs: {}; }]>;
54
143
  }
144
+ /**
145
+ * Identifies an element as a popup for an `ngCombobox`.
146
+ *
147
+ * This directive acts as a bridge, allowing the `ngCombobox` to discover and interact
148
+ * with the underlying control (e.g., `ngListbox`, `ngTree`, or `ngComboboxDialog`) that
149
+ * manages the options. It's primarily used as a host directive and is responsible for
150
+ * exposing the popup's control pattern to the parent combobox.
151
+ *
152
+ * @developerPreview 21.0
153
+ */
55
154
  declare class ComboboxPopup<V> {
56
155
  /** The combobox that the popup belongs to. */
57
156
  readonly combobox: Combobox<V> | null;
58
- /** The controls the popup exposes to the combobox. */
59
- readonly controls: WritableSignal<ComboboxListboxControls<any, V> | ComboboxTreeControls<any, V> | undefined>;
157
+ /** The popup controls exposed to the combobox. */
158
+ readonly _controls: WritableSignal<ComboboxDialogPattern | ComboboxListboxControls<any, V> | ComboboxTreeControls<any, V> | undefined>;
60
159
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxPopup<any>, never>;
61
160
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxPopup<any>, "[ngComboboxPopup]", ["ngComboboxPopup"], {}, {}, never, never, true, never>;
62
161
  }
162
+ /**
163
+ * Integrates a native `<dialog>` element with the combobox, allowing for
164
+ * a modal or non-modal popup experience. It handles the opening and closing of the dialog
165
+ * based on the combobox's expanded state.
166
+ *
167
+ * ```html
168
+ * <ng-template ngComboboxPopupContainer>
169
+ * <dialog ngComboboxDialog class="example-dialog">
170
+ * <!-- ... dialog content ... -->
171
+ * </dialog>
172
+ * </ng-template>
173
+ * ```
174
+ *
175
+ * @developerPreview 21.0
176
+ */
177
+ declare class ComboboxDialog {
178
+ /** The dialog element. */
179
+ private readonly _elementRef;
180
+ /** A reference to the dialog element. */
181
+ readonly element: HTMLElement;
182
+ /** The combobox that the dialog belongs to. */
183
+ readonly combobox: Combobox<any>;
184
+ /** A reference to the parent combobox popup, if one exists. */
185
+ private readonly _popup;
186
+ _pattern: ComboboxDialogPattern;
187
+ constructor();
188
+ close(): void;
189
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxDialog, never>;
190
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxDialog, "dialog[ngComboboxDialog]", ["ngComboboxDialog"], {}, {}, never, never, true, [{ directive: typeof ComboboxPopup; inputs: {}; outputs: {}; }]>;
191
+ }
63
192
 
64
- export { Combobox, ComboboxInput, ComboboxPopup, ComboboxPopupContainer };
193
+ export { Combobox, ComboboxDialog, ComboboxInput, ComboboxPopup, ComboboxPopupContainer };
package/types/grid.d.ts CHANGED
@@ -1,35 +1,76 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { Signal } from '@angular/core';
2
+ import { Signal, ElementRef } from '@angular/core';
3
3
  import * as _angular_cdk_bidi from '@angular/cdk/bidi';
4
4
  import { GridPattern, GridRowPattern, GridCellPattern, GridCellWidgetPattern } from './_grid-chunk.js';
5
5
 
6
- /** A directive that provides grid-based navigation and selection behavior. */
6
+ /**
7
+ * The container for a grid. It provides keyboard navigation and focus management for the grid's
8
+ * rows and cells. It manages the overall behavior of the grid, including focus
9
+ * wrapping, selection, and disabled states.
10
+ *
11
+ * ```html
12
+ * <table ngGrid [multi]="true" [enableSelection]="true">
13
+ * @for (row of gridData; track row) {
14
+ * <tr ngGridRow>
15
+ * @for (cell of row; track cell) {
16
+ * <td ngGridCell [disabled]="cell.disabled">
17
+ * {{cell.value}}
18
+ * </td>
19
+ * }
20
+ * </tr>
21
+ * }
22
+ * </table>
23
+ * ```
24
+ *
25
+ * @developerPreview 21.0
26
+ */
7
27
  declare class Grid {
8
28
  /** A reference to the host element. */
9
29
  private readonly _elementRef;
30
+ /** A reference to the host element. */
31
+ readonly element: HTMLElement;
10
32
  /** The rows that make up the grid. */
11
33
  private readonly _rows;
12
34
  /** The UI patterns for the rows in the grid. */
13
35
  private readonly _rowPatterns;
14
36
  /** Text direction. */
15
37
  readonly textDirection: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
16
- /** The host native element. */
17
- readonly element: Signal<any>;
18
38
  /** Whether selection is enabled for the grid. */
19
39
  readonly enableSelection: _angular_core.InputSignalWithTransform<boolean, unknown>;
20
40
  /** Whether the grid is disabled. */
21
41
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
22
- /** Whether to allow disabled items to receive focus. */
42
+ /**
43
+ * Whether to allow disabled items to receive focus. When `true`, disabled items are
44
+ * focusable but not interactive. When `false`, disabled items are skipped during navigation.
45
+ */
23
46
  readonly softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
24
- /** The focus strategy used by the grid. */
47
+ /**
48
+ * The focus strategy used by the grid.
49
+ * - `roving`: Focus is moved to the active cell using `tabindex`.
50
+ * - `activedescendant`: Focus remains on the grid container, and `aria-activedescendant` is used to indicate the active cell.
51
+ */
25
52
  readonly focusMode: _angular_core.InputSignal<"roving" | "activedescendant">;
26
- /** The wrapping behavior for keyboard navigation along the row axis. */
53
+ /**
54
+ * The wrapping behavior for keyboard navigation along the row axis.
55
+ * - `continuous`: Navigation wraps from the last row to the first, and vice-versa.
56
+ * - `loop`: Navigation wraps within the current row.
57
+ * - `nowrap`: Navigation stops at the first/last item in the row.
58
+ */
27
59
  readonly rowWrap: _angular_core.InputSignal<"continuous" | "loop" | "nowrap">;
28
- /** The wrapping behavior for keyboard navigation along the column axis. */
60
+ /**
61
+ * The wrapping behavior for keyboard navigation along the column axis.
62
+ * - `continuous`: Navigation wraps from the last column to the first, and vice-versa.
63
+ * - `loop`: Navigation wraps within the current column.
64
+ * - `nowrap`: Navigation stops at the first/last item in the column.
65
+ */
29
66
  readonly colWrap: _angular_core.InputSignal<"continuous" | "loop" | "nowrap">;
30
67
  /** Whether multiple cells in the grid can be selected. */
31
68
  readonly multi: _angular_core.InputSignalWithTransform<boolean, unknown>;
32
- /** The selection strategy used by the grid. */
69
+ /**
70
+ * The selection strategy used by the grid.
71
+ * - `follow`: The focused cell is automatically selected.
72
+ * - `explicit`: Cells are selected explicitly by the user (e.g., via click or spacebar).
73
+ */
33
74
  readonly selectionMode: _angular_core.InputSignal<"follow" | "explicit">;
34
75
  /** Whether enable range selections (with modifier keys or dragging). */
35
76
  readonly enableRangeSelection: _angular_core.InputSignalWithTransform<boolean, unknown>;
@@ -41,10 +82,22 @@ declare class Grid {
41
82
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Grid, never>;
42
83
  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; }; "enableRangeSelection": { "alias": "enableRangeSelection"; "required": false; "isSignal": true; }; }, {}, ["_rows"], never, true, never>;
43
84
  }
44
- /** A directive that represents a row in a grid. */
85
+ /**
86
+ * Represents a row within a grid. It is a container for `ngGridCell` directives.
87
+ *
88
+ * ```html
89
+ * <tr ngGridRow>
90
+ * <!-- ... cells ... -->
91
+ * </tr>
92
+ * ```
93
+ *
94
+ * @developerPreview 21.0
95
+ */
45
96
  declare class GridRow {
46
97
  /** A reference to the host element. */
47
98
  private readonly _elementRef;
99
+ /** A reference to the host element. */
100
+ readonly element: HTMLElement;
48
101
  /** The cells that make up this row. */
49
102
  private readonly _cells;
50
103
  /** The UI patterns for the cells in this row. */
@@ -52,34 +105,46 @@ declare class GridRow {
52
105
  /** The parent grid. */
53
106
  private readonly _grid;
54
107
  /** The parent grid UI pattern. */
55
- readonly grid: Signal<GridPattern>;
56
- /** The host native element. */
57
- readonly element: Signal<any>;
58
- /** The ARIA role for the row. */
59
- readonly role: _angular_core.InputSignal<"row" | "rowheader">;
108
+ readonly _gridPattern: Signal<GridPattern>;
60
109
  /** The index of this row within the grid. */
61
110
  readonly rowIndex: _angular_core.InputSignal<number | undefined>;
62
111
  /** The UI pattern for the grid row. */
63
112
  readonly _pattern: GridRowPattern;
64
113
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<GridRow, never>;
65
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridRow, "[ngGridRow]", ["ngGridRow"], { "role": { "alias": "role"; "required": false; "isSignal": true; }; "rowIndex": { "alias": "rowIndex"; "required": false; "isSignal": true; }; }, {}, ["_cells"], never, true, never>;
114
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridRow, "[ngGridRow]", ["ngGridRow"], { "rowIndex": { "alias": "rowIndex"; "required": false; "isSignal": true; }; }, {}, ["_cells"], never, true, never>;
66
115
  }
67
- /** A directive that represents a cell in a grid. */
116
+ /**
117
+ * Represents a cell within a grid row. It is the primary focusable element
118
+ * within the grid. It can be disabled and can have its selection state managed
119
+ * through the `selected` input.
120
+ *
121
+ * ```html
122
+ * <td ngGridCell [disabled]="isDisabled" [(selected)]="isSelected">
123
+ * Cell Content
124
+ * </td>
125
+ * ```
126
+ *
127
+ * @developerPreview 21.0
128
+ */
68
129
  declare class GridCell {
69
130
  /** A reference to the host element. */
70
131
  private readonly _elementRef;
71
- /** The widget contained within this cell, if any. */
132
+ /** A reference to the host element. */
133
+ readonly element: HTMLElement;
134
+ /** Whether the cell is currently active (focused). */
135
+ readonly active: Signal<boolean>;
136
+ /** The widgets contained within this cell, if any. */
72
137
  private readonly _widgets;
73
138
  /** The UI pattern for the widget in this cell. */
74
- private readonly _widgetPattern;
139
+ private readonly _widgetPatterns;
75
140
  /** The parent row. */
76
141
  private readonly _row;
142
+ /** Text direction. */
143
+ readonly textDirection: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
77
144
  /** A unique identifier for the cell. */
78
- private readonly _id;
79
- /** The host native element. */
80
- readonly element: Signal<any>;
145
+ readonly id: _angular_core.InputSignal<string>;
81
146
  /** The ARIA role for the cell. */
82
- readonly role: _angular_core.InputSignal<"gridcell" | "columnheader">;
147
+ readonly role: _angular_core.InputSignal<"gridcell" | "columnheader" | "rowheader">;
83
148
  /** The number of rows the cell should span. */
84
149
  readonly rowSpan: _angular_core.InputSignal<number>;
85
150
  /** The number of columns the cell should span. */
@@ -94,27 +159,80 @@ declare class GridCell {
94
159
  readonly selected: _angular_core.ModelSignal<boolean>;
95
160
  /** Whether the cell is selectable. */
96
161
  readonly selectable: _angular_core.InputSignal<boolean>;
162
+ /** Orientation of the widgets in the cell. */
163
+ readonly orientation: _angular_core.InputSignal<"vertical" | "horizontal">;
164
+ /** Whether widgets navigation wraps. */
165
+ readonly wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
166
+ /** The tabindex override. */
167
+ readonly tabindex: _angular_core.InputSignal<number | undefined>;
168
+ /**
169
+ * The tabindex value set to the element.
170
+ * If a focus target exists then return -1. Unless an override.
171
+ */
172
+ protected readonly _tabIndex: Signal<number>;
97
173
  /** The UI pattern for the grid cell. */
98
174
  readonly _pattern: GridCellPattern;
175
+ constructor();
176
+ /** Gets the cell widget pattern for a given element. */
177
+ private _getWidget;
99
178
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<GridCell, never>;
100
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridCell, "[ngGridCell]", ["ngGridCell"], { "role": { "alias": "role"; "required": false; "isSignal": true; }; "rowSpan": { "alias": "rowSpan"; "required": false; "isSignal": true; }; "colSpan": { "alias": "colSpan"; "required": false; "isSignal": true; }; "rowIndex": { "alias": "rowIndex"; "required": false; "isSignal": true; }; "colIndex": { "alias": "colIndex"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; }, ["_widgets"], never, true, never>;
179
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridCell, "[ngGridCell]", ["ngGridCell"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "role": { "alias": "role"; "required": false; "isSignal": true; }; "rowSpan": { "alias": "rowSpan"; "required": false; "isSignal": true; }; "colSpan": { "alias": "colSpan"; "required": false; "isSignal": true; }; "rowIndex": { "alias": "rowIndex"; "required": false; "isSignal": true; }; "colIndex": { "alias": "colIndex"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, { "selected": "selectedChange"; }, ["_widgets"], never, true, never>;
101
180
  }
102
- /** A directive that represents a widget inside a grid cell. */
181
+ /**
182
+ * Represents an interactive element inside a `GridCell`. It allows for pausing grid navigation to
183
+ * interact with the widget.
184
+ *
185
+ * When the user interacts with the widget (e.g., by typing in an input or opening a menu), grid
186
+ * navigation is temporarily suspended to allow the widget to handle keyboard
187
+ * events.
188
+ *
189
+ * ```html
190
+ * <td ngGridCell>
191
+ * <button ngGridCellWidget>Click Me</button>
192
+ * </td>
193
+ * ```
194
+ *
195
+ * @developerPreview 21.0
196
+ */
103
197
  declare class GridCellWidget {
104
198
  /** A reference to the host element. */
105
199
  private readonly _elementRef;
200
+ /** A reference to the host element. */
201
+ readonly element: HTMLElement;
202
+ /** Whether the widget is currently active (focused). */
203
+ readonly active: Signal<boolean>;
106
204
  /** The parent cell. */
107
205
  private readonly _cell;
108
- /** The host native element. */
109
- readonly element: Signal<any>;
110
- /** Whether the widget is activated and the grid navigation should be paused. */
111
- readonly activate: _angular_core.ModelSignal<boolean>;
206
+ /** A unique identifier for the widget. */
207
+ readonly id: _angular_core.InputSignal<string>;
208
+ /** The type of widget, which determines how it is activated. */
209
+ readonly widgetType: _angular_core.InputSignal<"simple" | "complex" | "editable">;
210
+ /** Whether the widget is disabled. */
211
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
212
+ /** The target that will receive focus instead of the widget. */
213
+ readonly focusTarget: _angular_core.InputSignal<ElementRef<any> | HTMLElement | undefined>;
214
+ /** Emits when the widget is activated. */
215
+ readonly onActivate: _angular_core.OutputEmitterRef<KeyboardEvent | FocusEvent | undefined>;
216
+ /** Emits when the widget is deactivated. */
217
+ readonly onDeactivate: _angular_core.OutputEmitterRef<KeyboardEvent | FocusEvent | undefined>;
218
+ /** The tabindex override. */
219
+ readonly tabindex: _angular_core.InputSignal<number | undefined>;
220
+ /**
221
+ * The tabindex value set to the element.
222
+ * If a focus target exists then return -1. Unless an override.
223
+ */
224
+ protected readonly _tabIndex: Signal<number>;
112
225
  /** The UI pattern for the grid cell widget. */
113
226
  readonly _pattern: GridCellWidgetPattern;
114
- /** Focuses the widget. */
115
- focus(): void;
227
+ /** Whether the widget is activated. */
228
+ get isActivated(): Signal<boolean>;
229
+ constructor();
230
+ /** Activates the widget. */
231
+ activate(): void;
232
+ /** Deactivates the widget. */
233
+ deactivate(): void;
116
234
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<GridCellWidget, never>;
117
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridCellWidget, "[ngGridCellWidget]", ["ngGridCellWidget"], { "activate": { "alias": "activate"; "required": false; "isSignal": true; }; }, { "activate": "activateChange"; }, never, never, true, never>;
235
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridCellWidget, "[ngGridCellWidget]", ["ngGridCellWidget"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "widgetType": { "alias": "widgetType"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "focusTarget": { "alias": "focusTarget"; "required": false; "isSignal": true; }; "tabindex": { "alias": "tabindex"; "required": false; "isSignal": true; }; }, { "onActivate": "onActivate"; "onDeactivate": "onDeactivate"; }, never, never, true, never>;
118
236
  }
119
237
 
120
238
  export { Grid, GridCell, GridCellWidget, GridRow };
@@ -4,28 +4,33 @@ import { OptionPattern, ListboxPattern } from '@angular/aria/private';
4
4
  import { ComboboxPopup } from './combobox.js';
5
5
 
6
6
  /**
7
- * A listbox container.
7
+ * Represents a container used to display a list of items for a user to select from.
8
8
  *
9
- * Listboxes are used to display a list of items for a user to select from. The Listbox is meant
10
- * to be used in conjunction with Option as follows:
9
+ * The `ngListbox` is meant to be used in conjunction with `ngOption` directives to create a
10
+ * selectable list. It supports single and multiple selection modes, as well as various focus and
11
+ * orientation strategies.
11
12
  *
12
13
  * ```html
13
- * <ul ngListbox>
14
- * <li [value]="1" ngOption>Item 1</li>
15
- * <li [value]="2" ngOption>Item 2</li>
16
- * <li [value]="3" ngOption>Item 3</li>
14
+ * <ul ngListbox [(value)]="selectedItems" [multi]="true" orientation="vertical">
15
+ * @for (item of items; track item.id) {
16
+ * <li ngOption [value]="item.id" [label]="item.name" [disabled]="item.disabled">
17
+ * {{item.name}}
18
+ * </li>
19
+ * }
17
20
  * </ul>
18
21
  * ```
22
+ *
23
+ * @developerPreview 21.0
19
24
  */
20
25
  declare class Listbox<V> {
21
26
  /** A unique identifier for the listbox. */
22
- private readonly _generatedId;
23
- /** A unique identifier for the listbox. */
24
- protected id: _angular_core.Signal<string>;
27
+ readonly id: _angular_core.InputSignal<string>;
25
28
  /** A reference to the parent combobox popup, if one exists. */
26
29
  private readonly _popup;
27
- /** A reference to the listbox element. */
30
+ /** A reference to the host element. */
28
31
  private readonly _elementRef;
32
+ /** A reference to the host element. */
33
+ readonly element: HTMLElement;
29
34
  /** The directionality (LTR / RTL) context for the application (or a subtree of it). */
30
35
  private readonly _directionality;
31
36
  /** The Options nested inside of the Listbox. */
@@ -40,11 +45,22 @@ declare class Listbox<V> {
40
45
  multi: _angular_core.InputSignalWithTransform<boolean, unknown>;
41
46
  /** Whether focus should wrap when navigating. */
42
47
  wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
43
- /** Whether to allow disabled items in the list to receive focus. */
48
+ /**
49
+ * Whether to allow disabled items to receive focus. When `true`, disabled items are
50
+ * focusable but not interactive. When `false`, disabled items are skipped during navigation.
51
+ */
44
52
  softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
45
- /** The focus strategy used by the list. */
53
+ /**
54
+ * The focus strategy used by the list.
55
+ * - `roving`: Focus is moved to the active item using `tabindex`.
56
+ * - `activedescendant`: Focus remains on the listbox container, and `aria-activedescendant` is used to indicate the active item.
57
+ */
46
58
  focusMode: _angular_core.InputSignal<"roving" | "activedescendant">;
47
- /** The selection strategy used by the list. */
59
+ /**
60
+ * The selection strategy used by the list.
61
+ * - `follow`: The focused item is automatically selected.
62
+ * - `explicit`: Items are selected explicitly by the user (e.g., via click or spacebar).
63
+ */
48
64
  selectionMode: _angular_core.InputSignal<"follow" | "explicit">;
49
65
  /** The amount of time before the typeahead search is reset. */
50
66
  typeaheadDelay: _angular_core.InputSignal<number>;
@@ -52,34 +68,50 @@ declare class Listbox<V> {
52
68
  disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
53
69
  /** Whether the listbox is readonly. */
54
70
  readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
55
- /** The values of the current selected items. */
56
- value: _angular_core.ModelSignal<V[]>;
71
+ /** The values of the currently selected items. */
72
+ values: _angular_core.ModelSignal<V[]>;
57
73
  /** The Listbox UIPattern. */
58
74
  readonly _pattern: ListboxPattern<V>;
59
75
  /** Whether the listbox has received focus yet. */
60
76
  private _hasFocused;
61
77
  constructor();
62
- onFocus(): void;
78
+ _onFocus(): void;
63
79
  scrollActiveItemIntoView(options?: ScrollIntoViewOptions): void;
80
+ /** Navigates to the first item in the listbox. */
81
+ gotoFirst(): void;
64
82
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Listbox<any>, never>;
65
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Listbox<any>, "[ngListbox]", ["ngListbox"], { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "multi": { "alias": "multi"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "focusMode": { "alias": "focusMode"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, ["_options"], never, true, [{ directive: typeof ComboboxPopup; inputs: {}; outputs: {}; }]>;
83
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Listbox<any>, "[ngListbox]", ["ngListbox"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "multi": { "alias": "multi"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "focusMode": { "alias": "focusMode"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "values": { "alias": "values"; "required": false; "isSignal": true; }; }, { "values": "valuesChange"; }, ["_options"], never, true, [{ directive: typeof ComboboxPopup; inputs: {}; outputs: {}; }]>;
66
84
  }
67
- /** A selectable option in a Listbox. */
85
+ /**
86
+ * A selectable option in an `ngListbox`.
87
+ *
88
+ * This directive should be applied to an element (e.g., `<li>`, `<div>`) within an
89
+ * `ngListbox`. The `value` input is used to identify the option, and the `label` input provides
90
+ * the accessible name for the option.
91
+ *
92
+ * ```html
93
+ * <li ngOption value="item-id" label="Item Name">
94
+ * Item Name
95
+ * </li>
96
+ * ```
97
+ *
98
+ * @developerPreview 21.0
99
+ */
68
100
  declare class Option<V> {
69
- /** A reference to the option element. */
101
+ /** A reference to the host element. */
70
102
  private readonly _elementRef;
103
+ /** A reference to the host element. */
104
+ readonly element: HTMLElement;
105
+ /** Whether the option is currently active (focused). */
106
+ active: _angular_core.Signal<boolean>;
71
107
  /** The parent Listbox. */
72
108
  private readonly _listbox;
73
109
  /** A unique identifier for the option. */
74
- private readonly _generatedId;
75
- /** A unique identifier for the option. */
76
- protected id: _angular_core.Signal<string>;
110
+ readonly id: _angular_core.InputSignal<string>;
77
111
  /** The text used by the typeahead search. */
78
- protected searchTerm: _angular_core.Signal<any>;
112
+ protected searchTerm: _angular_core.Signal<string>;
79
113
  /** The parent Listbox UIPattern. */
80
- protected listbox: _angular_core.Signal<ListboxPattern<any>>;
81
- /** A reference to the option element to be focused on navigation. */
82
- protected element: _angular_core.Signal<any>;
114
+ private readonly _listboxPattern;
83
115
  /** The value of the option. */
84
116
  value: _angular_core.InputSignal<V>;
85
117
  /** Whether an item is disabled. */
@@ -91,7 +123,7 @@ declare class Option<V> {
91
123
  /** The Option UIPattern. */
92
124
  readonly _pattern: OptionPattern<V>;
93
125
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Option<any>, never>;
94
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Option<any>, "[ngOption]", ["ngOption"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
126
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Option<any>, "[ngOption]", ["ngOption"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
95
127
  }
96
128
 
97
129
  export { Listbox, Option };