Repository navigation
refactor: migrate components from raw text size tokens to semantic type scale tokens - #661
Conversation
d75c691 to
49ef480
Compare
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsAppShell · View in Storybook
Badge · View in Storybook
Banner · View in Storybook
Breadcrumbs · View in Storybook
Button · View in Storybook
Calendar · View in Storybook
CheckboxInput · View in Storybook
Collapsible · View in Storybook
DateInput · View in Storybook
Divider · View in Storybook
DropdownMenu · View in Storybook
EmptyState · View in Storybook
Field · View in Storybook
Kbd · View in Storybook
Link · View in Storybook
List · View in Storybook
MoreMenu · View in Storybook
NavItem
NumberInput · View in Storybook
Pagination · View in Storybook
Popover · View in Storybook
PowerSearch · View in Storybook
ProgressBar · View in Storybook
RadioList · View in Storybook
Selector · View in Storybook
SideNav · View in Storybook
Slider · View in Storybook
Switch · View in Storybook
TabList · View in Storybook
Table · View in Storybook
TextArea · View in Storybook
TextInput · View in Storybook
TimeInput · View in Storybook
Token · View in Storybook
TopNav · View in Storybook
TreeList · View in Storybook
Typeahead · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Rebase notes after PR #665PR #665 just landed with significant changes to theme CSS generation. Here's what to expect when rebasing: Files removed:
Files changed that will likely conflict:
Key architectural change:
If your semantic token migration changes how component styles reference tokens, those should still work — |
49ef480 to
acd9467
Compare
acd9467 to
6adb50d
Compare
6adb50d to
9c1e5da
Compare
…pe scale tokens
Components now reference semantic type scale tokens (typeScaleVars) instead
of raw text size tokens (textSizeVars) for font sizing. This is the same
principle as using --color-accent instead of a hex code — components should
reference the semantic layer, not the raw palette.
The raw --text-* tokens (--text-base, --text-sm, --text-xsm, --text-lg)
are a size palette — they define what sizes exist. The semantic type scale
tokens (--text-body-size, --text-label-size, --text-supporting-size,
--text-large-size) define what sizes mean. Components should express intent
("this is a label", "this is supporting text") not implementation
("this is 14px", "this is 12px").
With this change, adjusting the type scale via defineTheme's typeScale
config now affects ALL text in the system — headings, body text, button
labels, table cells, nav items, form controls — not just XDSHeading
and XDSText.
| Raw token | Semantic token | Used for |
|-----------|---------------|----------|
| --text-base | --text-label-size | Interactive controls: buttons, tabs, selectors, menu items, form labels, nav items |
| --text-base | --text-body-size | Content: text inputs, links, descriptions, table cells (spacious) |
| --text-sm | --text-supporting-size | Secondary: descriptions, breadcrumbs, captions, placeholders |
| --text-xsm | --text-supporting-size | Compact: badges, helper text, field status, keyboard shortcuts |
| --text-lg | --text-large-size | Emphasis: empty state titles, nav headings |
| --text-2xs | --text-supporting-size | Micro: compact density descriptions |
Note: Both --text-sm and --text-xsm map to --text-supporting-size.
The distinction between these two raw sizes was arbitrary — they both
serve the same semantic purpose (secondary/supporting information).
The type scale system resolves this by having a single supporting size
that themes control via { base, ratio }.
47 component files updated. Each change replaces a textSizeVars reference
with the semantically correct typeScaleVars reference. Zero net line change
(142 insertions, 142 deletions) — this is a pure token migration.
This PR depends on #638 (type scale system) which defines the semantic
tokens. It should be merged after #638.
Co-authored-by: navi <[email protected]>
9c1e5da to
70551a9
Compare
…ng for descriptions - ListItem/TreeListItem compact+balanced: supporting → body (primary item text) - TableCell compact: supporting → body (table data content) - TableHeaderCell all densities: → label (headers are labels) - BreadcrumbItem/Breadcrumbs defaultSize: supporting → body (navigational text) - ProgressBar label+valueLabel: supporting → body (progress label text) - Calendar dayCell: supporting → body (interactive day numbers) Supporting text is for descriptions, sublabels, and subtext only.
…pe scale tokens (#661) * refactor: migrate components from raw text size tokens to semantic type scale tokens Components now reference semantic type scale tokens (typeScaleVars) instead of raw text size tokens (textSizeVars) for font sizing. This is the same principle as using --color-accent instead of a hex code — components should reference the semantic layer, not the raw palette. The raw --text-* tokens (--text-base, --text-sm, --text-xsm, --text-lg) are a size palette — they define what sizes exist. The semantic type scale tokens (--text-body-size, --text-label-size, --text-supporting-size, --text-large-size) define what sizes mean. Components should express intent ("this is a label", "this is supporting text") not implementation ("this is 14px", "this is 12px"). With this change, adjusting the type scale via defineTheme's typeScale config now affects ALL text in the system — headings, body text, button labels, table cells, nav items, form controls — not just XDSHeading and XDSText. | Raw token | Semantic token | Used for | |-----------|---------------|----------| | --text-base | --text-label-size | Interactive controls: buttons, tabs, selectors, menu items, form labels, nav items | | --text-base | --text-body-size | Content: text inputs, links, descriptions, table cells (spacious) | | --text-sm | --text-supporting-size | Secondary: descriptions, breadcrumbs, captions, placeholders | | --text-xsm | --text-supporting-size | Compact: badges, helper text, field status, keyboard shortcuts | | --text-lg | --text-large-size | Emphasis: empty state titles, nav headings | | --text-2xs | --text-supporting-size | Micro: compact density descriptions | Note: Both --text-sm and --text-xsm map to --text-supporting-size. The distinction between these two raw sizes was arbitrary — they both serve the same semantic purpose (secondary/supporting information). The type scale system resolves this by having a single supporting size that themes control via { base, ratio }. 47 component files updated. Each change replaces a textSizeVars reference with the semantically correct typeScaleVars reference. Zero net line change (142 insertions, 142 deletions) — this is a pure token migration. This PR depends on #638 (type scale system) which defines the semantic tokens. It should be merged after #638. Co-authored-by: navi <[email protected]> * fix: use body/label tokens for primary content text, reserve supporting for descriptions - ListItem/TreeListItem compact+balanced: supporting → body (primary item text) - TableCell compact: supporting → body (table data content) - TableHeaderCell all densities: → label (headers are labels) - BreadcrumbItem/Breadcrumbs defaultSize: supporting → body (navigational text) - ProgressBar label+valueLabel: supporting → body (progress label text) - Calendar dayCell: supporting → body (interactive day numbers) Supporting text is for descriptions, sublabels, and subtext only. --------- Co-authored-by: navi <[email protected]>
…pe scale tokens (#661) * refactor: migrate components from raw text size tokens to semantic type scale tokens Components now reference semantic type scale tokens (typeScaleVars) instead of raw text size tokens (textSizeVars) for font sizing. This is the same principle as using --color-accent instead of a hex code — components should reference the semantic layer, not the raw palette. The raw --text-* tokens (--text-base, --text-sm, --text-xsm, --text-lg) are a size palette — they define what sizes exist. The semantic type scale tokens (--text-body-size, --text-label-size, --text-supporting-size, --text-large-size) define what sizes mean. Components should express intent ("this is a label", "this is supporting text") not implementation ("this is 14px", "this is 12px"). With this change, adjusting the type scale via defineTheme's typeScale config now affects ALL text in the system — headings, body text, button labels, table cells, nav items, form controls — not just XDSHeading and XDSText. | Raw token | Semantic token | Used for | |-----------|---------------|----------| | --text-base | --text-label-size | Interactive controls: buttons, tabs, selectors, menu items, form labels, nav items | | --text-base | --text-body-size | Content: text inputs, links, descriptions, table cells (spacious) | | --text-sm | --text-supporting-size | Secondary: descriptions, breadcrumbs, captions, placeholders | | --text-xsm | --text-supporting-size | Compact: badges, helper text, field status, keyboard shortcuts | | --text-lg | --text-large-size | Emphasis: empty state titles, nav headings | | --text-2xs | --text-supporting-size | Micro: compact density descriptions | Note: Both --text-sm and --text-xsm map to --text-supporting-size. The distinction between these two raw sizes was arbitrary — they both serve the same semantic purpose (secondary/supporting information). The type scale system resolves this by having a single supporting size that themes control via { base, ratio }. 47 component files updated. Each change replaces a textSizeVars reference with the semantically correct typeScaleVars reference. Zero net line change (142 insertions, 142 deletions) — this is a pure token migration. This PR depends on #638 (type scale system) which defines the semantic tokens. It should be merged after #638. Co-authored-by: navi <[email protected]> * fix: use body/label tokens for primary content text, reserve supporting for descriptions - ListItem/TreeListItem compact+balanced: supporting → body (primary item text) - TableCell compact: supporting → body (table data content) - TableHeaderCell all densities: → label (headers are labels) - BreadcrumbItem/Breadcrumbs defaultSize: supporting → body (navigational text) - ProgressBar label+valueLabel: supporting → body (progress label text) - Calendar dayCell: supporting → body (interactive day numbers) Supporting text is for descriptions, sublabels, and subtext only. --------- Co-authored-by: navi <[email protected]>
…pe scale tokens (#661) * refactor: migrate components from raw text size tokens to semantic type scale tokens Components now reference semantic type scale tokens (typeScaleVars) instead of raw text size tokens (textSizeVars) for font sizing. This is the same principle as using --color-accent instead of a hex code — components should reference the semantic layer, not the raw palette. The raw --text-* tokens (--text-base, --text-sm, --text-xsm, --text-lg) are a size palette — they define what sizes exist. The semantic type scale tokens (--text-body-size, --text-label-size, --text-supporting-size, --text-large-size) define what sizes mean. Components should express intent ("this is a label", "this is supporting text") not implementation ("this is 14px", "this is 12px"). With this change, adjusting the type scale via defineTheme's typeScale config now affects ALL text in the system — headings, body text, button labels, table cells, nav items, form controls — not just XDSHeading and XDSText. | Raw token | Semantic token | Used for | |-----------|---------------|----------| | --text-base | --text-label-size | Interactive controls: buttons, tabs, selectors, menu items, form labels, nav items | | --text-base | --text-body-size | Content: text inputs, links, descriptions, table cells (spacious) | | --text-sm | --text-supporting-size | Secondary: descriptions, breadcrumbs, captions, placeholders | | --text-xsm | --text-supporting-size | Compact: badges, helper text, field status, keyboard shortcuts | | --text-lg | --text-large-size | Emphasis: empty state titles, nav headings | | --text-2xs | --text-supporting-size | Micro: compact density descriptions | Note: Both --text-sm and --text-xsm map to --text-supporting-size. The distinction between these two raw sizes was arbitrary — they both serve the same semantic purpose (secondary/supporting information). The type scale system resolves this by having a single supporting size that themes control via { base, ratio }. 47 component files updated. Each change replaces a textSizeVars reference with the semantically correct typeScaleVars reference. Zero net line change (142 insertions, 142 deletions) — this is a pure token migration. This PR depends on #638 (type scale system) which defines the semantic tokens. It should be merged after #638. * fix: use body/label tokens for primary content text, reserve supporting for descriptions - ListItem/TreeListItem compact+balanced: supporting → body (primary item text) - TableCell compact: supporting → body (table data content) - TableHeaderCell all densities: → label (headers are labels) - BreadcrumbItem/Breadcrumbs defaultSize: supporting → body (navigational text) - ProgressBar label+valueLabel: supporting → body (progress label text) - Calendar dayCell: supporting → body (interactive day numbers) Supporting text is for descriptions, sublabels, and subtext only. ---------
Changes
Migrates all component files from raw
textSizeVarsto semantictypeScaleVarstokens for fontSize.Before:
fontSize: textSizeVars['--text-xsm']After:
fontSize: typeScaleVars['--text-supporting-size']This makes font sizes themeable through the type scale system — change the base size or ratio and all components follow.
Files changed: 52
All component
.tsx/.tsfiles that referencedtextSizeVarsdirectly now usetypeScaleVarssemantic tokens.Follow-up: lineHeight migration
Many files now pair
typeScaleVarsfontSize with rawlineHeightVars. Safe-to-migrate pairings where the values are identical:--text-body-size+lineHeightVars['--leading-base']→typeScaleVars['--text-body-leading']--text-label-size+lineHeightVars['--leading-base']→typeScaleVars['--text-label-leading']Intentional overrides that should stay as raw
lineHeightVars(different values):--text-supporting-size+--leading-snug(tighter than--text-supporting-leadingfor dense UI)--text-large-size+--leading-tight/--leading-snug(tighter than--text-large-leadingfor headings)