Repository navigation
Charts: Replace __experimentalText with @wordpress/ui Text - #47894
Conversation
Replace usage of __experimentalText from @wordpress/components with the stable Text component from @wordpress/ui in leaderboard-chart.tsx (production code) and donut.stories.tsx (stories). - leaderboard-chart.tsx: Import Text from @wordpress/ui alongside Stack - donut.stories.tsx: Import Text as WPText from @wordpress/ui, migrate size/weight props to variant/style equivalents CHARTS-206
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
|
@cursoragent I'd prefer to drop the WPText rename and just use Text. Is there a reason to keep it? |
|
Done. The |
Rename the visx SVG text import to SvgText to free the Text name for the @wordpress/ui component, avoiding the need for a WPText alias.
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
|
Careful with this component; it's not fully recommended to use it yet. In some situations it works, but review carefully that it's not inheriting e.g. CSS overrides and such. |
|
@claude review please |
There was a problem hiding this comment.
Pull request overview
This PR migrates usage of the experimental __experimentalText export from @wordpress/components to the stable Text component from @wordpress/ui within the Charts package, reducing reliance on unsafe/experimental APIs while keeping other experimental imports unchanged.
Changes:
- Update
leaderboard-chart.tsxto importTextfrom@wordpress/ui(while keeping__experimentalGridfrom@wordpress/components). - Update
donut.stories.tsxto importTextfrom@wordpress/ui, rename the visxTextimport toSvgText, and adapt legend text props to the@wordpress/uiAPI. - Add a changelog fragment documenting the migration.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| projects/js-packages/charts/src/charts/pie-chart/stories/donut.stories.tsx | Switch legend text to @wordpress/ui Text, avoid name collision by renaming visx text to SvgText, and update props accordingly. |
| projects/js-packages/charts/src/charts/leaderboard-chart/leaderboard-chart.tsx | Replace experimental Text import with stable @wordpress/ui Text while keeping experimental grid usage. |
| projects/js-packages/charts/changelog/text-component-migration | Add changelog entry describing the Text component migration. |
PR Review (quick depth — 58 lines, 1 project)Verdict: Looks good — ready to merge. SummaryMigrates Checks
FindingsNo blockers, no suggestions. Reviewed by Claude Code (Opus 4.6) — quick depth. JS tests not run; follow PR testing instructions to verify locally. |



Proposed changes
Migrate the
Textcomponent usage from the experimental__experimentalTextexport in@wordpress/componentsto the stableTextcomponent from@wordpress/ui.leaderboard-chart.tsx(production): ImportTextfrom@wordpress/uialongside the existingStackimport, removing it from the@wordpress/componentsimport (which still imports__experimentalGrid)donut.stories.tsx(stories): ImportTextfrom@wordpress/ui, renaming the visx SVG text import toSvgTextto avoid collision. Props adapted from the@wordpress/componentsAPI to@wordpress/ui:size="small"→variant="body-sm"weight={600}→style={{ fontWeight: 600 }}Other information
@wordpress/uiv0.9.0 is already a production dependency of@automattic/charts@wordpress/componentsremains as a devDependency for other experimental components (__experimentalGrid,__experimentalHStack) — those migrations are tracked separately (e.g., CHARTS-175 for HStack)eslint-disable @wordpress/no-unsafe-wp-apiscomment is preserved in both files since other experimental imports remainRelated product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
cd projects/js-packages/charts && pnpm run typecheck— should pass with no errorscd projects/js-packages/charts && pnpm run test— all 841 tests should passcd projects/js-packages/charts && pnpm run build— should build successfullyLinear Issue: CHARTS-206