Skip to content
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

[pickers] Move more field props to the context #16278

Merged
merged 28 commits into from
Jan 28, 2025

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jan 21, 2025

This PR moves all the props that comes directly from the props of the pickers and are passed as is to the props of the fields.
It will help with #16175 because most of those props are not available on multi input range fields.

In this PR

Here are the props impacted:

  • className
  • sx
  • inputRef
  • name
  • label
  • ref
  • ownerState (not documented)

Follow up

Here are the props we are still drilling:

@flaviendelangle flaviendelangle added breaking change component: pickers This is the name of the generic UI component, not the React module! labels Jan 21, 2025
@flaviendelangle flaviendelangle self-assigned this Jan 21, 2025
@mui-bot
Copy link

mui-bot commented Jan 21, 2025

@flaviendelangle flaviendelangle marked this pull request as ready for review January 22, 2025 16:24
@flaviendelangle flaviendelangle force-pushed the field-context-ui branch 4 times, most recently from bd4ffba to 765e2a8 Compare January 22, 2025 16:56
]}
className={clsx(className, slotProps?.layout?.className)}
ref={ref}
sx={mergeSx(providerProps.contextValue.rootSx, slotProps?.layout?.sx)}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using the context instead of direct prop access so that every component has the same data flow.
But these weird providerProps.xxx accesses will go away once we have the new structure.

@flaviendelangle flaviendelangle force-pushed the field-context-ui branch 4 times, most recently from f3b236b to 40c8435 Compare January 24, 2025 13:25
docs/data/date-pickers/custom-field/BrowserV7Field.tsx Outdated Show resolved Hide resolved
@@ -486,12 +513,14 @@ If the updated values do not fit your use case, you can [override them](/x/react
formatDensity='spacious'
selectedSections={selectedSections}
onSelectedSectionsChange={onSelectedSectionsChange}
inputRef={inputRef}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did I get this wrong, or should this have a - in front of it to show the diff change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not
This section says that if you really want to still access those props on the field, then you can duplicate what you pass to the picker and also pass it to the field with slotProps.field.
It's clearly not something a lot of people should do

Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 27, 2025
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 27, 2025
@flaviendelangle flaviendelangle merged commit fc3b0b8 into mui:master Jan 28, 2025
18 checks passed
@flaviendelangle flaviendelangle deleted the field-context-ui branch January 28, 2025 06:17
A-s-h-o-k pushed a commit to A-s-h-o-k/mui-x that referenced this pull request Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: pickers This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants