Repository navigation
Update tokens to use text size scale - #1298
Conversation
🦋 Changeset detectedLatest commit: 5ac54a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Design Token Diff (CSS)
|
Design Token Diff (StyleLint)
|
Design Token Diff (Figma)
|
Design Token Diff (Fallbacks)
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a base text size scale to the design token system and migrates functional typography tokens from hardcoded pixel values to references to this new scale.
Changes:
- Added a new
base.text.sizescale with six size tokens (xs through 2xl) using rem units - Replaced hardcoded pixel values in functional typography tokens with references to the base size scale
- Updated the dimension value schema regex to support decimal rem/px values required by the new scale
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/tokens/base/typography/typography.json5 | Adds the new base text size scale with 6 size tokens (xs: 12px, sm: 14px, md: 16px, lg: 20px, xl: 32px, 2xl: 40px) |
| src/tokens/functional/typography/typography.json5 | Migrates 9 typography size properties from hardcoded pixel values to base size token references |
| src/schemas/dimensionValue.ts | Updates regex pattern to allow decimal values in px/rem units (e.g., 0.75rem, 2.5rem) |
| src/schemas/dimensionToken.ts | Adds 'base/typography' to the list of valid collections for dimension tokens |
| .changeset/rare-zebras-refuse.md | Documents the change as a minor version bump |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const dimensionValue = z.union([ | ||
| z.string().superRefine((dim, ctx) => { | ||
| if (!/(^-?[0-9]+(px|rem)$|^-?[0-9]+\.?[0-9]*em$)/.test(dim)) { | ||
| if (!/(^-?[0-9]+\.?[0-9]*(px|rem)$|^-?[0-9]+\.?[0-9]*em$)/.test(dim)) { |
There was a problem hiding this comment.
The regex pattern has been updated to support decimal values like '0.75rem' and '2.5rem', which is necessary for the new text size scale tokens. However, there are no test cases in the dimensionValueSchema.test.ts file that verify decimal rem/px values work correctly. Consider adding test cases such as dimensionValue.safeParse('0.75rem') and dimensionValue.safeParse('2.5px') to ensure the regex change works as intended.
Added text size scale