@angular/aria 21.0.0-rc.0 → 21.0.0-rc.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.
Files changed (48) hide show
  1. package/_adev_assets/aria-accordion.json +443 -59
  2. package/_adev_assets/aria-combobox.json +345 -37
  3. package/_adev_assets/aria-grid.json +408 -71
  4. package/_adev_assets/aria-listbox.json +115 -35
  5. package/_adev_assets/aria-menu.json +492 -167
  6. package/_adev_assets/aria-tabs.json +272 -88
  7. package/_adev_assets/aria-toolbar.json +151 -133
  8. package/_adev_assets/aria-tree.json +182 -35
  9. package/fesm2022/_widget-chunk.mjs +643 -190
  10. package/fesm2022/_widget-chunk.mjs.map +1 -1
  11. package/fesm2022/accordion.mjs +129 -77
  12. package/fesm2022/accordion.mjs.map +1 -1
  13. package/fesm2022/aria.mjs +1 -1
  14. package/fesm2022/aria.mjs.map +1 -1
  15. package/fesm2022/combobox.mjs +140 -27
  16. package/fesm2022/combobox.mjs.map +1 -1
  17. package/fesm2022/grid.mjs +254 -68
  18. package/fesm2022/grid.mjs.map +1 -1
  19. package/fesm2022/listbox.mjs +54 -44
  20. package/fesm2022/listbox.mjs.map +1 -1
  21. package/fesm2022/menu.mjs +270 -108
  22. package/fesm2022/menu.mjs.map +1 -1
  23. package/fesm2022/private.mjs +752 -785
  24. package/fesm2022/private.mjs.map +1 -1
  25. package/fesm2022/tabs.mjs +101 -71
  26. package/fesm2022/tabs.mjs.map +1 -1
  27. package/fesm2022/toolbar.mjs +87 -64
  28. package/fesm2022/toolbar.mjs.map +1 -1
  29. package/fesm2022/tree.mjs +105 -60
  30. package/fesm2022/tree.mjs.map +1 -1
  31. package/package.json +2 -10
  32. package/types/_grid-chunk.d.ts +326 -83
  33. package/types/accordion.d.ts +134 -35
  34. package/types/combobox.d.ts +146 -13
  35. package/types/grid.d.ts +159 -32
  36. package/types/listbox.d.ts +59 -28
  37. package/types/menu.d.ts +151 -55
  38. package/types/private.d.ts +449 -567
  39. package/types/tabs.d.ts +121 -41
  40. package/types/toolbar.d.ts +74 -51
  41. package/types/tree.d.ts +116 -45
  42. package/_adev_assets/aria-radio-group.json +0 -389
  43. package/fesm2022/deferred-content.mjs +0 -99
  44. package/fesm2022/deferred-content.mjs.map +0 -1
  45. package/fesm2022/radio-group.mjs +0 -338
  46. package/fesm2022/radio-group.mjs.map +0 -1
  47. package/types/deferred-content.d.ts +0 -38
  48. package/types/radio-group.d.ts +0 -84
@@ -1,4 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
+ import { WritableSignal, Signal } from '@angular/core';
2
3
 
3
4
  /**
4
5
  * Options that are applicable to all event handlers.
@@ -65,9 +66,9 @@ type KeyCode = string | SignalLike<string> | RegExp;
65
66
  declare class KeyboardEventManager<T extends KeyboardEvent> extends EventManager<T> {
66
67
  options: EventHandlerOptions;
67
68
  /** Configures this event manager to handle events with a specific key and no modifiers. */
68
- on(key: KeyCode, handler: EventHandler<T>): this;
69
+ on(key: KeyCode, handler: EventHandler<T>, options?: Partial<EventHandlerOptions>): this;
69
70
  /** Configures this event manager to handle events with a specific modifer and key combination. */
70
- on(modifiers: ModifierInputs, key: KeyCode, handler: EventHandler<T>): this;
71
+ on(modifiers: ModifierInputs, key: KeyCode, handler: EventHandler<T>, options?: Partial<EventHandlerOptions>): this;
71
72
  private _normalizeInputs;
72
73
  private _isMatch;
73
74
  }
@@ -103,6 +104,111 @@ declare class PointerEventManager<T extends PointerEvent> extends EventManager<T
103
104
  _isMatch(event: PointerEvent, button: MouseButton, modifiers: ModifierInputs): boolean;
104
105
  }
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
+ }
211
+
106
212
  /** Represents coordinates in a grid. */
107
213
  interface RowCol {
108
214
  /** The row index. */
@@ -127,8 +233,6 @@ declare class GridData<T extends BaseGridCell> {
127
233
  readonly inputs: GridDataInputs<T>;
128
234
  /** The two-dimensional array of cells that represents the grid. */
129
235
  readonly cells: SignalLike<T[][]>;
130
- /** The number of rows in the grid. */
131
- readonly rowCount: _angular_core.Signal<number>;
132
236
  /** The maximum number of rows in the grid, accounting for row spans. */
133
237
  readonly maxRowCount: _angular_core.Signal<number>;
134
238
  /** The maximum number of columns in the grid, accounting for column spans. */
@@ -142,6 +246,8 @@ declare class GridData<T extends BaseGridCell> {
142
246
  /** A map from a column index to the number of rows in that column. */
143
247
  private readonly _rowCountByCol;
144
248
  constructor(inputs: GridDataInputs<T>);
249
+ /** Whether the cell exists. */
250
+ hasCell(cell: T): boolean;
145
251
  /** Gets the cell at the given coordinates. */
146
252
  getCell(rowCol: RowCol): T | undefined;
147
253
  /** Gets the primary coordinates of the given cell. */
@@ -169,8 +275,8 @@ interface GridFocusInputs {
169
275
  focusMode: SignalLike<'roving' | 'activedescendant'>;
170
276
  /** Whether the grid is disabled. */
171
277
  disabled: SignalLike<boolean>;
172
- /** Whether disabled cells in the grid should be skipped when navigating. */
173
- skipDisabled: SignalLike<boolean>;
278
+ /** Whether disabled cells in the grid should be focusable. */
279
+ softDisabled: SignalLike<boolean>;
174
280
  }
175
281
  /** Dependencies for the `GridFocus` class. */
176
282
  interface GridFocusDeps<T extends GridFocusCell> {
@@ -181,9 +287,9 @@ interface GridFocusDeps<T extends GridFocusCell> {
181
287
  declare class GridFocus<T extends GridFocusCell> {
182
288
  readonly inputs: GridFocusInputs & GridFocusDeps<T>;
183
289
  /** The current active cell. */
184
- readonly activeCell: _angular_core.WritableSignal<T | undefined>;
290
+ readonly activeCell: WritableSignal<T | undefined>;
185
291
  /** The current active cell coordinates. */
186
- readonly activeCoords: _angular_core.WritableSignal<RowCol>;
292
+ readonly activeCoords: WritableSignal<RowCol>;
187
293
  /** Whether the grid active state is empty (no active cell or coordinates). */
188
294
  readonly stateEmpty: _angular_core.Signal<boolean>;
189
295
  /**
@@ -198,11 +304,11 @@ declare class GridFocus<T extends GridFocusCell> {
198
304
  readonly activeDescendant: _angular_core.Signal<string | undefined>;
199
305
  /** Whether the grid is in a disabled state. */
200
306
  readonly gridDisabled: _angular_core.Signal<boolean>;
201
- /** The tabindex for the grid container. */
307
+ /** The tab index for the grid container. */
202
308
  readonly gridTabIndex: _angular_core.Signal<0 | -1>;
203
309
  constructor(inputs: GridFocusInputs & GridFocusDeps<T>);
204
- /** Returns the tabindex for the given grid cell cell. */
205
- getCellTabindex(cell: T): -1 | 0;
310
+ /** Returns the tab index for the given grid cell cell. */
311
+ getCellTabIndex(cell: T): -1 | 0;
206
312
  /** Returns true if the given cell can be navigated to. */
207
313
  isFocusable(cell: T): boolean;
208
314
  /** Focuses the given cell. */
@@ -252,7 +358,7 @@ declare class GridNavigation<T extends GridNavigationCell> {
252
358
  /**
253
359
  * Gets the coordinates of the next focusable cell in a given direction, without changing focus.
254
360
  */
255
- peek(direction: Delta, fromCoords: RowCol, wrap?: WrapStrategy): RowCol | undefined;
361
+ peek(direction: Delta, fromCoords: RowCol, wrap?: WrapStrategy, allowDisabled?: boolean): RowCol | undefined;
256
362
  /**
257
363
  * Navigates to the next focusable cell in a given direction.
258
364
  */
@@ -261,7 +367,7 @@ declare class GridNavigation<T extends GridNavigationCell> {
261
367
  * Gets the coordinates of the first focusable cell.
262
368
  * If a row is not provided, searches the entire grid.
263
369
  */
264
- peekFirst(row?: number): RowCol | undefined;
370
+ peekFirst(row?: number, allowDisabled?: boolean): RowCol | undefined;
265
371
  /**
266
372
  * Navigates to the first focusable cell.
267
373
  * If a row is not provided, searches the entire grid.
@@ -271,7 +377,7 @@ declare class GridNavigation<T extends GridNavigationCell> {
271
377
  * Gets the coordinates of the last focusable cell.
272
378
  * If a row is not provided, searches the entire grid.
273
379
  */
274
- peekLast(row?: number): RowCol | undefined;
380
+ peekLast(row?: number, allowDisabled?: boolean): RowCol | undefined;
275
381
  /**
276
382
  * Navigates to the last focusable cell.
277
383
  * If a row is not provided, searches the entire grid.
@@ -303,7 +409,11 @@ interface GridSelectionDeps<T extends GridSelectionCell> {
303
409
  /** Controls selection for a grid of items. */
304
410
  declare class GridSelection<T extends GridSelectionCell> {
305
411
  readonly inputs: GridSelectionInputs & GridSelectionDeps<T>;
412
+ /** The list of cells that were changed in the last selection operation. */
413
+ private readonly _undoList;
306
414
  constructor(inputs: GridSelectionInputs & GridSelectionDeps<T>);
415
+ /** Reverts the last selection change. */
416
+ undo(): void;
307
417
  /** Selects one or more cells in a given range. */
308
418
  select(fromCoords: RowCol, toCoords?: RowCol): void;
309
419
  /** Deselects one or more cells in a given range. */
@@ -314,17 +424,40 @@ declare class GridSelection<T extends GridSelectionCell> {
314
424
  selectAll(): void;
315
425
  /** Deselects all valid cells in the grid. */
316
426
  deselectAll(): void;
317
- /** A generator that yields all valid (selectable and not disabled) cells within a given range. */
427
+ /** Whether a cell is selctable. */
428
+ isSelectable(cell: T): boolean;
429
+ /** A generator that yields all cells within a given range. */
318
430
  _validCells(fromCoords: RowCol, toCoords: RowCol): Generator<T>;
431
+ /**
432
+ * Updates the selection state of cells in a given range and preserves previous changes
433
+ * to a undo list.
434
+ */
435
+ private _updateState;
319
436
  }
320
437
 
438
+ /** The selection operations that can be performed after a navigation operation. */
439
+ interface NavOptions {
440
+ /** Toggles the selection state of the active cell. */
441
+ toggle?: boolean;
442
+ /**
443
+ * Toggles the selection state of the active cell, and deselects all other cells if the
444
+ * active cell is selected. If the active cell is the only selected cell, it will be deselected.
445
+ */
446
+ toggleOne?: boolean;
447
+ /** Selects the active cell, preserving the selection state of other cells. */
448
+ select?: boolean;
449
+ /** Deselects all other cells and selects the active cell. */
450
+ selectOne?: boolean;
451
+ /**
452
+ * Moves the selection anchor to the active cell and updates the selection to include all
453
+ * cells between the anchor and the active cell.
454
+ */
455
+ anchor?: boolean;
456
+ }
321
457
  /** A type that represents a cell in a grid, combining all cell-related interfaces. */
322
458
  type GridCell = BaseGridCell & GridFocusCell & GridNavigationCell & GridSelectionCell;
323
459
  /** Represents the required inputs for a grid. */
324
- interface GridInputs$1<T extends GridCell> extends GridDataInputs<T>, GridFocusInputs, GridNavigationInputs, GridSelectionInputs {
325
- /** Whether selection is enabled for the grid. */
326
- enableSelection: SignalLike<boolean>;
327
- }
460
+ type GridInputs$1<T extends GridCell> = GridDataInputs<T> & GridFocusInputs & GridNavigationInputs & GridSelectionInputs;
328
461
  /** The main class that orchestrates the grid behaviors. */
329
462
  declare class Grid<T extends GridCell> {
330
463
  readonly inputs: GridInputs$1<T>;
@@ -338,132 +471,216 @@ declare class Grid<T extends GridCell> {
338
471
  readonly selectionBehavior: GridSelection<T>;
339
472
  /** The anchor point for range selection, linked to the active coordinates. */
340
473
  readonly selectionAnchor: _angular_core.WritableSignal<RowCol>;
341
- /** The `tabindex` for the grid container. */
342
- readonly gridTabIndex: _angular_core.Signal<0 | -1>;
474
+ /** The cell at the selection anchor. */
475
+ readonly selectionAnchorCell: _angular_core.Signal<T | undefined>;
476
+ /** Whether a range selection has settled. */
477
+ readonly selectionStabled: _angular_core.WritableSignal<boolean>;
478
+ /** Whether all selectable cells are selected. */
479
+ readonly allSelected: SignalLike<boolean>;
480
+ /** The tab index for the grid container. */
481
+ readonly gridTabIndex: SignalLike<-1 | 0>;
343
482
  /** Whether the grid is in a disabled state. */
344
- readonly gridDisabled: _angular_core.Signal<boolean>;
483
+ readonly gridDisabled: SignalLike<boolean>;
345
484
  /** The ID of the active descendant for ARIA `activedescendant` focus management. */
346
- readonly activeDescendant: _angular_core.Signal<string | undefined>;
485
+ readonly activeDescendant: SignalLike<string | undefined>;
347
486
  constructor(inputs: GridInputs$1<T>);
348
487
  /** Gets the 1-based row index of a cell. */
349
488
  rowIndex(cell: T): number | undefined;
350
489
  /** Gets the 1-based column index of a cell. */
351
490
  colIndex(cell: T): number | undefined;
352
- /** Gets the `tabindex` for a given cell. */
491
+ /** Gets the tab index for a given cell. */
353
492
  cellTabIndex(cell: T): -1 | 0;
354
493
  /** Navigates to the cell above the currently active cell. */
355
- up(): boolean;
356
- /** Extends the selection to the cell above the selection anchor. */
357
- rangeSelectUp(): void;
494
+ up(opts?: NavOptions): boolean;
358
495
  /** Navigates to the cell below the currently active cell. */
359
- down(): boolean;
360
- /** Extends the selection to the cell below the selection anchor. */
361
- rangeSelectDown(): void;
496
+ down(opts?: NavOptions): boolean;
362
497
  /** Navigates to the cell to the left of the currently active cell. */
363
- left(): boolean;
364
- /** Extends the selection to the cell to the left of the selection anchor. */
365
- rangeSelectLeft(): void;
498
+ left(opts?: NavOptions): boolean;
366
499
  /** Navigates to the cell to the right of the currently active cell. */
367
- right(): boolean;
368
- /** Extends the selection to the cell to the right of the selection anchor. */
369
- rangeSelectRight(): void;
500
+ right(opts?: NavOptions): boolean;
370
501
  /** Navigates to the first focusable cell in the grid. */
371
- first(): boolean;
502
+ first(opts?: NavOptions): boolean;
372
503
  /** Navigates to the first focusable cell in the current row. */
373
- firstInRow(): boolean;
504
+ firstInRow(opts?: NavOptions): boolean;
374
505
  /** Navigates to the last focusable cell in the grid. */
375
- last(): boolean;
506
+ last(opts?: NavOptions): boolean;
376
507
  /** Navigates to the last focusable cell in the current row. */
377
- lastInRow(): boolean;
508
+ lastInRow(opts?: NavOptions): boolean;
378
509
  /** Selects all cells in the current row. */
379
510
  selectRow(): void;
380
511
  /** Selects all cells in the current column. */
381
512
  selectCol(): void;
513
+ /** Selects the active cell. */
514
+ select(): void;
515
+ /** Deselects the active cell. */
516
+ deselect(): void;
517
+ /**
518
+ * Toggles the selection state of the coordinates of the given cell
519
+ * or the current active coordinates.
520
+ */
521
+ toggle(): void;
522
+ /** Toggles the selection state of the active cell, and deselects all other cells. */
523
+ toggleOne(): void;
382
524
  /** Selects all selectable cells in the grid. */
383
525
  selectAll(): void;
526
+ /** Deselects all cells in the grid. */
527
+ deselectAll(): void;
384
528
  /** Navigates to and focuses the given cell. */
385
- gotoCell(cell: T): boolean;
386
- /** Toggles the selection state of the given cell. */
387
- toggleSelect(cell: T): void;
388
- /** Extends the selection from the anchor to the given cell. */
389
- rangeSelect(cell: T): void;
390
- /** Extends the selection to the given coordinates. */
391
- private _rangeSelectCoords;
529
+ gotoCell(cell: T, opts?: NavOptions): boolean;
530
+ /** Sets the default active state of the grid. */
531
+ setDefaultState(): boolean;
392
532
  /** Resets the active state of the grid if it is empty or stale. */
393
533
  resetState(): boolean;
534
+ /** Updates the selection anchor to the given coordinates. */
535
+ private _updateSelectionAnchor;
536
+ /** Updates the selection to include all cells between the anchor and the active cell. */
537
+ private _updateRangeSelection;
538
+ /** Gets the start and end coordinates for a selection range. */
539
+ private _getSelectionCoords;
540
+ /** Executes a navigation operation and applies selection options. */
541
+ private _navigateWithSelection;
394
542
  }
395
543
 
396
544
  /** The inputs for the `GridCellWidgetPattern`. */
397
- interface GridCellWidgetInputs {
545
+ interface GridCellWidgetInputs extends Omit<ListNavigationItem, 'index'> {
398
546
  /** The `GridCellPattern` that this widget belongs to. */
399
547
  cell: SignalLike<GridCellPattern>;
400
548
  /** The html element that should receive focus. */
401
549
  element: SignalLike<HTMLElement>;
402
- /**
403
- * Whether the widget is activated, which pauses grid navigation to allow interaction
404
- * with the widget.
405
- */
406
- activate: WritableSignalLike<boolean>;
550
+ /** The type of widget, which determines how it is activated. */
551
+ widgetType: SignalLike<'simple' | 'complex' | 'editable'>;
552
+ /** The element that will receive focus when the widget is activated. */
553
+ focusTarget: SignalLike<HTMLElement | undefined>;
407
554
  }
408
555
  /** The UI pattern for a widget inside a grid cell. */
409
- declare class GridCellWidgetPattern {
556
+ declare class GridCellWidgetPattern implements ListNavigationItem {
410
557
  readonly inputs: GridCellWidgetInputs;
558
+ /** A unique identifier for the widget. */
559
+ readonly id: SignalLike<string>;
411
560
  /** The html element that should receive focus. */
412
561
  readonly element: SignalLike<HTMLElement>;
413
- /** The `tabindex` for the widget. */
414
- readonly tabIndex: SignalLike<-1 | 0>;
415
- /** Whether the widget is in an active state (i.e. its containing cell is active). */
416
- readonly active: SignalLike<boolean>;
562
+ /** The element that should receive focus. */
563
+ readonly widgetHost: Signal<HTMLElement>;
564
+ /** The index of the widget within the cell. */
565
+ readonly index: Signal<number>;
566
+ /** Whether the widget is disabled. */
567
+ readonly disabled: Signal<boolean>;
568
+ /** The tab index for the widget. */
569
+ readonly tabIndex: Signal<-1 | 0>;
570
+ /** Whether the widget is the active item in the widget list. */
571
+ readonly active: Signal<boolean>;
572
+ /** Whether the widget is currently activated. */
573
+ readonly isActivated: WritableSignal<boolean>;
574
+ /** The last event that caused the widget to be activated. */
575
+ readonly lastActivateEvent: WritableSignal<KeyboardEvent | FocusEvent | undefined>;
576
+ /** The last event that caused the widget to be deactivated. */
577
+ readonly lastDeactivateEvent: WritableSignal<KeyboardEvent | FocusEvent | undefined>;
578
+ /** The keyboard event manager for the widget. */
579
+ readonly keydown: Signal<KeyboardEventManager<KeyboardEvent>>;
417
580
  constructor(inputs: GridCellWidgetInputs);
581
+ /** Handles keydown events for the widget. */
582
+ onKeydown(event: KeyboardEvent): void;
583
+ /** Handles focusin events for the widget. */
584
+ onFocusIn(event: FocusEvent): void;
585
+ /** Handles focusout events for the widget. */
586
+ onFocusOut(event: FocusEvent): void;
587
+ /** Focuses the widget's host element. */
588
+ focus(): void;
589
+ /** Activates the widget. */
590
+ activate(event?: KeyboardEvent | FocusEvent): void;
591
+ /** Deactivates the widget and restores focus to the widget's host element. */
592
+ deactivate(event?: KeyboardEvent | FocusEvent): void;
418
593
  }
419
594
 
420
595
  /** The inputs for the `GridCellPattern`. */
421
- interface GridCellInputs extends GridCell {
596
+ interface GridCellInputs extends GridCell, Omit<ListNavigationInputs<GridCellWidgetPattern>, 'focusMode' | 'items' | 'activeItem' | 'softDisabled' | 'element'> {
422
597
  /** The `GridPattern` that this cell belongs to. */
423
598
  grid: SignalLike<GridPattern>;
424
599
  /** The `GridRowPattern` that this cell belongs to. */
425
600
  row: SignalLike<GridRowPattern>;
426
- /** The widget pattern contained within this cell, if any. */
427
- widget: SignalLike<GridCellWidgetPattern | undefined>;
601
+ /** The widget patterns contained within this cell, if any. */
602
+ widgets: SignalLike<GridCellWidgetPattern[]>;
428
603
  /** The index of this cell's row within the grid. */
429
604
  rowIndex: SignalLike<number | undefined>;
430
605
  /** The index of this cell's column within the grid. */
431
606
  colIndex: SignalLike<number | undefined>;
607
+ /** A function that returns the cell widget associated with a given element. */
608
+ getWidget: (e: Element | null) => GridCellWidgetPattern | undefined;
432
609
  }
433
610
  /** The UI pattern for a grid cell. */
434
611
  declare class GridCellPattern implements GridCell {
435
612
  readonly inputs: GridCellInputs;
436
613
  /** A unique identifier for the cell. */
437
614
  readonly id: SignalLike<string>;
438
- /** Whether a cell is disabled. */
439
- readonly disabled: SignalLike<boolean>;
615
+ /** The html element that should receive focus. */
616
+ readonly element: SignalLike<HTMLElement>;
617
+ /** Whether the cell has focus. */
618
+ readonly isFocused: WritableSignal<boolean>;
440
619
  /** Whether the cell is selected. */
441
620
  readonly selected: WritableSignalLike<boolean>;
442
621
  /** Whether the cell is selectable. */
443
622
  readonly selectable: SignalLike<boolean>;
623
+ /** Whether a cell is disabled. */
624
+ readonly disabled: SignalLike<boolean>;
444
625
  /** The number of rows the cell should span. */
445
626
  readonly rowSpan: SignalLike<number>;
446
627
  /** The number of columns the cell should span. */
447
628
  readonly colSpan: SignalLike<number>;
629
+ /** Whether the cell is active. */
630
+ readonly active: SignalLike<boolean>;
631
+ /** Whether the cell is a selection anchor. */
632
+ readonly anchor: SignalLike<true | undefined>;
448
633
  /** The `aria-selected` attribute for the cell. */
449
- readonly ariaSelected: _angular_core.Signal<boolean | undefined>;
634
+ readonly ariaSelected: SignalLike<boolean | undefined>;
450
635
  /** The `aria-rowindex` attribute for the cell. */
451
- readonly ariaRowIndex: _angular_core.Signal<number | undefined>;
636
+ readonly ariaRowIndex: SignalLike<number | undefined>;
452
637
  /** The `aria-colindex` attribute for the cell. */
453
- readonly ariaColIndex: _angular_core.Signal<number | undefined>;
454
- /** The html element that should receive focus. */
455
- readonly element: SignalLike<HTMLElement>;
456
- /** Whether the cell is active. */
457
- readonly active: _angular_core.Signal<boolean>;
638
+ readonly ariaColIndex: SignalLike<number | undefined>;
458
639
  /** The internal tab index calculation for the cell. */
459
640
  private readonly _tabIndex;
460
- /** The `tabindex` for the cell. If the cell contains a widget, the cell's tabindex is -1. */
641
+ /** The tab index for the cell. If the cell contains a widget, the cell's tab index is -1. */
461
642
  readonly tabIndex: SignalLike<-1 | 0>;
462
- /** Whether the widget within the cell is activated. */
643
+ /** Whether the cell contains a single widget. */
644
+ readonly singleWidgetMode: SignalLike<boolean>;
645
+ /** Whether the cell contains multiple widgets. */
646
+ readonly multiWidgetMode: SignalLike<boolean>;
647
+ /** Whether navigation between widgets is disabled. */
648
+ readonly navigationDisabled: SignalLike<boolean>;
649
+ /** The focus behavior for the widgets in the cell. */
650
+ readonly focusBehavior: ListFocus<GridCellWidgetPattern>;
651
+ /** The navigation behavior for the widgets in the cell. */
652
+ readonly navigationBehavior: ListNavigation<GridCellWidgetPattern>;
653
+ /** The currently active widget in the cell. */
654
+ readonly activeWidget: WritableSignalLike<GridCellWidgetPattern | undefined>;
655
+ /** Whether navigation between widgets is activated. */
656
+ readonly navigationActivated: WritableSignalLike<boolean>;
657
+ /** Whether any widget within the cell is activated. */
463
658
  readonly widgetActivated: SignalLike<boolean>;
659
+ /** Whether the cell or widget inside the cell is activated. */
660
+ readonly isActivated: SignalLike<boolean>;
661
+ /** The key used to navigate to the previous widget. */
662
+ readonly prevKey: _angular_core.Signal<"ArrowUp" | "ArrowRight" | "ArrowLeft">;
663
+ /** The key used to navigate to the next widget. */
664
+ readonly nextKey: _angular_core.Signal<"ArrowRight" | "ArrowLeft" | "ArrowDown">;
665
+ /** The keyboard event manager for the cell. */
666
+ readonly keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
464
667
  constructor(inputs: GridCellInputs);
465
- /** Gets the `tabindex` for the widget within the cell. */
668
+ /** Handles keydown events for the cell. */
669
+ onKeydown(event: KeyboardEvent): void;
670
+ /** Handles focusin events for the cell. */
671
+ onFocusIn(event: FocusEvent): void;
672
+ /** Handles focusout events for the cell. */
673
+ onFocusOut(event: FocusEvent): void;
674
+ /** Focuses the cell or the active widget. */
675
+ focus(): void;
676
+ /** Gets the tab index for the widget within the cell. */
466
677
  widgetTabIndex(): -1 | 0;
678
+ /** Starts navigation between widgets. */
679
+ startNavigation(): void;
680
+ /** Stops navigation between widgets and restores focus to the cell. */
681
+ stopNavigation(): void;
682
+ /** Executes a navigation operation and focuses the new active widget. */
683
+ private _advance;
467
684
  }
468
685
 
469
686
  /** The inputs for the `GridRowPattern`. */
@@ -489,8 +706,18 @@ interface GridInputs extends Omit<GridInputs$1<GridCellPattern>, 'cells'> {
489
706
  element: SignalLike<HTMLElement>;
490
707
  /** The rows that make up the grid. */
491
708
  rows: SignalLike<GridRowPattern[]>;
709
+ /** The direction that text is read based on the users locale. */
710
+ textDirection: SignalLike<'rtl' | 'ltr'>;
711
+ /** Whether selection is enabled for the grid. */
712
+ enableSelection: SignalLike<boolean>;
713
+ /** Whether multiple cell in the grid can be selected. */
714
+ multi: SignalLike<boolean>;
715
+ /** The selection strategy used by the grid. */
716
+ selectionMode: SignalLike<'follow' | 'explicit'>;
717
+ /** Whether enable range selection. */
718
+ enableRangeSelection: SignalLike<boolean>;
492
719
  /** A function that returns the grid cell associated with a given element. */
493
- getCell: (e: Element) => GridCellPattern | undefined;
720
+ getCell: (e: Element | null) => GridCellPattern | undefined;
494
721
  }
495
722
  /** The UI pattern for a grid, handling keyboard navigation, focus, and selection. */
496
723
  declare class GridPattern {
@@ -507,18 +734,32 @@ declare class GridPattern {
507
734
  readonly activeDescendant: _angular_core.Signal<string | undefined>;
508
735
  /** The currently active cell. */
509
736
  readonly activeCell: _angular_core.Signal<GridCellPattern | undefined>;
510
- /** Whether to pause grid navigation. */
511
- readonly pauseNavigation: _angular_core.Signal<boolean>;
737
+ /** The current selection anchor cell. */
738
+ readonly anchorCell: SignalLike<GridCellPattern | undefined>;
739
+ /** Whether to pause grid navigation and give the keyboard control to cell or widget. */
740
+ readonly pauseNavigation: SignalLike<boolean>;
512
741
  /** Whether the focus is in the grid. */
513
742
  readonly isFocused: _angular_core.WritableSignal<boolean>;
743
+ /** Whether the grid has been focused once. */
744
+ readonly hasBeenFocused: _angular_core.WritableSignal<boolean>;
514
745
  /** Whether the user is currently dragging to select a range of cells. */
515
746
  readonly dragging: _angular_core.WritableSignal<boolean>;
747
+ /** The key for navigating to the previous column. */
748
+ readonly prevColKey: _angular_core.Signal<"ArrowRight" | "ArrowLeft">;
749
+ /** The key for navigating to the next column. */
750
+ readonly nextColKey: _angular_core.Signal<"ArrowRight" | "ArrowLeft">;
516
751
  /** The keydown event manager for the grid. */
517
752
  readonly keydown: _angular_core.Signal<KeyboardEventManager<KeyboardEvent>>;
518
753
  /** The pointerdown event manager for the grid. */
519
754
  readonly pointerdown: _angular_core.Signal<PointerEventManager<PointerEvent>>;
520
755
  /** The pointerup event manager for the grid. */
521
756
  readonly pointerup: _angular_core.Signal<PointerEventManager<PointerEvent>>;
757
+ /** Indicates maybe the losing focus is caused by row/cell deletion. */
758
+ private readonly _maybeDeletion;
759
+ /** Indicates the losing focus is certainly caused by row/cell deletion. */
760
+ private readonly _deletion;
761
+ /** Whether the grid state is stale and needs to be reconciled. */
762
+ private readonly _stateStale;
522
763
  constructor(inputs: GridInputs);
523
764
  /** Handles keydown events on the grid. */
524
765
  onKeydown(event: KeyboardEvent): void;
@@ -530,17 +771,19 @@ declare class GridPattern {
530
771
  onPointerup(event: PointerEvent): void;
531
772
  /** Handles focusin events on the grid. */
532
773
  onFocusIn(event: FocusEvent): void;
533
- /** Indicates maybe the losing focus is caused by row/cell deletion. */
534
- private readonly _maybeDeletion;
535
774
  /** Handles focusout events on the grid. */
536
775
  onFocusOut(event: FocusEvent): void;
537
- /** Indicates the losing focus is certainly caused by row/cell deletion. */
538
- private readonly _deletion;
776
+ /** Sets the default active state of the grid before receiving focus the first time. */
777
+ setDefaultStateEffect(): void;
539
778
  /** Resets the active state of the grid if it is empty or stale. */
540
779
  resetStateEffect(): void;
541
- /** Focuses on the active cell element. */
780
+ /** Resets the focus to the active cell element or grid element. */
781
+ resetFocusEffect(): void;
782
+ /** Restore focus when a deletion happened. */
783
+ restoreFocusEffect(): void;
784
+ /** Sets focus when active cell changed. */
542
785
  focusEffect(): void;
543
786
  }
544
787
 
545
- export { GridCellPattern, GridCellWidgetPattern, GridPattern, GridRowPattern, KeyboardEventManager, PointerEventManager, convertGetterSetterToWritableSignalLike };
546
- export type { GridCellInputs, GridCellWidgetInputs, GridInputs, GridRowInputs, SignalLike, WritableSignalLike };
788
+ export { GridCellPattern, GridCellWidgetPattern, GridPattern, GridRowPattern, KeyboardEventManager, ListFocus, ListNavigation, PointerEventManager, convertGetterSetterToWritableSignalLike };
789
+ export type { GridCellInputs, GridCellWidgetInputs, GridInputs, GridRowInputs, ListFocusInputs, ListFocusItem, ListNavigationInputs, ListNavigationItem, SignalLike, WritableSignalLike };