Skip to content

Commit b82a201

Browse files
committed
chore(core): remove 1st-gen type references from 2nd-gen core
1 parent 598039b commit b82a201

10 files changed

Lines changed: 34 additions & 157 deletions

File tree

2nd-gen/packages/core/components/alert-banner/AlertBanner.types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,3 @@ export const ALERT_BANNER_VALID_VARIANTS = [
1919
export type AlertBannerVariant =
2020
| (typeof ALERT_BANNER_VALID_VARIANTS)[number]
2121
| '';
22-
23-
/**
24-
* @deprecated Use `AlertBannerVariant` instead.
25-
* Kept as `string` for backward compatibility with 1st-gen.
26-
*/
27-
export type AlertBannerVariants = string;

2nd-gen/packages/core/components/badge/Badge.types.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
* governing permissions and limitations under the License.
1111
*/
1212

13-
/*
14-
* @todo The S1 types can be removed once we are no longer maintaining 1st-gen.
15-
*/
16-
1713
import type { ElementSize } from '@spectrum-web-components/core/mixins/index.js';
1814

1915
// ──────────────────
@@ -65,32 +61,6 @@ export const FIXED_VALUES = [
6561
'inline-end',
6662
] as const;
6763

68-
// ──────────────────────────────────────────
69-
// S1-ONLY (remove with 1st-gen)
70-
// ──────────────────────────────────────────
71-
72-
export const BADGE_VARIANTS_COLOR_S1 = [
73-
'fuchsia',
74-
'indigo',
75-
'magenta',
76-
'purple',
77-
'seafoam',
78-
'yellow',
79-
'gray',
80-
'red',
81-
'orange',
82-
'chartreuse',
83-
'celery',
84-
'green',
85-
'cyan',
86-
'blue',
87-
] as const satisfies readonly BadgeColorVariant[];
88-
89-
export const BADGE_VARIANTS_S1 = [
90-
...BADGE_VARIANTS_SEMANTIC,
91-
...BADGE_VARIANTS_COLOR_S1,
92-
] as const;
93-
9464
// ──────────────────
9565
// CANONICAL
9666
// ──────────────────
@@ -109,10 +79,6 @@ export type FixedValues = (typeof FIXED_VALUES)[number];
10979
export type BadgeSize = (typeof BADGE_VALID_SIZES)[number];
11080
export type BadgeSemanticVariant = (typeof BADGE_VARIANTS_SEMANTIC)[number];
11181

112-
// S1-only (remove with 1st-gen)
113-
export type BadgeColorVariantS1 = (typeof BADGE_VARIANTS_COLOR_S1)[number]; // remove with 1st-gen
114-
export type BadgeVariantS1 = (typeof BADGE_VARIANTS_S1)[number]; // remove with 1st-gen
115-
11682
// Canonical
11783
export type BadgeColorVariant = (typeof BADGE_VARIANTS_COLOR)[number];
11884
export type BadgeVariant = (typeof BADGE_VARIANTS)[number];

2nd-gen/packages/core/components/progress-circle/ProgressCircle.types.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,7 @@ export const PROGRESS_CIRCLE_VALID_SIZES = [
1717
'm',
1818
'l',
1919
] as const satisfies ElementSize[];
20-
export const PROGRESS_CIRCLE_STATIC_COLORS_S1 = ['white'] as const;
21-
export const PROGRESS_CIRCLE_STATIC_COLORS_S2 = [
22-
...PROGRESS_CIRCLE_STATIC_COLORS_S1,
23-
'black',
24-
] as const;
20+
export const PROGRESS_CIRCLE_STATIC_COLORS = ['white', 'black'] as const;
2521

26-
export type ProgressCircleStaticColorS1 =
27-
(typeof PROGRESS_CIRCLE_STATIC_COLORS_S1)[number];
28-
export type ProgressCircleStaticColorS2 =
29-
(typeof PROGRESS_CIRCLE_STATIC_COLORS_S2)[number];
3022
export type ProgressCircleStaticColor =
31-
| ProgressCircleStaticColorS1
32-
| ProgressCircleStaticColorS2;
23+
(typeof PROGRESS_CIRCLE_STATIC_COLORS)[number];

2nd-gen/packages/core/components/status-light/StatusLight.base.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,6 @@ export abstract class StatusLightBase extends SizedMixin(SpectrumElement, {
105105
}
106106
);
107107
}
108-
// Check disabled property if it exists (S1 only)
109-
if (this.hasAttribute('disabled') && !('disabled' in this)) {
110-
window.__swc.warn(
111-
this,
112-
`<${this.localName}> element does not support the disabled state.`,
113-
'https://opensource.adobe.com/spectrum-web-components/components/status-light/#states',
114-
{
115-
issues: ['disabled is not a supported property in Spectrum 2'],
116-
}
117-
);
118-
}
119108
}
120109
}
121110
}

2nd-gen/packages/core/components/status-light/StatusLight.types.ts

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111
*/
1212

1313
/**
14-
* @todo The S1 types can be removed once we are no longer maintaining 1st-gen.
1514
* @todo Rename STATUSLIGHT_ prefix to STATUS_LIGHT_ to align with type prefix
16-
* naming convention (use underscore separators for multi-word names). This
17-
* requires updating all imports in 1st-gen and 2nd-gen that reference these
18-
* constants.
15+
* naming convention (use underscore separators for multi-word names).
1916
*/
2017
import type { ElementSize } from '@spectrum-web-components/core/mixins/index.js';
2118

@@ -34,16 +31,7 @@ export const STATUSLIGHT_VARIANTS_SEMANTIC = [
3431
'notice',
3532
] as const;
3633

37-
export const STATUSLIGHT_VARIANTS_SEMANTIC_S1 = [
38-
...STATUSLIGHT_VARIANTS_SEMANTIC,
39-
'accent',
40-
] as const;
41-
42-
export const STATUSLIGHT_VARIANTS_SEMANTIC_S2 = [
43-
...STATUSLIGHT_VARIANTS_SEMANTIC,
44-
] as const;
45-
46-
export const STATUSLIGHT_VARIANTS_COLOR_S1 = [
34+
export const STATUSLIGHT_VARIANTS_COLOR = [
4735
'fuchsia',
4836
'indigo',
4937
'magenta',
@@ -53,43 +41,22 @@ export const STATUSLIGHT_VARIANTS_COLOR_S1 = [
5341
'chartreuse',
5442
'celery',
5543
'cyan',
56-
] as const;
57-
58-
export const STATUSLIGHT_VARIANTS_COLOR_S2 = [
59-
...STATUSLIGHT_VARIANTS_COLOR_S1,
6044
'pink',
6145
'turquoise',
6246
'brown',
6347
'cinnamon',
6448
'silver',
6549
] as const;
6650

67-
export const STATUSLIGHT_VARIANTS_S1 = [
68-
...STATUSLIGHT_VARIANTS_SEMANTIC_S1,
69-
...STATUSLIGHT_VARIANTS_COLOR_S1,
70-
] as const;
71-
72-
export const STATUSLIGHT_VARIANTS_S2 = [
73-
...STATUSLIGHT_VARIANTS_SEMANTIC_S2,
74-
...STATUSLIGHT_VARIANTS_COLOR_S2,
51+
export const STATUSLIGHT_VARIANTS = [
52+
...STATUSLIGHT_VARIANTS_SEMANTIC,
53+
...STATUSLIGHT_VARIANTS_COLOR,
7554
] as const;
7655

77-
export type StatusLightSemanticVariantS1 =
78-
(typeof STATUSLIGHT_VARIANTS_SEMANTIC_S1)[number];
79-
export type StatusLightSemanticVariantS2 =
80-
(typeof STATUSLIGHT_VARIANTS_SEMANTIC_S2)[number];
8156
export type StatusLightSemanticVariant =
82-
| StatusLightSemanticVariantS1
83-
| StatusLightSemanticVariantS2;
57+
(typeof STATUSLIGHT_VARIANTS_SEMANTIC)[number];
8458

85-
export type StatusLightColorVariantS1 =
86-
(typeof STATUSLIGHT_VARIANTS_COLOR_S1)[number];
87-
export type StatusLightColorVariantS2 =
88-
(typeof STATUSLIGHT_VARIANTS_COLOR_S2)[number];
8959
export type StatusLightColorVariant =
90-
| StatusLightColorVariantS1
91-
| StatusLightColorVariantS2;
60+
(typeof STATUSLIGHT_VARIANTS_COLOR)[number];
9261

93-
export type StatusLightVariantS1 = (typeof STATUSLIGHT_VARIANTS_S1)[number];
94-
export type StatusLightVariantS2 = (typeof STATUSLIGHT_VARIANTS_S2)[number];
95-
export type StatusLightVariant = StatusLightVariantS1 | StatusLightVariantS2;
62+
export type StatusLightVariant = (typeof STATUSLIGHT_VARIANTS)[number];

2nd-gen/packages/swc/components/badge/Badge.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ export class Badge extends BadgeBase {
7474

7575
/**
7676
* Whether the badge is subtle.
77-
*
78-
* @todo This can be moved to the base class once we are no longer maintaining 1st-gen.
7977
*/
8078
@property({ type: Boolean, reflect: true })
8179
public subtle: boolean = false;
@@ -84,8 +82,6 @@ export class Badge extends BadgeBase {
8482
* Whether the badge is outlined.
8583
*
8684
* Can only be used with semantic variants.
87-
*
88-
* @todo This can be moved to the base class once we are no longer maintaining 1st-gen.
8985
*/
9086
@property({ type: Boolean, reflect: true })
9187
public outline: boolean = false;

2nd-gen/packages/swc/components/progress-circle/ProgressCircle.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import { property } from 'lit/decorators.js';
1515
import { classMap } from 'lit/directives/class-map.js';
1616

1717
import {
18-
PROGRESS_CIRCLE_STATIC_COLORS_S2,
18+
PROGRESS_CIRCLE_STATIC_COLORS,
1919
ProgressCircleBase,
20-
type ProgressCircleStaticColorS2,
20+
type ProgressCircleStaticColor,
2121
} from '@spectrum-web-components/core/components/progress-circle';
2222
import { capitalize } from '@spectrum-web-components/core/utils/index.js';
2323

@@ -51,7 +51,7 @@ export class ProgressCircle extends ProgressCircleBase {
5151
/**
5252
* @internal
5353
*/
54-
static override readonly STATIC_COLORS = PROGRESS_CIRCLE_STATIC_COLORS_S2;
54+
static override readonly STATIC_COLORS = PROGRESS_CIRCLE_STATIC_COLORS;
5555

5656
/**
5757
* Static color variant for use on different backgrounds.
@@ -61,7 +61,7 @@ export class ProgressCircle extends ProgressCircleBase {
6161
* When set to 'black', the component uses black styling for images with a light tinted background.
6262
*/
6363
@property({ reflect: true, attribute: 'static-color' })
64-
public override staticColor?: ProgressCircleStaticColorS2;
64+
public override staticColor?: ProgressCircleStaticColor;
6565

6666
// ──────────────────────────────
6767
// RENDERING & STYLING

2nd-gen/packages/swc/components/status-light/StatusLight.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ import { property } from 'lit/decorators.js';
1515
import { classMap } from 'lit/directives/class-map.js';
1616

1717
import {
18-
STATUSLIGHT_VARIANTS_COLOR_S2,
19-
STATUSLIGHT_VARIANTS_S2,
20-
STATUSLIGHT_VARIANTS_SEMANTIC_S2,
18+
STATUSLIGHT_VARIANTS,
19+
STATUSLIGHT_VARIANTS_COLOR,
20+
STATUSLIGHT_VARIANTS_SEMANTIC,
2121
StatusLightBase,
22-
type StatusLightVariantS2 as StatusLightVariant,
22+
type StatusLightVariant,
2323
} from '@spectrum-web-components/core/components/status-light';
2424

2525
import styles from './status-light.css';
@@ -45,17 +45,17 @@ export class StatusLight extends StatusLightBase {
4545
/**
4646
* @internal
4747
*/
48-
static override readonly VARIANTS_COLOR = STATUSLIGHT_VARIANTS_COLOR_S2;
48+
static override readonly VARIANTS_COLOR = STATUSLIGHT_VARIANTS_COLOR;
4949

5050
/**
5151
* @internal
5252
*/
53-
static override readonly VARIANTS_SEMANTIC = STATUSLIGHT_VARIANTS_SEMANTIC_S2;
53+
static override readonly VARIANTS_SEMANTIC = STATUSLIGHT_VARIANTS_SEMANTIC;
5454

5555
/**
5656
* @internal
5757
*/
58-
static override readonly VARIANTS = STATUSLIGHT_VARIANTS_S2;
58+
static override readonly VARIANTS = STATUSLIGHT_VARIANTS;
5959

6060
/**
6161
* Changes the color of the status dot. The variant list includes both semantic and non-semantic options.

2nd-gen/packages/swc/components/status-light/stories/status-light.stories.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers';
1616

1717
import { StatusLight } from '@adobe/spectrum-wc/status-light';
1818
import {
19-
STATUSLIGHT_VARIANTS_COLOR_S2,
20-
STATUSLIGHT_VARIANTS_SEMANTIC_S2,
21-
StatusLightColorVariantS2,
22-
StatusLightSemanticVariantS2,
19+
STATUSLIGHT_VARIANTS_COLOR,
20+
STATUSLIGHT_VARIANTS_SEMANTIC,
21+
StatusLightColorVariant,
22+
StatusLightSemanticVariant,
2323
} from '@spectrum-web-components/core/components/status-light';
2424

2525
import '@adobe/spectrum-wc/status-light';
@@ -90,7 +90,7 @@ const semanticLabels = {
9090
positive: 'Approved',
9191
notice: 'Pending approval',
9292
negative: 'Rejected',
93-
} as const satisfies Record<StatusLightSemanticVariantS2, string>;
93+
} as const satisfies Record<StatusLightSemanticVariant, string>;
9494

9595
const nonSemanticLabels = {
9696
yellow: 'Operations',
@@ -107,7 +107,7 @@ const nonSemanticLabels = {
107107
brown: 'Facilities',
108108
cinnamon: 'Compliance',
109109
silver: 'Version 1.2.10',
110-
} as const satisfies Record<StatusLightColorVariantS2, string>;
110+
} as const satisfies Record<StatusLightColorVariant, string>;
111111

112112
// ────────────────────
113113
// AUTODOCS STORY
@@ -199,13 +199,12 @@ export const Sizes: Story = {
199199
*/
200200
export const SemanticVariants: Story = {
201201
render: (args) => html`
202-
${STATUSLIGHT_VARIANTS_SEMANTIC_S2.map(
203-
(variant: StatusLightSemanticVariantS2) =>
204-
template({
205-
...args,
206-
variant,
207-
'default-slot': semanticLabels[variant],
208-
})
202+
${STATUSLIGHT_VARIANTS_SEMANTIC.map((variant: StatusLightSemanticVariant) =>
203+
template({
204+
...args,
205+
variant,
206+
'default-slot': semanticLabels[variant],
207+
})
209208
)}
210209
`,
211210
parameters: {
@@ -233,7 +232,7 @@ export const SemanticVariants: Story = {
233232
*/
234233
export const NonSemanticVariants: Story = {
235234
render: (args) => html`
236-
${STATUSLIGHT_VARIANTS_COLOR_S2.map((variant: StatusLightColorVariantS2) =>
235+
${STATUSLIGHT_VARIANTS_COLOR.map((variant: StatusLightColorVariant) =>
237236
template({
238237
...args,
239238
variant,

2nd-gen/packages/swc/components/status-light/test/status-light.test.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -139,28 +139,3 @@ export const UnsupportedVariantWarningTest: Story = {
139139
);
140140
},
141141
};
142-
143-
export const DisabledAttributeWarningTest: Story = {
144-
render: () => html`
145-
<swc-status-light variant="positive">Positive</swc-status-light>
146-
`,
147-
play: async ({ canvasElement, step }) => {
148-
await step('warns when disabled attribute is set', () =>
149-
withWarningSpy(async (warnCalls) => {
150-
const statusLight = await getComponent<StatusLight>(
151-
canvasElement,
152-
'swc-status-light'
153-
);
154-
statusLight.setAttribute('disabled', '');
155-
statusLight.requestUpdate();
156-
await statusLight.updateComplete;
157-
158-
expect(warnCalls.length).toBeGreaterThan(0);
159-
expect(warnCalls[0][0]).toBe(statusLight);
160-
expect(warnCalls[0][1]).toContain(
161-
'does not support the disabled state'
162-
);
163-
})
164-
);
165-
},
166-
};

0 commit comments

Comments
 (0)