fix(docs-infra): don't use private symbol

Fixes that the tab group was referring to a private symbol from the CDK.

(cherry picked from commit 94a8f797e5)
This commit is contained in:
Kristiyan Kostadinov
2026-01-20 20:31:12 +01:00
committed by Alon Mishne
parent 93f3cca5e9
commit 3c8d69794c
@@ -18,7 +18,8 @@ import {
ElementRef,
ChangeDetectionStrategy,
} from '@angular/core';
import {_IdGenerator} from '@angular/cdk/a11y';
let idCounter = 0;
/**
* A simple tabs implementation with proper aria roles.
@@ -36,20 +37,22 @@ import {_IdGenerator} from '@angular/cdk/a11y';
})
export class TabGroup {
private readonly _renderer = inject(Renderer2);
private readonly _idGenerator = inject(_IdGenerator);
private readonly _tabpanels = viewChildren<ElementRef<HTMLDivElement>>('tabpanel');
readonly tabs = input<{label: string; panel: HTMLElement}[]>();
readonly computedTabs = computed(
() =>
readonly computedTabs = computed(() => {
const id = idCounter++;
return (
this.tabs()?.map((tab) => ({
tabId: this._idGenerator.getId('docs-tab-'),
tabPanelId: this._idGenerator.getId('docs-tab-panel-'),
tabId: `docs-tab-${id}`,
tabPanelId: `docs-tab-panel-${id}`,
label: tab.label,
panel: tab.panel,
})) ?? [],
);
})) ?? []
);
});
readonly selectedTab = linkedSignal(() => this.computedTabs()[0]?.tabId);