-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Umbrella Issue: CSS Modules Migration & Emotion Extraction
Objective: Default UI Kit uses CSS Modules with zero Emotion dependency. Emotion support is kept as an optional bundle under @tidbcloud/uikit/emotion.
Goals
- Default consumption path ships CSS Modules + static styles; no Emotion requirement.
- All Emotion-specific utilities (ThemeProvider,
sx/styles, caches) are exported from@tidbcloud/uikit/emotiononly. - Maintain functional parity for all components in both CSS and Emotion flows.
- Keep bundle size predictable and simplify dependency expectations for app teams.
Non-Goals
- Introducing new visual designs or theme tokens.
- Changing component APIs beyond what is needed to remove Emotion coupling.
Scope & Deliverables
- CSS-first core: Components rendered via
.module.css, CSS variables for theming, nocreateStyles. - Emotion bundle: Dedicated entry
@tidbcloud/uikit/emotionthat exposes the Emotion-backedThemeProvider,stylesTransform, and any Emotion-specific helpers. - Build/exports: Package exports updated to remove the
@tidbcloud/uikit/themevs@tidbcloud/uikit/theme/csssplit; keep a single CSS-first theme entry and the Emotion bundle at@tidbcloud/uikit/emotion. - Docs: Clear install/usage guidance for both modes and migration notes for consumers.
Key Decisions
- CSS mode is the default. Apps that want Emotion must import from
@tidbcloud/uikit/emotion. - Emotion dependencies become optional peers; CSS-only installs should not pull them.
- Theme variables remain shared; CSS mode uses static styles while Emotion mode can opt into dynamic styling APIs.
Work Items
- Infra
- Ensure build supports CSS Modules everywhere; remove residual
createStylesusage. - Wire CSS variables pipeline for theme tokens.
- Ensure build supports CSS Modules everywhere; remove residual
- Component migrations
- biz/TransferTree →
.module.css - biz/PhoneInput →
.module.css - primitive/Prism → CSS variables for dynamic params
- biz/Tree → static overrides, drop
Global/useCss - DateTimePicker/TimeScrollerPicker → CSS Modules + vars
- biz/TransferTree →
- Theme layer
- Create CSS-first
ThemeProvider(default export path). - Create Emotion
ThemeProviderand colocate all Emotion helpers under@tidbcloud/uikit/emotion. - Verify type exports for both entries.
- Create CSS-first
- Packaging
- Update
packages/uikit/package.jsonexports to use the new entries (CSS default, Emotion at@tidbcloud/uikit/emotion). - Set Emotion deps as optional peerDependencies.
- Build/test both bundles.
- Update
- Testing
- Unit coverage for CSS mode
- Unit coverage for Emotion mode
- Integration: vite and nextjs examples
- Documentation
- Update Getting Started / migration guide to explain the new entries.
- Note deprecation of
@tidbcloud/uikit/themesplit in favor of@tidbcloud/uikit/emotion.
Risks & Notes
- Divergence between CSS and Emotion visual output; needs visual regression checks.
- Third-party styles (e.g., rc-tree) must be reconciled with CSS variable theme tokens.
- Consumers might rely on
sxin existing code; migration guide must highlight@tidbcloud/uikit/emotionfor that path.
Definition of Done
- Build succeeds with Emotion dependencies absent.
- Emotion bundle works when
@emotion/*+@mantine/emotionare installed. - Docs published with clear import/install instructions and migration steps.
Metadata
Metadata
Assignees
Labels
No labels