@angular/aria 21.0.0-rc.1 → 21.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/_adev_assets/aria-accordion.json +429 -59
  2. package/_adev_assets/aria-combobox.json +261 -41
  3. package/_adev_assets/aria-grid.json +339 -85
  4. package/_adev_assets/aria-listbox.json +99 -70
  5. package/_adev_assets/aria-menu.json +355 -158
  6. package/_adev_assets/aria-tabs.json +198 -305
  7. package/_adev_assets/aria-toolbar.json +70 -221
  8. package/_adev_assets/aria-tree.json +153 -363
  9. package/fesm2022/_widget-chunk.mjs +388 -57
  10. package/fesm2022/_widget-chunk.mjs.map +1 -1
  11. package/fesm2022/accordion.mjs +125 -72
  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 +129 -24
  16. package/fesm2022/combobox.mjs.map +1 -1
  17. package/fesm2022/grid.mjs +203 -65
  18. package/fesm2022/grid.mjs.map +1 -1
  19. package/fesm2022/listbox.mjs +50 -39
  20. package/fesm2022/listbox.mjs.map +1 -1
  21. package/fesm2022/menu.mjs +179 -71
  22. package/fesm2022/menu.mjs.map +1 -1
  23. package/fesm2022/private.mjs +418 -440
  24. package/fesm2022/private.mjs.map +1 -1
  25. package/fesm2022/tabs.mjs +105 -73
  26. package/fesm2022/tabs.mjs.map +1 -1
  27. package/fesm2022/toolbar.mjs +52 -44
  28. package/fesm2022/toolbar.mjs.map +1 -1
  29. package/fesm2022/tree.mjs +106 -63
  30. package/fesm2022/tree.mjs.map +1 -1
  31. package/package.json +2 -2
  32. package/types/_grid-chunk.d.ts +216 -35
  33. package/types/accordion.d.ts +134 -35
  34. package/types/combobox.d.ts +141 -12
  35. package/types/grid.d.ts +150 -32
  36. package/types/listbox.d.ts +60 -28
  37. package/types/menu.d.ts +133 -49
  38. package/types/private.d.ts +210 -250
  39. package/types/tabs.d.ts +124 -44
  40. package/types/toolbar.d.ts +58 -36
  41. package/types/tree.d.ts +121 -49
@@ -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.
@@ -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. */
@@ -140,6 +246,8 @@ declare class GridData<T extends BaseGridCell> {
140
246
  /** A map from a column index to the number of rows in that column. */
141
247
  private readonly _rowCountByCol;
142
248
  constructor(inputs: GridDataInputs<T>);
249
+ /** Whether the cell exists. */
250
+ hasCell(cell: T): boolean;
143
251
  /** Gets the cell at the given coordinates. */
144
252
  getCell(rowCol: RowCol): T | undefined;
145
253
  /** Gets the primary coordinates of the given cell. */
@@ -179,9 +287,9 @@ interface GridFocusDeps<T extends GridFocusCell> {
179
287
  declare class GridFocus<T extends GridFocusCell> {
180
288
  readonly inputs: GridFocusInputs & GridFocusDeps<T>;
181
289
  /** The current active cell. */
182
- readonly activeCell: _angular_core.WritableSignal<T | undefined>;
290
+ readonly activeCell: WritableSignal<T | undefined>;
183
291
  /** The current active cell coordinates. */
184
- readonly activeCoords: _angular_core.WritableSignal<RowCol>;
292
+ readonly activeCoords: WritableSignal<RowCol>;
185
293
  /** Whether the grid active state is empty (no active cell or coordinates). */
186
294
  readonly stateEmpty: _angular_core.Signal<boolean>;
187
295
  /**
@@ -434,78 +542,145 @@ declare class Grid<T extends GridCell> {
434
542
  }
435
543
 
436
544
  /** The inputs for the `GridCellWidgetPattern`. */
437
- interface GridCellWidgetInputs {
545
+ interface GridCellWidgetInputs extends Omit<ListNavigationItem, 'index'> {
438
546
  /** The `GridCellPattern` that this widget belongs to. */
439
547
  cell: SignalLike<GridCellPattern>;
440
548
  /** The html element that should receive focus. */
441
549
  element: SignalLike<HTMLElement>;
442
- /**
443
- * Whether the widget is activated, which pauses grid navigation to allow interaction
444
- * with the widget.
445
- */
446
- 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>;
447
554
  }
448
555
  /** The UI pattern for a widget inside a grid cell. */
449
- declare class GridCellWidgetPattern {
556
+ declare class GridCellWidgetPattern implements ListNavigationItem {
450
557
  readonly inputs: GridCellWidgetInputs;
558
+ /** A unique identifier for the widget. */
559
+ readonly id: SignalLike<string>;
451
560
  /** The html element that should receive focus. */
452
561
  readonly element: SignalLike<HTMLElement>;
453
- /** The `tab index` for the widget. */
454
- readonly tabIndex: SignalLike<-1 | 0>;
455
- /** Whether the widget is in an active state (i.e. its containing cell is active). */
456
- 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>>;
457
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;
458
593
  }
459
594
 
460
595
  /** The inputs for the `GridCellPattern`. */
461
- interface GridCellInputs extends GridCell {
596
+ interface GridCellInputs extends GridCell, Omit<ListNavigationInputs<GridCellWidgetPattern>, 'focusMode' | 'items' | 'activeItem' | 'softDisabled' | 'element'> {
462
597
  /** The `GridPattern` that this cell belongs to. */
463
598
  grid: SignalLike<GridPattern>;
464
599
  /** The `GridRowPattern` that this cell belongs to. */
465
600
  row: SignalLike<GridRowPattern>;
466
- /** The widget pattern contained within this cell, if any. */
467
- widget: SignalLike<GridCellWidgetPattern | undefined>;
601
+ /** The widget patterns contained within this cell, if any. */
602
+ widgets: SignalLike<GridCellWidgetPattern[]>;
468
603
  /** The index of this cell's row within the grid. */
469
604
  rowIndex: SignalLike<number | undefined>;
470
605
  /** The index of this cell's column within the grid. */
471
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;
472
609
  }
473
610
  /** The UI pattern for a grid cell. */
474
611
  declare class GridCellPattern implements GridCell {
475
612
  readonly inputs: GridCellInputs;
476
613
  /** A unique identifier for the cell. */
477
614
  readonly id: SignalLike<string>;
478
- /** Whether a cell is disabled. */
479
- 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>;
480
619
  /** Whether the cell is selected. */
481
620
  readonly selected: WritableSignalLike<boolean>;
482
621
  /** Whether the cell is selectable. */
483
622
  readonly selectable: SignalLike<boolean>;
623
+ /** Whether a cell is disabled. */
624
+ readonly disabled: SignalLike<boolean>;
484
625
  /** The number of rows the cell should span. */
485
626
  readonly rowSpan: SignalLike<number>;
486
627
  /** The number of columns the cell should span. */
487
628
  readonly colSpan: SignalLike<number>;
488
- /** The `aria-selected` attribute for the cell. */
489
- readonly ariaSelected: _angular_core.Signal<boolean | undefined>;
490
- /** The `aria-rowindex` attribute for the cell. */
491
- readonly ariaRowIndex: _angular_core.Signal<number | undefined>;
492
- /** The `aria-colindex` attribute for the cell. */
493
- readonly ariaColIndex: _angular_core.Signal<number | undefined>;
494
- /** The html element that should receive focus. */
495
- readonly element: SignalLike<HTMLElement>;
496
629
  /** Whether the cell is active. */
497
- readonly active: _angular_core.Signal<boolean>;
630
+ readonly active: SignalLike<boolean>;
498
631
  /** Whether the cell is a selection anchor. */
499
632
  readonly anchor: SignalLike<true | undefined>;
633
+ /** The `aria-selected` attribute for the cell. */
634
+ readonly ariaSelected: SignalLike<boolean | undefined>;
635
+ /** The `aria-rowindex` attribute for the cell. */
636
+ readonly ariaRowIndex: SignalLike<number | undefined>;
637
+ /** The `aria-colindex` attribute for the cell. */
638
+ readonly ariaColIndex: SignalLike<number | undefined>;
500
639
  /** The internal tab index calculation for the cell. */
501
640
  private readonly _tabIndex;
502
641
  /** The tab index for the cell. If the cell contains a widget, the cell's tab index is -1. */
503
642
  readonly tabIndex: SignalLike<-1 | 0>;
504
- /** 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. */
505
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>>;
506
667
  constructor(inputs: GridCellInputs);
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;
507
676
  /** Gets the tab index for the widget within the cell. */
508
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;
509
684
  }
510
685
 
511
686
  /** The inputs for the `GridRowPattern`. */
@@ -542,7 +717,7 @@ interface GridInputs extends Omit<GridInputs$1<GridCellPattern>, 'cells'> {
542
717
  /** Whether enable range selection. */
543
718
  enableRangeSelection: SignalLike<boolean>;
544
719
  /** A function that returns the grid cell associated with a given element. */
545
- getCell: (e: Element) => GridCellPattern | undefined;
720
+ getCell: (e: Element | null) => GridCellPattern | undefined;
546
721
  }
547
722
  /** The UI pattern for a grid, handling keyboard navigation, focus, and selection. */
548
723
  declare class GridPattern {
@@ -561,8 +736,8 @@ declare class GridPattern {
561
736
  readonly activeCell: _angular_core.Signal<GridCellPattern | undefined>;
562
737
  /** The current selection anchor cell. */
563
738
  readonly anchorCell: SignalLike<GridCellPattern | undefined>;
564
- /** Whether to pause grid navigation. */
565
- readonly pauseNavigation: _angular_core.Signal<boolean>;
739
+ /** Whether to pause grid navigation and give the keyboard control to cell or widget. */
740
+ readonly pauseNavigation: SignalLike<boolean>;
566
741
  /** Whether the focus is in the grid. */
567
742
  readonly isFocused: _angular_core.WritableSignal<boolean>;
568
743
  /** Whether the grid has been focused once. */
@@ -583,6 +758,8 @@ declare class GridPattern {
583
758
  private readonly _maybeDeletion;
584
759
  /** Indicates the losing focus is certainly caused by row/cell deletion. */
585
760
  private readonly _deletion;
761
+ /** Whether the grid state is stale and needs to be reconciled. */
762
+ private readonly _stateStale;
586
763
  constructor(inputs: GridInputs);
587
764
  /** Handles keydown events on the grid. */
588
765
  onKeydown(event: KeyboardEvent): void;
@@ -593,16 +770,20 @@ declare class GridPattern {
593
770
  /** Handles pointerup events on the grid. */
594
771
  onPointerup(event: PointerEvent): void;
595
772
  /** Handles focusin events on the grid. */
596
- onFocusIn(): void;
773
+ onFocusIn(event: FocusEvent): void;
597
774
  /** Handles focusout events on the grid. */
598
775
  onFocusOut(event: FocusEvent): void;
599
776
  /** Sets the default active state of the grid before receiving focus the first time. */
600
777
  setDefaultStateEffect(): void;
601
778
  /** Resets the active state of the grid if it is empty or stale. */
602
779
  resetStateEffect(): void;
603
- /** 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. */
604
785
  focusEffect(): void;
605
786
  }
606
787
 
607
- export { GridCellPattern, GridCellWidgetPattern, GridPattern, GridRowPattern, KeyboardEventManager, PointerEventManager, convertGetterSetterToWritableSignalLike };
608
- 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 };
@@ -5,84 +5,183 @@ import * as i1 from '@angular/aria/private';
5
5
  import { AccordionTriggerPattern, AccordionPanelPattern, AccordionGroupPattern } from '@angular/aria/private';
6
6
 
7
7
  /**
8
- * Represents the content panel of an accordion item. It is controlled by an
9
- * associated `AccordionTrigger`.
8
+ * The content panel of an accordion item that is conditionally visible.
9
+ *
10
+ * This directive is a container for the content that is shown or hidden. It requires
11
+ * a `panelId` that must match the `panelId` of its corresponding `ngAccordionTrigger`.
12
+ * The content within the panel should be provided using an `ng-template` with the
13
+ * `ngAccordionContent` directive so that the content is not rendered on the page until the trigger
14
+ * is expanded. It applies `role="region"` for accessibility and uses the `inert` attribute to hide
15
+ * its content from assistive technologies when not visible.
16
+ *
17
+ * ```html
18
+ * <div ngAccordionPanel panelId="unique-id-1">
19
+ * <ng-template ngAccordionContent>
20
+ * <p>This content is lazily rendered and will be shown when the panel is expanded.</p>
21
+ * </ng-template>
22
+ * </div>
23
+ * ```
24
+ *
25
+ * @developerPreview 21.0
10
26
  */
11
27
  declare class AccordionPanel {
12
28
  /** The DeferredContentAware host directive. */
13
29
  private readonly _deferredContentAware;
14
30
  /** A global unique identifier for the panel. */
15
- private readonly _id;
16
- /** A local unique identifier for the panel, used to match with its trigger's value. */
17
- value: _angular_core.InputSignal<string>;
31
+ readonly id: _angular_core.InputSignal<string>;
32
+ /** A local unique identifier for the panel, used to match with its trigger's `panelId`. */
33
+ readonly panelId: _angular_core.InputSignal<string>;
34
+ /** Whether the accordion panel is visible. True if the associated trigger is expanded. */
35
+ readonly visible: _angular_core.Signal<boolean>;
18
36
  /** The parent accordion trigger pattern that controls this panel. This is set by AccordionGroup. */
19
- readonly accordionTrigger: WritableSignal<AccordionTriggerPattern | undefined>;
37
+ readonly _accordionTriggerPattern: WritableSignal<AccordionTriggerPattern | undefined>;
20
38
  /** The UI pattern instance for this panel. */
21
39
  readonly _pattern: AccordionPanelPattern;
22
40
  constructor();
41
+ /** Expands this item. */
42
+ expand(): void;
43
+ /** Collapses this item. */
44
+ collapse(): void;
45
+ /** Toggles the expansion state of this item. */
46
+ toggle(): void;
23
47
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AccordionPanel, never>;
24
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AccordionPanel, "[ngAccordionPanel]", ["ngAccordionPanel"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
48
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AccordionPanel, "[ngAccordionPanel]", ["ngAccordionPanel"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "panelId": { "alias": "panelId"; "required": true; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
25
49
  }
26
50
  /**
27
- * Represents the trigger button for an accordion item. It controls the expansion
28
- * state of an associated `AccordionPanel`.
51
+ * The trigger that toggles the visibility of its associated `ngAccordionPanel`.
52
+ *
53
+ * This directive requires a `panelId` that must match the `panelId` of the `ngAccordionPanel` it
54
+ * controls. When clicked, it will expand or collapse the panel. It also handles keyboard
55
+ * interactions for navigation within the `ngAccordionGroup`. It applies `role="button"` and manages
56
+ * `aria-expanded`, `aria-controls`, and `aria-disabled` attributes for accessibility.
57
+ * The `disabled` input can be used to disable the trigger.
58
+ *
59
+ * ```html
60
+ * <button ngAccordionTrigger panelId="unique-id-1">
61
+ * Accordion Trigger Text
62
+ * </button>
63
+ * ```
64
+ *
65
+ * @developerPreview 21.0
29
66
  */
30
67
  declare class AccordionTrigger {
31
- /** A global unique identifier for the trigger. */
32
- private readonly _id;
33
68
  /** A reference to the trigger element. */
34
69
  private readonly _elementRef;
70
+ /** A reference to the trigger element. */
71
+ readonly element: HTMLElement;
35
72
  /** The parent AccordionGroup. */
36
73
  private readonly _accordionGroup;
37
- /** A local unique identifier for the trigger, used to match with its panel's value. */
38
- value: _angular_core.InputSignal<string>;
74
+ /** A unique identifier for the widget. */
75
+ readonly id: _angular_core.InputSignal<string>;
76
+ /** A local unique identifier for the trigger, used to match with its panel's `panelId`. */
77
+ readonly panelId: _angular_core.InputSignal<string>;
39
78
  /** Whether the trigger is disabled. */
40
- disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
41
- /**
42
- * Whether this trigger is completely inaccessible.
43
- *
44
- * TODO(ok7sai): Consider move this to UI patterns.
45
- */
46
- readonly hardDisabled: _angular_core.Signal<boolean>;
79
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
80
+ /** Whether the corresponding panel is expanded. */
81
+ readonly expanded: _angular_core.ModelSignal<boolean>;
82
+ /** Whether the trigger is active. */
83
+ readonly active: _angular_core.Signal<boolean>;
47
84
  /** The accordion panel pattern controlled by this trigger. This is set by AccordionGroup. */
48
- readonly accordionPanel: WritableSignal<AccordionPanelPattern | undefined>;
85
+ readonly _accordionPanelPattern: WritableSignal<AccordionPanelPattern | undefined>;
49
86
  /** The UI pattern instance for this trigger. */
50
87
  readonly _pattern: AccordionTriggerPattern;
88
+ /** Expands this item. */
89
+ expand(): void;
90
+ /** Collapses this item. */
91
+ collapse(): void;
92
+ /** Toggles the expansion state of this item. */
93
+ toggle(): void;
51
94
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AccordionTrigger, never>;
52
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AccordionTrigger, "[ngAccordionTrigger]", ["ngAccordionTrigger"], { "value": { "alias": "value"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
95
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AccordionTrigger, "[ngAccordionTrigger]", ["ngAccordionTrigger"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "panelId": { "alias": "panelId"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "expanded": { "alias": "expanded"; "required": false; "isSignal": true; }; }, { "expanded": "expandedChange"; }, never, never, true, never>;
53
96
  }
54
97
  /**
55
- * Container for a group of accordion items. It manages the overall state and
98
+ * A container for a group of accordion items. It manages the overall state and
56
99
  * interactions of the accordion, such as keyboard navigation and expansion mode.
100
+ *
101
+ * The `ngAccordionGroup` serves as the root of a group of accordion triggers and panels,
102
+ * coordinating the behavior of the `ngAccordionTrigger` and `ngAccordionPanel` elements within it.
103
+ * It supports both single and multiple expansion modes.
104
+ *
105
+ * ```html
106
+ * <div ngAccordionGroup [multiExpandable]="true" [(expandedPanels)]="expandedItems">
107
+ * <div class="accordion-item">
108
+ * <h3>
109
+ * <button ngAccordionTrigger panelId="item-1">Item 1</button>
110
+ * </h3>
111
+ * <div ngAccordionPanel panelId="item-1">
112
+ * <ng-template ngAccordionContent>
113
+ * <p>Content for Item 1.</p>
114
+ * </ng-template>
115
+ * </div>
116
+ * </div>
117
+ * <div class="accordion-item">
118
+ * <h3>
119
+ * <button ngAccordionTrigger panelId="item-2">Item 2</button>
120
+ * </h3>
121
+ * <div ngAccordionPanel panelId="item-2">
122
+ * <ng-template ngAccordionContent>
123
+ * <p>Content for Item 2.</p>
124
+ * </ng-template>
125
+ * </div>
126
+ * </div>
127
+ * </div>
128
+ * ```
129
+ *
130
+ * @developerPreview 21.0
57
131
  */
58
132
  declare class AccordionGroup {
59
133
  /** A reference to the group element. */
60
134
  private readonly _elementRef;
135
+ /** A reference to the group element. */
136
+ readonly element: HTMLElement;
61
137
  /** The AccordionTriggers nested inside this group. */
62
- protected readonly _triggers: _angular_core.Signal<readonly AccordionTrigger[]>;
138
+ private readonly _triggers;
139
+ /** The AccordionTrigger patterns nested inside this group. */
140
+ private readonly _triggerPatterns;
63
141
  /** The AccordionPanels nested inside this group. */
64
- protected readonly _panels: _angular_core.Signal<readonly AccordionPanel[]>;
142
+ private readonly _panels;
65
143
  /** The text direction (ltr or rtl). */
66
144
  readonly textDirection: WritableSignal<_angular_cdk_bidi.Direction>;
67
145
  /** Whether the entire accordion group is disabled. */
68
- disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
146
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
69
147
  /** Whether multiple accordion items can be expanded simultaneously. */
70
- multiExpandable: _angular_core.InputSignalWithTransform<boolean, unknown>;
71
- /** The values of the current selected/expanded accordions. */
72
- value: _angular_core.ModelSignal<string[]>;
73
- /** Whether to allow disabled items to receive focus. */
74
- softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
148
+ readonly multiExpandable: _angular_core.InputSignalWithTransform<boolean, unknown>;
149
+ /**
150
+ * Whether to allow disabled items to receive focus. When `true`, disabled items are
151
+ * focusable but not interactive. When `false`, disabled items are skipped during navigation.
152
+ */
153
+ readonly softDisabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
75
154
  /** Whether keyboard navigation should wrap around from the last item to the first, and vice-versa. */
76
- wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
155
+ readonly wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
77
156
  /** The UI pattern instance for this accordion group. */
78
157
  readonly _pattern: AccordionGroupPattern;
79
158
  constructor();
159
+ /** Expands all accordion panels if multi-expandable. */
160
+ expandAll(): void;
161
+ /** Collapses all accordion panels. */
162
+ collapseAll(): void;
163
+ /** Gets the trigger pattern for a given element. */
164
+ private _getItem;
80
165
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AccordionGroup, never>;
81
- static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AccordionGroup, "[ngAccordionGroup]", ["ngAccordionGroup"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "multiExpandable": { "alias": "multiExpandable"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, ["_triggers", "_panels"], never, true, never>;
166
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AccordionGroup, "[ngAccordionGroup]", ["ngAccordionGroup"], { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "multiExpandable": { "alias": "multiExpandable"; "required": false; "isSignal": true; }; "softDisabled": { "alias": "softDisabled"; "required": false; "isSignal": true; }; "wrap": { "alias": "wrap"; "required": false; "isSignal": true; }; }, {}, ["_triggers", "_panels"], never, true, never>;
82
167
  }
83
168
  /**
84
- * A structural directive that marks the `ng-template` to be used as the content
85
- * for a `AccordionPanel`. This content can be lazily loaded.
169
+ * A structural directive that provides a mechanism for lazily rendering the content for an
170
+ * `ngAccordionPanel`.
171
+ *
172
+ * This directive should be applied to an `ng-template` inside an `ngAccordionPanel`.
173
+ * It allows the content of the panel to be lazily rendered, improving performance
174
+ * by only creating the content when the panel is first expanded.
175
+ *
176
+ * ```html
177
+ * <div ngAccordionPanel panelId="unique-id-1">
178
+ * <ng-template ngAccordionContent>
179
+ * <p>This is the content that will be displayed inside the panel.</p>
180
+ * </ng-template>
181
+ * </div>
182
+ * ```
183
+ *
184
+ * @developerPreview 21.0
86
185
  */
87
186
  declare class AccordionContent {
88
187
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AccordionContent, never>;