Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(core): converge status naming — positive/negative → success/error (#2175)

Cindy Zhanga37e2b804fcc
diff --git a/.github/scripts/codemod-verify.mjs b/.github/scripts/codemod-verify.mjs
index c468ffddd4..009ef9af48 100644
--- a/.github/scripts/codemod-verify.mjs
+++ b/.github/scripts/codemod-verify.mjs
@@ -121,6 +121,12 @@ async function main() {
const earliestIdx = allVersions.indexOf(earliestVersion);
const fromVersion = earliestIdx > 0 ? allVersions[earliestIdx - 1] : '0.0.0';
+ // Save the base versions to detect which files the codemod actually modified
+ const baseVersions = {};
+ for (const file of revertedFiles) {
+ baseVersions[file] = fs.readFileSync(file, 'utf-8');
+ }
+
// Run codemods on each affected consumer directory
const affectedDirs = [
...new Set(
@@ -146,18 +152,44 @@ async function main() {
});
}
+ // Filter to only files the codemod actually modified.
+ // Files unchanged by the codemod have unrelated edits in this PR — skip them.
+ const codemodModifiedFiles = revertedFiles.filter((file) => {
+ try {
+ return fs.readFileSync(file, 'utf-8') !== baseVersions[file];
+ } catch {
+ return false;
+ }
+ });
+ const skippedFiles = revertedFiles.filter((f) => !codemodModifiedFiles.includes(f));
+
+ if (codemodModifiedFiles.length === 0) {
+ console.log('\n✅ Codemod made no changes to consumer files — nothing to verify.');
+ for (const file of consumerFiles) {
+ fs.writeFileSync(file, prVersions[file]);
+ }
+ process.exit(0);
+ }
+
+ if (skippedFiles.length > 0) {
+ console.log(`\nSkipping ${skippedFiles.length} file(s) not modified by codemod:`);
+ for (const file of skippedFiles) {
+ console.log(` ⏭ ${file}`);
+ }
+ }
+
// Format codemod output with prettier to normalize style differences
// (jscodeshift's toSource() may change quotes, spacing, etc.)
- console.log('Formatting codemod output with prettier...');
+ console.log('\nFormatting codemod output with prettier...');
try {
- run(`npx prettier --write ${revertedFiles.map((f) => `"${f}"`).join(' ')}`);
+ run(`npx prettier --write ${codemodModifiedFiles.map((f) => `"${f}"`).join(' ')}`);
} catch (e) {
console.log(' ⚠️ Prettier formatting failed, comparing raw output');
}
// Also format the expected (PR) versions for a fair comparison
const formattedExpected = {};
- for (const file of revertedFiles) {
+ for (const file of codemodModifiedFiles) {
// Use the original file extension so prettier can infer the parser
const ext = path.extname(file);
const tmpFile = file.replace(ext, `.expected${ext}`);
@@ -171,12 +203,16 @@ async function main() {
fs.unlinkSync(tmpFile);
}
- // Compare formatted codemod output against formatted PR versions
+ // Compare codemod changes against PR versions.
+ // Instead of requiring exact file match, we verify that every line the
+ // codemod REMOVED from base is also absent in the PR, and every line it
+ // ADDED is present in the PR. This allows the PR to contain additional
+ // changes from stacked commits that are beyond the codemod's scope.
let mismatches = 0;
let matches = 0;
const mismatchDetails = [];
- for (const file of revertedFiles) {
+ for (const file of codemodModifiedFiles) {
const expected = formattedExpected[file] || prVersions[file];
let actual;
try {
@@ -189,16 +225,43 @@ async function main() {
matches++;
console.log(` ✅ ${file}`);
} else {
- mismatches++;
- const actualLines = actual.split('\n');
- const expectedLines = expected.split('\n');
- let diffCount = 0;
- const maxLen = Math.max(actualLines.length, expectedLines.length);
- for (let i = 0; i < maxLen; i++) {
- if (actualLines[i] !== expectedLines[i]) diffCount++;
+ // Check if the codemod's changes are a subset of the PR's changes.
+ // The codemod transforms base → actual. The PR transforms base → expected.
+ // We verify that lines removed by codemod are also removed in PR,
+ // and lines added by codemod are present in PR.
+ const baseLines = (baseVersions[file] || '').split('\n');
+ const codemodLines = actual.split('\n');
+ const prLines = expected.split('\n');
+
+ // Find lines removed by codemod (in base but not in codemod output)
+ const codemodRemovedFromBase = baseLines.filter((l) => !codemodLines.includes(l));
+ // Find lines added by codemod (in codemod output but not in base)
+ const codemodAddedToBase = codemodLines.filter((l) => !baseLines.includes(l));
+
+ // Check: removed lines should also be absent from PR
+ const missingRemovals = codemodRemovedFromBase.filter(
+ (l) => l.trim() && prLines.includes(l),
+ );
+ // Check: added lines should be present in PR
+ const missingAdditions = codemodAddedToBase.filter(
+ (l) => l.trim() && !prLines.includes(l),
+ );
+
+ if (missingRemovals.length === 0 && missingAdditions.length === 0) {
+ matches++;
+ console.log(` ✅ ${file} (superset — PR includes codemod changes + additional edits)`);
+ } else {
+ mismatches++;
+ const issues = [];
+ if (missingRemovals.length > 0) {
+ issues.push(`${missingRemovals.length} line(s) codemod removed still present in PR`);
+ }
+ if (missingAdditions.length > 0) {
+ issues.push(`${missingAdditions.length} line(s) codemod added missing from PR`);
+ }
+ mismatchDetails.push({file, diffLines: missingRemovals.length + missingAdditions.length, issues: issues.join('; ')});
+ console.log(` ❌ ${file} (${issues.join('; ')})`);
}
- mismatchDetails.push({file, diffLines: diffCount});
- console.log(` ❌ ${file} (${diffCount} lines differ)`);
}
}
@@ -218,9 +281,9 @@ async function main() {
console.log(` ❌ Mismatches: ${mismatches}`);
if (mismatches > 0) {
- console.log('\nMismatched files (codemod output ≠ committed changes):');
- for (const {file, diffLines} of mismatchDetails) {
- console.log(` ❌ ${file} (${diffLines} line${diffLines === 1 ? '' : 's'} differ)`);
+ console.log('\nMismatched files (codemod changes not fully reflected in PR):');
+ for (const {file, diffLines, issues} of mismatchDetails) {
+ console.log(` ❌ ${file} (${issues || diffLines + ' lines differ'})`);
}
console.log('\n⚠️ The codemod did not reproduce the committed consumer changes.');
console.log('This means either:');
diff --git a/apps/docsite/src/app/playground/PlaygroundClient.tsx b/apps/docsite/src/app/playground/PlaygroundClient.tsx
index 6d51a2eb08..04d60c4e3a 100644
--- a/apps/docsite/src/app/playground/PlaygroundClient.tsx
+++ b/apps/docsite/src/app/playground/PlaygroundClient.tsx
@@ -401,7 +401,7 @@ export function PlaygroundClient() {
<div {...stylex.props(s.toolbar)}>
<XDSHStack gap={8} align="center">
<XDSStatusDot
- variant={previewError ? "negative" : previewReady ? "positive" : "warning"}
+ variant={previewError ? "error" : previewReady ? "success" : "warning"}
label={previewError ? "Error" : previewReady ? "Ready" : "Loading"}
/>
<XDSText color="secondary" type="supporting">
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx
index 203baf5c9b..dfa8406d36 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/DocsView.tsx
@@ -391,7 +391,7 @@ function ChangelogSection({
}: {
label: string;
items: ChangelogItem[];
- dotVariant: 'negative' | 'positive' | 'warning' | 'info';
+ dotVariant: 'error' | 'success' | 'warning' | 'accent';
}) {
if (items.length === 0) return null;
return (
@@ -550,14 +550,14 @@ function VersionCard({
<ChangelogSection
label="Breaking Changes"
items={version.breakingChanges}
- dotVariant="negative"
+ dotVariant="error"
/>
)}
{(!visibleSection || visibleSection === 'Features') && (
<ChangelogSection
label="New Features"
items={version.features}
- dotVariant="positive"
+ dotVariant="success"
/>
)}
{(!visibleSection || visibleSection === 'Fixes') && (
@@ -579,7 +579,7 @@ function VersionCard({
gap={2}
vAlign="center"
style={{marginBottom: 10}}>
- <XDSStatusDot variant="info" label="Codemods" />
+ <XDSStatusDot variant="accent" label="Codemods" />
<XDSText
type="supporting"
color="secondary"
@@ -2897,7 +2897,7 @@ const ICON_COLORS: {color: string}[] = [
{color: 'secondary'},
{color: 'disabled'},
{color: 'accent'},
- {color: 'negative'},
+ {color: 'error'},
{color: 'warning'},
{color: 'success'},
{color: 'inherit'},
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx
index d8d5ade17a..c0d60304ef 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/docsite/ThemeEditorView.tsx
@@ -1209,7 +1209,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Savings Targets */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1270,7 +1269,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Buy Investment */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1326,7 +1324,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Recent Transactions */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1423,7 +1420,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Stock Performance */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1446,7 +1442,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* Card Balance */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1480,7 +1475,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* Power Usage */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1522,7 +1516,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* Clearinghouse Balance */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1571,7 +1564,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* Payout Preferences */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1635,7 +1627,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Q2 Dividend Income */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1700,7 +1691,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Payments Navigation */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1748,7 +1738,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* FAQ / Settings Tabs */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1797,7 +1786,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Savings Target Progress */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1829,7 +1817,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* Kitchen Island (Smart Home) */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1870,7 +1857,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Upcoming Payments */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1907,7 +1893,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* Syncing Accounts */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1935,7 +1920,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Notifications */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -1993,7 +1977,6 @@ function ComponentPreview() {
/>
</XDSCard>
</div>
-
{/* Dollar-Cost Averaging */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -2010,7 +1993,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* Buttons & Overlays */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -2072,7 +2054,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* Form Controls */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -2123,7 +2104,6 @@ function ComponentPreview() {
</XDSVStack>
</XDSCard>
</div>
-
{/* Loading & Status */}
<div style={CARD_WRAP}>
<XDSCard>
@@ -2172,7 +2152,7 @@ function ComponentPreview() {
<XDSDivider variant="strong" />
<XDSHStack gap={4} vAlign="center">
<XDSHStack gap={2} vAlign="center">
- <XDSStatusDot variant="positive" label="Online" isPulsing />
+ <XDSStatusDot variant="success" label="Online" isPulsing />
<XDSText type="body">Online</XDSText>
</XDSHStack>
<XDSHStack gap={2} vAlign="center">
@@ -2180,14 +2160,13 @@ function ComponentPreview() {
<XDSText type="body">Away</XDSText>
</XDSHStack>
<XDSHStack gap={2} vAlign="center">
- <XDSStatusDot variant="negative" label="Busy" isPulsing />
+ <XDSStatusDot variant="error" label="Busy" isPulsing />
<XDSText type="body">Busy</XDSText>
</XDSHStack>
</XDSHStack>
</XDSVStack>
</XDSCard>
</div>
-
{/* Surface Interactions */}
<div style={CARD_WRAP}>
<XDSCard>
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/example-cards/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/example-cards/page.tsx
index fcd7f2b19c..cd3595f2a3 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/example-cards/page.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/example-cards/page.tsx
@@ -968,13 +968,13 @@ export default function ExampleCardsPage() {
Overview
</XDSText>
{[
- {name: 'Dashboard', color: 'info' as const},
- {name: 'Transactions', color: 'info' as const},
- {name: 'Investments', color: 'positive' as const},
- {name: 'Goals', color: 'positive' as const},
+ {name: 'Dashboard', color: 'accent' as const},
+ {name: 'Transactions', color: 'accent' as const},
+ {name: 'Investments', color: 'success' as const},
+ {name: 'Goals', color: 'success' as const},
{name: 'Budget', color: 'warning' as const},
{name: 'Reports', color: 'warning' as const},
- {name: 'Documents', color: 'info' as const},
+ {name: 'Documents', color: 'accent' as const},
].map(item => (
<XDSHStack key={item.name} gap={2} vAlign="center">
<XDSStatusDot variant={item.color} label={item.name} />
@@ -987,13 +987,13 @@ export default function ExampleCardsPage() {
Account
</XDSText>
{[
- {name: 'Profile', color: 'info' as const},
- {name: 'Billing', color: 'info' as const},
- {name: 'Notifications', color: 'positive' as const},
+ {name: 'Profile', color: 'accent' as const},
+ {name: 'Billing', color: 'accent' as const},
+ {name: 'Notifications', color: 'success' as const},
{name: 'Security', color: 'warning' as const},
- {name: 'Help Center', color: 'positive' as const},
- {name: 'Contact Us', color: 'info' as const},
- {name: 'Status', color: 'positive' as const},
+ {name: 'Help Center', color: 'success' as const},
+ {name: 'Contact Us', color: 'accent' as const},
+ {name: 'Status', color: 'success' as const},
].map(item => (
<XDSHStack key={item.name} gap={2} vAlign="center">
<XDSStatusDot variant={item.color} label={item.name} />
@@ -1288,7 +1288,7 @@ export default function ExampleCardsPage() {
</XDSVStack>
<XDSHStack gap={2} vAlign="center">
<XDSText type="supporting">Locked</XDSText>
- <XDSStatusDot variant="positive" label="Locked" />
+ <XDSStatusDot variant="success" label="Locked" />
</XDSHStack>
</div>
<div {...stylex.props(styles.placeholder)}>
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/showcase-header/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/showcase-header/page.tsx
index b67c0fdeeb..14525cfe19 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/showcase-header/page.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/showcase-header/page.tsx
@@ -71,7 +71,7 @@ export default function ShowcaseHeaderPage() {
</div>
<div {...stylex.props(styles.availableRow)}>
- <XDSStatusDot variant="positive" label="Available" isPulsing />
+ <XDSStatusDot variant="success" label="Available" isPulsing />
<XDSText type="body" color="secondary">
Available now
</XDSText>
diff --git a/apps/sandbox/src/app/(sandbox)/pages/motion-examples/page.tsx b/apps/sandbox/src/app/(sandbox)/pages/motion-examples/page.tsx
index 45fe7d6041..4a277faee0 100644
--- a/apps/sandbox/src/app/(sandbox)/pages/motion-examples/page.tsx
+++ b/apps/sandbox/src/app/(sandbox)/pages/motion-examples/page.tsx
@@ -259,9 +259,7 @@ function MicroInteractionsCard() {
hasCloseButton={false}>
<XDSButton label="Start" variant="secondary" size="sm" />
</XDSPopover>
- <XDSHoverCard
- content={<HoverCardDemoContent />}
- placement="below">
+ <XDSHoverCard content={<HoverCardDemoContent />} placement="below">
<XDSButton label="HoverCard" variant="secondary" size="sm" />
</XDSHoverCard>
<XDSTooltip content="Tooltip · duration-fast-max">
@@ -277,7 +275,11 @@ function MicroInteractionsCard() {
Switches — thumb slide, track color · duration-fast
</XDSText>
<XDSHStack gap={4}>
- <XDSSwitch label="Notifications" value={switch1} onChange={setSwitch1} />
+ <XDSSwitch
+ label="Notifications"
+ value={switch1}
+ onChange={setSwitch1}
+ />
<XDSSwitch label="Sync" value={switch2} onChange={setSwitch2} />
</XDSHStack>
</XDSVStack>
@@ -448,7 +450,7 @@ function LoadingStatusCard() {
</XDSText>
<XDSHStack gap={4} vAlign="center">
<XDSHStack gap={2} vAlign="center">
- <XDSStatusDot variant="positive" label="Online" isPulsing />
+ <XDSStatusDot variant="success" label="Online" isPulsing />
<XDSText type="body">Online</XDSText>
</XDSHStack>
<XDSHStack gap={2} vAlign="center">
@@ -456,7 +458,7 @@ function LoadingStatusCard() {
<XDSText type="body">Away</XDSText>
</XDSHStack>
<XDSHStack gap={2} vAlign="center">
- <XDSStatusDot variant="negative" label="Busy" isPulsing />
+ <XDSStatusDot variant="error" label="Busy" isPulsing />
<XDSText type="body">Busy</XDSText>
</XDSHStack>
</XDSHStack>
diff --git a/apps/sandbox/src/app/(sandbox)/pages/table-overview/page.tsx b/apps/sandbox/src/app/(sandbox)/pages/table-overview/page.tsx
index 88332296e6..d9bcc6e3cc 100644
--- a/apps/sandbox/src/app/(sandbox)/pages/table-overview/page.tsx
+++ b/apps/sandbox/src/app/(sandbox)/pages/table-overview/page.tsx
@@ -281,7 +281,7 @@ const columns: XDSTableColumn<ReviewRow>[] = [
renderCell: (item: ReviewRow) => (
<XDSHStack gap={2} vAlign="center">
<XDSStatusDot
- variant={item.testStatus === 'passed' ? 'positive' : 'negative'}
+ variant={item.testStatus === 'passed' ? 'success' : 'error'}
label={item.testStatus === 'passed' ? 'Passed' : 'Failed'}
/>
<XDSText type="supporting">
diff --git a/apps/sandbox/src/components/ThemePalettePreview.tsx b/apps/sandbox/src/components/ThemePalettePreview.tsx
index a390d17ca5..b77bb6711e 100644
--- a/apps/sandbox/src/components/ThemePalettePreview.tsx
+++ b/apps/sandbox/src/components/ThemePalettePreview.tsx
@@ -21,10 +21,7 @@ import type {XDSDefinedTheme} from '@xds/core/theme';
import {XDSLayerProvider} from '@xds/core/Layer';
import {defaultTheme} from '@xds/theme-default/built';
-import {
- ThemeAuditDrawer,
- useThemeAudit,
-} from './themePreview/ThemeAuditDrawer';
+import {ThemeAuditDrawer, useThemeAudit} from './themePreview/ThemeAuditDrawer';
import {
buildTonalUsageMap,
tonalUsageKey,
@@ -205,10 +202,7 @@ const DARK_TONE_LIFT = 5;
const DARK_LIFT_TAPER_START = 80;
const DARK_LIFT_TAPER_END = 95;
const DARK_CHROMA_FACTOR = 0.85;
-function darkTonalPalette(
- hue: number,
- chroma: number,
-): Record<number, string> {
+function darkTonalPalette(hue: number, chroma: number): Record<number, string> {
const adjustedChroma = chroma * DARK_CHROMA_FACTOR;
const maxChroma = adjustedChroma * 1.8;
const result: Record<number, string> = {};
@@ -296,7 +290,7 @@ export interface CoreSwatch {
hex: string;
name: string;
/** Optional dark-mode override. When present, replaces hex and name in the dark column. */
- dark?: { hex: string; name: string };
+ dark?: {hex: string; name: string};
}
export interface ThemePalettePreviewProps {
@@ -543,9 +537,7 @@ function CoreSection({swatches, mode}: {swatches: CoreSwatch[]; mode?: Mode}) {
return (
<div key={hex}>
<div style={S.coreSwatch(hex)} />
- <div style={S.coreMeta}>
- {name && <div>{name}</div>}
- </div>
+ <div style={S.coreMeta}>{name && <div>{name}</div>}</div>
</div>
);
})}
@@ -726,7 +718,7 @@ function ProgressBarSection() {
<XDSProgressBar
value={40}
label="Upload"
- variant="positive"
+ variant="success"
hasValueLabel
/>
<XDSProgressBar
@@ -1057,87 +1049,92 @@ function TonalSection({
white (T100).
{isDark && (
<>
- {' '}Dark mode applies the audit&apos;s &sect;4 transform
- (<strong>+5 brightness</strong> with taper above T80,{' '}
- <strong>×0.85 chroma</strong>) so saturated stops don&apos;t
- vibrate against the dark canvas.
+ {' '}
+ Dark mode applies the audit&apos;s &sect;4 transform (
+ <strong>+5 brightness</strong> with taper above T80,{' '}
+ <strong>×0.85 chroma</strong>) so saturated stops don&apos;t vibrate
+ against the dark canvas.
</>
)}{' '}
{usage
? 'Markers ● show tone steps consumed by theme tokens (open the audit drawer for the full report).'
: 'Badge tokens use T90/T30 (light) and T70/T15 (dark).'}
</p>
- {colors.map(({name, sourceHex, semantic, note, tones: overrideTones, dark}) => {
- // In dark mode, use per-mode overrides if provided.
- const effectiveSourceHex = (isDark && dark?.sourceHex) || sourceHex;
- const effectiveTones = (isDark && dark?.tones) || overrideTones;
- const hct = hexToHct(effectiveSourceHex);
- const computedTones = tonalPaletteForMode(hct.hue, hct.chroma, mode);
- // Theme override wins when it has a hex for this step; otherwise
- // fall back to the algorithm so the strip is always a full 21-step
- // ramp (no missing cells when the theme defines a subset).
- const resolveTone = (t: number): string => {
- if (effectiveTones) {
- const v = effectiveTones[t];
- if (typeof v === 'string') return v;
- }
- return computedTones[t];
- };
- const steps = TONE_STEPS;
- return (
- <div key={name} style={S.tonalRow}>
- <span style={S.tonalLabel}>
- {name}
- {semantic && (
- <span style={{display: 'block', fontSize: 8, opacity: 0.5}}>
- = {semantic}
- </span>
- )}
- {note && (
- <span style={{display: 'block', fontSize: 8, opacity: 0.5}}>
- {note}
- </span>
- )}
- </span>
- <div style={S.tonalStrip}>
- {steps.map(t => {
- const hex = resolveTone(t);
- const usages = usage?.[tonalUsageKey(name, mode, t)] ?? [];
- // Title summarises which tokens snap to this step (max 4
- // listed to keep the native tooltip readable on dense ramps).
- const titleLines = [
- `${name} T${t}: ${hex}`,
- ...usages
- .slice(0, 4)
- .map(u => `· ${u.name} (\u0394E ${u.deltaE.toFixed(1)})`),
- usages.length > 4 ? `· +${usages.length - 4} more` : '',
- ].filter(Boolean);
- return (
- <div
- key={t}
- style={{
- ...S.tonalCell(hex),
- position: 'relative' as const,
- }}
- title={titleLines.join('\n')}>
- <span style={S.tonalNum(t)}>{t}</span>
- {usages.length > 0 && (
- <div style={S.markerDot(t)}>
- {usages.length > 1 && (
- <span style={S.markerCount(t)}>{usages.length}</span>
- )}
- </div>
- )}
- </div>
- );
- })}
+ {colors.map(
+ ({name, sourceHex, semantic, note, tones: overrideTones, dark}) => {
+ // In dark mode, use per-mode overrides if provided.
+ const effectiveSourceHex = (isDark && dark?.sourceHex) || sourceHex;
+ const effectiveTones = (isDark && dark?.tones) || overrideTones;
+ const hct = hexToHct(effectiveSourceHex);
+ const computedTones = tonalPaletteForMode(hct.hue, hct.chroma, mode);
+ // Theme override wins when it has a hex for this step; otherwise
+ // fall back to the algorithm so the strip is always a full 21-step
+ // ramp (no missing cells when the theme defines a subset).
+ const resolveTone = (t: number): string => {
+ if (effectiveTones) {
+ const v = effectiveTones[t];
+ if (typeof v === 'string') return v;
+ }
+ return computedTones[t];
+ };
+ const steps = TONE_STEPS;
+ return (
+ <div key={name} style={S.tonalRow}>
+ <span style={S.tonalLabel}>
+ {name}
+ {semantic && (
+ <span style={{display: 'block', fontSize: 8, opacity: 0.5}}>
+ = {semantic}
+ </span>
+ )}
+ {note && (
+ <span style={{display: 'block', fontSize: 8, opacity: 0.5}}>
+ {note}
+ </span>
+ )}
+ </span>
+ <div style={S.tonalStrip}>
+ {steps.map(t => {
+ const hex = resolveTone(t);
+ const usages = usage?.[tonalUsageKey(name, mode, t)] ?? [];
+ // Title summarises which tokens snap to this step (max 4
+ // listed to keep the native tooltip readable on dense ramps).
+ const titleLines = [
+ `${name} T${t}: ${hex}`,
+ ...usages
+ .slice(0, 4)
+ .map(u => `· ${u.name} (\u0394E ${u.deltaE.toFixed(1)})`),
+ usages.length > 4 ? `· +${usages.length - 4} more` : '',
+ ].filter(Boolean);
+ return (
+ <div
+ key={t}
+ style={{
+ ...S.tonalCell(hex),
+ position: 'relative' as const,
+ }}
+ title={titleLines.join('\n')}>
+ <span style={S.tonalNum(t)}>{t}</span>
+ {usages.length > 0 && (
+ <div style={S.markerDot(t)}>
+ {usages.length > 1 && (
+ <span style={S.markerCount(t)}>
+ {usages.length}
+ </span>
+ )}
+ </div>
+ )}
+ </div>
+ );
+ })}
+ </div>
+ <span style={S.tonalHct}>
+ H:{hct.hue.toFixed(0)} C:{hct.chroma.toFixed(0)}
+ </span>
</div>
- <span style={S.tonalHct}>
- H:{hct.hue.toFixed(0)} C:{hct.chroma.toFixed(0)}
- </span>
- </div>
- );
- })}
+ );
+ },
+ )}
<p
style={{
fontSize: 10,
@@ -1354,42 +1351,42 @@ export function ThemePalettePreview({
position: 'relative',
zIndex: 1,
}}>
- <div style={S.inner}>
- <h1 style={S.title}>{title}</h1>
- <p style={S.subtitle}>{subtitle}</p>
- {tonalModes.map(m => (
- <XDSTheme key={m} theme={theme} mode={m}>
- <XDSLayerProvider>
- {/* Spread overrideVars *inside* the inner XDSTheme so
+ <div style={S.inner}>
+ <h1 style={S.title}>{title}</h1>
+ <p style={S.subtitle}>{subtitle}</p>
+ {tonalModes.map(m => (
+ <XDSTheme key={m} theme={theme} mode={m}>
+ <XDSLayerProvider>
+ {/* Spread overrideVars *inside* the inner XDSTheme so
pending overrides win over the theme's own
`:scope { --color-*: … }` rules. Same trick the
ModeColumn uses. */}
- <div
- style={{
- ...overrideVars,
- background: 'var(--color-background-body)',
- color: 'var(--color-text-primary)',
- borderRadius: 16,
- padding: 24,
- marginBottom: 16,
- border: '1px solid var(--color-border)',
- }}>
- {tonalModes.length > 1 && (
- <p style={{...S.modeLabel, marginBottom: 16}}>
- {m === 'light' ? 'Light Mode' : 'Dark Mode'}
- </p>
- )}
- <TonalSection
- colors={tonalColors}
- mode={m}
- usage={effectiveUsage}
- />
- </div>
- </XDSLayerProvider>
- </XDSTheme>
- ))}
- <div style={columnsStyle}>{renderColumns()}</div>
- </div>
+ <div
+ style={{
+ ...overrideVars,
+ background: 'var(--color-background-body)',
+ color: 'var(--color-text-primary)',
+ borderRadius: 16,
+ padding: 24,
+ marginBottom: 16,
+ border: '1px solid var(--color-border)',
+ }}>
+ {tonalModes.length > 1 && (
+ <p style={{...S.modeLabel, marginBottom: 16}}>
+ {m === 'light' ? 'Light Mode' : 'Dark Mode'}
+ </p>
+ )}
+ <TonalSection
+ colors={tonalColors}
+ mode={m}
+ usage={effectiveUsage}
+ />
+ </div>
+ </XDSLayerProvider>
+ </XDSTheme>
+ ))}
+ <div style={columnsStyle}>{renderColumns()}</div>
+ </div>
</div>
</XDSLayerProvider>
</XDSTheme>
diff --git a/apps/storybook/stories/Avatar.stories.tsx b/apps/storybook/stories/Avatar.stories.tsx
index cfbcb8fefc..9ce8b83eae 100644
--- a/apps/storybook/stories/Avatar.stories.tsx
+++ b/apps/storybook/stories/Avatar.stories.tsx
@@ -232,7 +232,7 @@ export const WithStatus: Story = {
src="https://i.pravatar.cc/150?img=20"
name="Online User"
size="large"
- status={<XDSAvatarStatusDot variant="positive" label="Online" />}
+ status={<XDSAvatarStatusDot variant="success" label="Online" />}
/>
<XDSAvatar
src="https://i.pravatar.cc/150?img=21"
@@ -244,7 +244,7 @@ export const WithStatus: Story = {
src="https://i.pravatar.cc/150?img=22"
name="Busy User"
size="large"
- status={<XDSAvatarStatusDot variant="negative" label="Busy" />}
+ status={<XDSAvatarStatusDot variant="error" label="Busy" />}
/>
</div>
</div>
@@ -264,27 +264,27 @@ export const StatusAcrossAllSizes: Story = {
<XDSAvatar
name="TY"
size="tiny"
- status={<XDSAvatarStatusDot variant="positive" />}
+ status={<XDSAvatarStatusDot variant="success" />}
/>
<XDSAvatar
name="XS"
size="xsmall"
- status={<XDSAvatarStatusDot variant="positive" />}
+ status={<XDSAvatarStatusDot variant="success" />}
/>
<XDSAvatar
name="SM"
size="small"
- status={<XDSAvatarStatusDot variant="positive" />}
+ status={<XDSAvatarStatusDot variant="success" />}
/>
<XDSAvatar
name="MD"
size="medium"
- status={<XDSAvatarStatusDot variant="positive" />}
+ status={<XDSAvatarStatusDot variant="success" />}
/>
<XDSAvatar
name="LG"
size="large"
- status={<XDSAvatarStatusDot variant="positive" />}
+ status={<XDSAvatarStatusDot variant="success" />}
/>
</div>
@@ -294,19 +294,19 @@ export const StatusAcrossAllSizes: Story = {
src="https://i.pravatar.cc/150?img=30"
name="U1"
size={20}
- status={<XDSAvatarStatusDot variant="positive" />}
+ status={<XDSAvatarStatusDot variant="success" />}
/>
<XDSAvatar
src="https://i.pravatar.cc/150?img=31"
name="U2"
size={32}
- status={<XDSAvatarStatusDot variant="positive" />}
+ status={<XDSAvatarStatusDot variant="success" />}
/>
<XDSAvatar
src="https://i.pravatar.cc/150?img=32"
name="U3"
size={48}
- status={<XDSAvatarStatusDot variant="negative" />}
+ status={<XDSAvatarStatusDot variant="error" />}
/>
<XDSAvatar
src="https://i.pravatar.cc/150?img=33"
@@ -318,13 +318,13 @@ export const StatusAcrossAllSizes: Story = {
src="https://i.pravatar.cc/150?img=34"
name="U5"
size={96}
- status={<XDSAvatarStatusDot variant="positive" />}
+ status={<XDSAvatarStatusDot variant="success" />}
/>
<XDSAvatar
src="https://i.pravatar.cc/150?img=35"
name="U6"
size={128}
- status={<XDSAvatarStatusDot variant="positive" />}
+ status={<XDSAvatarStatusDot variant="success" />}
/>
</div>
@@ -334,7 +334,7 @@ export const StatusAcrossAllSizes: Story = {
src="https://i.pravatar.cc/150?img=40"
name="Positive"
size="medium"
- status={<XDSAvatarStatusDot variant="positive" label="Online" />}
+ status={<XDSAvatarStatusDot variant="success" label="Online" />}
/>
<XDSAvatar
src="https://i.pravatar.cc/150?img=41"
@@ -346,7 +346,7 @@ export const StatusAcrossAllSizes: Story = {
src="https://i.pravatar.cc/150?img=42"
name="Negative"
size="medium"
- status={<XDSAvatarStatusDot variant="negative" label="Busy" />}
+ status={<XDSAvatarStatusDot variant="error" label="Busy" />}
/>
</div>
</div>
@@ -382,7 +382,7 @@ export const StatusWithIcon: Story = {
size="tiny"
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -393,7 +393,7 @@ export const StatusWithIcon: Story = {
size="xsmall"
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -404,7 +404,7 @@ export const StatusWithIcon: Story = {
size="small"
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -416,7 +416,7 @@ export const StatusWithIcon: Story = {
size="medium"
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -428,7 +428,7 @@ export const StatusWithIcon: Story = {
size="large"
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -444,7 +444,7 @@ export const StatusWithIcon: Story = {
size={20}
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -456,7 +456,7 @@ export const StatusWithIcon: Story = {
size={32}
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -468,7 +468,7 @@ export const StatusWithIcon: Story = {
size={48}
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -480,7 +480,7 @@ export const StatusWithIcon: Story = {
size={72}
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -492,7 +492,7 @@ export const StatusWithIcon: Story = {
size={96}
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -504,7 +504,7 @@ export const StatusWithIcon: Story = {
size={128}
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -520,7 +520,7 @@ export const StatusWithIcon: Story = {
size="large"
status={
<XDSAvatarStatusDot
- variant="positive"
+ variant="success"
label="Verified"
icon={<CheckIcon />}
/>
@@ -544,7 +544,7 @@ export const StatusWithIcon: Story = {
size="large"
status={
<XDSAvatarStatusDot
- variant="negative"
+ variant="error"
label="Rejected"
icon={<CheckIcon />}
/>
diff --git a/apps/storybook/stories/Icon.stories.tsx b/apps/storybook/stories/Icon.stories.tsx
index 8151df65af..68d682bf3f 100644
--- a/apps/storybook/stories/Icon.stories.tsx
+++ b/apps/storybook/stories/Icon.stories.tsx
@@ -37,8 +37,8 @@ const meta: Meta<typeof XDSIcon> = {
'tertiary',
'disabled',
'accent',
- 'positive',
- 'negative',
+ 'success',
+ 'error',
'warning',
'inherit',
],
@@ -87,14 +87,14 @@ export const Accent: Story = {
export const Positive: Story = {
args: {
icon: CheckCircleIcon,
- color: 'positive',
+ color: 'success',
},
};
export const Negative: Story = {
args: {
icon: XCircleIcon,
- color: 'negative',
+ color: 'error',
},
};
@@ -136,7 +136,7 @@ export const Large: Story = {
export const SolidIcon: Story = {
args: {
icon: HeartIconSolid,
- color: 'negative',
+ color: 'error',
size: 'lg',
},
};
@@ -149,8 +149,8 @@ export const AllColors: Story = {
<XDSIcon icon={CogIcon} color="tertiary" />
<XDSIcon icon={BellIcon} color="disabled" />
<XDSIcon icon={HeartIcon} color="accent" />
- <XDSIcon icon={CheckCircleIcon} color="positive" />
- <XDSIcon icon={XCircleIcon} color="negative" />
+ <XDSIcon icon={CheckCircleIcon} color="success" />
+ <XDSIcon icon={XCircleIcon} color="error" />
<XDSIcon icon={ExclamationTriangleIcon} color="warning" />
</div>
),
@@ -177,7 +177,7 @@ export const OutlineVsSolid: Story = {
alignItems: 'center',
gap: '8px',
}}>
- <XDSIcon icon={HeartIcon} size="lg" color="negative" />
+ <XDSIcon icon={HeartIcon} size="lg" color="error" />
<span style={{fontSize: '12px', color: '#666'}}>Outline</span>
</div>
<div
@@ -187,7 +187,7 @@ export const OutlineVsSolid: Story = {
alignItems: 'center',
gap: '8px',
}}>
- <XDSIcon icon={HeartIconSolid} size="lg" color="negative" />
+ <XDSIcon icon={HeartIconSolid} size="lg" color="error" />
<span style={{fontSize: '12px', color: '#666'}}>Solid</span>
</div>
<div
@@ -254,7 +254,20 @@ export const InheritColor: Story = {
export const NonSemanticColors: Story = {
render: () => (
<XDSHStack gap={4} wrap="wrap">
- {(['blue', 'red', 'green', 'gray', 'cyan', 'teal', 'yellow', 'orange', 'pink', 'purple'] as const).map(color => (
+ {(
+ [
+ 'blue',
+ 'red',
+ 'green',
+ 'gray',
+ 'cyan',
+ 'teal',
+ 'yellow',
+ 'orange',
+ 'pink',
+ 'purple',
+ ] as const
+ ).map(color => (
<XDSVStack key={color} gap={1} hAlign="center">
<XDSIcon icon={StarIcon} color={color} />
<XDSText type="supporting">{color}</XDSText>
diff --git a/apps/storybook/stories/ProgressBar.stories.tsx b/apps/storybook/stories/ProgressBar.stories.tsx
index d48f301bb7..07bbddd14d 100644
--- a/apps/storybook/stories/ProgressBar.stories.tsx
+++ b/apps/storybook/stories/ProgressBar.stories.tsx
@@ -22,7 +22,7 @@ const meta: Meta<typeof XDSProgressBar> = {
},
variant: {
control: 'select',
- options: ['accent', 'positive', 'warning', 'negative'],
+ options: ['accent', 'success', 'warning', 'error'],
description: 'Semantic color variant',
},
size: {
@@ -85,7 +85,7 @@ export const Variants: Story = {
<XDSProgressBar
value={80}
label="Positive"
- variant="positive"
+ variant="success"
hasValueLabel
/>
<XDSProgressBar
@@ -97,7 +97,7 @@ export const Variants: Story = {
<XDSProgressBar
value={92}
label="Negative"
- variant="negative"
+ variant="error"
hasValueLabel
/>
<XDSProgressBar
@@ -162,7 +162,7 @@ export const Full: Story = {
value: 100,
label: 'Complete',
hasValueLabel: true,
- variant: 'positive',
+ variant: 'success',
},
};
@@ -191,9 +191,9 @@ export const IndeterminateVariants: Story = {
width: '300px',
}}>
<XDSProgressBar isIndeterminate label="Accent" variant="accent" />
- <XDSProgressBar isIndeterminate label="Positive" variant="positive" />
+ <XDSProgressBar isIndeterminate label="Positive" variant="success" />
<XDSProgressBar isIndeterminate label="Warning" variant="warning" />
- <XDSProgressBar isIndeterminate label="Negative" variant="negative" />
+ <XDSProgressBar isIndeterminate label="Negative" variant="error" />
<XDSProgressBar isIndeterminate label="Neutral" variant="neutral" />
</div>
),
diff --git a/apps/storybook/stories/StatusDot.stories.tsx b/apps/storybook/stories/StatusDot.stories.tsx
index 4977cf0cb1..32d3fd8b35 100644
--- a/apps/storybook/stories/StatusDot.stories.tsx
+++ b/apps/storybook/stories/StatusDot.stories.tsx
@@ -10,7 +10,7 @@ const meta: Meta<typeof XDSStatusDot> = {
argTypes: {
variant: {
control: 'select',
- options: ['positive', 'warning', 'negative', 'info', 'neutral'],
+ options: ['success', 'warning', 'error', 'accent', 'neutral'],
description: 'Semantic color variant',
},
size: {
@@ -32,7 +32,7 @@ type Story = StoryObj<typeof XDSStatusDot>;
export const Default: Story = {
args: {
- variant: 'positive',
+ variant: 'success',
label: 'Online',
},
};
@@ -40,10 +40,10 @@ export const Default: Story = {
export const Variants: Story = {
render: () => (
<div style={{display: 'flex', gap: '8px', alignItems: 'center'}}>
- <XDSStatusDot variant="positive" label="Positive" />
+ <XDSStatusDot variant="success" label="Positive" />
<XDSStatusDot variant="warning" label="Warning" />
- <XDSStatusDot variant="negative" label="Negative" />
- <XDSStatusDot variant="info" label="Info" />
+ <XDSStatusDot variant="error" label="Negative" />
+ <XDSStatusDot variant="accent" label="Info" />
<XDSStatusDot variant="neutral" label="Neutral" />
</div>
),
@@ -52,9 +52,9 @@ export const Variants: Story = {
export const Pulsing: Story = {
render: () => (
<div style={{display: 'flex', gap: '8px', alignItems: 'center'}}>
- <XDSStatusDot variant="positive" label="Live" isPulsing />
+ <XDSStatusDot variant="success" label="Live" isPulsing />
<XDSStatusDot variant="warning" label="Processing" isPulsing />
- <XDSStatusDot variant="negative" label="Error" isPulsing />
+ <XDSStatusDot variant="error" label="Error" isPulsing />
</div>
),
};
@@ -63,7 +63,7 @@ export const StatusIndicators: Story = {
render: () => (
<div style={{display: 'flex', flexDirection: 'column', gap: '8px'}}>
<div style={{display: 'flex', gap: '8px', alignItems: 'center'}}>
- <XDSStatusDot variant="positive" label="Online" />
+ <XDSStatusDot variant="success" label="Online" />
<span>Online</span>
</div>
<div style={{display: 'flex', gap: '8px', alignItems: 'center'}}>
@@ -71,7 +71,7 @@ export const StatusIndicators: Story = {
<span>Away</span>
</div>
<div style={{display: 'flex', gap: '8px', alignItems: 'center'}}>
- <XDSStatusDot variant="negative" label="Offline" />
+ <XDSStatusDot variant="error" label="Offline" />
<span>Offline</span>
</div>
<div style={{display: 'flex', gap: '8px', alignItems: 'center'}}>
diff --git a/apps/storybook/stories/ToggleButton.stories.tsx b/apps/storybook/stories/ToggleButton.stories.tsx
index 46ac739146..b06aadca9a 100644
--- a/apps/storybook/stories/ToggleButton.stories.tsx
+++ b/apps/storybook/stories/ToggleButton.stories.tsx
@@ -307,7 +307,7 @@ export const ColoredIconToolbar: Story = {
<XDSToggleButton
label="Link"
icon={<XDSIcon icon={LinkIcon} size="sm" color="secondary" />}
- pressedIcon={<XDSIcon icon={LinkIcon} size="sm" color="positive" />}
+ pressedIcon={<XDSIcon icon={LinkIcon} size="sm" color="success" />}
isPressed={pressed.link}
onPressedChange={() => toggle('link')}
isIconOnly
diff --git a/internal/vibe-tests/app/src/report/utils.ts b/internal/vibe-tests/app/src/report/utils.ts
index 57bc402ed4..57a7b972af 100644
--- a/internal/vibe-tests/app/src/report/utils.ts
+++ b/internal/vibe-tests/app/src/report/utils.ts
@@ -28,20 +28,20 @@ export const DIMENSION_LABELS: Record<UniversalDimension, string> = {
export function scoreToStatusVariant(
score: number,
-): 'positive' | 'neutral' | 'warning' | 'negative' {
- if (score >= 90) return 'positive';
+): 'success' | 'neutral' | 'warning' | 'error' {
+ if (score >= 90) return 'success';
if (score >= 70) return 'neutral';
if (score >= 50) return 'warning';
- return 'negative';
+ return 'error';
}
export function scoreToProgressVariant(
score: number,
-): 'positive' | 'accent' | 'warning' | 'negative' {
- if (score >= 90) return 'positive';
+): 'success' | 'accent' | 'warning' | 'error' {
+ if (score >= 90) return 'success';
if (score >= 70) return 'accent';
if (score >= 50) return 'warning';
- return 'negative';
+ return 'error';
}
/** Compute overall score. Null-safe for optional design dimension. */
diff --git a/packages/cli/src/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs b/packages/cli/src/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs
new file mode 100644
index 0000000000..325764ea6b
--- /dev/null
+++ b/packages/cli/src/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs
@@ -0,0 +1,164 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+import {describe, it, expect} from 'vitest';
+
+async function applyTransform(source) {
+ const {default: transform} = await import(
+ '../rename-status-variants.mjs'
+ );
+ const jscodeshift = (await import('jscodeshift')).default;
+ const j = jscodeshift.withParser('tsx');
+ const api = {jscodeshift: j, stats: () => {}, report: () => {}};
+ const file = {source, path: 'test.tsx'};
+ const result = transform(file, api);
+ return result ?? source;
+}
+
+describe('rename-status-variants', () => {
+ it('renames StatusDot variant="positive" to "success"', async () => {
+ const input = `<XDSStatusDot variant="positive" label="Online" />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ expect(output).not.toContain("'positive'");
+ });
+
+ it('renames StatusDot variant="negative" to "error"', async () => {
+ const input = `<XDSStatusDot variant="negative" label="Offline" />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'error'");
+ expect(output).not.toContain("'negative'");
+ });
+
+ it('renames StatusDot variant="info" to "accent"', async () => {
+ const input = `<XDSStatusDot variant="info" label="Info" />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'accent'");
+ expect(output).not.toContain("'info'");
+ });
+
+ it('renames AvatarStatusDot variant="positive" to "success"', async () => {
+ const input = `<XDSAvatarStatusDot variant="positive" label="Online" />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ expect(output).not.toContain("'positive'");
+ });
+
+ it('renames Icon color="positive" to "success"', async () => {
+ const input = `<XDSIcon color="positive" icon={CheckIcon} />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ expect(output).not.toContain("'positive'");
+ });
+
+ it('renames Icon color="negative" to "error"', async () => {
+ const input = `<XDSIcon color="negative" icon={XIcon} />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'error'");
+ expect(output).not.toContain("'negative'");
+ });
+
+ it('renames ProgressBar variant="positive" to "success"', async () => {
+ const input = `<XDSProgressBar variant="positive" value={50} />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ expect(output).not.toContain("'positive'");
+ });
+
+ it('renames ProgressBar variant="negative" to "error"', async () => {
+ const input = `<XDSProgressBar variant="negative" value={50} />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'error'");
+ expect(output).not.toContain("'negative'");
+ });
+
+ it('handles expression container: variant={"positive"}', async () => {
+ const input = `<XDSStatusDot variant={'positive'} label="Online" />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ expect(output).not.toContain("'positive'");
+ });
+
+ it('handles ternary: variant={x ? "positive" : "negative"}', async () => {
+ const input = `<XDSStatusDot variant={isOnline ? 'positive' : 'negative'} label="Status" />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ expect(output).toContain("'error'");
+ expect(output).not.toContain("'positive'");
+ expect(output).not.toContain("'negative'");
+ });
+
+ it('renames object property values in files importing target components', async () => {
+ const input = `import { XDSStatusDot } from '@xds/core/StatusDot';
+const args = { variant: 'positive' };`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ expect(output).not.toContain("'positive'");
+ });
+
+ it('renames Storybook argType options arrays', async () => {
+ const input = `import { XDSStatusDot } from '@xds/core/StatusDot';
+const meta = { argTypes: { variant: { options: ['positive', 'negative', 'warning', 'info', 'neutral'] } } };`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ expect(output).toContain("'error'");
+ expect(output).toContain("'accent'");
+ expect(output).not.toContain("'positive'");
+ expect(output).not.toContain("'negative'");
+ expect(output).not.toContain("'info'");
+ // warning and neutral are unchanged
+ expect(output).toContain("'warning'");
+ expect(output).toContain("'neutral'");
+ });
+
+ it('does not touch unrelated components', async () => {
+ const input = `<XDSBadge variant="info" label="New" />`;
+ const output = await applyTransform(input);
+ // XDSBadge is not in the target list
+ expect(output).toContain('info');
+ });
+
+ it('does not touch unrelated props on target components', async () => {
+ const input = `<XDSStatusDot variant="positive" label="positive result" />`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ // The label "positive result" should NOT be renamed
+ expect(output).toContain('positive result');
+ });
+
+ it('returns undefined when no changes needed', async () => {
+ const {default: transform} = await import(
+ '../rename-status-variants.mjs'
+ );
+ const jscodeshift = (await import('jscodeshift')).default;
+ const j = jscodeshift.withParser('tsx');
+ const api = {jscodeshift: j, stats: () => {}, report: () => {}};
+ const source = `<XDSStatusDot variant='success' label='Online' />`;
+ const result = transform({source, path: 'test.tsx'}, api);
+ expect(result).toBeUndefined();
+ });
+
+ it('handles a full component file', async () => {
+ const input = `import { XDSStatusDot } from '@xds/core/StatusDot';
+import { XDSIcon } from '@xds/core/Icon';
+
+function StatusIndicator({ isOnline }: { isOnline: boolean }) {
+ return (
+ <div>
+ <XDSStatusDot
+ variant={isOnline ? 'positive' : 'negative'}
+ label={isOnline ? 'Online' : 'Offline'}
+ />
+ <XDSIcon
+ icon={isOnline ? CheckIcon : XIcon}
+ color={isOnline ? 'positive' : 'negative'}
+ />
+ </div>
+ );
+}`;
+ const output = await applyTransform(input);
+ expect(output).toContain("'success'");
+ expect(output).toContain("'error'");
+ expect(output).not.toContain("'positive'");
+ expect(output).not.toContain("'negative'");
+ });
+});
diff --git a/packages/cli/src/codemods/transforms/v0.0.14/index.mjs b/packages/cli/src/codemods/transforms/v0.0.14/index.mjs
index c325f62a30..7077c9a5e3 100644
--- a/packages/cli/src/codemods/transforms/v0.0.14/index.mjs
+++ b/packages/cli/src/codemods/transforms/v0.0.14/index.mjs
@@ -14,6 +14,10 @@ import renameSectionWashToMuted, {
meta as renameSectionWashToMutedMeta,
} from './rename-section-wash-to-muted.mjs';
+import renameStatusVariants, {
+ meta as renameStatusVariantsMeta,
+} from './rename-status-variants.mjs';
+
export default [
{
name: 'rename-action-props',
@@ -25,4 +29,9 @@ export default [
transform: renameSectionWashToMuted,
meta: renameSectionWashToMutedMeta,
},
+ {
+ name: 'rename-status-variants',
+ transform: renameStatusVariants,
+ meta: renameStatusVariantsMeta,
+ },
];
diff --git a/packages/cli/src/codemods/transforms/v0.0.14/rename-status-variants.mjs b/packages/cli/src/codemods/transforms/v0.0.14/rename-status-variants.mjs
new file mode 100644
index 0000000000..21e0137374
--- /dev/null
+++ b/packages/cli/src/codemods/transforms/v0.0.14/rename-status-variants.mjs
@@ -0,0 +1,216 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+/**
+ * @file Codemod: Rename status variants positive/negative → success/error
+ * @see https://github.com/facebookexperimental/xds/issues/996
+ *
+ * Converges component APIs to match the token layer naming:
+ * - `positive` → `success` (maps to --color-success)
+ * - `negative` → `error` (maps to --color-error)
+ * - `info` → `accent` (maps to --color-accent)
+ *
+ * Affected components:
+ * - XDSStatusDot: variant="positive|negative|info" → variant="success|error|accent"
+ * - XDSAvatarStatusDot: variant="positive|negative" → variant="success|error"
+ * - XDSIcon: color="positive|negative" → color="success|error"
+ * - XDSProgressBar: variant="positive|negative" → variant="success|error"
+ *
+ * Transforms JSX attributes, object properties (in files importing affected
+ * components), TypeScript type annotations, and Storybook argType options.
+ */
+
+export const meta = {
+ title: 'Rename status variants positive/negative → success/error',
+ description:
+ 'Renames `positive` to `success`, `negative` to `error`, and `info` to `accent` ' +
+ 'on StatusDot, AvatarStatusDot, Icon, SVGIcon, and ProgressBar to align with token naming.',
+ pr: '#996',
+};
+
+/** Rename mappings. */
+const RENAMES = new Map([
+ ['positive', 'success'],
+ ['negative', 'error'],
+ ['info', 'accent'],
+]);
+
+/**
+ * Components and which props are affected.
+ * Key: component name. Value: set of prop names to check.
+ */
+const COMPONENT_PROPS = new Map([
+ ['XDSStatusDot', new Set(['variant'])],
+ ['XDSAvatarStatusDot', new Set(['variant'])],
+ ['XDSIcon', new Set(['color'])],
+ ['XDSProgressBar', new Set(['variant'])],
+]);
+
+/** All affected component names for quick lookup. */
+const TARGET_COMPONENTS = new Set(COMPONENT_PROPS.keys());
+
+/** All affected prop names (variant, color). */
+const TARGET_PROP_NAMES = new Set();
+for (const props of COMPONENT_PROPS.values()) {
+ for (const p of props) TARGET_PROP_NAMES.add(p);
+}
+
+/**
+ * Check if a key matches a target prop — exact or case-insensitive suffix.
+ * e.g. "dotVariant" matches because it ends with "variant".
+ */
+function matchesPropName(keyName) {
+ if (TARGET_PROP_NAMES.has(keyName)) return true;
+ const lower = keyName.toLowerCase();
+ for (const prop of TARGET_PROP_NAMES) {
+ if (lower.endsWith(prop.toLowerCase()) && lower !== prop.toLowerCase()) return true;
+ }
+ return false;
+}
+
+export default function transformer(file, api) {
+ const j = api.jscodeshift;
+ const root = j(file.source);
+ let hasChanges = false;
+
+ /**
+ * Rename a string literal value if it matches our renames.
+ * Unwraps TSAsExpression (e.g. 'positive' as const) to reach the literal.
+ * @returns {boolean} whether a rename occurred
+ */
+ function renameValue(node) {
+ if (!node) return false;
+
+ // Unwrap TSAsExpression (e.g. 'positive' as const → StringLiteral)
+ const target = node.type === 'TSAsExpression' ? node.expression : node;
+
+ const isString =
+ target.type === 'StringLiteral' || target.type === 'Literal';
+ if (!isString || typeof target.value !== 'string') return false;
+
+ const replacement = RENAMES.get(target.value);
+ if (!replacement) return false;
+
+ target.value = replacement;
+ if (target.raw) target.raw = undefined;
+ return true;
+ }
+
+ /**
+ * Rename elements in an array (handles TSAsExpression wrapping).
+ */
+ function renameArrayElements(node) {
+ let arrayNode = node;
+ if (arrayNode.type === 'TSAsExpression') arrayNode = arrayNode.expression;
+ if (arrayNode.type !== 'ArrayExpression') return;
+ arrayNode.elements.forEach((el) => {
+ if (renameValue(el)) hasChanges = true;
+ });
+ }
+
+ // Determine early: does this file import any target component?
+ const importsTarget = [...TARGET_COMPONENTS].some(
+ (name) =>
+ root.find(j.ImportSpecifier, {imported: {name}}).length > 0,
+ );
+
+ // 1. JSX attributes on target components
+ root.find(j.JSXOpeningElement).forEach((path) => {
+ const name = path.node.name;
+ const componentName = name.type === 'JSXIdentifier' ? name.name : null;
+ if (!componentName) return;
+
+ const isDirectTarget = TARGET_COMPONENTS.has(componentName);
+ // For non-target components, only check suffixed props if file imports targets
+ if (!isDirectTarget && !importsTarget) return;
+
+ path.node.attributes.forEach((attr) => {
+ if (attr.type !== 'JSXAttribute') return;
+ const attrName = attr.name.name;
+
+ if (isDirectTarget) {
+ // Direct targets: only their specific props
+ const targetProps = COMPONENT_PROPS.get(componentName);
+ if (!targetProps.has(attrName)) return;
+ } else {
+ // Non-target components: suffixed prop names only
+ // (e.g. dotVariant on ChangelogSection wrapping XDSStatusDot)
+ if (!matchesPropName(attrName) || TARGET_PROP_NAMES.has(attrName)) return;
+ }
+
+ const value = attr.value;
+
+ // variant="positive" (string literal)
+ if (renameValue(value)) {
+ hasChanges = true;
+ return;
+ }
+
+ // variant={'positive'} (expression container)
+ if (
+ value &&
+ value.type === 'JSXExpressionContainer' &&
+ value.expression
+ ) {
+ if (renameValue(value.expression)) {
+ hasChanges = true;
+ return;
+ }
+
+ // variant={condition ? 'positive' : 'negative'} (ternary)
+ if (value.expression.type === 'ConditionalExpression') {
+ if (renameValue(value.expression.consequent)) hasChanges = true;
+ if (renameValue(value.expression.alternate)) hasChanges = true;
+ }
+ }
+ });
+ });
+
+ // 2. Object properties in files importing target components.
+ // Handles args objects, config objects, Storybook argTypes, etc.
+ if (importsTarget) {
+ const PropertyType = j.ObjectProperty ?? j.Property;
+ root.find(PropertyType).forEach((path) => {
+ const key = path.node.key;
+ const keyName =
+ key.type === 'Identifier'
+ ? key.name
+ : key.type === 'StringLiteral' || key.type === 'Literal'
+ ? key.value
+ : null;
+
+ if (!keyName || !matchesPropName(keyName)) return;
+
+ const value = path.node.value;
+
+ // variant: 'positive' → variant: 'success'
+ if (renameValue(value)) {
+ hasChanges = true;
+ return;
+ }
+
+ // variant: { options: ['positive', 'negative', ...] }
+ if (value.type === 'ObjectExpression') {
+ const optionsProp = value.properties.find(
+ (p) => p.key && (p.key.name === 'options' || p.key.value === 'options'),
+ );
+ if (optionsProp) {
+ renameArrayElements(optionsProp.value);
+ }
+ }
+
+ // variant: ['positive', 'negative'] or [...] as Type[]
+ renameArrayElements(value);
+ });
+ }
+
+ // 3. TypeScript type references: 'positive' | 'negative' in union types
+ if (importsTarget) {
+ root.find(j.TSLiteralType).forEach((path) => {
+ const lit = path.node.literal;
+ if (renameValue(lit)) hasChanges = true;
+ });
+ }
+
+ if (!hasChanges) return undefined;
+ return root.toSource({quote: 'single'});
+}
diff --git a/packages/cli/templates/blocks/components/Avatar/AvatarShowcase.tsx b/packages/cli/templates/blocks/components/Avatar/AvatarShowcase.tsx
index 3280a9a37c..c48e0cc186 100644
--- a/packages/cli/templates/blocks/components/Avatar/AvatarShowcase.tsx
+++ b/packages/cli/templates/blocks/components/Avatar/AvatarShowcase.tsx
@@ -12,7 +12,7 @@ export default function AvatarShowcase() {
name="Ann Smith"
size="large"
src="https://lookaside.facebook.com/assets/vs_datakit_profile_photos_t66173184/VS-Design-Tools-Datakit-30.jpg"
- status={<XDSAvatarStatusDot variant="positive" label="Online" />}
+ status={<XDSAvatarStatusDot variant="success" label="Online" />}
/>
<XDSAvatar
name="Alex Daniels"
@@ -23,7 +23,7 @@ export default function AvatarShowcase() {
<XDSAvatar
name="Taylor Nguyen"
size="large"
- status={<XDSAvatarStatusDot variant="negative" label="Online" />}
+ status={<XDSAvatarStatusDot variant="error" label="Online" />}
/>
</XDSStack>
);
diff --git a/packages/cli/templates/blocks/components/Avatar/AvatarUserCard.tsx b/packages/cli/templates/blocks/components/Avatar/AvatarUserCard.tsx
index 24a980d94d..5eead89854 100644
--- a/packages/cli/templates/blocks/components/Avatar/AvatarUserCard.tsx
+++ b/packages/cli/templates/blocks/components/Avatar/AvatarUserCard.tsx
@@ -10,7 +10,7 @@ const USERS = [
{
name: 'Alex Daniels',
role: 'Engineering Lead',
- variant: 'positive' as const,
+ variant: 'success' as const,
src: 'https://lookaside.facebook.com/assets/vs_datakit_profile_photos_t66173184/VS-Design-Tools-Datakit-05.jpg',
},
{
@@ -22,7 +22,7 @@ const USERS = [
{
name: 'Carol Davis',
role: 'Engineering Manager',
- variant: 'negative' as const,
+ variant: 'error' as const,
src: 'https://lookaside.facebook.com/assets/vs_datakit_profile_photos_t66173184/VS-Design-Tools-Datakit-60.jpg',
},
];
diff --git a/packages/cli/templates/blocks/components/Avatar/AvatarWithStatus.tsx b/packages/cli/templates/blocks/components/Avatar/AvatarWithStatus.tsx
index 1759ef6340..817df19908 100644
--- a/packages/cli/templates/blocks/components/Avatar/AvatarWithStatus.tsx
+++ b/packages/cli/templates/blocks/components/Avatar/AvatarWithStatus.tsx
@@ -12,7 +12,7 @@ export default function AvatarWithStatus() {
src="https://lookaside.facebook.com/assets/vs_datakit_profile_photos_t66173184/VS-Design-Tools-Datakit-05.jpg"
name="Alex Daniels"
size="large"
- status={<XDSAvatarStatusDot variant="positive" label="Online" />}
+ status={<XDSAvatarStatusDot variant="success" label="Online" />}
/>
<XDSAvatar
src="https://lookaside.facebook.com/assets/vs_datakit_profile_photos_t66173184/VS-Design-Tools-Datakit-30.jpg"
@@ -24,7 +24,7 @@ export default function AvatarWithStatus() {
src="https://lookaside.facebook.com/assets/vs_datakit_profile_photos_t66173184/VS-Design-Tools-Datakit-60.jpg"
name="Carol Davis"
size="large"
- status={<XDSAvatarStatusDot variant="negative" label="Busy" />}
+ status={<XDSAvatarStatusDot variant="error" label="Busy" />}
/>
</XDSStack>
);
diff --git a/packages/cli/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx b/packages/cli/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx
index 3c9f08a387..c708c2b75c 100644
--- a/packages/cli/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx
+++ b/packages/cli/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx
@@ -11,7 +11,7 @@ export default function AvatarStatusDotShowcase() {
<XDSAvatar
name="Online User"
size="large"
- status={<XDSAvatarStatusDot variant="positive" label="Online" />}
+ status={<XDSAvatarStatusDot variant="success" label="Online" />}
/>
<XDSAvatar
name="Away User"
@@ -21,7 +21,7 @@ export default function AvatarStatusDotShowcase() {
<XDSAvatar
name="Busy User"
size="large"
- status={<XDSAvatarStatusDot variant="negative" label="Busy" />}
+ status={<XDSAvatarStatusDot variant="error" label="Busy" />}
/>
</XDSHStack>
);
diff --git a/packages/cli/templates/blocks/components/Icon/IconSemanticColors.tsx b/packages/cli/templates/blocks/components/Icon/IconSemanticColors.tsx
index d624090271..70b4d729a8 100644
--- a/packages/cli/templates/blocks/components/Icon/IconSemanticColors.tsx
+++ b/packages/cli/templates/blocks/components/Icon/IconSemanticColors.tsx
@@ -30,12 +30,12 @@ export default function IconSemanticColors() {
<XDSText type="supporting">accent</XDSText>
</XDSVStack>
<XDSVStack gap={1} hAlign="center">
- <XDSIcon icon="success" color="positive" />
- <XDSText type="supporting">positive</XDSText>
+ <XDSIcon icon="success" color="success" />
+ <XDSText type="supporting">success</XDSText>
</XDSVStack>
<XDSVStack gap={1} hAlign="center">
- <XDSIcon icon="error" color="negative" />
- <XDSText type="supporting">negative</XDSText>
+ <XDSIcon icon="error" color="error" />
+ <XDSText type="supporting">error</XDSText>
</XDSVStack>
<XDSVStack gap={1} hAlign="center">
<XDSIcon icon="warning" color="warning" />
diff --git a/packages/cli/templates/blocks/components/Icon/IconStatusIcons.tsx b/packages/cli/templates/blocks/components/Icon/IconStatusIcons.tsx
index 03064b2762..05f587bb06 100644
--- a/packages/cli/templates/blocks/components/Icon/IconStatusIcons.tsx
+++ b/packages/cli/templates/blocks/components/Icon/IconStatusIcons.tsx
@@ -7,9 +7,9 @@ import {XDSVStack, XDSHStack} from '@xds/core/Layout';
import {XDSText} from '@xds/core/Text';
const statuses = [
- {icon: 'success' as const, color: 'positive' as const, label: 'Deployed successfully'},
+ {icon: 'success' as const, color: 'success' as const, label: 'Deployed successfully'},
{icon: 'warning' as const, color: 'warning' as const, label: 'Build has warnings'},
- {icon: 'error' as const, color: 'negative' as const, label: 'Pipeline failed'},
+ {icon: 'error' as const, color: 'error' as const, label: 'Pipeline failed'},
{icon: 'info' as const, color: 'accent' as const, label: 'New version available'},
] as const;
diff --git a/packages/cli/templates/blocks/components/ProgressBar/ProgressBarSemanticVariants.tsx b/packages/cli/templates/blocks/components/ProgressBar/ProgressBarSemanticVariants.tsx
index f85ac5fc5f..1934ba9c25 100644
--- a/packages/cli/templates/blocks/components/ProgressBar/ProgressBarSemanticVariants.tsx
+++ b/packages/cli/templates/blocks/components/ProgressBar/ProgressBarSemanticVariants.tsx
@@ -17,7 +17,7 @@ export default function ProgressBarSemanticVariants() {
<XDSProgressBar
value={80}
label="Positive"
- variant="positive"
+ variant="success"
hasValueLabel
/>
<XDSProgressBar
@@ -29,7 +29,7 @@ export default function ProgressBarSemanticVariants() {
<XDSProgressBar
value={92}
label="Negative"
- variant="negative"
+ variant="error"
hasValueLabel
/>
<XDSProgressBar
diff --git a/packages/cli/templates/blocks/components/StatusDot/StatusDotPulsing.tsx b/packages/cli/templates/blocks/components/StatusDot/StatusDotPulsing.tsx
index 4219d4447b..db2fb75f66 100644
--- a/packages/cli/templates/blocks/components/StatusDot/StatusDotPulsing.tsx
+++ b/packages/cli/templates/blocks/components/StatusDot/StatusDotPulsing.tsx
@@ -8,10 +8,10 @@ import {XDSHStack} from '@xds/core/Layout';
export default function StatusDotPulsing() {
return (
<XDSHStack gap={2} vAlign="center">
- <XDSStatusDot variant="positive" label="Live" isPulsing />
+ <XDSStatusDot variant="success" label="Live" isPulsing />
<XDSStatusDot variant="warning" label="Processing" isPulsing />
- <XDSStatusDot variant="negative" label="Error" isPulsing />
- <XDSStatusDot variant="info" label="Processing" isPulsing />
+ <XDSStatusDot variant="error" label="Error" isPulsing />
+ <XDSStatusDot variant="accent" label="Processing" isPulsing />
<XDSStatusDot variant="neutral" label="Error" isPulsing />
</XDSHStack>
);
diff --git a/packages/cli/templates/blocks/components/StatusDot/StatusDotShowcase.tsx b/packages/cli/templates/blocks/components/StatusDot/StatusDotShowcase.tsx
index 86976946a8..e066824e78 100644
--- a/packages/cli/templates/blocks/components/StatusDot/StatusDotShowcase.tsx
+++ b/packages/cli/templates/blocks/components/StatusDot/StatusDotShowcase.tsx
@@ -8,10 +8,10 @@ import {XDSHStack} from '@xds/core/Layout';
export default function StatusDotShowcase() {
return (
<XDSHStack gap={2} vAlign="center">
- <XDSStatusDot variant="positive" label="Positive" />
+ <XDSStatusDot variant="success" label="Positive" />
<XDSStatusDot variant="warning" label="Warning" />
- <XDSStatusDot variant="negative" label="Negative" />
- <XDSStatusDot variant="info" label="Info" />
+ <XDSStatusDot variant="error" label="Negative" />
+ <XDSStatusDot variant="accent" label="Info" />
<XDSStatusDot variant="neutral" label="Neutral" />
</XDSHStack>
);
diff --git a/packages/cli/templates/blocks/components/StatusDot/StatusDotStatusIndicators.tsx b/packages/cli/templates/blocks/components/StatusDot/StatusDotStatusIndicators.tsx
index 4d189f784f..c13a9cab21 100644
--- a/packages/cli/templates/blocks/components/StatusDot/StatusDotStatusIndicators.tsx
+++ b/packages/cli/templates/blocks/components/StatusDot/StatusDotStatusIndicators.tsx
@@ -7,9 +7,9 @@ import {XDSVStack, XDSHStack} from '@xds/core/Layout';
import {XDSText} from '@xds/core/Text';
const statuses = [
- {variant: 'positive', label: 'Online'},
+ {variant: 'success', label: 'Online'},
{variant: 'warning', label: 'Away'},
- {variant: 'negative', label: 'Offline'},
+ {variant: 'error', label: 'Offline'},
{variant: 'neutral', label: 'Unknown'},
] as const;
diff --git a/packages/cli/templates/blocks/components/StatusDot/StatusDotVariants.tsx b/packages/cli/templates/blocks/components/StatusDot/StatusDotVariants.tsx
index f00d30e82c..95d2e3f19c 100644
--- a/packages/cli/templates/blocks/components/StatusDot/StatusDotVariants.tsx
+++ b/packages/cli/templates/blocks/components/StatusDot/StatusDotVariants.tsx
@@ -8,10 +8,10 @@ import {XDSHStack} from '@xds/core/Layout';
export default function StatusDotVariants() {
return (
<XDSHStack gap={2} vAlign="center">
- <XDSStatusDot variant="positive" label="Positive" />
+ <XDSStatusDot variant="success" label="Positive" />
<XDSStatusDot variant="warning" label="Warning" />
- <XDSStatusDot variant="negative" label="Negative" />
- <XDSStatusDot variant="info" label="Info" />
+ <XDSStatusDot variant="error" label="Negative" />
+ <XDSStatusDot variant="accent" label="Info" />
<XDSStatusDot variant="neutral" label="Neutral" />
</XDSHStack>
);
diff --git a/packages/cli/templates/blocks/components/TabList/TabListTabsWithStatusDot.tsx b/packages/cli/templates/blocks/components/TabList/TabListTabsWithStatusDot.tsx
index 54db19e519..953dd518e2 100644
--- a/packages/cli/templates/blocks/components/TabList/TabListTabsWithStatusDot.tsx
+++ b/packages/cli/templates/blocks/components/TabList/TabListTabsWithStatusDot.tsx
@@ -13,7 +13,7 @@ export default function TabListTabsWithStatusDot() {
<XDSTab
value="production"
label="Production"
- endContent={<XDSStatusDot variant="positive" label="Healthy" />}
+ endContent={<XDSStatusDot variant="success" label="Healthy" />}
/>
<XDSTab
value="staging"
diff --git a/packages/cli/templates/pages/dashboard-portfolio/page.tsx b/packages/cli/templates/pages/dashboard-portfolio/page.tsx
index 898c66e57c..05167f00d0 100644
--- a/packages/cli/templates/pages/dashboard-portfolio/page.tsx
+++ b/packages/cli/templates/pages/dashboard-portfolio/page.tsx
@@ -496,7 +496,7 @@ function MarketCard({
<XDSIcon
icon={positive ? ArrowUpIcon : ArrowDownIcon}
size="xsm"
- color={positive ? 'positive' : 'negative'}
+ color={positive ? 'success' : 'error'}
/>
<XDSText type="body" color="secondary">
{change}
@@ -615,7 +615,7 @@ function MetricCard({
<XDSIcon
icon={positive ? ArrowUpIcon : ArrowDownIcon}
size="xsm"
- color={positive ? 'positive' : 'negative'}
+ color={positive ? 'success' : 'error'}
/>
<XDSText type="body" color="secondary">
{change}
diff --git a/packages/cli/templates/pages/dashboard/page.tsx b/packages/cli/templates/pages/dashboard/page.tsx
index 5b49664ca1..234931cd98 100644
--- a/packages/cli/templates/pages/dashboard/page.tsx
+++ b/packages/cli/templates/pages/dashboard/page.tsx
@@ -391,9 +391,7 @@ const topPagesColumns: XDSTableColumn<PageRow>[] = [
label={`${item.page} views`}
isLabelHidden
/>
- <XDSText type="supporting">
- {item.views.toLocaleString()} views
- </XDSText>
+ <XDSText type="supporting">{item.views.toLocaleString()} views</XDSText>
</XDSVStack>
),
},
@@ -623,9 +621,9 @@ function MetricCard({
<XDSHeading level={2}>{value}</XDSHeading>
<XDSHStack gap={1} vAlign="center">
{positive ? (
- <XDSIcon icon={ArrowUpIcon} size="xsm" color="positive" />
+ <XDSIcon icon={ArrowUpIcon} size="xsm" color="success" />
) : (
- <XDSIcon icon={ArrowDownIcon} size="xsm" color="negative" />
+ <XDSIcon icon={ArrowDownIcon} size="xsm" color="error" />
)}
<XDSText type="body" color="secondary">
{change}
@@ -721,9 +719,7 @@ function TableCard<T extends {id: string}>({
<XDSVStack gap={6}>
<XDSHStack hAlign="between" vAlign="center">
<XDSHeading level={4}>{title}</XDSHeading>
- <XDSLink href={linkHref}>
- {linkLabel}
- </XDSLink>
+ <XDSLink href={linkHref}>{linkLabel}</XDSLink>
</XDSHStack>
<XDSTable<T>
data={data}
@@ -747,9 +743,7 @@ function DashboardSideNav() {
header={
<XDSSideNavHeading
icon={
- <XDSNavIcon
- icon={<XDSIcon icon={ChartBarIconSolid} size="sm" />}
- />
+ <XDSNavIcon icon={<XDSIcon icon={ChartBarIconSolid} size="sm" />} />
}
heading="Analytics"
headingHref="/"
@@ -819,7 +813,7 @@ export default function DashboardTemplate() {
{/* Metric Cards */}
<XDSGrid columns={{minWidth: 320, repeat: 'fit'}} gap={4}>
- {[0, 2].map((start) => (
+ {[0, 2].map(start => (
<XDSGrid
key={start}
columns={{minWidth: 240, repeat: 'fit'}}
diff --git a/packages/cli/templates/pages/detail-page/page.tsx b/packages/cli/templates/pages/detail-page/page.tsx
index 507cb6fbfb..ca032d1b30 100644
--- a/packages/cli/templates/pages/detail-page/page.tsx
+++ b/packages/cli/templates/pages/detail-page/page.tsx
@@ -282,12 +282,17 @@ function PageHeader({
</XDSHStack>
</XDSLink>
<XDSVStack gap={0}>
- <XDSHeading level={1} maxLines={1}>#1001</XDSHeading>
+ <XDSHeading level={1} maxLines={1}>
+ #1001
+ </XDSHeading>
<XDSOverflowList
gap={1}
minVisibleItems={2}
overflowRenderer={overflowItems => (
- <XDSBadge variant="neutral" label={`+${overflowItems.length} more`} />
+ <XDSBadge
+ variant="neutral"
+ label={`+${overflowItems.length} more`}
+ />
)}>
<XDSHStack gap={1} vAlign="center">
<XDSText type="body" maxLines={1}>
@@ -623,7 +628,7 @@ function RightPanel() {
<XDSProgressBar
label="Risk level"
value={15}
- variant="positive"
+ variant="success"
isLabelHidden
/>
<XDSText type="body">Recommendation: Fulfill order</XDSText>
diff --git a/packages/cli/templates/pages/table-grouped/page.tsx b/packages/cli/templates/pages/table-grouped/page.tsx
index 97ae0a1394..04337acf0d 100644
--- a/packages/cli/templates/pages/table-grouped/page.tsx
+++ b/packages/cli/templates/pages/table-grouped/page.tsx
@@ -121,12 +121,12 @@ interface TaskRow extends Record<string, unknown> {
const STATUS_DOT_VARIANT: Record<
TaskStatus,
- 'positive' | 'info' | 'neutral' | 'warning'
+ 'success' | 'accent' | 'neutral' | 'warning'
> = {
- in_progress: 'info',
+ in_progress: 'accent',
todo: 'warning',
backlog: 'neutral',
- done: 'positive',
+ done: 'success',
};
const PRIORITY_COLOR: Record<
diff --git a/packages/core/src/Avatar/Avatar.doc.mjs b/packages/core/src/Avatar/Avatar.doc.mjs
index b5c7940d44..b44b8ccbf2 100644
--- a/packages/core/src/Avatar/Avatar.doc.mjs
+++ b/packages/core/src/Avatar/Avatar.doc.mjs
@@ -75,9 +75,9 @@ export const docs = {
props: [
{
name: 'variant',
- type: "'positive' | 'neutral' | 'negative'",
+ type: "'success' | 'neutral' | 'error'",
description: 'Semantic color variant of the dot.',
- default: "'positive'",
+ default: "'success'",
},
{
name: 'label',
@@ -142,7 +142,7 @@ export const docsZh = {
name: 'XDSAvatarStatusDot',
description: '尺寸感知的状态指示点,从上下文中读取头像尺寸并等比缩放。',
props: [
- {name: 'variant', type: "'positive' | 'neutral' | 'negative'", description: '状态点的语义颜色变体。', default: "'positive'"},
+ {name: 'variant', type: "'success' | 'neutral' | 'error'", description: '状态点的语义颜色变体。', default: "'success'"},
{name: 'label', type: 'string', description: '屏幕阅读器的无障碍标签。'},
{name: 'icon', type: 'ReactNode', description: '居中显示在状态点内的图标(tiny 尺寸时隐藏)。'},
],
diff --git a/packages/core/src/Avatar/XDSAvatarStatusDot.tsx b/packages/core/src/Avatar/XDSAvatarStatusDot.tsx
index 6b9f2661e0..6d0affb514 100644
--- a/packages/core/src/Avatar/XDSAvatarStatusDot.tsx
+++ b/packages/core/src/Avatar/XDSAvatarStatusDot.tsx
@@ -66,9 +66,9 @@ function resolveStatusDotSize(avatarSize: number): {
* ```
*/
export interface XDSAvatarStatusDotVariantMap {
- positive: true;
+ success: true;
neutral: true;
- negative: true;
+ error: true;
}
/**
@@ -79,12 +79,12 @@ export type XDSAvatarStatusDotVariant = keyof XDSAvatarStatusDotVariantMap;
export interface XDSAvatarStatusDotProps extends XDSBaseProps<HTMLSpanElement> {
/**
* The semantic color variant of the dot.
- * - `positive` — green dot (e.g. online, accepted)
+ * - `success` — green dot (e.g. online, accepted)
* - `neutral` — gray dot (e.g. offline, pending)
- * - `negative` — red dot (e.g. busy, rejected)
+ * - `error` — red dot (e.g. busy, rejected)
*
* Matches the `variant` convention from `XDSStatusDot`.
- * @default 'positive'
+ * @default 'success'
*/
variant?: XDSAvatarStatusDotVariant;
/**
@@ -101,7 +101,7 @@ export interface XDSAvatarStatusDotProps extends XDSBaseProps<HTMLSpanElement> {
*
* @example
* ```
- * <XDSAvatarStatusDot variant="positive" label="Verified" icon={<CheckIcon />} />
+ * <XDSAvatarStatusDot variant="success" label="Verified" icon={<CheckIcon />} />
* ```
*/
icon?: ReactNode;
@@ -117,13 +117,13 @@ const styles = stylex.create({
alignItems: 'center',
justifyContent: 'center',
},
- positive: {
+ success: {
backgroundColor: colorVars['--color-success'],
},
neutral: {
backgroundColor: colorVars['--color-text-secondary'],
},
- negative: {
+ error: {
backgroundColor: colorVars['--color-error'],
},
icon: {
@@ -150,9 +150,9 @@ const dynamicStyles = stylex.create({
const variantStyleMap: Partial<
Record<XDSAvatarStatusDotVariant, stylex.StyleXStyles>
> = {
- positive: styles.positive,
+ success: styles.success,
neutral: styles.neutral,
- negative: styles.negative,
+ error: styles.error,
};
/**
@@ -167,17 +167,17 @@ const variantStyleMap: Partial<
* <XDSAvatar
* name="John Doe"
* size="medium"
- * status={<XDSAvatarStatusDot variant="positive" label="Online" />}
+ * status={<XDSAvatarStatusDot variant="success" label="Online" />}
* />
* <XDSAvatar
* name="Jane Smith"
* size="large"
- * status={<XDSAvatarStatusDot variant="positive" label="Verified" icon={<CheckIcon />} />}
+ * status={<XDSAvatarStatusDot variant="success" label="Verified" icon={<CheckIcon />} />}
* />
* ```
*/
export function XDSAvatarStatusDot({
- variant = 'positive',
+ variant = 'success',
label,
icon,
xstyle,
diff --git a/packages/core/src/Banner/XDSBanner.tsx b/packages/core/src/Banner/XDSBanner.tsx
index 12c120ba0a..56d9b09aa5 100644
--- a/packages/core/src/Banner/XDSBanner.tsx
+++ b/packages/core/src/Banner/XDSBanner.tsx
@@ -186,8 +186,8 @@ const statusRole: Record<XDSBannerStatus, 'alert' | 'status'> = {
const statusIconColor = {
info: 'accent',
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
} as const;
// =============================================================================
diff --git a/packages/core/src/Chat/XDSChatComposer.tsx b/packages/core/src/Chat/XDSChatComposer.tsx
index 9fb3cce23a..6b95b00929 100644
--- a/packages/core/src/Chat/XDSChatComposer.tsx
+++ b/packages/core/src/Chat/XDSChatComposer.tsx
@@ -343,7 +343,7 @@ export function XDSChatComposer(props: XDSChatComposerProps) {
<XDSIcon
icon={status.type === 'error' ? 'error' : 'warning'}
size="md"
- color={status.type === 'error' ? 'negative' : 'warning'}
+ color={status.type === 'error' ? 'error' : 'warning'}
/>
{status.message}
</div>
diff --git a/packages/core/src/DateInput/XDSDateInput.tsx b/packages/core/src/DateInput/XDSDateInput.tsx
index c106041a7f..333e75ef82 100644
--- a/packages/core/src/DateInput/XDSDateInput.tsx
+++ b/packages/core/src/DateInput/XDSDateInput.tsx
@@ -306,11 +306,11 @@ export function XDSDateInput({
const statusIconColorMap: Record<
XDSInputStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
// Constraint checking for text input validation (reuses calendar logic)
diff --git a/packages/core/src/DateRangePicker/XDSDateRangePicker.tsx b/packages/core/src/DateRangePicker/XDSDateRangePicker.tsx
index 96c0a8ebd4..987a84b438 100644
--- a/packages/core/src/DateRangePicker/XDSDateRangePicker.tsx
+++ b/packages/core/src/DateRangePicker/XDSDateRangePicker.tsx
@@ -382,11 +382,11 @@ export function XDSDateRangePicker({
const statusIconColorMap: Record<
XDSInputStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
const ariaDescribedBy =
diff --git a/packages/core/src/DateTimePicker/XDSDateTimePicker.tsx b/packages/core/src/DateTimePicker/XDSDateTimePicker.tsx
index bbc02d732c..44d50f4df5 100644
--- a/packages/core/src/DateTimePicker/XDSDateTimePicker.tsx
+++ b/packages/core/src/DateTimePicker/XDSDateTimePicker.tsx
@@ -398,11 +398,11 @@ export function XDSDateTimePicker({
const statusIconColorMap: Record<
XDSInputStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
const ariaDescribedBy =
diff --git a/packages/core/src/FileInput/XDSFileInput.tsx b/packages/core/src/FileInput/XDSFileInput.tsx
index 83da0d1f39..a3a4d88052 100644
--- a/packages/core/src/FileInput/XDSFileInput.tsx
+++ b/packages/core/src/FileInput/XDSFileInput.tsx
@@ -424,11 +424,11 @@ export function XDSFileInput({
const statusIconColorMap: Record<
XDSInputStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
const ariaDescribedBy =
diff --git a/packages/core/src/Icon/Icon.doc.mjs b/packages/core/src/Icon/Icon.doc.mjs
index 8a52fa9233..82278647b9 100644
--- a/packages/core/src/Icon/Icon.doc.mjs
+++ b/packages/core/src/Icon/Icon.doc.mjs
@@ -14,7 +14,7 @@ export const docs = {
},
{
name: 'color',
- type: "'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'positive' | 'negative' | 'warning' | 'inherit'",
+ type: "'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'success' | 'error' | 'warning' | 'inherit'",
description: 'Color variant mapped to XDS icon color tokens.',
default: "'inherit'",
},
@@ -57,7 +57,7 @@ export const docsZh = {
},
{
name: 'color',
- type: "'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'positive' | 'negative' | 'warning' | 'inherit'",
+ type: "'primary' | 'secondary' | 'tertiary' | 'disabled' | 'accent' | 'success' | 'error' | 'warning' | 'inherit'",
description: '映射到 XDS 图标颜色令牌的颜色变体。',
default: "'inherit'",
},
diff --git a/packages/core/src/Icon/XDSIcon.tsx b/packages/core/src/Icon/XDSIcon.tsx
index 4359dbcdf7..40b2de868e 100644
--- a/packages/core/src/Icon/XDSIcon.tsx
+++ b/packages/core/src/Icon/XDSIcon.tsx
@@ -62,10 +62,10 @@ const colorStyles = stylex.create({
accent: {
color: colorVars['--color-accent'],
},
- positive: {
+ success: {
color: colorVars['--color-success'],
},
- negative: {
+ error: {
color: colorVars['--color-error'],
},
warning: {
diff --git a/packages/core/src/MultiSelector/XDSMultiSelector.tsx b/packages/core/src/MultiSelector/XDSMultiSelector.tsx
index 2d45dd203c..df8790b4fb 100644
--- a/packages/core/src/MultiSelector/XDSMultiSelector.tsx
+++ b/packages/core/src/MultiSelector/XDSMultiSelector.tsx
@@ -367,11 +367,11 @@ const STATUS_ICON_MAP: Record<XDSMultiSelectorStatusType, XDSIconName> = {
const STATUS_ICON_COLOR_MAP: Record<
XDSMultiSelectorStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
export type XDSMultiSelectorSize = 'sm' | 'md' | 'lg';
diff --git a/packages/core/src/NumberInput/XDSNumberInput.tsx b/packages/core/src/NumberInput/XDSNumberInput.tsx
index 30e094f308..94a8c9f30b 100644
--- a/packages/core/src/NumberInput/XDSNumberInput.tsx
+++ b/packages/core/src/NumberInput/XDSNumberInput.tsx
@@ -380,11 +380,11 @@ export function XDSNumberInput({
const statusIconColorMap: Record<
XDSInputStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
const ariaDescribedBy =
diff --git a/packages/core/src/ProgressBar/ProgressBar.doc.mjs b/packages/core/src/ProgressBar/ProgressBar.doc.mjs
index 55d2552cea..1f41330f96 100644
--- a/packages/core/src/ProgressBar/ProgressBar.doc.mjs
+++ b/packages/core/src/ProgressBar/ProgressBar.doc.mjs
@@ -44,7 +44,7 @@ export const docs = {
},
{
name: 'variant',
- type: "'accent' | 'positive' | 'warning' | 'negative'",
+ type: "'accent' | 'success' | 'warning' | 'error'",
description: 'Semantic color variant.',
default: "'accent'",
},
@@ -72,7 +72,7 @@ export const docs = {
'A horizontal bar showing the completion progress of a task. Use it for operations where the duration is known, or as an animated indicator when progress can\'t be calculated. Supports semantic color variants, value labels, and custom formatting.',
bestPractices: [
{ guidance: true, description: "Use a determinate bar when the total amount of work is known, and indeterminate when it's not." },
- { guidance: true, description: 'Choose a color variant that matches the context — accent for general progress, positive for success, warning or negative for alerts.' },
+ { guidance: true, description: 'Choose a color variant that matches the context — accent for general progress, success for completion, warning or error for alerts.' },
{ guidance: true, description: "Always provide a label, even if hidden — screen readers need it to announce what's loading." },
{ guidance: false, description: 'Place icons or labels inside the bar — compose them alongside it using layout components.' },
{ guidance: false, description: "Use a progress bar for instant actions — it's meant for operations that take noticeable time." },
@@ -123,7 +123,7 @@ export const docsZh = {
},
{
name: 'variant',
- type: "'accent' | 'positive' | 'warning' | 'negative'",
+ type: "'accent' | 'success' | 'warning' | 'error'",
description: '语义颜色变体。',
default: "'accent'",
},
@@ -151,7 +151,7 @@ export const docsZh = {
'A horizontal bar showing the completion progress of a task. Use it for operations where the duration is known, or as an animated indicator when progress can\'t be calculated. Supports semantic color variants, value labels, and custom formatting.',
bestPractices: [
{ guidance: true, description: "Use a determinate bar when the total amount of work is known, and indeterminate when it's not." },
- { guidance: true, description: 'Choose a color variant that matches the context — accent for general progress, positive for success, warning or negative for alerts.' },
+ { guidance: true, description: 'Choose a color variant that matches the context — accent for general progress, success for completion, warning or error for alerts.' },
{ guidance: true, description: "Always provide a label, even if hidden — screen readers need it to announce what's loading." },
{ guidance: false, description: 'Place icons or labels inside the bar — compose them alongside it using layout components.' },
{ guidance: false, description: "Use a progress bar for instant actions — it's meant for operations that take noticeable time." },
@@ -169,7 +169,7 @@ export const docsDense = {
'A horizontal bar showing the completion progress of a task. Use it for operations where the duration is known, or as an animated indicator when progress can\'t be calculated. Supports semantic color variants, value labels, and custom formatting.',
bestPractices: [
{ guidance: true, description: "Use a determinate bar when the total amount of work is known, and indeterminate when it's not." },
- { guidance: true, description: 'Choose a color variant that matches the context — accent for general progress, positive for success, warning or negative for alerts.' },
+ { guidance: true, description: 'Choose a color variant that matches the context — accent for general progress, success for completion, warning or error for alerts.' },
{ guidance: true, description: "Always provide a label, even if hidden — screen readers need it to announce what's loading." },
{ guidance: false, description: 'Place icons or labels inside the bar — compose them alongside it using layout components.' },
{ guidance: false, description: "Use a progress bar for instant actions — it's meant for operations that take noticeable time." },
diff --git a/packages/core/src/ProgressBar/XDSProgressBar.test.tsx b/packages/core/src/ProgressBar/XDSProgressBar.test.tsx
index ed0a7962bb..e48dace571 100644
--- a/packages/core/src/ProgressBar/XDSProgressBar.test.tsx
+++ b/packages/core/src/ProgressBar/XDSProgressBar.test.tsx
@@ -88,7 +88,7 @@ describe('XDSProgressBar', () => {
});
it('renders with all variant options', () => {
- const variants = ['accent', 'positive', 'warning', 'negative'] as const;
+ const variants = ['accent', 'success', 'warning', 'error'] as const;
for (const variant of variants) {
const {unmount} = render(
<XDSProgressBar value={50} label={variant} variant={variant} />,
@@ -160,7 +160,7 @@ describe('XDSProgressBar', () => {
});
it('renders with all variants in indeterminate mode', () => {
- const variants = ['accent', 'positive', 'warning', 'negative'] as const;
+ const variants = ['accent', 'success', 'warning', 'error'] as const;
for (const variant of variants) {
const {unmount} = render(
<XDSProgressBar isIndeterminate label={variant} variant={variant} />,
diff --git a/packages/core/src/ProgressBar/XDSProgressBar.tsx b/packages/core/src/ProgressBar/XDSProgressBar.tsx
index 60729ec85b..c5361926a2 100644
--- a/packages/core/src/ProgressBar/XDSProgressBar.tsx
+++ b/packages/core/src/ProgressBar/XDSProgressBar.tsx
@@ -46,10 +46,10 @@ import type {XDSBaseProps} from '../XDSBaseProps';
*/
export interface XDSProgressBarVariantMap {
accent: true;
- positive: true;
+ success: true;
warning: true;
neutral: true;
- negative: true;
+ error: true;
}
/**
@@ -196,13 +196,13 @@ const variantStyles = stylex.create({
accent: {
backgroundColor: colorVars['--color-accent'],
},
- positive: {
+ success: {
backgroundColor: colorVars['--color-success'],
},
warning: {
backgroundColor: colorVars['--color-warning'],
},
- negative: {
+ error: {
backgroundColor: colorVars['--color-error'],
},
neutral: {
diff --git a/packages/core/src/Selector/XDSSelector.tsx b/packages/core/src/Selector/XDSSelector.tsx
index d57f1ef59c..f8acb0d7a4 100644
--- a/packages/core/src/Selector/XDSSelector.tsx
+++ b/packages/core/src/Selector/XDSSelector.tsx
@@ -296,11 +296,11 @@ const STATUS_ICON_MAP: Record<XDSSelectorStatusType, XDSIconName> = {
const STATUS_ICON_COLOR_MAP: Record<
XDSSelectorStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
export type XDSSelectorSize = 'sm' | 'md' | 'lg';
diff --git a/packages/core/src/StatusDot/StatusDot.doc.mjs b/packages/core/src/StatusDot/StatusDot.doc.mjs
index eaff3d4da7..bbb8ae433c 100644
--- a/packages/core/src/StatusDot/StatusDot.doc.mjs
+++ b/packages/core/src/StatusDot/StatusDot.doc.mjs
@@ -8,7 +8,7 @@ export const docs = {
props: [
{
name: 'variant',
- type: "'positive' | 'warning' | 'negative' | 'info' | 'neutral'",
+ type: "'success' | 'warning' | 'error' | 'accent' | 'neutral'",
description: 'Semantic color variant.',
required: true,
},
@@ -55,7 +55,7 @@ export const docsZh = {
props: [
{
name: 'variant',
- type: "'positive' | 'warning' | 'negative' | 'info' | 'neutral'",
+ type: "'success' | 'warning' | 'error' | 'accent' | 'neutral'",
description: '语义颜色变体。',
required: true,
},
diff --git a/packages/core/src/StatusDot/XDSStatusDot.test.tsx b/packages/core/src/StatusDot/XDSStatusDot.test.tsx
index 68fa021dae..25ece0f391 100644
--- a/packages/core/src/StatusDot/XDSStatusDot.test.tsx
+++ b/packages/core/src/StatusDot/XDSStatusDot.test.tsx
@@ -19,10 +19,10 @@ describe('XDSStatusDot', () => {
it('renders with all variant types', () => {
const variants = [
- 'positive',
+ 'success',
'warning',
- 'negative',
- 'info',
+ 'error',
+ 'accent',
'neutral',
] as const;
diff --git a/packages/core/src/StatusDot/XDSStatusDot.tsx b/packages/core/src/StatusDot/XDSStatusDot.tsx
index 55fa46ab0a..08d35aaab8 100644
--- a/packages/core/src/StatusDot/XDSStatusDot.tsx
+++ b/packages/core/src/StatusDot/XDSStatusDot.tsx
@@ -58,16 +58,16 @@ const styles = stylex.create({
* Variant styles mapping to theme color tokens
*/
const variants = stylex.create({
- positive: {
+ success: {
backgroundColor: colorVars['--color-success'],
},
warning: {
backgroundColor: colorVars['--color-warning'],
},
- negative: {
+ error: {
backgroundColor: colorVars['--color-error'],
},
- info: {
+ accent: {
backgroundColor: colorVars['--color-accent'],
},
neutral: {
@@ -89,10 +89,10 @@ const variants = stylex.create({
* ```
*/
export interface XDSStatusDotVariantMap {
- positive: true;
+ success: true;
warning: true;
- negative: true;
- info: true;
+ error: true;
+ accent: true;
neutral: true;
}
@@ -130,9 +130,9 @@ export interface XDSStatusDotProps extends XDSBaseProps<HTMLSpanElement> {
*
* @example
* ```
- * <XDSStatusDot variant="positive" label="Online" />
- * <XDSStatusDot variant="negative" label="Offline" />
- * <XDSStatusDot variant="positive" label="Live" isPulsing />
+ * <XDSStatusDot variant="success" label="Online" />
+ * <XDSStatusDot variant="error" label="Offline" />
+ * <XDSStatusDot variant="success" label="Live" isPulsing />
* ```
*/
export function XDSStatusDot({
diff --git a/packages/core/src/Table/types.ts b/packages/core/src/Table/types.ts
index d164877e7d..1a7147f066 100644
--- a/packages/core/src/Table/types.ts
+++ b/packages/core/src/Table/types.ts
@@ -197,7 +197,7 @@ export interface XDSTableColumn<T extends Record<string, unknown>> {
* @compositionHint Use renderCell to compose rich table cells:
* - XDSBadge for status labels (success/warning/error variants)
* - XDSStatusDot for colored indicators
- * - XDSText with color="positive"|"negative" for formatted values
+ * - XDSText with color="success"|"error" for formatted values
* - XDSHStack to combine multiple elements in a cell
* - XDSAvatar for user/entity cells
*
@@ -205,7 +205,7 @@ export interface XDSTableColumn<T extends Record<string, unknown>> {
* ```tsx
* renderCell: (item) => (
* <XDSHStack gap={2} align="center">
- * <XDSStatusDot status={item.isActive ? 'positive' : 'negative'} />
+ * <XDSStatusDot status={item.isActive ? 'success' : 'error'} />
* <XDSBadge variant={item.isActive ? 'success' : 'error'} label={item.isActive ? 'Active' : 'Inactive'} />
* </XDSHStack>
* )
diff --git a/packages/core/src/TextArea/XDSTextArea.tsx b/packages/core/src/TextArea/XDSTextArea.tsx
index 1a7e7aacdc..ec30cd3ead 100644
--- a/packages/core/src/TextArea/XDSTextArea.tsx
+++ b/packages/core/src/TextArea/XDSTextArea.tsx
@@ -295,11 +295,11 @@ export function XDSTextArea({
const statusIconColorMap: Record<
XDSTextAreaStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
const ariaDescribedBy =
diff --git a/packages/core/src/TextInput/XDSTextInput.tsx b/packages/core/src/TextInput/XDSTextInput.tsx
index e1b19465a3..2738b1b543 100644
--- a/packages/core/src/TextInput/XDSTextInput.tsx
+++ b/packages/core/src/TextInput/XDSTextInput.tsx
@@ -281,11 +281,11 @@ export function XDSTextInput({
const statusIconColorMap: Record<
XDSInputStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
const ariaDescribedBy =
diff --git a/packages/core/src/TimeInput/XDSTimeInput.tsx b/packages/core/src/TimeInput/XDSTimeInput.tsx
index 4ab8361bfc..e06ebf6f30 100644
--- a/packages/core/src/TimeInput/XDSTimeInput.tsx
+++ b/packages/core/src/TimeInput/XDSTimeInput.tsx
@@ -334,11 +334,11 @@ export function XDSTimeInput({
const statusIconColorMap: Record<
XDSInputStatusType,
- 'warning' | 'negative' | 'positive'
+ 'warning' | 'error' | 'success'
> = {
warning: 'warning',
- error: 'negative',
- success: 'positive',
+ error: 'error',
+ success: 'success',
};
const ariaDescribedBy =
diff --git a/packages/themes/butter/src/butterTheme.ts b/packages/themes/butter/src/butterTheme.ts
index bf95993503..26e45d2fda 100644
--- a/packages/themes/butter/src/butterTheme.ts
+++ b/packages/themes/butter/src/butterTheme.ts
@@ -397,13 +397,13 @@ export const butterTheme = defineTheme({
},
},
'progressbar-fill': {
- 'variant:positive': {
+ 'variant:success': {
backgroundColor: '#91D143',
},
'variant:warning': {
backgroundColor: '#ffc502',
},
- 'variant:negative': {
+ 'variant:error': {
backgroundColor: '#fc473b',
},
},
diff --git a/packages/themes/neutral/src/neutralTheme.ts b/packages/themes/neutral/src/neutralTheme.ts
index ab09ff6c50..af1dc2c4f3 100644
--- a/packages/themes/neutral/src/neutralTheme.ts
+++ b/packages/themes/neutral/src/neutralTheme.ts
@@ -563,7 +563,7 @@ export const neutralTheme = defineTheme({
// Blue T50 saturated stop (= variant:info badge bg)
'--color-accent': '#0074e2',
},
- 'variant:positive': {
+ 'variant:success': {
// Green T45 saturated stop (= variant:success badge bg)
'--color-success': '#198100',
},
@@ -571,7 +571,7 @@ export const neutralTheme = defineTheme({
// Yellow T85 saturated stop (= variant:warning badge bg)
'--color-warning': '#ffce2f',
},
- 'variant:negative': {
+ 'variant:error': {
// Red T55 saturated stop (= variant:error badge bg)
'--color-error': '#e33f4a',
},
diff --git a/packages/themes/stone/src/stoneTheme.ts b/packages/themes/stone/src/stoneTheme.ts
index 0eec34f87d..98e8647f66 100644
--- a/packages/themes/stone/src/stoneTheme.ts
+++ b/packages/themes/stone/src/stoneTheme.ts
@@ -329,13 +329,13 @@ export const stoneTheme = defineTheme({
'variant:accent': {
backgroundColor: 'light-dark(#d7e4f5, #a0acbc)', // Blue T90 / T70
},
- 'variant:positive': {
+ 'variant:success': {
backgroundColor: 'light-dark(#d0e9ce, #9ab298)', // Green T90 / T70
},
'variant:warning': {
backgroundColor: 'light-dark(#f4e1b7, #bbaa82)', // Yellow T90 / T70
},
- 'variant:negative': {
+ 'variant:error': {
backgroundColor: 'light-dark(#f9dcd7, #c0a5a0)', // Red T90 / T70
},
},