DataViews: vendor ValidatedToggleGroupControl - #81450
Conversation
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +282 B (0%) Total Size: 7.71 MB 📦 View Changed
|
|
Flaky tests detected in 63997f6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/31518839054 three users concurrently edit a large post with diverse blocks in
|
67df9e5 to
4ff9e18
Compare
| .dataviews-validated-control__wrapper-with-error-delegate { | ||
| position: relative; | ||
|
|
||
| // For ToggleGroupControl |
4ff9e18 to
8a6ec2e
Compare

Part of #81230
Follow-up to #81391
What?
Moves
ValidatedToggleGroupControlout of the@wordpress/componentsprivate APIs and into@wordpress/dataviews, its only consumer.Why?
See #81230.
How?
The
ValidatedToggleGroupControlwrapper now lives in thevalidated-form-controlsfolder of the DataViews package, where it reuses the already-vendoredControlWithErrorfoundation and builds on the public__experimentalToggleGroupControlexport instead of private APIs. The component, its story, and its private API registration are removed from the components package, and the mention of its delegate-based implementation is dropped from the overview doc. Its unit test moves along with it.This control validates through a visually hidden "error delegate" radio input, so the delegate styles (
__wrapper-with-error-delegate,__error-delegate) move into the DataViews stylesheet too, renamed from thecomponents-validated-controlnamespace todataviews-validated-control.Testing Instructions
npm run test:unit -- packages/dataviews/src/components/validated-form-controls/test/npm run storybook:dev, open DataViews → DataForm → Validation, and verify validation on the toggle group field: submitting with no option selected shows the required error, choosing an option other than Option 1 shows the custom rule error with the red highlight on the control, and choosing Option 1 clears it.Use of AI Tools
This PR was authored with the assistance of AI tools and reviewed by the author.