@angular/aria 22.0.0-next.4 → 22.0.0-next.6

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 (87) hide show
  1. package/fesm2022/_accordion-chunk.mjs +5 -5
  2. package/fesm2022/_accordion-chunk.mjs.map +1 -1
  3. package/fesm2022/_click-event-manager-chunk.mjs.map +1 -1
  4. package/fesm2022/_combobox-chunk.mjs +5 -5
  5. package/fesm2022/_combobox-chunk.mjs.map +1 -1
  6. package/fesm2022/_combobox-listbox-chunk.mjs +1 -1
  7. package/fesm2022/_combobox-listbox-chunk.mjs.map +1 -1
  8. package/fesm2022/_combobox-tree-chunk.mjs +6 -6
  9. package/fesm2022/_combobox-tree-chunk.mjs.map +1 -1
  10. package/fesm2022/_deferred-content-chunk.mjs.map +1 -1
  11. package/fesm2022/_element-chunk.mjs +6 -0
  12. package/fesm2022/_element-chunk.mjs.map +1 -0
  13. package/fesm2022/_expansion-chunk.mjs.map +1 -1
  14. package/fesm2022/_list-chunk.mjs.map +1 -1
  15. package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
  16. package/fesm2022/_list-typeahead-chunk.mjs.map +1 -1
  17. package/fesm2022/_menu-chunk.mjs.map +1 -1
  18. package/fesm2022/_pointer-event-manager-chunk.mjs.map +1 -1
  19. package/fesm2022/_signal-like-chunk.mjs.map +1 -1
  20. package/fesm2022/_tabs-chunk.mjs +1 -1
  21. package/fesm2022/_tabs-chunk.mjs.map +1 -1
  22. package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
  23. package/fesm2022/_widget-chunk.mjs +12 -166
  24. package/fesm2022/_widget-chunk.mjs.map +1 -1
  25. package/fesm2022/accordion-testing.mjs +61 -0
  26. package/fesm2022/accordion-testing.mjs.map +1 -0
  27. package/fesm2022/accordion.mjs +208 -183
  28. package/fesm2022/accordion.mjs.map +1 -1
  29. package/fesm2022/aria.mjs +1 -1
  30. package/fesm2022/aria.mjs.map +1 -1
  31. package/fesm2022/combobox.mjs.map +1 -1
  32. package/fesm2022/grid.mjs +14 -85
  33. package/fesm2022/grid.mjs.map +1 -1
  34. package/fesm2022/listbox-testing.mjs +55 -0
  35. package/fesm2022/listbox-testing.mjs.map +1 -0
  36. package/fesm2022/listbox.mjs +1 -1
  37. package/fesm2022/listbox.mjs.map +1 -1
  38. package/fesm2022/menu-testing.mjs +75 -0
  39. package/fesm2022/menu-testing.mjs.map +1 -0
  40. package/fesm2022/menu.mjs.map +1 -1
  41. package/fesm2022/private.mjs +2 -1
  42. package/fesm2022/private.mjs.map +1 -1
  43. package/fesm2022/tabs-testing.mjs +57 -0
  44. package/fesm2022/tabs-testing.mjs.map +1 -0
  45. package/fesm2022/tabs.mjs +3 -5
  46. package/fesm2022/tabs.mjs.map +1 -1
  47. package/fesm2022/toolbar-testing.mjs +56 -0
  48. package/fesm2022/toolbar-testing.mjs.map +1 -0
  49. package/fesm2022/toolbar.mjs +8 -6
  50. package/fesm2022/toolbar.mjs.map +1 -1
  51. package/fesm2022/tree-testing.mjs +88 -0
  52. package/fesm2022/tree-testing.mjs.map +1 -0
  53. package/fesm2022/tree.mjs +4 -6
  54. package/fesm2022/tree.mjs.map +1 -1
  55. package/package.json +26 -2
  56. package/resources/code-examples.db +0 -0
  57. package/types/_accordion-chunk.d.ts +10 -9
  58. package/types/_click-event-manager-chunk.d.ts +1 -1
  59. package/types/_combobox-chunk.d.ts +23 -23
  60. package/types/_element-chunk.d.ts +10 -0
  61. package/types/_expansion-chunk.d.ts +1 -1
  62. package/types/_grid-chunk.d.ts +11 -49
  63. package/types/_keyboard-event-manager-chunk.d.ts +2 -2
  64. package/types/_list-chunk.d.ts +19 -18
  65. package/types/_list-navigation-chunk.d.ts +6 -16
  66. package/types/_listbox-chunk.d.ts +27 -27
  67. package/types/_menu-chunk.d.ts +51 -51
  68. package/types/_pointer-event-manager-chunk.d.ts +1 -1
  69. package/types/_signal-like-chunk.d.ts +14 -0
  70. package/types/_tabs-chunk.d.ts +2 -1
  71. package/types/_toolbar-chunk.d.ts +1 -1
  72. package/types/_tree-chunk.d.ts +18 -17
  73. package/types/accordion-testing.d.ts +63 -0
  74. package/types/accordion.d.ts +69 -55
  75. package/types/combobox.d.ts +6 -5
  76. package/types/grid.d.ts +8 -14
  77. package/types/listbox-testing.d.ts +39 -0
  78. package/types/listbox.d.ts +19 -18
  79. package/types/menu-testing.d.ts +50 -0
  80. package/types/menu.d.ts +4 -3
  81. package/types/private.d.ts +46 -44
  82. package/types/tabs-testing.d.ts +57 -0
  83. package/types/tabs.d.ts +3 -5
  84. package/types/toolbar-testing.d.ts +72 -0
  85. package/types/toolbar.d.ts +3 -2
  86. package/types/tree-testing.d.ts +75 -0
  87. package/types/tree.d.ts +5 -6
@@ -0,0 +1,61 @@
1
+ import { ComponentHarness, HarnessPredicate, ContentContainerComponentHarness } from '@angular/cdk/testing';
2
+
3
+ var AccordionSection;
4
+ (function (AccordionSection) {
5
+ AccordionSection["TRIGGER"] = "[ngAccordionTrigger]";
6
+ AccordionSection["PANEL"] = "[ngAccordionPanel]";
7
+ })(AccordionSection || (AccordionSection = {}));
8
+ class AccordionHarness extends ContentContainerComponentHarness {
9
+ static hostSelector = '[ngAccordionTrigger]';
10
+ static with(options = {}) {
11
+ return new HarnessPredicate(AccordionHarness, options).addOption('title', options.title, (harness, title) => HarnessPredicate.stringMatches(harness.getTitle(), title)).addOption('expanded', options.expanded, async (harness, expanded) => (await harness.isExpanded()) === expanded).addOption('disabled', options.disabled, async (harness, disabled) => (await harness.isDisabled()) === disabled);
12
+ }
13
+ async getRootHarnessLoader() {
14
+ const panelId = await (await this.host()).getAttribute('aria-controls');
15
+ const documentRoot = await this.documentRootLocatorFactory().rootHarnessLoader();
16
+ return documentRoot.getChildLoader(`[ngAccordionPanel][id="${panelId}"]`);
17
+ }
18
+ async isExpanded() {
19
+ return (await (await this.host()).getAttribute('aria-expanded')) === 'true';
20
+ }
21
+ async isDisabled() {
22
+ return (await (await this.host()).getAttribute('aria-disabled')) === 'true';
23
+ }
24
+ async getTitle() {
25
+ return (await this.host()).text();
26
+ }
27
+ async toggle() {
28
+ await (await this.host()).click();
29
+ }
30
+ async expand() {
31
+ if (!(await this.isExpanded())) {
32
+ await this.toggle();
33
+ }
34
+ }
35
+ async collapse() {
36
+ if (await this.isExpanded()) {
37
+ await this.toggle();
38
+ }
39
+ }
40
+ async focus() {
41
+ await (await this.host()).focus();
42
+ }
43
+ async blur() {
44
+ await (await this.host()).blur();
45
+ }
46
+ async isFocused() {
47
+ return (await this.host()).isFocused();
48
+ }
49
+ }
50
+ class AccordionGroupHarness extends ComponentHarness {
51
+ static hostSelector = '[ngAccordionGroup]';
52
+ static with(options = {}) {
53
+ return new HarnessPredicate(AccordionGroupHarness, options);
54
+ }
55
+ async getAccordions(filters = {}) {
56
+ return this.locatorForAll(AccordionHarness.with(filters))();
57
+ }
58
+ }
59
+
60
+ export { AccordionGroupHarness, AccordionHarness, AccordionSection };
61
+ //# sourceMappingURL=accordion-testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordion-testing.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/src/aria/accordion/testing/accordion-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n ComponentHarness,\n ContentContainerComponentHarness,\n HarnessPredicate,\n} from '@angular/cdk/testing';\nimport {AccordionHarnessFilters, AccordionGroupHarnessFilters} from './accordion-harness-filters';\n\n/** Selectors for the sections that may contain user content. */\nexport enum AccordionSection {\n TRIGGER = '[ngAccordionTrigger]',\n PANEL = '[ngAccordionPanel]',\n}\n\n/** Harness for interacting with a standard ngAccordion item in tests. */\nexport class AccordionHarness extends ContentContainerComponentHarness<AccordionSection> {\n static hostSelector = '[ngAccordionTrigger]';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for an accordion\n * with specific attributes.\n */\n static with(options: AccordionHarnessFilters = {}): HarnessPredicate<AccordionHarness> {\n return new HarnessPredicate(AccordionHarness, options)\n .addOption('title', options.title, (harness, title) =>\n HarnessPredicate.stringMatches(harness.getTitle(), title),\n )\n .addOption(\n 'expanded',\n options.expanded,\n async (harness, expanded) => (await harness.isExpanded()) === expanded,\n )\n .addOption(\n 'disabled',\n options.disabled,\n async (harness, disabled) => (await harness.isDisabled()) === disabled,\n );\n }\n\n /** Overrides the internal loader to automatically resolve queries inside the associated panel. */\n protected override async getRootHarnessLoader() {\n const panelId = await (await this.host()).getAttribute('aria-controls');\n const documentRoot = await this.documentRootLocatorFactory().rootHarnessLoader();\n return documentRoot.getChildLoader(`[ngAccordionPanel][id=\"${panelId}\"]`);\n }\n\n /** Whether the accordion is expanded. */\n async isExpanded(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-expanded')) === 'true';\n }\n\n /** Whether the accordion is disabled. */\n async isDisabled(): Promise<boolean> {\n return (await (await this.host()).getAttribute('aria-disabled')) === 'true';\n }\n\n /** Gets the title text of the accordion. */\n async getTitle(): Promise<string> {\n return (await this.host()).text();\n }\n\n /** Toggles the expanded state of the accordion by clicking on the trigger. */\n async toggle(): Promise<void> {\n await (await this.host()).click();\n }\n\n /** Expands the accordion if collapsed. */\n async expand(): Promise<void> {\n if (!(await this.isExpanded())) {\n await this.toggle();\n }\n }\n\n /** Collapses the accordion if expanded. */\n async collapse(): Promise<void> {\n if (await this.isExpanded()) {\n await this.toggle();\n }\n }\n\n /** Focuses the accordion trigger. */\n async focus(): Promise<void> {\n await (await this.host()).focus();\n }\n\n /** Blurs the accordion trigger. */\n async blur(): Promise<void> {\n await (await this.host()).blur();\n }\n\n /** Whether the accordion trigger is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n}\n\n/** Harness for interacting with an `ngAccordionGroup` in tests. */\nexport class AccordionGroupHarness extends ComponentHarness {\n static hostSelector = '[ngAccordionGroup]';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for an accordion group with specific attributes.\n */\n static with(options: AccordionGroupHarnessFilters = {}): HarnessPredicate<AccordionGroupHarness> {\n return new HarnessPredicate(AccordionGroupHarness, options);\n }\n\n /** Gets all accordions within this group. */\n async getAccordions(filters: AccordionHarnessFilters = {}): Promise<AccordionHarness[]> {\n return this.locatorForAll(AccordionHarness.with(filters))();\n }\n}\n"],"names":["AccordionSection","AccordionHarness","ContentContainerComponentHarness","hostSelector","with","options","HarnessPredicate","addOption","title","harness","stringMatches","getTitle","expanded","isExpanded","disabled","isDisabled","getRootHarnessLoader","panelId","host","getAttribute","documentRoot","documentRootLocatorFactory","rootHarnessLoader","getChildLoader","text","toggle","click","expand","collapse","focus","blur","isFocused","AccordionGroupHarness","ComponentHarness","getAccordions","filters","locatorForAll"],"mappings":"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"}
@@ -1,16 +1,19 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, input, computed, afterRenderEffect, Directive, InjectionToken, ElementRef, booleanAttribute, model, contentChildren, signal } from '@angular/core';
2
+ import { inject, ElementRef, input, computed, afterRenderEffect, Directive, InjectionToken, signal, booleanAttribute, model } from '@angular/core';
3
3
  import { DeferredContentAware, DeferredContent } from './_deferred-content-chunk.mjs';
4
4
  import { Directionality } from '@angular/cdk/bidi';
5
+ import { sortDirectives } from './_element-chunk.mjs';
6
+ import { AccordionGroupPattern, AccordionTriggerPattern } from './_accordion-chunk.mjs';
5
7
  import { _IdGenerator } from '@angular/cdk/a11y';
6
- import { AccordionTriggerPattern, AccordionGroupPattern } from './_accordion-chunk.mjs';
7
8
  import './_expansion-chunk.mjs';
8
9
  import './_list-navigation-chunk.mjs';
9
10
  import './_signal-like-chunk.mjs';
10
11
  import '@angular/core/primitives/signals';
11
- import './_pointer-event-manager-chunk.mjs';
12
+ import './_click-event-manager-chunk.mjs';
12
13
 
13
14
  class AccordionPanel {
15
+ _elementRef = inject(ElementRef);
16
+ element = this._elementRef.nativeElement;
14
17
  _deferredContentAware = inject(DeferredContentAware);
15
18
  id = input(inject(_IdGenerator).getId('ng-accordion-panel-', true), ...(ngDevMode ? [{
16
19
  debugName: "id"
@@ -111,112 +114,126 @@ i0.ɵɵngDeclareClassMetadata({
111
114
 
112
115
  const ACCORDION_GROUP = new InjectionToken('ACCORDION_GROUP');
113
116
 
114
- class AccordionTrigger {
117
+ class AccordionGroup {
115
118
  _elementRef = inject(ElementRef);
116
119
  element = this._elementRef.nativeElement;
117
- _accordionGroup = inject(ACCORDION_GROUP);
118
- panel = input.required(...(ngDevMode ? [{
119
- debugName: "panel"
120
+ _triggers = signal(new Set(), ...(ngDevMode ? [{
121
+ debugName: "_triggers"
120
122
  }] : []));
121
- id = input(inject(_IdGenerator).getId('ng-accordion-trigger-', true), ...(ngDevMode ? [{
122
- debugName: "id"
123
+ _sortedTriggers = computed(() => {
124
+ const triggers = [...this._triggers()];
125
+ const sortFn = triggers[0]?.index() === undefined ? sortDirectives : (a, b) => a.index() - b.index();
126
+ return triggers.sort(sortFn);
127
+ }, ...(ngDevMode ? [{
128
+ debugName: "_sortedTriggers"
123
129
  }] : []));
124
- panelId = computed(() => this.panel().id(), ...(ngDevMode ? [{
125
- debugName: "panelId"
130
+ _triggerPatterns = computed(() => {
131
+ return this._sortedTriggers().map(t => t._pattern);
132
+ }, ...(ngDevMode ? [{
133
+ debugName: "_triggerPatterns"
126
134
  }] : []));
135
+ textDirection = inject(Directionality).valueSignal;
127
136
  disabled = input(false, {
128
137
  ...(ngDevMode ? {
129
138
  debugName: "disabled"
130
139
  } : {}),
131
140
  transform: booleanAttribute
132
141
  });
133
- expanded = model(false, ...(ngDevMode ? [{
134
- debugName: "expanded"
135
- }] : []));
136
- active = computed(() => this._pattern.active(), ...(ngDevMode ? [{
137
- debugName: "active"
138
- }] : []));
139
- _pattern;
140
- ngOnInit() {
141
- this._pattern = new AccordionTriggerPattern({
142
- ...this,
143
- element: () => this.element,
144
- accordionGroup: () => this._accordionGroup._pattern,
145
- accordionPanelId: this.panelId
146
- });
147
- this.panel()._pattern = this._pattern;
142
+ multiExpandable = input(true, {
143
+ ...(ngDevMode ? {
144
+ debugName: "multiExpandable"
145
+ } : {}),
146
+ transform: booleanAttribute
147
+ });
148
+ softDisabled = input(true, {
149
+ ...(ngDevMode ? {
150
+ debugName: "softDisabled"
151
+ } : {}),
152
+ transform: booleanAttribute
153
+ });
154
+ wrap = input(false, {
155
+ ...(ngDevMode ? {
156
+ debugName: "wrap"
157
+ } : {}),
158
+ transform: booleanAttribute
159
+ });
160
+ _pattern = new AccordionGroupPattern({
161
+ ...this,
162
+ element: () => this.element,
163
+ activeItem: signal(undefined),
164
+ items: this._triggerPatterns,
165
+ orientation: () => 'vertical'
166
+ });
167
+ expandAll() {
168
+ this._pattern.expandAll();
148
169
  }
149
- expand() {
150
- this._pattern.open();
170
+ collapseAll() {
171
+ this._pattern.collapseAll();
151
172
  }
152
- collapse() {
153
- this._pattern.close();
173
+ _registerTrigger(trigger) {
174
+ this._triggers().add(trigger);
175
+ this._triggers.set(new Set(this._triggers()));
154
176
  }
155
- toggle() {
156
- this._pattern.toggle();
177
+ _unregisterTrigger(trigger) {
178
+ this._triggers().delete(trigger);
179
+ this._triggers.set(new Set(this._triggers()));
157
180
  }
158
181
  static ɵfac = i0.ɵɵngDeclareFactory({
159
182
  minVersion: "12.0.0",
160
183
  version: "22.0.0-next.6",
161
184
  ngImport: i0,
162
- type: AccordionTrigger,
185
+ type: AccordionGroup,
163
186
  deps: [],
164
187
  target: i0.ɵɵFactoryTarget.Directive
165
188
  });
166
189
  static ɵdir = i0.ɵɵngDeclareDirective({
167
190
  minVersion: "17.1.0",
168
191
  version: "22.0.0-next.6",
169
- type: AccordionTrigger,
192
+ type: AccordionGroup,
170
193
  isStandalone: true,
171
- selector: "[ngAccordionTrigger]",
194
+ selector: "[ngAccordionGroup]",
172
195
  inputs: {
173
- panel: {
174
- classPropertyName: "panel",
175
- publicName: "panel",
196
+ disabled: {
197
+ classPropertyName: "disabled",
198
+ publicName: "disabled",
176
199
  isSignal: true,
177
- isRequired: true,
200
+ isRequired: false,
178
201
  transformFunction: null
179
202
  },
180
- id: {
181
- classPropertyName: "id",
182
- publicName: "id",
203
+ multiExpandable: {
204
+ classPropertyName: "multiExpandable",
205
+ publicName: "multiExpandable",
183
206
  isSignal: true,
184
207
  isRequired: false,
185
208
  transformFunction: null
186
209
  },
187
- disabled: {
188
- classPropertyName: "disabled",
189
- publicName: "disabled",
210
+ softDisabled: {
211
+ classPropertyName: "softDisabled",
212
+ publicName: "softDisabled",
190
213
  isSignal: true,
191
214
  isRequired: false,
192
215
  transformFunction: null
193
216
  },
194
- expanded: {
195
- classPropertyName: "expanded",
196
- publicName: "expanded",
217
+ wrap: {
218
+ classPropertyName: "wrap",
219
+ publicName: "wrap",
197
220
  isSignal: true,
198
221
  isRequired: false,
199
222
  transformFunction: null
200
223
  }
201
224
  },
202
- outputs: {
203
- expanded: "expandedChange"
204
- },
205
225
  host: {
206
- attributes: {
207
- "role": "button"
208
- },
209
- properties: {
210
- "attr.data-active": "active()",
211
- "id": "id()",
212
- "attr.aria-expanded": "expanded()",
213
- "attr.aria-controls": "_pattern.controls()",
214
- "attr.aria-disabled": "_pattern.disabled()",
215
- "attr.disabled": "_pattern.hardDisabled() ? true : null",
216
- "attr.tabindex": "_pattern.tabIndex()"
226
+ listeners: {
227
+ "keydown": "_pattern.onKeydown($event)",
228
+ "click": "_pattern.onClick($event)",
229
+ "focusin": "_pattern.onFocus($event)"
217
230
  }
218
231
  },
219
- exportAs: ["ngAccordionTrigger"],
232
+ providers: [{
233
+ provide: ACCORDION_GROUP,
234
+ useExisting: AccordionGroup
235
+ }],
236
+ exportAs: ["ngAccordionGroup"],
220
237
  ngImport: i0
221
238
  });
222
239
  }
@@ -224,175 +241,180 @@ i0.ɵɵngDeclareClassMetadata({
224
241
  minVersion: "12.0.0",
225
242
  version: "22.0.0-next.6",
226
243
  ngImport: i0,
227
- type: AccordionTrigger,
244
+ type: AccordionGroup,
228
245
  decorators: [{
229
246
  type: Directive,
230
247
  args: [{
231
- selector: '[ngAccordionTrigger]',
232
- exportAs: 'ngAccordionTrigger',
248
+ selector: '[ngAccordionGroup]',
249
+ exportAs: 'ngAccordionGroup',
233
250
  host: {
234
- '[attr.data-active]': 'active()',
235
- 'role': 'button',
236
- '[id]': 'id()',
237
- '[attr.aria-expanded]': 'expanded()',
238
- '[attr.aria-controls]': '_pattern.controls()',
239
- '[attr.aria-disabled]': '_pattern.disabled()',
240
- '[attr.disabled]': '_pattern.hardDisabled() ? true : null',
241
- '[attr.tabindex]': '_pattern.tabIndex()'
242
- }
251
+ '(keydown)': '_pattern.onKeydown($event)',
252
+ '(click)': '_pattern.onClick($event)',
253
+ '(focusin)': '_pattern.onFocus($event)'
254
+ },
255
+ providers: [{
256
+ provide: ACCORDION_GROUP,
257
+ useExisting: AccordionGroup
258
+ }]
243
259
  }]
244
260
  }],
245
261
  propDecorators: {
246
- panel: [{
262
+ disabled: [{
247
263
  type: i0.Input,
248
264
  args: [{
249
265
  isSignal: true,
250
- alias: "panel",
251
- required: true
266
+ alias: "disabled",
267
+ required: false
252
268
  }]
253
269
  }],
254
- id: [{
270
+ multiExpandable: [{
255
271
  type: i0.Input,
256
272
  args: [{
257
273
  isSignal: true,
258
- alias: "id",
274
+ alias: "multiExpandable",
259
275
  required: false
260
276
  }]
261
277
  }],
262
- disabled: [{
278
+ softDisabled: [{
263
279
  type: i0.Input,
264
280
  args: [{
265
281
  isSignal: true,
266
- alias: "disabled",
282
+ alias: "softDisabled",
267
283
  required: false
268
284
  }]
269
285
  }],
270
- expanded: [{
286
+ wrap: [{
271
287
  type: i0.Input,
272
288
  args: [{
273
289
  isSignal: true,
274
- alias: "expanded",
290
+ alias: "wrap",
275
291
  required: false
276
292
  }]
277
- }, {
278
- type: i0.Output,
279
- args: ["expandedChange"]
280
293
  }]
281
294
  }
282
295
  });
283
296
 
284
- class AccordionGroup {
297
+ class AccordionTrigger {
285
298
  _elementRef = inject(ElementRef);
286
299
  element = this._elementRef.nativeElement;
287
- _triggers = contentChildren(AccordionTrigger, {
288
- ...(ngDevMode ? {
289
- debugName: "_triggers"
290
- } : {}),
291
- descendants: true
292
- });
293
- _triggerPatterns = computed(() => this._triggers().map(t => t._pattern), ...(ngDevMode ? [{
294
- debugName: "_triggerPatterns"
300
+ _accordionGroup = inject(ACCORDION_GROUP);
301
+ panel = input.required(...(ngDevMode ? [{
302
+ debugName: "panel"
303
+ }] : []));
304
+ id = input(inject(_IdGenerator).getId('ng-accordion-trigger-', true), ...(ngDevMode ? [{
305
+ debugName: "id"
306
+ }] : []));
307
+ panelId = computed(() => this.panel().id(), ...(ngDevMode ? [{
308
+ debugName: "panelId"
295
309
  }] : []));
296
- textDirection = inject(Directionality).valueSignal;
297
310
  disabled = input(false, {
298
311
  ...(ngDevMode ? {
299
312
  debugName: "disabled"
300
313
  } : {}),
301
314
  transform: booleanAttribute
302
315
  });
303
- multiExpandable = input(true, {
304
- ...(ngDevMode ? {
305
- debugName: "multiExpandable"
306
- } : {}),
307
- transform: booleanAttribute
308
- });
309
- softDisabled = input(true, {
310
- ...(ngDevMode ? {
311
- debugName: "softDisabled"
312
- } : {}),
313
- transform: booleanAttribute
314
- });
315
- wrap = input(false, {
316
- ...(ngDevMode ? {
317
- debugName: "wrap"
318
- } : {}),
319
- transform: booleanAttribute
320
- });
321
- _pattern = new AccordionGroupPattern({
322
- ...this,
323
- element: () => this.element,
324
- activeItem: signal(undefined),
325
- items: this._triggerPatterns,
326
- orientation: () => 'vertical'
327
- });
328
- expandAll() {
329
- this._pattern.expandAll();
316
+ index = input(...(ngDevMode ? [undefined, {
317
+ debugName: "index"
318
+ }] : []));
319
+ expanded = model(false, ...(ngDevMode ? [{
320
+ debugName: "expanded"
321
+ }] : []));
322
+ active = computed(() => this._pattern.active(), ...(ngDevMode ? [{
323
+ debugName: "active"
324
+ }] : []));
325
+ _pattern;
326
+ ngOnInit() {
327
+ this._pattern = new AccordionTriggerPattern({
328
+ ...this,
329
+ element: () => this.element,
330
+ accordionGroup: () => this._accordionGroup._pattern,
331
+ accordionPanelId: this.panelId
332
+ });
333
+ this.panel()._pattern = this._pattern;
334
+ this._accordionGroup._registerTrigger(this);
330
335
  }
331
- collapseAll() {
332
- this._pattern.collapseAll();
336
+ ngOnDestroy() {
337
+ this.panel()._pattern = undefined;
338
+ this._accordionGroup._unregisterTrigger(this);
339
+ }
340
+ expand() {
341
+ this._pattern.open();
342
+ }
343
+ collapse() {
344
+ this._pattern.close();
345
+ }
346
+ toggle() {
347
+ this._pattern.toggle();
333
348
  }
334
349
  static ɵfac = i0.ɵɵngDeclareFactory({
335
350
  minVersion: "12.0.0",
336
351
  version: "22.0.0-next.6",
337
352
  ngImport: i0,
338
- type: AccordionGroup,
353
+ type: AccordionTrigger,
339
354
  deps: [],
340
355
  target: i0.ɵɵFactoryTarget.Directive
341
356
  });
342
357
  static ɵdir = i0.ɵɵngDeclareDirective({
343
- minVersion: "17.2.0",
358
+ minVersion: "17.1.0",
344
359
  version: "22.0.0-next.6",
345
- type: AccordionGroup,
360
+ type: AccordionTrigger,
346
361
  isStandalone: true,
347
- selector: "[ngAccordionGroup]",
362
+ selector: "[ngAccordionTrigger]",
348
363
  inputs: {
349
- disabled: {
350
- classPropertyName: "disabled",
351
- publicName: "disabled",
364
+ panel: {
365
+ classPropertyName: "panel",
366
+ publicName: "panel",
367
+ isSignal: true,
368
+ isRequired: true,
369
+ transformFunction: null
370
+ },
371
+ id: {
372
+ classPropertyName: "id",
373
+ publicName: "id",
352
374
  isSignal: true,
353
375
  isRequired: false,
354
376
  transformFunction: null
355
377
  },
356
- multiExpandable: {
357
- classPropertyName: "multiExpandable",
358
- publicName: "multiExpandable",
378
+ disabled: {
379
+ classPropertyName: "disabled",
380
+ publicName: "disabled",
359
381
  isSignal: true,
360
382
  isRequired: false,
361
383
  transformFunction: null
362
384
  },
363
- softDisabled: {
364
- classPropertyName: "softDisabled",
365
- publicName: "softDisabled",
385
+ index: {
386
+ classPropertyName: "index",
387
+ publicName: "index",
366
388
  isSignal: true,
367
389
  isRequired: false,
368
390
  transformFunction: null
369
391
  },
370
- wrap: {
371
- classPropertyName: "wrap",
372
- publicName: "wrap",
392
+ expanded: {
393
+ classPropertyName: "expanded",
394
+ publicName: "expanded",
373
395
  isSignal: true,
374
396
  isRequired: false,
375
397
  transformFunction: null
376
398
  }
377
399
  },
400
+ outputs: {
401
+ expanded: "expandedChange"
402
+ },
378
403
  host: {
379
- listeners: {
380
- "keydown": "_pattern.onKeydown($event)",
381
- "pointerdown": "_pattern.onPointerdown($event)",
382
- "focusin": "_pattern.onFocus($event)"
404
+ attributes: {
405
+ "role": "button"
406
+ },
407
+ properties: {
408
+ "attr.data-active": "active()",
409
+ "id": "id()",
410
+ "attr.aria-expanded": "expanded()",
411
+ "attr.aria-controls": "_pattern.controls()",
412
+ "attr.aria-disabled": "_pattern.disabled()",
413
+ "attr.disabled": "_pattern.hardDisabled() ? true : null",
414
+ "attr.tabindex": "_pattern.tabIndex()"
383
415
  }
384
416
  },
385
- providers: [{
386
- provide: ACCORDION_GROUP,
387
- useExisting: AccordionGroup
388
- }],
389
- queries: [{
390
- propertyName: "_triggers",
391
- predicate: AccordionTrigger,
392
- descendants: true,
393
- isSignal: true
394
- }],
395
- exportAs: ["ngAccordionGroup"],
417
+ exportAs: ["ngAccordionTrigger"],
396
418
  ngImport: i0
397
419
  });
398
420
  }
@@ -400,64 +422,67 @@ i0.ɵɵngDeclareClassMetadata({
400
422
  minVersion: "12.0.0",
401
423
  version: "22.0.0-next.6",
402
424
  ngImport: i0,
403
- type: AccordionGroup,
425
+ type: AccordionTrigger,
404
426
  decorators: [{
405
427
  type: Directive,
406
428
  args: [{
407
- selector: '[ngAccordionGroup]',
408
- exportAs: 'ngAccordionGroup',
429
+ selector: '[ngAccordionTrigger]',
430
+ exportAs: 'ngAccordionTrigger',
409
431
  host: {
410
- '(keydown)': '_pattern.onKeydown($event)',
411
- '(pointerdown)': '_pattern.onPointerdown($event)',
412
- '(focusin)': '_pattern.onFocus($event)'
413
- },
414
- providers: [{
415
- provide: ACCORDION_GROUP,
416
- useExisting: AccordionGroup
417
- }]
432
+ '[attr.data-active]': 'active()',
433
+ 'role': 'button',
434
+ '[id]': 'id()',
435
+ '[attr.aria-expanded]': 'expanded()',
436
+ '[attr.aria-controls]': '_pattern.controls()',
437
+ '[attr.aria-disabled]': '_pattern.disabled()',
438
+ '[attr.disabled]': '_pattern.hardDisabled() ? true : null',
439
+ '[attr.tabindex]': '_pattern.tabIndex()'
440
+ }
418
441
  }]
419
442
  }],
420
443
  propDecorators: {
421
- _triggers: [{
422
- type: i0.ContentChildren,
423
- args: [i0.forwardRef(() => AccordionTrigger), {
424
- ...{
425
- descendants: true
426
- },
427
- isSignal: true
444
+ panel: [{
445
+ type: i0.Input,
446
+ args: [{
447
+ isSignal: true,
448
+ alias: "panel",
449
+ required: true
428
450
  }]
429
451
  }],
430
- disabled: [{
452
+ id: [{
431
453
  type: i0.Input,
432
454
  args: [{
433
455
  isSignal: true,
434
- alias: "disabled",
456
+ alias: "id",
435
457
  required: false
436
458
  }]
437
459
  }],
438
- multiExpandable: [{
460
+ disabled: [{
439
461
  type: i0.Input,
440
462
  args: [{
441
463
  isSignal: true,
442
- alias: "multiExpandable",
464
+ alias: "disabled",
443
465
  required: false
444
466
  }]
445
467
  }],
446
- softDisabled: [{
468
+ index: [{
447
469
  type: i0.Input,
448
470
  args: [{
449
471
  isSignal: true,
450
- alias: "softDisabled",
472
+ alias: "index",
451
473
  required: false
452
474
  }]
453
475
  }],
454
- wrap: [{
476
+ expanded: [{
455
477
  type: i0.Input,
456
478
  args: [{
457
479
  isSignal: true,
458
- alias: "wrap",
480
+ alias: "expanded",
459
481
  required: false
460
482
  }]
483
+ }, {
484
+ type: i0.Output,
485
+ args: ["expandedChange"]
461
486
  }]
462
487
  }
463
488
  });