@angular/aria 21.0.3 → 21.1.0-next.1
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/_adev_assets/aria-accordion.json +743 -0
- package/_adev_assets/aria-combobox.json +603 -0
- package/_adev_assets/aria-grid.json +893 -0
- package/_adev_assets/aria-listbox.json +540 -0
- package/_adev_assets/aria-menu.json +1049 -0
- package/_adev_assets/aria-tabs.json +880 -0
- package/_adev_assets/aria-toolbar.json +545 -0
- package/_adev_assets/aria-tree.json +853 -0
- package/fesm2022/_widget-chunk.mjs +246 -4
- package/fesm2022/_widget-chunk.mjs.map +1 -1
- package/fesm2022/accordion.mjs +4 -17
- 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 -96
- package/fesm2022/combobox.mjs.map +1 -1
- package/fesm2022/grid.mjs +201 -225
- package/fesm2022/grid.mjs.map +1 -1
- package/fesm2022/listbox.mjs +161 -173
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +238 -256
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/private.mjs +932 -7
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/tabs.mjs +168 -182
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +3 -15
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tree.mjs +2 -4
- package/fesm2022/tree.mjs.map +1 -1
- package/package.json +3 -3
- package/types/_grid-chunk.d.ts +210 -3
- package/types/accordion.d.ts +49 -52
- package/types/combobox.d.ts +111 -25
- package/types/grid.d.ts +32 -37
- package/types/listbox.d.ts +5 -8
- package/types/menu.d.ts +113 -113
- package/types/private.d.ts +498 -10
- package/types/tabs.d.ts +84 -89
- package/types/toolbar.d.ts +66 -69
- package/types/tree.d.ts +103 -106
- package/fesm2022/_combobox-chunk.mjs +0 -425
- package/fesm2022/_combobox-chunk.mjs.map +0 -1
- package/fesm2022/_combobox-listbox-chunk.mjs +0 -522
- package/fesm2022/_combobox-listbox-chunk.mjs.map +0 -1
- package/fesm2022/_combobox-popup-chunk.mjs +0 -46
- package/fesm2022/_combobox-popup-chunk.mjs.map +0 -1
- package/fesm2022/_list-navigation-chunk.mjs +0 -116
- package/fesm2022/_list-navigation-chunk.mjs.map +0 -1
- package/fesm2022/_pointer-event-manager-chunk.mjs +0 -134
- package/fesm2022/_pointer-event-manager-chunk.mjs.map +0 -1
- package/types/_combobox-chunk.d.ts +0 -98
- package/types/_combobox-chunk.d2.ts +0 -193
- package/types/_list-chunk.d.ts +0 -212
- package/types/_list-navigation-chunk.d.ts +0 -212
- package/types/_listbox-chunk.d.ts +0 -106
package/types/_list-chunk.d.ts
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
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 };
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import * as _angular_core from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Options that are applicable to all event handlers.
|
|
5
|
-
*
|
|
6
|
-
* This library has not yet had a need for stopPropagationImmediate.
|
|
7
|
-
*/
|
|
8
|
-
interface EventHandlerOptions {
|
|
9
|
-
stopPropagation: boolean;
|
|
10
|
-
preventDefault: boolean;
|
|
11
|
-
}
|
|
12
|
-
/** A basic event handler. */
|
|
13
|
-
type EventHandler<T extends Event> = (event: T) => void;
|
|
14
|
-
/** A function that determines whether an event is to be handled. */
|
|
15
|
-
type EventMatcher<T extends Event> = (event: T) => boolean;
|
|
16
|
-
/** A config that specifies how to handle a particular event. */
|
|
17
|
-
interface EventHandlerConfig<T extends Event> extends EventHandlerOptions {
|
|
18
|
-
matcher: EventMatcher<T>;
|
|
19
|
-
handler: EventHandler<T>;
|
|
20
|
-
}
|
|
21
|
-
/** Bit flag representation of the possible modifier keys that can be present on an event. */
|
|
22
|
-
declare enum Modifier {
|
|
23
|
-
None = 0,
|
|
24
|
-
Ctrl = 1,
|
|
25
|
-
Shift = 2,
|
|
26
|
-
Alt = 4,
|
|
27
|
-
Meta = 8,
|
|
28
|
-
Any = "Any"
|
|
29
|
-
}
|
|
30
|
-
type ModifierInputs = Modifier | Modifier[];
|
|
31
|
-
/**
|
|
32
|
-
* Abstract base class for all event managers.
|
|
33
|
-
*
|
|
34
|
-
* Event managers are designed to normalize how event handlers are authored and create a safety net
|
|
35
|
-
* for common event handling gotchas like remembering to call preventDefault or stopPropagation.
|
|
36
|
-
*/
|
|
37
|
-
declare abstract class EventManager<T extends Event> {
|
|
38
|
-
protected configs: EventHandlerConfig<T>[];
|
|
39
|
-
abstract options: EventHandlerOptions;
|
|
40
|
-
/** Runs the handlers that match with the given event. */
|
|
41
|
-
handle(event: T): void;
|
|
42
|
-
/** Configures the event manager to handle specific events. (See subclasses for more). */
|
|
43
|
-
abstract on(...args: [...unknown[]]): this;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
type SignalLike<T> = () => T;
|
|
47
|
-
interface WritableSignalLike<T> extends SignalLike<T> {
|
|
48
|
-
set(value: T): void;
|
|
49
|
-
update(updateFn: (value: T) => T): void;
|
|
50
|
-
}
|
|
51
|
-
/** Converts a getter setter style signal to a WritableSignalLike. */
|
|
52
|
-
declare function convertGetterSetterToWritableSignalLike<T>(getter: () => T, setter: (v: T) => void): WritableSignalLike<T>;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Used to represent a keycode.
|
|
56
|
-
*
|
|
57
|
-
* This is used to match whether an events keycode should be handled. The ability to match using a
|
|
58
|
-
* string, SignalLike, or Regexp gives us more flexibility when authoring event handlers.
|
|
59
|
-
*/
|
|
60
|
-
type KeyCode = string | SignalLike<string> | RegExp;
|
|
61
|
-
/**
|
|
62
|
-
* An event manager that is specialized for handling keyboard events. By default this manager stops
|
|
63
|
-
* propagation and prevents default on all events it handles.
|
|
64
|
-
*/
|
|
65
|
-
declare class KeyboardEventManager<T extends KeyboardEvent> extends EventManager<T> {
|
|
66
|
-
options: EventHandlerOptions;
|
|
67
|
-
/** Configures this event manager to handle events with a specific key and no modifiers. */
|
|
68
|
-
on(key: KeyCode, handler: EventHandler<T>, options?: Partial<EventHandlerOptions>): this;
|
|
69
|
-
/** Configures this event manager to handle events with a specific modifer and key combination. */
|
|
70
|
-
on(modifiers: ModifierInputs, key: KeyCode, handler: EventHandler<T>, options?: Partial<EventHandlerOptions>): this;
|
|
71
|
-
private _normalizeInputs;
|
|
72
|
-
private _isMatch;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* The different mouse buttons that may appear on a pointer event.
|
|
77
|
-
*/
|
|
78
|
-
declare enum MouseButton {
|
|
79
|
-
Main = 0,
|
|
80
|
-
Auxiliary = 1,
|
|
81
|
-
Secondary = 2
|
|
82
|
-
}
|
|
83
|
-
/** An event manager that is specialized for handling pointer events. */
|
|
84
|
-
declare class PointerEventManager<T extends PointerEvent> extends EventManager<T> {
|
|
85
|
-
options: EventHandlerOptions;
|
|
86
|
-
/**
|
|
87
|
-
* Configures this event manager to handle events with a specific modifer and mouse button
|
|
88
|
-
* combination.
|
|
89
|
-
*/
|
|
90
|
-
on(button: MouseButton, modifiers: ModifierInputs, handler: EventHandler<T>): this;
|
|
91
|
-
/**
|
|
92
|
-
* Configures this event manager to handle events with a specific mouse button and no modifiers.
|
|
93
|
-
*/
|
|
94
|
-
on(modifiers: ModifierInputs, handler: EventHandler<T>): this;
|
|
95
|
-
/**
|
|
96
|
-
* Configures this event manager to handle events with the main mouse button and no modifiers.
|
|
97
|
-
*
|
|
98
|
-
* @param handler The handler function
|
|
99
|
-
* @param options Options for whether to stop propagation or prevent default.
|
|
100
|
-
*/
|
|
101
|
-
on(handler: EventHandler<T>): this;
|
|
102
|
-
private _normalizeInputs;
|
|
103
|
-
_isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs): boolean;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/** Represents an item in a collection, such as a listbox option, than may receive focus. */
|
|
107
|
-
interface ListFocusItem {
|
|
108
|
-
/** A unique identifier for the item. */
|
|
109
|
-
id: SignalLike<string>;
|
|
110
|
-
/** The html element that should receive focus. */
|
|
111
|
-
element: SignalLike<HTMLElement | undefined>;
|
|
112
|
-
/** Whether an item is disabled. */
|
|
113
|
-
disabled: SignalLike<boolean>;
|
|
114
|
-
/** The index of the item in the list. */
|
|
115
|
-
index: SignalLike<number>;
|
|
116
|
-
}
|
|
117
|
-
/** Represents the required inputs for a collection that contains focusable items. */
|
|
118
|
-
interface ListFocusInputs<T extends ListFocusItem> {
|
|
119
|
-
/** The focus strategy used by the list. */
|
|
120
|
-
focusMode: SignalLike<'roving' | 'activedescendant'>;
|
|
121
|
-
/** Whether the list is disabled. */
|
|
122
|
-
disabled: SignalLike<boolean>;
|
|
123
|
-
/** The items in the list. */
|
|
124
|
-
items: SignalLike<T[]>;
|
|
125
|
-
/** The active item. */
|
|
126
|
-
activeItem: WritableSignalLike<T | undefined>;
|
|
127
|
-
/** Whether disabled items in the list should be focusable. */
|
|
128
|
-
softDisabled: SignalLike<boolean>;
|
|
129
|
-
element: SignalLike<HTMLElement | undefined>;
|
|
130
|
-
}
|
|
131
|
-
/** Controls focus for a list of items. */
|
|
132
|
-
declare class ListFocus<T extends ListFocusItem> {
|
|
133
|
-
readonly inputs: ListFocusInputs<T>;
|
|
134
|
-
/** The last item that was active. */
|
|
135
|
-
prevActiveItem: _angular_core.WritableSignal<T | undefined>;
|
|
136
|
-
/** The index of the last item that was active. */
|
|
137
|
-
prevActiveIndex: _angular_core.Signal<number>;
|
|
138
|
-
/** The current active index in the list. */
|
|
139
|
-
activeIndex: _angular_core.Signal<number>;
|
|
140
|
-
constructor(inputs: ListFocusInputs<T>);
|
|
141
|
-
/** Whether the list is in a disabled state. */
|
|
142
|
-
isListDisabled(): boolean;
|
|
143
|
-
/** The id of the current active item. */
|
|
144
|
-
getActiveDescendant(): string | undefined;
|
|
145
|
-
/** The tab index for the list. */
|
|
146
|
-
getListTabIndex(): -1 | 0;
|
|
147
|
-
/** Returns the tab index for the given item. */
|
|
148
|
-
getItemTabIndex(item: T): -1 | 0;
|
|
149
|
-
/** Moves focus to the given item if it is focusable. */
|
|
150
|
-
focus(item: T, opts?: {
|
|
151
|
-
focusElement?: boolean;
|
|
152
|
-
}): boolean;
|
|
153
|
-
/** Returns true if the given item can be navigated to. */
|
|
154
|
-
isFocusable(item: T): boolean;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** Represents an item in a collection, such as a listbox option, than can be navigated to. */
|
|
158
|
-
interface ListNavigationItem extends ListFocusItem {
|
|
159
|
-
}
|
|
160
|
-
/** Represents the required inputs for a collection that has navigable items. */
|
|
161
|
-
interface ListNavigationInputs<T extends ListNavigationItem> extends ListFocusInputs<T> {
|
|
162
|
-
/** Whether focus should wrap when navigating. */
|
|
163
|
-
wrap: SignalLike<boolean>;
|
|
164
|
-
/** Whether the list is vertically or horizontally oriented. */
|
|
165
|
-
orientation: SignalLike<'vertical' | 'horizontal'>;
|
|
166
|
-
/** The direction that text is read based on the users locale. */
|
|
167
|
-
textDirection: SignalLike<'rtl' | 'ltr'>;
|
|
168
|
-
}
|
|
169
|
-
/** Controls navigation for a list of items. */
|
|
170
|
-
declare class ListNavigation<T extends ListNavigationItem> {
|
|
171
|
-
readonly inputs: ListNavigationInputs<T> & {
|
|
172
|
-
focusManager: ListFocus<T>;
|
|
173
|
-
};
|
|
174
|
-
constructor(inputs: ListNavigationInputs<T> & {
|
|
175
|
-
focusManager: ListFocus<T>;
|
|
176
|
-
});
|
|
177
|
-
/** Navigates to the given item. */
|
|
178
|
-
goto(item?: T, opts?: {
|
|
179
|
-
focusElement?: boolean;
|
|
180
|
-
}): boolean;
|
|
181
|
-
/** Navigates to the next item in the list. */
|
|
182
|
-
next(opts?: {
|
|
183
|
-
focusElement?: boolean;
|
|
184
|
-
}): boolean;
|
|
185
|
-
/** Peeks the next item in the list. */
|
|
186
|
-
peekNext(): T | undefined;
|
|
187
|
-
/** Navigates to the previous item in the list. */
|
|
188
|
-
prev(opts?: {
|
|
189
|
-
focusElement?: boolean;
|
|
190
|
-
}): boolean;
|
|
191
|
-
/** Peeks the previous item in the list. */
|
|
192
|
-
peekPrev(): T | undefined;
|
|
193
|
-
/** Navigates to the first item in the list. */
|
|
194
|
-
first(opts?: {
|
|
195
|
-
focusElement?: boolean;
|
|
196
|
-
}): boolean;
|
|
197
|
-
/** Navigates to the last item in the list. */
|
|
198
|
-
last(opts?: {
|
|
199
|
-
focusElement?: boolean;
|
|
200
|
-
}): boolean;
|
|
201
|
-
/** Gets the first focusable item from the given list of items. */
|
|
202
|
-
peekFirst(items?: T[]): T | undefined;
|
|
203
|
-
/** Gets the last focusable item from the given list of items. */
|
|
204
|
-
peekLast(items?: T[]): T | undefined;
|
|
205
|
-
/** Advances to the next or previous focusable item in the list based on the given delta. */
|
|
206
|
-
private _advance;
|
|
207
|
-
/** Peeks the next or previous focusable item in the list based on the given delta. */
|
|
208
|
-
private _peek;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export { KeyboardEventManager, ListFocus, ListNavigation, PointerEventManager, convertGetterSetterToWritableSignalLike };
|
|
212
|
-
export type { ListFocusInputs, ListFocusItem, ListNavigationInputs, ListNavigationItem, SignalLike, WritableSignalLike };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { SignalLike, KeyboardEventManager, PointerEventManager } from './_list-navigation-chunk.js';
|
|
3
|
-
import { ListItem, ListInputs, List } from './_list-chunk.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Represents the properties exposed by a listbox that need to be accessed by an option.
|
|
7
|
-
* This exists to avoid circular dependency errors between the listbox and option.
|
|
8
|
-
*/
|
|
9
|
-
interface ListboxPattern$1<V> {
|
|
10
|
-
inputs: ListInputs<OptionPattern<V>, V>;
|
|
11
|
-
listBehavior: List<OptionPattern<V>, V>;
|
|
12
|
-
}
|
|
13
|
-
/** Represents the required inputs for an option in a listbox. */
|
|
14
|
-
interface OptionInputs<V> extends Omit<ListItem<V>, 'index' | 'selectable'> {
|
|
15
|
-
listbox: SignalLike<ListboxPattern$1<V> | undefined>;
|
|
16
|
-
}
|
|
17
|
-
/** Represents an option in a listbox. */
|
|
18
|
-
declare class OptionPattern<V> {
|
|
19
|
-
/** A unique identifier for the option. */
|
|
20
|
-
id: SignalLike<string>;
|
|
21
|
-
/** The value of the option. */
|
|
22
|
-
value: SignalLike<V>;
|
|
23
|
-
/** The position of the option in the list. */
|
|
24
|
-
index: _angular_core.Signal<number>;
|
|
25
|
-
/** Whether the option is active. */
|
|
26
|
-
active: _angular_core.Signal<boolean>;
|
|
27
|
-
/** Whether the option is selected. */
|
|
28
|
-
selected: _angular_core.Signal<boolean | undefined>;
|
|
29
|
-
/** Whether the option is selectable. */
|
|
30
|
-
selectable: () => boolean;
|
|
31
|
-
/** Whether the option is disabled. */
|
|
32
|
-
disabled: SignalLike<boolean>;
|
|
33
|
-
/** The text used by the typeahead search. */
|
|
34
|
-
searchTerm: SignalLike<string>;
|
|
35
|
-
/** A reference to the parent listbox. */
|
|
36
|
-
listbox: SignalLike<ListboxPattern$1<V> | undefined>;
|
|
37
|
-
/** The tab index of the option. */
|
|
38
|
-
tabIndex: _angular_core.Signal<0 | -1 | undefined>;
|
|
39
|
-
/** The html element that should receive focus. */
|
|
40
|
-
element: SignalLike<HTMLElement | undefined>;
|
|
41
|
-
constructor(args: OptionInputs<V>);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Represents the required inputs for a listbox. */
|
|
45
|
-
type ListboxInputs<V> = ListInputs<OptionPattern<V>, V> & {
|
|
46
|
-
/** A unique identifier for the listbox. */
|
|
47
|
-
id: SignalLike<string>;
|
|
48
|
-
/** Whether the listbox is readonly. */
|
|
49
|
-
readonly: SignalLike<boolean>;
|
|
50
|
-
};
|
|
51
|
-
/** Controls the state of a listbox. */
|
|
52
|
-
declare class ListboxPattern<V> {
|
|
53
|
-
readonly inputs: ListboxInputs<V>;
|
|
54
|
-
listBehavior: List<OptionPattern<V>, V>;
|
|
55
|
-
/** Whether the list is vertically or horizontally oriented. */
|
|
56
|
-
orientation: SignalLike<'vertical' | 'horizontal'>;
|
|
57
|
-
/** Whether the listbox is disabled. */
|
|
58
|
-
disabled: _angular_core.Signal<boolean>;
|
|
59
|
-
/** Whether the listbox is readonly. */
|
|
60
|
-
readonly: SignalLike<boolean>;
|
|
61
|
-
/** The tab index of the listbox. */
|
|
62
|
-
tabIndex: SignalLike<-1 | 0>;
|
|
63
|
-
/** The id of the current active item. */
|
|
64
|
-
activeDescendant: _angular_core.Signal<string | undefined>;
|
|
65
|
-
/** Whether multiple items in the list can be selected at once. */
|
|
66
|
-
multi: SignalLike<boolean>;
|
|
67
|
-
/** The number of items in the listbox. */
|
|
68
|
-
setsize: _angular_core.Signal<number>;
|
|
69
|
-
/** Whether the listbox selection follows focus. */
|
|
70
|
-
followFocus: _angular_core.Signal<boolean>;
|
|
71
|
-
/** Whether the listbox should wrap. Used to disable wrapping while range selecting. */
|
|
72
|
-
wrap: _angular_core.WritableSignal<boolean>;
|
|
73
|
-
/** The key used to navigate to the previous item in the list. */
|
|
74
|
-
prevKey: _angular_core.Signal<"ArrowUp" | "ArrowRight" | "ArrowLeft">;
|
|
75
|
-
/** The key used to navigate to the next item in the list. */
|
|
76
|
-
nextKey: _angular_core.Signal<"ArrowRight" | "ArrowLeft" | "ArrowDown">;
|
|
77
|
-
/** Represents the space key. Does nothing when the user is actively using typeahead. */
|
|
78
|
-
dynamicSpaceKey: _angular_core.Signal<"" | " ">;
|
|
79
|
-
/** The regexp used to decide if a key should trigger typeahead. */
|
|
80
|
-
typeaheadRegexp: RegExp;
|
|
81
|
-
/** The keydown event manager for the listbox. */
|
|
82
|
-
keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
|
|
83
|
-
/** The pointerdown event manager for the listbox. */
|
|
84
|
-
pointerdown: _angular_core.Signal<PointerEventManager<PointerEvent>>;
|
|
85
|
-
constructor(inputs: ListboxInputs<V>);
|
|
86
|
-
/** Returns a set of violations */
|
|
87
|
-
validate(): string[];
|
|
88
|
-
/** Handles keydown events for the listbox. */
|
|
89
|
-
onKeydown(event: KeyboardEvent): void;
|
|
90
|
-
onPointerdown(event: PointerEvent): void;
|
|
91
|
-
/**
|
|
92
|
-
* Sets the listbox to it's default initial state.
|
|
93
|
-
*
|
|
94
|
-
* Sets the active index of the listbox to the first focusable selected
|
|
95
|
-
* item if one exists. Otherwise, sets focus to the first focusable item.
|
|
96
|
-
*
|
|
97
|
-
* This method should be called once the listbox and it's options are properly initialized,
|
|
98
|
-
* meaning the ListboxPattern and OptionPatterns should have references to each other before this
|
|
99
|
-
* is called.
|
|
100
|
-
*/
|
|
101
|
-
setDefaultState(): void;
|
|
102
|
-
protected _getItem(e: PointerEvent): OptionPattern<V> | undefined;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export { ListboxPattern, OptionPattern };
|
|
106
|
-
export type { ListboxInputs, OptionInputs };
|