Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
4 changes: 2 additions & 2 deletions 2nd-gen/packages/core/components/asset/Asset.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ export abstract class AssetBase extends SpectrumElement {
// IMPLEMENTATION
// ──────────────────────

protected override updated(changes: PropertyValues): void {
super.updated(changes);
protected override update(changes: PropertyValues): void {
if (typeof this.variant !== 'undefined') {
const constructor = this.constructor as typeof AssetBase;
validateEnum(this, {
Expand All @@ -63,5 +62,6 @@ export abstract class AssetBase extends SpectrumElement {
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-asset--docs',
});
}
super.update(changes);
}
}
30 changes: 17 additions & 13 deletions 2nd-gen/packages/core/components/card/Card.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,19 +181,7 @@ export abstract class CardBase extends SizedMixin(SpectrumElement, {
?.addEventListener('slotchange', this.handleActionsSlotChange);
}

protected override updated(changedProperties: PropertyValues): void {
super.updated(changedProperties);

if (changedProperties.has('selectable')) {
if (this.selectable) {
this.setAttribute('tabindex', '0');
this.addEventListener('keydown', this.handleSelectableKeydown);
} else {
this.removeAttribute('tabindex');
this.removeEventListener('keydown', this.handleSelectableKeydown);
}
}

protected override update(changedProperties: PropertyValues): void {
const { VARIANTS, DENSITIES } = this.constructor as typeof CardBase;

if (changedProperties.has('variant')) {
Expand All @@ -215,6 +203,22 @@ export abstract class CardBase extends SizedMixin(SpectrumElement, {
});
}

super.update(changedProperties);
}

protected override updated(changedProperties: PropertyValues): void {
super.updated(changedProperties);

if (changedProperties.has('selectable')) {
if (this.selectable) {
this.setAttribute('tabindex', '0');
this.addEventListener('keydown', this.handleSelectableKeydown);
} else {
this.removeAttribute('tabindex');
this.removeEventListener('keydown', this.handleSelectableKeydown);
}
}

warnIf(
this,
changedProperties.has('titleAsLink') &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ export abstract class IllustratedMessageBase extends SpectrumElement {
return this.slotText.hasContent;
}

protected override updated(changedProperties: PropertyValues): void {
super.updated(changedProperties);

protected override update(changedProperties: PropertyValues): void {
if (changedProperties.has('size')) {
validateEnum(this, {
prop: 'size',
Expand All @@ -128,6 +126,8 @@ export abstract class IllustratedMessageBase extends SpectrumElement {
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-illustrated-message--docs',
});
}

super.update(changedProperties);
}

protected handleActionsSlotChange(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,17 @@ export abstract class ProgressCircleBase extends SizedMixin(SpectrumElement, {
this.progress = clamped;
}
}

if (changes.has('staticColor') && this.staticColor !== undefined) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

const constructor = this.constructor as typeof ProgressCircleBase;
validateEnum(this, {
prop: 'static-color',
value: this.staticColor,
valid: constructor.STATIC_COLORS,
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-progress-circle--docs',
});
}

super.willUpdate(changes);
}

Expand Down Expand Up @@ -223,16 +234,6 @@ export abstract class ProgressCircleBase extends SizedMixin(SpectrumElement, {
);
}

if (changes.has('staticColor') && this.staticColor !== undefined) {
const constructor = this.constructor as typeof ProgressCircleBase;
validateEnum(this, {
prop: 'static-color',
value: this.staticColor,
valid: constructor.STATIC_COLORS,
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-progress-circle--docs',
});
}

this.warnDeprecatedLightDomChildren();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ export abstract class StatusLightBase extends SizedMixin(SpectrumElement, {
// IMPLEMENTATION
// ──────────────────────

protected override updated(changes: PropertyValues): void {
super.updated(changes);
protected override update(changes: PropertyValues): void {
const constructor = this.constructor as typeof StatusLightBase;
// @ts-expect-error -- intentional runtime guard: 1st-gen consumers may pass 'accent'
if (this.variant === 'accent') {
Expand All @@ -125,5 +124,7 @@ export abstract class StatusLightBase extends SizedMixin(SpectrumElement, {
'https://spectrum-web-components.adobe.com/?path=/docs/status-light-migration-guide--docs',
{ level: 'deprecation' }
);

super.update(changes);
}
}
7 changes: 4 additions & 3 deletions 2nd-gen/packages/core/components/tooltip/Tooltip.base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,7 @@ export abstract class TooltipBase
if (this.disabled && this.open) {
this.open = false;
}
}

protected override updated(changedProperties: PropertyValues): void {
super.updated(changedProperties);
if (changedProperties.has('variant')) {
const constructor = this.constructor as typeof TooltipBase;
validateEnum(this, {

@Rajdeepc Rajdeepc Aug 6, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not a bug: I see Tooltip and ProgressCircle fold the validateEnum check in willUpdate while others do in update. Again, functionally both is running pre-render but its an inconsistency where we are trying to create a pattern.

Expand All @@ -493,6 +490,10 @@ export abstract class TooltipBase
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-tooltip--docs',
});
}
}

protected override updated(changedProperties: PropertyValues): void {
super.updated(changedProperties);
if (changedProperties.has('offset')) {
this.style.setProperty(
'--_swc-tooltip-animation-distance',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ export class ActionButton extends PendingMixin(ButtonBase) {
// state we just set.
private _ariaForwardingInProgress = false;

protected override updated(changedProperties: PropertyValues): void {
super.updated(changedProperties);
protected override update(changedProperties: PropertyValues): void {
if (
changedProperties.has('staticColor') &&
this.staticColor !== undefined
Expand All @@ -177,6 +176,7 @@ export class ActionButton extends PendingMixin(ButtonBase) {
url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-action-button--docs',
});
}
super.update(changedProperties);
}

// ──────────────────────────────
Expand Down
Loading