@angular/aria 22.0.0-next.0 → 22.0.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.
Files changed (34) hide show
  1. package/fesm2022/_accordion-chunk.mjs +24 -18
  2. package/fesm2022/_accordion-chunk.mjs.map +1 -1
  3. package/fesm2022/_combobox-chunk.mjs.map +1 -1
  4. package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -1
  5. package/fesm2022/_combobox-tree-chunk.mjs.map +1 -1
  6. package/fesm2022/_deferred-content-chunk.mjs.map +1 -1
  7. package/fesm2022/_expansion-chunk.mjs.map +1 -1
  8. package/fesm2022/_list-chunk.mjs.map +1 -1
  9. package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
  10. package/fesm2022/_list-typeahead-chunk.mjs.map +1 -1
  11. package/fesm2022/_menu-chunk.mjs.map +1 -1
  12. package/fesm2022/_pointer-event-manager-chunk.mjs.map +1 -1
  13. package/fesm2022/_signal-like-chunk.mjs.map +1 -1
  14. package/fesm2022/_tabs-chunk.mjs.map +1 -1
  15. package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
  16. package/fesm2022/_widget-chunk.mjs.map +1 -1
  17. package/fesm2022/accordion.mjs +44 -111
  18. package/fesm2022/accordion.mjs.map +1 -1
  19. package/fesm2022/aria.mjs +1 -1
  20. package/fesm2022/aria.mjs.map +1 -1
  21. package/fesm2022/combobox.mjs.map +1 -1
  22. package/fesm2022/grid.mjs.map +1 -1
  23. package/fesm2022/listbox.mjs.map +1 -1
  24. package/fesm2022/menu.mjs.map +1 -1
  25. package/fesm2022/private.mjs +1 -1
  26. package/fesm2022/tabs.mjs.map +1 -1
  27. package/fesm2022/toolbar.mjs.map +1 -1
  28. package/fesm2022/tree.mjs.map +1 -1
  29. package/package.json +2 -2
  30. package/resources/code-examples.db +0 -0
  31. package/types/_accordion-chunk.d.ts +11 -31
  32. package/types/_list-navigation-chunk.d.ts +0 -2
  33. package/types/accordion.d.ts +31 -35
  34. package/types/private.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { WritableSignal } from '@angular/core';
3
- import { AccordionTriggerPattern, AccordionPanelPattern, AccordionGroupPattern } from './_accordion-chunk.js';
2
+ import { OnInit } from '@angular/core';
3
+ import { AccordionTriggerPattern, AccordionGroupPattern } from './_accordion-chunk.js';
4
4
  import { DeferredContentAware, DeferredContent } from './_deferred-content-chunk.js';
5
5
  import * as _angular_cdk_bidi from '@angular/cdk/bidi';
6
6
  import './_keyboard-event-manager-chunk.js';
@@ -11,15 +11,15 @@ import './_expansion-chunk.js';
11
11
  /**
12
12
  * The content panel of an accordion item that is conditionally visible.
13
13
  *
14
- * This directive is a container for the content that is shown or hidden. It requires
15
- * a `panelId` that must match the `panelId` of its corresponding `ngAccordionTrigger`.
14
+ * This directive is a container for the content that is shown or hidden. It should
15
+ * expose a template reference that will be used by the corresponding `ngAccordionTrigger`.
16
16
  * The content within the panel should be provided using an `ng-template` with the
17
17
  * `ngAccordionContent` directive so that the content is not rendered on the page until the trigger
18
18
  * is expanded. It applies `role="region"` for accessibility and uses the `inert` attribute to hide
19
19
  * its content from assistive technologies when not visible.
20
20
  *
21
21
  * ```html
22
- * <div ngAccordionPanel panelId="unique-id-1">
22
+ * <div ngAccordionPanel #panel="ngAccordionPanel">
23
23
  * <ng-template ngAccordionContent>
24
24
  * <p>This content is lazily rendered and will be shown when the panel is expanded.</p>
25
25
  * </ng-template>
@@ -34,14 +34,14 @@ declare class AccordionPanel {
34
34
  private readonly _deferredContentAware;
35
35
  /** A global unique identifier for the panel. */
36
36
  readonly id: _angular_core.InputSignal<string>;
37
- /** A local unique identifier for the panel, used to match with its trigger's `panelId`. */
38
- readonly panelId: _angular_core.InputSignal<string>;
39
37
  /** Whether the accordion panel is visible. True if the associated trigger is expanded. */
40
38
  readonly visible: _angular_core.Signal<boolean>;
41
- /** The parent accordion trigger pattern that controls this panel. This is set by AccordionGroup. */
42
- readonly _accordionTriggerPattern: WritableSignal<AccordionTriggerPattern | undefined>;
43
- /** The UI pattern instance for this panel. */
44
- readonly _pattern: AccordionPanelPattern;
39
+ /**
40
+ * The pattern for the accordion trigger that controls this panel.
41
+ * This is set by the trigger when it initializes.
42
+ * There is no need for a panel pattern, as the trigger has all the necessary logic.
43
+ */
44
+ _pattern?: AccordionTriggerPattern;
45
45
  constructor();
46
46
  /** Expands this item. */
47
47
  expand(): void;
@@ -50,7 +50,7 @@ declare class AccordionPanel {
50
50
  /** Toggles the expansion state of this item. */
51
51
  toggle(): void;
52
52
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AccordionPanel, never>;
53
- 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 DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
53
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AccordionPanel, "[ngAccordionPanel]", ["ngAccordionPanel"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof DeferredContentAware; inputs: { "preserveContent": "preserveContent"; }; outputs: {}; }]>;
54
54
  }
55
55
 
56
56
  /**
@@ -62,12 +62,12 @@ declare class AccordionPanel {
62
62
  * It supports both single and multiple expansion modes.
63
63
  *
64
64
  * ```html
65
- * <div ngAccordionGroup [multiExpandable]="true" [(expandedPanels)]="expandedItems">
65
+ * <div ngAccordionGroup [multiExpandable]="true">
66
66
  * <div class="accordion-item">
67
67
  * <h3>
68
- * <button ngAccordionTrigger panelId="item-1">Item 1</button>
68
+ * <button ngAccordionTrigger [panel]="panel1">Item 1</button>
69
69
  * </h3>
70
- * <div ngAccordionPanel panelId="item-1">
70
+ * <div ngAccordionPanel #panel1="ngAccordionPanel">
71
71
  * <ng-template ngAccordionContent>
72
72
  * <p>Content for Item 1.</p>
73
73
  * </ng-template>
@@ -75,9 +75,9 @@ declare class AccordionPanel {
75
75
  * </div>
76
76
  * <div class="accordion-item">
77
77
  * <h3>
78
- * <button ngAccordionTrigger panelId="item-2">Item 2</button>
78
+ * <button ngAccordionTrigger [panel]="panel2">Item 2</button>
79
79
  * </h3>
80
- * <div ngAccordionPanel panelId="item-2">
80
+ * <div ngAccordionPanel #panel2="ngAccordionPanel">
81
81
  * <ng-template ngAccordionContent>
82
82
  * <p>Content for Item 2.</p>
83
83
  * </ng-template>
@@ -96,10 +96,8 @@ declare class AccordionGroup {
96
96
  readonly element: HTMLElement;
97
97
  /** The AccordionTriggers nested inside this group. */
98
98
  private readonly _triggers;
99
- /** The AccordionTrigger patterns nested inside this group. */
99
+ /** The corresponding patterns for the accordion triggers. */
100
100
  private readonly _triggerPatterns;
101
- /** The AccordionPanels nested inside this group. */
102
- private readonly _panels;
103
101
  /** The text direction (ltr or rtl). */
104
102
  readonly textDirection: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
105
103
  /** Whether the entire accordion group is disabled. */
@@ -115,28 +113,25 @@ declare class AccordionGroup {
115
113
  readonly wrap: _angular_core.InputSignalWithTransform<boolean, unknown>;
116
114
  /** The UI pattern instance for this accordion group. */
117
115
  readonly _pattern: AccordionGroupPattern;
118
- constructor();
119
116
  /** Expands all accordion panels if multi-expandable. */
120
117
  expandAll(): void;
121
118
  /** Collapses all accordion panels. */
122
119
  collapseAll(): void;
123
- /** Gets the trigger pattern for a given element. */
124
- private _getItem;
125
120
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AccordionGroup, never>;
126
- 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>;
121
+ 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"], never, true, never>;
127
122
  }
128
123
 
129
124
  /**
130
125
  * The trigger that toggles the visibility of its associated `ngAccordionPanel`.
131
126
  *
132
- * This directive requires a `panelId` that must match the `panelId` of the `ngAccordionPanel` it
133
- * controls. When clicked, it will expand or collapse the panel. It also handles keyboard
127
+ * This directive requires the `panel` input be set to the template reference of the `ngAccordionPanel`
128
+ * it controls. When clicked, it will expand or collapse the panel. It also handles keyboard
134
129
  * interactions for navigation within the `ngAccordionGroup`. It applies `role="button"` and manages
135
130
  * `aria-expanded`, `aria-controls`, and `aria-disabled` attributes for accessibility.
136
131
  * The `disabled` input can be used to disable the trigger.
137
132
  *
138
133
  * ```html
139
- * <button ngAccordionTrigger panelId="unique-id-1">
134
+ * <button ngAccordionTrigger [panel]="panel">
140
135
  * Accordion Trigger Text
141
136
  * </button>
142
137
  * ```
@@ -144,27 +139,28 @@ declare class AccordionGroup {
144
139
  * @developerPreview 21.0
145
140
  * @see [Accordion](guide/aria/accordion)
146
141
  */
147
- declare class AccordionTrigger {
142
+ declare class AccordionTrigger implements OnInit {
148
143
  /** A reference to the trigger element. */
149
144
  private readonly _elementRef;
150
145
  /** A reference to the trigger element. */
151
146
  readonly element: HTMLElement;
152
147
  /** The parent AccordionGroup. */
153
148
  private readonly _accordionGroup;
154
- /** A unique identifier for the widget. */
149
+ /** The associated AccordionPanel. */
150
+ readonly panel: _angular_core.InputSignal<AccordionPanel>;
151
+ /** The unique identifier for the trigger. */
155
152
  readonly id: _angular_core.InputSignal<string>;
156
- /** A local unique identifier for the trigger, used to match with its panel's `panelId`. */
157
- readonly panelId: _angular_core.InputSignal<string>;
153
+ /** The unique identifier for the correspondingtrigger panel. */
154
+ readonly panelId: _angular_core.Signal<string>;
158
155
  /** Whether the trigger is disabled. */
159
156
  readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
160
157
  /** Whether the corresponding panel is expanded. */
161
158
  readonly expanded: _angular_core.ModelSignal<boolean>;
162
159
  /** Whether the trigger is active. */
163
160
  readonly active: _angular_core.Signal<boolean>;
164
- /** The accordion panel pattern controlled by this trigger. This is set by AccordionGroup. */
165
- readonly _accordionPanelPattern: WritableSignal<AccordionPanelPattern | undefined>;
166
161
  /** The UI pattern instance for this trigger. */
167
- readonly _pattern: AccordionTriggerPattern;
162
+ _pattern: AccordionTriggerPattern;
163
+ ngOnInit(): void;
168
164
  /** Expands this item. */
169
165
  expand(): void;
170
166
  /** Collapses this item. */
@@ -172,7 +168,7 @@ declare class AccordionTrigger {
172
168
  /** Toggles the expansion state of this item. */
173
169
  toggle(): void;
174
170
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<AccordionTrigger, never>;
175
- 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>;
171
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AccordionTrigger, "[ngAccordionTrigger]", ["ngAccordionTrigger"], { "panel": { "alias": "panel"; "required": true; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "expanded": { "alias": "expanded"; "required": false; "isSignal": true; }; }, { "expanded": "expandedChange"; }, never, never, true, never>;
176
172
  }
177
173
 
178
174
  /**
@@ -7,7 +7,7 @@ export { WritableSignalLike, computed, convertGetterSetterToWritableSignalLike,
7
7
  export { MenuBarInputs, MenuBarPattern, MenuInputs, MenuItemInputs, MenuItemPattern, MenuPattern, MenuTriggerInputs, MenuTriggerPattern } from './_menu-chunk.js';
8
8
  export { TabInputs, TabListInputs, TabListPattern, TabPanelInputs, TabPanelPattern, TabPattern } from './_tabs-chunk.js';
9
9
  export { ToolbarInputs, ToolbarPattern, ToolbarWidgetGroupInputs, ToolbarWidgetGroupPattern, ToolbarWidgetInputs, ToolbarWidgetPattern } from './_toolbar-chunk.js';
10
- export { AccordionGroupInputs, AccordionGroupPattern, AccordionPanelInputs, AccordionPanelPattern, AccordionTriggerInputs, AccordionTriggerPattern } from './_accordion-chunk.js';
10
+ export { AccordionGroupInputs, AccordionGroupPattern, AccordionTriggerInputs, AccordionTriggerPattern } from './_accordion-chunk.js';
11
11
  import { TreeInputs, TreeItemPattern, TreePattern } from './_tree-chunk.js';
12
12
  export { TreeItemInputs } from './_tree-chunk.js';
13
13
  export { GridCellInputs, GridCellPattern, GridCellWidgetInputs, GridCellWidgetPattern, GridInputs, GridPattern, GridRowInputs, GridRowPattern } from './_grid-chunk.js';