@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
package/types/menu.d.ts CHANGED
@@ -2,48 +2,76 @@ import * as _angular_core from '@angular/core';
2
2
  import { Signal } 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 { MenuTriggerPattern, MenuPattern, MenuItemPattern, SignalLike, MenuBarPattern } from '@angular/aria/private';
5
+ import { MenuTriggerPattern, MenuPattern, SignalLike, MenuBarPattern, MenuItemPattern } from '@angular/aria/private';
6
6
 
7
7
  /**
8
8
  * A trigger for a menu.
9
9
  *
10
- * The menu trigger is used to open and close menus, and can be placed on menu items to connect
11
- * sub-menus.
10
+ * The `ngMenuTrigger` directive is used to open and close menus. It can be applied to
11
+ * any interactive element (e.g., a button) to associate it with a `ngMenu` instance.
12
+ * It also supports linking to sub-menus when applied to a `ngMenuItem`.
13
+ *
14
+ * ```html
15
+ * <button ngMenuTrigger [menu]="myMenu">Open Menu</button>
16
+ *
17
+ * <div ngMenu #myMenu="ngMenu">
18
+ * <div ngMenuItem>Item 1</div>
19
+ * <div ngMenuItem>Item 2</div>
20
+ * </div>
21
+ * ```
22
+ *
23
+ * @developerPreview 21.0
12
24
  */
13
25
  declare class MenuTrigger<V> {
14
- /** A reference to the menu trigger element. */
26
+ /** A reference to the host element. */
15
27
  private readonly _elementRef;
28
+ /** A reference to the host element. */
29
+ readonly element: HTMLElement;
16
30
  /** The directionality (LTR / RTL) context for the application (or a subtree of it). */
17
31
  readonly textDirection: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
18
- /** A reference to the menu element. */
19
- readonly element: HTMLButtonElement;
20
32
  /** The menu associated with the trigger. */
21
33
  menu: _angular_core.InputSignal<Menu<V> | undefined>;
22
- /** Whether the menu item has been focused. */
23
- readonly hasBeenFocused: _angular_core.WritableSignal<boolean>;
34
+ /** Whether the menu is expanded. */
35
+ readonly expanded: Signal<boolean>;
36
+ /** Whether the menu trigger has a popup. */
37
+ readonly hasPopup: Signal<boolean>;
38
+ /** Whether the menu trigger is disabled. */
39
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
40
+ /** Whether the menu trigger is soft disabled. */
41
+ readonly softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
24
42
  /** The menu trigger ui pattern instance. */
25
43
  _pattern: MenuTriggerPattern<V>;
26
44
  constructor();
27
- /** Marks the menu trigger as having been focused. */
28
- onFocusIn(): void;
45
+ /** Opens the menu focusing on the first menu item. */
46
+ open(): void;
47
+ /** Closes the menu. */
48
+ close(): void;
29
49
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MenuTrigger<any>, never>;
30
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MenuTrigger<any>, "button[ngMenuTrigger]", ["ngMenuTrigger"], { "menu": { "alias": "menu"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
50
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MenuTrigger<any>, "button[ngMenuTrigger]", ["ngMenuTrigger"], { "menu": { "alias": "menu"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
31
51
  }
32
52
  /**
33
53
  * A list of menu items.
34
54
  *
35
- * A menu is used to offer a list of menu item choices to users. Menus can be nested within other
36
- * menus to create sub-menus.
55
+ * A `ngMenu` is used to offer a list of menu item choices to users. Menus can be nested
56
+ * within other menus to create sub-menus. It works in conjunction with `ngMenuTrigger`
57
+ * and `ngMenuItem` directives.
37
58
  *
38
59
  * ```html
39
- * <button ngMenuTrigger menu="menu">Options</button>
60
+ * <button ngMenuTrigger [menu]="myMenu">Options</button>
40
61
  *
41
- * <div ngMenu #menu="ngMenu">
62
+ * <div ngMenu #myMenu="ngMenu">
42
63
  * <div ngMenuItem>Star</div>
43
64
  * <div ngMenuItem>Edit</div>
44
- * <div ngMenuItem>Delete</div>
65
+ * <div ngMenuItem [submenu]="subMenu">More</div>
66
+ * </div>
67
+ *
68
+ * <div ngMenu #subMenu="ngMenu">
69
+ * <div ngMenuItem>Sub Item 1</div>
70
+ * <div ngMenuItem>Sub Item 2</div>
45
71
  * </div>
46
72
  * ```
73
+ *
74
+ * @developerPreview 21.0
47
75
  */
48
76
  declare class Menu<V> {
49
77
  /** The DeferredContentAware host directive. */
@@ -52,18 +80,20 @@ declare class Menu<V> {
52
80
  readonly _allItems: Signal<readonly MenuItem<V>[]>;
53
81
  /** The menu items that are direct children of this menu. */
54
82
  readonly _items: Signal<MenuItem<V>[]>;
55
- /** A reference to the menu element. */
83
+ /** A reference to the host element. */
56
84
  private readonly _elementRef;
57
- /** A reference to the menu element. */
85
+ /** A reference to the host element. */
58
86
  readonly element: HTMLElement;
59
87
  /** The directionality (LTR / RTL) context for the application (or a subtree of it). */
60
88
  readonly textDirection: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
61
89
  /** The unique ID of the menu. */
62
90
  readonly id: _angular_core.InputSignal<string>;
63
91
  /** Whether the menu should wrap its items. */
64
- readonly wrap: _angular_core.InputSignal<boolean>;
65
- /** The delay in seconds before the typeahead buffer is cleared. */
92
+ readonly wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
93
+ /** The delay in milliseconds before the typeahead buffer is cleared. */
66
94
  readonly typeaheadDelay: _angular_core.InputSignal<number>;
95
+ /** Whether the menu is disabled. */
96
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
67
97
  /** A reference to the parent menu item or menu trigger. */
68
98
  readonly parent: _angular_core.WritableSignal<MenuTrigger<V> | MenuItem<V> | undefined>;
69
99
  /** The menu ui pattern instance. */
@@ -75,65 +105,97 @@ declare class Menu<V> {
75
105
  * sometimes the items array is empty. The bug can be reproduced by switching this to use a
76
106
  * computed and then quickly opening and closing menus in the dev app.
77
107
  */
78
- readonly items: () => MenuItemPattern<V>[];
108
+ private readonly _itemPatterns;
79
109
  /** Whether the menu is visible. */
80
- isVisible: Signal<boolean>;
110
+ readonly visible: Signal<boolean>;
111
+ /** The tab index of the menu. */
112
+ readonly tabIndex: Signal<0 | -1>;
81
113
  /** A callback function triggered when a menu item is selected. */
82
114
  onSelect: _angular_core.OutputEmitterRef<V>;
115
+ /** The delay in milliseconds before expanding sub-menus on hover. */
116
+ readonly expansionDelay: _angular_core.InputSignal<number>;
83
117
  constructor();
84
118
  /** Closes the menu. */
85
- close(opts?: {
86
- refocus?: boolean;
87
- }): void;
88
- /** Closes all parent menus. */
89
- closeAll(opts?: {
90
- refocus?: boolean;
91
- }): void;
119
+ close(): void;
92
120
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Menu<any>, never>;
93
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Menu<any>, "[ngMenu]", ["ngMenu"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; }, { "onSelect": "onSelect"; }, ["_allItems"], never, true, [{ directive: typeof i1.DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
121
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Menu<any>, "[ngMenu]", ["ngMenu"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "expansionDelay": { "alias": "expansionDelay"; "required": false; "isSignal": true; }; }, { "onSelect": "onSelect"; }, ["_allItems"], never, true, [{ directive: typeof i1.DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
94
122
  }
95
123
  /**
96
124
  * A menu bar of menu items.
97
125
  *
98
- * Like the menu, a menubar is used to offer a list of menu item choices to users. However, a
99
- * menubar is used to display a persistent, top-level,
100
- * always-visible set of menu item choices.
126
+ * Like the `ngMenu`, a `ngMenuBar` is used to offer a list of menu item choices to users.
127
+ * However, a menubar is used to display a persistent, top-level, always-visible set of
128
+ * menu item choices, typically found at the top of an application window.
129
+ *
130
+ * ```html
131
+ * <div ngMenuBar>
132
+ * <button ngMenuTrigger [menu]="fileMenu">File</button>
133
+ * <button ngMenuTrigger [menu]="editMenu">Edit</button>
134
+ * </div>
135
+ *
136
+ * <div ngMenu #fileMenu="ngMenu">
137
+ * <div ngMenuItem>New</div>
138
+ * <div ngMenuItem>Open</div>
139
+ * </div>
140
+ *
141
+ * <div ngMenu #editMenu="ngMenu">
142
+ * <div ngMenuItem>Cut</div>
143
+ * <div ngMenuItem>Copy</div>
144
+ * </div>
145
+ * ```
146
+ *
147
+ * @developerPreview 21.0
101
148
  */
102
149
  declare class MenuBar<V> {
103
150
  /** The menu items contained in the menubar. */
104
151
  readonly _allItems: Signal<readonly MenuItem<V>[]>;
105
152
  readonly _items: SignalLike<MenuItem<V>[]>;
106
- /** A reference to the menu element. */
153
+ /** A reference to the host element. */
107
154
  private readonly _elementRef;
108
- /** A reference to the menubar element. */
155
+ /** A reference to the host element. */
109
156
  readonly element: HTMLElement;
157
+ /** Whether the menubar is disabled. */
158
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
159
+ /** Whether the menubar is soft disabled. */
160
+ readonly softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
110
161
  /** The directionality (LTR / RTL) context for the application (or a subtree of it). */
111
162
  readonly textDirection: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
112
- /** The value of the menu. */
113
- readonly value: _angular_core.ModelSignal<V[]>;
163
+ /** The values of the currently selected menu items. */
164
+ readonly values: _angular_core.ModelSignal<V[]>;
114
165
  /** Whether the menu should wrap its items. */
115
- readonly wrap: _angular_core.InputSignal<boolean>;
116
- /** The delay in seconds before the typeahead buffer is cleared. */
166
+ readonly wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
167
+ /** The delay in milliseconds before the typeahead buffer is cleared. */
117
168
  readonly typeaheadDelay: _angular_core.InputSignal<number>;
118
169
  /** The menu ui pattern instance. */
119
170
  readonly _pattern: MenuBarPattern<V>;
120
171
  /** The menu items as a writable signal. */
121
- readonly items: _angular_core.WritableSignal<MenuItemPattern<V>[]>;
172
+ private readonly _itemPatterns;
122
173
  /** A callback function triggered when a menu item is selected. */
123
174
  onSelect: _angular_core.OutputEmitterRef<V>;
124
175
  constructor();
176
+ /** Closes the menubar. */
177
+ close(): void;
125
178
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MenuBar<any>, never>;
126
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MenuBar<any>, "[ngMenuBar]", ["ngMenuBar"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "onSelect": "onSelect"; }, ["_allItems"], never, true, never>;
179
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MenuBar<any>, "[ngMenuBar]", ["ngMenuBar"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "values": { "alias": "values"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; }, { "values": "valuesChange"; "onSelect": "onSelect"; }, ["_allItems"], never, true, never>;
127
180
  }
128
181
  /**
129
182
  * An item in a Menu.
130
183
  *
131
- * Menu items can be used in menus and menubars to represent a choice or action a user can take.
184
+ * `ngMenuItem` directives can be used in `ngMenu` and `ngMenuBar` to represent a choice
185
+ * or action a user can take. They can also act as triggers for sub-menus.
186
+ *
187
+ * ```html
188
+ * <div ngMenuItem (onSelect)="doAction()">Action Item</div>
189
+ *
190
+ * <div ngMenuItem [submenu]="anotherMenu">Submenu Trigger</div>
191
+ * ```
192
+ *
193
+ * @developerPreview 21.0
132
194
  */
133
195
  declare class MenuItem<V> {
134
- /** A reference to the menu item element. */
196
+ /** A reference to the host element. */
135
197
  private readonly _elementRef;
136
- /** A reference to the menu element. */
198
+ /** A reference to the host element. */
137
199
  readonly element: HTMLElement;
138
200
  /** The unique ID of the menu item. */
139
201
  readonly id: _angular_core.InputSignal<string>;
@@ -151,17 +213,39 @@ declare class MenuItem<V> {
151
213
  readonly parent: Menu<V> | MenuBar<V> | null;
152
214
  /** The submenu associated with the menu item. */
153
215
  readonly submenu: _angular_core.InputSignal<Menu<V> | undefined>;
154
- /** Whether the menu item has been focused. */
155
- readonly hasBeenFocused: _angular_core.WritableSignal<boolean>;
216
+ /** Whether the menu item is active. */
217
+ readonly active: Signal<boolean>;
218
+ /** Whether the menu is expanded. */
219
+ readonly expanded: Signal<boolean | null>;
220
+ /** Whether the menu item has a popup. */
221
+ readonly hasPopup: Signal<boolean>;
156
222
  /** The menu item ui pattern instance. */
157
223
  readonly _pattern: MenuItemPattern<V>;
158
224
  constructor();
159
- /** Marks the menu item as having been focused. */
160
- onFocusIn(): void;
225
+ /** Opens the submenu focusing on the first menu item. */
226
+ open(): void;
227
+ /** Closes the submenu. */
228
+ close(): void;
161
229
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MenuItem<any>, never>;
162
230
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MenuItem<any>, "[ngMenuItem]", ["ngMenuItem"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "searchTerm": { "alias": "searchTerm"; "required": false; "isSignal": true; }; "submenu": { "alias": "submenu"; "required": false; "isSignal": true; }; }, { "searchTerm": "searchTermChange"; }, never, never, true, never>;
163
231
  }
164
- /** Defers the rendering of the menu content. */
232
+ /**
233
+ * Defers the rendering of the menu content.
234
+ *
235
+ * This structural directive should be applied to an `ng-template` within a `ngMenu`
236
+ * or `ngMenuBar` to lazily render its content only when the menu is opened.
237
+ *
238
+ * ```html
239
+ * <div ngMenu #myMenu="ngMenu">
240
+ * <ng-template ngMenuContent>
241
+ * <div ngMenuItem>Lazy Item 1</div>
242
+ * <div ngMenuItem>Lazy Item 2</div>
243
+ * </ng-template>
244
+ * </div>
245
+ * ```
246
+ *
247
+ * @developerPreview 21.0
248
+ */
165
249
  declare class MenuContent {
166
250
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MenuContent, never>;
167
251
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MenuContent, "ng-template[ngMenuContent]", ["ngMenuContent"], {}, {}, never, never, true, [{ directive: typeof i1.DeferredContent; inputs: {}; outputs: {}; }]>;