Replace experimental @wordpress/components APIs with @wordpress/ui - #8
Open
torounit wants to merge 1 commit into
Open
Replace experimental @wordpress/components APIs with @wordpress/ui#8torounit wants to merge 1 commit into
torounit wants to merge 1 commit into
Conversation
…imeControl Swap __experimentalHStack / __experimentalHeading / __experimentalSpacer from @wordpress/components for @wordpress/ui's Stack and Text, which don't carry the __experimental prefix that @wordpress/no-unsafe-wp-apis flags. Stack's justify="space-between" replaces the HStack+Spacer combo, and Text renders as an <h2> via the render prop to keep the popover header's heading semantics. Drop the eslint-disable block that was suppressing the lint rule for this file. No extra theme setup is needed since this renders inside the block editor, where @wordpress/ui's styles are picked up from the surrounding Gutenberg context per its own docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__experimentalHStack/__experimentalHeading/__experimentalSpacer(from@wordpress/components) with@wordpress/ui'sStackandTextin the "Schedule Terms" popover header (src/editor/components/DatetimeControl.tsx).Stack'sjustify="space-between"replaces theHStack+Spacercombo (no directSpacerequivalent exists in@wordpress/ui).Textis rendered as an<h2>via itsrenderprop to preserve the original heading semantics.eslint-disable @wordpress/no-unsafe-wp-apisblock that was previously needed for this file.@wordpress/ui(^0.15.1) as a dependency. No extra theme/CSS setup is needed since this component renders inside the block editor, where@wordpress/ui's docs say styling is handled by the surrounding Gutenberg context.Note:
@wordpress/uiis still a 0.x package and its own README says it's "still experimental" (i.e. its API may have breaking changes across minor versions), even though it doesn't use the__experimentalnaming convention that the lint rule checks for.Test plan
npm run lint:typepassesnpm run lint-jspasses (no more@wordpress/no-unsafe-wp-apiswarnings)npm run buildsucceeds