@angular/aria 21.1.0-next.0 → 21.1.0-next.2
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.
- package/fesm2022/_combobox-chunk.mjs +425 -0
- package/fesm2022/_combobox-chunk.mjs.map +1 -0
- package/fesm2022/_combobox-listbox-chunk.mjs +522 -0
- package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -0
- package/fesm2022/_combobox-popup-chunk.mjs +46 -0
- package/fesm2022/_combobox-popup-chunk.mjs.map +1 -0
- package/fesm2022/_list-navigation-chunk.mjs +116 -0
- package/fesm2022/_list-navigation-chunk.mjs.map +1 -0
- package/fesm2022/_pointer-event-manager-chunk.mjs +134 -0
- package/fesm2022/_pointer-event-manager-chunk.mjs.map +1 -0
- package/fesm2022/_widget-chunk.mjs +4 -246
- package/fesm2022/_widget-chunk.mjs.map +1 -1
- package/fesm2022/accordion.mjs +64 -51
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/aria.mjs +1 -1
- package/fesm2022/aria.mjs.map +1 -1
- package/fesm2022/combobox.mjs +120 -144
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/grid.mjs +285 -261
- package/fesm2022/grid.mjs.map +1 -1
- package/fesm2022/listbox.mjs +205 -193
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +301 -283
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/private.mjs +15 -938
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/tabs.mjs +209 -195
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +59 -47
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tree.mjs +43 -41
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +2 -2
- package/types/_combobox-chunk.d.ts +98 -0
- package/types/_combobox-chunk.d2.ts +193 -0
- package/types/_grid-chunk.d.ts +3 -210
- package/types/_list-chunk.d.ts +212 -0
- package/types/_list-navigation-chunk.d.ts +212 -0
- package/types/_listbox-chunk.d.ts +106 -0
- package/types/accordion.d.ts +52 -49
- package/types/combobox.d.ts +25 -111
- package/types/grid.d.ts +37 -32
- package/types/listbox.d.ts +8 -5
- package/types/menu.d.ts +113 -113
- package/types/private.d.ts +12 -498
- package/types/tabs.d.ts +89 -84
- package/types/toolbar.d.ts +69 -66
- package/types/tree.d.ts +106 -103
- package/_adev_assets/aria-accordion.json +0 -743
- package/_adev_assets/aria-combobox.json +0 -607
- package/_adev_assets/aria-grid.json +0 -901
- package/_adev_assets/aria-listbox.json +0 -544
- package/_adev_assets/aria-menu.json +0 -1049
- package/_adev_assets/aria-tabs.json +0 -880
- package/_adev_assets/aria-toolbar.json +0 -545
- package/_adev_assets/aria-tree.json +0 -861
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { SignalLike, WritableSignalLike, KeyboardEventManager, PointerEventManager } from './_list-navigation-chunk.js';
|
|
3
|
+
import { ListItem } from './_list-chunk.js';
|
|
4
|
+
|
|
5
|
+
/** Represents the required inputs for a combobox. */
|
|
6
|
+
interface ComboboxInputs<T extends ListItem<V>, V> {
|
|
7
|
+
/** The controls for the popup associated with the combobox. */
|
|
8
|
+
popupControls: SignalLike<ComboboxListboxControls<T, V> | ComboboxTreeControls<T, V> | ComboboxDialogPattern | undefined>;
|
|
9
|
+
/** The HTML input element that serves as the combobox input. */
|
|
10
|
+
inputEl: SignalLike<HTMLInputElement | undefined>;
|
|
11
|
+
/** The HTML element that serves as the combobox container. */
|
|
12
|
+
containerEl: SignalLike<HTMLElement | undefined>;
|
|
13
|
+
/** The filtering mode for the combobox. */
|
|
14
|
+
filterMode: SignalLike<'manual' | 'auto-select' | 'highlight'>;
|
|
15
|
+
/** The current value of the combobox. */
|
|
16
|
+
inputValue?: WritableSignalLike<string>;
|
|
17
|
+
/** The value of the first matching item in the popup. */
|
|
18
|
+
firstMatch: SignalLike<V | undefined>;
|
|
19
|
+
/** Whether the combobox is disabled. */
|
|
20
|
+
disabled: SignalLike<boolean>;
|
|
21
|
+
/** Whether the combobox is read-only. */
|
|
22
|
+
readonly: SignalLike<boolean>;
|
|
23
|
+
/** Whether the combobox is in a right-to-left context. */
|
|
24
|
+
textDirection: SignalLike<'rtl' | 'ltr'>;
|
|
25
|
+
/** Whether the combobox is always expanded. */
|
|
26
|
+
alwaysExpanded: SignalLike<boolean>;
|
|
27
|
+
}
|
|
28
|
+
/** An interface that allows combobox popups to expose the necessary controls for the combobox. */
|
|
29
|
+
interface ComboboxListboxControls<T extends ListItem<V>, V> {
|
|
30
|
+
/** A unique identifier for the popup. */
|
|
31
|
+
id: () => string;
|
|
32
|
+
/** The ARIA role for the popup. */
|
|
33
|
+
role: SignalLike<'listbox' | 'tree' | 'grid'>;
|
|
34
|
+
/** Whether multiple items in the popup can be selected at once. */
|
|
35
|
+
multi: SignalLike<boolean>;
|
|
36
|
+
/** The ID of the active item in the popup. */
|
|
37
|
+
activeId: SignalLike<string | undefined>;
|
|
38
|
+
/** The list of items in the popup. */
|
|
39
|
+
items: SignalLike<T[]>;
|
|
40
|
+
/** Navigates to the given item in the popup. */
|
|
41
|
+
focus: (item: T, opts?: {
|
|
42
|
+
focusElement?: boolean;
|
|
43
|
+
}) => void;
|
|
44
|
+
/** Navigates to the next item in the popup. */
|
|
45
|
+
next: () => void;
|
|
46
|
+
/** Navigates to the previous item in the popup. */
|
|
47
|
+
prev: () => void;
|
|
48
|
+
/** Navigates to the first item in the popup. */
|
|
49
|
+
first: () => void;
|
|
50
|
+
/** Navigates to the last item in the popup. */
|
|
51
|
+
last: () => void;
|
|
52
|
+
/** Selects the current item in the popup. */
|
|
53
|
+
select: (item?: T) => void;
|
|
54
|
+
/** Toggles the selection state of the given item in the popup. */
|
|
55
|
+
toggle: (item?: T) => void;
|
|
56
|
+
/** Clears the selection state of the popup. */
|
|
57
|
+
clearSelection: () => void;
|
|
58
|
+
/** Removes focus from any item in the popup. */
|
|
59
|
+
unfocus: () => void;
|
|
60
|
+
/** Returns the item corresponding to the given event. */
|
|
61
|
+
getItem: (e: PointerEvent) => T | undefined;
|
|
62
|
+
/** Returns the currently active (focused) item in the popup. */
|
|
63
|
+
getActiveItem: () => T | undefined;
|
|
64
|
+
/** Returns the currently selected items in the popup. */
|
|
65
|
+
getSelectedItems: () => T[];
|
|
66
|
+
/** Sets the value of the combobox based on the selected item. */
|
|
67
|
+
setValue: (value: V | undefined) => void;
|
|
68
|
+
}
|
|
69
|
+
interface ComboboxTreeControls<T extends ListItem<V>, V> extends ComboboxListboxControls<T, V> {
|
|
70
|
+
/** Whether the currently active item in the popup is collapsible. */
|
|
71
|
+
isItemCollapsible: () => boolean;
|
|
72
|
+
/** Expands the currently active item in the popup. */
|
|
73
|
+
expandItem: () => void;
|
|
74
|
+
/** Collapses the currently active item in the popup. */
|
|
75
|
+
collapseItem: () => void;
|
|
76
|
+
/** Checks if the currently active item in the popup is expandable. */
|
|
77
|
+
isItemExpandable: (item?: T) => boolean;
|
|
78
|
+
/** Expands all nodes in the tree. */
|
|
79
|
+
expandAll: () => void;
|
|
80
|
+
/** Collapses all nodes in the tree. */
|
|
81
|
+
collapseAll: () => void;
|
|
82
|
+
/** Toggles the expansion state of the currently active item in the popup. */
|
|
83
|
+
toggleExpansion: (item?: T) => void;
|
|
84
|
+
/** Whether the current active item is selectable. */
|
|
85
|
+
isItemSelectable: (item?: T) => boolean;
|
|
86
|
+
}
|
|
87
|
+
/** Controls the state of a combobox. */
|
|
88
|
+
declare class ComboboxPattern<T extends ListItem<V>, V> {
|
|
89
|
+
readonly inputs: ComboboxInputs<T, V>;
|
|
90
|
+
/** Whether the combobox is expanded. */
|
|
91
|
+
expanded: _angular_core.WritableSignal<boolean>;
|
|
92
|
+
/** Whether the combobox is disabled. */
|
|
93
|
+
disabled: () => boolean;
|
|
94
|
+
/** The ID of the active item in the combobox. */
|
|
95
|
+
activeDescendant: _angular_core.Signal<string | null>;
|
|
96
|
+
/** The currently highlighted item in the combobox. */
|
|
97
|
+
highlightedItem: _angular_core.WritableSignal<T | undefined>;
|
|
98
|
+
/** Whether the most recent input event was a deletion. */
|
|
99
|
+
isDeleting: boolean;
|
|
100
|
+
/** Whether the combobox is focused. */
|
|
101
|
+
isFocused: _angular_core.WritableSignal<boolean>;
|
|
102
|
+
/** Whether the combobox has ever been focused. */
|
|
103
|
+
hasBeenFocused: _angular_core.WritableSignal<boolean>;
|
|
104
|
+
/** The key used to navigate to the previous item in the list. */
|
|
105
|
+
expandKey: _angular_core.Signal<"ArrowLeft" | "ArrowRight">;
|
|
106
|
+
/** The key used to navigate to the next item in the list. */
|
|
107
|
+
collapseKey: _angular_core.Signal<"ArrowLeft" | "ArrowRight">;
|
|
108
|
+
/** The ID of the popup associated with the combobox. */
|
|
109
|
+
popupId: _angular_core.Signal<string | null>;
|
|
110
|
+
/** The autocomplete behavior of the combobox. */
|
|
111
|
+
autocomplete: _angular_core.Signal<"both" | "list">;
|
|
112
|
+
/** The ARIA role of the popup associated with the combobox. */
|
|
113
|
+
hasPopup: _angular_core.Signal<"listbox" | "tree" | "grid" | "dialog" | null>;
|
|
114
|
+
/** Whether the combobox is read-only. */
|
|
115
|
+
readonly: _angular_core.Signal<true | null>;
|
|
116
|
+
/** Returns the listbox controls for the combobox. */
|
|
117
|
+
listControls: () => ComboboxListboxControls<T, V> | null | undefined;
|
|
118
|
+
/** Returns the tree controls for the combobox. */
|
|
119
|
+
treeControls: () => ComboboxTreeControls<T, V> | null;
|
|
120
|
+
/** The keydown event manager for the combobox. */
|
|
121
|
+
keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
|
|
122
|
+
/** The click event manager for the combobox. */
|
|
123
|
+
click: _angular_core.Signal<PointerEventManager<PointerEvent>>;
|
|
124
|
+
constructor(inputs: ComboboxInputs<T, V>);
|
|
125
|
+
/** Handles keydown events for the combobox. */
|
|
126
|
+
onKeydown(event: KeyboardEvent): void;
|
|
127
|
+
/** Handles click events for the combobox. */
|
|
128
|
+
onClick(event: MouseEvent): void;
|
|
129
|
+
/** Handles input events for the combobox. */
|
|
130
|
+
onInput(event: Event): void;
|
|
131
|
+
/** Handles focus in events for the combobox. */
|
|
132
|
+
onFocusIn(): void;
|
|
133
|
+
/** Handles focus out events for the combobox. */
|
|
134
|
+
onFocusOut(event: FocusEvent): void;
|
|
135
|
+
/** The first matching item in the combobox. */
|
|
136
|
+
firstMatch: _angular_core.Signal<T | undefined>;
|
|
137
|
+
/** Handles filtering logic for the combobox. */
|
|
138
|
+
onFilter(): void;
|
|
139
|
+
/** Highlights the currently selected item in the combobox. */
|
|
140
|
+
highlight(): void;
|
|
141
|
+
/** Closes the combobox. */
|
|
142
|
+
close(opts?: {
|
|
143
|
+
reset: boolean;
|
|
144
|
+
}): void;
|
|
145
|
+
/** Opens the combobox. */
|
|
146
|
+
open(nav?: {
|
|
147
|
+
first?: boolean;
|
|
148
|
+
last?: boolean;
|
|
149
|
+
selected?: boolean;
|
|
150
|
+
}): void;
|
|
151
|
+
/** Navigates to the next focusable item in the combobox popup. */
|
|
152
|
+
next(): void;
|
|
153
|
+
/** Navigates to the previous focusable item in the combobox popup. */
|
|
154
|
+
prev(): void;
|
|
155
|
+
/** Navigates to the first focusable item in the combobox popup. */
|
|
156
|
+
first(): void;
|
|
157
|
+
/** Navigates to the last focusable item in the combobox popup. */
|
|
158
|
+
last(): void;
|
|
159
|
+
/** Collapses the currently focused item in the combobox. */
|
|
160
|
+
collapseItem(): void;
|
|
161
|
+
/** Expands the currently focused item in the combobox. */
|
|
162
|
+
expandItem(): void;
|
|
163
|
+
/** Selects an item in the combobox popup. */
|
|
164
|
+
select(opts?: {
|
|
165
|
+
item?: T;
|
|
166
|
+
commit?: boolean;
|
|
167
|
+
close?: boolean;
|
|
168
|
+
}): void;
|
|
169
|
+
/** Updates the value of the input based on the currently selected item. */
|
|
170
|
+
commit(): void;
|
|
171
|
+
/** Navigates and handles additional actions based on filter mode. */
|
|
172
|
+
private _navigate;
|
|
173
|
+
}
|
|
174
|
+
declare class ComboboxDialogPattern {
|
|
175
|
+
readonly inputs: {
|
|
176
|
+
combobox: ComboboxPattern<any, any>;
|
|
177
|
+
element: SignalLike<HTMLDialogElement>;
|
|
178
|
+
id: SignalLike<string>;
|
|
179
|
+
};
|
|
180
|
+
id: () => string;
|
|
181
|
+
role: () => "dialog";
|
|
182
|
+
keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
|
|
183
|
+
constructor(inputs: {
|
|
184
|
+
combobox: ComboboxPattern<any, any>;
|
|
185
|
+
element: SignalLike<HTMLDialogElement>;
|
|
186
|
+
id: SignalLike<string>;
|
|
187
|
+
});
|
|
188
|
+
onKeydown(event: KeyboardEvent): void;
|
|
189
|
+
onClick(event: MouseEvent): void;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export { ComboboxDialogPattern, ComboboxPattern };
|
|
193
|
+
export type { ComboboxInputs, ComboboxListboxControls, ComboboxTreeControls };
|
package/types/_grid-chunk.d.ts
CHANGED
|
@@ -1,213 +1,6 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { WritableSignal, Signal } from '@angular/core';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Options that are applicable to all event handlers.
|
|
6
|
-
*
|
|
7
|
-
* This library has not yet had a need for stopPropagationImmediate.
|
|
8
|
-
*/
|
|
9
|
-
interface EventHandlerOptions {
|
|
10
|
-
stopPropagation: boolean;
|
|
11
|
-
preventDefault: boolean;
|
|
12
|
-
}
|
|
13
|
-
/** A basic event handler. */
|
|
14
|
-
type EventHandler<T extends Event> = (event: T) => void;
|
|
15
|
-
/** A function that determines whether an event is to be handled. */
|
|
16
|
-
type EventMatcher<T extends Event> = (event: T) => boolean;
|
|
17
|
-
/** A config that specifies how to handle a particular event. */
|
|
18
|
-
interface EventHandlerConfig<T extends Event> extends EventHandlerOptions {
|
|
19
|
-
matcher: EventMatcher<T>;
|
|
20
|
-
handler: EventHandler<T>;
|
|
21
|
-
}
|
|
22
|
-
/** Bit flag representation of the possible modifier keys that can be present on an event. */
|
|
23
|
-
declare enum Modifier {
|
|
24
|
-
None = 0,
|
|
25
|
-
Ctrl = 1,
|
|
26
|
-
Shift = 2,
|
|
27
|
-
Alt = 4,
|
|
28
|
-
Meta = 8,
|
|
29
|
-
Any = "Any"
|
|
30
|
-
}
|
|
31
|
-
type ModifierInputs = Modifier | Modifier[];
|
|
32
|
-
/**
|
|
33
|
-
* Abstract base class for all event managers.
|
|
34
|
-
*
|
|
35
|
-
* Event managers are designed to normalize how event handlers are authored and create a safety net
|
|
36
|
-
* for common event handling gotchas like remembering to call preventDefault or stopPropagation.
|
|
37
|
-
*/
|
|
38
|
-
declare abstract class EventManager<T extends Event> {
|
|
39
|
-
protected configs: EventHandlerConfig<T>[];
|
|
40
|
-
abstract options: EventHandlerOptions;
|
|
41
|
-
/** Runs the handlers that match with the given event. */
|
|
42
|
-
handle(event: T): void;
|
|
43
|
-
/** Configures the event manager to handle specific events. (See subclasses for more). */
|
|
44
|
-
abstract on(...args: [...unknown[]]): this;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
type SignalLike<T> = () => T;
|
|
48
|
-
interface WritableSignalLike<T> extends SignalLike<T> {
|
|
49
|
-
set(value: T): void;
|
|
50
|
-
update(updateFn: (value: T) => T): void;
|
|
51
|
-
}
|
|
52
|
-
/** Converts a getter setter style signal to a WritableSignalLike. */
|
|
53
|
-
declare function convertGetterSetterToWritableSignalLike<T>(getter: () => T, setter: (v: T) => void): WritableSignalLike<T>;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Used to represent a keycode.
|
|
57
|
-
*
|
|
58
|
-
* This is used to match whether an events keycode should be handled. The ability to match using a
|
|
59
|
-
* string, SignalLike, or Regexp gives us more flexibility when authoring event handlers.
|
|
60
|
-
*/
|
|
61
|
-
type KeyCode = string | SignalLike<string> | RegExp;
|
|
62
|
-
/**
|
|
63
|
-
* An event manager that is specialized for handling keyboard events. By default this manager stops
|
|
64
|
-
* propagation and prevents default on all events it handles.
|
|
65
|
-
*/
|
|
66
|
-
declare class KeyboardEventManager<T extends KeyboardEvent> extends EventManager<T> {
|
|
67
|
-
options: EventHandlerOptions;
|
|
68
|
-
/** Configures this event manager to handle events with a specific key and no modifiers. */
|
|
69
|
-
on(key: KeyCode, handler: EventHandler<T>, options?: Partial<EventHandlerOptions>): this;
|
|
70
|
-
/** Configures this event manager to handle events with a specific modifer and key combination. */
|
|
71
|
-
on(modifiers: ModifierInputs, key: KeyCode, handler: EventHandler<T>, options?: Partial<EventHandlerOptions>): this;
|
|
72
|
-
private _normalizeInputs;
|
|
73
|
-
private _isMatch;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The different mouse buttons that may appear on a pointer event.
|
|
78
|
-
*/
|
|
79
|
-
declare enum MouseButton {
|
|
80
|
-
Main = 0,
|
|
81
|
-
Auxiliary = 1,
|
|
82
|
-
Secondary = 2
|
|
83
|
-
}
|
|
84
|
-
/** An event manager that is specialized for handling pointer events. */
|
|
85
|
-
declare class PointerEventManager<T extends PointerEvent> extends EventManager<T> {
|
|
86
|
-
options: EventHandlerOptions;
|
|
87
|
-
/**
|
|
88
|
-
* Configures this event manager to handle events with a specific modifer and mouse button
|
|
89
|
-
* combination.
|
|
90
|
-
*/
|
|
91
|
-
on(button: MouseButton, modifiers: ModifierInputs, handler: EventHandler<T>): this;
|
|
92
|
-
/**
|
|
93
|
-
* Configures this event manager to handle events with a specific mouse button and no modifiers.
|
|
94
|
-
*/
|
|
95
|
-
on(modifiers: ModifierInputs, handler: EventHandler<T>): this;
|
|
96
|
-
/**
|
|
97
|
-
* Configures this event manager to handle events with the main mouse button and no modifiers.
|
|
98
|
-
*
|
|
99
|
-
* @param handler The handler function
|
|
100
|
-
* @param options Options for whether to stop propagation or prevent default.
|
|
101
|
-
*/
|
|
102
|
-
on(handler: EventHandler<T>): this;
|
|
103
|
-
private _normalizeInputs;
|
|
104
|
-
_isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs): boolean;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** Represents an item in a collection, such as a listbox option, than may receive focus. */
|
|
108
|
-
interface ListFocusItem {
|
|
109
|
-
/** A unique identifier for the item. */
|
|
110
|
-
id: SignalLike<string>;
|
|
111
|
-
/** The html element that should receive focus. */
|
|
112
|
-
element: SignalLike<HTMLElement | undefined>;
|
|
113
|
-
/** Whether an item is disabled. */
|
|
114
|
-
disabled: SignalLike<boolean>;
|
|
115
|
-
/** The index of the item in the list. */
|
|
116
|
-
index: SignalLike<number>;
|
|
117
|
-
}
|
|
118
|
-
/** Represents the required inputs for a collection that contains focusable items. */
|
|
119
|
-
interface ListFocusInputs<T extends ListFocusItem> {
|
|
120
|
-
/** The focus strategy used by the list. */
|
|
121
|
-
focusMode: SignalLike<'roving' | 'activedescendant'>;
|
|
122
|
-
/** Whether the list is disabled. */
|
|
123
|
-
disabled: SignalLike<boolean>;
|
|
124
|
-
/** The items in the list. */
|
|
125
|
-
items: SignalLike<T[]>;
|
|
126
|
-
/** The active item. */
|
|
127
|
-
activeItem: WritableSignalLike<T | undefined>;
|
|
128
|
-
/** Whether disabled items in the list should be focusable. */
|
|
129
|
-
softDisabled: SignalLike<boolean>;
|
|
130
|
-
element: SignalLike<HTMLElement | undefined>;
|
|
131
|
-
}
|
|
132
|
-
/** Controls focus for a list of items. */
|
|
133
|
-
declare class ListFocus<T extends ListFocusItem> {
|
|
134
|
-
readonly inputs: ListFocusInputs<T>;
|
|
135
|
-
/** The last item that was active. */
|
|
136
|
-
prevActiveItem: _angular_core.WritableSignal<T | undefined>;
|
|
137
|
-
/** The index of the last item that was active. */
|
|
138
|
-
prevActiveIndex: _angular_core.Signal<number>;
|
|
139
|
-
/** The current active index in the list. */
|
|
140
|
-
activeIndex: _angular_core.Signal<number>;
|
|
141
|
-
constructor(inputs: ListFocusInputs<T>);
|
|
142
|
-
/** Whether the list is in a disabled state. */
|
|
143
|
-
isListDisabled(): boolean;
|
|
144
|
-
/** The id of the current active item. */
|
|
145
|
-
getActiveDescendant(): string | undefined;
|
|
146
|
-
/** The tab index for the list. */
|
|
147
|
-
getListTabIndex(): -1 | 0;
|
|
148
|
-
/** Returns the tab index for the given item. */
|
|
149
|
-
getItemTabIndex(item: T): -1 | 0;
|
|
150
|
-
/** Moves focus to the given item if it is focusable. */
|
|
151
|
-
focus(item: T, opts?: {
|
|
152
|
-
focusElement?: boolean;
|
|
153
|
-
}): boolean;
|
|
154
|
-
/** Returns true if the given item can be navigated to. */
|
|
155
|
-
isFocusable(item: T): boolean;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/** Represents an item in a collection, such as a listbox option, than can be navigated to. */
|
|
159
|
-
interface ListNavigationItem extends ListFocusItem {
|
|
160
|
-
}
|
|
161
|
-
/** Represents the required inputs for a collection that has navigable items. */
|
|
162
|
-
interface ListNavigationInputs<T extends ListNavigationItem> extends ListFocusInputs<T> {
|
|
163
|
-
/** Whether focus should wrap when navigating. */
|
|
164
|
-
wrap: SignalLike<boolean>;
|
|
165
|
-
/** Whether the list is vertically or horizontally oriented. */
|
|
166
|
-
orientation: SignalLike<'vertical' | 'horizontal'>;
|
|
167
|
-
/** The direction that text is read based on the users locale. */
|
|
168
|
-
textDirection: SignalLike<'rtl' | 'ltr'>;
|
|
169
|
-
}
|
|
170
|
-
/** Controls navigation for a list of items. */
|
|
171
|
-
declare class ListNavigation<T extends ListNavigationItem> {
|
|
172
|
-
readonly inputs: ListNavigationInputs<T> & {
|
|
173
|
-
focusManager: ListFocus<T>;
|
|
174
|
-
};
|
|
175
|
-
constructor(inputs: ListNavigationInputs<T> & {
|
|
176
|
-
focusManager: ListFocus<T>;
|
|
177
|
-
});
|
|
178
|
-
/** Navigates to the given item. */
|
|
179
|
-
goto(item?: T, opts?: {
|
|
180
|
-
focusElement?: boolean;
|
|
181
|
-
}): boolean;
|
|
182
|
-
/** Navigates to the next item in the list. */
|
|
183
|
-
next(opts?: {
|
|
184
|
-
focusElement?: boolean;
|
|
185
|
-
}): boolean;
|
|
186
|
-
/** Peeks the next item in the list. */
|
|
187
|
-
peekNext(): T | undefined;
|
|
188
|
-
/** Navigates to the previous item in the list. */
|
|
189
|
-
prev(opts?: {
|
|
190
|
-
focusElement?: boolean;
|
|
191
|
-
}): boolean;
|
|
192
|
-
/** Peeks the previous item in the list. */
|
|
193
|
-
peekPrev(): T | undefined;
|
|
194
|
-
/** Navigates to the first item in the list. */
|
|
195
|
-
first(opts?: {
|
|
196
|
-
focusElement?: boolean;
|
|
197
|
-
}): boolean;
|
|
198
|
-
/** Navigates to the last item in the list. */
|
|
199
|
-
last(opts?: {
|
|
200
|
-
focusElement?: boolean;
|
|
201
|
-
}): boolean;
|
|
202
|
-
/** Gets the first focusable item from the given list of items. */
|
|
203
|
-
peekFirst(items?: T[]): T | undefined;
|
|
204
|
-
/** Gets the last focusable item from the given list of items. */
|
|
205
|
-
peekLast(items?: T[]): T | undefined;
|
|
206
|
-
/** Advances to the next or previous focusable item in the list based on the given delta. */
|
|
207
|
-
private _advance;
|
|
208
|
-
/** Peeks the next or previous focusable item in the list based on the given delta. */
|
|
209
|
-
private _peek;
|
|
210
|
-
}
|
|
3
|
+
import { SignalLike, WritableSignalLike, ListNavigationItem, KeyboardEventManager, ListNavigationInputs, ListFocus, ListNavigation, PointerEventManager } from './_list-navigation-chunk.js';
|
|
211
4
|
|
|
212
5
|
/** Represents coordinates in a grid. */
|
|
213
6
|
interface RowCol {
|
|
@@ -785,5 +578,5 @@ declare class GridPattern {
|
|
|
785
578
|
focusEffect(): void;
|
|
786
579
|
}
|
|
787
580
|
|
|
788
|
-
export { GridCellPattern, GridCellWidgetPattern, GridPattern, GridRowPattern
|
|
789
|
-
export type { GridCellInputs, GridCellWidgetInputs, GridInputs, GridRowInputs
|
|
581
|
+
export { GridCellPattern, GridCellWidgetPattern, GridPattern, GridRowPattern };
|
|
582
|
+
export type { GridCellInputs, GridCellWidgetInputs, GridInputs, GridRowInputs };
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ListFocusItem, SignalLike, ListFocusInputs, WritableSignalLike, ListFocus, ListNavigationItem, ListNavigationInputs, ListNavigation } from './_list-navigation-chunk.js';
|
|
3
|
+
|
|
4
|
+
/** Represents an item in a collection, such as a listbox option, that can be selected. */
|
|
5
|
+
interface ListSelectionItem<V> extends ListFocusItem {
|
|
6
|
+
/** The value of the item. */
|
|
7
|
+
value: SignalLike<V>;
|
|
8
|
+
/** Whether the item is selectable. */
|
|
9
|
+
selectable: SignalLike<boolean>;
|
|
10
|
+
}
|
|
11
|
+
/** Represents the required inputs for a collection that contains selectable items. */
|
|
12
|
+
interface ListSelectionInputs<T extends ListSelectionItem<V>, V> extends ListFocusInputs<T> {
|
|
13
|
+
/** Whether multiple items in the list can be selected at once. */
|
|
14
|
+
multi: SignalLike<boolean>;
|
|
15
|
+
/** The current value of the list selection. */
|
|
16
|
+
values: WritableSignalLike<V[]>;
|
|
17
|
+
/** The selection strategy used by the list. */
|
|
18
|
+
selectionMode: SignalLike<'follow' | 'explicit'>;
|
|
19
|
+
}
|
|
20
|
+
/** Controls selection for a list of items. */
|
|
21
|
+
declare class ListSelection<T extends ListSelectionItem<V>, V> {
|
|
22
|
+
readonly inputs: ListSelectionInputs<T, V> & {
|
|
23
|
+
focusManager: ListFocus<T>;
|
|
24
|
+
};
|
|
25
|
+
/** The start index to use for range selection. */
|
|
26
|
+
rangeStartIndex: _angular_core.WritableSignal<number>;
|
|
27
|
+
/** The end index to use for range selection. */
|
|
28
|
+
rangeEndIndex: _angular_core.WritableSignal<number>;
|
|
29
|
+
/** The currently selected items. */
|
|
30
|
+
selectedItems: _angular_core.Signal<T[]>;
|
|
31
|
+
constructor(inputs: ListSelectionInputs<T, V> & {
|
|
32
|
+
focusManager: ListFocus<T>;
|
|
33
|
+
});
|
|
34
|
+
/** Selects the item at the current active index. */
|
|
35
|
+
select(item?: ListSelectionItem<V>, opts?: {
|
|
36
|
+
anchor: boolean;
|
|
37
|
+
}): void;
|
|
38
|
+
/** Deselects the item at the current active index. */
|
|
39
|
+
deselect(item?: ListSelectionItem<V>): void;
|
|
40
|
+
/** Toggles the item at the current active index. */
|
|
41
|
+
toggle(item?: ListSelectionItem<V>): void;
|
|
42
|
+
/** Toggles only the item at the current active index. */
|
|
43
|
+
toggleOne(): void;
|
|
44
|
+
/** Selects all items in the list. */
|
|
45
|
+
selectAll(): void;
|
|
46
|
+
/** Deselects all items in the list. */
|
|
47
|
+
deselectAll(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Selects all items in the list or deselects all
|
|
50
|
+
* items in the list if all items are already selected.
|
|
51
|
+
*/
|
|
52
|
+
toggleAll(): void;
|
|
53
|
+
/** Sets the selection to only the current active item. */
|
|
54
|
+
selectOne(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Selects all items in the list up to the anchor item.
|
|
57
|
+
*
|
|
58
|
+
* Deselects all items that were previously within the
|
|
59
|
+
* selected range that are now outside of the selected range
|
|
60
|
+
*/
|
|
61
|
+
selectRange(opts?: {
|
|
62
|
+
anchor: boolean;
|
|
63
|
+
}): void;
|
|
64
|
+
/** Marks the given index as the start of a range selection. */
|
|
65
|
+
beginRangeSelection(index?: number): void;
|
|
66
|
+
/** Returns the items in the list starting from the given index. */
|
|
67
|
+
private _getItemsFromIndex;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Represents an item in a collection, such as a listbox option, than can be navigated to by
|
|
72
|
+
* typeahead.
|
|
73
|
+
*/
|
|
74
|
+
interface ListTypeaheadItem extends ListFocusItem {
|
|
75
|
+
/** The text used by the typeahead search. */
|
|
76
|
+
searchTerm: SignalLike<string>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Represents the required inputs for a collection that contains items that can be navigated to by
|
|
80
|
+
* typeahead.
|
|
81
|
+
*/
|
|
82
|
+
interface ListTypeaheadInputs<T extends ListTypeaheadItem> extends ListFocusInputs<T> {
|
|
83
|
+
/** The amount of time before the typeahead search is reset. */
|
|
84
|
+
typeaheadDelay: SignalLike<number>;
|
|
85
|
+
}
|
|
86
|
+
/** Controls typeahead for a list of items. */
|
|
87
|
+
declare class ListTypeahead<T extends ListTypeaheadItem> {
|
|
88
|
+
readonly inputs: ListTypeaheadInputs<T> & {
|
|
89
|
+
focusManager: ListFocus<T>;
|
|
90
|
+
};
|
|
91
|
+
/** A reference to the timeout for resetting the typeahead search. */
|
|
92
|
+
timeout?: ReturnType<typeof setTimeout> | undefined;
|
|
93
|
+
/** The focus controller of the parent list. */
|
|
94
|
+
focusManager: ListFocus<T>;
|
|
95
|
+
/** Whether the user is actively typing a typeahead search query. */
|
|
96
|
+
isTyping: _angular_core.Signal<boolean>;
|
|
97
|
+
/** Keeps track of the characters that typeahead search is being called with. */
|
|
98
|
+
private _query;
|
|
99
|
+
/** The index where that the typeahead search was initiated from. */
|
|
100
|
+
private _startIndex;
|
|
101
|
+
constructor(inputs: ListTypeaheadInputs<T> & {
|
|
102
|
+
focusManager: ListFocus<T>;
|
|
103
|
+
});
|
|
104
|
+
/** Performs a typeahead search, appending the given character to the search string. */
|
|
105
|
+
search(char: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Returns the first item whose search term matches the
|
|
108
|
+
* current query starting from the the current anchor index.
|
|
109
|
+
*/
|
|
110
|
+
private _getItem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The operations that the list can perform after navigation. */
|
|
114
|
+
interface NavOptions {
|
|
115
|
+
toggle?: boolean;
|
|
116
|
+
select?: boolean;
|
|
117
|
+
selectOne?: boolean;
|
|
118
|
+
selectRange?: boolean;
|
|
119
|
+
anchor?: boolean;
|
|
120
|
+
focusElement?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/** Represents an item in the list. */
|
|
123
|
+
type ListItem<V> = ListTypeaheadItem & ListNavigationItem & ListSelectionItem<V> & ListFocusItem;
|
|
124
|
+
/** The necessary inputs for the list behavior. */
|
|
125
|
+
type ListInputs<T extends ListItem<V>, V> = ListFocusInputs<T> & ListNavigationInputs<T> & ListSelectionInputs<T, V> & ListTypeaheadInputs<T>;
|
|
126
|
+
/** Controls the state of a list. */
|
|
127
|
+
declare class List<T extends ListItem<V>, V> {
|
|
128
|
+
readonly inputs: ListInputs<T, V>;
|
|
129
|
+
/** Controls navigation for the list. */
|
|
130
|
+
navigationBehavior: ListNavigation<T>;
|
|
131
|
+
/** Controls selection for the list. */
|
|
132
|
+
selectionBehavior: ListSelection<T, V>;
|
|
133
|
+
/** Controls typeahead for the list. */
|
|
134
|
+
typeaheadBehavior: ListTypeahead<T>;
|
|
135
|
+
/** Controls focus for the list. */
|
|
136
|
+
focusBehavior: ListFocus<T>;
|
|
137
|
+
/** Whether the list is disabled. */
|
|
138
|
+
disabled: _angular_core.Signal<boolean>;
|
|
139
|
+
/** The id of the current active item. */
|
|
140
|
+
activeDescendant: _angular_core.Signal<string | undefined>;
|
|
141
|
+
/** The tab index of the list. */
|
|
142
|
+
tabIndex: _angular_core.Signal<0 | -1>;
|
|
143
|
+
/** The index of the currently active item in the list. */
|
|
144
|
+
activeIndex: _angular_core.Signal<number>;
|
|
145
|
+
/**
|
|
146
|
+
* The uncommitted index for selecting a range of options.
|
|
147
|
+
*
|
|
148
|
+
* NOTE: This is subtly distinct from the "rangeStartIndex" in the ListSelection behavior.
|
|
149
|
+
* The anchorIndex does not necessarily represent the start of a range, but represents the most
|
|
150
|
+
* recent index where the user showed intent to begin a range selection. Usually, this is wherever
|
|
151
|
+
* the user most recently pressed the "Shift" key, but if the user presses shift + space to select
|
|
152
|
+
* from the anchor, the user is not intending to start a new range from this index.
|
|
153
|
+
*
|
|
154
|
+
* In other words, "rangeStartIndex" is only set when a user commits to starting a range selection
|
|
155
|
+
* while "anchorIndex" is set whenever a user indicates they may be starting a range selection.
|
|
156
|
+
*/
|
|
157
|
+
private _anchorIndex;
|
|
158
|
+
/** Whether the list should wrap. Used to disable wrapping while range selecting. */
|
|
159
|
+
private _wrap;
|
|
160
|
+
constructor(inputs: ListInputs<T, V>);
|
|
161
|
+
/** Returns the tab index for the given item. */
|
|
162
|
+
getItemTabindex(item: T): 0 | -1;
|
|
163
|
+
/** Navigates to the first option in the list. */
|
|
164
|
+
first(opts?: NavOptions): void;
|
|
165
|
+
/** Navigates to the last option in the list. */
|
|
166
|
+
last(opts?: NavOptions): void;
|
|
167
|
+
/** Navigates to the next option in the list. */
|
|
168
|
+
next(opts?: NavOptions): void;
|
|
169
|
+
/** Navigates to the previous option in the list. */
|
|
170
|
+
prev(opts?: NavOptions): void;
|
|
171
|
+
/** Navigates to the given item in the list. */
|
|
172
|
+
goto(item: T, opts?: NavOptions): void;
|
|
173
|
+
/** Removes focus from the list. */
|
|
174
|
+
unfocus(): void;
|
|
175
|
+
/** Marks the given index as the potential start of a range selection. */
|
|
176
|
+
anchor(index: number): void;
|
|
177
|
+
/** Handles typeahead search navigation for the list. */
|
|
178
|
+
search(char: string, opts?: NavOptions): void;
|
|
179
|
+
/** Checks if the list is currently typing for typeahead search. */
|
|
180
|
+
isTyping(): boolean;
|
|
181
|
+
/** Selects the currently active item in the list. */
|
|
182
|
+
select(item?: T): void;
|
|
183
|
+
/** Sets the selection to only the current active item. */
|
|
184
|
+
selectOne(): void;
|
|
185
|
+
/** Deselects the currently active item in the list. */
|
|
186
|
+
deselect(item?: T): void;
|
|
187
|
+
/** Deselects all items in the list. */
|
|
188
|
+
deselectAll(): void;
|
|
189
|
+
/** Toggles the currently active item in the list. */
|
|
190
|
+
toggle(item?: T): void;
|
|
191
|
+
/** Toggles the currently active item in the list, deselecting all other items. */
|
|
192
|
+
toggleOne(): void;
|
|
193
|
+
/** Toggles the selection of all items in the list. */
|
|
194
|
+
toggleAll(): void;
|
|
195
|
+
/** Checks if the given item is able to receive focus. */
|
|
196
|
+
isFocusable(item: T): boolean;
|
|
197
|
+
/** Handles updating selection for the list. */
|
|
198
|
+
updateSelection(opts?: NavOptions): void;
|
|
199
|
+
/**
|
|
200
|
+
* Safely performs a navigation operation.
|
|
201
|
+
*
|
|
202
|
+
* Handles conditionally disabling wrapping for when a navigation
|
|
203
|
+
* operation is occurring while the user is selecting a range of options.
|
|
204
|
+
*
|
|
205
|
+
* Handles boilerplate calling of focus & selection operations. Also ensures these
|
|
206
|
+
* additional operations are only called if the navigation operation moved focus to a new option.
|
|
207
|
+
*/
|
|
208
|
+
private _navigate;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export { List };
|
|
212
|
+
export type { ListInputs, ListItem };
|