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

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 (105) hide show
  1. package/fesm2022/_accordion-chunk.mjs +1 -1
  2. package/fesm2022/_accordion-chunk.mjs.map +1 -1
  3. package/fesm2022/_click-event-manager-chunk.mjs +1 -1
  4. package/fesm2022/_click-event-manager-chunk.mjs.map +1 -1
  5. package/fesm2022/{_signal-like-chunk.mjs → _collection-chunk.mjs} +51 -3
  6. package/fesm2022/_collection-chunk.mjs.map +1 -0
  7. package/fesm2022/_deferred-content-chunk.mjs +16 -14
  8. package/fesm2022/_deferred-content-chunk.mjs.map +1 -1
  9. package/fesm2022/_expansion-chunk.mjs.map +1 -1
  10. package/fesm2022/_list-chunk.mjs +4 -1
  11. package/fesm2022/_list-chunk.mjs.map +1 -1
  12. package/fesm2022/_list-navigation-chunk.mjs +4 -2
  13. package/fesm2022/_list-navigation-chunk.mjs.map +1 -1
  14. package/fesm2022/_list-typeahead-chunk.mjs +1 -1
  15. package/fesm2022/_list-typeahead-chunk.mjs.map +1 -1
  16. package/fesm2022/_menu-chunk.mjs +1 -1
  17. package/fesm2022/_menu-chunk.mjs.map +1 -1
  18. package/fesm2022/{_combobox-listbox-chunk.mjs → _option-chunk.mjs} +6 -50
  19. package/fesm2022/_option-chunk.mjs.map +1 -0
  20. package/fesm2022/_tabs-chunk.mjs +22 -47
  21. package/fesm2022/_tabs-chunk.mjs.map +1 -1
  22. package/fesm2022/_toolbar-widget-group-chunk.mjs +1 -1
  23. package/fesm2022/_toolbar-widget-group-chunk.mjs.map +1 -1
  24. package/fesm2022/_transforms-chunk.mjs +8 -0
  25. package/fesm2022/_transforms-chunk.mjs.map +1 -0
  26. package/fesm2022/{_combobox-tree-chunk.mjs → _tree-chunk.mjs} +3 -48
  27. package/fesm2022/_tree-chunk.mjs.map +1 -0
  28. package/fesm2022/_widget-chunk.mjs +84 -21
  29. package/fesm2022/_widget-chunk.mjs.map +1 -1
  30. package/fesm2022/accordion-testing.mjs.map +1 -1
  31. package/fesm2022/accordion.mjs +32 -57
  32. package/fesm2022/accordion.mjs.map +1 -1
  33. package/fesm2022/aria.mjs +1 -1
  34. package/fesm2022/aria.mjs.map +1 -1
  35. package/fesm2022/combobox-testing.mjs +79 -0
  36. package/fesm2022/combobox-testing.mjs.map +1 -0
  37. package/fesm2022/combobox.mjs +287 -296
  38. package/fesm2022/combobox.mjs.map +1 -1
  39. package/fesm2022/grid-testing.mjs +80 -0
  40. package/fesm2022/grid-testing.mjs.map +1 -0
  41. package/fesm2022/grid.mjs +113 -86
  42. package/fesm2022/grid.mjs.map +1 -1
  43. package/fesm2022/listbox-testing.mjs +4 -0
  44. package/fesm2022/listbox-testing.mjs.map +1 -1
  45. package/fesm2022/listbox.mjs +231 -225
  46. package/fesm2022/listbox.mjs.map +1 -1
  47. package/fesm2022/menu-testing.mjs +11 -0
  48. package/fesm2022/menu-testing.mjs.map +1 -1
  49. package/fesm2022/menu.mjs +66 -84
  50. package/fesm2022/menu.mjs.map +1 -1
  51. package/fesm2022/private.mjs +166 -9
  52. package/fesm2022/private.mjs.map +1 -1
  53. package/fesm2022/tabs-testing.mjs.map +1 -1
  54. package/fesm2022/tabs.mjs +241 -222
  55. package/fesm2022/tabs.mjs.map +1 -1
  56. package/fesm2022/toolbar-testing.mjs +5 -1
  57. package/fesm2022/toolbar-testing.mjs.map +1 -1
  58. package/fesm2022/toolbar.mjs +23 -33
  59. package/fesm2022/toolbar.mjs.map +1 -1
  60. package/fesm2022/tree-testing.mjs +12 -0
  61. package/fesm2022/tree-testing.mjs.map +1 -1
  62. package/fesm2022/tree.mjs +160 -156
  63. package/fesm2022/tree.mjs.map +1 -1
  64. package/package.json +10 -2
  65. package/types/_accordion-chunk.d.ts +2 -2
  66. package/types/_collection-chunk.d.ts +42 -0
  67. package/types/_expansion-chunk.d.ts +1 -1
  68. package/types/_grid-chunk.d.ts +23 -9
  69. package/types/_keyboard-event-manager-chunk.d.ts +1 -1
  70. package/types/_list-chunk.d.ts +1 -1
  71. package/types/_list-navigation-chunk.d.ts +1 -1
  72. package/types/_listbox-chunk.d.ts +1 -1
  73. package/types/_menu-chunk.d.ts +1 -1
  74. package/types/_tabs-chunk.d.ts +8 -43
  75. package/types/_toolbar-chunk.d.ts +1 -1
  76. package/types/_tree-chunk.d.ts +1 -1
  77. package/types/accordion.d.ts +7 -13
  78. package/types/combobox-testing.d.ts +63 -0
  79. package/types/combobox.d.ts +96 -192
  80. package/types/grid-testing.d.ts +83 -0
  81. package/types/grid.d.ts +102 -90
  82. package/types/listbox-testing.d.ts +25 -0
  83. package/types/listbox.d.ts +60 -63
  84. package/types/menu-testing.d.ts +6 -0
  85. package/types/menu.d.ts +24 -17
  86. package/types/private.d.ts +115 -133
  87. package/types/tabs.d.ts +26 -24
  88. package/types/toolbar-testing.d.ts +4 -0
  89. package/types/toolbar.d.ts +5 -6
  90. package/types/tree-testing.d.ts +8 -0
  91. package/types/tree.d.ts +11 -15
  92. package/fesm2022/_combobox-chunk.mjs +0 -429
  93. package/fesm2022/_combobox-chunk.mjs.map +0 -1
  94. package/fesm2022/_combobox-listbox-chunk.mjs.map +0 -1
  95. package/fesm2022/_combobox-tree-chunk.mjs.map +0 -1
  96. package/fesm2022/_element-chunk.mjs +0 -6
  97. package/fesm2022/_element-chunk.mjs.map +0 -1
  98. package/fesm2022/_pointer-event-manager-chunk.mjs +0 -54
  99. package/fesm2022/_pointer-event-manager-chunk.mjs.map +0 -1
  100. package/fesm2022/_signal-like-chunk.mjs.map +0 -1
  101. package/resources/code-examples.db +0 -0
  102. package/types/_combobox-chunk.d.ts +0 -194
  103. package/types/_element-chunk.d.ts +0 -10
  104. package/types/_pointer-event-manager-chunk.d.ts +0 -34
  105. package/types/_signal-like-chunk.d.ts +0 -14
package/fesm2022/tabs.mjs CHANGED
@@ -1,32 +1,119 @@
1
1
  import { _IdGenerator } from '@angular/cdk/a11y';
2
2
  import * as i0 from '@angular/core';
3
- import { InjectionToken, inject, ElementRef, signal, computed, input, booleanAttribute, model, afterRenderEffect, Directive } from '@angular/core';
4
- import { Directionality } from '@angular/cdk/bidi';
5
- import { TabListPattern, TabPanelPattern, TabPattern } from './_tabs-chunk.mjs';
6
- import { sortDirectives } from './_element-chunk.mjs';
3
+ import { InjectionToken, inject, ElementRef, signal, computed, afterNextRender, Directive, input, booleanAttribute, model, linkedSignal, afterRenderEffect } from '@angular/core';
4
+ import { TabListPattern, TabPattern, TabPanelPattern } from './_tabs-chunk.mjs';
7
5
  import { DeferredContentAware, DeferredContent } from './_deferred-content-chunk.mjs';
6
+ import { Directionality } from '@angular/cdk/bidi';
7
+ import { SortedCollection } from './_collection-chunk.mjs';
8
8
  import './_expansion-chunk.mjs';
9
- import './_signal-like-chunk.mjs';
10
- import '@angular/core/primitives/signals';
11
9
  import './_list-navigation-chunk.mjs';
12
10
  import './_click-event-manager-chunk.mjs';
11
+ import '@angular/core/primitives/signals';
13
12
 
14
13
  const TABS = new InjectionToken('TABS');
14
+ const TAB_LIST = new InjectionToken('TAB_LIST');
15
15
 
16
- class TabList {
16
+ class Tabs {
17
17
  _elementRef = inject(ElementRef);
18
18
  element = this._elementRef.nativeElement;
19
- _tabs = inject(TABS);
20
- _unorderedTabs = signal(new Set(), ...(ngDevMode ? [{
21
- debugName: "_unorderedTabs"
19
+ _tabList = signal(undefined, ...(ngDevMode ? [{
20
+ debugName: "_tabList"
22
21
  }] : []));
23
- textDirection = inject(Directionality).valueSignal;
24
- _tabPatterns = computed(() => [...this._unorderedTabs()].sort(sortDirectives).map(tab => tab._pattern), ...(ngDevMode ? [{
22
+ _collection = new SortedCollection();
23
+ _tabPatterns = computed(() => this._tabList()?._tabPatterns(), ...(ngDevMode ? [{
24
+ debugName: "_tabPatterns"
25
+ }] : []));
26
+ _tabPanelPatterns = computed(() => this._collection.orderedItems().map(tabpanel => tabpanel._pattern), ...(ngDevMode ? [{
27
+ debugName: "_tabPanelPatterns"
28
+ }] : []));
29
+ _panelMap = computed(() => {
30
+ const map = new Map();
31
+ for (const panel of this._collection.orderedItems()) {
32
+ map.set(panel.value(), panel._pattern);
33
+ }
34
+ return map;
35
+ }, ...(ngDevMode ? [{
36
+ debugName: "_panelMap"
37
+ }] : []));
38
+ _tabMap = computed(() => {
39
+ const map = new Map();
40
+ const tabList = this._tabList();
41
+ if (tabList) {
42
+ for (const tab of tabList._collection.orderedItems()) {
43
+ map.set(tab.value(), tab._pattern);
44
+ }
45
+ }
46
+ return map;
47
+ }, ...(ngDevMode ? [{
48
+ debugName: "_tabMap"
49
+ }] : []));
50
+ constructor() {
51
+ afterNextRender(() => {
52
+ this._collection.startObserving(this.element);
53
+ });
54
+ }
55
+ ngOnDestroy() {
56
+ this._collection.stopObserving();
57
+ }
58
+ _register(child) {
59
+ this._tabList.set(child);
60
+ }
61
+ _unregister() {
62
+ this._tabList.set(undefined);
63
+ }
64
+ static ɵfac = i0.ɵɵngDeclareFactory({
65
+ minVersion: "12.0.0",
66
+ version: "22.0.0-next.10",
67
+ ngImport: i0,
68
+ type: Tabs,
69
+ deps: [],
70
+ target: i0.ɵɵFactoryTarget.Directive
71
+ });
72
+ static ɵdir = i0.ɵɵngDeclareDirective({
73
+ minVersion: "14.0.0",
74
+ version: "22.0.0-next.10",
75
+ type: Tabs,
76
+ isStandalone: true,
77
+ selector: "[ngTabs]",
78
+ providers: [{
79
+ provide: TABS,
80
+ useExisting: Tabs
81
+ }],
82
+ exportAs: ["ngTabs"],
83
+ ngImport: i0
84
+ });
85
+ }
86
+ i0.ɵɵngDeclareClassMetadata({
87
+ minVersion: "12.0.0",
88
+ version: "22.0.0-next.10",
89
+ ngImport: i0,
90
+ type: Tabs,
91
+ decorators: [{
92
+ type: Directive,
93
+ args: [{
94
+ selector: '[ngTabs]',
95
+ exportAs: 'ngTabs',
96
+ providers: [{
97
+ provide: TABS,
98
+ useExisting: Tabs
99
+ }]
100
+ }]
101
+ }],
102
+ ctorParameters: () => []
103
+ });
104
+
105
+ class TabList {
106
+ _elementRef = inject(ElementRef);
107
+ element = this._elementRef.nativeElement;
108
+ _tabsParent = inject(TABS);
109
+ _collection = new SortedCollection();
110
+ _tabPatterns = computed(() => this._collection.orderedItems().map(tab => tab._pattern), ...(ngDevMode ? [{
25
111
  debugName: "_tabPatterns"
26
112
  }] : []));
27
113
  orientation = input('horizontal', ...(ngDevMode ? [{
28
114
  debugName: "orientation"
29
115
  }] : []));
116
+ textDirection = inject(Directionality).valueSignal;
30
117
  wrap = input(true, {
31
118
  ...(ngDevMode ? {
32
119
  debugName: "wrap"
@@ -48,6 +135,12 @@ class TabList {
48
135
  selectedTab = model(...(ngDevMode ? [undefined, {
49
136
  debugName: "selectedTab"
50
137
  }] : []));
138
+ _selectedTabPattern = linkedSignal(() => {
139
+ const tab = this.findTab(this.selectedTab());
140
+ return tab?._pattern;
141
+ }, ...(ngDevMode ? [{
142
+ debugName: "_selectedTabPattern"
143
+ }] : []));
51
144
  disabled = input(false, {
52
145
  ...(ngDevMode ? {
53
146
  debugName: "disabled"
@@ -56,50 +149,42 @@ class TabList {
56
149
  });
57
150
  _pattern = new TabListPattern({
58
151
  ...this,
59
- items: this._tabPatterns,
152
+ element: () => this._elementRef.nativeElement,
60
153
  activeItem: signal(undefined),
61
- element: () => this._elementRef.nativeElement
154
+ items: this._tabPatterns,
155
+ selectedTab: this._selectedTabPattern
62
156
  });
63
157
  constructor() {
158
+ afterNextRender(() => {
159
+ this._collection.startObserving(this.element);
160
+ });
64
161
  afterRenderEffect(() => {
65
162
  this._pattern.setDefaultStateEffect();
66
163
  });
67
- afterRenderEffect(() => {
68
- const tab = this._pattern.selectedTab();
69
- if (tab) {
70
- this.selectedTab.set(tab.value());
71
- }
72
- });
73
- afterRenderEffect(() => {
74
- const value = this.selectedTab();
75
- if (value) {
76
- this._tabPatterns().forEach(tab => tab.expanded.set(false));
77
- const tab = this._tabPatterns().find(t => t.value() === value);
78
- this._pattern.selectedTab.set(tab);
79
- tab?.expanded.set(true);
164
+ afterRenderEffect({
165
+ write: () => {
166
+ const pattern = this._selectedTabPattern();
167
+ const tab = this._collection.orderedItems().find(tab => tab._pattern == pattern);
168
+ this.selectedTab.set(tab?.value());
80
169
  }
81
170
  });
82
171
  }
83
172
  ngOnInit() {
84
- this._tabs._register(this);
173
+ this._tabsParent._register(this);
85
174
  }
86
175
  ngOnDestroy() {
87
- this._tabs._unregister(this);
88
- }
89
- _register(child) {
90
- this._unorderedTabs().add(child);
91
- this._unorderedTabs.set(new Set(this._unorderedTabs()));
92
- }
93
- _unregister(child) {
94
- this._unorderedTabs().delete(child);
95
- this._unorderedTabs.set(new Set(this._unorderedTabs()));
176
+ this._tabsParent._unregister();
177
+ this._collection.stopObserving();
96
178
  }
97
179
  open(value) {
98
- return this._pattern.open(value);
180
+ return this._pattern.open(this.findTab(value)?._pattern);
181
+ }
182
+ findTab(value) {
183
+ return value ? this._collection.orderedItems().find(tab => tab.value() === value) : undefined;
99
184
  }
100
185
  static ɵfac = i0.ɵɵngDeclareFactory({
101
186
  minVersion: "12.0.0",
102
- version: "22.0.0-next.6",
187
+ version: "22.0.0-next.10",
103
188
  ngImport: i0,
104
189
  type: TabList,
105
190
  deps: [],
@@ -107,7 +192,7 @@ class TabList {
107
192
  });
108
193
  static ɵdir = i0.ɵɵngDeclareDirective({
109
194
  minVersion: "17.1.0",
110
- version: "22.0.0-next.6",
195
+ version: "22.0.0-next.10",
111
196
  type: TabList,
112
197
  isStandalone: true,
113
198
  selector: "[ngTabList]",
@@ -181,13 +266,17 @@ class TabList {
181
266
  "attr.aria-activedescendant": "_pattern.activeDescendant()"
182
267
  }
183
268
  },
269
+ providers: [{
270
+ provide: TAB_LIST,
271
+ useExisting: TabList
272
+ }],
184
273
  exportAs: ["ngTabList"],
185
274
  ngImport: i0
186
275
  });
187
276
  }
188
277
  i0.ɵɵngDeclareClassMetadata({
189
278
  minVersion: "12.0.0",
190
- version: "22.0.0-next.6",
279
+ version: "22.0.0-next.10",
191
280
  ngImport: i0,
192
281
  type: TabList,
193
282
  decorators: [{
@@ -204,7 +293,11 @@ i0.ɵɵngDeclareClassMetadata({
204
293
  '(keydown)': '_pattern.onKeydown($event)',
205
294
  '(click)': '_pattern.onClick($event)',
206
295
  '(focusin)': '_pattern.onFocusIn()'
207
- }
296
+ },
297
+ providers: [{
298
+ provide: TAB_LIST,
299
+ useExisting: TabList
300
+ }]
208
301
  }]
209
302
  }],
210
303
  ctorParameters: () => [],
@@ -271,50 +364,62 @@ i0.ɵɵngDeclareClassMetadata({
271
364
  }
272
365
  });
273
366
 
274
- class TabPanel {
367
+ class Tab {
275
368
  _elementRef = inject(ElementRef);
276
369
  element = this._elementRef.nativeElement;
277
- _deferredContentAware = inject(DeferredContentAware);
278
- _tabs = inject(TABS);
279
- id = input(inject(_IdGenerator).getId('ng-tabpanel-', true), ...(ngDevMode ? [{
370
+ _tabList = inject(TAB_LIST);
371
+ id = input(inject(_IdGenerator).getId('ng-tab-', true), ...(ngDevMode ? [{
280
372
  debugName: "id"
281
373
  }] : []));
282
- _tabPattern = computed(() => this._tabs._tabPatterns()?.find(tab => tab.value() === this.value()), ...(ngDevMode ? [{
283
- debugName: "_tabPattern"
374
+ _tabpanelPattern = computed(() => {
375
+ return this._tabList._tabsParent._panelMap().get(this.value());
376
+ }, ...(ngDevMode ? [{
377
+ debugName: "_tabpanelPattern"
284
378
  }] : []));
379
+ disabled = input(false, {
380
+ ...(ngDevMode ? {
381
+ debugName: "disabled"
382
+ } : {}),
383
+ transform: booleanAttribute
384
+ });
285
385
  value = input.required(...(ngDevMode ? [{
286
386
  debugName: "value"
287
387
  }] : []));
288
- visible = computed(() => !this._pattern.hidden(), ...(ngDevMode ? [{
289
- debugName: "visible"
388
+ active = computed(() => this._pattern.active(), ...(ngDevMode ? [{
389
+ debugName: "active"
290
390
  }] : []));
291
- _pattern = new TabPanelPattern({
391
+ selected = computed(() => this._pattern.selected(), ...(ngDevMode ? [{
392
+ debugName: "selected"
393
+ }] : []));
394
+ _pattern = new TabPattern({
292
395
  ...this,
293
- tab: this._tabPattern
396
+ element: () => this.element,
397
+ tabList: () => this._tabList._pattern,
398
+ tabPanel: this._tabpanelPattern
294
399
  });
295
- constructor() {
296
- afterRenderEffect(() => this._deferredContentAware.contentVisible.set(this.visible()));
400
+ open() {
401
+ this._pattern.open();
297
402
  }
298
403
  ngOnInit() {
299
- this._tabs._register(this);
404
+ this._tabList._collection.register(this);
300
405
  }
301
406
  ngOnDestroy() {
302
- this._tabs._unregister(this);
407
+ this._tabList._collection.unregister(this);
303
408
  }
304
409
  static ɵfac = i0.ɵɵngDeclareFactory({
305
410
  minVersion: "12.0.0",
306
- version: "22.0.0-next.6",
411
+ version: "22.0.0-next.10",
307
412
  ngImport: i0,
308
- type: TabPanel,
413
+ type: Tab,
309
414
  deps: [],
310
415
  target: i0.ɵɵFactoryTarget.Directive
311
416
  });
312
417
  static ɵdir = i0.ɵɵngDeclareDirective({
313
418
  minVersion: "17.1.0",
314
- version: "22.0.0-next.6",
315
- type: TabPanel,
419
+ version: "22.0.0-next.10",
420
+ type: Tab,
316
421
  isStandalone: true,
317
- selector: "[ngTabPanel]",
422
+ selector: "[ngTab]",
318
423
  inputs: {
319
424
  id: {
320
425
  classPropertyName: "id",
@@ -323,6 +428,13 @@ class TabPanel {
323
428
  isRequired: false,
324
429
  transformFunction: null
325
430
  },
431
+ disabled: {
432
+ classPropertyName: "disabled",
433
+ publicName: "disabled",
434
+ isSignal: true,
435
+ isRequired: false,
436
+ transformFunction: null
437
+ },
326
438
  value: {
327
439
  classPropertyName: "value",
328
440
  publicName: "value",
@@ -333,47 +445,42 @@ class TabPanel {
333
445
  },
334
446
  host: {
335
447
  attributes: {
336
- "role": "tabpanel"
448
+ "role": "tab"
337
449
  },
338
450
  properties: {
451
+ "attr.data-active": "active()",
339
452
  "attr.id": "_pattern.id()",
340
453
  "attr.tabindex": "_pattern.tabIndex()",
341
- "attr.inert": "!visible() ? true : null",
342
- "attr.aria-labelledby": "_pattern.labelledBy()"
454
+ "attr.aria-selected": "selected()",
455
+ "attr.aria-disabled": "_pattern.disabled()",
456
+ "attr.aria-controls": "_pattern.controls()"
343
457
  }
344
458
  },
345
- exportAs: ["ngTabPanel"],
346
- hostDirectives: [{
347
- directive: DeferredContentAware,
348
- inputs: ["preserveContent", "preserveContent"]
349
- }],
459
+ exportAs: ["ngTab"],
350
460
  ngImport: i0
351
461
  });
352
462
  }
353
463
  i0.ɵɵngDeclareClassMetadata({
354
464
  minVersion: "12.0.0",
355
- version: "22.0.0-next.6",
465
+ version: "22.0.0-next.10",
356
466
  ngImport: i0,
357
- type: TabPanel,
467
+ type: Tab,
358
468
  decorators: [{
359
469
  type: Directive,
360
470
  args: [{
361
- selector: '[ngTabPanel]',
362
- exportAs: 'ngTabPanel',
471
+ selector: '[ngTab]',
472
+ exportAs: 'ngTab',
363
473
  host: {
364
- 'role': 'tabpanel',
474
+ 'role': 'tab',
475
+ '[attr.data-active]': 'active()',
365
476
  '[attr.id]': '_pattern.id()',
366
477
  '[attr.tabindex]': '_pattern.tabIndex()',
367
- '[attr.inert]': '!visible() ? true : null',
368
- '[attr.aria-labelledby]': '_pattern.labelledBy()'
369
- },
370
- hostDirectives: [{
371
- directive: DeferredContentAware,
372
- inputs: ['preserveContent']
373
- }]
478
+ '[attr.aria-selected]': 'selected()',
479
+ '[attr.aria-disabled]': '_pattern.disabled()',
480
+ '[attr.aria-controls]': '_pattern.controls()'
481
+ }
374
482
  }]
375
483
  }],
376
- ctorParameters: () => [],
377
484
  propDecorators: {
378
485
  id: [{
379
486
  type: i0.Input,
@@ -383,6 +490,14 @@ i0.ɵɵngDeclareClassMetadata({
383
490
  required: false
384
491
  }]
385
492
  }],
493
+ disabled: [{
494
+ type: i0.Input,
495
+ args: [{
496
+ isSignal: true,
497
+ alias: "disabled",
498
+ required: false
499
+ }]
500
+ }],
386
501
  value: [{
387
502
  type: i0.Input,
388
503
  args: [{
@@ -394,138 +509,52 @@ i0.ɵɵngDeclareClassMetadata({
394
509
  }
395
510
  });
396
511
 
397
- class Tabs {
398
- _elementRef = inject(ElementRef);
399
- element = this._elementRef.nativeElement;
400
- _tablist = signal(undefined, ...(ngDevMode ? [{
401
- debugName: "_tablist"
402
- }] : []));
403
- _unorderedPanels = signal(new Set(), ...(ngDevMode ? [{
404
- debugName: "_unorderedPanels"
405
- }] : []));
406
- _tabPatterns = computed(() => this._tablist()?._tabPatterns(), ...(ngDevMode ? [{
407
- debugName: "_tabPatterns"
408
- }] : []));
409
- _unorderedTabpanelPatterns = computed(() => [...this._unorderedPanels()].map(tabpanel => tabpanel._pattern), ...(ngDevMode ? [{
410
- debugName: "_unorderedTabpanelPatterns"
411
- }] : []));
412
- _register(child) {
413
- if (child instanceof TabList) {
414
- this._tablist.set(child);
415
- }
416
- if (child instanceof TabPanel) {
417
- this._unorderedPanels().add(child);
418
- this._unorderedPanels.set(new Set(this._unorderedPanels()));
419
- }
420
- }
421
- _unregister(child) {
422
- if (child instanceof TabList) {
423
- this._tablist.set(undefined);
424
- }
425
- if (child instanceof TabPanel) {
426
- this._unorderedPanels().delete(child);
427
- this._unorderedPanels.set(new Set(this._unorderedPanels()));
428
- }
429
- }
430
- static ɵfac = i0.ɵɵngDeclareFactory({
431
- minVersion: "12.0.0",
432
- version: "22.0.0-next.6",
433
- ngImport: i0,
434
- type: Tabs,
435
- deps: [],
436
- target: i0.ɵɵFactoryTarget.Directive
437
- });
438
- static ɵdir = i0.ɵɵngDeclareDirective({
439
- minVersion: "14.0.0",
440
- version: "22.0.0-next.6",
441
- type: Tabs,
442
- isStandalone: true,
443
- selector: "[ngTabs]",
444
- providers: [{
445
- provide: TABS,
446
- useExisting: Tabs
447
- }],
448
- exportAs: ["ngTabs"],
449
- ngImport: i0
450
- });
451
- }
452
- i0.ɵɵngDeclareClassMetadata({
453
- minVersion: "12.0.0",
454
- version: "22.0.0-next.6",
455
- ngImport: i0,
456
- type: Tabs,
457
- decorators: [{
458
- type: Directive,
459
- args: [{
460
- selector: '[ngTabs]',
461
- exportAs: 'ngTabs',
462
- providers: [{
463
- provide: TABS,
464
- useExisting: Tabs
465
- }]
466
- }]
467
- }]
468
- });
469
-
470
- class Tab {
512
+ class TabPanel {
471
513
  _elementRef = inject(ElementRef);
472
514
  element = this._elementRef.nativeElement;
515
+ _deferredContentAware = inject(DeferredContentAware);
473
516
  _tabs = inject(TABS);
474
- _tabList = inject(TabList);
475
- id = input(inject(_IdGenerator).getId('ng-tab-', true), ...(ngDevMode ? [{
517
+ id = input(inject(_IdGenerator).getId('ng-tabpanel-', true), ...(ngDevMode ? [{
476
518
  debugName: "id"
477
519
  }] : []));
478
- _tablistPattern = computed(() => this._tabList._pattern, ...(ngDevMode ? [{
479
- debugName: "_tablistPattern"
480
- }] : []));
481
- _tabpanelPattern = computed(() => this._tabs._unorderedTabpanelPatterns().find(tabpanel => tabpanel.value() === this.value()), ...(ngDevMode ? [{
482
- debugName: "_tabpanelPattern"
520
+ _tabPattern = computed(() => {
521
+ return this._tabs._tabMap().get(this.value());
522
+ }, ...(ngDevMode ? [{
523
+ debugName: "_tabPattern"
483
524
  }] : []));
484
- disabled = input(false, {
485
- ...(ngDevMode ? {
486
- debugName: "disabled"
487
- } : {}),
488
- transform: booleanAttribute
489
- });
490
525
  value = input.required(...(ngDevMode ? [{
491
526
  debugName: "value"
492
527
  }] : []));
493
- active = computed(() => this._pattern.active(), ...(ngDevMode ? [{
494
- debugName: "active"
495
- }] : []));
496
- selected = computed(() => this._pattern.selected(), ...(ngDevMode ? [{
497
- debugName: "selected"
528
+ visible = computed(() => !this._pattern.hidden(), ...(ngDevMode ? [{
529
+ debugName: "visible"
498
530
  }] : []));
499
- _pattern = new TabPattern({
531
+ _pattern = new TabPanelPattern({
500
532
  ...this,
501
- tablist: this._tablistPattern,
502
- tabpanel: this._tabpanelPattern,
503
- expanded: signal(false),
504
- element: () => this.element
533
+ tab: this._tabPattern
505
534
  });
506
- open() {
507
- this._pattern.open();
535
+ constructor() {
536
+ afterRenderEffect(() => this._deferredContentAware.contentVisible.set(this.visible()));
508
537
  }
509
538
  ngOnInit() {
510
- this._tabList._register(this);
539
+ this._tabs._collection.register(this);
511
540
  }
512
541
  ngOnDestroy() {
513
- this._tabList._unregister(this);
542
+ this._tabs._collection.unregister(this);
514
543
  }
515
544
  static ɵfac = i0.ɵɵngDeclareFactory({
516
545
  minVersion: "12.0.0",
517
- version: "22.0.0-next.6",
546
+ version: "22.0.0-next.10",
518
547
  ngImport: i0,
519
- type: Tab,
548
+ type: TabPanel,
520
549
  deps: [],
521
550
  target: i0.ɵɵFactoryTarget.Directive
522
551
  });
523
552
  static ɵdir = i0.ɵɵngDeclareDirective({
524
553
  minVersion: "17.1.0",
525
- version: "22.0.0-next.6",
526
- type: Tab,
554
+ version: "22.0.0-next.10",
555
+ type: TabPanel,
527
556
  isStandalone: true,
528
- selector: "[ngTab]",
557
+ selector: "[ngTabPanel]",
529
558
  inputs: {
530
559
  id: {
531
560
  classPropertyName: "id",
@@ -534,13 +563,6 @@ class Tab {
534
563
  isRequired: false,
535
564
  transformFunction: null
536
565
  },
537
- disabled: {
538
- classPropertyName: "disabled",
539
- publicName: "disabled",
540
- isSignal: true,
541
- isRequired: false,
542
- transformFunction: null
543
- },
544
566
  value: {
545
567
  classPropertyName: "value",
546
568
  publicName: "value",
@@ -551,42 +573,47 @@ class Tab {
551
573
  },
552
574
  host: {
553
575
  attributes: {
554
- "role": "tab"
576
+ "role": "tabpanel"
555
577
  },
556
578
  properties: {
557
- "attr.data-active": "active()",
558
579
  "attr.id": "_pattern.id()",
559
580
  "attr.tabindex": "_pattern.tabIndex()",
560
- "attr.aria-selected": "selected()",
561
- "attr.aria-disabled": "_pattern.disabled()",
562
- "attr.aria-controls": "_pattern.controls()"
581
+ "attr.inert": "!visible() ? true : null",
582
+ "attr.aria-labelledby": "_pattern.labelledBy()"
563
583
  }
564
584
  },
565
- exportAs: ["ngTab"],
585
+ exportAs: ["ngTabPanel"],
586
+ hostDirectives: [{
587
+ directive: DeferredContentAware,
588
+ inputs: ["preserveContent", "preserveContent"]
589
+ }],
566
590
  ngImport: i0
567
591
  });
568
592
  }
569
593
  i0.ɵɵngDeclareClassMetadata({
570
594
  minVersion: "12.0.0",
571
- version: "22.0.0-next.6",
595
+ version: "22.0.0-next.10",
572
596
  ngImport: i0,
573
- type: Tab,
597
+ type: TabPanel,
574
598
  decorators: [{
575
599
  type: Directive,
576
600
  args: [{
577
- selector: '[ngTab]',
578
- exportAs: 'ngTab',
601
+ selector: '[ngTabPanel]',
602
+ exportAs: 'ngTabPanel',
579
603
  host: {
580
- 'role': 'tab',
581
- '[attr.data-active]': 'active()',
604
+ 'role': 'tabpanel',
582
605
  '[attr.id]': '_pattern.id()',
583
606
  '[attr.tabindex]': '_pattern.tabIndex()',
584
- '[attr.aria-selected]': 'selected()',
585
- '[attr.aria-disabled]': '_pattern.disabled()',
586
- '[attr.aria-controls]': '_pattern.controls()'
587
- }
607
+ '[attr.inert]': '!visible() ? true : null',
608
+ '[attr.aria-labelledby]': '_pattern.labelledBy()'
609
+ },
610
+ hostDirectives: [{
611
+ directive: DeferredContentAware,
612
+ inputs: ['preserveContent']
613
+ }]
588
614
  }]
589
615
  }],
616
+ ctorParameters: () => [],
590
617
  propDecorators: {
591
618
  id: [{
592
619
  type: i0.Input,
@@ -596,14 +623,6 @@ i0.ɵɵngDeclareClassMetadata({
596
623
  required: false
597
624
  }]
598
625
  }],
599
- disabled: [{
600
- type: i0.Input,
601
- args: [{
602
- isSignal: true,
603
- alias: "disabled",
604
- required: false
605
- }]
606
- }],
607
626
  value: [{
608
627
  type: i0.Input,
609
628
  args: [{
@@ -618,7 +637,7 @@ i0.ɵɵngDeclareClassMetadata({
618
637
  class TabContent {
619
638
  static ɵfac = i0.ɵɵngDeclareFactory({
620
639
  minVersion: "12.0.0",
621
- version: "22.0.0-next.6",
640
+ version: "22.0.0-next.10",
622
641
  ngImport: i0,
623
642
  type: TabContent,
624
643
  deps: [],
@@ -626,7 +645,7 @@ class TabContent {
626
645
  });
627
646
  static ɵdir = i0.ɵɵngDeclareDirective({
628
647
  minVersion: "14.0.0",
629
- version: "22.0.0-next.6",
648
+ version: "22.0.0-next.10",
630
649
  type: TabContent,
631
650
  isStandalone: true,
632
651
  selector: "ng-template[ngTabContent]",
@@ -639,7 +658,7 @@ class TabContent {
639
658
  }
640
659
  i0.ɵɵngDeclareClassMetadata({
641
660
  minVersion: "12.0.0",
642
- version: "22.0.0-next.6",
661
+ version: "22.0.0-next.10",
643
662
  ngImport: i0,
644
663
  type: TabContent,
645
664
  decorators: [{