-
Notifications
You must be signed in to change notification settings - Fork 4.6k
UI: Add Stack component leveraging gap spacing design tokens #73308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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: +396 B (+0.02%) Total Size: 2.58 MB
ℹ️ View Unchanged
|
b7c4da6 to
79291f9
Compare
|
I rebased this after #73215 was merged, with a few changes to align to some of the decisions made in the other pull request:
|
|
The unit test failures seem to be stemming from the JSDOM upgrade, which I may end up spinning off into its own pull request to review independently. It's an interesting nuance of computing accessible names and whether two adjacent elements are joined with any whitespace, where the browser renders these as My read of the relevant specification is that this is a more accurate reflection of how a browser would be expected to behave:
|
Separate pull request at #73472 |
|
It looks like a smaller JSDOM version bump is enough to get the support we need for CSS properties without having to deal with all the other breaking changes and performance regressions that came up in #73472. I think this should be good to move forward as-is after a review. |
packages/theme/tokens/dimension.json
Outdated
| } | ||
| }, | ||
| "sm": { | ||
| "$value": "{dimension.primitive.space.40}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice 12px is missing as an option which is a value we currently use in a few places. Noting some example gaps we currently use which might help to inform the initial scale:
- 4px (icon button spacing)
- 8px (control spacing between label, input, help text)
- 12px (DataViews List)
- 16px (DataForm field spacing)
- 24px (DataForm Card spacing)
- 32px (DataViews grid spacing)
In other words;
2xs=10(4px)xs=20(8px)sm=30(12px)md=40(16px)lg=60(24px)xl=80(32px)
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me 👍 I updated these in b62e8c9
Consistency with padding tokens
Fixes CSS parsing limitation while avoiding some of the performance degradation and test assumptions in newer versions
|
Flaky tests detected in 6c52a30. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19900280690
|
jameskoster
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a design perspective I think we're good :)
* UI: Add Stack component leveraging gap spacing design tokens * Remove "flow" nesting layer in gap tokens * Use shorthand names for gap tokens Consistency with padding tokens * Add 2xs gap token for 4px spacing * Remove "content flow" qualifier for gap descriptions * Align gap token values to padding * Update documentation example referencing outdated token * Limit JSDOM bump to 26.x Fixes CSS parsing limitation while avoiding some of the performance degradation and test assumptions in newer versions * Update gap scale to better reflect real-world usage See: WordPress/gutenberg#73308 (comment) * Ensure design tokens are included in Story * Remove redundant padding from Stack story boxes Co-authored-by: aduth <[email protected]> Co-authored-by: jameskoster <[email protected]> Source: WordPress/gutenberg@2d25715
| if ( typeof gap === 'number' ) { | ||
| return `calc( ${ gap } * var( --wpds-dimension-base ) )`; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jameskoster Curious for your thoughts: Since we have gap tokens that we'd encourage people to use, should we remove this support for specifying a numeric multiplier of the base spacing? (at least initially)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I missed this before you merged, but yes I think that's a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request at #73852
What?
Adds a
Stackcomponent to the new@wordpress/uipackage, a formalization of the ideas previously explored in experimental components (HStackand friends), extended to use design system spacing tokens and density configuration.Builds on #73215
Why?
Modalcomponent #72336 (comment)).How?
dimension.gap.flow.[x-small|small|medium|large])gapto tie to design system tokens, either numeric multiplier of base spacing (4px) or as a semantic token ('small', etc.)BoxTesting Instructions
Verify in Storybook:
npm run storybook:devScreenshots or screencast
stack.mov