Skip to content

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

TypeScript

refactor: rename design tokens to match new naming convention (#894)

rubyycheung5c794dbaf427
diff --git a/.claude/commands/create-theme.md b/.claude/commands/create-theme.md
index bcea5b208d..8bf3e4d81b 100644
--- a/.claude/commands/create-theme.md
+++ b/.claude/commands/create-theme.md
@@ -60,18 +60,19 @@ export const {themeName}Theme = defineTheme({
// Colors — use [light, dark] tuples for automatic light-dark() conversion
'--color-accent': ['#YOUR_LIGHT', '#YOUR_DARK'],
'--color-accent-muted': ['#YOUR_LIGHT33', '#YOUR_DARK3F'],
- '--color-surface': ['#FFFFFF', '#1C1C1C'],
- '--color-wash': ['#F5F5F5', '#121212'],
+ '--color-background-surface': ['#FFFFFF', '#1C1C1C'],
+ '--color-background-body': ['#F5F5F5', '#121212'],
// Radius — customize for different feel
- '--radius-3': '12px',
- '--radius-2': '8px',
- '--radius-1': '4px',
+ '--radius-page': '28px',
+ '--radius-container': '12px',
+ '--radius-element': '8px',
+ '--radius-inner': '4px',
// Typography — font families
- '--font-body': '-apple-system, BlinkMacSystemFont, sans-serif',
- '--font-heading': '-apple-system, BlinkMacSystemFont, sans-serif',
- '--font-code': '"SF Mono", Monaco, Consolas, monospace',
+ '--font-family-body': '-apple-system, BlinkMacSystemFont, sans-serif',
+ '--font-family-heading': '-apple-system, BlinkMacSystemFont, sans-serif',
+ '--font-family-code': '"SF Mono", Monaco, Consolas, monospace',
// Only include tokens you want to override.
// See packages/core/src/theme/tokens.stylex.ts for all available tokens.
@@ -86,8 +87,8 @@ export const {themeName}Theme = defineTheme({
},
heading: {
'level:1': {
- fontFamily: 'var(--font-heading)',
- fontSize: 'var(--text-2xl)',
+ fontFamily: 'var(--font-family-heading)',
+ fontSize: 'var(--font-size-2xl)',
fontWeight: 'var(--font-weight-semibold)',
lineHeight: '1.2',
color: 'var(--color-text-primary)',
@@ -97,8 +98,8 @@ export const {themeName}Theme = defineTheme({
},
text: {
'type:body': {
- fontFamily: 'var(--font-body)',
- fontSize: 'var(--text-base)',
+ fontFamily: 'var(--font-family-body)',
+ fontSize: 'var(--font-size-base)',
fontWeight: 'var(--font-weight-normal)',
lineHeight: 'var(--leading-base)',
color: 'var(--color-text-primary)',
@@ -136,7 +137,7 @@ Component overrides generate scoped CSS:
background-color: ...;
}
.xds-heading.level-1 {
- font-size: var(--text-2xl);
+ font-size: var(--font-size-2xl);
}
}
```
diff --git a/apps/example-nextjs-tailwind/src/app/page.tsx b/apps/example-nextjs-tailwind/src/app/page.tsx
index fad2395201..8c775db297 100644
--- a/apps/example-nextjs-tailwind/src/app/page.tsx
+++ b/apps/example-nextjs-tailwind/src/app/page.tsx
@@ -43,10 +43,10 @@ export default function Home() {
<XDSVStack gap={3}>
<XDSHeading level={2}>Badges</XDSHeading>
<XDSHStack gap={3} vAlign="center">
- <XDSBadge variant="info" label='Info' />
- <XDSBadge variant="success" label='Success' />
- <XDSBadge variant="warning" label='Warning' />
- <XDSBadge variant="error" label='Error' />
+ <XDSBadge variant="info" label="Info" />
+ <XDSBadge variant="success" label="Success" />
+ <XDSBadge variant="warning" label="Warning" />
+ <XDSBadge variant="error" label="Error" />
</XDSHStack>
</XDSVStack>
@@ -63,7 +63,7 @@ export default function Home() {
{/* Tailwind custom styling */}
<XDSVStack gap={3}>
<XDSHeading level={2}>Tailwind Integration</XDSHeading>
- <div className="rounded-lg border border-[var(--color-border)] p-4 bg-[var(--color-wash)]">
+ <div className="rounded-lg border border-[var(--color-border)] p-4 bg-[var(--color-background-body)]">
<XDSText type="body">
This card uses Tailwind utilities for layout with XDS design
tokens via CSS custom properties. No StyleX needed.
diff --git a/apps/sandbox/src/app/(fullscreen)/pages/shell-lab/page.tsx b/apps/sandbox/src/app/(fullscreen)/pages/shell-lab/page.tsx
index 226c440fa5..1984c6e196 100644
--- a/apps/sandbox/src/app/(fullscreen)/pages/shell-lab/page.tsx
+++ b/apps/sandbox/src/app/(fullscreen)/pages/shell-lab/page.tsx
@@ -785,7 +785,7 @@ export default function ShellLabPage() {
padding: '8px 12px',
borderRadius: 8,
border: '1px solid var(--color-border)',
- background: 'var(--color-wash)',
+ background: 'var(--color-background-body)',
fontSize: 14,
outline: 'none',
}}
@@ -883,7 +883,7 @@ export default function ShellLabPage() {
overflow: 'auto',
padding: 12,
borderRadius: 8,
- background: 'var(--color-wash)',
+ background: 'var(--color-background-body)',
}}>
{JSON.stringify(config, null, 2)}
</pre>
diff --git a/apps/sandbox/src/app/(sandbox)/pages/mega-menu/page.tsx b/apps/sandbox/src/app/(sandbox)/pages/mega-menu/page.tsx
index 86d242c14e..38c5a50870 100644
--- a/apps/sandbox/src/app/(sandbox)/pages/mega-menu/page.tsx
+++ b/apps/sandbox/src/app/(sandbox)/pages/mega-menu/page.tsx
@@ -24,7 +24,7 @@ const styles = stylex.create({
position: 'relative',
borderRadius: 12,
overflow: 'visible',
- backgroundColor: 'var(--color-surface, #fff)',
+ backgroundColor: 'var(--color-background-surface, #fff)',
boxShadow: '0 1px 3px rgba(0, 0, 0, 0.08)',
transitionProperty: 'border-radius, box-shadow',
transitionDuration: '0.2s',
@@ -54,7 +54,7 @@ const styles = stylex.create({
featuredLink: {
fontSize: 14,
fontWeight: 600,
- color: 'var(--color-text-link)',
+ color: 'var(--color-text-accent)',
textDecoration: 'none',
},
featuredImage: {
diff --git a/apps/sandbox/src/app/(sandbox)/pages/theme-editor/page.tsx b/apps/sandbox/src/app/(sandbox)/pages/theme-editor/page.tsx
index 41ce4d3629..269b0b3a47 100644
--- a/apps/sandbox/src/app/(sandbox)/pages/theme-editor/page.tsx
+++ b/apps/sandbox/src/app/(sandbox)/pages/theme-editor/page.tsx
@@ -29,7 +29,6 @@ import {
radiusDefaults,
typographyDefaults,
textSizeDefaults,
- lineHeightDefaults,
fontWeightDefaults,
typeScaleDefaults,
sizeDefaults,
@@ -67,7 +66,6 @@ const TOKEN_GROUPS = {
tokens: {
...typographyDefaults,
...textSizeDefaults,
- ...lineHeightDefaults,
...fontWeightDefaults,
},
},
@@ -103,34 +101,36 @@ const COLOR_CATEGORIES = {
'Core Semantic': [
'--color-accent',
'--color-accent-muted',
- '--color-secondary',
- '--color-surface',
- '--color-wash',
+ '--color-neutral',
'--color-overlay',
],
'Interactive States': [
'--color-overlay-hover',
'--color-overlay-pressed',
- '--color-ring-focus',
- '--color-ring-focus-error',
- '--color-ring-focus-success',
- '--color-ring-focus-warning',
- '--color-muted',
+ '--color-accent',
+ '--color-error',
+ '--color-success',
+ '--color-warning',
+ '--color-background-muted',
],
Text: [
'--color-text-primary',
'--color-text-secondary',
'--color-text-disabled',
- '--color-text-link',
- '--color-text-on-dark-media',
+ '--color-text-accent',
+ '--color-on-dark',
],
Icon: [
'--color-icon-primary',
'--color-icon-secondary',
'--color-icon-disabled',
- '--color-icon-on-dark-media',
],
- 'Surface Variants': ['--color-card', '--color-popover', '--color-navbar'],
+ 'Surface Variants': [
+ '--color-background-surface',
+ '--color-background-body',
+ '--color-background-card',
+ '--color-background-popover',
+ ],
'Status/Sentiment': [
'--color-success',
'--color-success-muted',
@@ -138,74 +138,68 @@ const COLOR_CATEGORIES = {
'--color-error-muted',
'--color-warning',
'--color-warning-muted',
- '--color-info',
- '--color-info-muted',
- ],
- Divider: [
- '--color-border',
- '--color-border-strong',
- '--color-border-emphasized',
],
- Effects: ['--color-skeleton', '--color-shadow', '--color-hover-tint'],
+ Divider: ['--color-border', '--color-border-emphasized'],
+ Effects: ['--color-skeleton', '--color-shadow', '--color-tint-hover'],
'Palette: Blue': [
- '--color-blue-background',
- '--color-blue-border',
- '--color-blue-icon',
- '--color-blue-text',
+ '--color-background-blue',
+ '--color-border-blue',
+ '--color-icon-blue',
+ '--color-text-blue',
],
'Palette: Green': [
- '--color-green-background',
- '--color-green-border',
- '--color-green-icon',
- '--color-green-text',
+ '--color-background-green',
+ '--color-border-green',
+ '--color-icon-green',
+ '--color-text-green',
],
'Palette: Red': [
- '--color-red-background',
- '--color-red-border',
- '--color-red-icon',
- '--color-red-text',
+ '--color-background-red',
+ '--color-border-red',
+ '--color-icon-red',
+ '--color-text-red',
],
'Palette: Yellow': [
- '--color-yellow-background',
- '--color-yellow-border',
- '--color-yellow-icon',
- '--color-yellow-text',
+ '--color-background-yellow',
+ '--color-border-yellow',
+ '--color-icon-yellow',
+ '--color-text-yellow',
],
'Palette: Orange': [
- '--color-orange-background',
- '--color-orange-border',
- '--color-orange-icon',
- '--color-orange-text',
+ '--color-background-orange',
+ '--color-border-orange',
+ '--color-icon-orange',
+ '--color-text-orange',
],
'Palette: Purple': [
- '--color-purple-background',
- '--color-purple-border',
- '--color-purple-icon',
- '--color-purple-text',
+ '--color-background-purple',
+ '--color-border-purple',
+ '--color-icon-purple',
+ '--color-text-purple',
],
'Palette: Pink': [
- '--color-pink-background',
- '--color-pink-border',
- '--color-pink-icon',
- '--color-pink-text',
+ '--color-background-pink',
+ '--color-border-pink',
+ '--color-icon-pink',
+ '--color-text-pink',
],
'Palette: Teal': [
- '--color-teal-background',
- '--color-teal-border',
- '--color-teal-icon',
- '--color-teal-text',
+ '--color-background-teal',
+ '--color-border-teal',
+ '--color-icon-teal',
+ '--color-text-teal',
],
'Palette: Cyan': [
- '--color-cyan-background',
- '--color-cyan-border',
- '--color-cyan-icon',
- '--color-cyan-text',
+ '--color-background-cyan',
+ '--color-border-cyan',
+ '--color-icon-cyan',
+ '--color-text-cyan',
],
'Palette: Gray': [
- '--color-gray-background',
- '--color-gray-border',
- '--color-gray-icon',
- '--color-gray-text',
+ '--color-background-gray',
+ '--color-border-gray',
+ '--color-icon-gray',
+ '--color-text-gray',
],
} as const;
@@ -218,30 +212,58 @@ const COLOR_CATEGORIES = {
* Each style shows which tokens it uses (size, weight, line-height).
*/
const TYPOGRAPHY_CATEGORIES = {
- 'Font Families': ['--font-body', '--font-heading', '--font-code'],
+ 'Font Families': [
+ '--font-family-body',
+ '--font-family-heading',
+ '--font-family-code',
+ ],
'Heading 1': {
description: 'Primary page title (24px default)',
- tokens: ['--heading-1-size', '--heading-1-weight', '--heading-1-leading'],
+ tokens: [
+ '--text-heading-1-size',
+ '--text-heading-1-weight',
+ '--text-heading-1-leading',
+ ],
},
'Heading 2': {
description: 'Section title (20px default)',
- tokens: ['--heading-2-size', '--heading-2-weight', '--heading-2-leading'],
+ tokens: [
+ '--text-heading-2-size',
+ '--text-heading-2-weight',
+ '--text-heading-2-leading',
+ ],
},
'Heading 3': {
description: 'Subsection title (17px default)',
- tokens: ['--heading-3-size', '--heading-3-weight', '--heading-3-leading'],
+ tokens: [
+ '--text-heading-3-size',
+ '--text-heading-3-weight',
+ '--text-heading-3-leading',
+ ],
},
'Heading 4': {
description: 'Card/component title (14px — base anchor)',
- tokens: ['--heading-4-size', '--heading-4-weight', '--heading-4-leading'],
+ tokens: [
+ '--text-heading-4-size',
+ '--text-heading-4-weight',
+ '--text-heading-4-leading',
+ ],
},
'Heading 5': {
description: 'Minor heading (12px default)',
- tokens: ['--heading-5-size', '--heading-5-weight', '--heading-5-leading'],
+ tokens: [
+ '--text-heading-5-size',
+ '--text-heading-5-weight',
+ '--text-heading-5-leading',
+ ],
},
'Heading 6': {
description: 'Smallest heading (10px default)',
- tokens: ['--heading-6-size', '--heading-6-weight', '--heading-6-leading'],
+ tokens: [
+ '--text-heading-6-size',
+ '--text-heading-6-weight',
+ '--text-heading-6-leading',
+ ],
},
'Body Text': {
description: 'Default paragraph text',
@@ -276,17 +298,17 @@ const TYPOGRAPHY_CATEGORIES = {
tokens: ['--text-code-size', '--text-code-weight', '--text-code-leading'],
},
'All Text Sizes': [
- '--text-4xs',
- '--text-3xs',
- '--text-2xs',
- '--text-xsm',
- '--text-sm',
- '--text-base',
- '--text-lg',
- '--text-xl',
- '--text-2xl',
- '--text-3xl',
- '--text-4xl',
+ '--font-size-4xs',
+ '--font-size-3xs',
+ '--font-size-2xs',
+ '--font-size-xs',
+ '--font-size-sm',
+ '--font-size-base',
+ '--font-size-lg',
+ '--font-size-xl',
+ '--font-size-2xl',
+ '--font-size-3xl',
+ '--font-size-4xl',
],
'All Font Weights': [
'--font-weight-normal',
@@ -438,7 +460,7 @@ function ColorSwatch({tokenName, value, onChange, mode}: ColorSwatchProps) {
gap: '12px',
padding: '8px 12px',
borderRadius: '8px',
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
}}>
<div
style={{
@@ -482,7 +504,7 @@ function ColorSwatch({tokenName, value, onChange, mode}: ColorSwatchProps) {
style={{
fontSize: '11px',
color: 'var(--color-text-secondary)',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
}}>
{tokenName}
</code>
@@ -515,10 +537,10 @@ function ColorSwatch({tokenName, value, onChange, mode}: ColorSwatchProps) {
width: '50px',
padding: '4px 6px',
fontSize: '12px',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
border: '1px solid var(--color-border-emphasized)',
borderRadius: '4px',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
color: 'var(--color-text-primary)',
textAlign: 'center',
}}
@@ -547,10 +569,10 @@ function ColorSwatch({tokenName, value, onChange, mode}: ColorSwatchProps) {
width: '100px',
padding: '4px 8px',
fontSize: '12px',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
border: '1px solid var(--color-border-emphasized)',
borderRadius: '4px',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
color: 'var(--color-text-primary)',
}}
/>
@@ -576,7 +598,7 @@ function SpacingEditor({tokenName, value, onChange}: SpacingEditorProps) {
gap: '12px',
padding: '8px 12px',
borderRadius: '8px',
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
}}>
<div
style={{
@@ -601,7 +623,7 @@ function SpacingEditor({tokenName, value, onChange}: SpacingEditorProps) {
style={{
fontSize: '11px',
color: 'var(--color-text-secondary)',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
}}>
{tokenName}
</code>
@@ -614,10 +636,10 @@ function SpacingEditor({tokenName, value, onChange}: SpacingEditorProps) {
width: '80px',
padding: '4px 8px',
fontSize: '12px',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
border: '1px solid var(--color-border-emphasized)',
borderRadius: '4px',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
color: 'var(--color-text-primary)',
}}
/>
@@ -640,7 +662,7 @@ function RadiusEditor({tokenName, value, onChange}: RadiusEditorProps) {
gap: '12px',
padding: '8px 12px',
borderRadius: '8px',
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
}}>
<div
style={{
@@ -665,7 +687,7 @@ function RadiusEditor({tokenName, value, onChange}: RadiusEditorProps) {
style={{
fontSize: '11px',
color: 'var(--color-text-secondary)',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
}}>
{tokenName}
</code>
@@ -678,10 +700,10 @@ function RadiusEditor({tokenName, value, onChange}: RadiusEditorProps) {
width: '80px',
padding: '4px 8px',
fontSize: '12px',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
border: '1px solid var(--color-border-emphasized)',
borderRadius: '4px',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
color: 'var(--color-text-primary)',
}}
/>
@@ -709,7 +731,7 @@ function TypographyEditor({tokenName, value, onChange}: TypographyEditorProps) {
gap: '12px',
padding: '8px 12px',
borderRadius: '8px',
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
}}>
<div
style={{
@@ -741,7 +763,7 @@ function TypographyEditor({tokenName, value, onChange}: TypographyEditorProps) {
style={{
fontSize: '11px',
color: 'var(--color-text-secondary)',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
}}>
{tokenName}
</code>
@@ -754,10 +776,10 @@ function TypographyEditor({tokenName, value, onChange}: TypographyEditorProps) {
width: isFont ? '200px' : '80px',
padding: '4px 8px',
fontSize: '12px',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
border: '1px solid var(--color-border-emphasized)',
borderRadius: '4px',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
color: 'var(--color-text-primary)',
}}
/>
@@ -866,11 +888,11 @@ function ComponentPreview() {
<pre
style={{
padding: '16px',
- borderRadius: 'var(--radius-2)',
- backgroundColor: 'var(--color-wash)',
+ borderRadius: 'var(--radius-element)',
+ backgroundColor: 'var(--color-background-body)',
border: '1px solid var(--color-border)',
- fontFamily: 'var(--font-code)',
- fontSize: 'var(--text-sm)',
+ fontFamily: 'var(--font-family-code)',
+ fontSize: 'var(--font-size-sm)',
lineHeight: 'var(--leading-normal)',
overflow: 'auto',
margin: '0 0 16px 0',
@@ -891,7 +913,7 @@ const styles = stylex.create({
const styles = stylex.create({
button: {
backgroundColor: colorVars['--color-accent'],
- color: colorVars['--color-text-on-dark-media'],
+ color: colorVars['--color-on-dark'],
},
});`}
</code>
@@ -910,7 +932,7 @@ const styles = stylex.create({
margin: '0 0 16px 0',
paddingLeft: '24px',
color: 'var(--color-text-primary)',
- fontSize: 'var(--text-base)',
+ fontSize: 'var(--font-size-base)',
lineHeight: 'var(--leading-base)',
}}>
<li>Automatic dark mode support via light-dark()</li>
@@ -1033,7 +1055,12 @@ const styles = stylex.create({
gap: '12px',
maxWidth: '300px',
}}>
- <XDSTextInput label="Text Input" placeholder="Enter text..." value="" onChange={() => {}} />
+ <XDSTextInput
+ label="Text Input"
+ placeholder="Enter text..."
+ value=""
+ onChange={() => {}}
+ />
<XDSSwitch
label="Toggle Switch"
value={switchValue}
@@ -1172,7 +1199,7 @@ const styles = stylex.create({
/>
<XDSDialog
isOpen={dialogOpen}
- onOpenChange={(open) => setDialogOpen(open)}>
+ onOpenChange={open => setDialogOpen(open)}>
<div style={{padding: '0 24px 24px 24px'}}>
<XDSStack direction="vertical" gap={3}>
<XDSText type="body">
@@ -1409,7 +1436,11 @@ function DashboardPreview() {
<XDSTab value="errors" label="Errors" />
</XDSTabList>
<div style={{marginTop: '16px'}}>
- <XDSTable columns={dashboardColumns} data={metrics} density="compact" />
+ <XDSTable
+ columns={dashboardColumns}
+ data={metrics}
+ density="compact"
+ />
</div>
</div>
@@ -1647,7 +1678,6 @@ function ThemeEditorComponent() {
...radiusDefaults,
...typographyDefaults,
...textSizeDefaults,
- ...lineHeightDefaults,
...fontWeightDefaults,
...typeScaleDefaults,
...sizeDefaults,
@@ -1681,11 +1711,11 @@ function ThemeEditorComponent() {
// Create a theme from current tokens.
// Uses defaultTheme's component overrides so that type scale tokens
- // (--heading-1-size, --text-body-size, etc.) are consumed by the
+ // (--text-heading-1-size, --text-body-size, etc.) are consumed by the
// heading/text CSS rules in the preview.
//
// Type scale tokens are ALWAYS included (even at default values) because
- // the component overrides reference var(--heading-1-size) etc., and those
+ // the component overrides reference var(--text-heading-1-size) etc., and those
// unhashed CSS custom properties only exist when the theme explicitly sets them.
const typeScaleKeys = React.useMemo(
() => new Set(Object.keys(typeScaleDefaults)),
@@ -1696,7 +1726,7 @@ function ThemeEditorComponent() {
const tokenOverrides: Record<string, string> = {};
for (const [key, value] of Object.entries(tokens)) {
// Always include type scale tokens — the component CSS rules reference
- // var(--heading-1-size) etc. which only exist when the theme sets them.
+ // var(--text-heading-1-size) etc. which only exist when the theme sets them.
if (typeScaleKeys.has(key) || value !== allDefaults[key]) {
tokenOverrides[key] = value;
}
@@ -1803,7 +1833,7 @@ function ThemeEditorComponent() {
style={{
padding: '12px',
borderRadius: '8px',
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
display: 'flex',
flexDirection: 'column',
gap: '10px',
@@ -1901,14 +1931,14 @@ function ThemeEditorComponent() {
padding: '8px 12px',
borderRadius: '6px',
border: '1px solid var(--color-border)',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
display: 'flex',
flexDirection: 'column',
gap: '2px',
}}>
{[1, 2, 3, 4, 5, 6].map(level => {
const sizeRaw = tokens[`--heading-${level}-size`] || '';
- // Resolve var() refs: "var(--text-2xl)" → look up --text-2xl in tokens
+ // Resolve var() refs: "var(--font-size-2xl)" → look up --font-size-2xl in tokens
const resolvedSize = sizeRaw.startsWith('var(')
? tokens[sizeRaw.slice(4, -1)] || sizeRaw
: sizeRaw;
@@ -2088,7 +2118,7 @@ function ThemeEditorComponent() {
style={{
padding: '16px',
borderRadius: '8px',
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
border: '1px solid var(--color-border)',
marginBottom: '8px',
}}>
@@ -2131,7 +2161,7 @@ function ThemeEditorComponent() {
gap: '12px',
padding: '8px 12px',
borderRadius: '8px',
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
}}>
<div style={{flex: 1, minWidth: 0}}>
<div
@@ -2147,7 +2177,7 @@ function ThemeEditorComponent() {
style={{
fontSize: '11px',
color: 'var(--color-text-secondary)',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
}}>
{tokenName}
</code>
@@ -2160,10 +2190,10 @@ function ThemeEditorComponent() {
width: '200px',
padding: '4px 8px',
fontSize: '12px',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
border: '1px solid var(--color-border-emphasized)',
borderRadius: '4px',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
color: 'var(--color-text-primary)',
}}
/>
@@ -2180,7 +2210,7 @@ function ThemeEditorComponent() {
position: 'fixed',
inset: 0,
overflow: 'hidden',
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
}}>
{/* Left Panel - Token Editor */}
<div
@@ -2189,7 +2219,7 @@ function ThemeEditorComponent() {
borderRight: '1px solid var(--color-border-emphasized)',
display: 'flex',
flexDirection: 'column',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
}}>
{/* Token group tabs */}
<div
@@ -2262,7 +2292,7 @@ function ThemeEditorComponent() {
style={{
padding: '12px 24px',
borderBottom: '1px solid var(--color-border)',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
@@ -2290,7 +2320,7 @@ function ThemeEditorComponent() {
style={{
padding: '16px 24px',
borderBottom: '1px solid var(--color-border)',
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
maxHeight: '300px',
overflow: 'auto',
}}>
@@ -2303,10 +2333,10 @@ function ThemeEditorComponent() {
style={{
padding: '16px',
borderRadius: '8px',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
border: '1px solid var(--color-border-emphasized)',
fontSize: '12px',
- fontFamily: 'var(--font-code)',
+ fontFamily: 'var(--font-family-code)',
overflow: 'auto',
margin: 0,
color: 'var(--color-text-primary)',
@@ -2331,7 +2361,7 @@ function ThemeEditorComponent() {
<XDSTheme theme={currentTheme} mode={mode}>
<div
style={{
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
padding: '24px',
}}>
<PreviewTabs />
diff --git a/apps/storybook/.storybook/preview.tsx b/apps/storybook/.storybook/preview.tsx
index 6a43ce8948..a72086e337 100644
--- a/apps/storybook/.storybook/preview.tsx
+++ b/apps/storybook/.storybook/preview.tsx
@@ -8,7 +8,6 @@ import {brutalistTheme} from '@xds/theme-brutalist';
// Import the base reset and typography stylesheets
import '@xds/core/reset.css';
-
/**
* Map of available themes
*/
@@ -60,7 +59,7 @@ const withXDSTheme: Decorator = (Story, context) => {
<div
className="xds-typography"
style={{
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
padding: 16,
}}>
<Story />
diff --git a/apps/storybook/stories/AspectRatio.stories.tsx b/apps/storybook/stories/AspectRatio.stories.tsx
index 762aa0b63a..bc68d489fd 100644
--- a/apps/storybook/stories/AspectRatio.stories.tsx
+++ b/apps/storybook/stories/AspectRatio.stories.tsx
@@ -13,12 +13,12 @@ import {
const styles = stylex.create({
container: {
padding: spacingVars['--spacing-4'],
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
maxWidth: 600,
},
wideContainer: {
padding: spacingVars['--spacing-4'],
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
maxWidth: 1000,
},
storyWrapper: {
@@ -33,13 +33,13 @@ const styles = stylex.create({
width: '100%',
height: '100%',
objectFit: 'cover',
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
},
placeholder: {
width: '100%',
height: '100%',
- backgroundColor: colorVars['--color-wash'],
- borderRadius: radiusVars['--radius-2'],
+ backgroundColor: colorVars['--color-background-body'],
+ borderRadius: radiusVars['--radius-element'],
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
@@ -48,7 +48,7 @@ const styles = stylex.create({
width: '100%',
height: '100%',
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
@@ -60,7 +60,7 @@ const styles = stylex.create({
smallContainer: {
maxWidth: 300,
padding: spacingVars['--spacing-4'],
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
},
});
diff --git a/apps/storybook/stories/Avatar.stories.tsx b/apps/storybook/stories/Avatar.stories.tsx
index 4a102ea8ef..72af5a50e1 100644
--- a/apps/storybook/stories/Avatar.stories.tsx
+++ b/apps/storybook/stories/Avatar.stories.tsx
@@ -18,7 +18,7 @@ const styles = stylex.create({
},
heading: {
margin: `0 0 ${spacingVars['--spacing-2']} 0`,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
},
});
diff --git a/apps/storybook/stories/Card.stories.tsx b/apps/storybook/stories/Card.stories.tsx
index 7d4c80782e..f4f684d23b 100644
--- a/apps/storybook/stories/Card.stories.tsx
+++ b/apps/storybook/stories/Card.stories.tsx
@@ -19,11 +19,11 @@ import {
const styles = stylex.create({
pageWrapper: {
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
padding: spacingVars['--spacing-6'],
},
text: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -38,7 +38,7 @@ const styles = stylex.create({
},
heading: {
margin: `0 0 ${spacingVars['--spacing-2']} 0`,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: 14,
color: colorVars['--color-text-secondary'],
},
diff --git a/apps/storybook/stories/Center.stories.tsx b/apps/storybook/stories/Center.stories.tsx
index f8466a9c44..bb9ab7a8b4 100644
--- a/apps/storybook/stories/Center.stories.tsx
+++ b/apps/storybook/stories/Center.stories.tsx
@@ -14,14 +14,14 @@ import {
const styles = stylex.create({
box: {
- backgroundColor: colorVars['--color-blue-background'],
- color: colorVars['--color-blue-text'],
+ backgroundColor: colorVars['--color-background-blue'],
+ color: colorVars['--color-text-blue'],
borderWidth: 1,
borderStyle: 'solid',
- borderColor: colorVars['--color-blue-border'],
+ borderColor: colorVars['--color-border-blue'],
paddingBlock: spacingVars['--spacing-4'],
paddingInline: spacingVars['--spacing-6'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
fontWeight: 500,
},
storyWrapper: {
@@ -30,10 +30,10 @@ const styles = stylex.create({
gap: spacingVars['--spacing-6'],
},
iconWrapper: {
- backgroundColor: colorVars['--color-blue-background'],
- color: colorVars['--color-blue-text'],
+ backgroundColor: colorVars['--color-background-blue'],
+ color: colorVars['--color-text-blue'],
padding: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
},
});
diff --git a/apps/storybook/stories/Collapsible.stories.tsx b/apps/storybook/stories/Collapsible.stories.tsx
index 6af90efe20..7a34178399 100644
--- a/apps/storybook/stories/Collapsible.stories.tsx
+++ b/apps/storybook/stories/Collapsible.stories.tsx
@@ -12,18 +12,18 @@ import {
const styles = stylex.create({
pageWrapper: {
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
padding: spacingVars['--spacing-6'],
},
text: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
color: colorVars['--color-text-primary'],
margin: 0,
},
textSecondary: {
color: colorVars['--color-text-secondary'],
fontSize: 14,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
margin: 0,
},
});
diff --git a/apps/storybook/stories/Field.stories.tsx b/apps/storybook/stories/Field.stories.tsx
index e576a1f1bf..87296ee917 100644
--- a/apps/storybook/stories/Field.stories.tsx
+++ b/apps/storybook/stories/Field.stories.tsx
@@ -16,15 +16,15 @@ const inputStyles = stylex.create({
root: {
width: '100%',
boxSizing: 'border-box',
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: '14px',
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
borderWidth: 1,
borderStyle: 'solid',
borderColor: colorVars['--color-border'],
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-surface'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-background-surface'],
color: colorVars['--color-text-primary'],
outline: 'none',
':focus': {
diff --git a/apps/storybook/stories/Grid.stories.tsx b/apps/storybook/stories/Grid.stories.tsx
index b146523f28..baee5bccee 100644
--- a/apps/storybook/stories/Grid.stories.tsx
+++ b/apps/storybook/stories/Grid.stories.tsx
@@ -13,26 +13,26 @@ import {
const styles = stylex.create({
container: {
padding: spacingVars['--spacing-4'],
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
},
item: {
padding: spacingVars['--spacing-4'],
- backgroundColor: colorVars['--color-wash'],
- borderRadius: radiusVars['--radius-2'],
+ backgroundColor: colorVars['--color-background-body'],
+ borderRadius: radiusVars['--radius-element'],
textAlign: 'center',
},
featuredItem: {
padding: spacingVars['--spacing-6'],
backgroundColor: colorVars['--color-accent-muted'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
textAlign: 'center',
height: '100%',
boxSizing: 'border-box',
},
cardImage: {
height: 120,
- backgroundColor: colorVars['--color-wash'],
- borderRadius: radiusVars['--radius-2'],
+ backgroundColor: colorVars['--color-background-body'],
+ borderRadius: radiusVars['--radius-element'],
marginBlockEnd: spacingVars['--spacing-3'],
},
storyWrapper: {
diff --git a/apps/storybook/stories/Layout.stories.tsx b/apps/storybook/stories/Layout.stories.tsx
index 1d19b59f7d..b08ae44638 100644
--- a/apps/storybook/stories/Layout.stories.tsx
+++ b/apps/storybook/stories/Layout.stories.tsx
@@ -28,7 +28,7 @@ const styles = stylex.create({
// Story wrapper styles
pageWrapper: {
height: 500,
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
padding: spacingVars['--spacing-4'],
},
pageWrapperTall: {
@@ -36,26 +36,26 @@ const styles = stylex.create({
},
storySection: {
padding: spacingVars['--spacing-4'],
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
},
// Typography
heading: {
margin: 0,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: 18,
fontWeight: 600,
color: colorVars['--color-text-primary'],
},
subheading: {
margin: 0,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: 14,
fontWeight: 500,
color: colorVars['--color-text-secondary'],
},
bodyText: {
margin: 0,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: 14,
lineHeight: 1.5,
color: colorVars['--color-text-secondary'],
@@ -66,7 +66,7 @@ const styles = stylex.create({
borderRadius: 6,
cursor: 'pointer',
color: colorVars['--color-text-primary'],
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: 14,
backgroundColor: {
default: 'transparent',
@@ -75,29 +75,29 @@ const styles = stylex.create({
},
navItemActive: {
backgroundColor: colorVars['--color-accent-muted'],
- color: colorVars['--color-text-link'],
+ color: colorVars['--color-text-accent'],
},
// Content placeholder
placeholder: {
- backgroundColor: colorVars['--color-gray-background'],
+ backgroundColor: colorVars['--color-background-gray'],
borderRadius: 8,
padding: spacingVars['--spacing-4'],
color: colorVars['--color-text-secondary'],
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: 14,
},
// Full bleed placeholder (no radius, no padding)
placeholderFullBleed: {
- backgroundColor: colorVars['--color-gray-background'],
+ backgroundColor: colorVars['--color-background-gray'],
padding: spacingVars['--spacing-4'],
color: colorVars['--color-text-secondary'],
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: 14,
minHeight: 100,
},
sectionLabel: {
margin: `0 0 ${spacingVars['--spacing-2']} 0`,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: 12,
fontWeight: 600,
textTransform: 'uppercase',
@@ -106,9 +106,9 @@ const styles = stylex.create({
},
// Demo container styling to visualize bounds
demoContainer: {
- backgroundColor: colorVars['--color-card'],
- borderRadius: radiusVars['--radius-3'],
- boxShadow: shadowVars['--shadow-base'],
+ backgroundColor: colorVars['--color-background-card'],
+ borderRadius: radiusVars['--radius-container'],
+ boxShadow: shadowVars['--shadow-low'],
},
// Demo sizing for outer padding story
demoSize: {
diff --git a/apps/storybook/stories/Section.stories.tsx b/apps/storybook/stories/Section.stories.tsx
index 0ebb39fbd4..3dc7a6b4df 100644
--- a/apps/storybook/stories/Section.stories.tsx
+++ b/apps/storybook/stories/Section.stories.tsx
@@ -18,15 +18,15 @@ import {
const styles = stylex.create({
surfaceWrapper: {
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
padding: spacingVars['--spacing-6'],
},
pageWrapper: {
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
padding: spacingVars['--spacing-6'],
},
text: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -41,7 +41,7 @@ const styles = stylex.create({
},
heading: {
margin: `0 0 ${spacingVars['--spacing-2']} 0`,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: 14,
color: colorVars['--color-text-secondary'],
},
diff --git a/apps/storybook/stories/Stack.stories.tsx b/apps/storybook/stories/Stack.stories.tsx
index 1c9e09e485..b1d0e06ccc 100644
--- a/apps/storybook/stories/Stack.stories.tsx
+++ b/apps/storybook/stories/Stack.stories.tsx
@@ -10,40 +10,40 @@ import {
const styles = stylex.create({
box: {
- backgroundColor: colorVars['--color-blue-background'],
- color: colorVars['--color-blue-text'],
+ backgroundColor: colorVars['--color-background-blue'],
+ color: colorVars['--color-text-blue'],
borderWidth: 1,
borderStyle: 'solid',
- borderColor: colorVars['--color-blue-border'],
+ borderColor: colorVars['--color-border-blue'],
paddingBlock: spacingVars['--spacing-4'],
paddingInline: spacingVars['--spacing-6'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
fontWeight: 500,
height: '100%',
boxSizing: 'border-box',
},
boxAlt: {
- backgroundColor: colorVars['--color-gray-background'],
- color: colorVars['--color-gray-text'],
- borderColor: colorVars['--color-gray-border'],
+ backgroundColor: colorVars['--color-background-gray'],
+ color: colorVars['--color-text-gray'],
+ borderColor: colorVars['--color-border-gray'],
},
boxGreen: {
- backgroundColor: colorVars['--color-green-background'],
- color: colorVars['--color-green-text'],
- borderColor: colorVars['--color-green-border'],
+ backgroundColor: colorVars['--color-background-green'],
+ color: colorVars['--color-text-green'],
+ borderColor: colorVars['--color-border-green'],
},
boxPurple: {
- backgroundColor: colorVars['--color-purple-background'],
- color: colorVars['--color-purple-text'],
- borderColor: colorVars['--color-purple-border'],
+ backgroundColor: colorVars['--color-background-purple'],
+ color: colorVars['--color-text-purple'],
+ borderColor: colorVars['--color-border-purple'],
},
boxOrange: {
- backgroundColor: colorVars['--color-orange-background'],
- color: colorVars['--color-orange-text'],
- borderColor: colorVars['--color-orange-border'],
+ backgroundColor: colorVars['--color-background-orange'],
+ color: colorVars['--color-text-orange'],
+ borderColor: colorVars['--color-border-orange'],
},
container: {
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
},
containerWidth: {
width: 300,
@@ -86,7 +86,7 @@ const styles = stylex.create({
},
heading: {
margin: `0 0 ${spacingVars['--spacing-2']} 0`,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
},
});
diff --git a/apps/storybook/stories/Table.stories.tsx b/apps/storybook/stories/Table.stories.tsx
index ae337817de..e40276a9c4 100644
--- a/apps/storybook/stories/Table.stories.tsx
+++ b/apps/storybook/stories/Table.stories.tsx
@@ -204,16 +204,16 @@ export const CustomCellRenderer: Story = {
<span
style={{
padding: `${spacingDefaults['--spacing-0-5']} ${spacingDefaults['--spacing-2']}`,
- borderRadius: radiusDefaults['--radius-1'],
- fontSize: textSizeDefaults['--text-xsm'],
+ borderRadius: radiusDefaults['--radius-inner'],
+ fontSize: textSizeDefaults['--font-size-xs'],
backgroundColor:
item.role === 'Engineer'
- ? colorDefaults['--color-blue-background']
- : colorDefaults['--color-purple-background'],
+ ? colorDefaults['--color-background-blue']
+ : colorDefaults['--color-background-purple'],
color:
item.role === 'Engineer'
- ? colorDefaults['--color-blue-text']
- : colorDefaults['--color-purple-text'],
+ ? colorDefaults['--color-text-blue']
+ : colorDefaults['--color-text-purple'],
}}>
{item.role}
</span>
diff --git a/internal/eslint-plugin-xds/README.md b/internal/eslint-plugin-xds/README.md
index 53b392b840..6e3c9819e6 100644
--- a/internal/eslint-plugin-xds/README.md
+++ b/internal/eslint-plugin-xds/README.md
@@ -47,7 +47,7 @@ const styles = stylex.create({
```tsx
const styles = stylex.create({
text: {
- fontSize: textSizeVars['--text-base'], // ✅ Token
+ fontSize: textSizeVars['--font-size-base'], // ✅ Token
fontWeight: fontWeightVars['--font-weight-semibold'], // ✅ Token
color: colorVars['--color-error'], // ✅ Token
},
diff --git a/internal/eslint-plugin-xds/index.js b/internal/eslint-plugin-xds/index.js
index 30d5102aa8..a32e2b845e 100644
--- a/internal/eslint-plugin-xds/index.js
+++ b/internal/eslint-plugin-xds/index.js
@@ -28,7 +28,7 @@ const STYLE_PROPERTIES = {
pattern: /^['"]?\d+(\.\d+)?(px|rem|em)['"]?$/,
tokenVar: 'textSizeVars',
message: 'Use textSizeVars token instead of hardcoded fontSize',
- examples: ["textSizeVars['--text-xsm']", "textSizeVars['--text-base']"],
+ examples: ["textSizeVars['--font-size-xs']", "textSizeVars['--font-size-base']"],
},
fontWeight: {
pattern: /^\d{3}$/,
@@ -81,7 +81,7 @@ const STYLE_PROPERTIES = {
pattern: /^['"]?(#[0-9a-fA-F]{3,8}|rgba?\([^)]+\))['"]?$/,
tokenVar: 'colorVars',
message: 'Use colorVars token instead of hardcoded backgroundColor',
- examples: ["colorVars['--color-surface']"],
+ examples: ["colorVars['--color-background-surface']"],
},
borderColor: {
pattern: /^['"]?(#[0-9a-fA-F]{3,8}|rgba?\([^)]+\))['"]?$/,
diff --git a/internal/vibe-tests/.generated/xds-tailwind-skill.md b/internal/vibe-tests/.generated/xds-tailwind-skill.md
index b37e5c6c7f..7270a6bec3 100644
--- a/internal/vibe-tests/.generated/xds-tailwind-skill.md
+++ b/internal/vibe-tests/.generated/xds-tailwind-skill.md
@@ -215,41 +215,41 @@ XDS provides CSS custom properties you can reference alongside Tailwind utilitie
### Color Tokens
-| Token | Usage |
-| --------------------------- | -------------------- |
-| var(--color-accent) | Primary action color |
-| var(--color-surface) | Background surface |
-| var(--color-wash) | Secondary background |
-| var(--color-success) | Success states |
-| var(--color-error) | Error states |
-| var(--color-warning) | Warning states |
-| var(--color-text-primary) | Main text |
-| var(--color-text-secondary) | Secondary text |
-| var(--color-text-link) | Link text |
+| Token | Usage |
+| ------------------------------- | -------------------- |
+| var(--color-accent) | Primary action color |
+| var(--color-background-surface) | Background surface |
+| var(--color-background-body) | Secondary background |
+| var(--color-success) | Success states |
+| var(--color-error) | Error states |
+| var(--color-warning) | Warning states |
+| var(--color-text-primary) | Main text |
+| var(--color-text-secondary) | Secondary text |
+| var(--color-text-accent) | Link text |
### Radius Tokens
-| Token | Value | Usage |
-| --------------------- | ------ | --------------- |
-| var(--radius-rounded) | 9999px | Pills, avatars |
-| var(--radius-3) | 12px | Cards, modals |
-| var(--radius-2) | 8px | Buttons, inputs |
-| var(--radius-1) | 4px | Small elements |
+| Token | Value | Usage |
+| ----------------------- | ------ | --------------- |
+| var(--radius-full) | 9999px | Pills, avatars |
+| var(--radius-container) | 12px | Cards, modals |
+| var(--radius-element) | 8px | Buttons, inputs |
+| var(--radius-inner) | 4px | Small elements |
### Size Tokens
-| Token | Value | Usage |
-| -------------- | ----- | -------------------- |
-| var(--size-sm) | 28px | Compact controls |
-| var(--size-md) | 32px | Default control size |
-| var(--size-lg) | 36px | Larger controls |
+| Token | Value | Usage |
+| ---------------------- | ----- | -------------------- |
+| var(--size-element-sm) | 28px | Compact controls |
+| var(--size-element-md) | 32px | Default control size |
+| var(--size-element-lg) | 36px | Larger controls |
### Using Tokens with Tailwind
You can reference XDS tokens in Tailwind arbitrary values:
```tsx
-<div className="p-[var(--spacing-4)] bg-[var(--color-surface)] rounded-[var(--radius-3)]">
+<div className="p-[var(--spacing-4)] bg-[var(--color-background-surface)] rounded-[var(--radius-container)]">
Content
</div>
```
@@ -257,8 +257,8 @@ You can reference XDS tokens in Tailwind arbitrary values:
Or simply use Tailwind's built-in scale which maps closely:
- `p-4` ≈ var(--spacing-4) (16px)
-- `rounded-xl` ≈ var(--radius-3) (12px)
-- `rounded-lg` ≈ var(--radius-2) (8px)
+- `rounded-xl` ≈ var(--radius-container) (12px)
+- `rounded-lg` ≈ var(--radius-element) (8px)
## Theme System
@@ -280,7 +280,7 @@ Create themes by overriding CSS custom properties:
const myTheme = {
...defaultTheme,
'--color-accent': '#7B61FF',
- '--color-surface': '#1A1A2E',
+ '--color-background-surface': '#1A1A2E',
};
<XDSTheme theme={myTheme}>
diff --git a/internal/vibe-tests/app/src/report/report.css b/internal/vibe-tests/app/src/report/report.css
index e18dd1015b..896a122c4b 100644
--- a/internal/vibe-tests/app/src/report/report.css
+++ b/internal/vibe-tests/app/src/report/report.css
@@ -22,7 +22,7 @@
font-family: ui-monospace, "SF Mono", Menlo, monospace;
font-size: 13px;
line-height: 1.5;
- background-color: var(--color-wash);
+ background-color: var(--color-background-body);
border-radius: 6px;
padding: var(--spacing-3);
overflow: auto;
@@ -140,7 +140,7 @@
/* === Report === */
.report-root {
min-height: 100vh;
- background-color: var(--color-wash);
+ background-color: var(--color-background-body);
}
.report-container {
diff --git a/internal/vibe-tests/docs/job-taxonomy.md b/internal/vibe-tests/docs/job-taxonomy.md
index 2fa70965e0..6910414152 100644
--- a/internal/vibe-tests/docs/job-taxonomy.md
+++ b/internal/vibe-tests/docs/job-taxonomy.md
@@ -69,7 +69,7 @@ const styles = stylex.create({
flexDirection: 'column',
gap: 'var(--spacing-4)',
padding: 'var(--spacing-6)',
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
},
});
```
diff --git a/internal/vibe-tests/prompts/evaluator.md b/internal/vibe-tests/prompts/evaluator.md
index a8a482943f..3ae369911d 100644
--- a/internal/vibe-tests/prompts/evaluator.md
+++ b/internal/vibe-tests/prompts/evaluator.md
@@ -74,17 +74,17 @@ XDS uses specific CSS variable naming. **Any variable not matching these pattern
**Valid CSS variable prefixes:**
-| Category | Prefix | Examples |
-| ------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------- |
-| Colors | `--color-*` | `--color-surface`, `--color-text-primary`, `--color-accent` |
-| Spacing | `--spacing-*` | `--spacing-0` through `--spacing-7` |
-| Radius | `--radius-*` | `--radius-0`, `--radius-1`, `--radius-2`, `--radius-3`, `--radius-4`, `--radius-rounded` |
-| Shadow | `--shadow-*`, `--inset-shadow-border-*` | `--shadow-base`, `--shadow-dialog`, `--inset-shadow-border-hover` |
-| Transitions | `--transition-*` | `--transition-fast`, `--transition-normal` |
-| Font families | `--font-body`, `--font-code`, `--font-heading` | (only these three) |
-| Text sizes | `--text-*` | `--text-base`, `--text-sm`, `--text-lg`, `--text-xl` |
-| Line heights | `--leading-*` | `--leading-tight`, `--leading-normal`, `--leading-relaxed` |
-| Font weights | `--font-weight-*` | `--font-weight-normal`, `--font-weight-bold` |
+| Category | Prefix | Examples |
+| ------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
+| Colors | `--color-*` | `--color-background-surface`, `--color-text-primary`, `--color-accent` |
+| Spacing | `--spacing-*` | `--spacing-0` through `--spacing-7` |
+| Radius | `--radius-*` | `--radius-none`, `--radius-inner`, `--radius-element`, `--radius-container`, `--radius-container`, `--radius-full` |
+| Shadow | `--shadow-*`, `--inset-shadow-border-*` | `--shadow-low`, `--shadow-high`, `--shadow-inset-hover` |
+| Transitions | `--transition-*` | `--transition-fast`, `--transition-normal` |
+| Font families | `--font-family-body`, `--font-family-code`, `--font-family-heading` | (only these three) |
+| Text sizes | `--text-*` | `--font-size-base`, `--font-size-sm`, `--font-size-lg`, `--font-size-xl` |
+| Line heights | `--leading-*` | `--leading-tight`, `--leading-normal`, `--leading-relaxed` |
+| Font weights | `--font-weight-*` | `--font-weight-normal`, `--font-weight-bold` |
**Common hallucinations to flag:**
@@ -92,7 +92,7 @@ XDS uses specific CSS variable naming. **Any variable not matching these pattern
- `--xds-color-*`, `--xds-space-*`, `--xds-font-*` (INVALID)
- `--space-*` instead of `--spacing-*`
- `--border-*` (doesn't exist - use `--color-border` or component props)
-- `--font-family-*` (doesn't exist - use `--font-body`, `--font-code`, `--font-heading`)
+- `--font-family-*` (doesn't exist - use `--font-family-body`, `--font-family-code`, `--font-family-heading`)
- `--font-size-*` (doesn't exist - use `--text-*`)
- `--elevation-*` (doesn't exist - use `--shadow-*` and `--inset-shadow-border-*`)
@@ -102,7 +102,7 @@ When you detect a hallucinated CSS variable, create an escape hatch entry:
{
"type": "hallucination",
"severity": "critical",
- "detail": "Used non-existent CSS variable --xds-font-family-base. Valid alternatives: --font-body, --font-code, --font-heading",
+ "detail": "Used non-existent CSS variable --xds-font-family-base. Valid alternatives: --font-family-body, --font-family-code, --font-family-heading",
"codeSnippet": "fontFamily: 'var(--xds-font-family-base)'"
}
```
diff --git a/internal/vibe-tests/prompts/radius-evaluator.md b/internal/vibe-tests/prompts/radius-evaluator.md
index 3278a51444..eb32dfaeb9 100644
--- a/internal/vibe-tests/prompts/radius-evaluator.md
+++ b/internal/vibe-tests/prompts/radius-evaluator.md
@@ -15,24 +15,25 @@ You will receive:
### Semantic (current)
-| Token | Value | Usage |
-| ---------------- | ------ | --------------- |
-| --radius-rounded | 9999px | Pills, avatars |
-| --radius-3 | 12px | Cards, modals |
-| --radius-2 | 8px | Buttons, inputs |
-| --radius-1 | 4px | Small elements |
-| --radius-0 | 0px | No radius |
+| Token | Value | Usage |
+| ------------------ | ------ | ------------------------ |
+| --radius-full | 9999px | Pills, avatars |
+| --radius-page | 28px | Page sections, app shell |
+| --radius-container | 12px | Cards, modals |
+| --radius-element | 8px | Buttons, inputs |
+| --radius-inner | 4px | Small elements |
+| --radius-none | 0px | No radius |
### Numeric (proposed)
-| Token | Value | Usage |
-| ---------------- | ------ | ------------------------------- |
-| --radius-rounded | 9999px | Pills, avatars |
-| --radius-4 | 16px | Page sections, large containers |
-| --radius-3 | 12px | Cards, modals |
-| --radius-2 | 8px | Buttons, inputs |
-| --radius-1 | 4px | Small elements |
-| --radius-0 | 0px | No radius |
+| Token | Value | Usage |
+| ------------------ | ------ | ------------------------------- |
+| --radius-full | 9999px | Pills, avatars |
+| --radius-page | 28px | Page sections, large containers |
+| --radius-container | 12px | Cards, modals |
+| --radius-element | 8px | Buttons, inputs |
+| --radius-inner | 4px | Small elements |
+| --radius-none | 0px | No radius |
## Evaluation Criteria
@@ -50,15 +51,15 @@ Did the LLM pick the **right radius level** for each element?
Did the LLM invent tokens that don't exist in the given scheme?
-- In semantic mode: using --radius-1, --radius-2, etc. is a hallucination
-- In numeric mode: using --radius-3, --radius-2, etc. is a hallucination
+- In semantic mode: using --radius-inner, --radius-element, etc. is a hallucination
+- In numeric mode: using --radius-container, --radius-element, etc. is a hallucination
- In either mode: using --xds-radius-_, --border-radius-_, etc. is a hallucination
### 3. Hardcoded Values
Did the LLM use raw pixel values instead of tokens?
-- `borderRadius: '12px'` instead of `var(--radius-3)` or `var(--radius-3)`
+- `borderRadius: '12px'` instead of `var(--radius-container)` or `var(--radius-container)`
- This is an anti-pattern (hardcoded_radius)
### 4. Radius Hierarchy
@@ -83,7 +84,7 @@ Return JSON:
"success": true/false,
"componentsUsed": ["XDSCard", ...],
"componentsExpected": ["XDSCard", ...],
- "radiusTokensUsed": ["--radius-3", ...],
+ "radiusTokensUsed": ["--radius-container", ...],
"radiusSelectionCorrect": true/false,
"radiusSelectionDetail": "Correctly used container radius for card, element radius for button",
"escapeHatches": [...],
diff --git a/internal/vibe-tests/src/aggregate.ts b/internal/vibe-tests/src/aggregate.ts
index a446aa7167..42281f419e 100644
--- a/internal/vibe-tests/src/aggregate.ts
+++ b/internal/vibe-tests/src/aggregate.ts
@@ -836,7 +836,7 @@ function detectEscapeHatches(
type: 'hardcoded_typography',
severity: 'acceptable',
detail:
- 'Hardcoded fontFamily instead of using --font-body, --font-heading, or --font-code tokens',
+ 'Hardcoded fontFamily instead of using --font-family-body, --font-family-heading, or --font-family-code tokens',
codeSnippet: match[0],
});
}
@@ -850,7 +850,7 @@ function detectEscapeHatches(
type: 'hallucinated_typography_token',
severity: 'critical',
detail:
- 'Hallucinated typography CSS variable. Valid tokens: --text-*, --font-body, --font-code, --font-heading, --font-weight-*, --leading-*',
+ 'Hallucinated typography CSS variable. Valid tokens: --text-*, --font-family-body, --font-family-code, --font-family-heading, --font-weight-*, --leading-*',
codeSnippet: match[0],
});
}
diff --git a/internal/vibe-tests/src/quality-agent.ts b/internal/vibe-tests/src/quality-agent.ts
index b6775f9936..99a580683c 100644
--- a/internal/vibe-tests/src/quality-agent.ts
+++ b/internal/vibe-tests/src/quality-agent.ts
@@ -199,7 +199,7 @@ The code should use:
- **XDSFontWrapper** is a global provider that styles native HTML elements with proper typography — raw HTML is acceptable for prose/markdown content rendered within it
- For structured UI (cards, forms, dashboards), prefer XDSHeading/XDSText over raw HTML for access to props like \`weight\`, \`maxLines\`, \`variant\`, \`hasTabularNumbers\`
- Never hardcode fontSize, fontWeight, lineHeight, or fontFamily — use the component type system or design tokens
-- Valid typography tokens: \`--text-*\` (sizes), \`--font-weight-*\` (weights), \`--leading-*\` (line heights), \`--font-body\`, \`--font-code\`, \`--font-heading\` (font families)
+- Valid typography tokens: \`--text-*\` (sizes), \`--font-weight-*\` (weights), \`--leading-*\` (line heights), \`--font-family-body\`, \`--font-family-code\`, \`--font-family-heading\` (font families)
- Common hallucinated tokens to flag: \`--font-size-*\`, \`--font-family-*\`, \`--xds-font-*\` (these don't exist)`
: `
## Design System Context (shadcn/Tailwind)
diff --git a/internal/vibe-tests/test-sets/radius-tokens.json b/internal/vibe-tests/test-sets/radius-tokens.json
index 3d787e276c..edfcd3995c 100644
--- a/internal/vibe-tests/test-sets/radius-tokens.json
+++ b/internal/vibe-tests/test-sets/radius-tokens.json
@@ -1,6 +1,6 @@
{
"name": "radius-tokens",
- "description": "Focused test set for evaluating radius token naming: semantic (--radius-container) vs numeric scale (--radius-1 through --radius-4). Tests whether LLMs correctly select and apply radius tokens.",
+ "description": "Focused test set for evaluating radius token naming: semantic (--radius-container) vs numeric scale (--radius-inner through --radius-container). Tests whether LLMs correctly select and apply radius tokens.",
"prompts": [
{
"id": "rad-1",
diff --git a/packages/cli/docs/principles.doc.mjs b/packages/cli/docs/principles.doc.mjs
index 5511d77359..358eda25a9 100644
--- a/packages/cli/docs/principles.doc.mjs
+++ b/packages/cli/docs/principles.doc.mjs
@@ -97,8 +97,8 @@ const overrides = stylex.create({
const styles = stylex.create({
container: {
padding: 'var(--spacing-4)',
- backgroundColor: 'var(--color-surface)',
- borderRadius: 'var(--radius-2)',
+ backgroundColor: 'var(--color-background-surface)',
+ borderRadius: 'var(--radius-element)',
},
});
diff --git a/packages/cli/docs/principles.md b/packages/cli/docs/principles.md
index dd1f7f522c..04bdd939f9 100644
--- a/packages/cli/docs/principles.md
+++ b/packages/cli/docs/principles.md
@@ -66,8 +66,8 @@ import * as stylex from '@stylexjs/stylex';
const styles = stylex.create({
container: {
padding: 'var(--spacing-4)',
- backgroundColor: 'var(--color-surface)',
- borderRadius: 'var(--radius-2)',
+ backgroundColor: 'var(--color-background-surface)',
+ borderRadius: 'var(--radius-element)',
},
});
diff --git a/packages/cli/docs/theme.doc.mjs b/packages/cli/docs/theme.doc.mjs
index b98217b805..ff83526d29 100644
--- a/packages/cli/docs/theme.doc.mjs
+++ b/packages/cli/docs/theme.doc.mjs
@@ -80,7 +80,7 @@ import {colorVars, colorDefaults} from '@xds/core/theme/tokens.stylex';
const colorOverrides = {
'--color-accent': 'light-dark(#7B61FF, #9B85FF)',
- '--color-surface': 'light-dark(#FFFFFF, #1A1A2E)',
+ '--color-background-surface': 'light-dark(#FFFFFF, #1A1A2E)',
// ... all ~60 color tokens (see npx xds docs tokens)
} as const;
@@ -148,8 +148,8 @@ const myTheme = defineTheme({
headers: ['Config', 'Generates', 'Parameters'],
rows: [
['typography.scale', '--heading-*-size/weight/leading, --text-*-size/weight/leading', 'base (px), ratio'],
- ['typography.body/heading/code', '--font-body, --font-heading, --font-code', 'family, fallbacks?, url?, weight?'],
- ['radius', '--radius-0 through --radius-4, --radius-rounded', 'base (px), multiplier (0–2)'],
+ ['typography.body/heading/code', '--font-family-body, --font-family-heading, --font-family-code', 'family, fallbacks?, url?, weight?'],
+ ['radius', '--radius-none through --radius-page, --radius-full', 'base (px), multiplier (0–2)'],
['motion', '--duration-fast-*, --duration-medium-*, --ease-*', 'fast (ms), medium (ms), ratio, easing?'],
],
},
@@ -221,7 +221,7 @@ const myTheme = defineTheme({
label: 'Applying background color',
code: `const styles = stylex.create({
page: {
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
minHeight: '100vh',
},
});
@@ -252,7 +252,7 @@ const myTheme = defineTheme({
padding: '2px',
},
content: {
- backgroundColor: 'var(--color-card)',
+ backgroundColor: 'var(--color-background-card)',
borderRadius: '18px',
},
});
diff --git a/packages/cli/docs/theme.md b/packages/cli/docs/theme.md
index 02e4ea4a53..b4f9e5199c 100644
--- a/packages/cli/docs/theme.md
+++ b/packages/cli/docs/theme.md
@@ -54,7 +54,7 @@ import {colorVars, colorDefaults} from '@xds/core/theme/tokens.stylex';
// 1. Define your color overrides
const colorOverrides = {
'--color-accent': 'light-dark(#7B61FF, #9B85FF)',
- '--color-surface': 'light-dark(#FFFFFF, #1A1A2E)',
+ '--color-background-surface': 'light-dark(#FFFFFF, #1A1A2E)',
// ... all ~60 color tokens (see npx xds docs tokens)
} as const;
@@ -157,7 +157,7 @@ const myTheme = defineTheme({
| Config | What it generates | Parameters |
| ------------------ | ----------------------------------------------------------------- | -------------------------------- |
| `typography.scale` | `--heading-*-size/weight/leading`, `--text-*-size/weight/leading` | `base` (px), `ratio`, `weights?` |
-| `radius` | `--radius-0` through `--radius-4`, `--radius-rounded` | `base` (px), `multiplier` (0–2) |
+| `radius` | `--radius-none` through `--radius-page`, `--radius-full` | `base` (px), `multiplier` (0–2) |
Explicit `tokens` overrides always take precedence over scale-generated values.
@@ -221,7 +221,7 @@ To apply the theme's background color, add it to a wrapper element via StyleX:
```tsx
const styles = stylex.create({
page: {
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
minHeight: '100vh',
},
});
@@ -264,7 +264,7 @@ const cardOverrides = stylex.create({
padding: '2px', // gradient border width
},
content: {
- backgroundColor: 'var(--color-card)',
+ backgroundColor: 'var(--color-background-card)',
borderRadius: '18px', // inner radius = outer - padding
},
});
diff --git a/packages/cli/docs/tokens.doc.mjs b/packages/cli/docs/tokens.doc.mjs
index 3cda919de4..71bb5b3d33 100644
--- a/packages/cli/docs/tokens.doc.mjs
+++ b/packages/cli/docs/tokens.doc.mjs
@@ -46,9 +46,9 @@ export const docs = {
type: 'table',
headers: ['Token', 'Value', 'Usage'],
rows: [
- ['--size-sm', '28px', 'Compact controls'],
- ['--size-md', '32px', 'Default control size'],
- ['--size-lg', '36px', 'Larger, more prominent controls'],
+ ['--size-element-sm', '28px', 'Compact controls'],
+ ['--size-element-md', '32px', 'Default control size'],
+ ['--size-element-lg', '36px', 'Larger, more prominent controls'],
],
},
],
@@ -65,8 +65,8 @@ export const docs = {
headers: ['Token', 'Usage'],
rows: [
['--color-accent', 'Primary action color'],
- ['--color-surface', 'Background surface'],
- ['--color-wash', 'Secondary background'],
+ ['--color-background-surface', 'Background surface'],
+ ['--color-background-body', 'Secondary background'],
['--color-success', 'Success states'],
['--color-error', 'Error states'],
['--color-warning', 'Warning states'],
@@ -79,7 +79,7 @@ export const docs = {
['--color-text-primary', 'Main text'],
['--color-text-secondary', 'Secondary text'],
['--color-text-disabled', 'Disabled text'],
- ['--color-text-link', 'Link text'],
+ ['--color-text-accent', 'Link text'],
],
},
{
@@ -104,12 +104,12 @@ export const docs = {
type: 'table',
headers: ['Token', 'Value', 'Usage', 'Scales'],
rows: [
- ['--radius-0', '0px', 'No radius (dividers, table cells)', 'No'],
- ['--radius-1', '4px', 'Code blocks, inner content', 'Yes'],
- ['--radius-2', '8px', 'Buttons, inputs, text areas', 'Yes'],
- ['--radius-3', '12px', 'Cards, modals, popovers, dropdowns', 'Yes'],
- ['--radius-4', '16px', 'Page sections, large containers', 'Yes'],
- ['--radius-rounded', '9999px', 'Badges, avatars, status dots, toggles', 'No'],
+ ['--radius-none', '0px', 'No radius (dividers, table cells)', 'No'],
+ ['--radius-inner', '4px', 'Code blocks, inner content', 'Yes'],
+ ['--radius-element', '8px', 'Buttons, inputs, text areas', 'Yes'],
+ ['--radius-container', '12px', 'Cards, modals, popovers, dropdowns', 'Yes'],
+ ['--radius-page', '28px', 'Page sections, large containers', 'Yes'],
+ ['--radius-full', '9999px', 'Badges, avatars, status dots, toggles', 'No'],
],
},
{
@@ -132,7 +132,7 @@ const roundedTheme = defineTheme({
const sharpTheme = defineTheme({
name: 'sharp',
radius: { base: 4, multiplier: 0 },
- tokens: { '--radius-rounded': '0px' }, // even pills are sharp
+ tokens: { '--radius-full': '0px' }, // even pills are sharp
});`,
},
],
@@ -144,15 +144,14 @@ const sharpTheme = defineTheme({
type: 'table',
headers: ['Token', 'Usage'],
rows: [
- ['--shadow-base', 'Subtle lift (cards)'],
- ['--shadow-menu', 'Floating elements (menus, popovers)'],
- ['--shadow-hover', 'Hover lift, toasts'],
- ['--shadow-dialog', 'Dialogs, modals'],
- ['--inset-shadow-border-hover', 'Input hover ring'],
- ['--inset-shadow-border-accent', 'Input focused/active ring'],
- ['--inset-shadow-border-positive', 'Input success ring'],
- ['--inset-shadow-border-warning', 'Input warning ring'],
- ['--inset-shadow-border-negative', 'Input error ring'],
+ ['--shadow-low', 'Subtle lift (cards, menus, popovers)'],
+ ['--shadow-med', 'Hover lift, toasts'],
+ ['--shadow-high', 'Dialogs, modals'],
+ ['--shadow-inset-hover', 'Input hover ring'],
+ ['--shadow-inset-selected', 'Input focused/active ring'],
+ ['--shadow-inset-success', 'Input success ring'],
+ ['--shadow-inset-warning', 'Input warning ring'],
+ ['--shadow-inset-error', 'Input error ring'],
],
},
],
@@ -164,26 +163,26 @@ const sharpTheme = defineTheme({
type: 'list',
style: 'unordered',
items: [
- '--font-body: System UI font stack',
- '--font-code: Monospace font stack',
- '--font-heading: System UI font stack',
+ '--font-family-body: System UI font stack',
+ '--font-family-code: Monospace font stack',
+ '--font-family-heading: System UI font stack',
],
},
{
type: 'table',
headers: ['Token', 'Value'],
rows: [
- ['--text-4xs', '8px'],
- ['--text-3xs', '10px'],
- ['--text-2xs', '11px'],
- ['--text-xsm', '12px'],
- ['--text-sm', '13px'],
- ['--text-base', '14px (default)'],
- ['--text-lg', '16px'],
- ['--text-xl', '18px'],
- ['--text-2xl', '20px'],
- ['--text-3xl', '24px'],
- ['--text-4xl', '32px'],
+ ['--font-size-4xs', '8px'],
+ ['--font-size-3xs', '10px'],
+ ['--font-size-2xs', '11px'],
+ ['--font-size-xs', '12px'],
+ ['--font-size-sm', '13px'],
+ ['--font-size-base', '14px (default)'],
+ ['--font-size-lg', '16px'],
+ ['--font-size-xl', '18px'],
+ ['--font-size-2xl', '20px'],
+ ['--font-size-3xl', '24px'],
+ ['--font-size-4xl', '32px'],
],
},
{
@@ -202,7 +201,7 @@ const sharpTheme = defineTheme({
rows: [
['--leading-tight', '1.25', 'Display text, headings'],
['--leading-snug', '1.375', 'Compact body text, headings'],
- ['--leading-base', '1.4286', 'Body text with --text-base'],
+ ['--leading-base', '1.4286', 'Body text with --font-size-base'],
['--leading-normal', '1.5', 'Body text, large body'],
['--leading-relaxed', '1.625', 'Editorial body, reading text'],
],
@@ -222,11 +221,11 @@ import {colorVars, spacingVars, sizeVars, radiusVars} from '@xds/core';
const styles = stylex.create({
card: {
padding: spacingVars['--spacing-4'],
- backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-3'],
+ backgroundColor: colorVars['--color-background-surface'],
+ borderRadius: radiusVars['--radius-container'],
},
button: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
});`,
},
@@ -237,8 +236,8 @@ const styles = stylex.create({
code: `const styles = stylex.create({
card: {
padding: 'var(--spacing-4)',
- backgroundColor: 'var(--color-surface)',
- borderRadius: 'var(--radius-3)',
+ backgroundColor: 'var(--color-background-surface)',
+ borderRadius: 'var(--radius-container)',
},
});`,
},
diff --git a/packages/cli/docs/tokens.md b/packages/cli/docs/tokens.md
index a5bc12f3fc..8bdf0a74bc 100644
--- a/packages/cli/docs/tokens.md
+++ b/packages/cli/docs/tokens.md
@@ -27,40 +27,46 @@ Component gap props use `space0`-`space12` which map to these tokens.
Control heights for consistent sizing across buttons, inputs, and selectors.
-| Token | Value | Usage |
-| --------- | ----- | ------------------------------- |
-| --size-sm | 28px | Compact controls |
-| --size-md | 32px | Default control size |
-| --size-lg | 36px | Larger, more prominent controls |
+| Token | Value | Usage |
+| ----------------- | ----- | ------------------------------- |
+| --size-element-sm | 28px | Compact controls |
+| --size-element-md | 32px | Default control size |
+| --size-element-lg | 36px | Larger, more prominent controls |
## Color Tokens
### Semantic Colors
-| Token | Usage |
-| --------------- | -------------------------------------------- |
-| --color-accent | Primary action color |
-| --color-surface | Background surface |
-| --color-wash | Page-level background (app shell, page body) |
-| --color-success | Success states |
-| --color-error | Error states |
-| --color-warning | Warning states |
+| Token | Usage |
+| -------------------------- | -------------------------------------------- |
+| --color-accent | Primary action color |
+| --color-background-surface | Background surface |
+| --color-background-body | Page-level background (app shell, page body) |
+| --color-success | Success states |
+| --color-error | Error states |
+| --color-warning | Warning states |
+| --color-on-accent | Text/icon on accent background |
+| --color-on-success | Text/icon on success background |
+| --color-on-error | Text/icon on error background |
+| --color-on-warning | Text/icon on warning background |
+| --color-on-dark | Text/icon on dark media |
+| --color-on-light | Text/icon on light media |
### Neutral Grays
Three tokens for "gray" backgrounds. Choosing the right one depends on what the element _is_:
-| Token | Role | Use for |
-| --------------------- | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
-| --color-secondary | Neutral fill for elements | Buttons (default), badges, tokens, kbd, avatar fallback, pagination dots, status dots, selected nav items, icon containers |
-| --color-muted | Background for content areas | Sections, code blocks, table zebra stripes, progress/slider tracks, disabled input fills, featured cards |
-| --color-overlay-hover | Translucent hover/active state | Hover on ghost buttons, list item highlights, menu item highlights, table row hover |
+| Token | Role | Use for |
+| ------------------------ | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
+| --color-neutral | Neutral fill for elements | Buttons (default), badges, tokens, kbd, avatar fallback, pagination dots, status dots, selected nav items, icon containers |
+| --color-background-muted | Background for content areas | Sections, code blocks, table zebra stripes, progress/slider tracks, disabled input fills, featured cards |
+| --color-overlay-hover | Translucent hover/active state | Hover on ghost buttons, list item highlights, menu item highlights, table row hover |
**Decision tree:**
1. Is it a **hover/active/highlighted state**? → `--color-overlay-hover`
-2. Is it a **container with other content inside** (text, icons, controls)? → `--color-muted`
-3. Is it a **self-contained element sitting on a surface**? → `--color-secondary`
+2. Is it a **container with other content inside** (text, icons, controls)? → `--color-background-muted`
+3. Is it a **self-contained element sitting on a surface**? → `--color-neutral`
### Text Colors
@@ -69,28 +75,29 @@ Three tokens for "gray" backgrounds. Choosing the right one depends on what the
| --color-text-primary | Main text |
| --color-text-secondary | Secondary text |
| --color-text-disabled | Disabled text |
-| --color-text-link | Link text |
+| --color-text-accent | Link text |
### Icon Colors
| Token | Usage |
| ---------------------- | --------------- |
+| --color-icon-accent | Accent icons |
| --color-icon-primary | Main icons |
| --color-icon-secondary | Secondary icons |
| --color-icon-disabled | Disabled icons |
## Radius Tokens
-Numeric scale based on a 4dp base unit. Tokens 1–4 scale with the theme's `radius` multiplier; tokens 0 and rounded are fixed.
+Semantic scale based on a 4dp base unit. Tokens inner through page scale with the theme's `radius` multiplier; none and full are fixed.
-| Token | Value | Usage | Scales |
-| ---------------- | ------ | ------------------------------------- | ------ |
-| --radius-0 | 0px | No radius (dividers, table cells) | No |
-| --radius-1 | 4px | Code blocks, inner content | Yes |
-| --radius-2 | 8px | Buttons, inputs, text areas | Yes |
-| --radius-3 | 12px | Cards, modals, popovers, dropdowns | Yes |
-| --radius-4 | 16px | Page sections, large containers | Yes |
-| --radius-rounded | 9999px | Badges, avatars, status dots, toggles | No |
+| Token | Value | Usage | Scales |
+| ------------------ | ------ | ------------------------------------- | ------ |
+| --radius-none | 0px | No radius (dividers, table cells) | No |
+| --radius-inner | 4px | Code blocks, inner content | Yes |
+| --radius-element | 8px | Buttons, inputs, text areas | Yes |
+| --radius-container | 12px | Cards, modals, popovers, dropdowns | Yes |
+| --radius-page | 28px | Page sections, large containers | Yes |
+| --radius-full | 9999px | Badges, avatars, status dots, toggles | No |
### radius (via defineTheme)
@@ -121,46 +128,52 @@ const sharpTheme = defineTheme({
| 1.5 | Rounded | 18px |
| 2 | Pill-like | 24px |
+## Border Tokens
+
+| Token | Value | Usage |
+| -------------- | ----- | ---------------------------------- |
+| --border-width | 1px | Default border width across the UI |
+
## Shadow Tokens
-| Token | Usage |
-| ------------------------------ | ------------------------- |
-| --shadow-base | Subtle lift (cards) |
-| --shadow-menu | Floating elements (menus) |
-| --shadow-hover | Hover lift, toasts |
-| --shadow-dialog | Dialogs, modals |
-| --inset-shadow-border-hover | Input hover ring |
-| --inset-shadow-border-accent | Input focused/active ring |
-| --inset-shadow-border-positive | Input success ring |
-| --inset-shadow-border-warning | Input warning ring |
-| --inset-shadow-border-negative | Input error ring |
+| Token | Usage |
+| ----------------------- | ------------------------- |
+| --shadow-low | Subtle lift (cards) |
+| --shadow-low | Floating elements (menus) |
+| --shadow-med | Hover lift, toasts |
+| --shadow-high | Dialogs, modals |
+| --shadow-inset-hover | Input hover ring |
+| --shadow-inset-selected | Input focused/active ring |
+| --shadow-inset-success | Input success ring |
+| --shadow-inset-warning | Input warning ring |
+| --shadow-inset-error | Input error ring |
## Typography Tokens
### Font Families
-- `--font-body`: System UI font stack
-- `--font-code`: Monospace font stack
-- `--font-heading`: System UI font stack
+- `--font-family-body`: System UI font stack
+- `--font-family-code`: Monospace font stack
+- `--font-family-heading`: System UI font stack
### Text Sizes
Computed from a geometric scale: `round(base × ratio^step)`.
Default: base=14px, ratio=1.2.
-| Token | Step | Default | Usage |
-| ----------- | ---- | ------- | --------------- |
-| --text-4xs | -5 | 6px | Citation, micro |
-| --text-3xs | -4 | 7px | Micro labels |
-| --text-2xs | -3 | 8px | Small micro |
-| --text-xsm | -2 | 10px | Extra small |
-| --text-sm | -1 | 12px | Small text |
-| --text-base | 0 | 14px | Body (anchor) |
-| --text-lg | +1 | 17px | Large text |
-| --text-xl | +2 | 20px | Extra large |
-| --text-2xl | +3 | 24px | 2× large |
-| --text-3xl | +4 | 29px | 3× large |
-| --text-4xl | +5 | 35px | 4× large |
+| Token | Step | Default | Usage |
+| ---------------- | ---- | ------- | --------------- |
+| --font-size-4xs | -5 | 6px | Citation, micro |
+| --font-size-3xs | -4 | 7px | Micro labels |
+| --font-size-2xs | -3 | 8px | Small micro |
+| --font-size-xs | -2 | 10px | Extra small |
+| --font-size-sm | -1 | 12px | Small text |
+| --font-size-base | 0 | 14px | Body (anchor) |
+| --font-size-lg | +1 | 17px | Large text |
+| --font-size-xl | +2 | 20px | Extra large |
+| --font-size-2xl | +3 | 24px | 2× large |
+| --font-size-3xl | +4 | 29px | 3× large |
+| --font-size-4xl | +5 | 35px | 4× large |
### Type Scale (Semantic Tokens)
@@ -171,46 +184,60 @@ Override the entire scale with `typography.scale: { base, ratio }` in `defineThe
#### Heading Tokens
-| Token | Maps to | Default | Leading |
-| ------------------- | ---------------- | ------- | ------- |
-| --heading-1-size | var(--text-2xl) | 24px | |
-| --heading-1-weight | semibold | | |
-| --heading-1-leading | | | 1.3333 |
-| --heading-2-size | var(--text-xl) | 20px | |
-| --heading-2-weight | semibold | | |
-| --heading-2-leading | | | 1.4 |
-| --heading-3-size | var(--text-lg) | 17px | |
-| --heading-3-weight | semibold | | |
-| --heading-3-leading | | | 1.4118 |
-| --heading-4-size | var(--text-base) | 14px | |
-| --heading-4-weight | semibold | | |
-| --heading-4-leading | | | 1.4286 |
-| --heading-5-size | var(--text-sm) | 12px | |
-| --heading-5-weight | semibold | | |
-| --heading-5-leading | | | 1.6667 |
-| --heading-6-size | var(--text-xsm) | 10px | |
-| --heading-6-weight | semibold | | |
-| --heading-6-leading | | | 1.6 |
+| Token | Maps to | Default | Leading |
+| ------------------------ | --------------------- | ------- | ------- |
+| --text-heading-1-size | var(--font-size-2xl) | 24px | |
+| --text-heading-1-weight | semibold | | |
+| --text-heading-1-leading | | | 1.3333 |
+| --text-heading-2-size | var(--font-size-xl) | 20px | |
+| --text-heading-2-weight | semibold | | |
+| --text-heading-2-leading | | | 1.4 |
+| --text-heading-3-size | var(--font-size-lg) | 17px | |
+| --text-heading-3-weight | semibold | | |
+| --text-heading-3-leading | | | 1.4118 |
+| --text-heading-4-size | var(--font-size-base) | 14px | |
+| --text-heading-4-weight | semibold | | |
+| --text-heading-4-leading | | | 1.4286 |
+| --text-heading-5-size | var(--font-size-sm) | 12px | |
+| --text-heading-5-weight | semibold | | |
+| --text-heading-5-leading | | | 1.6667 |
+| --text-heading-6-size | var(--font-size-xs) | 10px | |
+| --text-heading-6-weight | semibold | | |
+| --text-heading-6-leading | | | 1.6 |
#### Text Type Tokens
-| Token | Maps to | Default | Leading | Weight |
-| ------------------------- | ---------------- | ------- | ------- | -------- |
-| --text-body-size | var(--text-base) | 14px | | |
-| --text-body-weight | | | | normal |
-| --text-body-leading | | | 1.4286 | |
-| --text-large-size | var(--text-lg) | 17px | | |
-| --text-large-weight | | | | semibold |
-| --text-large-leading | | | 1.4118 | |
-| --text-label-size | var(--text-base) | 14px | | |
-| --text-label-weight | | | | medium |
-| --text-label-leading | | | 1.4286 | |
-| --text-code-size | var(--text-base) | 14px | | |
-| --text-code-weight | | | | normal |
-| --text-code-leading | | | 1.4286 | |
-| --text-supporting-size | var(--text-sm) | 12px | | |
-| --text-supporting-weight | | | | normal |
-| --text-supporting-leading | | | 1.6667 | |
+| Token | Maps to | Default | Leading | Weight |
+| ------------------------- | --------------------- | ------- | ------- | -------- |
+| --text-body-size | var(--font-size-base) | 14px | | |
+| --text-body-weight | | | | normal |
+| --text-body-leading | | | 1.4286 | |
+| --text-large-size | var(--font-size-lg) | 17px | | |
+| --text-large-weight | | | | semibold |
+| --text-large-leading | | | 1.4118 | |
+| --text-label-size | var(--font-size-base) | 14px | | |
+| --text-label-weight | | | | medium |
+| --text-label-leading | | | 1.4286 | |
+| --text-code-size | var(--font-size-base) | 14px | | |
+| --text-code-weight | | | | normal |
+| --text-code-leading | | | 1.4286 | |
+| --text-supporting-size | var(--font-size-sm) | 12px | | |
+| --text-supporting-weight | | | | normal |
+| --text-supporting-leading | | | 1.6667 | |
+
+#### Display Tokens
+
+| Token | Maps to | Default | Leading |
+| ------------------------ | -------------------- | ------- | ------- |
+| --text-display-1-size | var(--font-size-5xl) | 42px | |
+| --text-display-1-weight | | | normal |
+| --text-display-1-leading | | | 1.2381 |
+| --text-display-2-size | var(--font-size-4xl) | 35px | |
+| --text-display-2-weight | | | normal |
+| --text-display-2-leading | | | 1.2571 |
+| --text-display-3-size | var(--font-size-3xl) | 29px | |
+| --text-display-3-weight | | | normal |
+| --text-display-3-leading | | | 1.2414 |
### Font Weights
@@ -219,17 +246,19 @@ Override the entire scale with `typography.scale: { base, ratio }` in `defineThe
- `--font-weight-semibold`: 600
- `--font-weight-bold`: 700
-### Line Heights (Named Leading)
+### Line Heights (Named Leading) — Deprecated
-Intent-based ratios for component use. Not modified by `typography.scale`.
+> **Deprecated.** Use semantic type scale leading tokens instead.
+> Components should pair their `fontSize` with the matching semantic leading:
+> `--text-body-leading`, `--text-label-leading`, `--text-supporting-leading`, etc.
-| Token | Value | Usage |
-| ----------------- | ------ | ---------------------------- |
-| --leading-tight | 1.25 | Display text, headings |
-| --leading-snug | 1.375 | Compact body text, headings |
-| --leading-base | 1.4286 | Body text with --text-base |
-| --leading-normal | 1.5 | Body text, large body |
-| --leading-relaxed | 1.625 | Editorial body, reading text |
+| Old Token | Value | Replacement |
+| ----------------- | ------ | ------------------------- |
+| --leading-base | 1.4286 | --text-body-leading |
+| --leading-snug | 1.375 | --text-label-leading |
+| --leading-normal | 1.5 | --text-large-leading |
+| --leading-tight | 1.25 | --text-heading-1-leading |
+| --leading-relaxed | 1.625 | --text-supporting-leading |
## Usage in StyleX
@@ -240,11 +269,11 @@ import {colorVars, spacingVars, sizeVars, radiusVars} from '@xds/core';
const styles = stylex.create({
card: {
padding: spacingVars['--spacing-4'],
- backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-3'],
+ backgroundColor: colorVars['--color-background-surface'],
+ borderRadius: radiusVars['--radius-container'],
},
button: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
});
```
@@ -255,8 +284,8 @@ Or use CSS custom properties directly:
const styles = stylex.create({
card: {
padding: 'var(--spacing-4)',
- backgroundColor: 'var(--color-surface)',
- borderRadius: 'var(--radius-3)',
+ backgroundColor: 'var(--color-background-surface)',
+ borderRadius: 'var(--radius-container)',
},
});
```
diff --git a/packages/cli/src/codemods/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs b/packages/cli/src/codemods/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs
new file mode 100644
index 0000000000..53ca74ca41
--- /dev/null
+++ b/packages/cli/src/codemods/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs
@@ -0,0 +1,251 @@
+import {describe, it, expect} from 'vitest';
+
+async function applyTransform(source) {
+ const {default: transform} = await import('../migrate-token-renames.mjs');
+ const jscodeshift = (await import('jscodeshift')).default;
+ const api = {jscodeshift, stats: () => {}, report: () => {}};
+ const file = {source, path: 'test.tsx'};
+ const result = transform(file, api);
+ return result ?? source;
+}
+
+describe('migrate-token-renames (v0.0.8)', () => {
+ // === Color renames ===
+
+ it('renames --color-secondary to --color-neutral', async () => {
+ const output = await applyTransform(`const x = '--color-secondary';`);
+ expect(output).toContain('--color-neutral');
+ expect(output).not.toContain('--color-secondary');
+ });
+
+ it('renames --color-text-link to --color-text-accent', async () => {
+ const output = await applyTransform(`const x = colorVars['--color-text-link'];`);
+ expect(output).toContain('--color-text-accent');
+ expect(output).not.toContain('--color-text-link');
+ });
+
+ it('renames --color-text-on-dark-media to --color-on-dark', async () => {
+ const output = await applyTransform(`const x = '--color-text-on-dark-media';`);
+ expect(output).toContain('--color-on-dark');
+ });
+
+ it('renames background tokens', async () => {
+ const input = `const x = {
+ a: colorVars['--color-wash'],
+ b: colorVars['--color-surface'],
+ c: colorVars['--color-card'],
+ d: colorVars['--color-popover'],
+ e: colorVars['--color-muted'],
+ };`;
+ const output = await applyTransform(input);
+ expect(output).toContain('--color-background-body');
+ expect(output).toContain('--color-background-surface');
+ expect(output).toContain('--color-background-card');
+ expect(output).toContain('--color-background-popover');
+ expect(output).toContain('--color-background-muted');
+ });
+
+ it('renames --color-hover-tint to --color-tint-hover', async () => {
+ const output = await applyTransform(`const x = '--color-hover-tint';`);
+ expect(output).toContain('--color-tint-hover');
+ });
+
+ it('removes ring-focus tokens by mapping to accent/status', async () => {
+ const input = `const x = {
+ a: colorVars['--color-ring-focus'],
+ b: colorVars['--color-ring-focus-error'],
+ c: colorVars['--color-ring-focus-success'],
+ d: colorVars['--color-ring-focus-warning'],
+ };`;
+ const output = await applyTransform(input);
+ expect(output).toContain('--color-accent');
+ expect(output).toContain('--color-error');
+ expect(output).toContain('--color-success');
+ expect(output).toContain('--color-warning');
+ expect(output).not.toMatch(/ring-focus/);
+ });
+
+ it('renames palette tokens (reversed naming)', async () => {
+ const input = `const x = {
+ a: colorVars['--color-blue-background'],
+ b: colorVars['--color-red-text'],
+ c: colorVars['--color-green-icon'],
+ d: colorVars['--color-gray-border'],
+ };`;
+ const output = await applyTransform(input);
+ expect(output).toContain('--color-background-blue');
+ expect(output).toContain('--color-text-red');
+ expect(output).toContain('--color-icon-green');
+ expect(output).toContain('--color-border-gray');
+ });
+
+ // === Size renames ===
+
+ it('renames size tokens', async () => {
+ const output = await applyTransform(`const x = sizeVars['--size-sm'];`);
+ expect(output).toContain('--size-element-sm');
+ });
+
+ // === Radius renames ===
+
+ it('renames radius tokens from numeric to semantic', async () => {
+ const input = `const x = {
+ a: radiusVars['--radius-0'],
+ b: radiusVars['--radius-1'],
+ c: radiusVars['--radius-2'],
+ d: radiusVars['--radius-3'],
+ e: radiusVars['--radius-rounded'],
+ };`;
+ const output = await applyTransform(input);
+ expect(output).toContain('--radius-none');
+ expect(output).toContain('--radius-inner');
+ expect(output).toContain('--radius-element');
+ expect(output).toContain('--radius-container');
+ expect(output).toContain('--radius-full');
+ });
+
+ it('removes --radius-4 by mapping to --radius-container', async () => {
+ const output = await applyTransform(`const x = '--radius-4';`);
+ expect(output).toContain('--radius-container');
+ });
+
+ // === Shadow renames ===
+
+ it('renames shadow tokens', async () => {
+ const input = `const x = {
+ a: shadowVars['--shadow-base'],
+ b: shadowVars['--shadow-menu'],
+ c: shadowVars['--shadow-hover'],
+ d: shadowVars['--shadow-dialog'],
+ };`;
+ const output = await applyTransform(input);
+ expect(output).toContain('--shadow-low');
+ expect(output).toContain('--shadow-med');
+ expect(output).toContain('--shadow-high');
+ expect(output).not.toMatch(/shadow-base|shadow-menu|shadow-hover|shadow-dialog/);
+ });
+
+ it('renames inset shadow tokens', async () => {
+ const input = `const x = {
+ a: shadowVars['--inset-shadow-border-hover'],
+ b: shadowVars['--inset-shadow-border-accent'],
+ c: shadowVars['--inset-shadow-border-positive'],
+ d: shadowVars['--inset-shadow-border-warning'],
+ e: shadowVars['--inset-shadow-border-negative'],
+ };`;
+ const output = await applyTransform(input);
+ expect(output).toContain('--shadow-inset-hover');
+ expect(output).toContain('--shadow-inset-selected');
+ expect(output).toContain('--shadow-inset-success');
+ expect(output).toContain('--shadow-inset-warning');
+ expect(output).toContain('--shadow-inset-error');
+ });
+
+ // === Typography renames ===
+
+ it('renames font family tokens', async () => {
+ const output = await applyTransform(`const x = 'var(--font-heading)';`);
+ expect(output).toContain('var(--font-family-heading)');
+ });
+
+ it('renames font size tokens', async () => {
+ const output = await applyTransform(`const x = textSizeVars['--text-base'];`);
+ expect(output).toContain('--font-size-base');
+ });
+
+ it('renames --text-xsm to --font-size-xs', async () => {
+ const output = await applyTransform(`const x = '--text-xsm';`);
+ expect(output).toContain('--font-size-xs');
+ });
+
+ // === Type scale renames ===
+
+ it('renames heading type scale tokens', async () => {
+ const output = await applyTransform(`const x = 'var(--heading-1-size)';`);
+ expect(output).toContain('var(--text-heading-1-size)');
+ });
+
+ // === Removed token migrations ===
+
+ it('maps --color-info to --color-icon-purple', async () => {
+ const output = await applyTransform(`const x = colorVars['--color-info'];`);
+ expect(output).toContain('--color-icon-purple');
+ expect(output).not.toContain("'--color-info'");
+ });
+
+ it('maps --color-info-muted to --color-background-purple', async () => {
+ const output = await applyTransform(`const x = '--color-info-muted';`);
+ expect(output).toContain('--color-background-purple');
+ });
+
+ // === Line height renames (token string + identifier rewrite) ===
+
+ it('rewrites lineHeightVars member access to typeScaleVars with new key', async () => {
+ const input = `const x = lineHeightVars['--leading-base'];`;
+ const output = await applyTransform(input);
+ expect(output).toContain('typeScaleVars["--text-body-leading"]');
+ expect(output).not.toContain('lineHeightVars');
+ expect(output).not.toContain('--leading-base');
+ });
+
+ it('rewrites lineHeightVars import to typeScaleVars', async () => {
+ const input = `import { lineHeightVars } from '@xds/core/theme/tokens.stylex';
+const x = lineHeightVars['--leading-snug'];`;
+ const output = await applyTransform(input);
+ expect(output).toContain('typeScaleVars');
+ expect(output).toContain('--text-label-leading');
+ expect(output).not.toContain('lineHeightVars');
+ expect(output).not.toContain('--leading-snug');
+ });
+
+ it('rewrites lineHeightDefaults to typeScaleDefaults', async () => {
+ const input = `import { lineHeightDefaults } from '@xds/core';
+const tokens = { ...lineHeightDefaults };`;
+ const output = await applyTransform(input);
+ expect(output).toContain('typeScaleDefaults');
+ expect(output).not.toContain('lineHeightDefaults');
+ });
+
+ it('renames all --leading-* token strings', async () => {
+ const input = `const styles = {
+ a: lineHeightVars['--leading-base'],
+ b: lineHeightVars['--leading-snug'],
+ c: lineHeightVars['--leading-normal'],
+ d: lineHeightVars['--leading-tight'],
+ e: lineHeightVars['--leading-relaxed'],
+ };`;
+ const output = await applyTransform(input);
+ expect(output).toContain('typeScaleVars["--text-body-leading"]');
+ expect(output).toContain('typeScaleVars["--text-label-leading"]');
+ expect(output).toContain('typeScaleVars["--text-large-leading"]');
+ expect(output).toContain('typeScaleVars["--text-heading-1-leading"]');
+ expect(output).toContain('typeScaleVars["--text-supporting-leading"]');
+ expect(output).not.toContain('lineHeightVars');
+ });
+
+ it('renames bare --leading-* strings (e.g. in CSS)', async () => {
+ const output = await applyTransform(`const x = '--leading-normal';`);
+ expect(output).toContain('--text-large-leading');
+ });
+
+ // === Edge cases ===
+
+ it('handles template literals', async () => {
+ const output = await applyTransform('const css = `color: var(--color-wash)`;');
+ expect(output).toContain('--color-background-body');
+ });
+
+ it('does not modify already-final names', async () => {
+ const input = `const x = '--color-background-body';`;
+ const output = await applyTransform(input);
+ expect(output).toBe(input);
+ });
+
+ it('returns undefined when no changes needed', async () => {
+ const {default: transform} = await import('../migrate-token-renames.mjs');
+ const jscodeshift = (await import('jscodeshift')).default;
+ const api = {jscodeshift, stats: () => {}, report: () => {}};
+ const result = transform({source: `const x = '--color-accent';`, path: 'test.tsx'}, api);
+ expect(result).toBeUndefined();
+ });
+});
diff --git a/packages/cli/src/codemods/transforms/v0.0.8/index.mjs b/packages/cli/src/codemods/transforms/v0.0.8/index.mjs
index c27a52b9ae..93c85ea52a 100644
--- a/packages/cli/src/codemods/transforms/v0.0.8/index.mjs
+++ b/packages/cli/src/codemods/transforms/v0.0.8/index.mjs
@@ -8,10 +8,19 @@ import renameEndSlotToEndContent, {
meta as endSlotMeta,
} from './rename-endslot-to-endcontent.mjs';
+import migrateTokenRenames, {
+ meta as migrateTokenRenamesMeta,
+} from './migrate-token-renames.mjs';
+
export default [
{
name: 'rename-endslot-to-endcontent',
transform: renameEndSlotToEndContent,
meta: endSlotMeta,
},
+ {
+ name: 'migrate-token-renames',
+ transform: migrateTokenRenames,
+ meta: migrateTokenRenamesMeta,
+ },
];
diff --git a/packages/cli/src/codemods/transforms/v0.0.8/migrate-token-renames.mjs b/packages/cli/src/codemods/transforms/v0.0.8/migrate-token-renames.mjs
new file mode 100644
index 0000000000..961b4fb082
--- /dev/null
+++ b/packages/cli/src/codemods/transforms/v0.0.8/migrate-token-renames.mjs
@@ -0,0 +1,268 @@
+/**
+ * @file Codemod: Migrate v0.0.6 token names to v0.0.8 final names
+ *
+ * Handles all token renames from the token spec spreadsheet:
+ * - Color palette: --color-{color}-{type} → --color-{type}-{color}
+ * - Backgrounds: --color-wash/surface/card/popover/muted → --color-background-*
+ * - Text: --color-text-link → --color-text-accent
+ * - Media: --color-text-on-dark-media → --color-on-dark
+ * - Effects: --color-hover-tint → --color-tint-hover
+ * - Status: --color-secondary → --color-neutral
+ * - Focus: --color-ring-focus* → --color-accent/error/success/warning
+ * - Border: --color-border-strong → --color-border-emphasized
+ * - Size: --size-sm/md/lg → --size-element-sm/md/lg
+ * - Radius: --radius-0..4 → --radius-none/inner/element/container, --radius-rounded → --radius-full
+ * - Shadow: --shadow-base/menu/hover/dialog → --shadow-low/med/high
+ * - Shadow inset: --inset-shadow-border-* → --shadow-inset-*
+ * - Font family: --font-body/code/heading → --font-family-body/code/heading
+ * - Font size: --text-* → --font-size-*
+ * - Type scale: --heading-*-size/weight/leading → --text-heading-*-size/weight/leading
+ * - Line height: --leading-* → semantic typeScale leading tokens
+ * Also rewrites lineHeightVars → typeScaleVars (imports + member access)
+ *
+ * ## Line height migration strategy
+ *
+ * Raw --leading-* tokens are replaced with semantic typeScale leading tokens.
+ * The correct mapping depends on the fontSize used alongside the lineHeight.
+ * This codemod uses the closest-value match as a default. If the result doesn't
+ * look right, manually pick the semantic leading that pairs with your fontSize:
+ *
+ * | fontSize token (px) | Correct leading token | Value |
+ * |-------------------------------|-------------------------------|--------|
+ * | --font-size-base (14px) | --text-body-leading | 1.4286 |
+ * | --font-size-base (14px) | --text-label-leading | 1.4286 |
+ * | --font-size-sm (12px) | --text-supporting-leading | 1.6667 |
+ * | --font-size-lg (17px) | --text-large-leading | 1.4118 |
+ * | --font-size-xs (10px) | --text-heading-6-leading | 1.6 |
+ * | --font-size-xl (20px) | --text-heading-2-leading | 1.4 |
+ * | --font-size-2xl (24px) | --text-heading-1-leading | 1.3333 |
+ */
+
+export const meta = {
+ title: 'Migrate token names to v0.0.8 naming convention',
+ description:
+ 'Renames tokens from v0.0.6 intermediate names to final v0.0.8 names per the token spec.',
+};
+
+// =============================================================================
+// Token string renames (CSS custom property names)
+// =============================================================================
+
+const TOKEN_MAP = {
+ // Color — Core Semantic
+ '--color-secondary': '--color-neutral',
+ '--color-info-muted': '--color-background-purple', // removed token, closest purple match
+ '--color-info': '--color-icon-purple', // removed token, exact value match (#5B08D8)
+ '--color-ring-focus-success': '--color-success',
+ '--color-ring-focus-warning': '--color-warning',
+ '--color-ring-focus-error': '--color-error',
+ '--color-ring-focus': '--color-accent',
+ '--color-border-strong': '--color-border-emphasized',
+
+ // Color — Text
+ '--color-text-link': '--color-text-accent',
+ '--color-text-on-dark-media': '--color-on-dark',
+
+ // Color — Icon
+ '--color-icon-on-dark-media': '--color-on-dark',
+
+ // Color — Background
+ '--color-wash': '--color-background-body',
+ '--color-surface': '--color-background-surface',
+ '--color-card': '--color-background-card',
+ '--color-popover': '--color-background-popover',
+ '--color-muted': '--color-background-muted',
+
+ // Color — Effects
+ '--color-hover-tint': '--color-tint-hover',
+
+ // Color — Palette (all 10 colors × 4 types)
+ '--color-blue-background': '--color-background-blue',
+ '--color-blue-border': '--color-border-blue',
+ '--color-blue-icon': '--color-icon-blue',
+ '--color-blue-text': '--color-text-blue',
+ '--color-cyan-background': '--color-background-cyan',
+ '--color-cyan-border': '--color-border-cyan',
+ '--color-cyan-icon': '--color-icon-cyan',
+ '--color-cyan-text': '--color-text-cyan',
+ '--color-gray-background': '--color-background-gray',
+ '--color-gray-border': '--color-border-gray',
+ '--color-gray-icon': '--color-icon-gray',
+ '--color-gray-text': '--color-text-gray',
+ '--color-green-background': '--color-background-green',
+ '--color-green-border': '--color-border-green',
+ '--color-green-icon': '--color-icon-green',
+ '--color-green-text': '--color-text-green',
+ '--color-orange-background': '--color-background-orange',
+ '--color-orange-border': '--color-border-orange',
+ '--color-orange-icon': '--color-icon-orange',
+ '--color-orange-text': '--color-text-orange',
+ '--color-pink-background': '--color-background-pink',
+ '--color-pink-border': '--color-border-pink',
+ '--color-pink-icon': '--color-icon-pink',
+ '--color-pink-text': '--color-text-pink',
+ '--color-purple-background': '--color-background-purple',
+ '--color-purple-border': '--color-border-purple',
+ '--color-purple-icon': '--color-icon-purple',
+ '--color-purple-text': '--color-text-purple',
+ '--color-red-background': '--color-background-red',
+ '--color-red-border': '--color-border-red',
+ '--color-red-icon': '--color-icon-red',
+ '--color-red-text': '--color-text-red',
+ '--color-teal-background': '--color-background-teal',
+ '--color-teal-border': '--color-border-teal',
+ '--color-teal-icon': '--color-icon-teal',
+ '--color-teal-text': '--color-text-teal',
+ '--color-yellow-background': '--color-background-yellow',
+ '--color-yellow-border': '--color-border-yellow',
+ '--color-yellow-icon': '--color-icon-yellow',
+ '--color-yellow-text': '--color-text-yellow',
+
+ // Size
+ '--size-sm': '--size-element-sm',
+ '--size-md': '--size-element-md',
+ '--size-lg': '--size-element-lg',
+
+ // Radius
+ '--radius-0': '--radius-none',
+ '--radius-1': '--radius-inner',
+ '--radius-2': '--radius-element',
+ '--radius-3': '--radius-container',
+ '--radius-4': '--radius-container',
+ '--radius-rounded': '--radius-full',
+
+ // Shadow
+ '--shadow-base': '--shadow-low',
+ '--shadow-menu': '--shadow-low',
+ '--shadow-hover': '--shadow-med',
+ '--shadow-dialog': '--shadow-high',
+ '--inset-shadow-border-hover': '--shadow-inset-hover',
+ '--inset-shadow-border-accent': '--shadow-inset-selected',
+ '--inset-shadow-border-positive': '--shadow-inset-success',
+ '--inset-shadow-border-warning': '--shadow-inset-warning',
+ '--inset-shadow-border-negative': '--shadow-inset-error',
+
+ // Font family
+ '--font-body': '--font-family-body',
+ '--font-code': '--font-family-code',
+ '--font-heading': '--font-family-heading',
+
+ // Font size
+ '--text-4xs': '--font-size-4xs',
+ '--text-3xs': '--font-size-3xs',
+ '--text-2xs': '--font-size-2xs',
+ '--text-xsm': '--font-size-xs',
+ '--text-sm': '--font-size-sm',
+ '--text-base': '--font-size-base',
+ '--text-lg': '--font-size-lg',
+ '--text-xl': '--font-size-xl',
+ '--text-2xl': '--font-size-2xl',
+ '--text-3xl': '--font-size-3xl',
+ '--text-4xl': '--font-size-4xl',
+ '--text-5xl': '--font-size-5xl',
+
+ // Line height — closest semantic match by value (see header for manual override guide)
+ '--leading-base': '--text-body-leading', // 1.4286 → 1.4286 (exact)
+ '--leading-snug': '--text-label-leading', // 1.375 → 1.4286 (closest)
+ '--leading-normal': '--text-large-leading', // 1.5 → 1.4118 (closest)
+ '--leading-tight': '--text-heading-1-leading', // 1.25 → 1.3333 (closest)
+ '--leading-relaxed': '--text-supporting-leading', // 1.625 → 1.6667 (closest)
+
+ // Type scale
+ '--heading-1-size': '--text-heading-1-size',
+ '--heading-1-weight': '--text-heading-1-weight',
+ '--heading-1-leading': '--text-heading-1-leading',
+ '--heading-2-size': '--text-heading-2-size',
+ '--heading-2-weight': '--text-heading-2-weight',
+ '--heading-2-leading': '--text-heading-2-leading',
+ '--heading-3-size': '--text-heading-3-size',
+ '--heading-3-weight': '--text-heading-3-weight',
+ '--heading-3-leading': '--text-heading-3-leading',
+ '--heading-4-size': '--text-heading-4-size',
+ '--heading-4-weight': '--text-heading-4-weight',
+ '--heading-4-leading': '--text-heading-4-leading',
+ '--heading-5-size': '--text-heading-5-size',
+ '--heading-5-weight': '--text-heading-5-weight',
+ '--heading-5-leading': '--text-heading-5-leading',
+ '--heading-6-size': '--text-heading-6-size',
+ '--heading-6-weight': '--text-heading-6-weight',
+ '--heading-6-leading': '--text-heading-6-leading',
+};
+
+// =============================================================================
+// JS identifier renames (import names, variable references)
+// =============================================================================
+
+const IDENTIFIER_MAP = {
+ lineHeightVars: 'typeScaleVars',
+ lineHeightDefaults: 'typeScaleDefaults',
+ lineHeightRaw: 'typeScaleDefaults',
+};
+
+// =============================================================================
+// Helpers
+// =============================================================================
+
+const OLD_TOKENS_PATTERN = new RegExp(
+ Object.keys(TOKEN_MAP)
+ .sort((a, b) => b.length - a.length)
+ .map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
+ .join('|') + '(?![a-zA-Z0-9_-])',
+ 'g',
+);
+
+function replaceTokens(str) {
+ return str.replace(OLD_TOKENS_PATTERN, (match) => TOKEN_MAP[match] || match);
+}
+
+// =============================================================================
+// Transformer
+// =============================================================================
+
+export default function transformer(file, api) {
+ const j = api.jscodeshift;
+ const root = j(file.source);
+ let hasChanges = false;
+
+ // --- Pass 1: Rename token strings in string literals ---
+ const replaceInStringNode = (path) => {
+ if (typeof path.node.value !== 'string') return;
+ const original = path.node.value;
+ const replaced = replaceTokens(original);
+ if (replaced !== original) {
+ path.node.value = replaced;
+ hasChanges = true;
+ }
+ };
+
+ root.find(j.StringLiteral).forEach(replaceInStringNode);
+ root.find(j.Literal).forEach((path) => {
+ if (typeof path.node.value === 'string') {
+ replaceInStringNode(path);
+ }
+ });
+
+ // --- Pass 2: Rename token strings in template literals ---
+ root.find(j.TemplateLiteral).forEach((path) => {
+ for (const quasi of path.node.quasis) {
+ const original = quasi.value.raw;
+ const replaced = replaceTokens(original);
+ if (replaced !== original) {
+ quasi.value.raw = replaced;
+ quasi.value.cooked = replaceTokens(quasi.value.cooked);
+ hasChanges = true;
+ }
+ }
+ });
+
+ // --- Pass 3: Rename JS identifiers (lineHeightVars → typeScaleVars, etc.) ---
+ // This handles imports, member expressions, and any other reference in one pass.
+ root.find(j.Identifier).forEach((path) => {
+ const newName = IDENTIFIER_MAP[path.node.name];
+ if (!newName) return;
+ path.node.name = newName;
+ hasChanges = true;
+ });
+
+ return hasChanges ? root.toSource() : undefined;
+}
diff --git a/packages/cli/src/commands/build-theme.mjs b/packages/cli/src/commands/build-theme.mjs
index 6cd3c3e5a0..d81f868848 100644
--- a/packages/cli/src/commands/build-theme.mjs
+++ b/packages/cli/src/commands/build-theme.mjs
@@ -448,16 +448,16 @@ function generateProseCSS(themeDef) {
const parts = [];
// Heading resets — all heading elements get the base heading treatment
- parts.push(` :is(h1, h2, h3, h4, h5, h6) {\n font-family: var(--font-heading);\n font-weight: var(--font-weight-semibold);\n color: var(--color-text-primary);\n margin: 0;\n }`);
+ parts.push(` :is(h1, h2, h3, h4, h5, h6) {\n font-family: var(--font-family-heading);\n font-weight: var(--font-weight-semibold);\n color: var(--color-text-primary);\n margin: 0;\n }`);
// Per-level heading sizes
const headingSizes = {
- h1: {fontSize: 'var(--text-2xl)', lineHeight: '1.2'},
- h2: {fontSize: 'var(--text-xl)', lineHeight: '1.333'},
- h3: {fontSize: 'var(--text-lg)', lineHeight: '1.25'},
- h4: {fontSize: 'var(--text-base)', lineHeight: 'var(--leading-base)'},
- h5: {fontSize: 'var(--text-base)', lineHeight: 'var(--leading-base)'},
- h6: {fontSize: 'var(--text-xsm)', lineHeight: '1.333'},
+ h1: {fontSize: 'var(--font-size-2xl)', lineHeight: '1.2'},
+ h2: {fontSize: 'var(--font-size-xl)', lineHeight: '1.333'},
+ h3: {fontSize: 'var(--font-size-lg)', lineHeight: '1.25'},
+ h4: {fontSize: 'var(--font-size-base)', lineHeight: 'var(--leading-base)'},
+ h5: {fontSize: 'var(--font-size-base)', lineHeight: 'var(--leading-base)'},
+ h6: {fontSize: 'var(--font-size-xs)', lineHeight: '1.333'},
};
for (const [el, styles] of Object.entries(headingSizes)) {
@@ -468,11 +468,11 @@ function generateProseCSS(themeDef) {
}
// Text element resets
- parts.push(` p {\n font-family: var(--font-heading);\n color: var(--color-text-primary);\n margin: 0;\n font-size: var(--text-base);\n line-height: var(--leading-base);\n }`);
+ parts.push(` p {\n font-family: var(--font-family-heading);\n color: var(--color-text-primary);\n margin: 0;\n font-size: var(--font-size-base);\n line-height: var(--leading-base);\n }`);
- parts.push(` small {\n font-size: var(--text-xsm);\n line-height: 1.333;\n color: var(--color-text-secondary);\n }`);
+ parts.push(` small {\n font-size: var(--font-size-xs);\n line-height: 1.333;\n color: var(--color-text-secondary);\n }`);
- parts.push(` code, pre {\n font-family: var(--font-code);\n font-size: var(--text-base);\n line-height: var(--leading-base);\n }`);
+ parts.push(` code, pre {\n font-family: var(--font-family-code);\n font-size: var(--font-size-base);\n line-height: var(--leading-base);\n }`);
parts.push(` hr {\n border: none;\n border-top: 1px solid var(--color-border);\n margin: 0;\n }`);
diff --git a/packages/cli/src/commands/theme.mjs b/packages/cli/src/commands/theme.mjs
index 0a9c8b5690..2a6ab531f3 100644
--- a/packages/cli/src/commands/theme.mjs
+++ b/packages/cli/src/commands/theme.mjs
@@ -103,34 +103,33 @@ function deriveColorPalette({accent, positive, negative, warning, mode}) {
// Core semantic
'--color-accent': ld(accentDark, accentLight),
'--color-accent-muted': ld(withAlpha(accent, 0.2), withAlpha(accent, 0.25)),
- '--color-secondary': ld('rgba(5, 54, 89, 0.1)', 'rgba(223, 226, 229, 0.2)'),
- '--color-text-link': ld(accentTextLight, accentTextDark),
- '--color-surface': ld('#FFFFFF', '#1F1F22'),
- '--color-wash': ld('#F1F4F7', '#111112'),
+ '--color-neutral': ld('rgba(5, 54, 89, 0.1)', 'rgba(223, 226, 229, 0.2)'),
+ '--color-text-accent': ld(accentTextLight, accentTextDark),
+ '--color-background-surface': ld('#FFFFFF', '#1F1F22'),
+ '--color-background-body': ld('#F1F4F7', '#111112'),
'--color-overlay': ld('#01122866', '#11111299'),
'--color-overlay-hover': ld('#0536590C', '#FFFFFF0C'),
'--color-overlay-pressed': ld('#05365919', '#FFFFFF19'),
- '--color-ring-focus': ld(accentTextLight, accentTextDark),
- '--color-muted': ld('#0536590C', '#1111127F'),
+ '--color-accent': ld(accentTextLight, accentTextDark),
+ '--color-background-muted': ld('#0536590C', '#1111127F'),
// Text
'--color-text-primary': ld('#0A1317', '#DFE2E5'),
'--color-text-secondary': ld('#4E606F', '#AAAFB5'),
'--color-text-disabled': ld('#A4B0BC', '#6F747C'),
- '--color-text-link': ld(accentDark, accentLight),
+ '--color-text-accent': ld(accentDark, accentLight),
'--color-text-secondary': ld('#4E606F', '#AAAFB5'),
- '--color-text-on-dark-media': ld('#FFFFFF', '#FFFFFF'),
+ '--color-on-dark': ld('#FFFFFF', '#FFFFFF'),
// Icon
'--color-icon-primary': ld('#0A1317', '#DFE2E5'),
'--color-icon-secondary': ld('#4E606F', '#AAAFB5'),
'--color-icon-secondary': ld('#748695', '#8C939B'),
'--color-icon-disabled': ld('#A4B0BC', '#6F747C'),
- '--color-icon-on-dark-media': ld('#FFFFFF', '#FFFFFF'),
// Surface variants
- '--color-card': ld('#FFFFFF', '#1F1F22'),
- '--color-popover': ld('#FFFFFF', '#28292C'),
+ '--color-background-card': ld('#FFFFFF', '#1F1F22'),
+ '--color-background-popover': ld('#FFFFFF', '#28292C'),
// Status
'--color-success': ld(positive, positive),
@@ -139,60 +138,58 @@ function deriveColorPalette({accent, positive, negative, warning, mode}) {
'--color-error-muted': ld(withAlpha(negative, 0.2), withAlpha(negative, 0.25)),
'--color-warning': ld(warning, mixColors(warning, '#FFCC00', 0.3)),
'--color-warning-muted': ld(withAlpha(warning, 0.2), withAlpha(warning, 0.25)),
- '--color-info': ld('#5B08D8', '#6B1EFD'),
- '--color-info-muted': ld('#7952FF33', '#5B08D83F'),
// Divider
'--color-border': ld('#05365919', '#F2F4F619'),
- '--color-border-strong': ld('#647685', '#6F747C'),
+ '--color-border-emphasized': ld('#647685', '#6F747C'),
'--color-border-emphasized': ld('#CCD3DB', '#494D53'),
// Effects
'--color-skeleton': ld('#CCD3DB', '#5A5E66'),
'--color-shadow': ld('rgba(5, 54, 89, 0.1)', 'rgba(0, 0, 0, 0.3)'),
- '--color-hover-tint': ld('black', 'white'),
+ '--color-tint-hover': ld('black', 'white'),
// Literal color sets
- '--color-blue-background': ld('#0171E333', '#0171E333'),
- '--color-blue-border': ld('#0171E3', '#4BA9FE'),
- '--color-blue-icon': ld('#0064E0', '#2694FE'),
- '--color-blue-text': ld('#042F97', '#AFD7FF'),
- '--color-cyan-background': ld('#00BCD433', '#00BCD433'),
- '--color-cyan-border': ld('#00BCD4', '#4DD0E1'),
- '--color-cyan-icon': ld('#00ACC1', '#26C6DA'),
- '--color-cyan-text': ld('#006064', '#B2EBF2'),
- '--color-gray-background': ld('#0A131733', '#666A724C'),
- '--color-gray-border': ld('#647685', '#8C939B'),
- '--color-gray-icon': ld('#4E606F', '#AAAFB5'),
- '--color-gray-text': ld('#0A1317', '#E7EAED'),
- '--color-green-background': ld('#24BB5E33', '#24BB5E33'),
- '--color-green-border': ld('#24BB5E', '#4CD964'),
- '--color-green-icon': ld('#0D8626', '#26A756'),
- '--color-green-text': ld('#09441F', '#A5F690'),
- '--color-orange-background': ld('#F2790233', '#F2790233'),
- '--color-orange-border': ld('#F27902', '#FFA040'),
- '--color-orange-icon': ld('#E9690B', '#FB8C00'),
- '--color-orange-text': ld('#6B2203', '#FDB876'),
- '--color-pink-background': ld('#E91E6333', '#E91E6333'),
- '--color-pink-border': ld('#E91E63', '#F48FB1'),
- '--color-pink-icon': ld('#C2185B', '#EC407A'),
- '--color-pink-text': ld('#880E4F', '#F8BBD0'),
- '--color-purple-background': ld('#7952FF33', '#7952FF33'),
- '--color-purple-border': ld('#7952FF', '#9575CD'),
- '--color-purple-icon': ld('#5B08D8', '#7952FF'),
- '--color-purple-text': ld('#3E0697', '#B3B0FE'),
- '--color-red-background': ld('#E3193B33', '#E3193B33'),
- '--color-red-border': ld('#E3193B', '#F5394F'),
- '--color-red-icon': ld('#D31130', '#E3193B'),
- '--color-red-text': ld('#7B0210', '#FFB2B8'),
- '--color-teal-background': ld('#0DB7AF33', '#0DB7AF33'),
- '--color-teal-border': ld('#0DB7AF', '#4DB6AC'),
- '--color-teal-icon': ld('#009688', '#26A69A'),
- '--color-teal-text': ld('#083943', '#40DCCD'),
- '--color-yellow-background': ld('#FFEB3B33', '#FFEB3B33'),
- '--color-yellow-border': ld('#FFEB3B', '#FFF176'),
- '--color-yellow-icon': ld('#FBC02D', '#FFEE58'),
- '--color-yellow-text': ld('#753F07', '#FBCE03'),
+ '--color-background-blue': ld('#0171E333', '#0171E333'),
+ '--color-border-blue': ld('#0171E3', '#4BA9FE'),
+ '--color-icon-blue': ld('#0064E0', '#2694FE'),
+ '--color-text-blue': ld('#042F97', '#AFD7FF'),
+ '--color-background-cyan': ld('#00BCD433', '#00BCD433'),
+ '--color-border-cyan': ld('#00BCD4', '#4DD0E1'),
+ '--color-icon-cyan': ld('#00ACC1', '#26C6DA'),
+ '--color-text-cyan': ld('#006064', '#B2EBF2'),
+ '--color-background-gray': ld('#0A131733', '#666A724C'),
+ '--color-border-gray': ld('#647685', '#8C939B'),
+ '--color-icon-gray': ld('#4E606F', '#AAAFB5'),
+ '--color-text-gray': ld('#0A1317', '#E7EAED'),
+ '--color-background-green': ld('#24BB5E33', '#24BB5E33'),
+ '--color-border-green': ld('#24BB5E', '#4CD964'),
+ '--color-icon-green': ld('#0D8626', '#26A756'),
+ '--color-text-green': ld('#09441F', '#A5F690'),
+ '--color-background-orange': ld('#F2790233', '#F2790233'),
+ '--color-border-orange': ld('#F27902', '#FFA040'),
+ '--color-icon-orange': ld('#E9690B', '#FB8C00'),
+ '--color-text-orange': ld('#6B2203', '#FDB876'),
+ '--color-background-pink': ld('#E91E6333', '#E91E6333'),
+ '--color-border-pink': ld('#E91E63', '#F48FB1'),
+ '--color-icon-pink': ld('#C2185B', '#EC407A'),
+ '--color-text-pink': ld('#880E4F', '#F8BBD0'),
+ '--color-background-purple': ld('#7952FF33', '#7952FF33'),
+ '--color-border-purple': ld('#7952FF', '#9575CD'),
+ '--color-icon-purple': ld('#5B08D8', '#7952FF'),
+ '--color-text-purple': ld('#3E0697', '#B3B0FE'),
+ '--color-background-red': ld('#E3193B33', '#E3193B33'),
+ '--color-border-red': ld('#E3193B', '#F5394F'),
+ '--color-icon-red': ld('#D31130', '#E3193B'),
+ '--color-text-red': ld('#7B0210', '#FFB2B8'),
+ '--color-background-teal': ld('#0DB7AF33', '#0DB7AF33'),
+ '--color-border-teal': ld('#0DB7AF', '#4DB6AC'),
+ '--color-icon-teal': ld('#009688', '#26A69A'),
+ '--color-text-teal': ld('#083943', '#40DCCD'),
+ '--color-background-yellow': ld('#FFEB3B33', '#FFEB3B33'),
+ '--color-border-yellow': ld('#FFEB3B', '#FFF176'),
+ '--color-icon-yellow': ld('#FBC02D', '#FFEE58'),
+ '--color-text-yellow': ld('#753F07', '#FBCE03'),
};
}
@@ -232,20 +229,20 @@ function generateThemeFile({name, exportName, colors, includeComponentOverrides,
// --- Card ---
// const cardOverrides = stylex.create({
// container: {
-// borderRadius: radiusVars['--radius-3'],
+// borderRadius: radiusVars['--radius-container'],
// // gradient border: set a gradient background + padding, inner content covers it
// // background: 'linear-gradient(135deg, ...)',
// },
// content: {
-// backgroundColor: colorVars['--color-card'],
+// backgroundColor: colorVars['--color-background-card'],
// },
// });
// --- Heading ---
// const headingStyles = stylex.create({
// h1: {
-// fontFamily: typographyVars['--font-heading'],
-// fontSize: textSizeVars['--text-2xl'],
+// fontFamily: typographyVars['--font-family-heading'],
+// fontSize: textSizeVars['--font-size-2xl'],
// fontWeight: fontWeightVars['--font-weight-semibold'],
// lineHeight: 1.2,
// color: colorVars['--color-text-primary'],
@@ -257,10 +254,10 @@ function generateThemeFile({name, exportName, colors, includeComponentOverrides,
// --- Text ---
// const textStyles = stylex.create({
// body: {
-// fontFamily: typographyVars['--font-body'],
-// fontSize: textSizeVars['--text-base'],
+// fontFamily: typographyVars['--font-family-body'],
+// fontSize: textSizeVars['--font-size-base'],
// fontWeight: fontWeightVars['--font-weight-normal'],
-// lineHeight: lineHeightVars['--leading-base'],
+// lineHeight: typeScaleVars['--text-body-leading'],
// color: colorVars['--color-text-primary'],
// margin: 0,
// },
@@ -327,7 +324,7 @@ const colorTheme = stylex.createTheme(
// Uncomment and customize to override other token groups:
// import { radiusVars, shadowVars, typographyVars, ... } from '@xds/core/theme/tokens.stylex';
-// const radiusTheme = stylex.createTheme(radiusVars, { '--radius-3': '16px', ... });
+// const radiusTheme = stylex.createTheme(radiusVars, { '--radius-container': '16px', ... });
${componentOverrideSection}
// =============================================================================
// Theme Export
diff --git a/packages/core/src/AppShell/XDSAppShell.tsx b/packages/core/src/AppShell/XDSAppShell.tsx
index b2b7788b88..d64bb65916 100644
--- a/packages/core/src/AppShell/XDSAppShell.tsx
+++ b/packages/core/src/AppShell/XDSAppShell.tsx
@@ -15,7 +15,6 @@
* - /apps/storybook/stories/AppShell.stories.tsx
*/
-
import {
isValidElement,
useCallback,
@@ -259,16 +258,16 @@ const styles = stylex.create({
position: 'relative',
},
variantWash: {
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
},
variantSurface: {
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
},
variantSection: {
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
},
variantElevated: {
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
},
rootFill: {
height: '100dvh',
@@ -324,8 +323,8 @@ const styles = stylex.create({
default: 0,
':focus': spacingVars['--spacing-2'],
},
- backgroundColor: colorVars['--color-surface'],
- color: colorVars['--color-text-link'],
+ backgroundColor: colorVars['--color-background-surface'],
+ color: colorVars['--color-text-accent'],
zIndex: 9999,
textDecoration: 'none',
fontWeight: fontWeightVars['--font-weight-semibold'],
@@ -335,8 +334,8 @@ const styles = stylex.create({
elevatedBackdrop: {
position: 'absolute',
inset: 0,
- backgroundColor: colorVars['--color-surface'],
- borderStartStartRadius: radiusVars['--radius-4'],
+ backgroundColor: colorVars['--color-background-surface'],
+ borderStartStartRadius: radiusVars['--radius-page'],
pointerEvents: 'none',
},
elevatedContentWrapper: {
@@ -347,20 +346,20 @@ const styles = stylex.create({
height: '100%',
},
contentBgSurface: {
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
},
contentBgWash: {
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
},
contentBgTransparent: {
backgroundColor: 'transparent',
isolation: 'isolate',
},
navAreaWash: {
- backgroundColor: colorVars['--color-wash'],
+ backgroundColor: colorVars['--color-background-body'],
},
navAreaSurface: {
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
},
banner: {
flexShrink: 0,
diff --git a/packages/core/src/Avatar/XDSAvatar.tsx b/packages/core/src/Avatar/XDSAvatar.tsx
index 34a185416d..df82e23b7f 100644
--- a/packages/core/src/Avatar/XDSAvatar.tsx
+++ b/packages/core/src/Avatar/XDSAvatar.tsx
@@ -128,9 +128,9 @@ const styles = stylex.create({
justifyContent: 'center',
width: '100%',
height: '100%',
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
color: colorVars['--color-text-secondary'],
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontWeight: fontWeightVars['--font-weight-medium'],
textTransform: 'uppercase',
},
diff --git a/packages/core/src/Avatar/XDSAvatarStatusDot.tsx b/packages/core/src/Avatar/XDSAvatarStatusDot.tsx
index 8774faf781..07b9ba925e 100644
--- a/packages/core/src/Avatar/XDSAvatarStatusDot.tsx
+++ b/packages/core/src/Avatar/XDSAvatarStatusDot.tsx
@@ -12,7 +12,6 @@
* - /apps/storybook/stories/Avatar.stories.tsx (storybook stories)
*/
-
import {useContext, type ReactNode} from 'react';
import type {XDSBaseProps} from '../XDSBaseProps';
import * as stylex from '@stylexjs/stylex';
@@ -109,7 +108,7 @@ const styles = stylex.create({
dot: {
borderRadius: '50%',
borderStyle: 'solid',
- borderColor: colorVars['--color-surface'],
+ borderColor: colorVars['--color-background-surface'],
boxSizing: 'border-box',
display: 'flex',
alignItems: 'center',
@@ -128,7 +127,7 @@ const styles = stylex.create({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- color: colorVars['--color-surface'],
+ color: colorVars['--color-background-surface'],
lineHeight: 0,
},
});
diff --git a/packages/core/src/Badge/XDSBadge.tsx b/packages/core/src/Badge/XDSBadge.tsx
index 1422422f71..802b3aab77 100644
--- a/packages/core/src/Badge/XDSBadge.tsx
+++ b/packages/core/src/Badge/XDSBadge.tsx
@@ -13,7 +13,6 @@
* - /apps/storybook/stories/Badge.stories.tsx (storybook stories)
*/
-
import {type ReactNode} from 'react';
import type {XDSBaseProps} from '../XDSBaseProps';
import * as stylex from '@stylexjs/stylex';
@@ -22,7 +21,6 @@ import {
spacingVars,
radiusVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {xdsClassName, mergeProps} from '../utils';
@@ -39,10 +37,10 @@ const styles = stylex.create({
height: spacingVars['--spacing-5'],
paddingBlock: 0,
paddingInline: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-tight'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
fontWeight: fontWeightVars['--font-weight-medium'],
whiteSpace: 'nowrap',
},
@@ -71,24 +69,24 @@ const styles = stylex.create({
*/
const variants = stylex.create({
neutral: {
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
color: colorVars['--color-text-primary'],
},
info: {
backgroundColor: colorVars['--color-accent'],
- color: colorVars['--color-text-on-dark-media'],
+ color: colorVars['--color-on-accent'],
},
success: {
backgroundColor: colorVars['--color-success'],
- color: colorVars['--color-text-on-dark-media'],
+ color: colorVars['--color-on-success'],
},
warning: {
backgroundColor: colorVars['--color-warning'],
- color: colorVars['--color-text-primary'],
+ color: colorVars['--color-on-warning'],
},
error: {
backgroundColor: colorVars['--color-error'],
- color: colorVars['--color-text-on-dark-media'],
+ color: colorVars['--color-on-error'],
},
});
diff --git a/packages/core/src/Banner/Banner.doc.mjs b/packages/core/src/Banner/Banner.doc.mjs
index c9c77c2dd5..96af3a5f57 100644
--- a/packages/core/src/Banner/Banner.doc.mjs
+++ b/packages/core/src/Banner/Banner.doc.mjs
@@ -121,7 +121,7 @@ export const docs = {
{className: 'xds-banner-icon', visualProps: ['status']},
],
vars: [
- {name: '--banner-radius', description: 'Border radius (card container only)', default: 'var(--radius-3)'},
+ {name: '--banner-radius', description: 'Border radius (card container only)', default: 'var(--radius-container)'},
],
},
notes: [
@@ -252,7 +252,7 @@ export const docsZh = {
{className: 'xds-banner-icon', visualProps: ['status']},
],
vars: [
- {name: '--banner-radius', description: 'Border radius (card container only)', default: 'var(--radius-3)'},
+ {name: '--banner-radius', description: 'Border radius (card container only)', default: 'var(--radius-container)'},
],
},
notes: [
diff --git a/packages/core/src/Banner/XDSBanner.tsx b/packages/core/src/Banner/XDSBanner.tsx
index 2d6bc14b3d..92d451a4a2 100644
--- a/packages/core/src/Banner/XDSBanner.tsx
+++ b/packages/core/src/Banner/XDSBanner.tsx
@@ -19,7 +19,6 @@
* - /apps/storybook/stories/Banner.stories.tsx (storybook stories)
*/
-
import {useState, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import type {StyleXStyles} from '@stylexjs/stylex';
@@ -39,7 +38,6 @@ import {
spacingVars,
radiusVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {xdsClassName, mergeProps} from '../utils';
@@ -232,7 +230,7 @@ const styles = stylex.create({
overflow: 'clip',
},
card: {
- '--banner-radius': radiusVars['--radius-3'],
+ '--banner-radius': radiusVars['--radius-container'],
borderRadius: 'var(--banner-radius)',
},
section: {
@@ -267,7 +265,7 @@ const styles = stylex.create({
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-label-size'],
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
color: colorVars['--color-text-primary'],
},
description: {
@@ -275,7 +273,7 @@ const styles = stylex.create({
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-supporting-size'],
fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
},
iconWrapper: {
@@ -294,7 +292,7 @@ const styles = stylex.create({
// automatically via --edge-end signal on the endArea
// Content area — card background for additional content below the header
contentArea: {
- backgroundColor: colorVars['--color-card'],
+ backgroundColor: colorVars['--color-background-card'],
paddingBlock: spacingVars['--spacing-3'],
paddingInline: spacingVars['--spacing-4'],
borderLeftWidth: 1,
diff --git a/packages/core/src/Breadcrumbs/XDSBreadcrumbItem.tsx b/packages/core/src/Breadcrumbs/XDSBreadcrumbItem.tsx
index dbaed15a25..5b42beafe1 100644
--- a/packages/core/src/Breadcrumbs/XDSBreadcrumbItem.tsx
+++ b/packages/core/src/Breadcrumbs/XDSBreadcrumbItem.tsx
@@ -13,15 +13,9 @@
* - /apps/storybook/stories/Breadcrumbs.stories.tsx
*/
-
import {useContext, type ReactNode, type MouseEvent} from 'react';
import * as stylex from '@stylexjs/stylex';
-import {
- colorVars,
- spacingVars,
- lineHeightVars,
- typeScaleVars,
-} from '../theme/tokens.stylex';
+import {colorVars, spacingVars, typeScaleVars} from '../theme/tokens.stylex';
import {BreadcrumbCtx} from './XDSBreadcrumbs';
import {useXDSLinkComponent} from '../Link/useXDSLinkComponent';
import type {XDSLinkComponentType} from '../Link/types';
@@ -75,26 +69,25 @@ const itemStyles = stylex.create({
display: 'flex',
alignItems: 'center',
gap: spacingVars['--spacing-1'],
- lineHeight: lineHeightVars['--leading-snug'],
margin: 0,
},
defaultSize: {
fontSize: typeScaleVars['--text-body-size'],
+ lineHeight: typeScaleVars['--text-body-leading'],
},
supportingSize: {
fontSize: typeScaleVars['--text-supporting-size'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
contentWrapper: {
display: 'flex',
alignItems: 'center',
gap: spacingVars['--spacing-1'],
- lineHeight: lineHeightVars['--leading-snug'],
},
link: {
display: 'flex',
alignItems: 'center',
gap: spacingVars['--spacing-1'],
- lineHeight: lineHeightVars['--leading-snug'],
paddingBlock: spacingVars['--spacing-1'],
textDecoration: {
default: 'none',
@@ -105,7 +98,7 @@ const itemStyles = stylex.create({
cursor: 'pointer',
},
defaultLink: {
- color: colorVars['--color-text-link'],
+ color: colorVars['--color-text-accent'],
},
supportingLink: {
color: colorVars['--color-text-secondary'],
diff --git a/packages/core/src/Breadcrumbs/XDSBreadcrumbs.tsx b/packages/core/src/Breadcrumbs/XDSBreadcrumbs.tsx
index 2af82de3bb..52a8459578 100644
--- a/packages/core/src/Breadcrumbs/XDSBreadcrumbs.tsx
+++ b/packages/core/src/Breadcrumbs/XDSBreadcrumbs.tsx
@@ -13,16 +13,10 @@
* - /apps/storybook/stories/Breadcrumbs.stories.tsx
*/
-
import {Children, isValidElement, createContext, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import type {StyleXStyles} from '@stylexjs/stylex';
-import {
- colorVars,
- spacingVars,
- lineHeightVars,
- typeScaleVars,
-} from '../theme/tokens.stylex';
+import {colorVars, spacingVars, typeScaleVars} from '../theme/tokens.stylex';
import type {XDSBreadcrumbItemProps} from './XDSBreadcrumbItem';
import {xdsClassName, mergeProps} from '../utils';
@@ -154,15 +148,16 @@ const separatorStyles = stylex.create({
display: 'flex',
alignItems: 'center',
color: colorVars['--color-text-secondary'],
- lineHeight: lineHeightVars['--leading-snug'],
paddingBlock: spacingVars['--spacing-1'],
userSelect: 'none',
},
defaultSize: {
fontSize: typeScaleVars['--text-body-size'],
+ lineHeight: typeScaleVars['--text-body-leading'],
},
supportingSize: {
fontSize: typeScaleVars['--text-supporting-size'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
});
diff --git a/packages/core/src/Button/Button.doc.mjs b/packages/core/src/Button/Button.doc.mjs
index 5fb3f903e4..560cd42e5c 100644
--- a/packages/core/src/Button/Button.doc.mjs
+++ b/packages/core/src/Button/Button.doc.mjs
@@ -168,7 +168,7 @@ export const docs = {
{className: 'xds-button', visualProps: ['size', 'variant']},
],
vars: [
- {name: '--button-radius', description: 'Border radius', default: 'var(--radius-2)'},
+ {name: '--button-radius', description: 'Border radius', default: 'var(--radius-element)'},
{name: '--button-press-scale', description: 'Active press transform', default: 'scale(0.98)'},
{name: '--button-disabled-opacity', description: 'Opacity when disabled', default: '0.5'},
{name: '--button-focus-offset', description: 'Focus ring outline offset', default: '3px'},
@@ -359,7 +359,7 @@ export const docsZh = {
{className: 'xds-button', visualProps: ['size', 'variant']},
],
vars: [
- {name: '--button-radius', description: '圆角半径', default: 'var(--radius-2)'},
+ {name: '--button-radius', description: '圆角半径', default: 'var(--radius-element)'},
{name: '--button-press-scale', description: '按下时的变换', default: 'scale(0.98)'},
{name: '--button-disabled-opacity', description: '禁用时的不透明度', default: '0.5'},
{name: '--button-focus-offset', description: '焦点环轮廓偏移', default: '3px'},
diff --git a/packages/core/src/Button/XDSButton.tsx b/packages/core/src/Button/XDSButton.tsx
index 01aaa2afc2..1f42a00c2c 100644
--- a/packages/core/src/Button/XDSButton.tsx
+++ b/packages/core/src/Button/XDSButton.tsx
@@ -26,7 +26,6 @@ import {
durationVars,
easeVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {XDSTooltip} from '../Tooltip/XDSTooltip';
@@ -51,11 +50,11 @@ const styles = stylex.create({
paddingInline: spacingVars['--spacing-3'],
borderWidth: 0,
borderStyle: 'none',
- '--button-radius': radiusVars['--radius-2'],
+ '--button-radius': radiusVars['--radius-element'],
borderRadius: 'var(--button-radius)',
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-medium'],
whiteSpace: 'nowrap',
cursor: 'pointer',
@@ -121,13 +120,13 @@ const styles = stylex.create({
const sizeStyles = stylex.create({
sm: {
- height: sizeVars['--size-sm'],
+ height: sizeVars['--size-element-sm'],
},
md: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
lg: {
- height: sizeVars['--size-lg'],
+ height: sizeVars['--size-element-lg'],
},
});
@@ -140,7 +139,7 @@ const sizeStyles = stylex.create({
const variants = stylex.create({
primary: {
backgroundColor: colorVars['--color-accent'],
- color: colorVars['--color-text-on-dark-media'],
+ color: colorVars['--color-on-accent'],
backgroundImage: {
default: null,
':hover': {
@@ -150,7 +149,7 @@ const variants = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
'--button-focus-offset': '3px',
outlineOffset: {
@@ -159,7 +158,7 @@ const variants = stylex.create({
},
},
secondary: {
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
color: colorVars['--color-text-primary'],
backgroundImage: {
default: null,
@@ -170,7 +169,7 @@ const variants = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
'--button-focus-offset': '3px',
outlineOffset: {
@@ -190,7 +189,7 @@ const variants = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
'--button-focus-offset': '3px',
outlineOffset: {
@@ -200,7 +199,7 @@ const variants = stylex.create({
},
destructive: {
backgroundColor: colorVars['--color-error'],
- color: colorVars['--color-text-on-dark-media'],
+ color: colorVars['--color-on-error'],
backgroundImage: {
default: null,
':hover': {
diff --git a/packages/core/src/Calendar/styles.ts b/packages/core/src/Calendar/styles.ts
index 234e751996..c7d2dd6c3f 100644
--- a/packages/core/src/Calendar/styles.ts
+++ b/packages/core/src/Calendar/styles.ts
@@ -85,8 +85,8 @@ export const monthGridStyles = stylex.create({
gridTemplateColumns: 'auto repeat(7, 1fr)',
},
dayName: {
- width: sizeVars['--size-md'],
- height: sizeVars['--size-md'],
+ width: sizeVars['--size-element-md'],
+ height: sizeVars['--size-element-md'],
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
@@ -95,7 +95,7 @@ export const monthGridStyles = stylex.create({
color: colorVars['--color-text-secondary'],
},
weekNumberHeader: {
- width: sizeVars['--size-md'],
+ width: sizeVars['--size-element-md'],
},
daysGrid: {
display: 'grid',
@@ -105,8 +105,8 @@ export const monthGridStyles = stylex.create({
gridTemplateColumns: 'auto repeat(7, 1fr)',
},
weekNumber: {
- width: sizeVars['--size-md'],
- height: sizeVars['--size-md'],
+ width: sizeVars['--size-element-md'],
+ height: sizeVars['--size-element-md'],
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
@@ -129,7 +129,7 @@ export const dayCellStyles = stylex.create({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
// Range background - structural positioning
@@ -142,13 +142,13 @@ export const dayCellStyles = stylex.create({
},
rangeBgRadiusLeft: {
left: '2px',
- borderTopLeftRadius: radiusVars['--radius-rounded'],
- borderBottomLeftRadius: radiusVars['--radius-rounded'],
+ borderTopLeftRadius: radiusVars['--radius-full'],
+ borderBottomLeftRadius: radiusVars['--radius-full'],
},
rangeBgRadiusRight: {
right: '2px',
- borderTopRightRadius: radiusVars['--radius-rounded'],
- borderBottomRightRadius: radiusVars['--radius-rounded'],
+ borderTopRightRadius: radiusVars['--radius-full'],
+ borderBottomRightRadius: radiusVars['--radius-full'],
},
rangeInsetLeft: {
left: '2px',
@@ -167,29 +167,29 @@ export const dayCellStyles = stylex.create({
},
previewBgRadiusLeft: {
left: '2px',
- borderTopLeftRadius: radiusVars['--radius-rounded'],
- borderBottomLeftRadius: radiusVars['--radius-rounded'],
+ borderTopLeftRadius: radiusVars['--radius-full'],
+ borderBottomLeftRadius: radiusVars['--radius-full'],
},
previewBgRadiusRight: {
right: '2px',
- borderTopRightRadius: radiusVars['--radius-rounded'],
- borderBottomRightRadius: radiusVars['--radius-rounded'],
+ borderTopRightRadius: radiusVars['--radius-full'],
+ borderBottomRightRadius: radiusVars['--radius-full'],
},
previewStart: {
left: '2px',
- borderTopLeftRadius: radiusVars['--radius-rounded'],
- borderBottomLeftRadius: radiusVars['--radius-rounded'],
+ borderTopLeftRadius: radiusVars['--radius-full'],
+ borderBottomLeftRadius: radiusVars['--radius-full'],
},
previewEnd: {
right: '2px',
- borderTopRightRadius: radiusVars['--radius-rounded'],
- borderBottomRightRadius: radiusVars['--radius-rounded'],
+ borderTopRightRadius: radiusVars['--radius-full'],
+ borderBottomRightRadius: radiusVars['--radius-full'],
},
// Day button - structural
day: {
- width: sizeVars['--size-sm'],
- height: sizeVars['--size-sm'],
+ width: sizeVars['--size-element-sm'],
+ height: sizeVars['--size-element-sm'],
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
@@ -258,7 +258,7 @@ export const dayCellTheme = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -284,7 +284,7 @@ export const dayCellTheme = stylex.create({
// Selected state (single selection or range endpoints)
daySelected: {
backgroundColor: colorVars['--color-accent'],
- color: colorVars['--color-text-on-dark-media'],
+ color: colorVars['--color-on-accent'],
backgroundImage: {
default: null,
':hover': {
diff --git a/packages/core/src/Card/Card.doc.mjs b/packages/core/src/Card/Card.doc.mjs
index 805c744d04..ad3ac6db41 100644
--- a/packages/core/src/Card/Card.doc.mjs
+++ b/packages/core/src/Card/Card.doc.mjs
@@ -91,7 +91,7 @@ export const docs = {
{className: 'xds-card'},
],
vars: [
- {name: '--card-radius', description: 'Border radius of the card', default: 'var(--radius-3)'},
+ {name: '--card-radius', description: 'Border radius of the card', default: 'var(--radius-container)'},
],
cssProperties: [
{
@@ -196,7 +196,7 @@ export const docsZh = {
{className: 'xds-card'},
],
vars: [
- {name: '--card-radius', description: 'Border radius of the card', default: 'var(--radius-3)'},
+ {name: '--card-radius', description: 'Border radius of the card', default: 'var(--radius-container)'},
],
cssProperties: [
{
diff --git a/packages/core/src/Card/XDSCard.tsx b/packages/core/src/Card/XDSCard.tsx
index 900f413ad7..62ef5e134e 100644
--- a/packages/core/src/Card/XDSCard.tsx
+++ b/packages/core/src/Card/XDSCard.tsx
@@ -14,7 +14,7 @@
import {type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
-import {colorVars, radiusVars} from '../theme/tokens.stylex';
+import {borderVars, colorVars, radiusVars} from '../theme/tokens.stylex';
import {container} from '../Layout/container.stylex';
import type {SpacingToken} from '../Layout/container.stylex';
import {
@@ -29,12 +29,12 @@ import {XDSBaseProps} from '../XDSBaseProps';
const styles = stylex.create({
// Outer wrapper: visual styling with clip for border-radius
cardOuter: {
- '--card-radius': radiusVars['--radius-3'],
- backgroundColor: colorVars['--color-card'],
+ '--card-radius': radiusVars['--radius-container'],
+ backgroundColor: colorVars['--color-background-card'],
borderRadius: 'var(--card-radius)',
// No drop-shadow — matches WWW XDSCard which uses border only
overflow: 'clip',
- borderWidth: 1,
+ borderWidth: borderVars['--border-width'],
borderStyle: 'solid',
borderColor: colorVars['--color-border-emphasized'],
},
diff --git a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
index 73cdff3e00..a1be6b22b0 100644
--- a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
+++ b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
@@ -29,9 +29,9 @@ import {
durationVars,
easeVars,
typographyVars,
- textSizeVars,
- lineHeightVars,
+ typeScaleVars,
fontWeightVars,
+ borderVars,
} from '../theme/tokens.stylex';
import type {XDSBaseProps} from '../XDSBaseProps';
import {XDSFieldLabel} from '../Field/XDSFieldLabel';
@@ -72,9 +72,9 @@ const styles = stylex.create({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- borderWidth: 1,
+ borderWidth: borderVars['--border-width'],
borderStyle: 'solid',
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
transitionProperty: 'background-color, border-color',
transitionDuration: {
default: durationVars['--duration-fast'],
@@ -86,7 +86,7 @@ const styles = stylex.create({
outline: {
default: 'none',
[stylex.when.ancestor(':focus-within')]:
- `2px solid ${colorVars['--color-ring-focus']}`,
+ `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: null,
@@ -98,13 +98,13 @@ const styles = stylex.create({
borderColor: {
default: colorVars['--color-border-emphasized'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-border-emphasized']}, ${colorVars['--color-hover-tint']} 20%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-border-emphasized']}, ${colorVars['--color-tint-hover']} 20%)`,
},
},
backgroundColor: {
- default: colorVars['--color-surface'],
+ default: colorVars['--color-background-surface'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-surface']}, ${colorVars['--color-hover-tint']} 5%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-background-surface']}, ${colorVars['--color-tint-hover']} 5%)`,
},
},
},
@@ -112,13 +112,13 @@ const styles = stylex.create({
borderColor: {
default: colorVars['--color-accent'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-hover-tint']} 15%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-tint-hover']} 15%)`,
},
},
backgroundColor: {
default: colorVars['--color-accent'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-hover-tint']} 15%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-tint-hover']} 15%)`,
},
},
},
@@ -138,18 +138,18 @@ const styles = stylex.create({
},
},
checkboxDisabledUnchecked: {
- backgroundColor: colorVars['--color-muted'],
+ backgroundColor: colorVars['--color-background-muted'],
},
checkmark: {
display: 'none',
- color: colorVars['--color-icon-on-dark-media'],
+ color: colorVars['--color-on-accent'],
},
checkmarkVisible: {
display: 'block',
},
indeterminateMark: {
display: 'none',
- backgroundColor: colorVars['--color-icon-on-dark-media'],
+ backgroundColor: colorVars['--color-on-accent'],
borderRadius: 1,
},
indeterminateMarkVisible: {
@@ -161,9 +161,9 @@ const styles = stylex.create({
gap: spacingVars['--spacing-0-5'],
},
description: {
- fontFamily: typographyVars['--font-body'],
- fontSize: textSizeVars['--text-xsm'],
- lineHeight: lineHeightVars['--leading-relaxed'],
+ fontFamily: typographyVars['--font-family-body'],
+ fontSize: typeScaleVars['--text-supporting-size'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-secondary'],
},
diff --git a/packages/core/src/Collapsible/XDSCollapsible.tsx b/packages/core/src/Collapsible/XDSCollapsible.tsx
index dee5b30162..c4c8ec49e5 100644
--- a/packages/core/src/Collapsible/XDSCollapsible.tsx
+++ b/packages/core/src/Collapsible/XDSCollapsible.tsx
@@ -43,7 +43,7 @@ const styles = stylex.create({
justifyContent: 'space-between',
width: '100%',
cursor: 'pointer',
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-large-size'],
fontWeight: fontWeightVars['--font-weight-semibold'],
color: colorVars['--color-text-primary'],
diff --git a/packages/core/src/DateInput/XDSDateInput.tsx b/packages/core/src/DateInput/XDSDateInput.tsx
index 9c38d49940..da4ccc6ef9 100644
--- a/packages/core/src/DateInput/XDSDateInput.tsx
+++ b/packages/core/src/DateInput/XDSDateInput.tsx
@@ -30,8 +30,8 @@ import {
radiusVars,
shadowVars,
typographyVars,
- lineHeightVars,
typeScaleVars,
+ borderVars,
} from '../theme/tokens.stylex';
import {
XDSField,
@@ -64,10 +64,10 @@ const styles = stylex.create({
borderStyle: 'none',
backgroundColor: 'transparent',
cursor: 'pointer',
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
outline: {
default: 'none',
- ':focus-visible': `1px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `${borderVars['--border-width']} solid ${colorVars['--color-accent']}`,
},
outlineOffset: 1,
},
@@ -81,9 +81,9 @@ const styles = stylex.create({
borderWidth: 0,
borderStyle: 'none',
padding: 0,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-normal'],
+ lineHeight: typeScaleVars['--text-body-leading'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
outline: 'none',
@@ -98,21 +98,21 @@ const styles = stylex.create({
color: colorVars['--color-text-secondary'],
},
popover: {
- backgroundColor: colorVars['--color-popover'],
- borderRadius: radiusVars['--radius-3'],
- boxShadow: shadowVars['--shadow-menu'],
+ backgroundColor: colorVars['--color-background-popover'],
+ borderRadius: radiusVars['--radius-container'],
+ boxShadow: shadowVars['--shadow-low'],
},
});
const sizeStyles = stylex.create({
sm: {
- height: sizeVars['--size-sm'],
+ height: sizeVars['--size-element-sm'],
},
md: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
lg: {
- height: sizeVars['--size-lg'],
+ height: sizeVars['--size-element-lg'],
},
});
diff --git a/packages/core/src/Dialog/Dialog.doc.mjs b/packages/core/src/Dialog/Dialog.doc.mjs
index a077bac3ac..6e4838944f 100644
--- a/packages/core/src/Dialog/Dialog.doc.mjs
+++ b/packages/core/src/Dialog/Dialog.doc.mjs
@@ -106,7 +106,7 @@ function Example() {
{className: 'xds-dialog', visualProps: ['variant']},
],
vars: [
- {name: '--dialog-radius', description: 'Border radius of the dialog', default: 'var(--radius-3)'},
+ {name: '--dialog-radius', description: 'Border radius of the dialog', default: 'var(--radius-container)'},
],
},
keyboard:
@@ -365,7 +365,7 @@ function Example() {
{className: 'xds-dialog', visualProps: ['variant']},
],
vars: [
- {name: '--dialog-radius', description: 'Border radius of the dialog', default: 'var(--radius-3)'},
+ {name: '--dialog-radius', description: 'Border radius of the dialog', default: 'var(--radius-container)'},
],
},
keyboard:
diff --git a/packages/core/src/Dialog/XDSDialog.tsx b/packages/core/src/Dialog/XDSDialog.tsx
index 26f4651416..756bd1cf22 100644
--- a/packages/core/src/Dialog/XDSDialog.tsx
+++ b/packages/core/src/Dialog/XDSDialog.tsx
@@ -80,10 +80,10 @@ const styles = stylex.create({
margin: 'auto',
padding: 0,
border: 'none',
- backgroundColor: colorVars['--color-surface'],
- '--dialog-radius': radiusVars['--radius-3'],
+ backgroundColor: colorVars['--color-background-surface'],
+ '--dialog-radius': radiusVars['--radius-container'],
borderRadius: 'var(--dialog-radius)',
- boxShadow: shadowVars['--shadow-dialog'],
+ boxShadow: shadowVars['--shadow-high'],
display: {
default: 'none',
':where([open])': 'flex',
@@ -113,7 +113,7 @@ const styles = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
diff --git a/packages/core/src/Divider/XDSDivider.tsx b/packages/core/src/Divider/XDSDivider.tsx
index ccd61a2a8a..bcaaae6360 100644
--- a/packages/core/src/Divider/XDSDivider.tsx
+++ b/packages/core/src/Divider/XDSDivider.tsx
@@ -12,17 +12,11 @@
* - /apps/storybook/stories/Divider.stories.tsx
*/
-
import {type HTMLAttributes, type ReactNode} from 'react';
import type {XDSBaseProps} from '../XDSBaseProps';
import * as stylex from '@stylexjs/stylex';
import type {StyleXStyles} from '@stylexjs/stylex';
-import {
- colorVars,
- spacingVars,
- lineHeightVars,
- typeScaleVars,
-} from '../theme/tokens.stylex';
+import {colorVars, spacingVars, typeScaleVars} from '../theme/tokens.stylex';
import {xdsClassName, mergeProps} from '../utils';
/**
@@ -141,10 +135,10 @@ const labelStyles = stylex.create({
label: {
flexShrink: 0,
paddingInline: spacingVars['--spacing-3'],
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
// Small secondary text styling
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-normal'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
},
verticalLabel: {
diff --git a/packages/core/src/DropdownMenu/DropdownMenu.doc.mjs b/packages/core/src/DropdownMenu/DropdownMenu.doc.mjs
index 2ed15c26d4..b34122dd5e 100644
--- a/packages/core/src/DropdownMenu/DropdownMenu.doc.mjs
+++ b/packages/core/src/DropdownMenu/DropdownMenu.doc.mjs
@@ -102,7 +102,7 @@ export const docs = {
{className: 'xds-dropdown-menu-item'},
],
vars: [
- {name: '--dropdown-radius', description: 'Border radius of the menu popup', default: 'var(--radius-2)'},
+ {name: '--dropdown-radius', description: 'Border radius of the menu popup', default: 'var(--radius-element)'},
{name: '--dropdown-padding', description: 'Inner padding of the menu popup', default: 'var(--spacing-1)'},
],
},
@@ -437,7 +437,7 @@ export const docsZh = {
{className: 'xds-dropdown-menu-item'},
],
vars: [
- {name: '--dropdown-radius', description: 'Border radius of the menu popup', default: 'var(--radius-2)'},
+ {name: '--dropdown-radius', description: 'Border radius of the menu popup', default: 'var(--radius-element)'},
{name: '--dropdown-padding', description: 'Inner padding of the menu popup', default: 'var(--spacing-1)'},
],
},
diff --git a/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx b/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx
index 264c2b3a0e..669ab69054 100644
--- a/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx
+++ b/packages/core/src/DropdownMenu/XDSDropdownMenu.tsx
@@ -47,12 +47,12 @@ const styles = stylex.create({
boxSizing: 'border-box',
maxHeight: '300px',
overflowY: 'auto',
- '--dropdown-radius': radiusVars['--radius-2'],
+ '--dropdown-radius': radiusVars['--radius-element'],
'--dropdown-padding': spacingVars['--spacing-1'],
padding: spacingVars['--spacing-1'],
borderRadius: 'var(--dropdown-radius)',
- backgroundColor: colorVars['--color-surface'],
- boxShadow: shadowVars['--shadow-menu'],
+ backgroundColor: colorVars['--color-background-surface'],
+ boxShadow: shadowVars['--shadow-low'],
opacity: 1,
transitionProperty: 'opacity',
transitionDuration: durationVars['--duration-fast'],
@@ -95,7 +95,7 @@ const styles = stylex.create({
padding: spacingVars['--spacing-2'],
borderRadius:
'max(0px, calc(var(--dropdown-radius) - var(--dropdown-padding)))',
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-label-size'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
diff --git a/packages/core/src/EmptyState/XDSEmptyState.tsx b/packages/core/src/EmptyState/XDSEmptyState.tsx
index dfa7523ca2..3b937483be 100644
--- a/packages/core/src/EmptyState/XDSEmptyState.tsx
+++ b/packages/core/src/EmptyState/XDSEmptyState.tsx
@@ -18,7 +18,6 @@ import {
colorVars,
spacingVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {xdsClassName, mergeProps} from '../utils';
@@ -44,7 +43,7 @@ const styles = stylex.create({
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-large-size'],
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-large-leading'],
color: colorVars['--color-text-primary'],
},
titleCompact: {
@@ -55,7 +54,7 @@ const styles = stylex.create({
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-body-size'],
fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-body-leading'],
color: colorVars['--color-text-secondary'],
},
descriptionCompact: {
diff --git a/packages/core/src/Field/Field.doc.mjs b/packages/core/src/Field/Field.doc.mjs
index 1ab5c07442..4083a5526d 100644
--- a/packages/core/src/Field/Field.doc.mjs
+++ b/packages/core/src/Field/Field.doc.mjs
@@ -76,7 +76,7 @@ const bioDescId = useId();
{className: 'xds-field-status', visualProps: ['type', 'variant']},
],
vars: [
- {name: '--input-radius', description: 'Border radius of input fields', default: 'var(--radius-2)'},
+ {name: '--input-radius', description: 'Border radius of input fields', default: 'var(--radius-element)'},
],
},
notes: [
@@ -389,7 +389,7 @@ const bioDescId = useId();
{className: 'xds-field-status', visualProps: ['type', 'variant']},
],
vars: [
- {name: '--input-radius', description: 'Border radius of input fields', default: 'var(--radius-2)'},
+ {name: '--input-radius', description: 'Border radius of input fields', default: 'var(--radius-element)'},
],
},
notes: [
diff --git a/packages/core/src/Field/XDSField.tsx b/packages/core/src/Field/XDSField.tsx
index bc50966972..d2a6ed861f 100644
--- a/packages/core/src/Field/XDSField.tsx
+++ b/packages/core/src/Field/XDSField.tsx
@@ -21,7 +21,6 @@ import {XDSFieldStatus} from './XDSFieldStatus';
import {
colorVars,
fontWeightVars,
- lineHeightVars,
spacingVars,
typographyVars,
typeScaleVars,
@@ -50,10 +49,14 @@ const styles = stylex.create({
whiteSpace: 'nowrap',
width: 1,
},
+ labelGroup: {
+ display: 'flex',
+ flexDirection: 'column',
+ },
description: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-secondary'],
},
@@ -217,25 +220,27 @@ export function XDSField({
style,
)}
{...props}>
- <XDSFieldLabel
- label={label}
- inputID={inputID}
- isLabelHidden={isLabelHidden}
- isOptional={isOptional}
- isRequired={isRequired}
- labelIcon={labelIcon}
- labelTooltip={labelTooltip}
- />
- {description && (
- <span
- id={resolvedDescriptionID}
- {...stylex.props(
- styles.description,
- isLabelHidden && styles.labelHidden,
- )}>
- {description}
- </span>
- )}
+ <div {...stylex.props(styles.labelGroup)}>
+ <XDSFieldLabel
+ label={label}
+ inputID={inputID}
+ isLabelHidden={isLabelHidden}
+ isOptional={isOptional}
+ isRequired={isRequired}
+ labelIcon={labelIcon}
+ labelTooltip={labelTooltip}
+ />
+ {description && (
+ <span
+ id={resolvedDescriptionID}
+ {...stylex.props(
+ styles.description,
+ isLabelHidden && styles.labelHidden,
+ )}>
+ {description}
+ </span>
+ )}
+ </div>
{statusVariant === 'attached' ? (
<div {...stylex.props(styles.inputStatusWrapper)}>
{children}
diff --git a/packages/core/src/Field/XDSFieldLabel.tsx b/packages/core/src/Field/XDSFieldLabel.tsx
index 9d2f4bb541..9c78d8e2e3 100644
--- a/packages/core/src/Field/XDSFieldLabel.tsx
+++ b/packages/core/src/Field/XDSFieldLabel.tsx
@@ -27,7 +27,7 @@ const styles = stylex.create({
display: 'flex',
alignItems: 'center',
gap: spacingVars['--spacing-1'],
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-label-size'],
fontWeight: fontWeightVars['--font-weight-medium'],
color: {
diff --git a/packages/core/src/Field/XDSFieldStatus.tsx b/packages/core/src/Field/XDSFieldStatus.tsx
index 2d4544b77c..187ddcfc1c 100644
--- a/packages/core/src/Field/XDSFieldStatus.tsx
+++ b/packages/core/src/Field/XDSFieldStatus.tsx
@@ -13,7 +13,6 @@ import * as stylex from '@stylexjs/stylex';
import {xdsClassName, mergeProps} from '../utils';
import {
colorVars,
- lineHeightVars,
radiusVars,
spacingVars,
typographyVars,
@@ -23,38 +22,38 @@ import type {XDSInputStatusType} from './types';
const styles = stylex.create({
base: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
attached: {
marginTop: `calc(-1 * ${spacingVars['--spacing-1-5']})`,
paddingBlockStart: `calc(${spacingVars['--spacing-1-5']} + ${spacingVars['--spacing-2']})`,
paddingBlockEnd: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-2'],
- borderBottomLeftRadius: radiusVars['--radius-2'],
- borderBottomRightRadius: radiusVars['--radius-2'],
+ borderBottomLeftRadius: radiusVars['--radius-element'],
+ borderBottomRightRadius: radiusVars['--radius-element'],
},
detached: {
marginTop: spacingVars['--spacing-1'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
},
});
const colorStyles = stylex.create({
warning: {
backgroundColor: colorVars['--color-warning-muted'],
- color: colorVars['--color-yellow-text'],
+ color: colorVars['--color-text-yellow'],
},
error: {
backgroundColor: colorVars['--color-error-muted'],
- color: colorVars['--color-red-text'],
+ color: colorVars['--color-text-red'],
},
success: {
backgroundColor: colorVars['--color-success-muted'],
- color: colorVars['--color-green-text'],
+ color: colorVars['--color-text-green'],
},
});
diff --git a/packages/core/src/Field/inputStyles.stylex.ts b/packages/core/src/Field/inputStyles.stylex.ts
index 6cd02dd2d1..2669000ee4 100644
--- a/packages/core/src/Field/inputStyles.stylex.ts
+++ b/packages/core/src/Field/inputStyles.stylex.ts
@@ -19,6 +19,7 @@ import {
shadowVars,
durationVars,
easeVars,
+ borderVars,
} from '../theme/tokens.stylex';
/**
@@ -35,17 +36,17 @@ export const inputWrapperStyles = stylex.create({
gap: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-1'],
paddingInline: spacingVars['--spacing-2'],
- borderWidth: '1px',
+ borderWidth: borderVars['--border-width'],
borderStyle: 'solid',
borderColor: {
default: colorVars['--color-border-emphasized'],
':hover': {
- '@media (hover: hover)': colorVars['--color-border-strong'],
+ '@media (hover: hover)': colorVars['--color-border-emphasized'],
},
},
- '--input-radius': radiusVars['--radius-2'],
+ '--input-radius': radiusVars['--radius-element'],
borderRadius: 'var(--input-radius)',
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
transitionProperty: 'border-color, outline, box-shadow',
transitionDuration: {
default: durationVars['--duration-fast'],
@@ -55,12 +56,12 @@ export const inputWrapperStyles = stylex.create({
boxShadow: {
default: 'none',
':hover': {
- '@media (hover: hover)': shadowVars['--inset-shadow-border-hover'],
+ '@media (hover: hover)': shadowVars['--shadow-inset-hover'],
},
},
outline: {
default: 'none',
- ':focus-within': `1px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-within': `${borderVars['--border-width']} solid ${colorVars['--color-accent']}`,
},
outlineOffset: '0',
},
@@ -96,7 +97,7 @@ export const inputStatusHoverShadowStyles = stylex.create({
boxShadow: {
default: 'none',
':hover': {
- '@media (hover: hover)': shadowVars['--inset-shadow-border-warning'],
+ '@media (hover: hover)': shadowVars['--shadow-inset-warning'],
},
},
},
@@ -104,7 +105,7 @@ export const inputStatusHoverShadowStyles = stylex.create({
boxShadow: {
default: 'none',
':hover': {
- '@media (hover: hover)': shadowVars['--inset-shadow-border-negative'],
+ '@media (hover: hover)': shadowVars['--shadow-inset-error'],
},
},
},
@@ -112,7 +113,7 @@ export const inputStatusHoverShadowStyles = stylex.create({
boxShadow: {
default: 'none',
':hover': {
- '@media (hover: hover)': shadowVars['--inset-shadow-border-positive'],
+ '@media (hover: hover)': shadowVars['--shadow-inset-success'],
},
},
},
@@ -127,19 +128,19 @@ export const inputStatusFocusWithinStyles = stylex.create({
warning: {
outline: {
default: 'none',
- ':focus-within': `1px solid ${colorVars['--color-ring-focus-warning']}`,
+ ':focus-within': `${borderVars['--border-width']} solid ${colorVars['--color-warning']}`,
},
},
error: {
outline: {
default: 'none',
- ':focus-within': `1px solid ${colorVars['--color-ring-focus-error']}`,
+ ':focus-within': `${borderVars['--border-width']} solid ${colorVars['--color-error']}`,
},
},
success: {
outline: {
default: 'none',
- ':focus-within': `1px solid ${colorVars['--color-ring-focus-success']}`,
+ ':focus-within': `${borderVars['--border-width']} solid ${colorVars['--color-success']}`,
},
},
});
@@ -153,19 +154,19 @@ export const inputStatusFocusStyles = stylex.create({
warning: {
outline: {
default: 'none',
- ':focus': `1px solid ${colorVars['--color-ring-focus-warning']}`,
+ ':focus': `${borderVars['--border-width']} solid ${colorVars['--color-warning']}`,
},
},
error: {
outline: {
default: 'none',
- ':focus': `1px solid ${colorVars['--color-ring-focus-error']}`,
+ ':focus': `${borderVars['--border-width']} solid ${colorVars['--color-error']}`,
},
},
success: {
outline: {
default: 'none',
- ':focus': `1px solid ${colorVars['--color-ring-focus-success']}`,
+ ':focus': `${borderVars['--border-width']} solid ${colorVars['--color-success']}`,
},
},
});
diff --git a/packages/core/src/HoverCard/HoverCard.doc.mjs b/packages/core/src/HoverCard/HoverCard.doc.mjs
index 6dce8bda73..8b8289446a 100644
--- a/packages/core/src/HoverCard/HoverCard.doc.mjs
+++ b/packages/core/src/HoverCard/HoverCard.doc.mjs
@@ -30,7 +30,7 @@ export const docs = {
{className: 'xds-hovercard'},
],
vars: [
- {name: '--hovercard-radius', description: 'Border radius of the hover card', default: 'var(--radius-3)'},
+ {name: '--hovercard-radius', description: 'Border radius of the hover card', default: 'var(--radius-container)'},
],
},
examples: [
@@ -229,7 +229,7 @@ export const docsZh = {
{className: 'xds-hovercard'},
],
vars: [
- {name: '--hovercard-radius', description: 'Border radius of the hover card', default: 'var(--radius-3)'},
+ {name: '--hovercard-radius', description: 'Border radius of the hover card', default: 'var(--radius-container)'},
],
},
examples: [
diff --git a/packages/core/src/HoverCard/useXDSHoverCard.tsx b/packages/core/src/HoverCard/useXDSHoverCard.tsx
index 2e9376839c..51d8387ebf 100644
--- a/packages/core/src/HoverCard/useXDSHoverCard.tsx
+++ b/packages/core/src/HoverCard/useXDSHoverCard.tsx
@@ -10,7 +10,6 @@
* - /packages/core/src/HoverCard/index.ts
*/
-
import {
useCallback,
useEffect,
@@ -38,10 +37,10 @@ import {xdsClassName, mergeProps} from '../utils';
const styles = stylex.create({
// Base container styles passed to useXDSLayer (includes animations)
container: {
- backgroundColor: colorVars['--color-surface'],
- '--hovercard-radius': radiusVars['--radius-3'],
+ backgroundColor: colorVars['--color-background-surface'],
+ '--hovercard-radius': radiusVars['--radius-container'],
borderRadius: 'var(--hovercard-radius)',
- boxShadow: shadowVars['--shadow-hover'],
+ boxShadow: shadowVars['--shadow-med'],
// Animation: closed state (default) and open state
opacity: {
default: 0,
diff --git a/packages/core/src/Kbd/Kbd.doc.mjs b/packages/core/src/Kbd/Kbd.doc.mjs
index 39ddb6a269..a09c0a9bff 100644
--- a/packages/core/src/Kbd/Kbd.doc.mjs
+++ b/packages/core/src/Kbd/Kbd.doc.mjs
@@ -63,7 +63,7 @@ export const docs = {
keyboard: 'Not interactive — purely presentational',
notes: [
'Fixed 20px height with min-width 20px per key badge',
- 'Uses --color-wash background and --color-text-secondary text color',
+ 'Uses --color-background-body background and --color-text-secondary text color',
'Key display symbols follow macOS conventions (⌘, ⌥, ⇧, ⌃)',
],
};
@@ -132,7 +132,7 @@ export const docsZh = {
keyboard: '非交互式 — 纯展示用途',
notes: [
'固定 20px 高度,每个按键徽章最小宽度 20px',
- '使用 --color-wash 背景色和 --color-text-secondary 文字颜色',
+ '使用 --color-background-body 背景色和 --color-text-secondary 文字颜色',
'按键显示符号遵循 macOS 惯例(⌘、⌥、⇧、⌃)',
],
};
@@ -149,7 +149,7 @@ export const docsDense = {
],
notes: [
'Fixed 20px height w/ min-width 20px per key badge',
- 'Uses --color-wash background + --color-text-secondary text color',
+ 'Uses --color-background-body background + --color-text-secondary text color',
'Key display symbols follow macOS conventions (\u2318, \u2325, \u21e7, \u2303)',
],
accessibility: [
diff --git a/packages/core/src/Kbd/XDSKbd.tsx b/packages/core/src/Kbd/XDSKbd.tsx
index 4ba19d197c..44b4057bae 100644
--- a/packages/core/src/Kbd/XDSKbd.tsx
+++ b/packages/core/src/Kbd/XDSKbd.tsx
@@ -18,7 +18,6 @@ import {
radiusVars,
typographyVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
@@ -36,16 +35,16 @@ const styles = stylex.create({
minWidth: '20px',
height: '20px',
paddingInline: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-1'],
- backgroundColor: colorVars['--color-secondary'],
+ borderRadius: radiusVars['--radius-inner'],
+ backgroundColor: colorVars['--color-neutral'],
borderBottomWidth: '2px',
borderBottomStyle: 'solid',
borderBottomColor: colorVars['--color-border'],
color: colorVars['--color-text-secondary'],
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-supporting-size'],
fontWeight: fontWeightVars['--font-weight-medium'],
- lineHeight: lineHeightVars['--leading-tight'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
userSelect: 'none',
},
});
diff --git a/packages/core/src/Link/XDSLink.tsx b/packages/core/src/Link/XDSLink.tsx
index d40ddfeeec..659ad433ad 100644
--- a/packages/core/src/Link/XDSLink.tsx
+++ b/packages/core/src/Link/XDSLink.tsx
@@ -13,7 +13,6 @@
* - /apps/storybook/stories/Link.stories.tsx (storybook stories)
*/
-
import {type MouseEventHandler, type ReactNode} from 'react';
import type {XDSBaseProps} from '../XDSBaseProps';
import * as stylex from '@stylexjs/stylex';
@@ -22,7 +21,6 @@ import {
colorVars,
durationVars,
easeVars,
- lineHeightVars,
spacingVars,
typeScaleVars,
} from '../theme/tokens.stylex';
@@ -64,7 +62,7 @@ const styles = stylex.create({
transitionTimingFunction: easeVars['--ease-standard'],
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -81,7 +79,7 @@ const styles = stylex.create({
},
standalone: {
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-body-leading'],
},
});
diff --git a/packages/core/src/List/XDSListItem.tsx b/packages/core/src/List/XDSListItem.tsx
index deb5a644b0..c098756e32 100644
--- a/packages/core/src/List/XDSListItem.tsx
+++ b/packages/core/src/List/XDSListItem.tsx
@@ -20,10 +20,10 @@ import {
colorVars,
radiusVars,
spacingVars,
- lineHeightVars,
durationVars,
easeVars,
typeScaleVars,
+ borderVars,
} from '../theme/tokens.stylex';
import {XDSListContext} from './XDSListContext';
import {xdsClassName, mergeProps} from '../utils';
@@ -148,13 +148,13 @@ const styles = stylex.create({
gap: spacingVars['--spacing-3'],
},
withRadius: {
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
},
noRadius: {
borderRadius: 0,
},
withDivider: {
- borderBlockEnd: `1px solid ${colorVars['--color-border']}`,
+ borderBlockEnd: `${borderVars['--border-width']} solid ${colorVars['--color-border']}`,
':last-child': {
borderBlockEnd: 'none',
},
@@ -175,7 +175,7 @@ const styles = stylex.create({
focusWithinOutline: {
outline: {
default: 'none',
- ':focus-within': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-within': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -252,33 +252,33 @@ const densityStyles = stylex.create({
compact: {
paddingBlock: spacingVars['--spacing-1'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-body-leading'],
},
balanced: {
paddingBlock: spacingVars['--spacing-2'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-body-leading'],
},
spacious: {
paddingBlock: spacingVars['--spacing-3'],
paddingInline: spacingVars['--spacing-3'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-normal'],
+ lineHeight: typeScaleVars['--text-body-leading'],
},
});
const descriptionSizeStyles = stylex.create({
compact: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
balanced: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
spacious: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-normal'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
});
diff --git a/packages/core/src/MobileNav/XDSMobileNav.tsx b/packages/core/src/MobileNav/XDSMobileNav.tsx
index e2c8050532..fdbd2e8347 100644
--- a/packages/core/src/MobileNav/XDSMobileNav.tsx
+++ b/packages/core/src/MobileNav/XDSMobileNav.tsx
@@ -23,7 +23,6 @@
* - /packages/core/src/MobileNav/index.ts (exports if types change)
*/
-
import {useCallback, useEffect, useRef, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import {
@@ -97,7 +96,7 @@ const styles = stylex.create({
bottom: 0,
display: 'flex',
flexDirection: 'column',
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
boxSizing: 'border-box',
overflow: 'hidden',
transitionProperty: 'transform',
diff --git a/packages/core/src/MoreMenu/XDSMoreMenu.tsx b/packages/core/src/MoreMenu/XDSMoreMenu.tsx
index 5086e6c465..074e1b7181 100644
--- a/packages/core/src/MoreMenu/XDSMoreMenu.tsx
+++ b/packages/core/src/MoreMenu/XDSMoreMenu.tsx
@@ -16,7 +16,6 @@
* - /apps/storybook/stories/MoreMenu.stories.tsx
*/
-
import {
useCallback,
useId,
@@ -59,9 +58,9 @@ const styles = stylex.create({
maxHeight: '300px',
overflowY: 'auto',
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-surface'],
- boxShadow: shadowVars['--shadow-menu'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-background-surface'],
+ boxShadow: shadowVars['--shadow-low'],
opacity: 1,
transitionProperty: 'opacity',
transitionDuration: durationVars['--duration-fast'],
@@ -87,8 +86,8 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
width: '100%',
padding: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-1'],
- fontFamily: typographyVars['--font-body'],
+ borderRadius: radiusVars['--radius-inner'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-label-size'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
diff --git a/packages/core/src/NavIcon/NavIcon.doc.mjs b/packages/core/src/NavIcon/NavIcon.doc.mjs
index 54af90233a..e1d9c13f3a 100644
--- a/packages/core/src/NavIcon/NavIcon.doc.mjs
+++ b/packages/core/src/NavIcon/NavIcon.doc.mjs
@@ -6,8 +6,8 @@ export const docs = {
'Circular icon container with accent background for navigation headers.',
features: [
'Shared — used in both XDSTopNavHeading and XDSPageNavHeader',
- 'Accent background — uses --color-accent with --color-icon-on-dark-media contrast',
- 'Fixed size — renders at the medium (--size-md) design token size',
+ 'Accent background — uses --color-accent with --color-on-accent contrast',
+ 'Fixed size — renders at the medium (--size-element-md) design token size',
],
props: [
{
@@ -61,8 +61,8 @@ export const docsZh = {
'用于导航头部的带强调色背景的圆形图标容器。',
features: [
'共享 — 同时用于 XDSTopNavHeading 和 XDSPageNavHeader',
- '强调色背景 — 使用 --color-accent 配合 --color-icon-on-dark-media 对比色',
- '固定尺寸 — 以中等尺寸 (--size-md) 设计令牌渲染',
+ '强调色背景 — 使用 --color-accent 配合 --color-on-accent 对比色',
+ '固定尺寸 — 以中等尺寸 (--size-element-md) 设计令牌渲染',
],
props: [
{
@@ -115,8 +115,8 @@ export const docsDense = {
'Circular icon container w/ accent background for navigation headers.',
features: [
'Shared; used in both XDSTopNavHeading + XDSPageNavHeader',
- 'Accent background; uses --color-accent w/ --color-icon-on-dark-media contrast',
- 'Fixed size; renders at medium (--size-md) design token size',
+ 'Accent background; uses --color-accent w/ --color-on-accent contrast',
+ 'Fixed size; renders at medium (--size-element-md) design token size',
],
propDescriptions: {
icon: 'Icon element inside circular background. Should be XDSIcon or similar.',
diff --git a/packages/core/src/NavIcon/XDSNavIcon.tsx b/packages/core/src/NavIcon/XDSNavIcon.tsx
index f72d74bd86..0b8920ae3d 100644
--- a/packages/core/src/NavIcon/XDSNavIcon.tsx
+++ b/packages/core/src/NavIcon/XDSNavIcon.tsx
@@ -28,10 +28,10 @@ const styles = stylex.create({
justifyContent: 'center',
borderRadius: '50%',
backgroundColor: colorVars['--color-accent'],
- color: colorVars['--color-icon-on-dark-media'],
+ color: colorVars['--color-on-accent'],
flexShrink: 0,
- width: sizeVars['--size-md'],
- height: sizeVars['--size-md'],
+ width: sizeVars['--size-element-md'],
+ height: sizeVars['--size-element-md'],
},
});
diff --git a/packages/core/src/NavItem/navItemStyles.stylex.ts b/packages/core/src/NavItem/navItemStyles.stylex.ts
index f854dd4cd8..0c4503566b 100644
--- a/packages/core/src/NavItem/navItemStyles.stylex.ts
+++ b/packages/core/src/NavItem/navItemStyles.stylex.ts
@@ -20,7 +20,6 @@ import {
radiusVars,
typeScaleVars,
fontWeightVars,
- lineHeightVars,
} from '../theme/tokens.stylex';
/**
@@ -49,7 +48,7 @@ export const navItemStyles = stylex.create({
width: '100%',
paddingInline: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
borderWidth: 0,
borderStyle: 'none',
backgroundColor: 'transparent',
@@ -59,7 +58,7 @@ export const navItemStyles = stylex.create({
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-label-size'],
fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
textAlign: 'start',
boxSizing: 'border-box',
':hover': {
@@ -74,15 +73,15 @@ export const navItemStyles = stylex.create({
/** Selected/active page indicator — deemphasized background, medium weight */
selected: {
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
fontWeight: fontWeightVars['--font-weight-medium'],
':hover': {
'@media (hover: hover)': {
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
},
},
':active': {
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
},
},
diff --git a/packages/core/src/NumberInput/XDSNumberInput.tsx b/packages/core/src/NumberInput/XDSNumberInput.tsx
index b319ab6a1f..54f1392a9e 100644
--- a/packages/core/src/NumberInput/XDSNumberInput.tsx
+++ b/packages/core/src/NumberInput/XDSNumberInput.tsx
@@ -13,7 +13,6 @@
* - /apps/storybook/stories/NumberInput.stories.tsx (storybook stories)
*/
-
import {
useId,
useState,
@@ -29,7 +28,6 @@ import {
colorVars,
sizeVars,
typographyVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {
@@ -54,9 +52,9 @@ const styles = stylex.create({
borderWidth: 0,
borderStyle: 'none',
padding: 0,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-body-leading'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
outline: 'none',
@@ -71,9 +69,9 @@ const styles = stylex.create({
color: colorVars['--color-text-secondary'],
},
units: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-body-leading'],
color: colorVars['--color-text-secondary'],
flexShrink: 0,
},
@@ -81,13 +79,13 @@ const styles = stylex.create({
const sizeStyles = stylex.create({
sm: {
- height: sizeVars['--size-sm'],
+ height: sizeVars['--size-element-sm'],
},
md: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
lg: {
- height: sizeVars['--size-lg'],
+ height: sizeVars['--size-element-lg'],
},
});
diff --git a/packages/core/src/Pagination/XDSPagination.tsx b/packages/core/src/Pagination/XDSPagination.tsx
index 07f9b76cb0..44c3a7f0f3 100644
--- a/packages/core/src/Pagination/XDSPagination.tsx
+++ b/packages/core/src/Pagination/XDSPagination.tsx
@@ -184,15 +184,15 @@ const styles = stylex.create({
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
- minWidth: sizeVars['--size-md'],
- height: sizeVars['--size-md'],
+ minWidth: sizeVars['--size-element-md'],
+ height: sizeVars['--size-element-md'],
color: colorVars['--color-text-secondary'],
fontSize: typeScaleVars['--text-label-size'],
userSelect: 'none',
},
ellipsisSm: {
- minWidth: sizeVars['--size-sm'],
- height: sizeVars['--size-sm'],
+ minWidth: sizeVars['--size-element-sm'],
+ height: sizeVars['--size-element-sm'],
fontSize: typeScaleVars['--text-supporting-size'],
},
infoText: {
@@ -212,14 +212,14 @@ const styles = stylex.create({
borderStyle: 'none',
padding: 0,
borderRadius: '50%',
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
cursor: 'pointer',
transitionProperty: 'background-color',
transitionDuration: durationVars['--duration-fast'],
transitionTimingFunction: easeVars['--ease-standard'],
outline: {
default: 'none',
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
diff --git a/packages/core/src/Popover/Popover.doc.mjs b/packages/core/src/Popover/Popover.doc.mjs
index 7de2d2aa42..17cc668b6a 100644
--- a/packages/core/src/Popover/Popover.doc.mjs
+++ b/packages/core/src/Popover/Popover.doc.mjs
@@ -215,7 +215,7 @@ export const docs = {
{className: 'xds-popover'},
],
vars: [
- {name: '--popover-radius', description: 'Border radius of the popover', default: 'var(--radius-2)'},
+ {name: '--popover-radius', description: 'Border radius of the popover', default: 'var(--radius-element)'},
],
},
};
@@ -431,7 +431,7 @@ export const docsZh = {
{className: 'xds-popover'},
],
vars: [
- {name: '--popover-radius', description: 'Border radius of the popover', default: 'var(--radius-2)'},
+ {name: '--popover-radius', description: 'Border radius of the popover', default: 'var(--radius-element)'},
],
},
};
diff --git a/packages/core/src/Popover/XDSPopover.tsx b/packages/core/src/Popover/XDSPopover.tsx
index bbcdbca4ae..5c1cf31e14 100644
--- a/packages/core/src/Popover/XDSPopover.tsx
+++ b/packages/core/src/Popover/XDSPopover.tsx
@@ -14,7 +14,6 @@
* - /apps/storybook/stories/Popover.stories.tsx
*/
-
import React, {
useCallback,
useLayoutEffect,
@@ -193,10 +192,10 @@ const styles = stylex.create({
},
// Visual styles for the inner content container
container: {
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
color: colorVars['--color-text-primary'],
- borderRadius: radiusVars['--radius-2'],
- boxShadow: shadowVars['--shadow-menu'],
+ borderRadius: radiusVars['--radius-element'],
+ boxShadow: shadowVars['--shadow-low'],
},
contentPadding: {
paddingBlockStart: spacingVars['--spacing-3'],
diff --git a/packages/core/src/Popover/useXDSPopover.tsx b/packages/core/src/Popover/useXDSPopover.tsx
index 95f711bda5..f062f9f3af 100644
--- a/packages/core/src/Popover/useXDSPopover.tsx
+++ b/packages/core/src/Popover/useXDSPopover.tsx
@@ -13,7 +13,6 @@
* - /packages/core/src/Popover/index.ts
*/
-
import React, {
useCallback,
useEffect,
@@ -70,13 +69,13 @@ const styles = stylex.create({
whiteSpace: 'nowrap',
// Inverted color palette (like tooltip): dark background, light text
backgroundColor: colorVars['--color-text-primary'],
- color: colorVars['--color-surface'],
+ color: colorVars['--color-background-surface'],
fontSize: typeScaleVars['--text-supporting-size'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
cursor: 'pointer',
borderWidth: 0,
borderStyle: 'none',
- outline: `2px solid ${colorVars['--color-ring-focus']}`,
+ outline: `2px solid ${colorVars['--color-accent']}`,
outlineOffset: 2,
zIndex: 1,
pointerEvents: 'auto', // Re-enable mouse clicks when visible
diff --git a/packages/core/src/PowerSearch/PowerSearchEditPopover.tsx b/packages/core/src/PowerSearch/PowerSearchEditPopover.tsx
index 87ff3763b2..300b620660 100644
--- a/packages/core/src/PowerSearch/PowerSearchEditPopover.tsx
+++ b/packages/core/src/PowerSearch/PowerSearchEditPopover.tsx
@@ -10,7 +10,6 @@
* - /packages/core/src/PowerSearch/index.ts
*/
-
import React, {useState, useCallback, useEffect, useMemo, useRef} from 'react';
import * as stylex from '@stylexjs/stylex';
import {XDSButton} from '../Button';
@@ -36,9 +35,9 @@ import type {
const styles = stylex.create({
container: {
- backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-2'],
- boxShadow: shadowVars['--shadow-menu'],
+ backgroundColor: colorVars['--color-background-surface'],
+ borderRadius: radiusVars['--radius-element'],
+ boxShadow: shadowVars['--shadow-low'],
overflow: 'hidden',
},
content: {
diff --git a/packages/core/src/PowerSearch/XDSPowerSearch.tsx b/packages/core/src/PowerSearch/XDSPowerSearch.tsx
index b6c9f4ae66..2c4abd10f3 100644
--- a/packages/core/src/PowerSearch/XDSPowerSearch.tsx
+++ b/packages/core/src/PowerSearch/XDSPowerSearch.tsx
@@ -32,12 +32,7 @@ import type {XDSIconType} from '../Icon';
import type {XDSIconName} from '../Icon/globalIconRegistry';
import type {XDSInputStatus} from '../Field';
import {useXDSLayer} from '../Layer';
-import {
- spacingVars,
- colorVars,
- lineHeightVars,
- typeScaleVars,
-} from '../theme/tokens.stylex';
+import {spacingVars, colorVars, typeScaleVars} from '../theme/tokens.stylex';
import {useInternalConfig} from './useInternalConfig';
import {usePowerSearchSource} from './usePowerSearchSource';
import {formatFilterValue} from './formatFilterValue';
@@ -97,7 +92,7 @@ const popoverLayerStyles = stylex.create({
const resultCountStyles = stylex.create({
text: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
whiteSpace: 'nowrap',
},
diff --git a/packages/core/src/ProgressBar/XDSProgressBar.tsx b/packages/core/src/ProgressBar/XDSProgressBar.tsx
index 72f1141af5..573bac0e14 100644
--- a/packages/core/src/ProgressBar/XDSProgressBar.tsx
+++ b/packages/core/src/ProgressBar/XDSProgressBar.tsx
@@ -13,7 +13,6 @@
* - /apps/storybook/stories/ProgressBar.stories.tsx (storybook stories)
*/
-
import {useId} from 'react';
import * as stylex from '@stylexjs/stylex';
import type {StyleXStyles} from '@stylexjs/stylex';
@@ -22,7 +21,6 @@ import {
spacingVars,
radiusVars,
fontWeightVars,
- lineHeightVars,
durationVars,
easeVars,
typeScaleVars,
@@ -173,13 +171,13 @@ const styles = stylex.create({
},
label: {
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-body-leading'],
fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-primary'],
},
valueLabel: {
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-body-leading'],
fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-secondary'],
},
@@ -196,13 +194,13 @@ const styles = stylex.create({
},
track: {
width: '100%',
- backgroundColor: colorVars['--color-muted'],
- borderRadius: radiusVars['--radius-rounded'],
+ backgroundColor: colorVars['--color-background-muted'],
+ borderRadius: radiusVars['--radius-full'],
overflow: 'hidden',
},
fill: {
height: '100%',
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
transitionProperty: 'width',
transitionDuration: durationVars['--duration-medium'],
transitionTimingFunction: easeVars['--ease-standard'],
@@ -210,7 +208,7 @@ const styles = stylex.create({
indeterminateFill: {
height: '100%',
width: '40%',
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
animationName: indeterminateSlide,
animationDuration: {
default: '1.5s',
diff --git a/packages/core/src/RadioList/XDSRadioListItem.tsx b/packages/core/src/RadioList/XDSRadioListItem.tsx
index 68d5b46c9b..9a3e729655 100644
--- a/packages/core/src/RadioList/XDSRadioListItem.tsx
+++ b/packages/core/src/RadioList/XDSRadioListItem.tsx
@@ -23,6 +23,7 @@ import {
typographyVars,
fontWeightVars,
typeScaleVars,
+ borderVars,
} from '../theme/tokens.stylex';
import {XDSRadioListContext} from './XDSRadioList';
import {xdsClassName, mergeProps} from '../utils';
@@ -55,7 +56,7 @@ const styles = stylex.create({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- borderWidth: 1,
+ borderWidth: borderVars['--border-width'],
borderStyle: 'solid',
borderRadius: '50%',
transitionProperty: 'background-color, border-color',
@@ -67,13 +68,13 @@ const styles = stylex.create({
borderColor: {
default: colorVars['--color-border-emphasized'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-border-emphasized']}, ${colorVars['--color-hover-tint']} 20%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-border-emphasized']}, ${colorVars['--color-tint-hover']} 20%)`,
},
},
backgroundColor: {
- default: colorVars['--color-surface'],
+ default: colorVars['--color-background-surface'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-surface']}, ${colorVars['--color-hover-tint']} 5%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-background-surface']}, ${colorVars['--color-tint-hover']} 5%)`,
},
},
},
@@ -81,20 +82,20 @@ const styles = stylex.create({
borderColor: {
default: colorVars['--color-accent'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-hover-tint']} 15%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-tint-hover']} 15%)`,
},
},
backgroundColor: {
default: colorVars['--color-accent'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-hover-tint']} 15%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-tint-hover']} 15%)`,
},
},
},
radioWrapperFocus: {
outline: {
default: 'none',
- ':focus-within': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-within': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -107,11 +108,11 @@ const styles = stylex.create({
borderColor: colorVars['--color-border'],
},
radioDisabledUnchecked: {
- backgroundColor: colorVars['--color-muted'],
+ backgroundColor: colorVars['--color-background-muted'],
},
innerDot: {
borderRadius: '50%',
- backgroundColor: colorVars['--color-icon-on-dark-media'],
+ backgroundColor: colorVars['--color-on-accent'],
},
labelWrapper: {
display: 'flex',
@@ -120,7 +121,7 @@ const styles = stylex.create({
marginTop: 1,
},
label: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-label-size'],
fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-primary'],
@@ -131,7 +132,7 @@ const styles = stylex.create({
cursor: 'not-allowed',
},
description: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-supporting-size'],
color: colorVars['--color-text-secondary'],
},
diff --git a/packages/core/src/Section/XDSSection.tsx b/packages/core/src/Section/XDSSection.tsx
index 01d1f077d7..babdf7973d 100644
--- a/packages/core/src/Section/XDSSection.tsx
+++ b/packages/core/src/Section/XDSSection.tsx
@@ -53,13 +53,13 @@ export type XDSSectionVariant = keyof XDSSectionVariantMap;
const variantStyles = stylex.create({
section: {
- backgroundColor: colorVars['--color-surface'],
+ backgroundColor: colorVars['--color-background-surface'],
},
transparent: {
backgroundColor: 'transparent',
},
wash: {
- backgroundColor: colorVars['--color-muted'],
+ backgroundColor: colorVars['--color-background-muted'],
},
});
diff --git a/packages/core/src/SegmentedControl/SegmentedControl.doc.mjs b/packages/core/src/SegmentedControl/SegmentedControl.doc.mjs
index 77a3310491..6eeef59397 100644
--- a/packages/core/src/SegmentedControl/SegmentedControl.doc.mjs
+++ b/packages/core/src/SegmentedControl/SegmentedControl.doc.mjs
@@ -69,7 +69,7 @@ export const docs = {
'Deselection not allowed (radio semantics — always one selected)',
'Uses aria-disabled instead of native disabled to maintain keyboard focusability',
'Keyboard navigation skips disabled items',
- 'Track background uses --color-secondary, selected indicator uses --color-surface with --shadow-base',
+ 'Track background uses --color-neutral, selected indicator uses --color-background-surface with --shadow-low',
'label prop on XDSSegmentedControl is aria-only (like XDSTabList aria-label), never rendered visually',
],
components: [
@@ -215,7 +215,7 @@ export const docsZh = {
'不允许取消选中(单选语义,始终有一项选中)',
'使用 aria-disabled 替代原生 disabled 以保持键盘可聚焦性',
'键盘导航会跳过禁用项',
- '轨道背景使用 --color-secondary,选中指示器使用 --color-surface 配合 --shadow-base',
+ '轨道背景使用 --color-neutral,选中指示器使用 --color-background-surface 配合 --shadow-low',
'XDSSegmentedControl 的 label 属性仅用于 aria(类似 XDSTabList 的 aria-label),不会渲染为可见内容',
],
components: [
@@ -277,7 +277,7 @@ export const docsDense = {
'no deselection (radio semantics; always one selected)',
'aria-disabled not native disabled; maintains keyboard focusability',
'keyboard nav skips disabled items',
- 'track bg: --color-secondary; selected indicator: --color-surface+--shadow-base',
+ 'track bg: --color-neutral; selected indicator: --color-background-surface+--shadow-low',
'label prop aria-only (like XDSTabList aria-label); never rendered',
],
propDescriptions: {
diff --git a/packages/core/src/SegmentedControl/XDSSegmentedControl.tsx b/packages/core/src/SegmentedControl/XDSSegmentedControl.tsx
index 0d75c9a3e0..0d15bf586a 100644
--- a/packages/core/src/SegmentedControl/XDSSegmentedControl.tsx
+++ b/packages/core/src/SegmentedControl/XDSSegmentedControl.tsx
@@ -12,7 +12,6 @@
* - /packages/core/src/SegmentedControl/XDSSegmentedControl.test.tsx
*/
-
import {useMemo, useRef, useCallback, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import type {StyleXStyles} from '@stylexjs/stylex';
@@ -65,7 +64,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-0-5'],
'--segmented-padding': spacingVars['--spacing-0-5'],
padding: 'var(--segmented-padding)',
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
},
disabled: {
opacity: 0.5,
@@ -75,15 +74,15 @@ const styles = stylex.create({
const sizeStyles = stylex.create({
sm: {
- '--segmented-radius': radiusVars['--radius-1'],
+ '--segmented-radius': radiusVars['--radius-inner'],
borderRadius: 'var(--segmented-radius)',
},
md: {
- '--segmented-radius': radiusVars['--radius-2'],
+ '--segmented-radius': radiusVars['--radius-element'],
borderRadius: 'var(--segmented-radius)',
},
lg: {
- '--segmented-radius': radiusVars['--radius-2'],
+ '--segmented-radius': radiusVars['--radius-element'],
borderRadius: 'var(--segmented-radius)',
},
});
diff --git a/packages/core/src/SegmentedControl/XDSSegmentedControlItem.tsx b/packages/core/src/SegmentedControl/XDSSegmentedControlItem.tsx
index 5482d3b32b..b9b64cf641 100644
--- a/packages/core/src/SegmentedControl/XDSSegmentedControlItem.tsx
+++ b/packages/core/src/SegmentedControl/XDSSegmentedControlItem.tsx
@@ -12,7 +12,6 @@
* - /packages/core/src/SegmentedControl/XDSSegmentedControl.test.tsx
*/
-
import {useCallback, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import {
@@ -23,8 +22,8 @@ import {
easeVars,
textSizeVars,
fontWeightVars,
- lineHeightVars,
shadowVars,
+ typeScaleVars,
} from '../theme/tokens.stylex';
import {useXDSSegmentedControlContext} from './XDSSegmentedControlContext';
import type {XDSSegmentedControlSize} from './XDSSegmentedControlContext';
@@ -73,8 +72,8 @@ const styles = stylex.create({
borderWidth: 0,
borderStyle: 'none',
fontFamily: 'inherit',
- fontSize: textSizeVars['--text-base'],
- lineHeight: lineHeightVars['--leading-base'],
+ fontSize: textSizeVars['--font-size-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-secondary'],
cursor: 'pointer',
@@ -83,7 +82,7 @@ const styles = stylex.create({
transitionTimingFunction: easeVars['--ease-standard'],
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -101,8 +100,8 @@ const styles = stylex.create({
selected: {
color: colorVars['--color-text-primary'],
fontWeight: fontWeightVars['--font-weight-semibold'],
- backgroundColor: colorVars['--color-surface'],
- boxShadow: shadowVars['--shadow-base'],
+ backgroundColor: colorVars['--color-background-surface'],
+ boxShadow: shadowVars['--shadow-low'],
},
disabled: {
cursor: 'default',
@@ -121,18 +120,18 @@ const CONCENTRIC_RADIUS =
const sizeStyles = stylex.create({
sm: {
- height: `calc(${sizeVars['--size-sm']} - 4px)`,
+ height: `calc(${sizeVars['--size-element-sm']} - 4px)`,
borderRadius: CONCENTRIC_RADIUS,
paddingInline: spacingVars['--spacing-2'],
- fontSize: textSizeVars['--text-sm'],
+ fontSize: textSizeVars['--font-size-sm'],
},
md: {
- height: `calc(${sizeVars['--size-md']} - 4px)`,
+ height: `calc(${sizeVars['--size-element-md']} - 4px)`,
borderRadius: CONCENTRIC_RADIUS,
paddingInline: spacingVars['--spacing-3'],
},
lg: {
- height: `calc(${sizeVars['--size-lg']} - 4px)`,
+ height: `calc(${sizeVars['--size-element-lg']} - 4px)`,
borderRadius: CONCENTRIC_RADIUS,
paddingInline: spacingVars['--spacing-3'],
},
diff --git a/packages/core/src/Selector/XDSSelector.tsx b/packages/core/src/Selector/XDSSelector.tsx
index 15fcdcc999..cb3a60c0d0 100644
--- a/packages/core/src/Selector/XDSSelector.tsx
+++ b/packages/core/src/Selector/XDSSelector.tsx
@@ -41,8 +41,8 @@ import {
easeVars,
typographyVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
+ borderVars,
} from '../theme/tokens.stylex';
import {type XDSSelectorOptionType, type XDSSelectorOptionData} from './types';
import {
@@ -68,19 +68,19 @@ const styles = stylex.create({
width: '100%',
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
- borderWidth: 1,
+ borderWidth: borderVars['--border-width'],
borderStyle: 'solid',
borderColor: {
default: colorVars['--color-border-emphasized'],
':hover': {
- '@media (hover: hover)': colorVars['--color-border-strong'],
+ '@media (hover: hover)': colorVars['--color-border-emphasized'],
},
},
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-surface'],
- fontFamily: typographyVars['--font-body'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-background-surface'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
color: colorVars['--color-text-primary'],
cursor: 'pointer',
transitionProperty: 'border-color, outline, box-shadow',
@@ -89,12 +89,12 @@ const styles = stylex.create({
boxShadow: {
default: 'none',
':hover': {
- '@media (hover: hover)': shadowVars['--inset-shadow-border-hover'],
+ '@media (hover: hover)': shadowVars['--shadow-inset-hover'],
},
},
outline: {
default: 'none',
- ':focus': `1px solid ${colorVars['--color-ring-focus']}`,
+ ':focus': `${borderVars['--border-width']} solid ${colorVars['--color-accent']}`,
},
outlineOffset: '0',
},
@@ -133,9 +133,9 @@ const styles = stylex.create({
maxHeight: '300px',
overflowY: 'auto',
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-surface'],
- boxShadow: shadowVars['--shadow-menu'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-background-surface'],
+ boxShadow: shadowVars['--shadow-low'],
opacity: 1,
transition: `opacity ${durationVars['--duration-fast']}`,
},
@@ -171,8 +171,8 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
width: '100%',
padding: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-1'],
- fontFamily: typographyVars['--font-body'],
+ borderRadius: radiusVars['--radius-inner'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-label-size'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
@@ -208,13 +208,13 @@ const styles = stylex.create({
const sizeStyles = stylex.create({
sm: {
- height: sizeVars['--size-sm'],
+ height: sizeVars['--size-element-sm'],
},
md: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
lg: {
- height: sizeVars['--size-lg'],
+ height: sizeVars['--size-element-lg'],
},
});
diff --git a/packages/core/src/SideNav/XDSSideNav.tsx b/packages/core/src/SideNav/XDSSideNav.tsx
index a7fbfc0a80..7396bd9028 100644
--- a/packages/core/src/SideNav/XDSSideNav.tsx
+++ b/packages/core/src/SideNav/XDSSideNav.tsx
@@ -18,12 +18,11 @@
* - /apps/storybook/stories/SideNav.stories.tsx
*/
-
import {useCallback, useState, type ReactNode} from 'react';
import type {XDSBaseProps} from '../XDSBaseProps';
import * as stylex from '@stylexjs/stylex';
import type {StyleXStyles} from '@stylexjs/stylex';
-import {colorVars, spacingVars} from '../theme/tokens.stylex';
+import {borderVars, colorVars, spacingVars} from '../theme/tokens.stylex';
import {xdsClassName, mergeProps} from '../utils';
import {XDSSideNavCollapseContext} from './XDSSideNavCollapseContext';
import {XDSSideNavCollapseButton} from './XDSSideNavCollapseButton';
@@ -92,7 +91,7 @@ const styles = stylex.create({
paddingInline: spacingVars['--spacing-2'],
paddingBlockStart: spacingVars['--spacing-1'],
paddingBlockEnd: spacingVars['--spacing-2'],
- borderBlockStart: `1px solid ${colorVars['--color-border']}`,
+ borderBlockStart: `${borderVars['--border-width']} solid ${colorVars['--color-border']}`,
},
footerRow: {
display: 'flex',
@@ -122,7 +121,7 @@ const styles = stylex.create({
marginBlockStart: 'auto',
gap: spacingVars['--spacing-2'],
paddingBlockStart: spacingVars['--spacing-2'],
- borderBlockStart: `1px solid ${colorVars['--color-border']}`,
+ borderBlockStart: `${borderVars['--border-width']} solid ${colorVars['--color-border']}`,
},
drawerFooterIcons: {
display: 'flex',
diff --git a/packages/core/src/SideNav/XDSSideNavHeading.tsx b/packages/core/src/SideNav/XDSSideNavHeading.tsx
index 6e54b28900..2ca31a3bda 100644
--- a/packages/core/src/SideNav/XDSSideNavHeading.tsx
+++ b/packages/core/src/SideNav/XDSSideNavHeading.tsx
@@ -23,7 +23,6 @@ import {
colorVars,
spacingVars,
fontWeightVars,
- lineHeightVars,
radiusVars,
shadowVars,
typeScaleVars,
@@ -59,7 +58,7 @@ const styles = stylex.create({
},
interactive: {
cursor: 'pointer',
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
borderWidth: 0,
borderStyle: 'none',
backgroundColor: 'transparent',
@@ -88,7 +87,7 @@ const styles = stylex.create({
},
superheading: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
textDecoration: 'none',
overflow: 'hidden',
@@ -98,7 +97,7 @@ const styles = stylex.create({
heading: {
fontSize: typeScaleVars['--text-large-size'],
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-large-leading'],
color: colorVars['--color-text-primary'],
textDecoration: 'none',
overflow: 'hidden',
@@ -111,7 +110,7 @@ const styles = stylex.create({
},
subheading: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
textDecoration: 'none',
overflow: 'hidden',
@@ -129,9 +128,9 @@ const styles = stylex.create({
},
popoverContent: {
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-surface'],
- boxShadow: shadowVars['--shadow-menu'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-background-surface'],
+ boxShadow: shadowVars['--shadow-low'],
overflow: 'hidden',
},
popover: {
diff --git a/packages/core/src/SideNav/XDSSideNavItem.tsx b/packages/core/src/SideNav/XDSSideNavItem.tsx
index 48b4a4ce2e..4e8f597e92 100644
--- a/packages/core/src/SideNav/XDSSideNavItem.tsx
+++ b/packages/core/src/SideNav/XDSSideNavItem.tsx
@@ -15,7 +15,6 @@
* - /apps/storybook/stories/SideNav.stories.tsx
*/
-
import {useCallback, useId, useRef, useState, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import {
@@ -27,6 +26,7 @@ import {
durationVars,
easeVars,
shadowVars,
+ borderVars,
} from '../theme/tokens.stylex';
import {XDSIcon} from '../Icon';
import type {XDSIconType} from '../Icon';
@@ -99,12 +99,12 @@ const styles = stylex.create({
},
// Popover surface for collapsed items with children
popoverSurface: {
- backgroundColor: colorVars['--color-popover'],
- borderWidth: 1,
+ backgroundColor: colorVars['--color-background-popover'],
+ borderWidth: borderVars['--border-width'],
borderStyle: 'solid',
borderColor: colorVars['--color-border'],
- borderRadius: radiusVars['--radius-2'],
- boxShadow: shadowVars['--shadow-menu'],
+ borderRadius: radiusVars['--radius-element'],
+ boxShadow: shadowVars['--shadow-low'],
paddingBlock: spacingVars['--spacing-1'],
paddingInline: spacingVars['--spacing-1'],
marginInlineStart: spacingVars['--spacing-1'],
diff --git a/packages/core/src/SideNav/XDSSideNavSection.tsx b/packages/core/src/SideNav/XDSSideNavSection.tsx
index d094512a80..e3ed271099 100644
--- a/packages/core/src/SideNav/XDSSideNavSection.tsx
+++ b/packages/core/src/SideNav/XDSSideNavSection.tsx
@@ -15,14 +15,12 @@
* - /apps/storybook/stories/SideNav.stories.tsx
*/
-
import {useId, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import {
colorVars,
spacingVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {xdsClassName, mergeProps} from '../utils';
@@ -56,7 +54,7 @@ const styles = stylex.create({
title: {
fontSize: typeScaleVars['--text-supporting-size'],
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
overflow: 'hidden',
textOverflow: 'ellipsis',
@@ -64,7 +62,7 @@ const styles = stylex.create({
},
subtitle: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
overflow: 'hidden',
textOverflow: 'ellipsis',
diff --git a/packages/core/src/Skeleton/XDSSkeleton.tsx b/packages/core/src/Skeleton/XDSSkeleton.tsx
index 69d2e9be07..a2d9f5c354 100644
--- a/packages/core/src/Skeleton/XDSSkeleton.tsx
+++ b/packages/core/src/Skeleton/XDSSkeleton.tsx
@@ -12,7 +12,6 @@
* - /apps/storybook/stories/Skeleton.stories.tsx
*/
-
import type {XDSBaseProps} from '../XDSBaseProps';
import * as stylex from '@stylexjs/stylex';
import {colorVars, radiusVars} from '../theme/tokens.stylex';
@@ -76,22 +75,22 @@ const radiusStyles = stylex.create({
borderRadius: 0,
},
0: {
- borderRadius: radiusVars['--radius-0'],
+ borderRadius: radiusVars['--radius-none'],
},
1: {
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
},
2: {
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
},
3: {
- borderRadius: radiusVars['--radius-3'],
+ borderRadius: radiusVars['--radius-container'],
},
4: {
- borderRadius: radiusVars['--radius-4'],
+ borderRadius: radiusVars['--radius-container'],
},
rounded: {
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
},
});
diff --git a/packages/core/src/Slider/XDSSlider.tsx b/packages/core/src/Slider/XDSSlider.tsx
index e204dd8935..720e036688 100644
--- a/packages/core/src/Slider/XDSSlider.tsx
+++ b/packages/core/src/Slider/XDSSlider.tsx
@@ -163,8 +163,8 @@ const styles = stylex.create({
},
track: {
position: 'absolute',
- backgroundColor: colorVars['--color-muted'],
- borderRadius: radiusVars['--radius-rounded'],
+ backgroundColor: colorVars['--color-background-muted'],
+ borderRadius: radiusVars['--radius-full'],
},
trackHorizontal: {
left: 0,
@@ -183,7 +183,7 @@ const styles = stylex.create({
filledTrack: {
position: 'absolute',
backgroundColor: colorVars['--color-accent'],
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
},
filledTrackHorizontal: {
height: TRACK_SIZE,
@@ -199,7 +199,7 @@ const styles = stylex.create({
position: 'absolute',
width: THUMB_SIZE,
height: THUMB_SIZE,
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
backgroundColor: colorVars['--color-accent'],
transform: 'translate(-50%, -50%)',
transitionProperty: 'background-color, box-shadow',
@@ -223,14 +223,14 @@ const styles = stylex.create({
backgroundColor: {
default: colorVars['--color-accent'],
':hover': {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-hover-tint']} 15%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-tint-hover']} 15%)`,
},
},
},
thumbFocusVisible: {
outline: {
default: 'none',
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -238,11 +238,11 @@ const styles = stylex.create({
},
},
thumbDisabled: {
- backgroundColor: colorVars['--color-muted'],
+ backgroundColor: colorVars['--color-background-muted'],
cursor: 'not-allowed',
},
textValue: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-label-size'],
color: colorVars['--color-text-primary'],
whiteSpace: 'nowrap',
@@ -264,7 +264,7 @@ const styles = stylex.create({
mark: {
position: 'absolute',
backgroundColor: colorVars['--color-border-emphasized'],
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
},
markHorizontal: {
width: 2,
@@ -278,7 +278,7 @@ const styles = stylex.create({
},
markLabel: {
position: 'absolute',
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-supporting-size'],
color: colorVars['--color-text-secondary'],
whiteSpace: 'nowrap',
diff --git a/packages/core/src/Spinner/XDSSpinner.tsx b/packages/core/src/Spinner/XDSSpinner.tsx
index 7303b83497..00a0df8707 100644
--- a/packages/core/src/Spinner/XDSSpinner.tsx
+++ b/packages/core/src/Spinner/XDSSpinner.tsx
@@ -148,9 +148,8 @@ export function XDSSpinner({
const computedStyle = getComputedStyle(canvas);
const activeColor =
shade === 'onMedia'
- ? computedStyle.getPropertyValue(
- colorVars['--color-icon-on-dark-media'],
- ) || '#FFFFFF'
+ ? computedStyle.getPropertyValue(colorVars['--color-on-dark']) ||
+ '#FFFFFF'
: computedStyle.getPropertyValue(colorVars['--color-accent']) ||
'#0064E0';
const backgroundColor =
diff --git a/packages/core/src/StatusDot/XDSStatusDot.tsx b/packages/core/src/StatusDot/XDSStatusDot.tsx
index 8c54035953..fa36cff001 100644
--- a/packages/core/src/StatusDot/XDSStatusDot.tsx
+++ b/packages/core/src/StatusDot/XDSStatusDot.tsx
@@ -78,7 +78,7 @@ const variants = stylex.create({
backgroundColor: colorVars['--color-accent'],
},
neutral: {
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
},
});
diff --git a/packages/core/src/Switch/XDSSwitch.tsx b/packages/core/src/Switch/XDSSwitch.tsx
index 431a192ff7..6b5745add1 100644
--- a/packages/core/src/Switch/XDSSwitch.tsx
+++ b/packages/core/src/Switch/XDSSwitch.tsx
@@ -13,7 +13,6 @@
* - /apps/storybook/stories/Switch.stories.tsx (storybook stories)
*/
-
import {
useId,
useOptimistic,
@@ -94,7 +93,7 @@ const styles = stylex.create({
width: SWITCH_WIDTH,
height: SWITCH_HEIGHT,
padding: TRACK_PADDING,
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
transitionProperty: 'background-color',
transitionDuration: {
default: durationVars['--duration-fast'],
@@ -107,7 +106,7 @@ const styles = stylex.create({
outline: {
default: 'none',
[stylex.when.ancestor(':focus-within')]:
- `2px solid ${colorVars['--color-ring-focus']}`,
+ `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: null,
@@ -117,9 +116,9 @@ const styles = stylex.create({
// State-dependent colors with ancestor hover behavior
trackOff: {
backgroundColor: {
- default: colorVars['--color-gray-background'],
+ default: colorVars['--color-background-gray'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-gray-background']}, ${colorVars['--color-hover-tint']} 5%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-background-gray']}, ${colorVars['--color-tint-hover']} 5%)`,
},
},
},
@@ -127,7 +126,7 @@ const styles = stylex.create({
backgroundColor: {
default: colorVars['--color-accent'],
[stylex.when.ancestor(':hover')]: {
- '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-hover-tint']} 15%)`,
+ '@media (hover: hover)': `color-mix(in srgb, ${colorVars['--color-accent']}, ${colorVars['--color-tint-hover']} 15%)`,
},
},
},
@@ -135,14 +134,14 @@ const styles = stylex.create({
opacity: 0.5,
},
trackDisabledOff: {
- backgroundColor: colorVars['--color-gray-background'],
+ backgroundColor: colorVars['--color-background-gray'],
},
thumb: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
- borderRadius: radiusVars['--radius-rounded'],
- backgroundColor: colorVars['--color-surface'],
+ borderRadius: radiusVars['--radius-full'],
+ backgroundColor: colorVars['--color-background-surface'],
transitionProperty: 'transform, width, height',
transitionDuration: {
default: durationVars['--duration-fast'],
@@ -168,7 +167,7 @@ const styles = stylex.create({
minHeight: SWITCH_HEIGHT,
},
description: {
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-supporting-size'],
color: colorVars['--color-text-secondary'],
},
diff --git a/packages/core/src/TabList/XDSTab.tsx b/packages/core/src/TabList/XDSTab.tsx
index 7f64662508..2e6781cce2 100644
--- a/packages/core/src/TabList/XDSTab.tsx
+++ b/packages/core/src/TabList/XDSTab.tsx
@@ -12,7 +12,6 @@
* - /packages/core/src/TabList/XDSTabList.test.tsx
*/
-
import {useCallback, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import {
@@ -23,7 +22,6 @@ import {
durationVars,
easeVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {useXDSTabListContext} from './XDSTabListContext';
@@ -76,10 +74,10 @@ const styles = stylex.create({
backgroundColor: 'transparent',
borderWidth: 0,
borderStyle: 'none',
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-secondary'],
cursor: 'pointer',
@@ -89,7 +87,7 @@ const styles = stylex.create({
transitionTimingFunction: easeVars['--ease-standard'],
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -97,7 +95,7 @@ const styles = stylex.create({
},
},
selected: {
- color: colorVars['--color-text-link'],
+ color: colorVars['--color-text-accent'],
fontWeight: fontWeightVars['--font-weight-semibold'],
},
underlineSelected: {
@@ -109,7 +107,7 @@ const styles = stylex.create({
right: spacingVars['--spacing-3'],
height: '2px',
backgroundColor: colorVars['--color-accent'],
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
},
},
hoverUnderline: {
@@ -119,7 +117,7 @@ const styles = stylex.create({
right: spacingVars['--spacing-3'],
height: '2px',
backgroundColor: colorVars['--color-border'],
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
opacity: {
default: 0,
[stylex.when.ancestor(':hover')]: {
@@ -154,9 +152,9 @@ const styles = stylex.create({
});
const sizeStyles = stylex.create({
- sm: {height: sizeVars['--size-sm']},
- md: {height: sizeVars['--size-md']},
- lg: {height: sizeVars['--size-lg']},
+ sm: {height: sizeVars['--size-element-sm']},
+ md: {height: sizeVars['--size-element-md']},
+ lg: {height: sizeVars['--size-element-lg']},
});
const iconSizeStyles = stylex.create({
diff --git a/packages/core/src/TabList/XDSTabList.tsx b/packages/core/src/TabList/XDSTabList.tsx
index 294fc37814..279952c4a5 100644
--- a/packages/core/src/TabList/XDSTabList.tsx
+++ b/packages/core/src/TabList/XDSTabList.tsx
@@ -12,10 +12,9 @@
* - /packages/core/src/TabList/XDSTabList.test.tsx
*/
-
import {useMemo, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
-import {colorVars, spacingVars} from '../theme/tokens.stylex';
+import {borderVars, colorVars, spacingVars} from '../theme/tokens.stylex';
import {XDSTabListContext} from './XDSTabListContext';
import type {XDSTabListSize} from './XDSTabListContext';
import {xdsClassName, mergeProps} from '../utils';
@@ -52,7 +51,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-0-5'],
},
divider: {
- borderBottomWidth: '1px',
+ borderBottomWidth: borderVars['--border-width'],
borderBottomStyle: 'solid',
borderBottomColor: colorVars['--color-border'],
},
diff --git a/packages/core/src/TabList/XDSTabMenu.tsx b/packages/core/src/TabList/XDSTabMenu.tsx
index 7f7a6cdfb1..e19494c153 100644
--- a/packages/core/src/TabList/XDSTabMenu.tsx
+++ b/packages/core/src/TabList/XDSTabMenu.tsx
@@ -25,7 +25,6 @@ import {
easeVars,
shadowVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {useXDSLayer} from '../Layer/useXDSLayer';
@@ -71,10 +70,10 @@ const styles = stylex.create({
backgroundColor: 'transparent',
borderWidth: 0,
borderStyle: 'none',
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-secondary'],
cursor: 'pointer',
@@ -84,7 +83,7 @@ const styles = stylex.create({
transitionTimingFunction: easeVars['--ease-standard'],
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -92,7 +91,7 @@ const styles = stylex.create({
},
},
triggerSelected: {
- color: colorVars['--color-text-link'],
+ color: colorVars['--color-text-accent'],
fontWeight: fontWeightVars['--font-weight-semibold'],
},
triggerLabel: {
@@ -121,7 +120,7 @@ const styles = stylex.create({
right: 0,
height: '2px',
backgroundColor: colorVars['--color-accent'],
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
},
},
hoverUnderline: {
@@ -131,7 +130,7 @@ const styles = stylex.create({
right: 0,
height: '2px',
backgroundColor: colorVars['--color-border'],
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
opacity: {
default: 0,
[stylex.when.ancestor(':hover')]: {
@@ -160,9 +159,9 @@ const styles = stylex.create({
gap: spacingVars['--spacing-0-5'],
paddingBlock: spacingVars['--spacing-1'],
paddingInline: spacingVars['--spacing-1'],
- backgroundColor: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-2'],
- boxShadow: shadowVars['--shadow-menu'],
+ backgroundColor: colorVars['--color-background-surface'],
+ borderRadius: radiusVars['--radius-element'],
+ boxShadow: shadowVars['--shadow-low'],
minWidth: '160px',
},
menuItem: {
@@ -172,10 +171,10 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-primary'],
cursor: 'pointer',
@@ -190,7 +189,7 @@ const styles = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
},
menuItemSelected: {
@@ -210,9 +209,9 @@ const styles = stylex.create({
});
const sizeStyles = stylex.create({
- sm: {height: sizeVars['--size-sm']},
- md: {height: sizeVars['--size-md']},
- lg: {height: sizeVars['--size-lg']},
+ sm: {height: sizeVars['--size-element-sm']},
+ md: {height: sizeVars['--size-element-md']},
+ lg: {height: sizeVars['--size-element-lg']},
});
/**
diff --git a/packages/core/src/Table/XDSTableCell.tsx b/packages/core/src/Table/XDSTableCell.tsx
index c407c0b9bd..e54127f31e 100644
--- a/packages/core/src/Table/XDSTableCell.tsx
+++ b/packages/core/src/Table/XDSTableCell.tsx
@@ -11,11 +11,15 @@
* - /packages/core/src/Table/index.ts
*/
-
import {useContext, type ReactNode} from 'react';
import type {XDSBaseProps} from '../XDSBaseProps';
import * as stylex from '@stylexjs/stylex';
-import {colorVars, spacingVars, typeScaleVars} from '../theme/tokens.stylex';
+import {
+ borderVars,
+ colorVars,
+ spacingVars,
+ typeScaleVars,
+} from '../theme/tokens.stylex';
import type {StyleXStyles} from '../theme/types';
import {XDSTableContext} from './XDSTableContext';
import {xdsClassName, mergeProps} from '../utils';
@@ -59,7 +63,7 @@ const densityStyles = stylex.create({
const dividerRowStyles = stylex.create({
cell: {
- borderBottomWidth: '1px',
+ borderBottomWidth: borderVars['--border-width'],
borderBottomStyle: 'solid',
borderBottomColor: colorVars['--color-border'],
},
@@ -68,7 +72,7 @@ const dividerRowStyles = stylex.create({
const dividerColumnStyles = stylex.create({
cell: {
borderRightWidth: {
- default: '1px',
+ default: borderVars['--border-width'],
':last-child': '0',
},
borderRightStyle: 'solid',
diff --git a/packages/core/src/Table/XDSTableHeaderCell.tsx b/packages/core/src/Table/XDSTableHeaderCell.tsx
index 0682b45586..92e44794e5 100644
--- a/packages/core/src/Table/XDSTableHeaderCell.tsx
+++ b/packages/core/src/Table/XDSTableHeaderCell.tsx
@@ -19,6 +19,7 @@ import {
spacingVars,
fontWeightVars,
typeScaleVars,
+ borderVars,
} from '../theme/tokens.stylex';
import type {StyleXStyles} from '../theme/types';
import {XDSTableContext} from './XDSTableContext';
@@ -69,7 +70,7 @@ const headerStyles = stylex.create({
const headerDividerStyles = stylex.create({
cell: {
- borderBottomWidth: '1px',
+ borderBottomWidth: borderVars['--border-width'],
borderBottomStyle: 'solid',
borderBottomColor: colorVars['--color-border'],
},
@@ -78,7 +79,7 @@ const headerDividerStyles = stylex.create({
const dividerColumnStyles = stylex.create({
cell: {
borderRightWidth: {
- default: '1px',
+ default: borderVars['--border-width'],
':last-child': '0',
},
borderRightStyle: 'solid',
diff --git a/packages/core/src/Table/XDSTableRow.tsx b/packages/core/src/Table/XDSTableRow.tsx
index 95579023b5..066cd32eae 100644
--- a/packages/core/src/Table/XDSTableRow.tsx
+++ b/packages/core/src/Table/XDSTableRow.tsx
@@ -35,7 +35,7 @@ const stripedRowStyles = stylex.create({
row: {
backgroundColor: {
default: null,
- ':nth-child(even)': colorVars['--color-muted'],
+ ':nth-child(even)': colorVars['--color-background-muted'],
},
},
});
@@ -58,7 +58,7 @@ const stripedHoverRowStyles = stylex.create({
row: {
backgroundColor: {
default: null,
- ':nth-child(even)': colorVars['--color-muted'],
+ ':nth-child(even)': colorVars['--color-background-muted'],
':hover': {
'@media (hover: hover)': colorVars['--color-overlay-hover'],
},
diff --git a/packages/core/src/TextArea/XDSTextArea.tsx b/packages/core/src/TextArea/XDSTextArea.tsx
index 10b5c0b7ba..771de59f63 100644
--- a/packages/core/src/TextArea/XDSTextArea.tsx
+++ b/packages/core/src/TextArea/XDSTextArea.tsx
@@ -27,7 +27,6 @@ import {
colorVars,
spacingVars,
typographyVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {
@@ -57,9 +56,9 @@ const styles = stylex.create({
borderWidth: 0,
borderStyle: 'none',
padding: 0,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-body-leading'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
outline: 'none',
@@ -76,7 +75,7 @@ const styles = stylex.create({
display: 'flex',
justifyContent: 'flex-end',
marginTop: spacingVars['--spacing-1'],
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-supporting-size'],
color: colorVars['--color-text-secondary'],
},
diff --git a/packages/core/src/TextInput/XDSTextInput.tsx b/packages/core/src/TextInput/XDSTextInput.tsx
index c879e03cc8..ab7cdfd6cc 100644
--- a/packages/core/src/TextInput/XDSTextInput.tsx
+++ b/packages/core/src/TextInput/XDSTextInput.tsx
@@ -13,7 +13,6 @@
* - /apps/storybook/stories/TextInput.stories.tsx (storybook stories)
*/
-
import {useId, useOptimistic, useTransition, type ChangeEvent} from 'react';
import * as stylex from '@stylexjs/stylex';
import type {XDSIconName} from '../Icon';
@@ -21,7 +20,6 @@ import {
colorVars,
sizeVars,
typographyVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {
@@ -47,9 +45,9 @@ const styles = stylex.create({
borderWidth: 0,
borderStyle: 'none',
padding: 0,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-body-leading'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
outline: 'none',
@@ -64,13 +62,13 @@ const styles = stylex.create({
const sizeStyles = stylex.create({
sm: {
- height: sizeVars['--size-sm'],
+ height: sizeVars['--size-element-sm'],
},
md: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
lg: {
- height: sizeVars['--size-lg'],
+ height: sizeVars['--size-element-lg'],
},
});
diff --git a/packages/core/src/TimeInput/XDSTimeInput.tsx b/packages/core/src/TimeInput/XDSTimeInput.tsx
index 7d7baa4c50..657d86051e 100644
--- a/packages/core/src/TimeInput/XDSTimeInput.tsx
+++ b/packages/core/src/TimeInput/XDSTimeInput.tsx
@@ -13,7 +13,6 @@
* - /apps/storybook/stories/TimeInput.stories.tsx (storybook stories)
*/
-
import {
useId,
useState,
@@ -32,8 +31,8 @@ import {
sizeVars,
radiusVars,
typographyVars,
- lineHeightVars,
typeScaleVars,
+ borderVars,
} from '../theme/tokens.stylex';
import {
XDSField,
@@ -72,9 +71,9 @@ const styles = stylex.create({
borderWidth: 0,
borderStyle: 'none',
padding: 0,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-normal'],
+ lineHeight: typeScaleVars['--text-body-leading'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
outline: 'none',
@@ -98,10 +97,10 @@ const styles = stylex.create({
borderStyle: 'none',
backgroundColor: 'transparent',
cursor: 'pointer',
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
outline: {
default: 'none',
- ':focus-visible': `1px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `${borderVars['--border-width']} solid ${colorVars['--color-accent']}`,
},
outlineOffset: 1,
},
@@ -109,13 +108,13 @@ const styles = stylex.create({
const sizeStyles = stylex.create({
sm: {
- height: sizeVars['--size-sm'],
+ height: sizeVars['--size-element-sm'],
},
md: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
lg: {
- height: sizeVars['--size-lg'],
+ height: sizeVars['--size-element-lg'],
},
});
diff --git a/packages/core/src/Token/XDSToken.tsx b/packages/core/src/Token/XDSToken.tsx
index 1234b086c7..ab8f6cc554 100644
--- a/packages/core/src/Token/XDSToken.tsx
+++ b/packages/core/src/Token/XDSToken.tsx
@@ -22,7 +22,6 @@ import {
durationVars,
easeVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {XDSIcon} from '../Icon';
@@ -142,10 +141,10 @@ const styles = stylex.create({
paddingBlock: 0,
borderWidth: 0,
borderStyle: 'none',
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
fontFamily: 'inherit',
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
fontWeight: fontWeightVars['--font-weight-medium'],
whiteSpace: 'nowrap',
textDecoration: 'none',
@@ -172,7 +171,7 @@ const styles = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -207,7 +206,7 @@ const styles = stylex.create({
focusWithinOutline: {
outline: {
default: null,
- ':focus-within': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-within': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -223,13 +222,13 @@ const styles = stylex.create({
padding: 0,
marginInlineEnd: `calc(-1 * ${spacingVars['--spacing-1']})`,
cursor: 'pointer',
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
width: '16px',
height: '16px',
color: 'inherit',
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
'::after': {
content: '""',
@@ -241,60 +240,60 @@ const styles = stylex.create({
const sizeStyles = stylex.create({
sm: {
- height: `calc(${sizeVars['--size-sm']} - 8px)`,
+ height: `calc(${sizeVars['--size-element-sm']} - 8px)`,
fontSize: typeScaleVars['--text-supporting-size'],
paddingInline: spacingVars['--spacing-2'],
},
md: {
- height: `calc(${sizeVars['--size-md']} - 8px)`,
+ height: `calc(${sizeVars['--size-element-md']} - 8px)`,
paddingInline: spacingVars['--spacing-2'],
},
});
const colorStyles = stylex.create({
default: {
- backgroundColor: colorVars['--color-secondary'],
+ backgroundColor: colorVars['--color-neutral'],
color: colorVars['--color-text-primary'],
},
red: {
- backgroundColor: colorVars['--color-red-background'],
- color: colorVars['--color-red-text'],
+ backgroundColor: colorVars['--color-background-red'],
+ color: colorVars['--color-text-red'],
},
orange: {
- backgroundColor: colorVars['--color-orange-background'],
- color: colorVars['--color-orange-text'],
+ backgroundColor: colorVars['--color-background-orange'],
+ color: colorVars['--color-text-orange'],
},
yellow: {
- backgroundColor: colorVars['--color-yellow-background'],
- color: colorVars['--color-yellow-text'],
+ backgroundColor: colorVars['--color-background-yellow'],
+ color: colorVars['--color-text-yellow'],
},
green: {
- backgroundColor: colorVars['--color-green-background'],
- color: colorVars['--color-green-text'],
+ backgroundColor: colorVars['--color-background-green'],
+ color: colorVars['--color-text-green'],
},
teal: {
- backgroundColor: colorVars['--color-teal-background'],
- color: colorVars['--color-teal-text'],
+ backgroundColor: colorVars['--color-background-teal'],
+ color: colorVars['--color-text-teal'],
},
cyan: {
- backgroundColor: colorVars['--color-cyan-background'],
- color: colorVars['--color-cyan-text'],
+ backgroundColor: colorVars['--color-background-cyan'],
+ color: colorVars['--color-text-cyan'],
},
blue: {
- backgroundColor: colorVars['--color-blue-background'],
- color: colorVars['--color-blue-text'],
+ backgroundColor: colorVars['--color-background-blue'],
+ color: colorVars['--color-text-blue'],
},
purple: {
- backgroundColor: colorVars['--color-purple-background'],
- color: colorVars['--color-purple-text'],
+ backgroundColor: colorVars['--color-background-purple'],
+ color: colorVars['--color-text-purple'],
},
pink: {
- backgroundColor: colorVars['--color-pink-background'],
- color: colorVars['--color-pink-text'],
+ backgroundColor: colorVars['--color-background-pink'],
+ color: colorVars['--color-text-pink'],
},
gray: {
- backgroundColor: colorVars['--color-gray-background'],
- color: colorVars['--color-gray-text'],
+ backgroundColor: colorVars['--color-background-gray'],
+ color: colorVars['--color-text-gray'],
},
});
diff --git a/packages/core/src/Tokenizer/XDSTokenizer.tsx b/packages/core/src/Tokenizer/XDSTokenizer.tsx
index b365ab43ae..763e5f3c3c 100644
--- a/packages/core/src/Tokenizer/XDSTokenizer.tsx
+++ b/packages/core/src/Tokenizer/XDSTokenizer.tsx
@@ -212,7 +212,7 @@ const styles = stylex.create({
justifyContent: 'center',
cursor: 'pointer',
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
color: colorVars['--color-text-secondary'],
opacity: {
default: 0.7,
@@ -230,10 +230,10 @@ const styles = stylex.create({
flexShrink: 0,
},
sizeSm: {
- minHeight: sizeVars['--size-sm'],
+ minHeight: sizeVars['--size-element-sm'],
},
sizeMd: {
- minHeight: sizeVars['--size-md'],
+ minHeight: sizeVars['--size-element-md'],
},
inputAtMax: {
width: 0,
@@ -256,20 +256,20 @@ const styles = stylex.create({
overflow: 'hidden',
},
truncatedSm: {
- height: sizeVars['--size-sm'],
+ height: sizeVars['--size-element-sm'],
},
truncatedMd: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
layerOuter: {
position: 'relative',
zIndex: 1,
},
layerOuterSm: {
- height: sizeVars['--size-sm'],
+ height: sizeVars['--size-element-sm'],
},
layerOuterMd: {
- height: sizeVars['--size-md'],
+ height: sizeVars['--size-element-md'],
},
layerInner: {
position: 'absolute',
diff --git a/packages/core/src/Tooltip/useXDSTooltip.tsx b/packages/core/src/Tooltip/useXDSTooltip.tsx
index 86138e1571..2fc9f04c31 100644
--- a/packages/core/src/Tooltip/useXDSTooltip.tsx
+++ b/packages/core/src/Tooltip/useXDSTooltip.tsx
@@ -10,7 +10,6 @@
* - /packages/core/src/Tooltip/index.ts
*/
-
import {
useCallback,
useEffect,
@@ -33,7 +32,6 @@ import {
spacingVars,
typographyVars,
typeScaleVars,
- lineHeightVars,
} from '../theme/tokens.stylex';
import {xdsClassName} from '../utils';
@@ -42,12 +40,12 @@ const styles = stylex.create({
container: {
// Inverted color palette: dark background, light text
backgroundColor: colorVars['--color-text-primary'],
- color: colorVars['--color-surface'],
- borderRadius: radiusVars['--radius-2'],
+ color: colorVars['--color-background-surface'],
+ borderRadius: radiusVars['--radius-element'],
// Typography
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-body-leading'],
// Animation: closed state (default) and open state
opacity: {
default: 0,
diff --git a/packages/core/src/TopNav/XDSTopNavHeading.tsx b/packages/core/src/TopNav/XDSTopNavHeading.tsx
index c2bde10b40..cd42c039c2 100644
--- a/packages/core/src/TopNav/XDSTopNavHeading.tsx
+++ b/packages/core/src/TopNav/XDSTopNavHeading.tsx
@@ -18,7 +18,6 @@ import {
colorVars,
spacingVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {xdsClassName, mergeProps} from '../utils';
@@ -37,7 +36,7 @@ const styles = stylex.create({
headingText: {
fontSize: typeScaleVars['--text-large-size'],
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-tight'],
+ lineHeight: typeScaleVars['--text-large-leading'],
whiteSpace: 'nowrap',
},
logo: {
diff --git a/packages/core/src/TopNav/XDSTopNavItem.tsx b/packages/core/src/TopNav/XDSTopNavItem.tsx
index 99bc1984de..723d56bd98 100644
--- a/packages/core/src/TopNav/XDSTopNavItem.tsx
+++ b/packages/core/src/TopNav/XDSTopNavItem.tsx
@@ -23,7 +23,6 @@ import {
durationVars,
easeVars,
fontWeightVars,
- lineHeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
import {useXDSLinkComponent} from '../Link/useXDSLinkComponent';
@@ -42,9 +41,9 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-secondary'],
textDecoration: 'none',
@@ -61,7 +60,7 @@ const styles = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -72,11 +71,11 @@ const styles = stylex.create({
color: colorVars['--color-text-primary'],
fontWeight: fontWeightVars['--font-weight-semibold'],
backgroundColor: {
- default: colorVars['--color-secondary'],
+ default: colorVars['--color-neutral'],
':hover': {
- '@media (hover: hover)': colorVars['--color-secondary'],
+ '@media (hover: hover)': colorVars['--color-neutral'],
},
- ':active': colorVars['--color-secondary'],
+ ':active': colorVars['--color-neutral'],
},
},
iconOnly: {
@@ -86,7 +85,7 @@ const styles = stylex.create({
drawerFocus: {
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
diff --git a/packages/core/src/TopNav/XDSTopNavMegaMenu.tsx b/packages/core/src/TopNav/XDSTopNavMegaMenu.tsx
index 96c487ab63..b9649d4f56 100644
--- a/packages/core/src/TopNav/XDSTopNavMegaMenu.tsx
+++ b/packages/core/src/TopNav/XDSTopNavMegaMenu.tsx
@@ -20,7 +20,6 @@
* - /packages/core/src/TopNav/index.ts
*/
-
import {useCallback, useEffect, useRef, useState, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
import {
@@ -30,9 +29,9 @@ import {
durationVars,
easeVars,
fontWeightVars,
- lineHeightVars,
shadowVars,
typeScaleVars,
+ borderVars,
} from '../theme/tokens.stylex';
import {useXDSPopover} from '../Popover/useXDSPopover';
import {XDSGrid} from '../Grid/XDSGrid';
@@ -53,9 +52,9 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-secondary'],
textDecoration: 'none',
@@ -71,7 +70,7 @@ const styles = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -115,10 +114,10 @@ const styles = stylex.create({
},
// Visual styles for the panel content container.
panelContainer: {
- backgroundColor: colorVars['--color-popover'],
- borderTop: `1px solid ${colorVars['--color-border']}`,
- borderRadius: radiusVars['--radius-3'],
- boxShadow: shadowVars['--shadow-menu'],
+ backgroundColor: colorVars['--color-background-popover'],
+ borderTop: `${borderVars['--border-width']} solid ${colorVars['--color-border']}`,
+ borderRadius: radiusVars['--radius-container'],
+ boxShadow: shadowVars['--shadow-low'],
overflow: 'hidden',
},
panelContent: {
@@ -139,8 +138,8 @@ const styles = stylex.create({
flexGrow: 1,
flexShrink: 1,
flexBasis: 200,
- borderRadius: radiusVars['--radius-3'],
- backgroundColor: colorVars['--color-muted'],
+ borderRadius: radiusVars['--radius-container'],
+ backgroundColor: colorVars['--color-background-muted'],
overflow: 'hidden',
display: 'flex',
flexDirection: 'column',
@@ -187,8 +186,8 @@ const styles = stylex.create({
drawerFeatured: {
marginBlockStart: spacingVars['--spacing-2'],
marginInlineStart: spacingVars['--spacing-6'],
- borderRadius: radiusVars['--radius-3'],
- backgroundColor: colorVars['--color-muted'],
+ borderRadius: radiusVars['--radius-container'],
+ backgroundColor: colorVars['--color-background-muted'],
overflow: 'hidden',
},
});
diff --git a/packages/core/src/TopNav/XDSTopNavMegaMenuFeaturedCard.tsx b/packages/core/src/TopNav/XDSTopNavMegaMenuFeaturedCard.tsx
index 550d26fd27..ae3330d7c3 100644
--- a/packages/core/src/TopNav/XDSTopNavMegaMenuFeaturedCard.tsx
+++ b/packages/core/src/TopNav/XDSTopNavMegaMenuFeaturedCard.tsx
@@ -22,7 +22,6 @@ import {
spacingVars,
typeScaleVars,
fontWeightVars,
- lineHeightVars,
} from '../theme/tokens.stylex';
import {xdsClassName, mergeProps} from '../utils';
@@ -50,19 +49,19 @@ const styles = stylex.create({
title: {
fontSize: typeScaleVars['--text-label-size'],
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
color: colorVars['--color-text-primary'],
},
description: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
},
link: {
fontSize: typeScaleVars['--text-supporting-size'],
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: lineHeightVars['--leading-snug'],
- color: colorVars['--color-text-link'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
+ color: colorVars['--color-text-accent'],
textDecoration: 'none',
},
});
diff --git a/packages/core/src/TopNav/XDSTopNavMegaMenuItem.tsx b/packages/core/src/TopNav/XDSTopNavMegaMenuItem.tsx
index 1d72922c0b..6742fde3b6 100644
--- a/packages/core/src/TopNav/XDSTopNavMegaMenuItem.tsx
+++ b/packages/core/src/TopNav/XDSTopNavMegaMenuItem.tsx
@@ -22,7 +22,6 @@ import {
easeVars,
typeScaleVars,
fontWeightVars,
- lineHeightVars,
} from '../theme/tokens.stylex';
import {navItemStyles} from '../NavItem/navItemStyles.stylex';
import {useXDSLinkComponent} from '../Link/useXDSLinkComponent';
@@ -42,7 +41,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-3'],
paddingBlock: spacingVars['--spacing-3'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
textDecoration: 'none',
cursor: 'pointer',
transitionProperty: 'background-color',
@@ -58,7 +57,7 @@ const styles = stylex.create({
border: 'none',
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -76,8 +75,8 @@ const styles = stylex.create({
justifyContent: 'center',
width: 40,
height: 40,
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-secondary'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-neutral'],
flexShrink: 0,
color: colorVars['--color-icon-secondary'],
},
@@ -89,13 +88,13 @@ const styles = stylex.create({
},
desktopTitle: {
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-semibold'],
color: colorVars['--color-text-primary'],
},
desktopDescription: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-secondary'],
},
@@ -111,8 +110,8 @@ const styles = stylex.create({
justifyContent: 'center',
width: 32,
height: 32,
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-secondary'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-neutral'],
flexShrink: 0,
color: colorVars['--color-icon-secondary'],
marginBlockStart: spacingVars['--spacing-0-5'],
@@ -125,7 +124,7 @@ const styles = stylex.create({
},
drawerItemDescription: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
fontWeight: fontWeightVars['--font-weight-normal'],
},
diff --git a/packages/core/src/TopNav/XDSTopNavMenu.tsx b/packages/core/src/TopNav/XDSTopNavMenu.tsx
index 77e771cf8e..910a141631 100644
--- a/packages/core/src/TopNav/XDSTopNavMenu.tsx
+++ b/packages/core/src/TopNav/XDSTopNavMenu.tsx
@@ -35,7 +35,6 @@ import {
durationVars,
easeVars,
fontWeightVars,
- lineHeightVars,
shadowVars,
typeScaleVars,
} from '../theme/tokens.stylex';
@@ -51,9 +50,9 @@ const styles = stylex.create({
gap: spacingVars['--spacing-2'],
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-secondary'],
textDecoration: 'none',
@@ -69,7 +68,7 @@ const styles = stylex.create({
},
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -98,9 +97,9 @@ const styles = stylex.create({
gap: spacingVars['--spacing-1'],
minWidth: 280,
padding: spacingVars['--spacing-1'],
- backgroundColor: colorVars['--color-popover'],
- borderRadius: radiusVars['--radius-3'],
- boxShadow: shadowVars['--shadow-menu'],
+ backgroundColor: colorVars['--color-background-popover'],
+ borderRadius: radiusVars['--radius-container'],
+ boxShadow: shadowVars['--shadow-low'],
},
menuOffset: {
marginBlockStart: spacingVars['--spacing-1'],
@@ -111,7 +110,7 @@ const styles = stylex.create({
gap: spacingVars['--spacing-3'],
paddingBlock: spacingVars['--spacing-3'],
paddingInline: spacingVars['--spacing-3'],
- borderRadius: radiusVars['--radius-2'],
+ borderRadius: radiusVars['--radius-element'],
textDecoration: 'none',
cursor: 'pointer',
transitionProperty: 'background-color',
@@ -126,7 +125,7 @@ const styles = stylex.create({
border: 'none',
outline: {
default: null,
- ':focus-visible': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-visible': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -139,8 +138,8 @@ const styles = stylex.create({
justifyContent: 'center',
width: 40,
height: 40,
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-secondary'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-neutral'],
flexShrink: 0,
},
menuItemContent: {
@@ -151,13 +150,13 @@ const styles = stylex.create({
},
menuItemTitle: {
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-semibold'],
color: colorVars['--color-text-primary'],
},
menuItemDescription: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-secondary'],
},
diff --git a/packages/core/src/TreeList/XDSTreeListItem.tsx b/packages/core/src/TreeList/XDSTreeListItem.tsx
index 240454dc28..292821bdc7 100644
--- a/packages/core/src/TreeList/XDSTreeListItem.tsx
+++ b/packages/core/src/TreeList/XDSTreeListItem.tsx
@@ -17,7 +17,6 @@ import {
colorVars,
radiusVars,
spacingVars,
- lineHeightVars,
durationVars,
easeVars,
typeScaleVars,
@@ -63,7 +62,7 @@ const styles = stylex.create({
position: 'relative',
},
contentWrapper: {
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
display: 'flex',
alignItems: 'center',
gap: spacingVars['--spacing-2'],
@@ -90,7 +89,7 @@ const styles = stylex.create({
focusWithinOutline: {
outline: {
default: 'none',
- ':focus-within': `2px solid ${colorVars['--color-ring-focus']}`,
+ ':focus-within': `2px solid ${colorVars['--color-accent']}`,
},
outlineOffset: {
default: '0',
@@ -165,7 +164,7 @@ const styles = stylex.create({
background: 'none',
padding: 0,
color: colorVars['--color-icon-secondary'],
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
},
chevronButton: {
all: 'unset',
@@ -177,7 +176,7 @@ const styles = stylex.create({
fontSize: CHEVRON_SIZE,
cursor: 'pointer',
color: colorVars['--color-icon-secondary'],
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
},
chevronSvg: {
display: 'flex',
@@ -197,33 +196,33 @@ const densityStyles = stylex.create({
compact: {
paddingBlock: spacingVars['--spacing-1'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-body-leading'],
},
balanced: {
paddingBlock: spacingVars['--spacing-2'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-body-leading'],
},
spacious: {
paddingBlock: spacingVars['--spacing-3'],
paddingInline: spacingVars['--spacing-3'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-normal'],
+ lineHeight: typeScaleVars['--text-body-leading'],
},
});
const descriptionSizeStyles = stylex.create({
compact: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
balanced: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
spacious: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-normal'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
});
diff --git a/packages/core/src/Typeahead/XDSBaseTypeahead.tsx b/packages/core/src/Typeahead/XDSBaseTypeahead.tsx
index bb92c8eead..66e851a8e1 100644
--- a/packages/core/src/Typeahead/XDSBaseTypeahead.tsx
+++ b/packages/core/src/Typeahead/XDSBaseTypeahead.tsx
@@ -33,7 +33,6 @@ import {
colorVars,
spacingVars,
radiusVars,
- lineHeightVars,
typographyVars,
fontWeightVars,
shadowVars,
@@ -159,9 +158,9 @@ const styles = stylex.create({
borderWidth: 0,
borderStyle: 'none',
padding: 0,
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
fontSize: typeScaleVars['--text-body-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-body-leading'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
outline: 'none',
@@ -177,9 +176,9 @@ const styles = stylex.create({
maxHeight: '300px',
overflowY: 'auto',
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-surface'],
- boxShadow: shadowVars['--shadow-menu'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-background-surface'],
+ boxShadow: shadowVars['--shadow-low'],
},
popover: {
minWidth: 'anchor-size(width)',
@@ -194,7 +193,7 @@ const styles = stylex.create({
alignItems: 'center',
width: '100%',
padding: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
cursor: 'pointer',
outline: 'none',
backgroundColor: 'transparent',
diff --git a/packages/core/src/Typeahead/XDSTypeahead.tsx b/packages/core/src/Typeahead/XDSTypeahead.tsx
index 2db58925eb..bec3a4518f 100644
--- a/packages/core/src/Typeahead/XDSTypeahead.tsx
+++ b/packages/core/src/Typeahead/XDSTypeahead.tsx
@@ -16,7 +16,6 @@
* - /apps/storybook/stories/Typeahead.stories.tsx
*/
-
import React, {useCallback, useId, useRef, useState} from 'react';
import * as stylex from '@stylexjs/stylex';
import type {StyleXStyles} from '@stylexjs/stylex';
@@ -153,7 +152,7 @@ const styles = stylex.create({
justifyContent: 'center',
cursor: 'pointer',
padding: spacingVars['--spacing-1'],
- borderRadius: radiusVars['--radius-rounded'],
+ borderRadius: radiusVars['--radius-full'],
color: colorVars['--color-text-secondary'],
opacity: {
default: 0.7,
@@ -163,10 +162,10 @@ const styles = stylex.create({
},
},
sizeSmWrapper: {
- minHeight: sizeVars['--size-sm'],
+ minHeight: sizeVars['--size-element-sm'],
},
sizeMdWrapper: {
- minHeight: sizeVars['--size-md'],
+ minHeight: sizeVars['--size-element-md'],
},
inputHidden: {
width: 0,
diff --git a/packages/core/src/Typeahead/XDSTypeaheadItem.tsx b/packages/core/src/Typeahead/XDSTypeaheadItem.tsx
index 1436790540..eb4992bbb0 100644
--- a/packages/core/src/Typeahead/XDSTypeaheadItem.tsx
+++ b/packages/core/src/Typeahead/XDSTypeaheadItem.tsx
@@ -14,7 +14,6 @@ import * as stylex from '@stylexjs/stylex';
import {
colorVars,
spacingVars,
- lineHeightVars,
fontWeightVars,
typeScaleVars,
} from '../theme/tokens.stylex';
@@ -74,7 +73,7 @@ const styles = stylex.create({
},
label: {
fontSize: typeScaleVars['--text-label-size'],
- lineHeight: lineHeightVars['--leading-base'],
+ lineHeight: typeScaleVars['--text-label-leading'],
fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-primary'],
overflow: 'hidden',
@@ -83,7 +82,7 @@ const styles = stylex.create({
},
description: {
fontSize: typeScaleVars['--text-supporting-size'],
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
color: colorVars['--color-text-secondary'],
overflow: 'hidden',
textOverflow: 'ellipsis',
diff --git a/packages/core/src/docs-types.ts b/packages/core/src/docs-types.ts
index ac4c6e928a..f8ab5117b4 100644
--- a/packages/core/src/docs-types.ts
+++ b/packages/core/src/docs-types.ts
@@ -124,7 +124,7 @@ export interface CSSPropertyDoc {
*
* @example
* ```
- * {name: '--card-radius', description: 'Border radius', default: 'var(--radius-3)'}
+ * {name: '--card-radius', description: 'Border radius', default: 'var(--radius-container)'}
* {name: '--card-concentric-radius', description: 'Inner radius', derived: true, formula: 'max(0px, calc(var(--card-radius) - var(--card-padding)))'}
* ```
*/
@@ -133,7 +133,7 @@ export interface ComponentVar {
name: string;
/** What this var controls */
description: string;
- /** Default value as a CSS expression, e.g. 'var(--radius-3)' */
+ /** Default value as a CSS expression, e.g. 'var(--radius-container)' */
default: string;
/** Whether this var is derived from other vars (not directly settable) */
derived?: boolean;
diff --git a/packages/core/src/theme/README.md b/packages/core/src/theme/README.md
index 839e59ccb3..caf1a791b5 100644
--- a/packages/core/src/theme/README.md
+++ b/packages/core/src/theme/README.md
@@ -122,9 +122,9 @@ Theme provides CSS variables for use in StyleX:
```tsx
const styles = stylex.create({
card: {
- backgroundColor: 'var(--color-surface)',
+ backgroundColor: 'var(--color-background-surface)',
padding: 'var(--spacing-4)',
- borderRadius: 'var(--radius-3)',
+ borderRadius: 'var(--radius-container)',
},
});
```
diff --git a/packages/core/src/theme/XDSTheme.tsx b/packages/core/src/theme/XDSTheme.tsx
index 4e748693b5..b4207a9953 100644
--- a/packages/core/src/theme/XDSTheme.tsx
+++ b/packages/core/src/theme/XDSTheme.tsx
@@ -20,7 +20,6 @@
* ```
*/
-
import React, {useId, useInsertionEffect, useLayoutEffect, useRef} from 'react';
import * as stylex from '@stylexjs/stylex';
import type {ThemeMode} from './types';
@@ -47,7 +46,7 @@ const wrapperStyles = stylex.create({
base: {
display: 'contents',
color: colorVars['--color-text-primary'],
- fontFamily: typographyVars['--font-body'],
+ fontFamily: typographyVars['--font-family-body'],
},
light: {
colorScheme: 'light',
diff --git a/packages/core/src/theme/defineTheme.test.ts b/packages/core/src/theme/defineTheme.test.ts
index d45508ed9a..36cdba834a 100644
--- a/packages/core/src/theme/defineTheme.test.ts
+++ b/packages/core/src/theme/defineTheme.test.ts
@@ -17,7 +17,7 @@ describe('defineTheme', () => {
// Override should be present
expect(theme.tokens['--color-accent']).toBe('#FF0000');
// Defaults should NOT be in tokens
- expect(theme.tokens['--color-surface']).toBeUndefined();
+ expect(theme.tokens['--color-background-surface']).toBeUndefined();
});
it('converts [light, dark] tuples to light-dark()', () => {
@@ -35,10 +35,10 @@ describe('defineTheme', () => {
const theme = defineTheme({
name: 'string-test',
tokens: {
- '--radius-3': '16px',
+ '--radius-container': '16px',
},
});
- expect(theme.tokens['--radius-3']).toBe('16px');
+ expect(theme.tokens['--radius-container']).toBe('16px');
});
it('mixes tuples and strings', () => {
@@ -46,13 +46,13 @@ describe('defineTheme', () => {
name: 'mixed',
tokens: {
'--color-accent': ['#0077B6', '#48CAE4'],
- '--radius-3': '16px',
- '--font-heading': '"Georgia", serif',
+ '--radius-container': '16px',
+ '--font-family-heading': '"Georgia", serif',
},
});
expect(theme.tokens['--color-accent']).toBe('light-dark(#0077B6, #48CAE4)');
- expect(theme.tokens['--radius-3']).toBe('16px');
- expect(theme.tokens['--font-heading']).toBe('"Georgia", serif');
+ expect(theme.tokens['--radius-container']).toBe('16px');
+ expect(theme.tokens['--font-family-heading']).toBe('"Georgia", serif');
});
it('accepts unknown token names without warning (types provide guardrails)', () => {
@@ -90,15 +90,15 @@ describe('generateThemeCSS', () => {
name: 'ocean',
tokens: {
'--color-accent': ['#0077B6', '#48CAE4'],
- '--radius-3': '16px',
+ '--radius-container': '16px',
},
});
const css = generateThemeCSS(theme);
expect(css).toContain('@scope');
expect(css).toContain('--color-accent: light-dark(#0077B6, #48CAE4)');
- expect(css).toContain('--radius-3: 16px');
+ expect(css).toContain('--radius-container: 16px');
// :scope should NOT contain non-overridden tokens
- expect(css).not.toContain('--color-surface:');
+ expect(css).not.toContain('--color-background-surface:');
});
it('includes prose rules even with no overrides', () => {
@@ -106,7 +106,7 @@ describe('generateThemeCSS', () => {
const css = generateThemeCSS(theme);
expect(css).toContain('@scope');
expect(css).toContain(':is(h1, h2, h3, h4, h5, h6)');
- expect(css).toContain('font-family: var(--font-heading)');
+ expect(css).toContain('font-family: var(--font-family-heading)');
});
});
@@ -221,14 +221,14 @@ describe('generateThemeCSS with components', () => {
it('combines tokens and components', () => {
const theme = defineTheme({
name: 'combo',
- tokens: {'--radius-3': '20px'},
+ tokens: {'--radius-container': '20px'},
components: {
card: {base: {borderWidth: '1px'}},
},
});
const css = generateThemeCSS(theme);
expect(css).toContain('@scope');
- expect(css).toContain('--radius-3: 20px');
+ expect(css).toContain('--radius-container: 20px');
expect(css).toContain('.xds-card {');
expect(css).toContain('border-width: 1px');
});
@@ -241,9 +241,9 @@ describe('typography.scale', () => {
typography: {scale: {base: 12, ratio: 1.125}},
});
// Semantic tokens are now var() refs; raw token has the computed value
- expect(theme.tokens['--heading-4-size']).toBe('var(--text-base)');
- expect(theme.tokens['--text-base']).toBe('0.75rem');
- expect(theme.tokens['--text-body-size']).toBe('var(--text-base)');
+ expect(theme.tokens['--text-heading-4-size']).toBe('var(--font-size-base)');
+ expect(theme.tokens['--font-size-base']).toBe('0.75rem');
+ expect(theme.tokens['--text-body-size']).toBe('var(--font-size-base)');
});
it('generates 44 tokens (11 raw size + 33 semantic)', () => {
@@ -251,10 +251,9 @@ describe('typography.scale', () => {
name: 'custom',
typography: {scale: {base: 14, ratio: 1.2}},
});
- // 11 raw size (--text-4xs…--text-4xl) + 33 semantic = 44
- // Filtering for --heading- or --text- captures raw + semantic = 11 + 15 + 18 = 44
+ // 12 raw size (--font-size-4xs…--font-size-5xl) + 18 heading + 24 text = 54
const typeScaleKeys = Object.keys(theme.tokens).filter(
- k => k.startsWith('--heading-') || k.startsWith('--text-'),
+ k => k.startsWith('--font-size-') || k.startsWith('--text-'),
);
expect(typeScaleKeys).toHaveLength(54);
});
@@ -264,19 +263,19 @@ describe('typography.scale', () => {
name: 'override-test',
typography: {scale: {base: 14, ratio: 1.2}},
tokens: {
- '--heading-1-size': '40px',
+ '--text-heading-1-size': '40px',
},
});
// Explicit token should win over typography.scale
- expect(theme.tokens['--heading-1-size']).toBe('40px');
+ expect(theme.tokens['--text-heading-1-size']).toBe('40px');
// Non-overridden scale token should still be a var() ref
- expect(theme.tokens['--heading-4-size']).toBe('var(--text-base)');
+ expect(theme.tokens['--text-heading-4-size']).toBe('var(--font-size-base)');
});
it('works without typography.scale (backwards compatible)', () => {
const theme = defineTheme({name: 'no-scale'});
// No type scale tokens should be present
- expect(theme.tokens['--heading-1-size']).toBeUndefined();
+ expect(theme.tokens['--text-heading-1-size']).toBeUndefined();
});
it('combines typography.scale with other token overrides', () => {
@@ -288,8 +287,8 @@ describe('typography.scale', () => {
},
});
expect(theme.tokens['--color-accent']).toBe('#FF0000');
- expect(theme.tokens['--heading-4-size']).toBe('var(--text-base)');
- expect(theme.tokens['--text-base']).toBe('1rem');
+ expect(theme.tokens['--text-heading-4-size']).toBe('var(--font-size-base)');
+ expect(theme.tokens['--font-size-base']).toBe('1rem');
});
});
@@ -301,7 +300,7 @@ describe('typography.scale component auto-generation', () => {
});
expect(theme.components?.heading?.['level:1']).toBeDefined();
expect(theme.components?.heading?.['level:1']?.fontSize).toBe(
- 'var(--heading-1-size)',
+ 'var(--text-heading-1-size)',
);
});
@@ -340,7 +339,7 @@ describe('typography.scale component auto-generation', () => {
});
// Auto-generated heading props still present
expect(theme.components?.heading?.['level:1']?.fontSize).toBe(
- 'var(--heading-1-size)',
+ 'var(--text-heading-1-size)',
);
// Explicit override merged on top
expect(theme.components?.heading?.['level:1']?.letterSpacing).toBe(
@@ -371,7 +370,7 @@ describe('typography.scale component auto-generation', () => {
);
// Auto-generated fontSize still present
expect(theme.components?.heading?.['level:1']?.fontSize).toBe(
- 'var(--heading-1-size)',
+ 'var(--text-heading-1-size)',
);
});
});
@@ -382,22 +381,22 @@ describe('radius', () => {
name: 'rounded',
radius: {base: 4, multiplier: 1.5},
});
- expect(theme.tokens['--radius-1']).toBe('6px');
- expect(theme.tokens['--radius-2']).toBe('12px');
- expect(theme.tokens['--radius-3']).toBe('18px');
- expect(theme.tokens['--radius-4']).toBe('24px');
- expect(theme.tokens['--radius-0']).toBe('0px');
- expect(theme.tokens['--radius-rounded']).toBe('9999px');
+ expect(theme.tokens['--radius-inner']).toBe('6px');
+ expect(theme.tokens['--radius-element']).toBe('12px');
+ expect(theme.tokens['--radius-container']).toBe('18px');
+ expect(theme.tokens['--radius-page']).toBe('42px');
+ expect(theme.tokens['--radius-none']).toBe('0px');
+ expect(theme.tokens['--radius-full']).toBe('9999px');
});
it('explicit tokens override radius', () => {
const theme = defineTheme({
name: 'custom',
radius: {base: 4, multiplier: 1},
- tokens: {'--radius-3': '20px'},
+ tokens: {'--radius-container': '20px'},
});
- expect(theme.tokens['--radius-3']).toBe('20px');
- expect(theme.tokens['--radius-2']).toBe('8px'); // from radius
+ expect(theme.tokens['--radius-container']).toBe('20px');
+ expect(theme.tokens['--radius-element']).toBe('8px'); // from radius
});
it('radius with multiplier 0 produces sharp theme', () => {
@@ -405,17 +404,17 @@ describe('radius', () => {
name: 'sharp',
radius: {base: 4, multiplier: 0},
});
- expect(theme.tokens['--radius-1']).toBe('0px');
- expect(theme.tokens['--radius-2']).toBe('0px');
- expect(theme.tokens['--radius-3']).toBe('0px');
- expect(theme.tokens['--radius-4']).toBe('0px');
- expect(theme.tokens['--radius-0']).toBe('0px');
- expect(theme.tokens['--radius-rounded']).toBe('9999px');
+ expect(theme.tokens['--radius-inner']).toBe('0px');
+ expect(theme.tokens['--radius-element']).toBe('0px');
+ expect(theme.tokens['--radius-container']).toBe('0px');
+ expect(theme.tokens['--radius-page']).toBe('0px');
+ expect(theme.tokens['--radius-none']).toBe('0px');
+ expect(theme.tokens['--radius-full']).toBe('9999px');
});
it('works without radius (backwards compatible)', () => {
const theme = defineTheme({name: 'no-scale'});
- expect(theme.tokens['--radius-0']).toBeUndefined();
+ expect(theme.tokens['--radius-none']).toBeUndefined();
});
it('combines radius with typography.scale and other tokens', () => {
@@ -428,8 +427,8 @@ describe('radius', () => {
},
});
expect(theme.tokens['--color-accent']).toBe('#FF0000');
- expect(theme.tokens['--heading-4-size']).toBe('var(--text-base)');
- expect(theme.tokens['--radius-2']).toBe('8px');
+ expect(theme.tokens['--text-heading-4-size']).toBe('var(--font-size-base)');
+ expect(theme.tokens['--radius-element']).toBe('8px');
});
});
@@ -440,13 +439,13 @@ describe('custom status via components', () => {
components: {
banner: {
'status:neutral': {
- backgroundColor: 'var(--color-muted)',
+ backgroundColor: 'var(--color-background-muted)',
},
},
},
});
expect(theme.components?.banner?.['status:neutral']).toEqual({
- backgroundColor: 'var(--color-muted)',
+ backgroundColor: 'var(--color-background-muted)',
});
});
@@ -456,7 +455,7 @@ describe('custom status via components', () => {
components: {
banner: {
'status:neutral': {
- backgroundColor: 'var(--color-muted)',
+ backgroundColor: 'var(--color-background-muted)',
},
},
},
@@ -464,7 +463,7 @@ describe('custom status via components', () => {
const css = generateThemeCSS(theme);
// parseStyleKey('status:neutral') → '.neutral', so CSS should have .xds-banner.neutral
expect(css).toContain('.xds-banner.neutral');
- expect(css).toContain('background-color: var(--color-muted)');
+ expect(css).toContain('background-color: var(--color-background-muted)');
});
it('custom button variant via components', () => {
@@ -506,7 +505,7 @@ describe('custom status via components', () => {
components: {
banner: {
'status:neutral': {
- backgroundColor: 'var(--color-muted)',
+ backgroundColor: 'var(--color-background-muted)',
color: 'gray',
},
},
@@ -515,7 +514,7 @@ describe('custom status via components', () => {
});
expect(theme.tokens['--color-accent']).toBe('#FF0000');
expect(theme.components?.banner?.['status:neutral']).toEqual({
- backgroundColor: 'var(--color-muted)',
+ backgroundColor: 'var(--color-background-muted)',
color: 'gray',
});
expect(theme.components?.button?.base?.borderRadius).toBe('999px');
@@ -596,13 +595,13 @@ describe('typography fonts derivation', () => {
code: {family: 'Geist Mono', fallbacks: '"SF Mono", monospace'},
},
});
- expect(theme.tokens['--font-body']).toBe(
+ expect(theme.tokens['--font-family-body']).toBe(
'Geist, -apple-system, sans-serif',
);
- expect(theme.tokens['--font-heading']).toBe(
+ expect(theme.tokens['--font-family-heading']).toBe(
'Geist, -apple-system, sans-serif',
); // inherited from body
- expect(theme.tokens['--font-code']).toBe(
+ expect(theme.tokens['--font-family-code']).toBe(
'"Geist Mono", "SF Mono", monospace',
);
});
@@ -615,8 +614,10 @@ describe('typography fonts derivation', () => {
heading: {family: 'Playfair Display', fallbacks: 'serif'},
},
});
- expect(theme.tokens['--font-body']).toBe('Inter, sans-serif');
- expect(theme.tokens['--font-heading']).toBe('"Playfair Display", serif');
+ expect(theme.tokens['--font-family-body']).toBe('Inter, sans-serif');
+ expect(theme.tokens['--font-family-heading']).toBe(
+ '"Playfair Display", serif',
+ );
});
it('explicit tokens override typography-derived font tokens', () => {
@@ -625,12 +626,12 @@ describe('typography fonts derivation', () => {
typography: {
body: {family: 'Geist', fallbacks: 'sans-serif'},
},
- tokens: {'--font-heading': '"Custom", serif'},
+ tokens: {'--font-family-heading': '"Custom", serif'},
});
// Explicit token wins over typography-derived
- expect(theme.tokens['--font-heading']).toBe('"Custom", serif');
+ expect(theme.tokens['--font-family-heading']).toBe('"Custom", serif');
// Body still comes from typography
- expect(theme.tokens['--font-body']).toBe('Geist, sans-serif');
+ expect(theme.tokens['--font-family-body']).toBe('Geist, sans-serif');
});
it('combines typography with scale and tokens', () => {
@@ -647,9 +648,9 @@ describe('typography fonts derivation', () => {
});
expect(theme.name).toBe('combo');
expect(theme.fonts).toHaveLength(1);
- expect(theme.tokens['--font-body']).toBe('Figtree, sans-serif');
+ expect(theme.tokens['--font-family-body']).toBe('Figtree, sans-serif');
// scale tokens should still be present
- expect(theme.tokens['--heading-4-size']).toBeDefined();
+ expect(theme.tokens['--text-heading-4-size']).toBeDefined();
});
});
@@ -663,8 +664,12 @@ describe('typography weight derivation', () => {
},
});
// All heading levels should get bold weight
- expect(theme.tokens['--heading-1-weight']).toBe('var(--font-weight-bold)');
- expect(theme.tokens['--heading-4-weight']).toBe('var(--font-weight-bold)');
+ expect(theme.tokens['--text-heading-1-weight']).toBe(
+ 'var(--font-weight-bold)',
+ );
+ expect(theme.tokens['--text-heading-4-weight']).toBe(
+ 'var(--font-weight-bold)',
+ );
});
it('per-level heading weights override default heading weight', () => {
@@ -678,11 +683,15 @@ describe('typography weight derivation', () => {
},
},
});
- expect(theme.tokens['--heading-1-weight']).toBe(
+ expect(theme.tokens['--text-heading-1-weight']).toBe(
'var(--font-weight-semibold)',
);
- expect(theme.tokens['--heading-3-weight']).toBe('var(--font-weight-bold)');
- expect(theme.tokens['--heading-4-weight']).toBe('var(--font-weight-bold)');
+ expect(theme.tokens['--text-heading-3-weight']).toBe(
+ 'var(--font-weight-bold)',
+ );
+ expect(theme.tokens['--text-heading-4-weight']).toBe(
+ 'var(--font-weight-bold)',
+ );
});
it('body weight flows to text body token', () => {
@@ -719,7 +728,7 @@ describe('typography weight derivation', () => {
heading: {weight: 'normal'},
},
});
- expect(theme.tokens['--heading-1-weight']).toBe(
+ expect(theme.tokens['--text-heading-1-weight']).toBe(
'var(--font-weight-normal)',
);
});
@@ -732,7 +741,7 @@ describe('typography weight derivation', () => {
heading: {weight: '900'},
},
});
- expect(theme.tokens['--heading-1-weight']).toBe('900');
+ expect(theme.tokens['--text-heading-1-weight']).toBe('900');
});
});
@@ -773,7 +782,7 @@ describe('pseudo-class overrides in components', () => {
backgroundColor: '#D6EBFF',
},
':focus-visible': {
- outline: '2px solid var(--color-ring-focus)',
+ outline: '2px solid var(--color-accent)',
},
},
},
@@ -785,7 +794,7 @@ describe('pseudo-class overrides in components', () => {
expect(css).toContain('.xds-button.primary-muted:hover {');
expect(css).toContain('background-color: #D6EBFF');
expect(css).toContain('.xds-button.primary-muted:focus-visible {');
- expect(css).toContain('outline: 2px solid var(--color-ring-focus)');
+ expect(css).toContain('outline: 2px solid var(--color-accent)');
});
it('handles pseudo-only overrides (no base properties)', () => {
diff --git a/packages/core/src/theme/defineTheme.ts b/packages/core/src/theme/defineTheme.ts
index bfcc6a593a..ebbac4f0cb 100644
--- a/packages/core/src/theme/defineTheme.ts
+++ b/packages/core/src/theme/defineTheme.ts
@@ -16,8 +16,8 @@
* name: 'ocean',
* tokens: {
* '--color-accent': ['#0077B6', '#48CAE4'], // [light, dark]
- * '--color-surface': ['#F0F8FF', '#0A1628'],
- * '--radius-3': '16px', // same in both modes
+ * '--color-background-surface': ['#F0F8FF', '#0A1628'],
+ * '--radius-container': '16px', // same in both modes
* },
* icons: oceanIcons,
* });
@@ -42,7 +42,6 @@ import {
transitionDefaults,
typographyDefaults,
textSizeDefaults,
- lineHeightDefaults,
fontWeightDefaults,
typeScaleDefaults,
} from './tokens.stylex';
@@ -79,7 +78,6 @@ export type XDSCoreTokenName =
| keyof typeof transitionDefaults
| keyof typeof typographyDefaults
| keyof typeof textSizeDefaults
- | keyof typeof lineHeightDefaults
| keyof typeof fontWeightDefaults
| keyof typeof typeScaleDefaults;
@@ -107,7 +105,7 @@ export type XDSTokenValue = string | [light: string, dark: string];
* {
* borderColor: '#8F9296',
* ':hover': { borderColor: 'color-mix(in srgb, #8F9296, black 20%)' },
- * ':focus-visible': { outline: '2px solid var(--color-ring-focus)' },
+ * ':focus-visible': { outline: '2px solid var(--color-accent)' },
* }
* ```
*/
@@ -232,7 +230,7 @@ export interface XDSDefineThemeInput {
* 'variant:primary-muted': { backgroundColor: '#ECF5FF' }, // new — generates augmentation
* },
* banner: {
- * 'status:neutral': { backgroundColor: 'var(--color-muted)' }, // new status
+ * 'status:neutral': { backgroundColor: 'var(--color-background-muted)' }, // new status
* },
* }
* ```
@@ -277,7 +275,6 @@ export const xdsTokenDefaults: Record<string, string> = {
...transitionDefaults,
...typographyDefaults,
...textSizeDefaults,
- ...lineHeightDefaults,
...fontWeightDefaults,
...typeScaleDefaults,
...domainTokenDefaults,
@@ -455,9 +452,9 @@ export function defineTheme(input: XDSDefineThemeInput): XDSDefinedTheme {
bodyFamily;
const codeFamily = buildFontFamily(typo.code?.family, typo.code?.fallbacks);
- if (bodyFamily) tokens['--font-body'] = bodyFamily;
- if (headingFamily) tokens['--font-heading'] = headingFamily;
- if (codeFamily) tokens['--font-code'] = codeFamily;
+ if (bodyFamily) tokens['--font-family-body'] = bodyFamily;
+ if (headingFamily) tokens['--font-family-heading'] = headingFamily;
+ if (codeFamily) tokens['--font-family-code'] = codeFamily;
}
// 2. Apply explicit token overrides (highest precedence — overwrites generated tokens)
@@ -597,20 +594,20 @@ export function generateThemeRules(theme: XDSDefinedTheme): string[] {
// 3. Prose HTML element rules (h1-h6, p, small, code, hr)
parts.push(` :is(h1, h2, h3, h4, h5, h6) {
- font-family: var(--font-heading);
+ font-family: var(--font-family-heading);
color: var(--color-text-primary);
}`);
for (let level = 1; level <= 6; level++) {
parts.push(` h${level} {
- font-size: ${val(`--heading-${level}-size`)};
- font-weight: ${val(`--heading-${level}-weight`)};
- line-height: ${val(`--heading-${level}-leading`)};
+ font-size: ${val(`--text-heading-${level}-size`)};
+ font-weight: ${val(`--text-heading-${level}-weight`)};
+ line-height: ${val(`--text-heading-${level}-leading`)};
}`);
}
parts.push(` p {
- font-family: var(--font-heading);
+ font-family: var(--font-family-heading);
font-size: ${val('--text-body-size')};
font-weight: ${val('--text-body-weight')};
line-height: ${val('--text-body-leading')};
@@ -625,7 +622,7 @@ export function generateThemeRules(theme: XDSDefinedTheme): string[] {
}`);
parts.push(` code, pre {
- font-family: var(--font-code);
+ font-family: var(--font-family-code);
font-size: ${val('--text-code-size')};
line-height: ${val('--text-code-leading')};
}`);
diff --git a/packages/core/src/theme/expandRadiusScale.test.ts b/packages/core/src/theme/expandRadiusScale.test.ts
index a0a2049602..19bcb22692 100644
--- a/packages/core/src/theme/expandRadiusScale.test.ts
+++ b/packages/core/src/theme/expandRadiusScale.test.ts
@@ -4,51 +4,51 @@ import {expandRadiusScale} from './expandRadiusScale';
describe('expandRadiusScale', () => {
it('generates default scale', () => {
const tokens = expandRadiusScale({base: 4, multiplier: 1});
- expect(tokens['--radius-0']).toBe('0px');
- expect(tokens['--radius-1']).toBe('4px');
- expect(tokens['--radius-2']).toBe('8px');
- expect(tokens['--radius-3']).toBe('12px');
- expect(tokens['--radius-4']).toBe('16px');
- expect(tokens['--radius-rounded']).toBe('9999px');
+ expect(tokens['--radius-none']).toBe('0px');
+ expect(tokens['--radius-inner']).toBe('4px');
+ expect(tokens['--radius-element']).toBe('8px');
+ expect(tokens['--radius-container']).toBe('12px');
+ expect(tokens['--radius-page']).toBe('28px');
+ expect(tokens['--radius-full']).toBe('9999px');
});
it('applies multiplier', () => {
const tokens = expandRadiusScale({base: 4, multiplier: 1.5});
- expect(tokens['--radius-1']).toBe('6px');
- expect(tokens['--radius-2']).toBe('12px');
- expect(tokens['--radius-3']).toBe('18px');
- expect(tokens['--radius-4']).toBe('24px');
+ expect(tokens['--radius-inner']).toBe('6px');
+ expect(tokens['--radius-element']).toBe('12px');
+ expect(tokens['--radius-container']).toBe('18px');
+ expect(tokens['--radius-page']).toBe('42px');
});
it('multiplier 0 produces all zeros', () => {
const tokens = expandRadiusScale({base: 4, multiplier: 0});
- expect(tokens['--radius-0']).toBe('0px');
- expect(tokens['--radius-1']).toBe('0px');
- expect(tokens['--radius-2']).toBe('0px');
- expect(tokens['--radius-3']).toBe('0px');
- expect(tokens['--radius-4']).toBe('0px');
- expect(tokens['--radius-rounded']).toBe('9999px');
+ expect(tokens['--radius-none']).toBe('0px');
+ expect(tokens['--radius-inner']).toBe('0px');
+ expect(tokens['--radius-element']).toBe('0px');
+ expect(tokens['--radius-container']).toBe('0px');
+ expect(tokens['--radius-page']).toBe('0px');
+ expect(tokens['--radius-full']).toBe('9999px');
});
it('fixed tokens are unaffected by multiplier', () => {
const tokens = expandRadiusScale({base: 4, multiplier: 2});
- expect(tokens['--radius-0']).toBe('0px');
- expect(tokens['--radius-rounded']).toBe('9999px');
+ expect(tokens['--radius-none']).toBe('0px');
+ expect(tokens['--radius-full']).toBe('9999px');
});
it('rounds fractional results to nearest integer', () => {
const tokens = expandRadiusScale({base: 3, multiplier: 1.3});
// 3 * 1 * 1.3 = 3.9 → 4px
- expect(tokens['--radius-1']).toBe('4px');
+ expect(tokens['--radius-inner']).toBe('4px');
// 3 * 2 * 1.3 = 7.8 → 8px
- expect(tokens['--radius-2']).toBe('8px');
+ expect(tokens['--radius-element']).toBe('8px');
});
it('works with non-standard base', () => {
const tokens = expandRadiusScale({base: 6, multiplier: 1});
- expect(tokens['--radius-1']).toBe('6px');
- expect(tokens['--radius-2']).toBe('12px');
- expect(tokens['--radius-3']).toBe('18px');
- expect(tokens['--radius-4']).toBe('24px');
+ expect(tokens['--radius-inner']).toBe('6px');
+ expect(tokens['--radius-element']).toBe('12px');
+ expect(tokens['--radius-container']).toBe('18px');
+ expect(tokens['--radius-page']).toBe('42px');
});
});
diff --git a/packages/core/src/theme/expandRadiusScale.ts b/packages/core/src/theme/expandRadiusScale.ts
index dcec2a7fac..36bf42a4a0 100644
--- a/packages/core/src/theme/expandRadiusScale.ts
+++ b/packages/core/src/theme/expandRadiusScale.ts
@@ -58,12 +58,12 @@ export type RadiusScaleTokens = Record<string, string>;
* @example
* ```
* const tokens = expandRadiusScale({ base: 4, multiplier: 1 });
- * // tokens['--radius-0'] === '0px'
- * // tokens['--radius-1'] === '4px'
- * // tokens['--radius-2'] === '8px'
- * // tokens['--radius-3'] === '12px'
- * // tokens['--radius-4'] === '16px'
- * // tokens['--radius-rounded'] === '9999px'
+ * // tokens['--radius-none'] === '0px'
+ * // tokens['--radius-inner'] === '4px'
+ * // tokens['--radius-element'] === '8px'
+ * // tokens['--radius-container'] === '12px'
+ * // tokens['--radius-page'] === '28px'
+ * // tokens['--radius-full'] === '9999px'
* ```
*/
export function expandRadiusScale(
@@ -71,11 +71,11 @@ export function expandRadiusScale(
): RadiusScaleTokens {
const {base, multiplier} = config;
return {
- '--radius-0': '0px',
- '--radius-1': `${Math.round(base * 1 * multiplier)}px`,
- '--radius-2': `${Math.round(base * 2 * multiplier)}px`,
- '--radius-3': `${Math.round(base * 3 * multiplier)}px`,
- '--radius-4': `${Math.round(base * 4 * multiplier)}px`,
- '--radius-rounded': '9999px',
+ '--radius-none': '0px',
+ '--radius-inner': `${Math.round(base * 1 * multiplier)}px`,
+ '--radius-element': `${Math.round(base * 2 * multiplier)}px`,
+ '--radius-container': `${Math.round(base * 3 * multiplier)}px`,
+ '--radius-page': `${Math.round(base * 7 * multiplier)}px`,
+ '--radius-full': '9999px',
};
}
diff --git a/packages/core/src/theme/expandTypeScale.test.ts b/packages/core/src/theme/expandTypeScale.test.ts
index cac325fd3a..c7e89f282e 100644
--- a/packages/core/src/theme/expandTypeScale.test.ts
+++ b/packages/core/src/theme/expandTypeScale.test.ts
@@ -12,18 +12,18 @@ describe('expandTypeScale', () => {
it('emits 11 raw size tokens in rem', () => {
const sizeTokens = [
- '--text-4xs',
- '--text-3xs',
- '--text-2xs',
- '--text-xsm',
- '--text-sm',
- '--text-base',
- '--text-lg',
- '--text-xl',
- '--text-2xl',
- '--text-3xl',
- '--text-4xl',
- '--text-5xl',
+ '--font-size-4xs',
+ '--font-size-3xs',
+ '--font-size-2xs',
+ '--font-size-xs',
+ '--font-size-sm',
+ '--font-size-base',
+ '--font-size-lg',
+ '--font-size-xl',
+ '--font-size-2xl',
+ '--font-size-3xl',
+ '--font-size-4xl',
+ '--font-size-5xl',
];
for (const name of sizeTokens) {
expect(tokens[name]).toBeDefined();
@@ -31,24 +31,24 @@ describe('expandTypeScale', () => {
}
});
- it('anchors --text-base to the base size', () => {
- expect(tokens['--text-base']).toBe('0.875rem'); // 14/16
+ it('anchors --font-size-base to the base size', () => {
+ expect(tokens['--font-size-base']).toBe('0.875rem'); // 14/16
});
it('computes geometric progression for sub-scale tokens', () => {
- expect(tokens['--text-4xs']).toBe('0.375rem'); // 6/16
- expect(tokens['--text-3xs']).toBe('0.4375rem'); // 7/16
- expect(tokens['--text-2xs']).toBe('0.5rem'); // 8/16
+ expect(tokens['--font-size-4xs']).toBe('0.375rem'); // 6/16
+ expect(tokens['--font-size-3xs']).toBe('0.4375rem'); // 7/16
+ expect(tokens['--font-size-2xs']).toBe('0.5rem'); // 8/16
});
it('computes geometric progression', () => {
- expect(tokens['--text-xsm']).toBe('0.625rem'); // 10/16
- expect(tokens['--text-sm']).toBe('0.75rem'); // 12/16
- expect(tokens['--text-lg']).toBe('1.0625rem'); // 17/16
- expect(tokens['--text-xl']).toBe('1.25rem'); // 20/16
- expect(tokens['--text-2xl']).toBe('1.5rem'); // 24/16
- expect(tokens['--text-3xl']).toBe('1.8125rem'); // 29/16
- expect(tokens['--text-4xl']).toBe('2.1875rem'); // 35/16
+ expect(tokens['--font-size-xs']).toBe('0.625rem'); // 10/16
+ expect(tokens['--font-size-sm']).toBe('0.75rem'); // 12/16
+ expect(tokens['--font-size-lg']).toBe('1.0625rem'); // 17/16
+ expect(tokens['--font-size-xl']).toBe('1.25rem'); // 20/16
+ expect(tokens['--font-size-2xl']).toBe('1.5rem'); // 24/16
+ expect(tokens['--font-size-3xl']).toBe('1.8125rem'); // 29/16
+ expect(tokens['--font-size-4xl']).toBe('2.1875rem'); // 35/16
});
});
@@ -56,29 +56,29 @@ describe('expandTypeScale', () => {
const tokens = expandTypeScale({base: 14, ratio: 1.2});
it('heading sizes are var() references to raw tokens', () => {
- expect(tokens['--heading-1-size']).toBe('var(--text-2xl)');
- expect(tokens['--heading-2-size']).toBe('var(--text-xl)');
- expect(tokens['--heading-3-size']).toBe('var(--text-lg)');
- expect(tokens['--heading-4-size']).toBe('var(--text-base)');
- expect(tokens['--heading-5-size']).toBe('var(--text-sm)');
- expect(tokens['--heading-6-size']).toBe('var(--text-xsm)');
+ expect(tokens['--text-heading-1-size']).toBe('var(--font-size-2xl)');
+ expect(tokens['--text-heading-2-size']).toBe('var(--font-size-xl)');
+ expect(tokens['--text-heading-3-size']).toBe('var(--font-size-lg)');
+ expect(tokens['--text-heading-4-size']).toBe('var(--font-size-base)');
+ expect(tokens['--text-heading-5-size']).toBe('var(--font-size-sm)');
+ expect(tokens['--text-heading-6-size']).toBe('var(--font-size-xs)');
});
it('heading leadings are hardcoded computed values', () => {
- expect(tokens['--heading-1-leading']).toBe('1.3333'); // 24px → 32px
- expect(tokens['--heading-2-leading']).toBe('1.4'); // 20px → 28px
- expect(tokens['--heading-3-leading']).toBe('1.4118'); // 17px → 24px
- expect(tokens['--heading-4-leading']).toBe('1.4286'); // 14px → 20px
- expect(tokens['--heading-5-leading']).toBe('1.6667'); // 12px → 20px
- expect(tokens['--heading-6-leading']).toBe('1.6'); // 10px → 16px
+ expect(tokens['--text-heading-1-leading']).toBe('1.3333'); // 24px → 32px
+ expect(tokens['--text-heading-2-leading']).toBe('1.4'); // 20px → 28px
+ expect(tokens['--text-heading-3-leading']).toBe('1.4118'); // 17px → 24px
+ expect(tokens['--text-heading-4-leading']).toBe('1.4286'); // 14px → 20px
+ expect(tokens['--text-heading-5-leading']).toBe('1.6667'); // 12px → 20px
+ expect(tokens['--text-heading-6-leading']).toBe('1.6'); // 10px → 16px
});
it('text type sizes are var() references', () => {
- expect(tokens['--text-body-size']).toBe('var(--text-base)');
- expect(tokens['--text-large-size']).toBe('var(--text-lg)');
- expect(tokens['--text-label-size']).toBe('var(--text-base)');
- expect(tokens['--text-code-size']).toBe('var(--text-base)');
- expect(tokens['--text-supporting-size']).toBe('var(--text-sm)');
+ expect(tokens['--text-body-size']).toBe('var(--font-size-base)');
+ expect(tokens['--text-large-size']).toBe('var(--font-size-lg)');
+ expect(tokens['--text-label-size']).toBe('var(--font-size-base)');
+ expect(tokens['--text-code-size']).toBe('var(--font-size-base)');
+ expect(tokens['--text-supporting-size']).toBe('var(--font-size-sm)');
});
it('text type leadings are hardcoded computed values', () => {
@@ -90,7 +90,9 @@ describe('expandTypeScale', () => {
});
it('weight tokens are var() references (unchanged)', () => {
- expect(tokens['--heading-1-weight']).toBe('var(--font-weight-semibold)');
+ expect(tokens['--text-heading-1-weight']).toBe(
+ 'var(--font-weight-semibold)',
+ );
expect(tokens['--text-body-weight']).toBe('var(--font-weight-normal)');
expect(tokens['--text-large-weight']).toBe('var(--font-weight-semibold)');
expect(tokens['--text-label-weight']).toBe('var(--font-weight-medium)');
@@ -102,11 +104,11 @@ describe('expandTypeScale', () => {
it('computes display sizes continuing the progression above h1', () => {
// display-1 = 14 × 1.2⁶ ≈ 41.80 → 42px → 2.625rem (largest)
- expect(tokens['--text-display-1-size']).toBe('var(--text-5xl)');
+ expect(tokens['--text-display-1-size']).toBe('var(--font-size-5xl)');
// display-2 = 14 × 1.2⁵ ≈ 34.84 → 35px → 2.1875rem
- expect(tokens['--text-display-2-size']).toBe('var(--text-4xl)');
+ expect(tokens['--text-display-2-size']).toBe('var(--font-size-4xl)');
// display-3 = 14 × 1.2⁴ ≈ 29.03 → 29px → 1.8125rem (closest to h1)
- expect(tokens['--text-display-3-size']).toBe('var(--text-3xl)');
+ expect(tokens['--text-display-3-size']).toBe('var(--font-size-3xl)');
});
it('assigns normal weight to display types by default', () => {
@@ -124,12 +126,12 @@ describe('expandTypeScale', () => {
it('all line heights snap to 4px grid', () => {
// Map semantic leading tokens to their font sizes (px)
const pairs: [string, number][] = [
- ['--heading-1-leading', 24],
- ['--heading-2-leading', 20],
- ['--heading-3-leading', 17],
- ['--heading-4-leading', 14],
- ['--heading-5-leading', 12],
- ['--heading-6-leading', 10],
+ ['--text-heading-1-leading', 24],
+ ['--text-heading-2-leading', 20],
+ ['--text-heading-3-leading', 17],
+ ['--text-heading-4-leading', 14],
+ ['--text-heading-5-leading', 12],
+ ['--text-heading-6-leading', 10],
['--text-body-leading', 14],
['--text-large-leading', 17],
['--text-supporting-leading', 12],
@@ -144,17 +146,17 @@ describe('expandTypeScale', () => {
it('uses tiered target ratio based on font size', () => {
// < 20px target 1.5: 14px → 20px line
- expect(Math.round(14 * parseFloat(tokens['--heading-4-leading']))).toBe(
- 20,
- );
+ expect(
+ Math.round(14 * parseFloat(tokens['--text-heading-4-leading'])),
+ ).toBe(20);
// 20-31px target 1.4: 20px → 28px line
- expect(Math.round(20 * parseFloat(tokens['--heading-2-leading']))).toBe(
- 28,
- );
+ expect(
+ Math.round(20 * parseFloat(tokens['--text-heading-2-leading'])),
+ ).toBe(28);
// 20-31px target 1.4: 24px → 32px line
- expect(Math.round(24 * parseFloat(tokens['--heading-1-leading']))).toBe(
- 32,
- );
+ expect(
+ Math.round(24 * parseFloat(tokens['--text-heading-1-leading'])),
+ ).toBe(32);
});
});
@@ -184,8 +186,10 @@ describe('expandTypeScale', () => {
ratio: 1.2,
weights: {heading: {1: 'var(--font-weight-bold)'}},
});
- expect(tokens['--heading-1-weight']).toBe('var(--font-weight-bold)');
- expect(tokens['--heading-2-weight']).toBe('var(--font-weight-semibold)');
+ expect(tokens['--text-heading-1-weight']).toBe('var(--font-weight-bold)');
+ expect(tokens['--text-heading-2-weight']).toBe(
+ 'var(--font-weight-semibold)',
+ );
});
it('applies text weight overrides', () => {
@@ -202,15 +206,15 @@ describe('expandTypeScale', () => {
describe('alternate scales', () => {
it('dense scale (base=12, ratio=1.125)', () => {
const tokens = expandTypeScale({base: 12, ratio: 1.125});
- expect(tokens['--text-base']).toBe('0.75rem'); // 12/16
- expect(tokens['--heading-4-size']).toBe('var(--text-base)');
+ expect(tokens['--font-size-base']).toBe('0.75rem'); // 12/16
+ expect(tokens['--text-heading-4-size']).toBe('var(--font-size-base)');
});
it('airy scale (base=16, ratio=1.25)', () => {
const tokens = expandTypeScale({base: 16, ratio: 1.25});
- expect(tokens['--text-base']).toBe('1rem'); // 16/16
- expect(tokens['--text-lg']).toBe('1.25rem'); // 20/16
- expect(tokens['--heading-1-size']).toBe('var(--text-2xl)');
+ expect(tokens['--font-size-base']).toBe('1rem'); // 16/16
+ expect(tokens['--font-size-lg']).toBe('1.25rem'); // 20/16
+ expect(tokens['--text-heading-1-size']).toBe('var(--font-size-2xl)');
});
it('all scales produce 4px-grid-aligned line heights', () => {
@@ -227,7 +231,7 @@ describe('expandTypeScale', () => {
const fontSize = Math.round(
config.base * Math.pow(config.ratio, step),
);
- const ratio = parseFloat(tokens[`--heading-${level}-leading`]);
+ const ratio = parseFloat(tokens[`--text-heading-${level}-leading`]);
const lhPx = Math.round(fontSize * ratio);
expect(lhPx % 4).toBe(0);
expect(lhPx).toBeGreaterThanOrEqual(fontSize + 4);
@@ -270,10 +274,10 @@ describe('generateTypeScaleComponents', () => {
it('heading rules include fontFamily, fontSize, fontWeight, lineHeight', () => {
const components = generateTypeScaleComponents({base: 14, ratio: 1.2});
const h1 = components.heading['level:1'];
- expect(h1.fontFamily).toBe('var(--font-heading)');
- expect(h1.fontSize).toBe('var(--heading-1-size)');
- expect(h1.fontWeight).toBe('var(--heading-1-weight)');
- expect(h1.lineHeight).toBe('var(--heading-1-leading)');
+ expect(h1.fontFamily).toBe('var(--font-family-heading)');
+ expect(h1.fontSize).toBe('var(--text-heading-1-size)');
+ expect(h1.fontWeight).toBe('var(--text-heading-1-weight)');
+ expect(h1.lineHeight).toBe('var(--text-heading-1-leading)');
});
it('generates heading and text component overrides', () => {
@@ -285,10 +289,10 @@ describe('generateTypeScaleComponents', () => {
it('heading overrides reference semantic tokens', () => {
const components = generateTypeScaleComponents({base: 14, ratio: 1.2});
expect(components.heading['level:1'].fontSize).toBe(
- 'var(--heading-1-size)',
+ 'var(--text-heading-1-size)',
);
expect(components.heading['level:1'].lineHeight).toBe(
- 'var(--heading-1-leading)',
+ 'var(--text-heading-1-leading)',
);
});
diff --git a/packages/core/src/theme/expandTypeScale.ts b/packages/core/src/theme/expandTypeScale.ts
index 6886a9c6e2..89c2b1b1dd 100644
--- a/packages/core/src/theme/expandTypeScale.ts
+++ b/packages/core/src/theme/expandTypeScale.ts
@@ -8,7 +8,7 @@
* using a geometric progression: size = base × ratio^step.
*
* Two-layer architecture:
- * Layer 1: Raw size tokens (--text-4xs … --text-4xl)
+ * Layer 1: Raw size tokens (--font-size-4xs … --font-size-4xl)
* Geometric progression in rem.
* Layer 2: Semantic tokens (--heading-*, --text-*-size/leading/weight)
* Sizes are var() references to Layer 1.
@@ -20,17 +20,17 @@
* component use.
*
* Step mapping:
- * step -5 → --text-4xs (sub-scale)
- * step -4 → --text-3xs (sub-scale)
- * step -3 → --text-2xs (sub-scale)
- * step -2 → --text-xsm (h6)
- * step -1 → --text-sm (h5, supporting)
- * step 0 → --text-base (h4, body, label, code)
- * step +1 → --text-lg (h3, large)
- * step +2 → --text-xl (h2)
- * step +3 → --text-2xl (h1)
- * step +4 → --text-3xl
- * step +5 → --text-4xl
+ * step -5 → --font-size-4xs (sub-scale)
+ * step -4 → --font-size-3xs (sub-scale)
+ * step -3 → --font-size-2xs (sub-scale)
+ * step -2 → --font-size-xs (h6)
+ * step -1 → --font-size-sm (h5, supporting)
+ * step 0 → --font-size-base (h4, body, label, code)
+ * step +1 → --font-size-lg (h3, large)
+ * step +2 → --font-size-xl (h2)
+ * step +3 → --font-size-2xl (h1)
+ * step +4 → --font-size-3xl
+ * step +5 → --font-size-4xl
*
* Line heights use a tiered target ratio based on font size:
* < 20px → 1.5 (body text, small UI)
@@ -131,31 +131,31 @@ export type TypeScaleTokens = Record<string, string>;
* These tokens form the geometric font size scale.
*
* The full scale spans steps -5 to +5:
- * -5 → --text-4xs (sub-scale)
- * -4 → --text-3xs (sub-scale)
- * -3 → --text-2xs (sub-scale)
- * -2 → --text-xsm
- * -1 → --text-sm
- * 0 → --text-base (anchor)
- * +1 → --text-lg
- * +2 → --text-xl
- * +3 → --text-2xl
- * +4 → --text-3xl
- * +5 → --text-4xl
+ * -5 → --font-size-4xs (sub-scale)
+ * -4 → --font-size-3xs (sub-scale)
+ * -3 → --font-size-2xs (sub-scale)
+ * -2 → --font-size-xs
+ * -1 → --font-size-sm
+ * 0 → --font-size-base (anchor)
+ * +1 → --font-size-lg
+ * +2 → --font-size-xl
+ * +3 → --font-size-2xl
+ * +4 → --font-size-3xl
+ * +5 → --font-size-4xl
*/
const STEP_TO_SIZE_TOKEN: Record<number, string> = {
- [-5]: '--text-4xs',
- [-4]: '--text-3xs',
- [-3]: '--text-2xs',
- [-2]: '--text-xsm',
- [-1]: '--text-sm',
- [0]: '--text-base',
- [1]: '--text-lg',
- [2]: '--text-xl',
- [3]: '--text-2xl',
- [4]: '--text-3xl',
- [5]: '--text-4xl',
- [6]: '--text-5xl',
+ [-5]: '--font-size-4xs',
+ [-4]: '--font-size-3xs',
+ [-3]: '--font-size-2xs',
+ [-2]: '--font-size-xs',
+ [-1]: '--font-size-sm',
+ [0]: '--font-size-base',
+ [1]: '--font-size-lg',
+ [2]: '--font-size-xl',
+ [3]: '--font-size-2xl',
+ [4]: '--font-size-3xl',
+ [5]: '--font-size-4xl',
+ [6]: '--font-size-5xl',
};
/**
@@ -275,7 +275,7 @@ function computeLeading(fontSize: number): number {
* Expand a type scale configuration into typography token overrides.
*
* Generates two layers of tokens:
- * - Layer 1: 11 raw size tokens (--text-4xs … --text-4xl) in rem
+ * - Layer 1: 11 raw size tokens (--font-size-4xs … --font-size-4xl) in rem
* - Layer 2: semantic tokens using var() refs for sizes and
* hardcoded computed values for line heights
*
@@ -288,13 +288,13 @@ function computeLeading(fontSize: number): number {
* ```
* const tokens = expandTypeScale({ base: 14, ratio: 1.2 });
* // Layer 1 — raw sizes
- * // tokens['--text-base'] === '0.875rem'
- * // tokens['--text-2xl'] === '1.5rem'
+ * // tokens['--font-size-base'] === '0.875rem'
+ * // tokens['--font-size-2xl'] === '1.5rem'
* //
* // Layer 2 — semantic
- * // tokens['--heading-1-size'] === 'var(--text-2xl)'
- * // tokens['--heading-1-leading'] === '1.3333'
- * // tokens['--text-body-size'] === 'var(--text-base)'
+ * // tokens['--text-heading-1-size'] === 'var(--font-size-2xl)'
+ * // tokens['--text-heading-1-leading'] === '1.3333'
+ * // tokens['--text-body-size'] === 'var(--font-size-base)'
* // tokens['--text-body-leading'] === '1.4286'
* ```
*/
@@ -329,9 +329,9 @@ export function expandTypeScale(config: XDSTypeScaleConfig): TypeScaleTokens {
const size = computeSize(base, ratio, step);
const leading = computeLeading(size);
- tokens[`--heading-${level}-size`] = `var(${STEP_TO_SIZE_TOKEN[step]})`;
- tokens[`--heading-${level}-weight`] = headingWeights[level];
- tokens[`--heading-${level}-leading`] = `${leading}`;
+ tokens[`--text-heading-${level}-size`] = `var(${STEP_TO_SIZE_TOKEN[step]})`;
+ tokens[`--text-heading-${level}-weight`] = headingWeights[level];
+ tokens[`--text-heading-${level}-leading`] = `${leading}`;
}
// Text tokens
@@ -352,14 +352,14 @@ export function expandTypeScale(config: XDSTypeScaleConfig): TypeScaleTokens {
// =============================================================================
const TEXT_FONT_FAMILIES: Record<string, string> = {
- body: 'var(--font-body)',
- large: 'var(--font-body)',
- label: 'var(--font-body)',
- code: 'var(--font-code)',
- supporting: 'var(--font-body)',
- 'display-1': 'var(--font-heading)',
- 'display-2': 'var(--font-heading)',
- 'display-3': 'var(--font-heading)',
+ body: 'var(--font-family-body)',
+ large: 'var(--font-family-body)',
+ label: 'var(--font-family-body)',
+ code: 'var(--font-family-code)',
+ supporting: 'var(--font-family-body)',
+ 'display-1': 'var(--font-family-heading)',
+ 'display-2': 'var(--font-family-heading)',
+ 'display-3': 'var(--font-family-heading)',
};
/**
@@ -373,10 +373,10 @@ export function generateTypeScaleComponents(
const headingRules: Record<string, Record<string, string>> = {};
for (const level of [1, 2, 3, 4, 5, 6]) {
headingRules[`level:${level}`] = {
- fontFamily: 'var(--font-heading)',
- fontSize: `var(--heading-${level}-size)`,
- fontWeight: `var(--heading-${level}-weight)`,
- lineHeight: `var(--heading-${level}-leading)`,
+ fontFamily: 'var(--font-family-heading)',
+ fontSize: `var(--text-heading-${level}-size)`,
+ fontWeight: `var(--text-heading-${level}-weight)`,
+ lineHeight: `var(--text-heading-${level}-leading)`,
};
}
components.heading = headingRules;
diff --git a/packages/core/src/theme/generateThemeRules.test.ts b/packages/core/src/theme/generateThemeRules.test.ts
index aa3b3bf871..4a598ee076 100644
--- a/packages/core/src/theme/generateThemeRules.test.ts
+++ b/packages/core/src/theme/generateThemeRules.test.ts
@@ -37,30 +37,30 @@ describe('generateThemeRules', () => {
const scopeRule = rules.find(r => r.includes(':scope'));
expect(scopeRule).toBeDefined();
// Raw size tokens are rem values
- expect(scopeRule).toContain('--text-base: 0.875rem');
- expect(scopeRule).toContain('--text-2xl: 1.5rem');
+ expect(scopeRule).toContain('--font-size-base: 0.875rem');
+ expect(scopeRule).toContain('--font-size-2xl: 1.5rem');
// Semantic tokens are var() refs
- expect(scopeRule).toContain('--heading-1-size: var(--text-2xl)');
- expect(scopeRule).toContain('--heading-4-size: var(--text-base)');
- expect(scopeRule).toContain('--text-body-size: var(--text-base)');
- expect(scopeRule).toContain('--text-supporting-size: var(--text-sm)');
+ expect(scopeRule).toContain('--text-heading-1-size: var(--font-size-2xl)');
+ expect(scopeRule).toContain('--text-heading-4-size: var(--font-size-base)');
+ expect(scopeRule).toContain('--text-body-size: var(--font-size-base)');
+ expect(scopeRule).toContain('--text-supporting-size: var(--font-size-sm)');
});
it('emits raw size tokens in rem', () => {
const scopeRule = rules.find(r => r.includes(':scope'))!;
- // Raw tokens (--text-4xs through --text-4xl) should be in rem
+ // Raw tokens (--font-size-4xs through --font-size-4xl) should be in rem
const rawSizeTokens = [
- '--text-4xs',
- '--text-3xs',
- '--text-2xs',
- '--text-xsm',
- '--text-sm',
- '--text-base',
- '--text-lg',
- '--text-xl',
- '--text-2xl',
- '--text-3xl',
- '--text-4xl',
+ '--font-size-4xs',
+ '--font-size-3xs',
+ '--font-size-2xs',
+ '--font-size-xs',
+ '--font-size-sm',
+ '--font-size-base',
+ '--font-size-lg',
+ '--font-size-xl',
+ '--font-size-2xl',
+ '--font-size-3xl',
+ '--font-size-4xl',
];
for (const token of rawSizeTokens) {
const match = scopeRule.match(new RegExp(`${token}: ([^;]+)`));
@@ -72,11 +72,11 @@ describe('generateThemeRules', () => {
it('emits semantic size tokens as var() refs', () => {
const scopeRule = rules.find(r => r.includes(':scope'))!;
const semanticSizeTokens = scopeRule.match(
- /--(?:heading-\d|text-(?:body|large|label|code|supporting))-size: [^;]+/g,
+ /--(?:text-heading-\d|text-(?:body|large|label|code|supporting))-size: [^;]+/g,
);
expect(semanticSizeTokens).not.toBeNull();
semanticSizeTokens!.forEach(m => {
- expect(m).toContain('var(--text-');
+ expect(m).toContain('var(--font-size-');
});
});
@@ -102,9 +102,9 @@ describe('generateThemeRules', () => {
const rule = rules.find(r => r.includes(`.xds-heading.level-${level}`));
expect(rule).toBeDefined();
expect(rule).toContain('font-family');
- expect(rule).toContain(`var(--heading-${level}-size)`);
- expect(rule).toContain(`var(--heading-${level}-weight)`);
- expect(rule).toContain(`var(--heading-${level}-leading)`);
+ expect(rule).toContain(`var(--text-heading-${level}-size)`);
+ expect(rule).toContain(`var(--text-heading-${level}-weight)`);
+ expect(rule).toContain(`var(--text-heading-${level}-leading)`);
}
});
@@ -130,7 +130,7 @@ describe('generateThemeRules', () => {
);
expect(h1Rule).toBeDefined();
// Prose rules use val() helper which resolves to the token value (now a var ref)
- expect(h1Rule).toContain('var(--text-2xl)');
+ expect(h1Rule).toContain('var(--font-size-2xl)');
expect(h1Rule).toContain('var(--font-weight-semibold)');
});
@@ -139,7 +139,7 @@ describe('generateThemeRules', () => {
r => r.trimStart().startsWith('p {') || r.includes('\n p {'),
);
expect(pRule).toBeDefined();
- expect(pRule).toContain('var(--text-base)');
+ expect(pRule).toContain('var(--font-size-base)');
expect(pRule).toContain('var(--color-text-primary)');
});
@@ -186,10 +186,12 @@ describe('generateThemeRules with weight overrides', () => {
it('reflects weight override in tokens', () => {
const scopeRule = rules.find(r => r.includes(':scope'))!;
- expect(scopeRule).toContain('--heading-3-weight: var(--font-weight-bold)');
+ expect(scopeRule).toContain(
+ '--text-heading-3-weight: var(--font-weight-bold)',
+ );
// Other levels keep default
expect(scopeRule).toContain(
- '--heading-1-weight: var(--font-weight-semibold)',
+ '--text-heading-1-weight: var(--font-weight-semibold)',
);
});
diff --git a/packages/core/src/theme/index.ts b/packages/core/src/theme/index.ts
index e97058a90a..ee415ddca8 100644
--- a/packages/core/src/theme/index.ts
+++ b/packages/core/src/theme/index.ts
@@ -55,6 +55,7 @@ export {
colorDefaults,
spacingDefaults,
sizeDefaults,
+ borderDefaults,
radiusDefaults,
shadowDefaults,
durationDefaults,
@@ -62,12 +63,12 @@ export {
transitionDefaults,
typographyDefaults,
textSizeDefaults,
- lineHeightDefaults,
fontWeightDefaults,
typeScaleDefaults,
colorVars,
spacingVars,
sizeVars,
+ borderVars,
radiusVars,
shadowVars,
durationVars,
@@ -75,7 +76,6 @@ export {
transitionVars,
typographyVars,
textSizeVars,
- lineHeightVars,
fontWeightVars,
typeScaleVars,
} from './tokens.stylex';
@@ -85,6 +85,7 @@ export type {
ColorVarName,
SpacingVarName,
SizeVarName,
+ BorderVarName,
RadiusVarName,
ShadowVarName,
DurationVarName,
@@ -92,7 +93,6 @@ export type {
TransitionVarName,
TypographyVarName,
TextSizeVarName,
- LineHeightVarName,
FontWeightVarName,
TypeScaleVarName,
} from './tokens.stylex';
diff --git a/packages/core/src/theme/tokens.stylex.ts b/packages/core/src/theme/tokens.stylex.ts
index 9dd81cf26b..04c24b95b1 100644
--- a/packages/core/src/theme/tokens.stylex.ts
+++ b/packages/core/src/theme/tokens.stylex.ts
@@ -18,116 +18,114 @@ export const colorDefaults = {
// Core semantic
'--color-accent': 'light-dark(#0064E0, #2694FE)',
'--color-accent-muted': 'light-dark(#0082FB33, #0082FB3F)',
- '--color-secondary':
+ '--color-on-accent': 'light-dark(#FFFFFF, #FFFFFF)',
+ '--color-neutral':
'light-dark(rgba(5, 54, 89, 0.1), rgba(223, 226, 229, 0.2))',
- '--color-surface': 'light-dark(#FFFFFF, #1F1F22)',
- '--color-wash': 'light-dark(#F1F4F7, #111112)',
+ '--color-background-surface': 'light-dark(#FFFFFF, #1F1F22)',
+ '--color-background-body': 'light-dark(#F1F4F7, #111112)',
'--color-overlay': 'light-dark(#01122866, #11111299)',
'--color-overlay-hover': 'light-dark(#0536590C, #FFFFFF0C)',
'--color-overlay-pressed': 'light-dark(#05365919, #FFFFFF19)',
- '--color-ring-focus': 'light-dark(#0171E3, #2694FE)',
- '--color-ring-focus-error': 'light-dark(#E3193B, #F5394F)',
- '--color-ring-focus-success': 'light-dark(#0D8626, #0D8626)',
- '--color-ring-focus-warning': 'light-dark(#F2C00B, #E9AF08)',
- '--color-muted': 'light-dark(#0536590C, #1111127F)',
+ '--color-background-muted': 'light-dark(#0536590C, #1111127F)',
// Text
'--color-text-primary': 'light-dark(#0A1317, #DFE2E5)',
'--color-text-secondary': 'light-dark(#4E606F, #AAAFB5)',
'--color-text-disabled': 'light-dark(#A4B0BC, #6F747C)',
- '--color-text-link': 'light-dark(#0064E0, #3E9EFB)',
- '--color-text-on-dark-media': 'light-dark(#FFFFFF, #FFFFFF)',
+ '--color-text-accent': 'light-dark(#0064E0, #3E9EFB)',
+ '--color-on-dark': 'light-dark(#FFFFFF, #FFFFFF)',
+ '--color-on-light': 'light-dark(#000000, #000000)',
// Icon
+ '--color-icon-accent': 'light-dark(#0064E0, #2694FE)',
'--color-icon-primary': 'light-dark(#0A1317, #DFE2E5)',
'--color-icon-secondary': 'light-dark(#4E606F, #AAAFB5)',
'--color-icon-disabled': 'light-dark(#A4B0BC, #6F747C)',
- '--color-icon-on-dark-media': 'light-dark(#FFFFFF, #FFFFFF)',
// Surface variants
- '--color-card': 'light-dark(#FFFFFF, #1F1F22)',
- '--color-popover': 'light-dark(#FFFFFF, #28292C)',
+ '--color-background-card': 'light-dark(#FFFFFF, #1F1F22)',
+ '--color-background-popover': 'light-dark(#FFFFFF, #28292C)',
// Status/Sentiment
'--color-success': 'light-dark(#0D8626, #0D8626)',
'--color-success-muted': 'light-dark(#0B991F33, #0B991F3F)',
+ '--color-on-success': 'light-dark(#FFFFFF, #FFFFFF)',
'--color-error': 'light-dark(#E3193B, #F5394F)',
'--color-error-muted': 'light-dark(#E3193B33, #F5394F3F)',
+ '--color-on-error': 'light-dark(#FFFFFF, #FFFFFF)',
'--color-warning': 'light-dark(#E9AF08, #F2C00B)',
'--color-warning-muted': 'light-dark(#E2A40033, #E2A4003F)',
- '--color-info': 'light-dark(#5B08D8, #6B1EFD)',
- '--color-info-muted': 'light-dark(#7952FF33, #5B08D83F)',
+ '--color-on-warning': 'light-dark(#0A1317, #0A1317)',
// Border
'--color-border': 'light-dark(#05365919, #F2F4F619)',
- '--color-border-strong': 'light-dark(#647685, #6F747C)',
'--color-border-emphasized': 'light-dark(#CCD3DB, #494D53)',
// Effects
'--color-skeleton': 'light-dark(#CCD3DB, #5A5E66)',
'--color-shadow': 'light-dark(rgba(5, 54, 89, 0.1), rgba(0, 0, 0, 0.3))',
// Hover tint: black in light mode, white in dark mode - used with color-mix for hover states
- '--color-hover-tint': 'light-dark(black, white)',
+ '--color-tint-hover': 'light-dark(black, white)',
// Blue
- '--color-blue-background': 'light-dark(#0171E333, #0171E333)',
- '--color-blue-border': 'light-dark(#0171E3, #4BA9FE)',
- '--color-blue-icon': 'light-dark(#0064E0, #2694FE)',
- '--color-blue-text': 'light-dark(#042F97, #AFD7FF)',
+ '--color-background-blue': 'light-dark(#0171E333, #0171E333)',
+ '--color-border-blue': 'light-dark(#0171E3, #4BA9FE)',
+ '--color-icon-blue': 'light-dark(#0064E0, #2694FE)',
+ '--color-text-blue': 'light-dark(#042F97, #AFD7FF)',
// Cyan
- '--color-cyan-background': 'light-dark(#00BCD433, #00BCD433)',
- '--color-cyan-border': 'light-dark(#00BCD4, #4DD0E1)',
- '--color-cyan-icon': 'light-dark(#00ACC1, #26C6DA)',
- '--color-cyan-text': 'light-dark(#006064, #B2EBF2)',
+ '--color-background-cyan': 'light-dark(#00BCD433, #00BCD433)',
+ '--color-border-cyan': 'light-dark(#00BCD4, #4DD0E1)',
+ '--color-icon-cyan': 'light-dark(#00ACC1, #26C6DA)',
+ '--color-text-cyan': 'light-dark(#006064, #B2EBF2)',
// Gray
- '--color-gray-background': 'light-dark(#0A131733, #666A724C)',
- '--color-gray-border': 'light-dark(#647685, #8C939B)',
- '--color-gray-icon': 'light-dark(#4E606F, #AAAFB5)',
- '--color-gray-text': 'light-dark(#0A1317, #E7EAED)',
+ '--color-background-gray': 'light-dark(#0A131733, #666A724C)',
+ '--color-border-gray': 'light-dark(#647685, #8C939B)',
+ '--color-icon-gray': 'light-dark(#4E606F, #AAAFB5)',
+ '--color-text-gray': 'light-dark(#0A1317, #E7EAED)',
// Green
- '--color-green-background': 'light-dark(#24BB5E33, #24BB5E33)',
- '--color-green-border': 'light-dark(#24BB5E, #4CD964)',
- '--color-green-icon': 'light-dark(#0D8626, #26A756)',
- '--color-green-text': 'light-dark(#09441F, #A5F690)',
+ '--color-background-green': 'light-dark(#24BB5E33, #24BB5E33)',
+ '--color-border-green': 'light-dark(#24BB5E, #4CD964)',
+ '--color-icon-green': 'light-dark(#0D8626, #26A756)',
+ '--color-text-green': 'light-dark(#09441F, #A5F690)',
// Orange
- '--color-orange-background': 'light-dark(#F2790233, #F2790233)',
- '--color-orange-border': 'light-dark(#F27902, #FFA040)',
- '--color-orange-icon': 'light-dark(#E9690B, #FB8C00)',
- '--color-orange-text': 'light-dark(#6B2203, #FDB876)',
+ '--color-background-orange': 'light-dark(#F2790233, #F2790233)',
+ '--color-border-orange': 'light-dark(#F27902, #FFA040)',
+ '--color-icon-orange': 'light-dark(#E9690B, #FB8C00)',
+ '--color-text-orange': 'light-dark(#6B2203, #FDB876)',
// Pink
- '--color-pink-background': 'light-dark(#E91E6333, #E91E6333)',
- '--color-pink-border': 'light-dark(#E91E63, #F48FB1)',
- '--color-pink-icon': 'light-dark(#C2185B, #EC407A)',
- '--color-pink-text': 'light-dark(#880E4F, #F8BBD0)',
+ '--color-background-pink': 'light-dark(#E91E6333, #E91E6333)',
+ '--color-border-pink': 'light-dark(#E91E63, #F48FB1)',
+ '--color-icon-pink': 'light-dark(#C2185B, #EC407A)',
+ '--color-text-pink': 'light-dark(#880E4F, #F8BBD0)',
// Purple
- '--color-purple-background': 'light-dark(#7952FF33, #7952FF33)',
- '--color-purple-border': 'light-dark(#7952FF, #9575CD)',
- '--color-purple-icon': 'light-dark(#5B08D8, #7952FF)',
- '--color-purple-text': 'light-dark(#3E0697, #B3B0FE)',
+ '--color-background-purple': 'light-dark(#7952FF33, #7952FF33)',
+ '--color-border-purple': 'light-dark(#7952FF, #9575CD)',
+ '--color-icon-purple': 'light-dark(#5B08D8, #7952FF)',
+ '--color-text-purple': 'light-dark(#3E0697, #B3B0FE)',
// Red
- '--color-red-background': 'light-dark(#E3193B33, #E3193B33)',
- '--color-red-border': 'light-dark(#E3193B, #F5394F)',
- '--color-red-icon': 'light-dark(#D31130, #E3193B)',
- '--color-red-text': 'light-dark(#7B0210, #FFB2B8)',
+ '--color-background-red': 'light-dark(#E3193B33, #E3193B33)',
+ '--color-border-red': 'light-dark(#E3193B, #F5394F)',
+ '--color-icon-red': 'light-dark(#D31130, #E3193B)',
+ '--color-text-red': 'light-dark(#7B0210, #FFB2B8)',
// Teal
- '--color-teal-background': 'light-dark(#0DB7AF33, #0DB7AF33)',
- '--color-teal-border': 'light-dark(#0DB7AF, #4DB6AC)',
- '--color-teal-icon': 'light-dark(#009688, #26A69A)',
- '--color-teal-text': 'light-dark(#083943, #40DCCD)',
+ '--color-background-teal': 'light-dark(#0DB7AF33, #0DB7AF33)',
+ '--color-border-teal': 'light-dark(#0DB7AF, #4DB6AC)',
+ '--color-icon-teal': 'light-dark(#009688, #26A69A)',
+ '--color-text-teal': 'light-dark(#083943, #40DCCD)',
// Yellow
- '--color-yellow-background': 'light-dark(#FFEB3B33, #FFEB3B33)',
- '--color-yellow-border': 'light-dark(#FFEB3B, #FFF176)',
- '--color-yellow-icon': 'light-dark(#FBC02D, #FFEE58)',
- '--color-yellow-text': 'light-dark(#753F07, #FBCE03)',
+ '--color-background-yellow': 'light-dark(#FFEB3B33, #FFEB3B33)',
+ '--color-border-yellow': 'light-dark(#FFEB3B, #FFF176)',
+ '--color-icon-yellow': 'light-dark(#FBC02D, #FFEE58)',
+ '--color-text-yellow': 'light-dark(#753F07, #FBCE03)',
// Syntax highlighting
} as const;
@@ -169,9 +167,9 @@ export const spacingVars = stylex.defineVars(spacingDefaults);
// =============================================================================
export const sizeDefaults = {
- '--size-sm': '28px',
- '--size-md': '32px',
- '--size-lg': '36px',
+ '--size-element-sm': '28px',
+ '--size-element-md': '32px',
+ '--size-element-lg': '36px',
} as const;
/** @deprecated Use sizeDefaults */
@@ -179,17 +177,29 @@ export const sizeRaw = sizeDefaults;
export const sizeVars = stylex.defineVars(sizeDefaults);
+// =============================================================================
+// Border Tokens
+// =============================================================================
+
+export const borderDefaults = {
+ '--border-width': '1px',
+} as const;
+
+export const borderVars = stylex.defineVars(borderDefaults);
+
+export type BorderVarName = keyof typeof borderDefaults;
+
// =============================================================================
// Radius Tokens
// =============================================================================
export const radiusDefaults = {
- '--radius-0': '0px',
- '--radius-1': '4px',
- '--radius-2': '8px',
- '--radius-3': '12px',
- '--radius-4': '16px',
- '--radius-rounded': '9999px',
+ '--radius-none': '0px',
+ '--radius-inner': '4px',
+ '--radius-element': '8px',
+ '--radius-container': '12px',
+ '--radius-page': '28px',
+ '--radius-full': '9999px',
} as const;
/** @deprecated Use radiusDefaults */
@@ -200,29 +210,23 @@ export const radiusVars = stylex.defineVars(radiusDefaults);
// =============================================================================
// Shadow Tokens
// =============================================================================
-// Outer shadows: shadow-base (subtle) → shadow-dialog (strongest).
-// Names encode use-case categories for LLM-friendly reasoning.
-// Inset shadows: inset-shadow-border-* for input state rings.
+// Shadow tokens: low → med → high (ascending intensity).
+// Inset shadows: for input state rings.
export const shadowDefaults = {
- // Outer elevation shadows (ascending intensity: base < menu < hover < dialog)
- '--shadow-base': '0px 0px 1px light-dark(rgba(0, 0, 0, 0.1), #111112)',
- '--shadow-menu':
+ // Outer elevation shadows (ascending intensity: low < med < high)
+ '--shadow-low':
'0px 1px 1px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.2)), 0px 2px 8px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.2))',
- '--shadow-hover':
+ '--shadow-med':
'0px 1px 2px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.2)), 0px 2px 12px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.2))',
- '--shadow-dialog':
+ '--shadow-high':
'0px 2px 2px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.2)), 0px 8px 24px light-dark(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.3))',
// Inset shadows for input border rings (interaction + validation states)
- '--inset-shadow-border-hover': 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.3)',
- '--inset-shadow-border-accent':
- 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.5)',
- '--inset-shadow-border-positive':
- 'inset 0px 0px 0px 2px rgba(38, 167, 86, 0.3)',
- '--inset-shadow-border-warning':
- 'inset 0px 0px 0px 2px rgba(226, 164, 0, 0.3)',
- '--inset-shadow-border-negative':
- 'inset 0px 0px 0px 2px rgba(227, 25, 59, 0.3)',
+ '--shadow-inset-hover': 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.3)',
+ '--shadow-inset-selected': 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.5)',
+ '--shadow-inset-success': 'inset 0px 0px 0px 2px rgba(38, 167, 86, 0.3)',
+ '--shadow-inset-warning': 'inset 0px 0px 0px 2px rgba(226, 164, 0, 0.3)',
+ '--shadow-inset-error': 'inset 0px 0px 0px 2px rgba(227, 25, 59, 0.3)',
} as const;
/** @deprecated Use shadowDefaults */
@@ -283,10 +287,10 @@ export const transitionVars = stylex.defineVars(transitionDefaults);
// =============================================================================
export const typographyDefaults = {
- '--font-body':
+ '--font-family-body':
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
- '--font-code': '"SF Mono", Monaco, Consolas, monospace',
- '--font-heading':
+ '--font-family-code': '"SF Mono", Monaco, Consolas, monospace',
+ '--font-family-heading':
'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',
} as const;
@@ -301,18 +305,18 @@ export const typographyVars = stylex.defineVars(typographyDefaults);
export const textSizeDefaults = {
// Full geometric scale: round(14 × 1.2^step) / 16, default base=14, ratio=1.2
- '--text-4xs': '0.375rem', // step -5: 6px (14 × 1.2⁻⁵ ≈ 5.63 → 6)
- '--text-3xs': '0.4375rem', // step -4: 7px (14 × 1.2⁻⁴ ≈ 6.75 → 7)
- '--text-2xs': '0.5rem', // step -3: 8px (14 × 1.2⁻³ ≈ 8.10 → 8)
- '--text-xsm': '0.625rem', // step -2: 10px (14 × 1.2⁻² ≈ 9.72 → 10)
- '--text-sm': '0.75rem', // step -1: 12px (14 × 1.2⁻¹ ≈ 11.67 → 12)
- '--text-base': '0.875rem', // step 0: 14px — base anchor
- '--text-lg': '1.0625rem', // step +1: 17px (14 × 1.2¹ ≈ 16.8 → 17)
- '--text-xl': '1.25rem', // step +2: 20px (14 × 1.2² ≈ 20.16 → 20)
- '--text-2xl': '1.5rem', // step +3: 24px (14 × 1.2³ ≈ 24.19 → 24)
- '--text-3xl': '1.8125rem', // step +4: 29px (14 × 1.2⁴ ≈ 29.03 → 29)
- '--text-4xl': '2.1875rem', // step +5: 35px (14 × 1.2⁵ ≈ 34.84 → 35)
- '--text-5xl': '2.625rem', // step +6: 42px (14 × 1.2⁶ ≈ 41.80 → 42)
+ '--font-size-4xs': '0.375rem', // step -5: 6px (14 × 1.2⁻⁵ ≈ 5.63 → 6)
+ '--font-size-3xs': '0.4375rem', // step -4: 7px (14 × 1.2⁻⁴ ≈ 6.75 → 7)
+ '--font-size-2xs': '0.5rem', // step -3: 8px (14 × 1.2⁻³ ≈ 8.10 → 8)
+ '--font-size-xs': '0.625rem', // step -2: 10px (14 × 1.2⁻² ≈ 9.72 → 10)
+ '--font-size-sm': '0.75rem', // step -1: 12px (14 × 1.2⁻¹ ≈ 11.67 → 12)
+ '--font-size-base': '0.875rem', // step 0: 14px — base anchor
+ '--font-size-lg': '1.0625rem', // step +1: 17px (14 × 1.2¹ ≈ 16.8 → 17)
+ '--font-size-xl': '1.25rem', // step +2: 20px (14 × 1.2² ≈ 20.16 → 20)
+ '--font-size-2xl': '1.5rem', // step +3: 24px (14 × 1.2³ ≈ 24.19 → 24)
+ '--font-size-3xl': '1.8125rem', // step +4: 29px (14 × 1.2⁴ ≈ 29.03 → 29)
+ '--font-size-4xl': '2.1875rem', // step +5: 35px (14 × 1.2⁵ ≈ 34.84 → 35)
+ '--font-size-5xl': '2.625rem', // step +6: 42px (14 × 1.2⁶ ≈ 41.80 → 42)
} as const;
/** @deprecated Use textSizeDefaults */
@@ -320,23 +324,6 @@ export const textSizeRaw = textSizeDefaults;
export const textSizeVars = stylex.defineVars(textSizeDefaults);
-// =============================================================================
-// Typography Tokens - Line Heights
-// =============================================================================
-
-export const lineHeightDefaults = {
- '--leading-tight': '1.25', // Display text, headings
- '--leading-snug': '1.375', // Compact body text, headings
- '--leading-base': '1.4285714285714286', // Body text with --text-base (20px line / 14px font)
- '--leading-normal': '1.5', // Body text, large body
- '--leading-relaxed': '1.625', // Editorial body, reading text
-} as const;
-
-/** @deprecated Use lineHeightDefaults */
-export const lineHeightRaw = lineHeightDefaults;
-
-export const lineHeightVars = stylex.defineVars(lineHeightDefaults);
-
// =============================================================================
// Typography Tokens - Font Weights
// =============================================================================
@@ -366,7 +353,6 @@ export type ShadowVarName = keyof typeof shadowDefaults;
export type TransitionVarName = keyof typeof transitionDefaults;
export type TypographyVarName = keyof typeof typographyDefaults;
export type TextSizeVarName = keyof typeof textSizeDefaults;
-export type LineHeightVarName = keyof typeof lineHeightDefaults;
export type FontWeightVarName = keyof typeof fontWeightDefaults;
// =============================================================================
@@ -391,39 +377,39 @@ export const typeScaleDefaults = {
// Step mapping: h6=-2, h5=-1, h4=0(base), h3=+1, h2=+2, h1=+3
//
// Heading tokens
- '--heading-1-size': 'var(--text-2xl)', // step +3: 24px
- '--heading-1-weight': 'var(--font-weight-semibold)',
- '--heading-1-leading': '1.3333', // 24px → 32px (target 1.4, 4px snap)
- '--heading-2-size': 'var(--text-xl)', // step +2: 20px
- '--heading-2-weight': 'var(--font-weight-semibold)',
- '--heading-2-leading': '1.4', // 20px → 28px (target 1.4, 4px snap)
- '--heading-3-size': 'var(--text-lg)', // step +1: 17px
- '--heading-3-weight': 'var(--font-weight-semibold)',
- '--heading-3-leading': '1.4118', // 17px → 24px (target 1.5, 4px snap)
- '--heading-4-size': 'var(--text-base)', // step 0: 14px — base anchor
- '--heading-4-weight': 'var(--font-weight-semibold)',
- '--heading-4-leading': '1.4286', // 14px → 20px (target 1.5, 4px snap)
- '--heading-5-size': 'var(--text-sm)', // step -1: 12px
- '--heading-5-weight': 'var(--font-weight-semibold)',
- '--heading-5-leading': '1.6667', // 12px → 20px (target 1.5, 4px snap)
- '--heading-6-size': 'var(--text-xsm)', // step -2: 10px
- '--heading-6-weight': 'var(--font-weight-semibold)',
- '--heading-6-leading': '1.6', // 10px → 16px (target 1.5, min dominated)
+ '--text-heading-1-size': 'var(--font-size-2xl)', // step +3: 24px
+ '--text-heading-1-weight': 'var(--font-weight-semibold)',
+ '--text-heading-1-leading': '1.3333', // 24px → 32px (target 1.4, 4px snap)
+ '--text-heading-2-size': 'var(--font-size-xl)', // step +2: 20px
+ '--text-heading-2-weight': 'var(--font-weight-semibold)',
+ '--text-heading-2-leading': '1.4', // 20px → 28px (target 1.4, 4px snap)
+ '--text-heading-3-size': 'var(--font-size-lg)', // step +1: 17px
+ '--text-heading-3-weight': 'var(--font-weight-semibold)',
+ '--text-heading-3-leading': '1.4118', // 17px → 24px (target 1.5, 4px snap)
+ '--text-heading-4-size': 'var(--font-size-base)', // step 0: 14px — base anchor
+ '--text-heading-4-weight': 'var(--font-weight-semibold)',
+ '--text-heading-4-leading': '1.4286', // 14px → 20px (target 1.5, 4px snap)
+ '--text-heading-5-size': 'var(--font-size-sm)', // step -1: 12px
+ '--text-heading-5-weight': 'var(--font-weight-semibold)',
+ '--text-heading-5-leading': '1.6667', // 12px → 20px (target 1.5, 4px snap)
+ '--text-heading-6-size': 'var(--font-size-xs)', // step -2: 10px
+ '--text-heading-6-weight': 'var(--font-weight-semibold)',
+ '--text-heading-6-leading': '1.6', // 10px → 16px (target 1.5, min dominated)
// Text tokens — body/label/code at base(0), large at +1, supporting at -1
- '--text-body-size': 'var(--text-base)', // 14px
+ '--text-body-size': 'var(--font-size-base)', // 14px
'--text-body-weight': 'var(--font-weight-normal)',
'--text-body-leading': '1.4286', // 14px → 20px
- '--text-large-size': 'var(--text-lg)', // 17px
+ '--text-large-size': 'var(--font-size-lg)', // 17px
'--text-large-weight': 'var(--font-weight-semibold)',
'--text-large-leading': '1.4118', // 17px → 24px
- '--text-label-size': 'var(--text-base)', // 14px
+ '--text-label-size': 'var(--font-size-base)', // 14px
'--text-label-weight': 'var(--font-weight-medium)',
'--text-label-leading': '1.4286', // 14px → 20px
- '--text-code-size': 'var(--text-base)', // 14px
+ '--text-code-size': 'var(--font-size-base)', // 14px
'--text-code-weight': 'var(--font-weight-normal)',
'--text-code-leading': '1.4286', // 14px → 20px
- '--text-supporting-size': 'var(--text-sm)', // 12px
+ '--text-supporting-size': 'var(--font-size-sm)', // 12px
'--text-supporting-weight': 'var(--font-weight-normal)',
'--text-supporting-leading': '1.6667', // 12px → 20px
@@ -431,13 +417,13 @@ export const typeScaleDefaults = {
// Display 1 = step +6 (largest, 42px), Display 3 = step +4 (29px, closest to h1).
// Line heights are tighter (~1.2) than headings (~1.3) since large text reads better tight.
// Font weight is normal (400) to balance the visual presence of large sizes.
- '--text-display-1-size': 'var(--text-5xl)', // 42px (14 × 1.2⁶, largest)
+ '--text-display-1-size': 'var(--font-size-5xl)', // 42px (14 × 1.2⁶, largest)
'--text-display-1-weight': 'var(--font-weight-normal)',
'--text-display-1-leading': '1.2381',
- '--text-display-2-size': 'var(--text-4xl)', // 35px (14 × 1.2⁵)
+ '--text-display-2-size': 'var(--font-size-4xl)', // 35px (14 × 1.2⁵)
'--text-display-2-weight': 'var(--font-weight-normal)',
'--text-display-2-leading': '1.2571',
- '--text-display-3-size': 'var(--text-3xl)', // 29px (14 × 1.2⁴, closest to h1)
+ '--text-display-3-size': 'var(--font-size-3xl)', // 29px (14 × 1.2⁴, closest to h1)
'--text-display-3-weight': 'var(--font-weight-normal)',
'--text-display-3-leading': '1.2414',
} as const;
diff --git a/packages/lab/src/CodeBlock/XDSCodeBlock.tsx b/packages/lab/src/CodeBlock/XDSCodeBlock.tsx
index 6d3f3323eb..7dc5744dad 100644
--- a/packages/lab/src/CodeBlock/XDSCodeBlock.tsx
+++ b/packages/lab/src/CodeBlock/XDSCodeBlock.tsx
@@ -29,7 +29,8 @@ import {
textSizeVars,
typographyVars,
fontWeightVars,
- lineHeightVars,
+ typeScaleVars,
+ borderVars,
} from '@xds/core/theme/tokens.stylex';
import {xdsClassName, mergeProps} from '@xds/core/utils';
import {tokenize, tokenizeAsync, SYNC_TOKENIZE_THRESHOLD} from './tokenizer';
@@ -44,9 +45,9 @@ const styles = stylex.create({
root: {
position: 'relative',
margin: 0,
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-muted'],
- border: `1px solid ${colorVars['--color-border']}`,
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-background-muted'],
+ border: `${borderVars['--border-width']} solid ${colorVars['--color-border']}`,
overflow: 'hidden',
},
header: {
@@ -55,16 +56,16 @@ const styles = stylex.create({
justifyContent: 'space-between',
paddingBlock: spacingVars['--spacing-2'],
paddingInline: spacingVars['--spacing-4'],
- borderBottom: `1px solid ${colorVars['--color-border']}`,
- backgroundColor: colorVars['--color-surface'],
+ borderBottom: `${borderVars['--border-width']} solid ${colorVars['--color-border']}`,
+ backgroundColor: colorVars['--color-background-surface'],
},
headerTitle: {
- fontSize: textSizeVars['--text-sm'],
- fontFamily: typographyVars['--font-code'],
+ fontSize: textSizeVars['--font-size-sm'],
+ fontFamily: typographyVars['--font-family-code'],
fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-secondary'],
margin: 0,
- lineHeight: lineHeightVars['--leading-snug'],
+ lineHeight: typeScaleVars['--text-supporting-leading'],
},
scrollContainer: {
overflowX: 'auto',
@@ -82,11 +83,11 @@ const styles = stylex.create({
textAlign: 'end',
userSelect: 'none',
color: colorVars['--color-text-disabled'],
- borderRight: `1px solid ${colorVars['--color-border']}`,
+ borderRight: `${borderVars['--border-width']} solid ${colorVars['--color-border']}`,
},
gutterLine: {
- fontFamily: typographyVars['--font-code'],
- lineHeight: lineHeightVars['--leading-normal'],
+ fontFamily: typographyVars['--font-family-code'],
+ lineHeight: typeScaleVars['--text-code-leading'],
},
code: {
display: 'block',
@@ -94,7 +95,7 @@ const styles = stylex.create({
paddingBlock: spacingVars['--spacing-3'],
paddingInline: spacingVars['--spacing-4'],
margin: 0,
- fontFamily: typographyVars['--font-code'],
+ fontFamily: typographyVars['--font-family-code'],
color: colorVars['--color-text-primary'],
tabSize: 2,
whiteSpace: 'pre',
@@ -107,7 +108,7 @@ const styles = stylex.create({
overflowWrap: 'break-word',
},
line: {
- lineHeight: lineHeightVars['--leading-normal'],
+ lineHeight: typeScaleVars['--text-code-leading'],
contentVisibility: 'auto',
containIntrinsicBlockSize: 'auto 1lh',
},
@@ -118,16 +119,16 @@ const styles = stylex.create({
borderLeft: `2px solid ${colorVars['--color-accent']}`,
},
sizeSm: {
- fontSize: textSizeVars['--text-sm'],
+ fontSize: textSizeVars['--font-size-sm'],
},
sizeMd: {
- fontSize: textSizeVars['--text-base'],
+ fontSize: textSizeVars['--font-size-base'],
},
gutterSm: {
- fontSize: textSizeVars['--text-sm'],
+ fontSize: textSizeVars['--font-size-sm'],
},
gutterMd: {
- fontSize: textSizeVars['--text-base'],
+ fontSize: textSizeVars['--font-size-base'],
},
copyButton: {
display: 'inline-flex',
@@ -135,12 +136,12 @@ const styles = stylex.create({
justifyContent: 'center',
padding: spacingVars['--spacing-1'],
border: 'none',
- borderRadius: radiusVars['--radius-1'],
+ borderRadius: radiusVars['--radius-inner'],
backgroundColor: 'transparent',
color: colorVars['--color-text-secondary'],
cursor: 'pointer',
- fontFamily: typographyVars['--font-code'],
- fontSize: textSizeVars['--text-sm'],
+ fontFamily: typographyVars['--font-family-code'],
+ fontSize: textSizeVars['--font-size-sm'],
lineHeight: '1',
transition: 'background-color 0.15s ease, color 0.15s ease',
},
diff --git a/packages/lab/src/CodeEditor/XDSCodeEditor.tsx b/packages/lab/src/CodeEditor/XDSCodeEditor.tsx
index 950e20d57b..47c8c80456 100644
--- a/packages/lab/src/CodeEditor/XDSCodeEditor.tsx
+++ b/packages/lab/src/CodeEditor/XDSCodeEditor.tsx
@@ -28,7 +28,8 @@ import {
radiusVars,
textSizeVars,
typographyVars,
- lineHeightVars,
+ typeScaleVars,
+ borderVars,
} from '@xds/core/theme/tokens.stylex';
import {xdsClassName, mergeProps} from '@xds/core/utils';
import {
@@ -47,14 +48,14 @@ const styles = stylex.create({
root: {
position: 'relative',
display: 'flex',
- borderRadius: radiusVars['--radius-2'],
- backgroundColor: colorVars['--color-muted'],
- border: `1px solid ${colorVars['--color-border']}`,
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-background-muted'],
+ border: `${borderVars['--border-width']} solid ${colorVars['--color-border']}`,
overflow: 'hidden',
},
rootFocused: {
- borderColor: colorVars['--color-ring-focus'],
- boxShadow: `0 0 0 1px ${colorVars['--color-ring-focus']}`,
+ borderColor: colorVars['--color-accent'],
+ boxShadow: `0 0 0 1px ${colorVars['--color-accent']}`,
},
gutter: {
flexShrink: 0,
@@ -64,11 +65,11 @@ const styles = stylex.create({
textAlign: 'end',
userSelect: 'none',
color: colorVars['--color-text-disabled'],
- borderRight: `1px solid ${colorVars['--color-border']}`,
+ borderRight: `${borderVars['--border-width']} solid ${colorVars['--color-border']}`,
},
gutterLine: {
- fontFamily: typographyVars['--font-code'],
- lineHeight: lineHeightVars['--leading-normal'],
+ fontFamily: typographyVars['--font-family-code'],
+ lineHeight: typeScaleVars['--text-code-leading'],
},
editorContainer: {
flex: 1,
@@ -80,7 +81,7 @@ const styles = stylex.create({
paddingBlock: spacingVars['--spacing-3'],
paddingInline: spacingVars['--spacing-4'],
margin: 0,
- fontFamily: typographyVars['--font-code'],
+ fontFamily: typographyVars['--font-family-code'],
color: colorVars['--color-text-primary'],
tabSize: 2,
whiteSpace: 'pre',
@@ -88,29 +89,29 @@ const styles = stylex.create({
overflowWrap: 'normal',
outline: 'none',
caretColor: colorVars['--color-text-primary'],
- lineHeight: lineHeightVars['--leading-normal'],
+ lineHeight: typeScaleVars['--text-code-leading'],
},
placeholder: {
position: 'absolute',
top: spacingVars['--spacing-3'],
left: spacingVars['--spacing-4'],
color: colorVars['--color-text-disabled'],
- fontFamily: typographyVars['--font-code'],
- lineHeight: lineHeightVars['--leading-normal'],
+ fontFamily: typographyVars['--font-family-code'],
+ lineHeight: typeScaleVars['--text-code-leading'],
pointerEvents: 'none',
userSelect: 'none',
},
sizeSm: {
- fontSize: textSizeVars['--text-sm'],
+ fontSize: textSizeVars['--font-size-sm'],
},
sizeMd: {
- fontSize: textSizeVars['--text-base'],
+ fontSize: textSizeVars['--font-size-base'],
},
gutterSm: {
- fontSize: textSizeVars['--text-sm'],
+ fontSize: textSizeVars['--font-size-sm'],
},
gutterMd: {
- fontSize: textSizeVars['--text-base'],
+ fontSize: textSizeVars['--font-size-base'],
},
});
diff --git a/packages/lab/src/CommandPalette/XDSCommandPaletteFooter.tsx b/packages/lab/src/CommandPalette/XDSCommandPaletteFooter.tsx
index aa32eff30d..2c5967a162 100644
--- a/packages/lab/src/CommandPalette/XDSCommandPaletteFooter.tsx
+++ b/packages/lab/src/CommandPalette/XDSCommandPaletteFooter.tsx
@@ -34,8 +34,8 @@ const styles = stylex.create({
display: 'flex',
alignItems: 'center',
gap: spacingVars['--spacing-1'],
- fontFamily: typographyVars['--font-body'],
- fontSize: textSizeVars['--text-xsm'],
+ fontFamily: typographyVars['--font-family-body'],
+ fontSize: textSizeVars['--font-size-xs'],
color: colorVars['--color-text-secondary'],
},
});
diff --git a/packages/lab/src/CommandPalette/XDSCommandPaletteGroup.tsx b/packages/lab/src/CommandPalette/XDSCommandPaletteGroup.tsx
index 327b8b62af..5dc6595490 100644
--- a/packages/lab/src/CommandPalette/XDSCommandPaletteGroup.tsx
+++ b/packages/lab/src/CommandPalette/XDSCommandPaletteGroup.tsx
@@ -29,8 +29,8 @@ const styles = stylex.create({
heading: {
paddingInline: spacingVars['--spacing-3'],
paddingBlock: spacingVars['--spacing-1'],
- fontFamily: typographyVars['--font-body'],
- fontSize: textSizeVars['--text-xsm'],
+ fontFamily: typographyVars['--font-family-body'],
+ fontSize: textSizeVars['--font-size-xs'],
fontWeight: fontWeightVars['--font-weight-semibold'],
color: colorVars['--color-text-secondary'],
textTransform: 'uppercase' as const,
diff --git a/packages/lab/src/CommandPalette/XDSCommandPaletteInput.tsx b/packages/lab/src/CommandPalette/XDSCommandPaletteInput.tsx
index e7a5d36c77..ef1b31975e 100644
--- a/packages/lab/src/CommandPalette/XDSCommandPaletteInput.tsx
+++ b/packages/lab/src/CommandPalette/XDSCommandPaletteInput.tsx
@@ -23,7 +23,7 @@ import * as stylex from '@stylexjs/stylex';
import {XDSIcon} from '@xds/core/Icon';
import {
colorVars,
- lineHeightVars,
+ typeScaleVars,
spacingVars,
typographyVars,
textSizeVars,
@@ -50,9 +50,9 @@ const styles = stylex.create({
outline: 'none',
backgroundColor: 'transparent',
color: colorVars['--color-text-primary'],
- fontFamily: typographyVars['--font-body'],
- fontSize: textSizeVars['--text-base'],
- lineHeight: lineHeightVars['--leading-normal'],
+ fontFamily: typographyVars['--font-family-body'],
+ fontSize: textSizeVars['--font-size-base'],
+ lineHeight: typeScaleVars['--text-body-leading'],
padding: 0,
'::placeholder': {
color: colorVars['--color-text-secondary'],
diff --git a/packages/lab/src/CommandPalette/XDSCommandPaletteItem.tsx b/packages/lab/src/CommandPalette/XDSCommandPaletteItem.tsx
index ca1630d30f..200885b7af 100644
--- a/packages/lab/src/CommandPalette/XDSCommandPaletteItem.tsx
+++ b/packages/lab/src/CommandPalette/XDSCommandPaletteItem.tsx
@@ -39,9 +39,9 @@ const styles = stylex.create({
width: '100%',
paddingInline: spacingVars['--spacing-3'],
paddingBlock: spacingVars['--spacing-2'],
- borderRadius: radiusVars['--radius-1'],
- fontFamily: typographyVars['--font-body'],
- fontSize: textSizeVars['--text-base'],
+ borderRadius: radiusVars['--radius-inner'],
+ fontFamily: typographyVars['--font-family-body'],
+ fontSize: textSizeVars['--font-size-base'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
border: 'none',
diff --git a/packages/themes/brutalist/src/index.ts b/packages/themes/brutalist/src/index.ts
index 03eb3a6022..c9a6dc3a11 100644
--- a/packages/themes/brutalist/src/index.ts
+++ b/packages/themes/brutalist/src/index.ts
@@ -29,12 +29,19 @@ export const brutalistTheme = defineTheme({
// Colors — high contrast, no subtlety
'--color-accent': ['#FF1493', '#FF69B4'],
'--color-accent-muted': ['#FF149333', '#FF69B43F'],
- '--color-surface': ['#FFFFFF', '#000000'],
- '--color-wash': ['#F5F5F5', '#111111'],
- '--color-card': ['#FFFFFF', '#000000'],
+ '--color-background-surface': ['#FFFFFF', '#000000'],
+ '--color-background-body': ['#F5F5F5', '#111111'],
+ '--color-background-card': ['#FFFFFF', '#000000'],
+ // Contrast on hot pink accent — white in both modes
+ '--color-on-accent': ['#FFFFFF', '#FFFFFF'],
+ '--color-on-success': ['#FFFFFF', '#FFFFFF'],
+ '--color-on-error': ['#FFFFFF', '#FFFFFF'],
+ '--color-on-warning': ['#000000', '#000000'],
+ '--color-on-light': ['#000000', '#000000'],
+ '--color-on-dark': ['#FFFFFF', '#FFFFFF'],
// Even pills are sharp in brutalist
- '--radius-rounded': '0px',
+ '--radius-full': '0px',
},
components: {
// Custom banner status — danger
@@ -97,7 +104,7 @@ export const brutalistTheme = defineTheme({
// Code gets a background
text: {
'type:code': {
- backgroundColor: 'var(--color-wash)',
+ backgroundColor: 'var(--color-background-body)',
padding: '2px 4px',
},
},
diff --git a/packages/themes/default/src/defaultTheme.ts b/packages/themes/default/src/defaultTheme.ts
index 3855d6bc4e..465cc7d8bc 100644
--- a/packages/themes/default/src/defaultTheme.ts
+++ b/packages/themes/default/src/defaultTheme.ts
@@ -5,7 +5,7 @@
* Uses defineTheme for CSS-based theming (no StyleX build required for consumers).
*
* Typography sizing is driven by typography.scale, which auto-generates both
- * the token values (--heading-1-size, --text-body-size, etc.) and the
+ * the token values (--text-heading-1-size, --text-body-size, etc.) and the
* component override rules (.xds-heading.level-1 { font-size: ... }).
*
* Only non-typography component overrides need to be specified manually.
diff --git a/packages/themes/neutral/src/neutralTheme.ts b/packages/themes/neutral/src/neutralTheme.ts
index dd05c5620c..55498c26dd 100644
--- a/packages/themes/neutral/src/neutralTheme.ts
+++ b/packages/themes/neutral/src/neutralTheme.ts
@@ -48,34 +48,36 @@ export const neutralTheme = defineTheme({
// Core semantic
'--color-accent': ['oklch(0.205 0 0)', 'oklch(0.922 0 0)'],
'--color-accent-muted': ['oklch(0.97 0 0)', 'oklch(0.269 0 0)'],
- '--color-secondary': ['oklch(0 0 0 / 6%)', 'oklch(1 0 0 / 10%)'],
- '--color-surface': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
- '--color-wash': ['oklch(0.97 0 0)', 'oklch(0.269 0 0)'],
+ '--color-neutral': ['oklch(0 0 0 / 6%)', 'oklch(1 0 0 / 10%)'],
+ '--color-background-surface': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
+ '--color-background-body': ['oklch(0.97 0 0)', 'oklch(0.269 0 0)'],
'--color-overlay': ['oklch(0 0 0 / 50%)', 'oklch(0 0 0 / 80%)'],
'--color-overlay-hover': ['oklch(0 0 0 / 5%)', 'oklch(1 0 0 / 5%)'],
'--color-overlay-pressed': ['oklch(0 0 0 / 10%)', 'oklch(1 0 0 / 10%)'],
- '--color-ring-focus': ['oklch(0.708 0 0)', 'oklch(0.556 0 0)'],
- '--color-ring-focus-error': ['#E3193B', '#F5394F'],
- '--color-ring-focus-success': ['#0D8626', '#0D8626'],
- '--color-ring-focus-warning': ['#F2C00B', '#E9AF08'],
- '--color-muted': ['oklch(0.97 0 0)', 'oklch(0.269 0 0)'],
+ '--color-background-muted': ['oklch(0.97 0 0)', 'oklch(0.269 0 0)'],
// Text
'--color-text-primary': ['oklch(0.145 0 0)', 'oklch(0.985 0 0)'],
'--color-text-secondary': ['oklch(0.556 0 0)', 'oklch(0.708 0 0)'],
'--color-text-disabled': ['oklch(0.708 0 0)', 'oklch(0.439 0 0)'],
- '--color-text-link': ['oklch(0.205 0 0)', 'oklch(0.922 0 0)'],
- '--color-text-on-dark-media': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
+ '--color-text-accent': ['oklch(0.205 0 0)', 'oklch(0.922 0 0)'],
+ '--color-on-dark': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
+ '--color-on-light': ['oklch(0.145 0 0)', 'oklch(0.145 0 0)'],
+ // Contrast: neutral accent is near-black (L) / near-white (D)
+ '--color-on-accent': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
+ '--color-on-success': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
+ '--color-on-error': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
+ '--color-on-warning': ['oklch(0.145 0 0)', 'oklch(0.145 0 0)'],
// Icon
+ '--color-icon-accent': ['oklch(0.205 0 0)', 'oklch(0.922 0 0)'],
'--color-icon-primary': ['oklch(0.145 0 0)', 'oklch(0.985 0 0)'],
'--color-icon-secondary': ['oklch(0.556 0 0)', 'oklch(0.708 0 0)'],
'--color-icon-disabled': ['oklch(0.708 0 0)', 'oklch(0.439 0 0)'],
- '--color-icon-on-dark-media': ['oklch(1 0 0)', 'oklch(0.145 0 0)'],
// Surface variants
- '--color-card': ['oklch(1 0 0)', 'oklch(0.205 0 0)'],
- '--color-popover': ['oklch(1 0 0)', 'oklch(0.269 0 0)'],
+ '--color-background-card': ['oklch(1 0 0)', 'oklch(0.205 0 0)'],
+ '--color-background-popover': ['oklch(1 0 0)', 'oklch(0.269 0 0)'],
// Status/Sentiment
'--color-success': ['oklch(0.6 0.15 145)', 'oklch(0.7 0.15 145)'],
@@ -96,196 +98,184 @@ export const neutralTheme = defineTheme({
'oklch(0.828 0.189 84.429 / 20%)',
'oklch(0.769 0.188 70.08 / 20%)',
],
- '--color-info': ['oklch(0.488 0.243 264.376)', 'oklch(0.627 0.265 303.9)'],
- '--color-info-muted': [
- 'oklch(0.488 0.243 264.376 / 20%)',
- 'oklch(0.627 0.265 303.9 / 20%)',
- ],
// Border
'--color-border': ['oklch(0.922 0 0)', 'oklch(1 0 0 / 10%)'],
- '--color-border-strong': ['oklch(0.708 0 0)', 'oklch(0.556 0 0)'],
'--color-border-emphasized': ['oklch(0.85 0 0)', 'oklch(0.371 0 0)'],
// Effects
'--color-skeleton': ['oklch(0.922 0 0)', 'oklch(0.371 0 0)'],
'--color-shadow': ['oklch(0 0 0 / 10%)', 'oklch(0 0 0 / 30%)'],
- '--color-hover-tint': ['black', 'white'],
+ '--color-tint-hover': ['black', 'white'],
// Blue
- '--color-blue-background': [
+ '--color-background-blue': [
'oklch(0.488 0.243 264.376 / 20%)',
'oklch(0.488 0.243 264.376 / 20%)',
],
- '--color-blue-border': [
+ '--color-border-blue': [
'oklch(0.488 0.243 264.376)',
'oklch(0.488 0.243 264.376)',
],
- '--color-blue-icon': [
+ '--color-icon-blue': [
'oklch(0.488 0.243 264.376)',
'oklch(0.488 0.243 264.376)',
],
- '--color-blue-text': ['oklch(0.398 0.2 264)', 'oklch(0.7 0.2 264)'],
+ '--color-text-blue': ['oklch(0.398 0.2 264)', 'oklch(0.7 0.2 264)'],
// Cyan
- '--color-cyan-background': [
+ '--color-background-cyan': [
'oklch(0.6 0.118 184.704 / 20%)',
'oklch(0.696 0.17 162.48 / 20%)',
],
- '--color-cyan-border': [
+ '--color-border-cyan': [
'oklch(0.6 0.118 184.704)',
'oklch(0.696 0.17 162.48)',
],
- '--color-cyan-icon': [
+ '--color-icon-cyan': [
'oklch(0.6 0.118 184.704)',
'oklch(0.696 0.17 162.48)',
],
- '--color-cyan-text': ['oklch(0.398 0.07 184)', 'oklch(0.8 0.1 162)'],
+ '--color-text-cyan': ['oklch(0.398 0.07 184)', 'oklch(0.8 0.1 162)'],
// Gray
- '--color-gray-background': [
+ '--color-background-gray': [
'oklch(0.922 0 0 / 50%)',
'oklch(0.371 0 0 / 50%)',
],
- '--color-gray-border': ['oklch(0.708 0 0)', 'oklch(0.556 0 0)'],
- '--color-gray-icon': ['oklch(0.556 0 0)', 'oklch(0.708 0 0)'],
- '--color-gray-text': ['oklch(0.145 0 0)', 'oklch(0.985 0 0)'],
+ '--color-border-gray': ['oklch(0.708 0 0)', 'oklch(0.556 0 0)'],
+ '--color-icon-gray': ['oklch(0.556 0 0)', 'oklch(0.708 0 0)'],
+ '--color-text-gray': ['oklch(0.145 0 0)', 'oklch(0.985 0 0)'],
// Green
- '--color-green-background': [
+ '--color-background-green': [
'oklch(0.6 0.118 184.704 / 20%)',
'oklch(0.696 0.17 162.48 / 20%)',
],
- '--color-green-border': [
+ '--color-border-green': [
'oklch(0.6 0.118 184.704)',
'oklch(0.696 0.17 162.48)',
],
- '--color-green-icon': [
+ '--color-icon-green': [
'oklch(0.6 0.118 184.704)',
'oklch(0.696 0.17 162.48)',
],
- '--color-green-text': ['oklch(0.398 0.07 184)', 'oklch(0.8 0.1 162)'],
+ '--color-text-green': ['oklch(0.398 0.07 184)', 'oklch(0.8 0.1 162)'],
// Orange
- '--color-orange-background': [
+ '--color-background-orange': [
'oklch(0.646 0.222 41.116 / 20%)',
'oklch(0.645 0.246 16.439 / 20%)',
],
- '--color-orange-border': [
+ '--color-border-orange': [
'oklch(0.646 0.222 41.116)',
'oklch(0.645 0.246 16.439)',
],
- '--color-orange-icon': [
+ '--color-icon-orange': [
'oklch(0.646 0.222 41.116)',
'oklch(0.645 0.246 16.439)',
],
- '--color-orange-text': ['oklch(0.5 0.18 41)', 'oklch(0.8 0.2 16)'],
+ '--color-text-orange': ['oklch(0.5 0.18 41)', 'oklch(0.8 0.2 16)'],
// Pink
- '--color-pink-background': [
+ '--color-background-pink': [
'oklch(0.627 0.265 303.9 / 20%)',
'oklch(0.627 0.265 303.9 / 20%)',
],
- '--color-pink-border': [
+ '--color-border-pink': [
'oklch(0.627 0.265 303.9)',
'oklch(0.627 0.265 303.9)',
],
- '--color-pink-icon': [
+ '--color-icon-pink': [
'oklch(0.627 0.265 303.9)',
'oklch(0.627 0.265 303.9)',
],
- '--color-pink-text': ['oklch(0.5 0.2 303)', 'oklch(0.8 0.2 303)'],
+ '--color-text-pink': ['oklch(0.5 0.2 303)', 'oklch(0.8 0.2 303)'],
// Purple
- '--color-purple-background': [
+ '--color-background-purple': [
'oklch(0.627 0.265 303.9 / 20%)',
'oklch(0.627 0.265 303.9 / 20%)',
],
- '--color-purple-border': [
+ '--color-border-purple': [
'oklch(0.627 0.265 303.9)',
'oklch(0.627 0.265 303.9)',
],
- '--color-purple-icon': [
+ '--color-icon-purple': [
'oklch(0.627 0.265 303.9)',
'oklch(0.627 0.265 303.9)',
],
- '--color-purple-text': ['oklch(0.5 0.2 303)', 'oklch(0.8 0.2 303)'],
+ '--color-text-purple': ['oklch(0.5 0.2 303)', 'oklch(0.8 0.2 303)'],
// Red
- '--color-red-background': [
+ '--color-background-red': [
'oklch(0.577 0.245 27.325 / 20%)',
'oklch(0.704 0.191 22.216 / 20%)',
],
- '--color-red-border': [
+ '--color-border-red': [
'oklch(0.577 0.245 27.325)',
'oklch(0.704 0.191 22.216)',
],
- '--color-red-icon': [
+ '--color-icon-red': [
'oklch(0.577 0.245 27.325)',
'oklch(0.704 0.191 22.216)',
],
- '--color-red-text': ['oklch(0.45 0.2 27)', 'oklch(0.85 0.15 22)'],
+ '--color-text-red': ['oklch(0.45 0.2 27)', 'oklch(0.85 0.15 22)'],
// Teal
- '--color-teal-background': [
+ '--color-background-teal': [
'oklch(0.6 0.118 184.704 / 20%)',
'oklch(0.696 0.17 162.48 / 20%)',
],
- '--color-teal-border': [
+ '--color-border-teal': [
'oklch(0.6 0.118 184.704)',
'oklch(0.696 0.17 162.48)',
],
- '--color-teal-icon': [
+ '--color-icon-teal': [
'oklch(0.6 0.118 184.704)',
'oklch(0.696 0.17 162.48)',
],
- '--color-teal-text': ['oklch(0.398 0.07 184)', 'oklch(0.8 0.1 162)'],
+ '--color-text-teal': ['oklch(0.398 0.07 184)', 'oklch(0.8 0.1 162)'],
// Yellow
- '--color-yellow-background': [
+ '--color-background-yellow': [
'oklch(0.828 0.189 84.429 / 20%)',
'oklch(0.769 0.188 70.08 / 20%)',
],
- '--color-yellow-border': [
+ '--color-border-yellow': [
'oklch(0.828 0.189 84.429)',
'oklch(0.769 0.188 70.08)',
],
- '--color-yellow-icon': [
+ '--color-icon-yellow': [
'oklch(0.828 0.189 84.429)',
'oklch(0.769 0.188 70.08)',
],
- '--color-yellow-text': ['oklch(0.6 0.15 84)', 'oklch(0.9 0.15 70)'],
+ '--color-text-yellow': ['oklch(0.6 0.15 84)', 'oklch(0.9 0.15 70)'],
// =========================================================================
// Radius — slightly larger than default
// =========================================================================
- '--radius-0': '0.25rem',
- '--radius-1': '0.375rem',
- '--radius-2': '0.625rem',
- '--radius-3': '0.75rem',
- '--radius-rounded': '9999px',
+ '--radius-none': '0.25rem',
+ '--radius-inner': '0.375rem',
+ '--radius-element': '0.625rem',
+ '--radius-container': '0.75rem',
+ '--radius-page': '1.75rem',
+ '--radius-full': '9999px',
// =========================================================================
// Shadows — oklch-based
// =========================================================================
- '--shadow-base':
- '0 1px 2px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 20%))',
- '--shadow-menu':
+ '--shadow-low':
'0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 15%)), 0 4px 8px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 20%))',
- '--shadow-hover':
+ '--shadow-med':
'0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 15%)), 0 4px 12px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 20%))',
- '--shadow-dialog':
+ '--shadow-high':
'0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 25%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 35%))',
- '--inset-shadow-border-hover':
- 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.3)',
- '--inset-shadow-border-accent':
- 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.5)',
- '--inset-shadow-border-positive':
- 'inset 0px 0px 0px 2px rgba(38, 167, 86, 0.3)',
- '--inset-shadow-border-warning':
- 'inset 0px 0px 0px 2px rgba(226, 164, 0, 0.3)',
- '--inset-shadow-border-negative':
- 'inset 0px 0px 0px 2px rgba(227, 25, 59, 0.3)',
+ '--shadow-inset-hover': 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.3)',
+ '--shadow-inset-selected': 'inset 0px 0px 0px 2px rgba(1, 113, 227, 0.5)',
+ '--shadow-inset-success': 'inset 0px 0px 0px 2px rgba(38, 167, 86, 0.3)',
+ '--shadow-inset-warning': 'inset 0px 0px 0px 2px rgba(226, 164, 0, 0.3)',
+ '--shadow-inset-error': 'inset 0px 0px 0px 2px rgba(227, 25, 59, 0.3)',
},
components: {
@@ -293,9 +283,6 @@ export const neutralTheme = defineTheme({
// Button — primary gets white text, secondary gets a border
// =========================================================================
button: {
- 'variant:primary': {
- color: 'light-dark(white, oklch(0.145 0 0))',
- },
'variant:secondary': {
borderWidth: '1px',
borderStyle: 'solid',