@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
@@ -15,24 +15,49 @@ interface ListboxHarnessFilters extends BaseHarnessFilters {
15
15
  disabled?: boolean;
16
16
  }
17
17
 
18
+ /** Harness for interacting with a standard ngOption in tests. */
18
19
  declare class ListboxOptionHarness extends ComponentHarness {
19
20
  static hostSelector: string;
21
+ /**
22
+ * Gets a `HarnessPredicate` that can be used to search for an option
23
+ * with specific attributes.
24
+ * @param options Options for filtering which option instances are considered a match.
25
+ * @return a `HarnessPredicate` configured with the given options.
26
+ */
20
27
  static with(options?: ListboxOptionHarnessFilters): HarnessPredicate<ListboxOptionHarness>;
28
+ /** Whether the option is selected. */
21
29
  isSelected(): Promise<boolean>;
30
+ /** Whether the option is disabled. */
22
31
  isDisabled(): Promise<boolean>;
32
+ /** Gets the option's text. */
23
33
  getText(): Promise<string>;
34
+ /** Clicks the option to toggle its selected state. */
24
35
  click(): Promise<void>;
25
36
  }
37
+ /** Harness for interacting with a standard ngListbox in tests. */
26
38
  declare class ListboxHarness extends ComponentHarness {
27
39
  static hostSelector: string;
40
+ /**
41
+ * Gets a `HarnessPredicate` that can be used to search for a listbox
42
+ * with specific attributes.
43
+ * @param options Options for filtering which listbox instances are considered a match.
44
+ * @return a `HarnessPredicate` configured with the given options.
45
+ */
28
46
  static with(options?: ListboxHarnessFilters): HarnessPredicate<ListboxHarness>;
47
+ /** Gets the orientation of the listbox. */
29
48
  getOrientation(): Promise<'vertical' | 'horizontal'>;
49
+ /** Whether the listbox is multiselectable. */
30
50
  isMulti(): Promise<boolean>;
51
+ /** Whether the listbox is disabled. */
31
52
  isDisabled(): Promise<boolean>;
53
+ /** Gets the options inside the listbox. */
32
54
  getOptions(filters?: ListboxOptionHarnessFilters): Promise<ListboxOptionHarness[]>;
55
+ /** Focuses the listbox container. */
33
56
  focus(): Promise<void>;
34
57
  /** Blurs the listbox container. */
35
58
  blur(): Promise<void>;
59
+ /** Gets the ID of the active option. */
60
+ getActiveDescendantId(): Promise<string | null>;
36
61
  }
37
62
 
38
63
  export { ListboxHarness, ListboxOptionHarness };
@@ -1,16 +1,59 @@
1
1
  import * as _angular_cdk_bidi from '@angular/cdk/bidi';
2
2
  import * as _angular_core from '@angular/core';
3
+ import { OnInit, OnDestroy, Signal } from '@angular/core';
3
4
  import { OptionPattern, ListboxPattern } from './_listbox-chunk.js';
4
- import { ComboboxPopup } from './combobox.js';
5
- export { Combobox as ɵɵCombobox, ComboboxDialog as ɵɵComboboxDialog, ComboboxInput as ɵɵComboboxInput, ComboboxPopupContainer as ɵɵComboboxPopupContainer } from './combobox.js';
6
- import './_signal-like-chunk.js';
5
+ import { SortedCollection } from './_collection-chunk.js';
7
6
  import './_list-chunk.js';
8
7
  import './_list-navigation-chunk.js';
9
8
  import './_keyboard-event-manager-chunk.js';
10
9
  import './_click-event-manager-chunk.js';
11
- import './_combobox-chunk.js';
12
- import './_pointer-event-manager-chunk.js';
13
- import './_deferred-content-chunk.js';
10
+
11
+ /**
12
+ * A selectable option in an `ngListbox`.
13
+ *
14
+ * This directive should be applied to an element (e.g., `<li>`, `<div>`) within an
15
+ * `ngListbox`. The `value` input is used to identify the option, and the `label` input provides
16
+ * the accessible name for the option.
17
+ *
18
+ * ```html
19
+ * <li ngOption value="item-id" label="Item Name">
20
+ * Item Name
21
+ * </li>
22
+ * ```
23
+ *
24
+ * @developerPreview 21.0
25
+ *
26
+ * @see [Listbox](guide/aria/listbox)
27
+ * @see [Autocomplete](guide/aria/autocomplete)
28
+ * @see [Select](guide/aria/select)
29
+ * @see [Multiselect](guide/aria/multiselect)
30
+ */
31
+ declare class Option<V> implements OnInit, OnDestroy {
32
+ /** A reference to the host element. */
33
+ readonly element: HTMLElement;
34
+ /** Whether the option is currently active (focused). */
35
+ readonly active: _angular_core.Signal<boolean>;
36
+ /** The parent Listbox. */
37
+ private readonly _listbox;
38
+ /** A unique identifier for the option. */
39
+ readonly id: _angular_core.InputSignal<string>;
40
+ /** The parent Listbox UIPattern. */
41
+ private readonly _listboxPattern;
42
+ /** The value of the option. */
43
+ readonly value: _angular_core.InputSignal<V>;
44
+ /** Whether an item is disabled. */
45
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
46
+ /** The text used by the typeahead search. */
47
+ readonly label: _angular_core.InputSignal<string | undefined>;
48
+ /** Whether the option is selected. */
49
+ readonly selected: _angular_core.Signal<boolean | undefined>;
50
+ /** The Option UIPattern. */
51
+ readonly _pattern: OptionPattern<V>;
52
+ ngOnInit(): void;
53
+ ngOnDestroy(): void;
54
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Option<any>, never>;
55
+ 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>;
56
+ }
14
57
 
15
58
  /**
16
59
  * Represents a container used to display a list of items for a user to select from.
@@ -36,21 +79,17 @@ import './_deferred-content-chunk.js';
36
79
  * @see [Select](guide/aria/select)
37
80
  * @see [Multiselect](guide/aria/multiselect)
38
81
  */
39
- declare class Listbox<V> {
82
+ declare class Listbox<V> implements OnDestroy {
40
83
  /** A unique identifier for the listbox. */
41
84
  readonly id: _angular_core.InputSignal<string>;
42
- /** A reference to the parent combobox popup, if one exists. */
43
- private readonly _popup;
44
85
  /** A reference to the host element. */
45
86
  private readonly _elementRef;
46
87
  /** A reference to the host element. */
47
88
  readonly element: HTMLElement;
48
- /** The Options nested inside of the Listbox. */
49
- private readonly _options;
89
+ /** The collection of Options. */
90
+ readonly _collection: SortedCollection<Option<V>>;
50
91
  /** A signal wrapper for directionality. */
51
- protected readonly textDirection: _angular_core.Signal<_angular_cdk_bidi.Direction>;
52
- /** The Option UIPatterns of the child Options. */
53
- protected readonly items: _angular_core.Signal<OptionPattern<V>[]>;
92
+ protected readonly textDirection: Signal<_angular_cdk_bidi.Direction>;
54
93
  /** Whether the list is vertically or horizontally oriented. */
55
94
  readonly orientation: _angular_core.InputSignal<"vertical" | "horizontal">;
56
95
  /** Whether multiple items in the list can be selected at once. */
@@ -80,63 +119,21 @@ declare class Listbox<V> {
80
119
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
81
120
  /** Whether the listbox is readonly. */
82
121
  readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
122
+ /** The tabindex of the listbox. */
123
+ readonly tabIndex: _angular_core.InputSignalWithTransform<number | undefined, string | number | undefined>;
83
124
  /** The values of the currently selected items. */
84
125
  readonly value: _angular_core.ModelSignal<V[]>;
85
126
  /** The Listbox UIPattern. */
86
127
  readonly _pattern: ListboxPattern<V>;
128
+ /** The ID of the active descendant in the listbox. */
129
+ readonly activeDescendant: Signal<string | undefined>;
87
130
  constructor();
131
+ ngOnDestroy(): void;
88
132
  scrollActiveItemIntoView(options?: ScrollIntoViewOptions): void;
89
133
  /** Navigates to the first item in the listbox. */
90
134
  gotoFirst(): void;
91
135
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Listbox<any>, never>;
92
- 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; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, ["_options"], never, true, [{ directive: typeof ComboboxPopup; inputs: {}; outputs: {}; }]>;
93
- }
94
-
95
- /**
96
- * A selectable option in an `ngListbox`.
97
- *
98
- * This directive should be applied to an element (e.g., `<li>`, `<div>`) within an
99
- * `ngListbox`. The `value` input is used to identify the option, and the `label` input provides
100
- * the accessible name for the option.
101
- *
102
- * ```html
103
- * <li ngOption value="item-id" label="Item Name">
104
- * Item Name
105
- * </li>
106
- * ```
107
- *
108
- * @developerPreview 21.0
109
- *
110
- * @see [Listbox](guide/aria/listbox)
111
- * @see [Autocomplete](guide/aria/autocomplete)
112
- * @see [Select](guide/aria/select)
113
- * @see [Multiselect](guide/aria/multiselect)
114
- */
115
- declare class Option<V> {
116
- /** A reference to the host element. */
117
- readonly element: HTMLElement;
118
- /** Whether the option is currently active (focused). */
119
- readonly active: _angular_core.Signal<boolean>;
120
- /** The parent Listbox. */
121
- private readonly _listbox;
122
- /** A unique identifier for the option. */
123
- readonly id: _angular_core.InputSignal<string>;
124
- /** The text used by the typeahead search. */
125
- protected readonly searchTerm: _angular_core.Signal<string>;
126
- /** The parent Listbox UIPattern. */
127
- private readonly _listboxPattern;
128
- /** The value of the option. */
129
- readonly value: _angular_core.InputSignal<V>;
130
- /** Whether an item is disabled. */
131
- readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
132
- /** The text used by the typeahead search. */
133
- readonly label: _angular_core.InputSignal<string | undefined>;
134
- /** Whether the option is selected. */
135
- readonly selected: _angular_core.Signal<boolean | undefined>;
136
- /** The Option UIPattern. */
137
- readonly _pattern: OptionPattern<V>;
138
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<Option<any>, never>;
139
- 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>;
136
+ 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; }; "tabIndex": { "alias": "tabindex"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
140
137
  }
141
138
 
142
- export { Listbox, Option, ComboboxPopup as ɵɵComboboxPopup };
139
+ export { Listbox, Option };
@@ -29,6 +29,10 @@ declare class MenuItemHarness extends ComponentHarness {
29
29
  click(): Promise<void>;
30
30
  /** Resolves the nested submenu panel associated with this menu item, if any exists. */
31
31
  getSubmenu(): Promise<MenuHarness | null>;
32
+ /** Whether the menu item has focus. */
33
+ isFocused(): Promise<boolean>;
34
+ /** Whether the menu item acts as a submenu trigger. */
35
+ hasSubmenu(): Promise<boolean>;
32
36
  }
33
37
  /** Harness for interacting with a standard ngMenu or ngMenuBar in tests. */
34
38
  declare class MenuHarness extends ComponentHarness {
@@ -38,6 +42,8 @@ declare class MenuHarness extends ComponentHarness {
38
42
  _getTrigger(): Promise<TestElement | null>;
39
43
  /** Checks whether the menu container is visible. */
40
44
  isOpen(): Promise<boolean>;
45
+ /** Whether the menu is a menu bar. */
46
+ isMenuBar(): Promise<boolean>;
41
47
  /** Opens the menu if it is currently closed. */
42
48
  open(): Promise<void>;
43
49
  /** Closes the menu if it is currently open. */
package/types/menu.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { Signal } from '@angular/core';
2
+ import { OnDestroy, OnInit, Signal } from '@angular/core';
3
3
  import * as _angular_cdk_bidi from '@angular/cdk/bidi';
4
4
  import { MenuBarPattern, MenuItemPattern, MenuPattern, MenuTriggerPattern } from './_menu-chunk.js';
5
5
  import { DeferredContentAware, DeferredContent } from './_deferred-content-chunk.js';
6
- import { SignalLike } from './_signal-like-chunk.js';
6
+ import { SortedCollection, SignalLike } from './_collection-chunk.js';
7
7
  import './_keyboard-event-manager-chunk.js';
8
8
  import './_list-chunk.js';
9
9
  import './_list-navigation-chunk.js';
@@ -37,9 +37,9 @@ import './_list-navigation-chunk.js';
37
37
  * @see [Menu](guide/aria/menu)
38
38
  * @see [MenuBar](guide/aria/menubar)
39
39
  */
40
- declare class MenuBar<V> {
41
- /** The menu items contained in the menubar. */
42
- readonly _allItems: _angular_core.Signal<readonly MenuItem<V>[]>;
40
+ declare class MenuBar<V> implements OnDestroy {
41
+ /** The collection of menu items. */
42
+ readonly _collection: SortedCollection<MenuItem<V>>;
43
43
  readonly _items: SignalLike<MenuItem<V>[]>;
44
44
  /** A reference to the host element. */
45
45
  private readonly _elementRef;
@@ -64,10 +64,11 @@ declare class MenuBar<V> {
64
64
  /** A callback function triggered when a menu item is selected. */
65
65
  readonly itemSelected: _angular_core.OutputEmitterRef<V>;
66
66
  constructor();
67
+ ngOnDestroy(): void;
67
68
  /** Closes the menubar. */
68
69
  close(): void;
69
70
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<MenuBar<any>, never>;
70
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MenuBar<any>, "[ngMenuBar]", ["ngMenuBar"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "itemSelected": "itemSelected"; }, ["_allItems"], never, true, never>;
71
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<MenuBar<any>, "[ngMenuBar]", ["ngMenuBar"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; "typeaheadDelay": { "alias": "typeaheadDelay"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "itemSelected": "itemSelected"; }, never, never, true, never>;
71
72
  }
72
73
 
73
74
  /**
@@ -78,7 +79,7 @@ declare class MenuBar<V> {
78
79
  *
79
80
  * ```html
80
81
  * <div ngMenu (itemSelected)="doAction()">
81
- * <div ngMenuItem >Action Item</div>
82
+ * <div ngMenuItem>Action Item</div>
82
83
  * <div ngMenuItem [submenu]="anotherMenu">Submenu Trigger</div>
83
84
  * </div>
84
85
  * ```
@@ -88,14 +89,14 @@ declare class MenuBar<V> {
88
89
  * @see [Menu](guide/aria/menu)
89
90
  * @see [MenuBar](guide/aria/menubar)
90
91
  */
91
- declare class MenuItem<V> {
92
+ declare class MenuItem<V> implements OnInit, OnDestroy {
92
93
  /** A reference to the host element. */
93
94
  private readonly _elementRef;
94
95
  /** A reference to the host element. */
95
96
  readonly element: HTMLElement;
96
97
  /** The unique ID of the menu item. */
97
98
  readonly id: _angular_core.InputSignal<string>;
98
- /** The value of the menu item, used as the default aria-label */
99
+ /** The value of the menu item. */
99
100
  readonly value: _angular_core.InputSignal<V>;
100
101
  /** Whether the menu item is disabled. */
101
102
  readonly disabled: _angular_core.InputSignal<boolean>;
@@ -114,6 +115,8 @@ declare class MenuItem<V> {
114
115
  /** The menu item ui pattern instance. */
115
116
  readonly _pattern: MenuItemPattern<V>;
116
117
  constructor();
118
+ ngOnInit(): void;
119
+ ngOnDestroy(): void;
117
120
  /** Opens the submenu focusing on the first menu item. */
118
121
  open(): void;
119
122
  /** Closes the submenu. */
@@ -149,11 +152,11 @@ declare class MenuItem<V> {
149
152
  * @see [Menu](guide/aria/menu)
150
153
  * @see [MenuBar](guide/aria/menubar)
151
154
  */
152
- declare class Menu<V> {
155
+ declare class Menu<V> implements OnDestroy {
153
156
  /** The DeferredContentAware host directive. */
154
157
  private readonly _deferredContentAware;
155
- /** The menu items contained in the menu. */
156
- readonly _allItems: Signal<readonly MenuItem<V>[]>;
158
+ /** The collection of menu items. */
159
+ readonly _collection: SortedCollection<MenuItem<V>>;
157
160
  /** The menu items that are direct children of this menu. */
158
161
  readonly _items: Signal<MenuItem<V>[]>;
159
162
  /** A reference to the host element. */
@@ -175,11 +178,14 @@ declare class Menu<V> {
175
178
  /** The menu ui pattern instance. */
176
179
  readonly _pattern: MenuPattern<V>;
177
180
  /**
178
- * The menu items as a writable signal.
181
+ * The menu item patterns for the menu items that are direct children of this menu, passed
182
+ * to the menu pattern.
179
183
  *
180
- * TODO(wagnermaciel): This would normally be a computed, but using a computed causes a bug where
181
- * sometimes the items array is empty. The bug can be reproduced by switching this to use a
182
- * computed and then quickly opening and closing menus in the dev app.
184
+ * Note: contentChildren has an issue where it will return a successively smaller list
185
+ * each time that the menu is open and closed, eventually resulting in an empty list.
186
+ * The workaround is to trigger a recomputation of this signal whenever the menu is opened
187
+ * or closed, by calling this._pattern.visible() in the signal body. Otherwise, computed could
188
+ * not be used and would have to rebuild the list each time this method is called.
183
189
  */
184
190
  private readonly _itemPatterns;
185
191
  /** Whether the menu is visible. */
@@ -191,10 +197,11 @@ declare class Menu<V> {
191
197
  /** The delay in milliseconds before expanding sub-menus on hover. */
192
198
  readonly expansionDelay: _angular_core.InputSignal<number>;
193
199
  constructor();
200
+ ngOnDestroy(): void;
194
201
  /** Closes the menu. */
195
202
  close(): void;
196
203
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Menu<any>, never>;
197
- 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; }; }, { "itemSelected": "itemSelected"; }, ["_allItems"], never, true, [{ directive: typeof DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
204
+ 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; }; }, { "itemSelected": "itemSelected"; }, never, never, true, [{ directive: typeof DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
198
205
  }
199
206
 
200
207
  /**
@@ -1,145 +1,127 @@
1
- import { ComboboxPattern, ComboboxListboxControls, ComboboxTreeControls } from './_combobox-chunk.js';
2
- export { ComboboxDialogPattern, ComboboxInputs } from './_combobox-chunk.js';
3
- import { ListboxInputs, OptionPattern, ListboxPattern } from './_listbox-chunk.js';
4
- export { OptionInputs } from './_listbox-chunk.js';
5
- import { SignalLike } from './_signal-like-chunk.js';
6
- export { WritableSignalLike, computed, convertGetterSetterToWritableSignalLike, linkedSignal, signal } from './_signal-like-chunk.js';
1
+ export { ListboxInputs, ListboxPattern, OptionInputs, OptionPattern } from './_listbox-chunk.js';
7
2
  export { MenuBarInputs, MenuBarPattern, MenuInputs, MenuItemInputs, MenuItemPattern, MenuPattern, MenuTriggerInputs, MenuTriggerPattern } from './_menu-chunk.js';
3
+ import { SignalLike, WritableSignalLike } from './_collection-chunk.js';
4
+ export { HasElement, SortedCollection, computed, convertGetterSetterToWritableSignalLike, linkedSignal, signal, sortDirectives } from './_collection-chunk.js';
8
5
  export { TabInputs, TabListInputs, TabListPattern, TabPanelInputs, TabPanelPattern, TabPattern } from './_tabs-chunk.js';
9
6
  export { ToolbarInputs, ToolbarPattern, ToolbarWidgetGroupInputs, ToolbarWidgetGroupPattern, ToolbarWidgetInputs, ToolbarWidgetPattern } from './_toolbar-chunk.js';
10
7
  export { AccordionGroupInputs, AccordionGroupPattern, AccordionTriggerInputs, AccordionTriggerPattern } from './_accordion-chunk.js';
11
- import { TreeInputs, TreeItemPattern, TreePattern } from './_tree-chunk.js';
12
- export { TreeItemInputs } from './_tree-chunk.js';
13
- export { GridCellInputs, GridCellPattern, GridCellWidgetInputs, GridCellWidgetPattern, GridInputs, GridPattern, GridRowInputs, GridRowPattern } from './_grid-chunk.js';
8
+ export { TreeInputs, TreeItemInputs, TreeItemPattern, TreePattern } from './_tree-chunk.js';
9
+ export { ElementResolver, GridCellInputs, GridCellPattern, GridCellWidgetInputs, GridCellWidgetPattern, GridInputs, GridPattern, GridRowInputs, GridRowPattern, resolveElement } from './_grid-chunk.js';
14
10
  export { DeferredContent, DeferredContentAware } from './_deferred-content-chunk.js';
15
- export { HasElement, sortDirectives } from './_element-chunk.js';
11
+ import * as _angular_core from '@angular/core';
12
+ import { KeyboardEventManager } from './_keyboard-event-manager-chunk.js';
13
+ import { ClickEventManager } from './_click-event-manager-chunk.js';
14
+ import { ExpansionItem } from './_expansion-chunk.js';
16
15
  export { untracked } from '@angular/core/primitives/signals';
17
- import './_keyboard-event-manager-chunk.js';
18
- import './_pointer-event-manager-chunk.js';
19
16
  import './_list-chunk.js';
20
17
  import './_list-navigation-chunk.js';
21
- import './_click-event-manager-chunk.js';
22
- import './_expansion-chunk.js';
23
- import '@angular/core';
24
18
 
25
- type ComboboxListboxInputs<V> = ListboxInputs<V> & {
26
- /** The combobox controlling the listbox. */
27
- combobox: SignalLike<ComboboxPattern<OptionPattern<V>, V> | undefined>;
28
- };
29
- declare class ComboboxListboxPattern<V> extends ListboxPattern<V> implements ComboboxListboxControls<OptionPattern<V>, V> {
30
- readonly inputs: ComboboxListboxInputs<V>;
31
- /** A unique identifier for the popup. */
32
- readonly id: SignalLike<string>;
33
- /** The ARIA role for the listbox. */
34
- readonly role: SignalLike<"listbox">;
35
- /** The id of the active (focused) item in the listbox. */
36
- readonly activeId: SignalLike<string | undefined>;
37
- /** The list of options in the listbox. */
38
- readonly items: SignalLike<OptionPattern<V>[]>;
39
- /** The tab index for the listbox. Always -1 because the combobox handles focus. */
40
- tabIndex: SignalLike<-1 | 0>;
41
- /** Whether multiple items in the list can be selected at once. */
42
- multi: SignalLike<boolean>;
43
- constructor(inputs: ComboboxListboxInputs<V>);
44
- /** Noop. The combobox handles keydown events. */
45
- onKeydown(_: KeyboardEvent): void;
46
- /** Noop. The combobox handles pointerdown events. */
47
- onClick(_: PointerEvent): void;
48
- /** Noop. The combobox controls the open state. */
49
- setDefaultState(): void;
50
- /** Navigates to the specified item in the listbox. */
51
- readonly focus: (item: OptionPattern<V>, opts?: {
52
- focusElement?: boolean;
53
- }) => void;
54
- /** Navigates to the previous focusable item in the listbox. */
55
- readonly getActiveItem: () => OptionPattern<V> | undefined;
56
- /** Navigates to the next focusable item in the listbox. */
57
- readonly next: () => void;
58
- /** Navigates to the previous focusable item in the listbox. */
59
- readonly prev: () => void;
60
- /** Navigates to the last focusable item in the listbox. */
61
- readonly last: () => void;
62
- /** Navigates to the first focusable item in the listbox. */
63
- readonly first: () => void;
64
- /** Unfocuses the currently focused item in the listbox. */
65
- readonly unfocus: () => void;
66
- /** Selects the specified item in the listbox. */
67
- readonly select: (item?: OptionPattern<V>) => void;
68
- /** Toggles the selection state of the given item in the listbox. */
69
- readonly toggle: (item?: OptionPattern<V>) => void;
70
- /** Clears the selection in the listbox. */
71
- readonly clearSelection: () => void;
72
- /** Retrieves the OptionPattern associated with a pointer event. */
73
- readonly getItem: (e: PointerEvent) => OptionPattern<V> | undefined;
74
- /** Retrieves the currently selected items in the listbox. */
75
- readonly getSelectedItems: () => OptionPattern<V>[];
76
- /** Sets the value of the combobox listbox. */
77
- readonly setValue: (value: V | undefined) => void;
78
- }
19
+ /**
20
+ * Transform function for tabIndex inputs.
21
+ * Returns undefined if the value is undefined, otherwise converts it to a number.
22
+ */
23
+ declare function tabIndexTransform(v: string | number | undefined): number | undefined;
79
24
 
80
- type ComboboxTreeInputs<V> = TreeInputs<V> & {
81
- /** The combobox controlling the tree. */
82
- combobox: SignalLike<ComboboxPattern<TreeItemPattern<V>, V> | undefined>;
83
- };
84
- declare class ComboboxTreePattern<V> extends TreePattern<V> implements ComboboxTreeControls<TreeItemPattern<V>, V> {
85
- readonly inputs: ComboboxTreeInputs<V>;
86
- /** Toggles to expand or collapse a tree item. */
87
- readonly toggleExpansion: (item?: TreeItemPattern<V>) => void;
88
- /** Whether the currently focused item is collapsible. */
89
- readonly isItemCollapsible: () => boolean;
90
- /** The ARIA role for the tree. */
91
- readonly role: () => "tree";
92
- readonly activeId: SignalLike<string | undefined>;
93
- /** Returns the currently active (focused) item in the tree. */
94
- readonly getActiveItem: () => TreeItemPattern<V> | undefined;
95
- /** The list of items in the tree. */
96
- items: SignalLike<TreeItemPattern<V>[]>;
97
- /** The tab index for the tree. Always -1 because the combobox handles focus. */
98
- readonly tabIndex: SignalLike<-1 | 0>;
99
- constructor(inputs: ComboboxTreeInputs<V>);
100
- /** Noop. The combobox handles keydown events. */
101
- onKeydown(_: KeyboardEvent): void;
102
- /** Noop. The combobox handles click events. */
103
- onClick(_: PointerEvent): void;
104
- /** Noop. The combobox controls the open state. */
105
- setDefaultState(): void;
106
- /** Navigates to the specified item in the tree. */
107
- readonly focus: (item: TreeItemPattern<V>) => void;
108
- /** Navigates to the next focusable item in the tree. */
109
- readonly next: () => void;
110
- /** Navigates to the previous focusable item in the tree. */
111
- readonly prev: () => void;
112
- /** Navigates to the last focusable item in the tree. */
113
- readonly last: () => void;
114
- /** Navigates to the first focusable item in the tree. */
115
- readonly first: () => void;
116
- /** Unfocuses the currently focused item in the tree. */
117
- readonly unfocus: () => void;
118
- /** Selects the specified item in the tree or the current active item if not provided. */
119
- readonly select: (item?: TreeItemPattern<V>) => void;
120
- /** Toggles the selection state of the given item in the tree or the current active item if not provided. */
121
- readonly toggle: (item?: TreeItemPattern<V>) => void;
122
- /** Clears the selection in the tree. */
123
- readonly clearSelection: () => void;
124
- /** Retrieves the TreeItemPattern associated with a pointer event. */
125
- readonly getItem: (e: PointerEvent) => TreeItemPattern<V> | undefined;
126
- /** Retrieves the currently selected items in the tree */
127
- readonly getSelectedItems: () => TreeItemPattern<V>[];
128
- /** Sets the value of the combobox tree. */
129
- readonly setValue: (value: V | undefined) => void;
130
- /** Expands the currently focused item if it is expandable, or navigates to the first child. */
131
- readonly expandItem: () => void;
132
- /** Collapses the currently focused item if it is expandable, or navigates to the parent. */
133
- readonly collapseItem: () => void;
134
- /** Whether the specified item or the currently active item is expandable. */
135
- isItemExpandable(item?: TreeItemPattern<V> | undefined): boolean;
136
- /** Expands all of the tree items. */
137
- readonly expandAll: () => void;
138
- /** Collapses all of the tree items. */
139
- readonly collapseAll: () => void;
140
- /** Whether the currently active item is selectable. */
141
- readonly isItemSelectable: (item?: TreeItemPattern<V> | undefined) => boolean;
25
+ /** Represents the required inputs for a simple combobox. */
26
+ interface ComboboxInputs extends ExpansionItem {
27
+ /** Whether the combobox should always remain expanded. */
28
+ alwaysExpanded: SignalLike<boolean>;
29
+ /** The value of the combobox. */
30
+ value: WritableSignalLike<string>;
31
+ /** The element that the combobox is attached to. */
32
+ element: SignalLike<HTMLElement>;
33
+ /** The popup associated with the combobox. */
34
+ popup: SignalLike<ComboboxPopupPattern | undefined>;
35
+ /** An inline suggestion to be displayed in the input. */
36
+ inlineSuggestion: SignalLike<string | undefined>;
37
+ /** Whether the combobox is disabled. */
38
+ disabled: SignalLike<boolean>;
39
+ /** Whether the combobox is soft disabled. */
40
+ softDisabled?: SignalLike<boolean>;
41
+ }
42
+ /** Controls the state of a simple combobox. */
43
+ declare class ComboboxPattern {
44
+ readonly inputs: ComboboxInputs;
45
+ /** The expanded state of the combobox. */
46
+ readonly isExpanded: _angular_core.Signal<boolean>;
47
+ /** The value of the combobox. */
48
+ readonly value: WritableSignalLike<string>;
49
+ /** The element that the combobox is attached to. */
50
+ readonly element: () => HTMLElement;
51
+ /** Whether the combobox is disabled. */
52
+ readonly disabled: () => boolean;
53
+ /** Whether the combobox is soft disabled. */
54
+ readonly softDisabled: () => boolean;
55
+ /** An inline suggestion to be displayed in the input. */
56
+ readonly inlineSuggestion: () => string | undefined;
57
+ /** The ID of the active descendant in the popup. */
58
+ readonly activeDescendant: _angular_core.Signal<string | undefined>;
59
+ /** The ID of the popup. */
60
+ readonly popupId: _angular_core.Signal<string | undefined>;
61
+ /** The type of the popup. */
62
+ readonly popupType: _angular_core.Signal<"listbox" | "tree" | "grid" | "dialog" | undefined>;
63
+ /** The autocomplete behavior of the combobox. */
64
+ readonly autocomplete: _angular_core.Signal<"none" | "inline" | "list" | "both">;
65
+ /** A relay for keyboard events to the popup. */
66
+ readonly keyboardEventRelay: _angular_core.WritableSignal<KeyboardEvent | undefined>;
67
+ /** Whether the combobox is focused. */
68
+ readonly isFocused: _angular_core.WritableSignal<boolean>;
69
+ /** Whether the most recent input event was a deletion. */
70
+ readonly isDeleting: _angular_core.WritableSignal<boolean>;
71
+ /** Whether the combobox is editable (i.e., an input or textarea). */
72
+ readonly isEditable: _angular_core.Signal<boolean>;
73
+ /** The keydown event manager for the combobox. */
74
+ keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
75
+ /** The click event manager for the combobox. */
76
+ click: _angular_core.Signal<ClickEventManager<PointerEvent>>;
77
+ constructor(inputs: ComboboxInputs);
78
+ /** Handles keydown events for the combobox. */
79
+ onKeydown(event: KeyboardEvent): void;
80
+ /** Handles click events for the combobox. */
81
+ onClick(event: PointerEvent): void;
82
+ /** Handles focus in events for the combobox. */
83
+ onFocusin(): void;
84
+ /** Handles focus out events for the combobox. */
85
+ onFocusout(event: FocusEvent): void;
86
+ /** Handles input events for the combobox. */
87
+ onInput(event: Event): void;
88
+ /** Highlights the currently selected item in the combobox. */
89
+ highlightEffect(): void;
90
+ /** Relays keyboard events to the popup. */
91
+ keyboardEventRelayEffect(): void;
92
+ /** Closes the popup when focus leaves the combobox and popup. */
93
+ closePopupOnBlurEffect(): void;
94
+ }
95
+ /** Represents the required inputs for a simple combobox popup. */
96
+ interface ComboboxPopupInputs {
97
+ /** The type of the popup. */
98
+ popupType: SignalLike<'listbox' | 'tree' | 'grid' | 'dialog'>;
99
+ /** The element that serves as the control target for the popup. */
100
+ controlTarget: SignalLike<HTMLElement | undefined>;
101
+ /** The ID of the active descendant in the popup. */
102
+ activeDescendant: SignalLike<string | undefined>;
103
+ /** The ID of the popup. */
104
+ popupId: SignalLike<string | undefined>;
105
+ }
106
+ /** Controls the state of a simple combobox popup. */
107
+ declare class ComboboxPopupPattern {
108
+ readonly inputs: ComboboxPopupInputs;
109
+ /** The type of the popup. */
110
+ readonly popupType: () => "listbox" | "tree" | "grid" | "dialog";
111
+ /** The element that serves as the control target for the popup. */
112
+ readonly controlTarget: () => HTMLElement | undefined;
113
+ /** The ID of the active descendant in the popup. */
114
+ readonly activeDescendant: () => string | undefined;
115
+ /** The ID of the popup. */
116
+ readonly popupId: () => string | undefined;
117
+ /** Whether the popup is focused. */
118
+ readonly isFocused: _angular_core.WritableSignal<boolean>;
119
+ constructor(inputs: ComboboxPopupInputs);
120
+ /** Handles focus in events for the popup. */
121
+ onFocusin(): void;
122
+ /** Handles focus out events for the popup. */
123
+ onFocusout(event: FocusEvent): void;
142
124
  }
143
125
 
144
- export { ComboboxListboxControls, ComboboxListboxPattern, ComboboxPattern, ComboboxTreeControls, ComboboxTreePattern, ListboxInputs, ListboxPattern, OptionPattern, SignalLike, TreeInputs, TreeItemPattern, TreePattern };
145
- export type { ComboboxListboxInputs, ComboboxTreeInputs };
126
+ export { ComboboxPattern, ComboboxPopupPattern, SignalLike, WritableSignalLike, tabIndexTransform };
127
+ export type { ComboboxInputs, ComboboxPopupInputs };