Skip to content

chore(tabs): update access modifiers, changedProperties type #5372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/tabs/src/Tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
CSSResult,
CSSResultArray,
html,
PropertyValueMap,
PropertyValues,
SizedMixin,
TemplateResult,
Expand Down Expand Up @@ -161,7 +160,7 @@ export class Tabs extends SizedMixin(Focusable, { noDefaultSize: true }) {
private slotEl!: HTMLSlotElement;

@query('#list')
private tabList!: HTMLDivElement;
protected tabList!: HTMLDivElement;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once we make this protected, if we want to change these in the future, it becomes a breaking change for subclasses.


@property({ reflect: true })
selected = '';
Expand All @@ -178,7 +177,7 @@ export class Tabs extends SizedMixin(Focusable, { noDefaultSize: true }) {
this.rovingTabindexController.clearElementCache();
}

private get tabs(): Tab[] {
protected get tabs(): Tab[] {
return this._tabs;
}

Expand Down Expand Up @@ -300,7 +299,7 @@ export class Tabs extends SizedMixin(Focusable, { noDefaultSize: true }) {
return complete;
}

private getNecessaryAutoScroll(index: number): number {
protected getNecessaryAutoScroll(index: number): number {
const selectedTab = this.tabs[index];
const selectionEnd = selectedTab.offsetLeft + selectedTab.offsetWidth;
const viewportEnd = this.tabList.scrollLeft + this.tabList.offsetWidth;
Expand Down Expand Up @@ -350,9 +349,7 @@ export class Tabs extends SizedMixin(Focusable, { noDefaultSize: true }) {
}
}

protected override updated(
changedProperties: PropertyValueMap<this>
): void {
protected override updated(changedProperties: PropertyValues<this>): void {
super.updated(changedProperties);

if (changedProperties.has('selected')) {
Expand Down
7 changes: 2 additions & 5 deletions packages/tabs/src/TabsOverflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ governing permissions and limitations under the License.
import {
CSSResultArray,
html,
PropertyValueMap,
PropertyValues,
SizedMixin,
SpectrumElement,
Expand Down Expand Up @@ -101,7 +100,7 @@ export class TabsOverflow extends SizedMixin(SpectrumElement) {
this._updateScrollState();
}

private _updateScrollState(): void {
protected _updateScrollState(): void {
const { scrollContent, overflowState } = this;

if (scrollContent) {
Expand Down Expand Up @@ -132,9 +131,7 @@ export class TabsOverflow extends SizedMixin(SpectrumElement) {
tabsElement.scrollTabs(left, 'smooth');
}

protected override updated(
changedProperties: PropertyValueMap<this>
): void {
protected override updated(changedProperties: PropertyValues<this>): void {
super.updated(changedProperties);
if (changedProperties.has('dir')) {
this._updateScrollState();
Expand Down
Loading