@angular/aria 21.1.0-next.1 → 21.1.0-next.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 (81) hide show
  1. package/fesm2022/_accordion-chunk.mjs +108 -0
  2. package/fesm2022/_accordion-chunk.mjs.map +1 -0
  3. package/fesm2022/_combobox-chunk.mjs +425 -0
  4. package/fesm2022/_combobox-chunk.mjs.map +1 -0
  5. package/fesm2022/_combobox-listbox-chunk.mjs +240 -0
  6. package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -0
  7. package/fesm2022/_combobox-tree-chunk.mjs +331 -0
  8. package/fesm2022/_combobox-tree-chunk.mjs.map +1 -0
  9. package/fesm2022/_deferred-content-chunk.mjs +124 -0
  10. package/fesm2022/_deferred-content-chunk.mjs.map +1 -0
  11. package/fesm2022/_expansion-chunk.mjs +41 -0
  12. package/fesm2022/_expansion-chunk.mjs.map +1 -0
  13. package/fesm2022/_list-chunk.mjs +287 -0
  14. package/fesm2022/_list-chunk.mjs.map +1 -0
  15. package/fesm2022/_list-navigation-chunk.mjs +116 -0
  16. package/fesm2022/_list-navigation-chunk.mjs.map +1 -0
  17. package/fesm2022/_menu-chunk.mjs +515 -0
  18. package/fesm2022/_menu-chunk.mjs.map +1 -0
  19. package/fesm2022/_pointer-event-manager-chunk.mjs +54 -0
  20. package/fesm2022/_pointer-event-manager-chunk.mjs.map +1 -0
  21. package/fesm2022/_signal-like-chunk.mjs +118 -0
  22. package/fesm2022/_signal-like-chunk.mjs.map +1 -0
  23. package/fesm2022/_tabs-chunk.mjs +159 -0
  24. package/fesm2022/_tabs-chunk.mjs.map +1 -0
  25. package/fesm2022/_toolbar-widget-group-chunk.mjs +148 -0
  26. package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -0
  27. package/fesm2022/_widget-chunk.mjs +5 -246
  28. package/fesm2022/_widget-chunk.mjs.map +1 -1
  29. package/fesm2022/accordion.mjs +73 -55
  30. package/fesm2022/accordion.mjs.map +1 -1
  31. package/fesm2022/aria.mjs +1 -1
  32. package/fesm2022/aria.mjs.map +1 -1
  33. package/fesm2022/combobox.mjs +166 -153
  34. package/fesm2022/combobox.mjs.map +1 -1
  35. package/fesm2022/grid.mjs +287 -261
  36. package/fesm2022/grid.mjs.map +1 -1
  37. package/fesm2022/listbox.mjs +211 -197
  38. package/fesm2022/listbox.mjs.map +1 -1
  39. package/fesm2022/menu.mjs +308 -286
  40. package/fesm2022/menu.mjs.map +1 -1
  41. package/fesm2022/private.mjs +15 -2329
  42. package/fesm2022/private.mjs.map +1 -1
  43. package/fesm2022/tabs.mjs +221 -199
  44. package/fesm2022/tabs.mjs.map +1 -1
  45. package/fesm2022/toolbar.mjs +64 -48
  46. package/fesm2022/toolbar.mjs.map +1 -1
  47. package/fesm2022/tree.mjs +54 -44
  48. package/fesm2022/tree.mjs.map +1 -1
  49. package/package.json +2 -2
  50. package/types/_accordion-chunk.d.ts +100 -0
  51. package/types/_combobox-chunk.d.ts +194 -0
  52. package/types/_deferred-content-chunk.d.ts +42 -0
  53. package/types/_expansion-chunk.d.ts +40 -0
  54. package/types/_grid-chunk.d.ts +43 -250
  55. package/types/_keyboard-event-manager-chunk.d.ts +68 -0
  56. package/types/_list-chunk.d.ts +211 -0
  57. package/types/_list-navigation-chunk.d.ts +119 -0
  58. package/types/_listbox-chunk.d.ts +107 -0
  59. package/types/_menu-chunk.d.ts +267 -0
  60. package/types/_pointer-event-manager-chunk.d.ts +34 -0
  61. package/types/_tabs-chunk.d.ts +153 -0
  62. package/types/_toolbar-chunk.d.ts +124 -0
  63. package/types/_tree-chunk.d.ts +185 -0
  64. package/types/accordion.d.ts +65 -54
  65. package/types/aria.d.ts +1 -1
  66. package/types/combobox.d.ts +86 -56
  67. package/types/grid.d.ts +47 -32
  68. package/types/listbox.d.ts +22 -7
  69. package/types/menu.d.ts +135 -117
  70. package/types/private.d.ts +28 -1376
  71. package/types/tabs.d.ts +109 -88
  72. package/types/toolbar.d.ts +77 -66
  73. package/types/tree.d.ts +118 -104
  74. package/_adev_assets/aria-accordion.json +0 -743
  75. package/_adev_assets/aria-combobox.json +0 -603
  76. package/_adev_assets/aria-grid.json +0 -893
  77. package/_adev_assets/aria-listbox.json +0 -540
  78. package/_adev_assets/aria-menu.json +0 -1049
  79. package/_adev_assets/aria-tabs.json +0 -880
  80. package/_adev_assets/aria-toolbar.json +0 -545
  81. package/_adev_assets/aria-tree.json +0 -853
@@ -0,0 +1,267 @@
1
+ import { SignalLike, WritableSignalLike } from './_list-navigation-chunk.js';
2
+ import { KeyboardEventManager } from './_keyboard-event-manager-chunk.js';
3
+ import { ListInputs, ListItem, List } from './_list-chunk.js';
4
+
5
+ /** The inputs for the MenuBarPattern class. */
6
+ interface MenuBarInputs<V> extends ListInputs<MenuItemPattern<V>, V> {
7
+ /** The menu items contained in the menu. */
8
+ items: SignalLike<MenuItemPattern<V>[]>;
9
+ /** Callback function triggered when a menu item is selected. */
10
+ onSelect?: (value: V) => void;
11
+ /** The text direction of the menu bar. */
12
+ textDirection: SignalLike<'ltr' | 'rtl'>;
13
+ }
14
+ /** The inputs for the MenuPattern class. */
15
+ interface MenuInputs<V> extends Omit<ListInputs<MenuItemPattern<V>, V>, 'values'> {
16
+ /** The unique ID of the menu. */
17
+ id: SignalLike<string>;
18
+ /** The menu items contained in the menu. */
19
+ items: SignalLike<MenuItemPattern<V>[]>;
20
+ /** A reference to the parent menu or menu trigger. */
21
+ parent: SignalLike<MenuTriggerPattern<V> | MenuItemPattern<V> | undefined>;
22
+ /** Callback function triggered when a menu item is selected. */
23
+ onSelect?: (value: V) => void;
24
+ /** The text direction of the menu bar. */
25
+ textDirection: SignalLike<'ltr' | 'rtl'>;
26
+ /** The delay in milliseconds before expanding sub-menus on hover. */
27
+ expansionDelay: SignalLike<number>;
28
+ }
29
+ /** The inputs for the MenuTriggerPattern class. */
30
+ interface MenuTriggerInputs<V> {
31
+ /** A reference to the menu trigger element. */
32
+ element: SignalLike<HTMLElement | undefined>;
33
+ /** A reference to the menu associated with the trigger. */
34
+ menu: SignalLike<MenuPattern<V> | undefined>;
35
+ /** The text direction of the menu bar. */
36
+ textDirection: SignalLike<'ltr' | 'rtl'>;
37
+ /** Whether the menu trigger is disabled. */
38
+ disabled: SignalLike<boolean>;
39
+ }
40
+ /** The inputs for the MenuItemPattern class. */
41
+ interface MenuItemInputs<V> extends Omit<ListItem<V>, 'index' | 'selectable'> {
42
+ /** A reference to the parent menu or menu trigger. */
43
+ parent: SignalLike<MenuPattern<V> | MenuBarPattern<V> | undefined>;
44
+ /** A reference to the submenu associated with the menu item. */
45
+ submenu: SignalLike<MenuPattern<V> | undefined>;
46
+ }
47
+ /** The menu ui pattern class. */
48
+ declare class MenuPattern<V> {
49
+ readonly inputs: MenuInputs<V>;
50
+ /** The unique ID of the menu. */
51
+ id: SignalLike<string>;
52
+ /** The role of the menu. */
53
+ role: () => string;
54
+ /** Whether the menu is disabled. */
55
+ disabled: () => boolean;
56
+ /** Whether the menu is visible. */
57
+ visible: SignalLike<boolean>;
58
+ /** Controls list behavior for the menu items. */
59
+ listBehavior: List<MenuItemPattern<V>, V>;
60
+ /** Whether the menu or any of its child elements are currently focused. */
61
+ isFocused: WritableSignalLike<boolean>;
62
+ /** Whether the menu has received focus. */
63
+ hasBeenFocused: WritableSignalLike<boolean>;
64
+ /** Whether the menu trigger has been hovered. */
65
+ hasBeenHovered: WritableSignalLike<boolean>;
66
+ /** Timeout used to open sub-menus on hover. */
67
+ _openTimeout: any;
68
+ /** Timeout used to close sub-menus on hover out. */
69
+ _closeTimeout: any;
70
+ /** The tab index of the menu. */
71
+ tabIndex: () => 0 | -1;
72
+ /** Whether the menu should be focused on mouse over. */
73
+ shouldFocus: SignalLike<boolean>;
74
+ /** The key used to expand sub-menus. */
75
+ private _expandKey;
76
+ /** The key used to collapse sub-menus. */
77
+ private _collapseKey;
78
+ /** Represents the space key. Does nothing when the user is actively using typeahead. */
79
+ dynamicSpaceKey: SignalLike<"" | " ">;
80
+ /** The regexp used to decide if a key should trigger typeahead. */
81
+ typeaheadRegexp: RegExp;
82
+ /** The root of the menu. */
83
+ root: SignalLike<MenuTriggerPattern<V> | MenuBarPattern<V> | MenuPattern<V> | undefined>;
84
+ /** Handles keyboard events for the menu. */
85
+ keydownManager: SignalLike<KeyboardEventManager<KeyboardEvent>>;
86
+ constructor(inputs: MenuInputs<V>);
87
+ /** Sets the default state for the menu. */
88
+ setDefaultState(): void;
89
+ /** Handles keyboard events for the menu. */
90
+ onKeydown(event: KeyboardEvent): void;
91
+ /** Handles mouseover events for the menu. */
92
+ onMouseOver(event: MouseEvent): void;
93
+ /** Closes the specified menu item after a delay. */
94
+ private _closeItem;
95
+ /** Opens the specified menu item after a delay. */
96
+ private _openItem;
97
+ /** Handles mouseout events for the menu. */
98
+ onMouseOut(event: MouseEvent): void;
99
+ /** Handles click events for the menu. */
100
+ onClick(event: MouseEvent): void;
101
+ /** Handles focusin events for the menu. */
102
+ onFocusIn(): void;
103
+ /** Handles the focusout event for the menu. */
104
+ onFocusOut(event: FocusEvent): void;
105
+ /** Focuses the previous menu item. */
106
+ prev(): void;
107
+ /** Focuses the next menu item. */
108
+ next(): void;
109
+ /** Focuses the first menu item. */
110
+ first(): void;
111
+ /** Focuses the last menu item. */
112
+ last(): void;
113
+ /** Triggers the active menu item. */
114
+ trigger(): void;
115
+ /** Submits the menu. */
116
+ submit(item?: MenuItemPattern<V> | undefined): void;
117
+ /** Collapses the current menu or focuses the previous item in the menubar. */
118
+ collapse(): void;
119
+ /** Expands the current menu or focuses the next item in the menubar. */
120
+ expand(): void;
121
+ /** Closes the menu. */
122
+ close(): void;
123
+ /** Closes the menu and all parent menus. */
124
+ closeAll(): void;
125
+ /** Clears any open or close timeouts for sub-menus. */
126
+ _clearTimeouts(): void;
127
+ /** Clears the open timeout. */
128
+ _clearOpenTimeout(): void;
129
+ /** Clears the close timeout. */
130
+ _clearCloseTimeout(): void;
131
+ }
132
+ /** The menubar ui pattern class. */
133
+ declare class MenuBarPattern<V> {
134
+ readonly inputs: MenuBarInputs<V>;
135
+ /** Controls list behavior for the menu items. */
136
+ listBehavior: List<MenuItemPattern<V>, V>;
137
+ /** The tab index of the menu. */
138
+ tabIndex: () => 0 | -1;
139
+ /** The key used to navigate to the next item. */
140
+ private _nextKey;
141
+ /** The key used to navigate to the previous item. */
142
+ private _previousKey;
143
+ /** Represents the space key. Does nothing when the user is actively using typeahead. */
144
+ dynamicSpaceKey: SignalLike<"" | " ">;
145
+ /** The regexp used to decide if a key should trigger typeahead. */
146
+ typeaheadRegexp: RegExp;
147
+ /** Whether the menubar or any of its children are currently focused. */
148
+ isFocused: WritableSignalLike<boolean>;
149
+ /** Whether the menubar has been focused. */
150
+ hasBeenFocused: WritableSignalLike<boolean>;
151
+ /** Whether the menubar is disabled. */
152
+ disabled: () => boolean;
153
+ /** Handles keyboard events for the menu. */
154
+ keydownManager: SignalLike<KeyboardEventManager<KeyboardEvent>>;
155
+ constructor(inputs: MenuBarInputs<V>);
156
+ /** Sets the default state for the menubar. */
157
+ setDefaultState(): void;
158
+ /** Handles keyboard events for the menu. */
159
+ onKeydown(event: KeyboardEvent): void;
160
+ /** Handles click events for the menu bar. */
161
+ onClick(event: MouseEvent): void;
162
+ /** Handles mouseover events for the menu bar. */
163
+ onMouseOver(event: MouseEvent): void;
164
+ /** Handles focusin events for the menu bar. */
165
+ onFocusIn(): void;
166
+ /** Handles focusout events for the menu bar. */
167
+ onFocusOut(event: FocusEvent): void;
168
+ /** Goes to and optionally focuses the specified menu item. */
169
+ goto(item: MenuItemPattern<V>, opts?: {
170
+ focusElement?: boolean;
171
+ }): void;
172
+ /** Focuses the next menu item. */
173
+ next(): void;
174
+ /** Focuses the previous menu item. */
175
+ prev(): void;
176
+ /** Closes the menubar and refocuses the root menu bar item. */
177
+ close(): void;
178
+ }
179
+ /** The menu trigger ui pattern class. */
180
+ declare class MenuTriggerPattern<V> {
181
+ readonly inputs: MenuTriggerInputs<V>;
182
+ /** Whether the menu is expanded. */
183
+ expanded: WritableSignalLike<boolean>;
184
+ /** Whether the menu trigger has received focus. */
185
+ hasBeenFocused: WritableSignalLike<boolean>;
186
+ /** The role of the menu trigger. */
187
+ role: () => string;
188
+ /** Whether the menu trigger has a popup. */
189
+ hasPopup: () => boolean;
190
+ /** The menu associated with the trigger. */
191
+ menu: SignalLike<MenuPattern<V> | undefined>;
192
+ /** The tab index of the menu trigger. */
193
+ tabIndex: SignalLike<-1 | 0>;
194
+ /** Whether the menu trigger is disabled. */
195
+ disabled: () => boolean;
196
+ /** Handles keyboard events for the menu trigger. */
197
+ keydownManager: SignalLike<KeyboardEventManager<KeyboardEvent>>;
198
+ constructor(inputs: MenuTriggerInputs<V>);
199
+ /** Handles keyboard events for the menu trigger. */
200
+ onKeydown(event: KeyboardEvent): void;
201
+ /** Handles click events for the menu trigger. */
202
+ onClick(): void;
203
+ /** Handles focusin events for the menu trigger. */
204
+ onFocusIn(): void;
205
+ /** Handles focusout events for the menu trigger. */
206
+ onFocusOut(event: FocusEvent): void;
207
+ /** Opens the menu. */
208
+ open(opts?: {
209
+ first?: boolean;
210
+ last?: boolean;
211
+ }): void;
212
+ /** Closes the menu. */
213
+ close(opts?: {
214
+ refocus?: boolean;
215
+ }): void;
216
+ }
217
+ /** The menu item ui pattern class. */
218
+ declare class MenuItemPattern<V> implements ListItem<V> {
219
+ readonly inputs: MenuItemInputs<V>;
220
+ /** The value of the menu item. */
221
+ value: SignalLike<V>;
222
+ /** The unique ID of the menu item. */
223
+ id: SignalLike<string>;
224
+ /** Whether the menu item is disabled. */
225
+ disabled: () => boolean;
226
+ /** The search term for the menu item. */
227
+ searchTerm: SignalLike<string>;
228
+ /** The element of the menu item. */
229
+ element: SignalLike<HTMLElement | undefined>;
230
+ /** Whether the menu item is active. */
231
+ active: SignalLike<boolean>;
232
+ /** Whether the menu item has received focus. */
233
+ hasBeenFocused: WritableSignalLike<boolean>;
234
+ /** The tab index of the menu item. */
235
+ tabIndex: SignalLike<0 | -1>;
236
+ /** The position of the menu item in the menu. */
237
+ index: SignalLike<number>;
238
+ /** Whether the menu item is expanded. */
239
+ expanded: SignalLike<boolean | null>;
240
+ /** Whether the menu item is expanded. */
241
+ _expanded: WritableSignalLike<boolean>;
242
+ /** The ID of the menu that the menu item controls. */
243
+ controls: WritableSignalLike<string | undefined>;
244
+ /** The role of the menu item. */
245
+ role: () => string;
246
+ /** Whether the menu item has a popup. */
247
+ hasPopup: SignalLike<boolean>;
248
+ /** The submenu associated with the menu item. */
249
+ submenu: SignalLike<MenuPattern<V> | undefined>;
250
+ /** Whether the menu item is selectable. */
251
+ selectable: SignalLike<boolean>;
252
+ constructor(inputs: MenuItemInputs<V>);
253
+ /** Opens the submenu. */
254
+ open(opts?: {
255
+ first?: boolean;
256
+ last?: boolean;
257
+ }): void;
258
+ /** Closes the submenu. */
259
+ close(opts?: {
260
+ refocus?: boolean;
261
+ }): void;
262
+ /** Handles focusin events for the menu item. */
263
+ onFocusIn(): void;
264
+ }
265
+
266
+ export { MenuBarPattern, MenuItemPattern, MenuPattern, MenuTriggerPattern };
267
+ export type { MenuBarInputs, MenuInputs, MenuItemInputs, MenuTriggerInputs };
@@ -0,0 +1,34 @@
1
+ import { EventManager, EventHandlerOptions, ModifierInputs, EventHandler } from './_keyboard-event-manager-chunk.js';
2
+
3
+ /**
4
+ * The different mouse buttons that may appear on a pointer event.
5
+ */
6
+ declare enum MouseButton {
7
+ Main = 0,
8
+ Auxiliary = 1,
9
+ Secondary = 2
10
+ }
11
+ /** An event manager that is specialized for handling pointer events. */
12
+ declare class PointerEventManager<T extends PointerEvent> extends EventManager<T> {
13
+ options: EventHandlerOptions;
14
+ /**
15
+ * Configures this event manager to handle events with a specific modifer and mouse button
16
+ * combination.
17
+ */
18
+ on(button: MouseButton, modifiers: ModifierInputs, handler: EventHandler<T>): this;
19
+ /**
20
+ * Configures this event manager to handle events with a specific mouse button and no modifiers.
21
+ */
22
+ on(modifiers: ModifierInputs, handler: EventHandler<T>): this;
23
+ /**
24
+ * Configures this event manager to handle events with the main mouse button and no modifiers.
25
+ *
26
+ * @param handler The handler function
27
+ * @param options Options for whether to stop propagation or prevent default.
28
+ */
29
+ on(handler: EventHandler<T>): this;
30
+ private _normalizeInputs;
31
+ _isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs): boolean;
32
+ }
33
+
34
+ export { PointerEventManager };
@@ -0,0 +1,153 @@
1
+ import { KeyboardEventManager } from './_keyboard-event-manager-chunk.js';
2
+ import { PointerEventManager } from './_pointer-event-manager-chunk.js';
3
+ import { ExpansionItem, ListExpansionInputs, ListExpansion } from './_expansion-chunk.js';
4
+ import { SignalLike, ListNavigationItem, WritableSignalLike, ListNavigationInputs, ListFocus, ListNavigation } from './_list-navigation-chunk.js';
5
+
6
+ /** Represents the required inputs for the label control. */
7
+ interface LabelControlInputs {
8
+ /** The default `aria-labelledby` ids. */
9
+ defaultLabelledBy: SignalLike<string[]>;
10
+ }
11
+ /** Represents the optional inputs for the label control. */
12
+ interface LabelControlOptionalInputs {
13
+ /** The `aria-label`. */
14
+ label?: SignalLike<string | undefined>;
15
+ /** The user-provided `aria-labelledby` ids. */
16
+ labelledBy?: SignalLike<string[]>;
17
+ }
18
+ /** Controls label and description of an element. */
19
+ declare class LabelControl {
20
+ readonly inputs: LabelControlInputs & LabelControlOptionalInputs;
21
+ /** The `aria-label`. */
22
+ readonly label: SignalLike<string | undefined>;
23
+ /** The `aria-labelledby` ids. */
24
+ readonly labelledBy: SignalLike<string[]>;
25
+ constructor(inputs: LabelControlInputs & LabelControlOptionalInputs);
26
+ }
27
+
28
+ /** The required inputs to tabs. */
29
+ interface TabInputs extends Omit<ListNavigationItem, 'index'>, Omit<ExpansionItem, 'expandable'> {
30
+ /** The parent tablist that controls the tab. */
31
+ tablist: SignalLike<TabListPattern>;
32
+ /** The remote tabpanel controlled by the tab. */
33
+ tabpanel: SignalLike<TabPanelPattern | undefined>;
34
+ /** The remote tabpanel unique identifier. */
35
+ value: SignalLike<string>;
36
+ }
37
+ /** A tab in a tablist. */
38
+ declare class TabPattern {
39
+ readonly inputs: TabInputs;
40
+ /** A global unique identifier for the tab. */
41
+ readonly id: SignalLike<string>;
42
+ /** The index of the tab. */
43
+ readonly index: SignalLike<number>;
44
+ /** The remote tabpanel unique identifier. */
45
+ readonly value: SignalLike<string>;
46
+ /** Whether the tab is disabled. */
47
+ readonly disabled: SignalLike<boolean>;
48
+ /** The html element that should receive focus. */
49
+ readonly element: SignalLike<HTMLElement>;
50
+ /** Whether this tab has expandable panel. */
51
+ readonly expandable: SignalLike<boolean>;
52
+ /** Whether the tab panel is expanded. */
53
+ readonly expanded: WritableSignalLike<boolean>;
54
+ /** Whether the tab is active. */
55
+ readonly active: SignalLike<boolean>;
56
+ /** Whether the tab is selected. */
57
+ readonly selected: SignalLike<boolean>;
58
+ /** The tab index of the tab. */
59
+ readonly tabIndex: SignalLike<0 | -1>;
60
+ /** The id of the tabpanel associated with the tab. */
61
+ readonly controls: SignalLike<string | undefined>;
62
+ constructor(inputs: TabInputs);
63
+ /** Opens the tab. */
64
+ open(): boolean;
65
+ }
66
+ /** The required inputs for the tabpanel. */
67
+ interface TabPanelInputs extends LabelControlOptionalInputs {
68
+ /** A global unique identifier for the tabpanel. */
69
+ id: SignalLike<string>;
70
+ /** The tab that controls this tabpanel. */
71
+ tab: SignalLike<TabPattern | undefined>;
72
+ /** A local unique identifier for the tabpanel. */
73
+ value: SignalLike<string>;
74
+ }
75
+ /** A tabpanel associated with a tab. */
76
+ declare class TabPanelPattern {
77
+ readonly inputs: TabPanelInputs;
78
+ /** A global unique identifier for the tabpanel. */
79
+ readonly id: SignalLike<string>;
80
+ /** A local unique identifier for the tabpanel. */
81
+ readonly value: SignalLike<string>;
82
+ /** Controls label for this tabpanel. */
83
+ readonly labelManager: LabelControl;
84
+ /** Whether the tabpanel is hidden. */
85
+ readonly hidden: SignalLike<boolean>;
86
+ /** The tab index of this tabpanel. */
87
+ readonly tabIndex: SignalLike<-1 | 0>;
88
+ /** The aria-labelledby value for this tabpanel. */
89
+ readonly labelledBy: SignalLike<string | undefined>;
90
+ constructor(inputs: TabPanelInputs);
91
+ }
92
+ /** The required inputs for the tablist. */
93
+ interface TabListInputs extends Omit<ListNavigationInputs<TabPattern>, 'multi'>, Omit<ListExpansionInputs, 'multiExpandable' | 'items'> {
94
+ /** The selection strategy used by the tablist. */
95
+ selectionMode: SignalLike<'follow' | 'explicit'>;
96
+ }
97
+ /** Controls the state of a tablist. */
98
+ declare class TabListPattern {
99
+ readonly inputs: TabListInputs;
100
+ /** The list focus behavior for the tablist. */
101
+ readonly focusBehavior: ListFocus<TabPattern>;
102
+ /** The list navigation behavior for the tablist. */
103
+ readonly navigationBehavior: ListNavigation<TabPattern>;
104
+ /** Controls expansion for the tablist. */
105
+ readonly expansionBehavior: ListExpansion;
106
+ /** The currently active tab. */
107
+ readonly activeTab: SignalLike<TabPattern | undefined>;
108
+ /** The currently selected tab. */
109
+ readonly selectedTab: WritableSignalLike<TabPattern | undefined>;
110
+ /** Whether the tablist is vertically or horizontally oriented. */
111
+ readonly orientation: SignalLike<'vertical' | 'horizontal'>;
112
+ /** Whether the tablist is disabled. */
113
+ readonly disabled: SignalLike<boolean>;
114
+ /** The tab index of the tablist. */
115
+ readonly tabIndex: SignalLike<0 | -1>;
116
+ /** The id of the current active tab. */
117
+ readonly activeDescendant: SignalLike<string | undefined>;
118
+ /** Whether selection should follow focus. */
119
+ readonly followFocus: SignalLike<boolean>;
120
+ /** The key used to navigate to the previous tab in the tablist. */
121
+ readonly prevKey: SignalLike<"ArrowUp" | "ArrowRight" | "ArrowLeft">;
122
+ /** The key used to navigate to the next item in the list. */
123
+ readonly nextKey: SignalLike<"ArrowRight" | "ArrowLeft" | "ArrowDown">;
124
+ /** The keydown event manager for the tablist. */
125
+ readonly keydown: SignalLike<KeyboardEventManager<KeyboardEvent>>;
126
+ /** The pointerdown event manager for the tablist. */
127
+ readonly pointerdown: SignalLike<PointerEventManager<PointerEvent>>;
128
+ constructor(inputs: TabListInputs);
129
+ /**
130
+ * Sets the tablist to its default initial state.
131
+ *
132
+ * Sets the active index of the tablist to the first focusable selected
133
+ * tab if one exists. Otherwise, sets focus to the first focusable tab.
134
+ *
135
+ * This method should be called once the tablist and its tabs are properly initialized.
136
+ */
137
+ setDefaultState(): void;
138
+ /** Handles keydown events for the tablist. */
139
+ onKeydown(event: KeyboardEvent): void;
140
+ /** The pointerdown event manager for the tablist. */
141
+ onPointerdown(event: PointerEvent): void;
142
+ /** Opens the tab by given value. */
143
+ open(value: string): boolean;
144
+ /** Opens the given tab or the current active tab. */
145
+ open(tab?: TabPattern): boolean;
146
+ /** Executes a navigation operation and expand the active tab if needed. */
147
+ private _navigate;
148
+ /** Returns the tab item associated with the given pointer event. */
149
+ private _getItem;
150
+ }
151
+
152
+ export { TabListPattern, TabPanelPattern, TabPattern };
153
+ export type { TabInputs, TabListInputs, TabPanelInputs };
@@ -0,0 +1,124 @@
1
+ import { SignalLike } from './_list-navigation-chunk.js';
2
+ import { ListItem, ListInputs, List } from './_list-chunk.js';
3
+
4
+ /** Represents the required inputs for a toolbar widget group. */
5
+ interface ToolbarWidgetGroupInputs<T extends ListItem<V>, V> {
6
+ /** A reference to the parent toolbar. */
7
+ toolbar: SignalLike<ToolbarPattern<V> | undefined>;
8
+ /** Whether the widget group is disabled. */
9
+ disabled: SignalLike<boolean>;
10
+ /** The list of items within the widget group. */
11
+ items: SignalLike<T[]>;
12
+ /** Whether the group allows multiple widgets to be selected. */
13
+ multi: SignalLike<boolean>;
14
+ }
15
+ /** A group of widgets within a toolbar that provides nested navigation. */
16
+ declare class ToolbarWidgetGroupPattern<T extends ListItem<V>, V> {
17
+ readonly inputs: ToolbarWidgetGroupInputs<T, V>;
18
+ /** Whether the widget is disabled. */
19
+ readonly disabled: () => boolean;
20
+ /** A reference to the parent toolbar. */
21
+ readonly toolbar: () => ToolbarPattern<V> | undefined;
22
+ /** Whether the group allows multiple widgets to be selected. */
23
+ readonly multi: () => boolean;
24
+ readonly searchTerm: () => string;
25
+ readonly value: () => V;
26
+ readonly selectable: () => boolean;
27
+ readonly element: () => undefined;
28
+ constructor(inputs: ToolbarWidgetGroupInputs<T, V>);
29
+ }
30
+
31
+ /** Represents the required inputs for a toolbar widget in a toolbar. */
32
+ interface ToolbarWidgetInputs<V> extends Omit<ListItem<V>, 'searchTerm' | 'index' | 'selectable'> {
33
+ /** A reference to the parent toolbar. */
34
+ toolbar: SignalLike<ToolbarPattern<V>>;
35
+ /** A reference to the parent widget group. */
36
+ group: SignalLike<ToolbarWidgetGroupPattern<ToolbarWidgetPattern<V>, V> | undefined>;
37
+ }
38
+ declare class ToolbarWidgetPattern<V> implements ListItem<V> {
39
+ readonly inputs: ToolbarWidgetInputs<V>;
40
+ /** A unique identifier for the widget. */
41
+ readonly id: () => string;
42
+ /** The html element that should receive focus. */
43
+ readonly element: () => HTMLElement | undefined;
44
+ /** Whether the widget is disabled. */
45
+ readonly disabled: () => boolean;
46
+ /** A reference to the parent toolbar. */
47
+ readonly group: () => ToolbarWidgetGroupPattern<ToolbarWidgetPattern<V>, V> | undefined;
48
+ /** A reference to the toolbar containing the widget. */
49
+ readonly toolbar: () => ToolbarPattern<V>;
50
+ /** The tabindex of the widget. */
51
+ readonly tabIndex: SignalLike<0 | -1>;
52
+ /** The text used by the typeahead search. */
53
+ readonly searchTerm: () => string;
54
+ /** The value associated with the widget. */
55
+ readonly value: () => V;
56
+ /** Whether the widget is selectable. */
57
+ readonly selectable: () => boolean;
58
+ /** The position of the widget within the toolbar. */
59
+ readonly index: SignalLike<number>;
60
+ /** Whether the widget is selected (only relevant in a selection group). */
61
+ readonly selected: SignalLike<boolean>;
62
+ /** Whether the widget is currently the active one (focused). */
63
+ readonly active: SignalLike<boolean>;
64
+ constructor(inputs: ToolbarWidgetInputs<V>);
65
+ }
66
+
67
+ /** Represents the required inputs for a toolbar. */
68
+ type ToolbarInputs<V> = Omit<ListInputs<ToolbarWidgetPattern<V>, V>, 'multi' | 'typeaheadDelay' | 'selectionMode' | 'focusMode'> & {
69
+ /** A function that returns the toolbar item associated with a given element. */
70
+ getItem: (e: Element) => ToolbarWidgetPattern<V> | undefined;
71
+ };
72
+ /** Controls the state of a toolbar. */
73
+ declare class ToolbarPattern<V> {
74
+ readonly inputs: ToolbarInputs<V>;
75
+ /** The list behavior for the toolbar. */
76
+ readonly listBehavior: List<ToolbarWidgetPattern<V>, V>;
77
+ /** Whether the tablist is vertically or horizontally oriented. */
78
+ readonly orientation: SignalLike<'vertical' | 'horizontal'>;
79
+ /** Whether disabled items in the group should be focusable. */
80
+ readonly softDisabled: SignalLike<boolean>;
81
+ /** Whether the toolbar is disabled. */
82
+ readonly disabled: SignalLike<boolean>;
83
+ /** The tab index of the toolbar (if using activedescendant). */
84
+ readonly tabIndex: SignalLike<0 | -1>;
85
+ /** The id of the current active widget (if using activedescendant). */
86
+ readonly activeDescendant: SignalLike<string | undefined>;
87
+ /** The currently active item in the toolbar. */
88
+ readonly activeItem: () => ToolbarWidgetPattern<V> | undefined;
89
+ /** The key used to navigate to the previous widget. */
90
+ private readonly _prevKey;
91
+ /** The key used to navigate to the next widget. */
92
+ private readonly _nextKey;
93
+ /** The alternate key used to navigate to the previous widget. */
94
+ private readonly _altPrevKey;
95
+ /** The alternate key used to navigate to the next widget. */
96
+ private readonly _altNextKey;
97
+ /** The keydown event manager for the toolbar. */
98
+ private readonly _keydown;
99
+ /** Navigates to the next widget in a widget group. */
100
+ private _groupNext;
101
+ /** Navigates to the previous widget in a widget group. */
102
+ private _groupPrev;
103
+ /** Navigates to the widget targeted by a pointer event. */
104
+ private _goto;
105
+ select(): void;
106
+ constructor(inputs: ToolbarInputs<V>);
107
+ /** Handles keydown events for the toolbar. */
108
+ onKeydown(event: KeyboardEvent): void;
109
+ onPointerdown(event: PointerEvent): void;
110
+ /** Handles click events for the toolbar. */
111
+ onClick(event: MouseEvent): void;
112
+ /**
113
+ * Sets the toolbar to its default initial state.
114
+ *
115
+ * Sets the active index to the selected widget if one exists and is focusable.
116
+ * Otherwise, sets the active index to the first focusable widget.
117
+ */
118
+ setDefaultState(): void;
119
+ /** Validates the state of the toolbar and returns a list of accessibility violations. */
120
+ validate(): string[];
121
+ }
122
+
123
+ export { ToolbarPattern, ToolbarWidgetGroupPattern, ToolbarWidgetPattern };
124
+ export type { ToolbarInputs, ToolbarWidgetGroupInputs, ToolbarWidgetInputs };