Skip to content

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

TypeScript

Fix lint errors and warnings, add --leading-base token (#79)

Cindy Zhange613eec6e665
diff --git a/apps/storybook/.storybook/main.ts b/apps/storybook/.storybook/main.ts
index 964bb170b0..8e49fa459c 100644
--- a/apps/storybook/.storybook/main.ts
+++ b/apps/storybook/.storybook/main.ts
@@ -1,12 +1,7 @@
-import type { StorybookConfig } from '@storybook/react-vite';
-import { join, dirname } from 'path';
+import type {StorybookConfig} from '@storybook/react-vite';
import stylex from '@stylexjs/unplugin';
import path from 'path';
-function getAbsolutePath(value: string): string {
- return dirname(require.resolve(join(value, 'package.json')));
-}
-
const rootDir = path.resolve(__dirname, '../../..');
const coreRoot = path.resolve(__dirname, '../../../packages/core/src');
@@ -27,11 +22,19 @@ const config: StorybookConfig = {
docs: {
autodocs: 'tag',
},
- viteFinal: async (config) => {
+ viteFinal: async config => {
// Filter out any existing StyleX plugins to avoid conflicts
- const filteredPlugins = config.plugins?.filter(
- (plugin: any) => !(plugin?.name?.includes?.('stylex'))
- ) || [];
+ const filteredPlugins =
+ config.plugins?.filter(
+ plugin =>
+ !(
+ plugin &&
+ typeof plugin === 'object' &&
+ 'name' in plugin &&
+ typeof plugin.name === 'string' &&
+ plugin.name.includes('stylex')
+ ),
+ ) || [];
return {
...config,
diff --git a/apps/storybook/stories/TextArea.stories.tsx b/apps/storybook/stories/TextArea.stories.tsx
index e9384e9c58..7828e25e83 100644
--- a/apps/storybook/stories/TextArea.stories.tsx
+++ b/apps/storybook/stories/TextArea.stories.tsx
@@ -1,6 +1,6 @@
import {useState} from 'react';
import type {Meta, StoryObj} from '@storybook/react';
-import {XDSTextArea, type XDSTextAreaStatus} from '@xds/core/TextArea';
+import {XDSTextArea} from '@xds/core/TextArea';
import {
DocumentTextIcon,
ChatBubbleLeftIcon,
@@ -115,7 +115,7 @@ export const WithValue: Story = {
render: args => {
const [value, setValue] = useState(
args.value ??
- 'This is a pre-filled textarea with some content that demonstrates how the component handles existing text.'
+ 'This is a pre-filled textarea with some content that demonstrates how the component handles existing text.',
);
return <XDSTextArea {...args} value={value} onChange={setValue} />;
},
@@ -258,7 +258,7 @@ export const DescriptionWithOptional: Story = {
export const Disabled: Story = {
render: args => {
const [value, setValue] = useState(
- args.value ?? 'This textarea is disabled and cannot be edited.'
+ args.value ?? 'This textarea is disabled and cannot be edited.',
);
return <XDSTextArea {...args} value={value} onChange={setValue} />;
},
@@ -338,7 +338,7 @@ export const ErrorStatus: Story = {
export const WarningStatus: Story = {
render: args => {
const [value, setValue] = useState(
- args.value ?? 'This content may contain issues'
+ args.value ?? 'This content may contain issues',
);
return <XDSTextArea {...args} value={value} onChange={setValue} />;
},
@@ -355,7 +355,7 @@ export const WarningStatus: Story = {
export const SuccessStatus: Story = {
render: args => {
const [value, setValue] = useState(
- args.value ?? 'This is a valid description that meets all requirements.'
+ args.value ?? 'This is a valid description that meets all requirements.',
);
return <XDSTextArea {...args} value={value} onChange={setValue} />;
},
@@ -383,7 +383,7 @@ export const StatusVariations: Story = {
const [error, setError] = useState('Too short');
const [warning, setWarning] = useState('This may need review');
const [success, setSuccess] = useState(
- 'This description meets all the requirements perfectly.'
+ 'This description meets all the requirements perfectly.',
);
const [errorNoMsg, setErrorNoMsg] = useState('Invalid');
return (
@@ -468,8 +468,8 @@ export const CombinedFeatures: Story = {
value.length > 0 && value.length < 20
? {type: 'warning', message: 'Consider adding more detail'}
: value.length >= 20
- ? {type: 'success', message: 'Description looks good!'}
- : undefined
+ ? {type: 'success', message: 'Description looks good!'}
+ : undefined
}
/>
</div>
@@ -493,7 +493,7 @@ export const MaxLengthWithValue: Story = {
render: args => {
const [value, setValue] = useState(
args.value ??
- 'This is a pre-filled bio that demonstrates the character counter.'
+ 'This is a pre-filled bio that demonstrates the character counter.',
);
return <XDSTextArea {...args} value={value} onChange={setValue} />;
},
@@ -508,7 +508,7 @@ export const MaxLengthVariations: Story = {
const [short, setShort] = useState('');
const [medium, setMedium] = useState('Some text here');
const [long, setLong] = useState(
- 'This is a longer text that approaches the maximum length limit.'
+ 'This is a longer text that approaches the maximum length limit.',
);
return (
<div
diff --git a/apps/storybook/stories/TextInput.stories.tsx b/apps/storybook/stories/TextInput.stories.tsx
index 82be000319..4e8036cd19 100644
--- a/apps/storybook/stories/TextInput.stories.tsx
+++ b/apps/storybook/stories/TextInput.stories.tsx
@@ -1,6 +1,6 @@
import {useState} from 'react';
import type {Meta, StoryObj} from '@storybook/react';
-import {XDSTextInput, type XDSTextInputStatus} from '@xds/core/TextInput';
+import {XDSTextInput} from '@xds/core/TextInput';
import {
MagnifyingGlassIcon,
EnvelopeIcon,
diff --git a/eslint.config.js b/eslint.config.js
index e07eb056e0..fce660a233 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -2,6 +2,8 @@ import js from "@eslint/js";
import tseslint from "typescript-eslint";
import xdsPlugin from "./internal/eslint-plugin-xds/index.js";
+/* global process */
+
/**
* XDS ESLint Configuration
*
@@ -22,7 +24,15 @@ export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
{
- ignores: ["**/dist/**", "**/node_modules/**", "**/internal/eslint-plugin-xds/**"],
+ ignores: [
+ "**/dist/**",
+ "**/node_modules/**",
+ "**/internal/eslint-plugin-xds/**",
+ ".github/scripts/**",
+ "scripts/**",
+ "**/*.mjs",
+ "**/*.test-violations.tsx",
+ ],
},
{
files: ["**/*.{ts,tsx}"],
@@ -34,12 +44,18 @@ export default tseslint.config(
},
},
rules: {
- "@typescript-eslint/no-unused-vars": "warn",
+ "@typescript-eslint/no-unused-vars": ["warn", {
+ argsIgnorePattern: "^_",
+ varsIgnorePattern: "^_",
+ destructuredArrayIgnorePattern: "^_",
+ caughtErrorsIgnorePattern: "^_",
+ }],
},
},
- // XDS design token enforcement - applies to core package
+ // XDS design token enforcement - applies to core package (excluding theme files)
{
files: ["packages/core/src/**/*.{ts,tsx}"],
+ ignores: ["packages/core/src/theme/**"],
...xdsConfig,
},
);
diff --git a/internal/vibe-tests/src/aggregate.ts b/internal/vibe-tests/src/aggregate.ts
index 359f7b4e14..134e49dac5 100644
--- a/internal/vibe-tests/src/aggregate.ts
+++ b/internal/vibe-tests/src/aggregate.ts
@@ -17,9 +17,8 @@ import type {
EscapeHatchType,
JobBreakdown,
InputTokenBreakdown,
- TokenUsageBreakdown,
} from './types.js';
-import {readJson, writeJson, getResultsDir} from './utils.js';
+import {writeJson, getResultsDir} from './utils.js';
/**
* Doc file sizes in characters (for input token estimation)
@@ -239,13 +238,6 @@ const ANTI_PATTERN_HATCHES: EscapeHatchType[] = [
'inline_style', // Should use StyleX instead
];
-/** Escape hatch types that indicate gaps in the component system */
-const GAP_HATCHES: EscapeHatchType[] = [
- 'supplemental_css',
- 'custom_animation',
- 'layout_workaround',
-];
-
interface TierCounts {
gold: number;
green: number;
@@ -1613,9 +1605,6 @@ function generateHtmlReport(
const totalSecs = agg.totalDurationMs
? (agg.totalDurationMs / 1000).toFixed(1)
: '-';
- const avgSecs = agg.avgDurationMs
- ? (agg.avgDurationMs / 1000).toFixed(1)
- : '-';
// Use tokenUsage.grandTotal (calculated from docs read + job breakdown) instead of raw totals
const totalTokens =
agg.tokenUsage?.grandTotal ?? agg.totalInputTokens + agg.totalOutputTokens;
diff --git a/internal/vibe-tests/src/cli.ts b/internal/vibe-tests/src/cli.ts
index fabc4e6bf9..48cfabe267 100755
--- a/internal/vibe-tests/src/cli.ts
+++ b/internal/vibe-tests/src/cli.ts
@@ -16,7 +16,6 @@ import {
readJsonl,
writeJson,
readJson,
- ensureDir,
getResultsDir,
} from './utils.js';
import type {TestResult} from './types.js';
diff --git a/internal/vibe-tests/src/interactive.ts b/internal/vibe-tests/src/interactive.ts
index 75577a3de2..a81ea780ae 100644
--- a/internal/vibe-tests/src/interactive.ts
+++ b/internal/vibe-tests/src/interactive.ts
@@ -14,13 +14,11 @@ import * as fs from 'node:fs';
import * as path from 'node:path';
import {execSync} from 'node:child_process';
import {fileURLToPath} from 'node:url';
-import type {TestPrompt, TestResult, Evaluation, EscapeHatch} from './types.js';
+import type {TestPrompt, Evaluation} from './types.js';
import {stratifiedSample} from './sampling.js';
import {
generateIterationId,
- hashContent,
ensureDir,
- appendJsonl,
writeJson,
readJson,
timestamp,
@@ -64,7 +62,7 @@ function installAgentsDocs(): void {
stdio: 'pipe',
});
console.log('✓ Generated AGENTS.md and .xds-docs/');
- } catch (error) {
+ } catch (_error) {
console.warn('⚠ Failed to generate AGENTS.md, continuing without it');
}
}
@@ -89,7 +87,7 @@ interface AgentTask {
/**
* Generate the agent prompt for a single test
*/
-function generateAgentPrompt(task: AgentTask): string {
+function _generateAgentPrompt(task: AgentTask): string {
const personaInstructions = {
naive: `You are testing as a NAIVE user who describes UIs in plain language without technical terms.
You don't know component names. Describe what you want visually.`,
@@ -165,7 +163,7 @@ Remember:
/**
* Parse agent output to extract evaluation
*/
-function parseAgentOutput(
+function _parseAgentOutput(
output: string,
): {response: string; evaluation: Evaluation} | null {
try {
diff --git a/packages/core/src/Avatar/XDSAvatar.tsx b/packages/core/src/Avatar/XDSAvatar.tsx
index e5b1d7726b..b4ea067c4a 100644
--- a/packages/core/src/Avatar/XDSAvatar.tsx
+++ b/packages/core/src/Avatar/XDSAvatar.tsx
@@ -13,7 +13,11 @@
import {forwardRef, useState, type HTMLAttributes, type ReactNode} from 'react';
import * as stylex from '@stylexjs/stylex';
-import {colorVars, typographyVars} from '../theme/tokens.stylex';
+import {
+ colorVars,
+ typographyVars,
+ fontWeightVars,
+} from '../theme/tokens.stylex';
/**
* The offset ratio for positioning elements on a circle's edge at 45°.
@@ -122,7 +126,7 @@ const styles = stylex.create({
backgroundColor: colorVars['--color-deemphasized'],
color: colorVars['--color-text-secondary'],
fontFamily: typographyVars['--font-body'],
- fontWeight: 500,
+ fontWeight: fontWeightVars['--font-weight-medium'],
textTransform: 'uppercase',
},
status: {
diff --git a/packages/core/src/Button/XDSButton.tsx b/packages/core/src/Button/XDSButton.tsx
index cd86d2a340..d76873fdbd 100644
--- a/packages/core/src/Button/XDSButton.tsx
+++ b/packages/core/src/Button/XDSButton.tsx
@@ -23,6 +23,9 @@ import {
spacingVars,
radiusVars,
transitionVars,
+ textSizeVars,
+ fontWeightVars,
+ lineHeightVars,
} from '../theme/tokens.stylex';
import {ThemeContext} from '../theme/ThemeContext';
@@ -44,9 +47,9 @@ const styles = stylex.create({
borderStyle: 'none',
borderRadius: radiusVars['--radius-element'],
fontFamily: 'inherit',
- fontSize: '0.875rem',
- lineHeight: 1.429,
- fontWeight: 500,
+ fontSize: textSizeVars['--text-base'],
+ lineHeight: lineHeightVars['--leading-base'],
+ fontWeight: fontWeightVars['--font-weight-medium'],
cursor: 'pointer',
transitionProperty: 'background-image, transform',
transitionDuration: transitionVars['--transition-fast'],
diff --git a/packages/core/src/Calendar/styles.ts b/packages/core/src/Calendar/styles.ts
index 8c57322a9b..1ac38fa6fb 100644
--- a/packages/core/src/Calendar/styles.ts
+++ b/packages/core/src/Calendar/styles.ts
@@ -18,6 +18,7 @@ import {
radiusVars,
transitionVars,
textSizeVars,
+ fontWeightVars,
} from '../theme/tokens.stylex';
// =============================================================================
@@ -40,7 +41,7 @@ export const calendarStyles = stylex.create({
monthYearLabel: {
flex: 1,
textAlign: 'center',
- fontWeight: 600,
+ fontWeight: fontWeightVars['--font-weight-semibold'],
fontSize: textSizeVars['--text-base'],
color: colorVars['--color-text-primary'],
},
@@ -77,7 +78,7 @@ export const monthGridStyles = stylex.create({
alignItems: 'center',
justifyContent: 'center',
fontSize: textSizeVars['--text-xsm'],
- fontWeight: 400,
+ fontWeight: fontWeightVars['--font-weight-normal'],
color: colorVars['--color-text-secondary'],
},
weekNumberHeader: {
diff --git a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
index 8a32a06586..51a4a31ef2 100644
--- a/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
+++ b/packages/core/src/CheckboxInput/XDSCheckboxInput.tsx
@@ -19,6 +19,7 @@ import {
radiusVars,
transitionVars,
typographyVars,
+ textSizeVars,
} from '../theme/tokens.stylex';
import {XDSFieldLabel} from '../Field/XDSFieldLabel';
import type {XDSIconType} from '../Icon';
@@ -116,7 +117,7 @@ const styles = stylex.create({
},
description: {
fontFamily: typographyVars['--font-body'],
- fontSize: '0.75rem',
+ fontSize: textSizeVars['--text-xsm'],
color: colorVars['--color-text-secondary'],
},
});
diff --git a/packages/core/src/Field/XDSField.tsx b/packages/core/src/Field/XDSField.tsx
index 5811e27bce..79aa36e0cf 100644
--- a/packages/core/src/Field/XDSField.tsx
+++ b/packages/core/src/Field/XDSField.tsx
@@ -20,6 +20,8 @@ import {
spacingVars,
textSizeVars,
typographyVars,
+ fontWeightVars,
+ lineHeightVars,
} from '../theme/tokens.stylex';
import type {XDSIconType} from '../Icon';
@@ -37,7 +39,7 @@ const styles = stylex.create({
label: {
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'],
- fontWeight: 500,
+ fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-primary'],
},
labelHidden: {
@@ -79,7 +81,7 @@ const styles = stylex.create({
borderBottomRightRadius: radiusVars['--radius-element'],
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-xsm'],
- lineHeight: 1.333,
+ lineHeight: lineHeightVars['--leading-base'],
},
});
diff --git a/packages/core/src/Field/XDSFieldLabel.tsx b/packages/core/src/Field/XDSFieldLabel.tsx
index 88f295c5d3..6a2e2f94fc 100644
--- a/packages/core/src/Field/XDSFieldLabel.tsx
+++ b/packages/core/src/Field/XDSFieldLabel.tsx
@@ -12,7 +12,13 @@
import {forwardRef} from 'react';
import * as stylex from '@stylexjs/stylex';
import {InformationCircleIcon} from '@heroicons/react/24/outline';
-import {colorVars, spacingVars, typographyVars} from '../theme/tokens.stylex';
+import {
+ colorVars,
+ spacingVars,
+ typographyVars,
+ textSizeVars,
+ fontWeightVars,
+} from '../theme/tokens.stylex';
import {XDSIcon, type XDSIconType} from '../Icon';
import {XDSTooltip} from '../Layer';
@@ -22,8 +28,8 @@ const styles = stylex.create({
alignItems: 'center',
gap: spacingVars['--spacing-1'],
fontFamily: typographyVars['--font-body'],
- fontSize: '0.875rem',
- fontWeight: 500,
+ fontSize: textSizeVars['--text-base'],
+ fontWeight: fontWeightVars['--font-weight-medium'],
color: colorVars['--color-text-primary'],
},
labelClickable: {
@@ -49,8 +55,8 @@ const styles = stylex.create({
width: 1,
},
optionalRequired: {
- fontWeight: 400,
- fontSize: '0.75rem',
+ fontWeight: fontWeightVars['--font-weight-normal'],
+ fontSize: textSizeVars['--text-xsm'],
color: colorVars['--color-text-secondary'],
},
});
diff --git a/packages/core/src/Layer/useXDSTooltip.tsx b/packages/core/src/Layer/useXDSTooltip.tsx
index c0a3ecb0cd..94786cfb2f 100644
--- a/packages/core/src/Layer/useXDSTooltip.tsx
+++ b/packages/core/src/Layer/useXDSTooltip.tsx
@@ -30,6 +30,7 @@ import {
radiusVars,
spacingVars,
typographyVars,
+ lineHeightVars,
} from '../theme/tokens.stylex';
const styles = stylex.create({
@@ -42,7 +43,7 @@ const styles = stylex.create({
// Typography
fontFamily: typographyVars['--font-body'],
fontSize: 14,
- lineHeight: 1.4285714285714,
+ lineHeight: lineHeightVars['--leading-base'],
// Animation: closed state (default) and open state
opacity: {
default: 0,
diff --git a/packages/core/src/Selector/XDSSelector.tsx b/packages/core/src/Selector/XDSSelector.tsx
index 51a660751a..220a11b5b8 100644
--- a/packages/core/src/Selector/XDSSelector.tsx
+++ b/packages/core/src/Selector/XDSSelector.tsx
@@ -36,6 +36,7 @@ import {
typographyVars,
textSizeVars,
fontWeightVars,
+ lineHeightVars,
} from '../theme/tokens.stylex';
import {type XDSSelectorOption, type XDSSelectorItemData} from './types';
import {
@@ -69,7 +70,7 @@ const styles = stylex.create({
backgroundColor: colorVars['--color-surface'],
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'],
- lineHeight: 1.429,
+ lineHeight: lineHeightVars['--leading-base'],
color: colorVars['--color-text-primary'],
cursor: 'pointer',
transitionProperty: 'border-color, outline',
diff --git a/packages/core/src/TextArea/XDSTextArea.tsx b/packages/core/src/TextArea/XDSTextArea.tsx
index a6a85fa59c..42c34c5838 100644
--- a/packages/core/src/TextArea/XDSTextArea.tsx
+++ b/packages/core/src/TextArea/XDSTextArea.tsx
@@ -25,6 +25,7 @@ import {
transitionVars,
typographyVars,
textSizeVars,
+ lineHeightVars,
} from '../theme/tokens.stylex';
import {XDSField} from '../Field';
import {XDSIcon, type XDSIconType} from '../Icon';
@@ -70,7 +71,7 @@ const styles = stylex.create({
padding: 0,
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'],
- lineHeight: 1.429,
+ lineHeight: lineHeightVars['--leading-base'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
outline: 0,
diff --git a/packages/core/src/TextInput/XDSTextInput.tsx b/packages/core/src/TextInput/XDSTextInput.tsx
index 21b5cfcec1..77cfa41a87 100644
--- a/packages/core/src/TextInput/XDSTextInput.tsx
+++ b/packages/core/src/TextInput/XDSTextInput.tsx
@@ -24,6 +24,8 @@ import {
radiusVars,
transitionVars,
typographyVars,
+ textSizeVars,
+ lineHeightVars,
} from '../theme/tokens.stylex';
import {XDSField, type XDSInputStatus, type XDSInputStatusType} from '../Field';
import {XDSIcon, type XDSIconType} from '../Icon';
@@ -68,8 +70,8 @@ const styles = stylex.create({
border: 0,
padding: 0,
fontFamily: typographyVars['--font-body'],
- fontSize: '0.875rem',
- lineHeight: 1.429,
+ fontSize: textSizeVars['--text-base'],
+ lineHeight: lineHeightVars['--leading-base'],
color: colorVars['--color-text-primary'],
backgroundColor: 'transparent',
outline: 0,
diff --git a/packages/core/src/theme/defaultTheme.stylex.ts b/packages/core/src/theme/defaultTheme.stylex.ts
index af347fe89c..c90afdd33b 100644
--- a/packages/core/src/theme/defaultTheme.stylex.ts
+++ b/packages/core/src/theme/defaultTheme.stylex.ts
@@ -231,6 +231,7 @@ const textSizeRaw = {
const lineHeightRaw = {
'--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 satisfies Record<LineHeightVarName, string>;
@@ -336,7 +337,7 @@ const headingStyles = stylex.create({
fontFamily: typographyVars['--font-heading'],
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -344,7 +345,7 @@ const headingStyles = stylex.create({
fontFamily: typographyVars['--font-heading'],
fontSize: textSizeVars['--text-base'], // 14px (same as h4)
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -399,7 +400,7 @@ const headingEditorialStyles = stylex.create({
fontFamily: typographyVars['--font-heading'],
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -422,7 +423,7 @@ const textStyles = stylex.create({
fontFamily: typographyVars['--font-heading'], // Optimistic
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -440,7 +441,7 @@ const textStyles = stylex.create({
fontFamily: typographyVars['--font-heading'], // Optimistic
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-medium'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -458,7 +459,7 @@ const textStyles = stylex.create({
fontFamily: typographyVars['--font-code'], // Menlo
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -471,7 +472,7 @@ const proseBaseStyles = stylex.create({
base: {
fontSize: textSizeVars['--text-base'], // 14px
fontFamily: typographyVars['--font-body'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
},
});
diff --git a/packages/core/src/theme/neutralTheme.stylex.ts b/packages/core/src/theme/neutralTheme.stylex.ts
index e5a7c09e0a..93122b1e6c 100644
--- a/packages/core/src/theme/neutralTheme.stylex.ts
+++ b/packages/core/src/theme/neutralTheme.stylex.ts
@@ -274,6 +274,7 @@ const textSizeRaw = {
const lineHeightRaw = {
'--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 satisfies Record<LineHeightVarName, string>;
@@ -407,7 +408,7 @@ const headingStyles = stylex.create({
fontFamily: typographyVars['--font-heading'],
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-bold'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -415,7 +416,7 @@ const headingStyles = stylex.create({
fontFamily: typographyVars['--font-heading'],
fontSize: textSizeVars['--text-base'], // 14px (same as h4)
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -469,7 +470,7 @@ const headingEditorialStyles = stylex.create({
fontFamily: typographyVars['--font-heading'],
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-semibold'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -492,7 +493,7 @@ const textStyles = stylex.create({
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -510,7 +511,7 @@ const textStyles = stylex.create({
fontFamily: typographyVars['--font-body'],
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-medium'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
@@ -528,7 +529,7 @@ const textStyles = stylex.create({
fontFamily: typographyVars['--font-code'],
fontSize: textSizeVars['--text-base'], // 14px
fontWeight: fontWeightVars['--font-weight-normal'],
- lineHeight: 1.4285714285714286, // 20px
+ lineHeight: lineHeightVars['--leading-base'], // 20px
color: colorVars['--color-text-primary'],
margin: 0,
},
diff --git a/packages/core/src/theme/tokens.stylex.ts b/packages/core/src/theme/tokens.stylex.ts
index 460315035a..e393e2ffdc 100644
--- a/packages/core/src/theme/tokens.stylex.ts
+++ b/packages/core/src/theme/tokens.stylex.ts
@@ -234,6 +234,7 @@ export const textSizeVars = stylex.defineVars(textSizeRaw);
export const lineHeightRaw = {
'--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;