Skip to content

feat(theme): motion token primitives — duration, easing, and component migration - #684

Merged
cixzhang merged 3 commits into
mainfrom
navi/feat/motion-tokens
Mar 18, 2026
Merged

cixzhang merged 3 commits into
mainfrom
navi/feat/motion-tokens

Conversation

@cixzhang

@cixzhang cixzhang commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Introduces a layered motion token system per the architecture proposed in #674. Replaces the old bundled --transition-fast / --transition-normal tokens with separated duration and easing primitives.

New Token Layers

Duration Primitives

Token Value Use case
--duration-fast-min 130ms Near-imperceptible (tooltip fade)
--duration-fast 175ms Micro-interactions (hover, toggle)
--duration-fast-max 230ms Slightly longer micro-interactions
--duration-medium-min 310ms Quick entrance/exit (dropdown, popover)
--duration-medium 410ms Standard entrance/exit (dialog, drawer)
--duration-medium-max 550ms Dramatic entrance (full-page transition)

Easing Primitives

Token Value Use case
--easing-decelerate cubic-bezier(0.24, 1, 0.4, 1) Elements entering/coming to rest
--easing-standard cubic-bezier(0.4, 0, 0.2, 1) Symmetric A↔B transitions

Migration

  • 24 components using transitionVars: mechanical migration to durationVars + easingVars
  • 6 hardcoded components (HoverCard, Popover, Tooltip, TopNavMegaMenu, MobileNav, Collapsible): replaced inline values with token vars
  • ThemeEditor story updated with new Duration/Easing token groups
  • Old transitionDefaults/transitionVars kept as deprecated aliases for backward compat

Token mapping decisions

  • Micro-interactions (hover, toggle, color change): --duration-fast + --easing-standard
  • Enter/exit animations (dialog, drawer, popover): --duration-medium + --easing-decelerate
  • Tooltip (near-instant): --duration-fast-min + --easing-decelerate
  • MobileNav drawer slide: --duration-medium + --easing-standard
  • TopNavMegaMenu panel: --duration-medium-min + --easing-decelerate

What's NOT in this PR

motionScale config for defineTheme() — that's the follow-up PR where themes can set motionScale: { fast, medium, ratio } to compute the full 6-token duration scale from 3 values.

Refs #674


…t migration

Introduces a layered motion token system replacing the old bundled
transition tokens (--transition-fast/--transition-normal).

New token layers:
- Duration primitives: --duration-{fast,medium}{-min,-max}
- Easing primitives: --easing-{decelerate,standard}
- Old transition tokens kept as deprecated aliases

Component migration (35 files):
- 24 components: transitionVars → durationVars + easingVars
- 6 hardcoded components: inline values → token vars
  (HoverCard, Popover, Tooltip, TopNavMegaMenu, MobileNav, Collapsible)
- ThemeEditor story updated with new token groups

Token mapping:
- Micro-interactions (hover, toggle): --duration-fast + --easing-standard
- Enter/exit animations (dialog, drawer): --duration-medium + --easing-decelerate
- Tooltip (near-instant): --duration-fast-min + --easing-decelerate
- MobileNav (slide): --duration-medium + --easing-standard

Closes #674 (partial — motionScale config in follow-up PR)

Co-authored-by: Navi <[email protected]>
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 18, 2026
…oken usage

The bulk migration script incorrectly transformed string-interpolated
transitionVars into (durationVars, easingVars['--transition-fast']),
creating a comma operator expression. Fixed to use separate
transitionProperty/transitionDuration/transitionTimingFunction.

Co-authored-by: Navi <[email protected]>
@github-actions

github-actions Bot commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Button · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 333B N/A
Lines of Code N/A 292 -
Complexity N/A High (22) -
Calendar · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 901B N/A
Lines of Code N/A 925 -
Complexity N/A Very High (122) -
CheckboxInput · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 443B N/A
Lines of Code N/A 348 -
Complexity N/A High (28) -
Collapsible · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 4.6KB N/A
Lines of Code N/A 244 -
Complexity N/A High (18) -
Dialog · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 595B N/A
Lines of Code N/A 317 -
Complexity N/A Very High (38) -
DropdownMenu · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 687B N/A
Lines of Code N/A 506 -
Complexity N/A Very High (63) -
Field · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 818B N/A
Lines of Code N/A 506 -
Complexity N/A High (19) -
HoverCard · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 217B N/A
Lines of Code N/A 428 -
Complexity N/A Very High (44) -
Link · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 581B N/A
Lines of Code N/A 228 -
Complexity N/A Medium (11) -
List · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 231B N/A
Lines of Code N/A 408 -
Complexity N/A Very High (37) -
MobileNav · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 615B N/A
Lines of Code N/A 322 -
Complexity N/A Very High (32) -
MoreMenu · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 625B N/A
Lines of Code N/A 372 -
Complexity N/A Very High (49) -
Pagination · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 799B N/A
Lines of Code N/A 383 -
Complexity N/A Very High (49) -
Popover · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 345B N/A
Lines of Code N/A 469 -
Complexity N/A Very High (42) -
ProgressBar · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 215B N/A
Lines of Code N/A 215 -
Complexity N/A Medium (13) -
RadioList · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 475B N/A
Lines of Code N/A 406 -
Complexity N/A High (28) -
Selector · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 1.1KB N/A
Lines of Code N/A 925 -
Complexity N/A Very High (47) -
SideNav · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 1.1KB N/A
Lines of Code N/A 1338 -
Complexity N/A Very High (133) -
Slider · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 429B N/A
Lines of Code N/A 615 -
Complexity N/A Very High (75) -
Switch · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 429B N/A
Lines of Code N/A 312 -
Complexity N/A High (27) -
TabList · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 479B N/A
Lines of Code N/A 559 -
Complexity N/A High (26) -
Table · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 863B N/A
Lines of Code N/A 847 -
Complexity N/A Very High (54) -
Token · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 267B N/A
Lines of Code N/A 357 -
Complexity N/A Medium (14) -
Tooltip · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 241B N/A
Lines of Code N/A 405 -
Complexity N/A Very High (47) -
TopNav · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 1.2KB N/A
Lines of Code N/A 1507 -
Complexity N/A Very High (92) -
TreeList · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A 241B N/A
Lines of Code N/A 678 -
Complexity N/A Very High (60) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 10.7KB 17.0KB 2.6KB

Accessibility Audit

Status: 6 accessibility violation(s) found — 1 critical, 3 serious, 2 moderate.

XDSCalendar - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 10/11 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
XDSList - 1 issue(s)
  • 🔴 critical: Ensure an element's role supports its ARIA attributes
    • Rule: aria-allowed-attr · Affects 1/10 stories · Learn more
    • WCAG: 4.1.2 (Level A)
XDSPagination - 1 issue(s)
  • 🟡 moderate: Ensure landmarks are unique
    • Rule: landmark-unique · Affects 1/14 stories · Learn more
XDSSideNav - 1 issue(s)
  • 🟠 serious: Ensure links have discernible text
    • Rule: link-name · Affects 1/8 stories · Learn more
    • WCAG: 2.4.4, 4.1.2 (Level A)
XDSTabList - 1 issue(s)
  • 🟡 moderate: Ensure landmarks are unique
    • Rule: landmark-unique · Affects 1/5 stories · Learn more
XDSToken - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/9 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

Per Ted's feedback: consolidate to one easing curve. The decelerate
curve (cubic-bezier(0.24, 1, 0.4, 1)) becomes --easing-standard —
it's the better general-purpose default.

Removes --easing-standard (the old symmetric 0.4,0,0.2,1 curve).
All components now use a single --easing-standard token.

Co-authored-by: Navi <[email protected]>
@cixzhang
cixzhang merged commit edb45df into main Mar 18, 2026
11 checks passed
@cixzhang
cixzhang deleted the navi/feat/motion-tokens branch March 20, 2026 16:59
cixzhang added a commit that referenced this pull request Apr 26, 2026
…t migration (#684)

* feat(theme): motion token primitives — duration, easing, and component migration

Introduces a layered motion token system replacing the old bundled
transition tokens (--transition-fast/--transition-normal).

New token layers:
- Duration primitives: --duration-{fast,medium}{-min,-max}
- Easing primitives: --easing-{decelerate,standard}
- Old transition tokens kept as deprecated aliases

Component migration (35 files):
- 24 components: transitionVars → durationVars + easingVars
- 6 hardcoded components: inline values → token vars
  (HoverCard, Popover, Tooltip, TopNavMegaMenu, MobileNav, Collapsible)
- ThemeEditor story updated with new token groups

Token mapping:
- Micro-interactions (hover, toggle): --duration-fast + --easing-standard
- Enter/exit animations (dialog, drawer): --duration-medium + --easing-decelerate
- Tooltip (near-instant): --duration-fast-min + --easing-decelerate
- MobileNav (slide): --duration-medium + --easing-standard

Closes #674 (partial — motionScale config in follow-up PR)

Co-authored-by: Navi <[email protected]>

* fix(Selector): replace broken comma-operator transition with proper token usage

The bulk migration script incorrectly transformed string-interpolated
transitionVars into (durationVars, easingVars['--transition-fast']),
creating a comma operator expression. Fixed to use separate
transitionProperty/transitionDuration/transitionTimingFunction.

Co-authored-by: Navi <[email protected]>

* refactor(theme): single easing token — rename decelerate to standard

Per Ted's feedback: consolidate to one easing curve. The decelerate
curve (cubic-bezier(0.24, 1, 0.4, 1)) becomes --easing-standard —
it's the better general-purpose default.

Removes --easing-standard (the old symmetric 0.4,0,0.2,1 curve).
All components now use a single --easing-standard token.

Co-authored-by: Navi <[email protected]>

---------

Co-authored-by: Navi <[email protected]>
cixzhang added a commit that referenced this pull request Jun 21, 2026
…t migration (#684)

* feat(theme): motion token primitives — duration, easing, and component migration

Introduces a layered motion token system replacing the old bundled
transition tokens (--transition-fast/--transition-normal).

New token layers:
- Duration primitives: --duration-{fast,medium}{-min,-max}
- Easing primitives: --easing-{decelerate,standard}
- Old transition tokens kept as deprecated aliases

Component migration (35 files):
- 24 components: transitionVars → durationVars + easingVars
- 6 hardcoded components: inline values → token vars
  (HoverCard, Popover, Tooltip, TopNavMegaMenu, MobileNav, Collapsible)
- ThemeEditor story updated with new token groups

Token mapping:
- Micro-interactions (hover, toggle): --duration-fast + --easing-standard
- Enter/exit animations (dialog, drawer): --duration-medium + --easing-decelerate
- Tooltip (near-instant): --duration-fast-min + --easing-decelerate
- MobileNav (slide): --duration-medium + --easing-standard

Closes #674 (partial — motionScale config in follow-up PR)

Co-authored-by: Navi <[email protected]>

* fix(Selector): replace broken comma-operator transition with proper token usage

The bulk migration script incorrectly transformed string-interpolated
transitionVars into (durationVars, easingVars['--transition-fast']),
creating a comma operator expression. Fixed to use separate
transitionProperty/transitionDuration/transitionTimingFunction.

Co-authored-by: Navi <[email protected]>

* refactor(theme): single easing token — rename decelerate to standard

Per Ted's feedback: consolidate to one easing curve. The decelerate
curve (cubic-bezier(0.24, 1, 0.4, 1)) becomes --easing-standard —
it's the better general-purpose default.

Removes --easing-standard (the old symmetric 0.4,0,0.2,1 curve).
All components now use a single --easing-standard token.

Co-authored-by: Navi <[email protected]>

---------

Co-authored-by: Navi <[email protected]>
cixzhang added a commit that referenced this pull request Jun 21, 2026
…t migration (#684)

* feat(theme): motion token primitives — duration, easing, and component migration

Introduces a layered motion token system replacing the old bundled
transition tokens (--transition-fast/--transition-normal).

New token layers:
- Duration primitives: --duration-{fast,medium}{-min,-max}
- Easing primitives: --easing-{decelerate,standard}
- Old transition tokens kept as deprecated aliases

Component migration (35 files):
- 24 components: transitionVars → durationVars + easingVars
- 6 hardcoded components: inline values → token vars
  (HoverCard, Popover, Tooltip, TopNavMegaMenu, MobileNav, Collapsible)
- ThemeEditor story updated with new token groups

Token mapping:
- Micro-interactions (hover, toggle): --duration-fast + --easing-standard
- Enter/exit animations (dialog, drawer): --duration-medium + --easing-decelerate
- Tooltip (near-instant): --duration-fast-min + --easing-decelerate
- MobileNav (slide): --duration-medium + --easing-standard

Closes #674 (partial — motionScale config in follow-up PR)


* fix(Selector): replace broken comma-operator transition with proper token usage

The bulk migration script incorrectly transformed string-interpolated
transitionVars into (durationVars, easingVars['--transition-fast']),
creating a comma operator expression. Fixed to use separate
transitionProperty/transitionDuration/transitionTimingFunction.


* refactor(theme): single easing token — rename decelerate to standard

Per Ted's feedback: consolidate to one easing curve. The decelerate
curve (cubic-bezier(0.24, 1, 0.4, 1)) becomes --easing-standard —
it's the better general-purpose default.

Removes --easing-standard (the old symmetric 0.4,0,0.2,1 curve).
All components now use a single --easing-standard token.


---------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant