feat: space, columns, rows and box grid item deprecation warnings#2182
feat: space, columns, rows and box grid item deprecation warnings#2182pedrobonamin wants to merge 9 commits intomainfrom
space, columns, rows and box grid item deprecation warnings#2182Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces backwards-compatible prop migrations across multiple UI primitives/components by adding new preferred props (gap, gridTemplateColumns, gridTemplateRows) while marking legacy aliases (space, columns, rows) as deprecated for removal in v4, and updates stories/tests to cover the migration behavior.
Changes:
- Add
gapto multiple primitives/components while keeping deprecatedspaceworking, and prefergapwhen both are provided. - Add
gridTemplateColumns/gridTemplateRowstoGridwhile keeping deprecatedcolumns/rows, with precedence to the new props. - Update Storybook argTypes and add focused Jest tests asserting legacy support + new-prop precedence.
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| stories/primitives/TextInput.stories.tsx | Exposes gap control alongside deprecated space. |
| stories/primitives/Stack.stories.tsx | Adds gap control alongside deprecated space. |
| stories/primitives/Select.stories.tsx | Adds gap control alongside deprecated space. |
| stories/primitives/Inline.stories.tsx | Adds gap control alongside deprecated space. |
| stories/primitives/Grid.stories.tsx | Adds controls for new/deprecated Grid template props. |
| stories/primitives/Button.stories.tsx | Adds gap control and includes it in controls list. |
| stories/components/Tree.stories.tsx | Adds gap control alongside deprecated space. |
| stories/components/TabList.stories.tsx | Adds gap control alongside deprecated space. |
| stories/components/MenuItem.stories.tsx | Adds gap control alongside deprecated space. |
| stories/components/Menu.stories.tsx | Adds gap control alongside deprecated space. |
| stories/components/Hotkeys.stories.tsx | Adds gap/space controls for spacing migration. |
| stories/components/Breadcrumbs.stories.tsx | Adds gap control alongside deprecated space. |
| src/core/primitives/types.ts | Deprecates columns/rows and adds gridTemplateColumns/gridTemplateRows to grid prop types. |
| src/core/primitives/textInput/textInput.tsx | Adds gap, deprecates space, and prefers gap when provided. |
| src/core/primitives/textInput/textInput.test.tsx | Tests space/gap equivalence and gap precedence. |
| src/core/primitives/stack/stack.tsx | Adds gap, deprecates space, and prefers gap. |
| src/core/primitives/stack/stack.test.tsx | Tests space/gap equivalence and gap precedence. |
| src/core/primitives/select/select.tsx | Adds gap, deprecates space, and prefers gap. |
| src/core/primitives/select/select.test.tsx | Tests space/gap equivalence and gap precedence. |
| src/core/primitives/inline/inline.tsx | Adds gap, deprecates space, and prefers gap. |
| src/core/primitives/inline/inline.test.tsx | Tests space/gap equivalence and gap precedence. |
| src/core/primitives/grid/grid.tsx | Adds new Grid template props with precedence over deprecated aliases. |
| src/core/primitives/grid/grid.test.tsx | Tests old/new Grid template props + precedence behavior. |
| src/core/primitives/button/button.tsx | Adds gap, deprecates space, and prefers gap for icon/text spacing. |
| src/core/primitives/button/button.test.tsx | Tests space/gap behavior and gap precedence. |
| src/core/components/tree/types.ts | Extends Tree context contract to include gap while deprecating space. |
| src/core/components/tree/treeItem.tsx | Adds gap, deprecates space, and prefers gap for item spacing. |
| src/core/components/tree/treeItem.test.tsx | Tests space/gap behavior and gap precedence for TreeItem. |
| src/core/components/tree/treeGroup.tsx | Switches TreeGroup layout to use context gap. |
| src/core/components/tree/tree.tsx | Adds gap, deprecates space, and forwards gap while keeping context compatibility. |
| src/core/components/tree/tree.test.tsx | Tests Tree space/gap behavior and gap precedence. |
| src/core/components/tab/tabList.test.tsx | Tests gap/space support via Inline styling hook. |
| src/core/components/menu/menuItem.tsx | Adds gap, deprecates space, and prefers gap for item layout. |
| src/core/components/menu/menuItem.spacing.test.tsx | Tests MenuItem space/gap behavior and gap precedence. |
| src/core/components/menu/menuGroup.tsx | Adds gap, deprecates space, and prefers gap for group layout. |
| src/core/components/menu/menuGroup.spacing.test.tsx | Tests MenuGroup space/gap behavior and gap precedence. |
| src/core/components/menu/menu.tsx | Adds gap, deprecates space, and prefers gap when rendering Stack. |
| src/core/components/menu/menu.spacing.test.tsx | Tests Menu space/gap behavior and gap precedence. |
| src/core/components/hotkeys/hotkeys.tsx | Adds gap, deprecates space, and prefers gap when rendering Inline. |
| src/core/components/hotkeys/hotkeys.test.tsx | Tests Hotkeys space/gap behavior and gap precedence. |
| src/core/components/breadcrumbs/breadcrumbs.tsx | Adds gap, deprecates space, and uses gap when rendering stacked overflow list. |
| src/core/components/breadcrumbs/breadcrumbs.test.tsx | Tests Breadcrumbs space/gap behavior and gap precedence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR introduces a backwards-compatible spacing migration across primitives/components (space → preferred gap) and updates Grid to prefer gridTemplateColumns/gridTemplateRows over deprecated columns/rows, with Storybook updates and focused migration tests.
Changes:
- Add
gapprops (preferred) while keeping deprecatedspaceacross multiple primitives/components, plus corresponding Storybook controls. - Add
gridTemplateColumns/gridTemplateRowstoGrid(preferred) while retaining deprecatedcolumns/rowswith precedence to the new props. - Add focused Jest tests to validate legacy support + new prop precedence.
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| stories/primitives/TextInput.stories.tsx | Adds gap control alongside existing space. |
| stories/primitives/Stack.stories.tsx | Adds gap control alongside existing space. |
| stories/primitives/Select.stories.tsx | Adds gap control alongside existing space. |
| stories/primitives/Inline.stories.tsx | Adds gap control alongside existing space. |
| stories/primitives/Grid.stories.tsx | Adds controls for deprecated columns/rows and preferred gridTemplateColumns/gridTemplateRows. |
| stories/primitives/Button.stories.tsx | Adds gap control and includes gap in the WithIcons control include list. |
| stories/components/Tree.stories.tsx | Adds gap control alongside existing space. |
| stories/components/TabList.stories.tsx | Adds gap control alongside existing space. |
| stories/components/MenuItem.stories.tsx | Adds gap control alongside existing space. |
| stories/components/Menu.stories.tsx | Adds gap control alongside existing space. |
| stories/components/Hotkeys.stories.tsx | Adds gap/space argTypes and imports getSpaceControls. |
| stories/components/Breadcrumbs.stories.tsx | Adds gap control alongside existing space. |
| src/core/primitives/types.ts | Deprecates columns/rows and adds preferred gridTemplateColumns/gridTemplateRows to ResponsiveGridProps. |
| src/core/primitives/textInput/textInput.tsx | Adds gap prop, deprecates space, and prefers gap when both are provided. |
| src/core/primitives/textInput/textInput.test.tsx | Adds migration tests for space/gap behavior and precedence. |
| src/core/primitives/stack/stack.tsx | Adds gap prop, deprecates space, and prefers gap. |
| src/core/primitives/stack/stack.test.tsx | Adds migration tests for space/gap behavior and precedence. |
| src/core/primitives/select/select.tsx | Adds gap prop, deprecates space, and prefers gap. |
| src/core/primitives/select/select.test.tsx | Adds migration tests for space/gap behavior and precedence. |
| src/core/primitives/inline/inline.tsx | Adds gap prop, deprecates space, and prefers gap. |
| src/core/primitives/inline/inline.test.tsx | Adds migration tests for space/gap behavior and precedence. |
| src/core/primitives/grid/grid.tsx | Adds preferred gridTemplateColumns/gridTemplateRows with precedence over deprecated columns/rows. |
| src/core/primitives/grid/grid.test.tsx | Adds tests validating legacy aliases + new prop precedence. |
| src/core/primitives/button/button.tsx | Adds gap prop, deprecates space, and maps to Flex gap with precedence to gap. |
| src/core/primitives/button/button.test.tsx | Adds tests for space support, gap support, and precedence. |
| src/core/components/tree/types.ts | Extends Tree context contract with gap while keeping deprecated space. |
| src/core/components/tree/treeItem.tsx | Adds gap prop, deprecates space, and prefers gap for icon spacing. |
| src/core/components/tree/treeItem.test.tsx | Adds tests validating space/gap behavior and precedence for TreeItem spacing. |
| src/core/components/tree/treeGroup.tsx | Switches TreeGroup spacing usage to tree.gap. |
| src/core/components/tree/tree.tsx | Adds gap prop, deprecates space, updates context + Stack usage to prefer gap. |
| src/core/components/tree/tree.test.tsx | Adds tests validating Tree space/gap behavior and precedence. |
| src/core/components/tab/tabList.test.tsx | Adds tests validating TabList space/gap behavior and precedence. |
| src/core/components/menu/menuItem.tsx | Adds gap prop, deprecates space, and prefers gap for internal Flex gap. |
| src/core/components/menu/menuItem.spacing.test.tsx | Adds tests validating MenuItem space/gap behavior and precedence. |
| src/core/components/menu/menuGroup.tsx | Adds gap prop, deprecates space, and prefers gap for internal Flex gap. |
| src/core/components/menu/menuGroup.spacing.test.tsx | Adds tests validating MenuGroup space/gap behavior and precedence. |
| src/core/components/menu/menu.tsx | Adds gap prop, deprecates space, and prefers gap when rendering internal Stack. |
| src/core/components/menu/menu.spacing.test.tsx | Adds tests validating Menu space/gap behavior and precedence. |
| src/core/components/hotkeys/hotkeys.tsx | Adds gap prop, deprecates space, and prefers gap when passing spacing to Inline. |
| src/core/components/hotkeys/hotkeys.test.tsx | Adds tests validating Hotkeys space/gap behavior and precedence. |
| src/core/components/breadcrumbs/breadcrumbs.tsx | Adds gap prop, deprecates space, and prefers gap when spacing the overflow menu list. |
| src/core/components/breadcrumbs/breadcrumbs.test.tsx | Adds tests validating Breadcrumbs space/gap behavior and precedence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
|
@pedrobonamin I've opened a new pull request, #2183, to work on those changes. Once the pull request is ready, I'll request review from you. |
space, columns, rows deprecation warnings
* fix: reset mocks between renders in spacing migration tests Co-authored-by: pedrobonamin <46196328+pedrobonamin@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pedrobonamin <46196328+pedrobonamin@users.noreply.github.com>
stipsan
left a comment
There was a problem hiding this comment.
Thanks for this! It'll help the migration to v4 for sure 💖
| import {Box} from '../../primitives' | ||
| import {Breadcrumbs} from './breadcrumbs' | ||
|
|
||
| jest.mock('../../primitives', () => { |
There was a problem hiding this comment.
Oh my goodness, I forgot this repo still uses jest 😧
space, columns, rows deprecation warningsspace, columns, rows and box grid item deprecation warnings
Description
Gridtemplate props: gridTemplateColumns/gridTemplateRows now preferred over deprecated columns/rows (with precedence to new props).This will help us have a smaller footprint one we are ready to migrate sanity monorepo to ui v4 or v5, most of the changes in the migration PR are related to this props renames. If we do that before the migration it will help us reduce the noise in the migration PR.
It will also help prepare users for the migration, by doing this change they can start updating the props for when we finally migrate the studio.
What Changed
Spacing migration (
space->gap, with backward compatibility)Updated these APIs to accept both props and prefer
gap:Inline,Stack,Button,TextInput,SelectTabList(viaInlineProps),Menu,MenuItem,MenuGroup,Hotkeys,Breadcrumbs,Tree,TreeItemgapwhile retaining deprecatedspaceAll affected
spaceprops are now documented as deprecated (v4 removal).Grid migration (
columns/rows->gridTemplateColumns/gridTemplateRows)gridTemplateColumnsgridTemplateRowscolumnsrowsgridTemplateColumns ?? columnsgridTemplateRows ?? rowsDeprecates box grid item props
columnforgridColumnand equivalents.Test strategy
What to review
Is the deprecation warning ok?
Testing