-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Simplify the API of the field hooks #11371
Conversation
import { TextFieldProps } from '@mui/material/TextField'; | ||
import { UseFieldResponse } from './useField'; | ||
|
||
export const useConvertFieldResponseIntoMuiTextFieldProps = < |
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.
With #10649 this will convert either to the MuiTextField
or PickersTextField
format.
useClearableField
Deploy preview: https://deploy-preview-11371--material-ui-x.netlify.app/ Updated pages: |
useClearableField
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
packages/x-date-pickers-pro/src/MultiInputDateRangeField/MultiInputDateRangeField.tsx
Outdated
Show resolved
Hide resolved
40b549f
to
d3a1866
Compare
d3a1866
to
6289e28
Compare
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.
Looks good 👍
:::success | ||
The following breaking changes only impact you if you are using hooks like `useDateField` to build a custom UI. | ||
|
||
If you are just using the regular field components, then you can safely skip this section. |
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.
Just an idea when reading it: differences betweeen sections/subsection is not always super clear. This could be a helper. Maybe better to add that kind of stuff after the first stable, when the migration guide structure will stop moving.
If you are just using the regular field components, then you can safely skip this section. | |
If you are just using the regular field components, then you can safely [skip this section](#date-management). |
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.
That's a nice idea
Maybe we can do it on the whole migration guide at the end of the alpha to make sure we don't have outdated things
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
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.
This is a really nice improvement! 💯
Looks much cleaner! 💙
@@ -28,7 +25,7 @@ type DateRangeFieldComponent = (<TDate>( | |||
*/ | |||
const SingleInputDateRangeField = React.forwardRef(function SingleInputDateRangeField<TDate>( | |||
inProps: SingleInputDateRangeFieldProps<TDate>, | |||
ref: React.Ref<HTMLDivElement>, | |||
inRef: React.Ref<HTMLDivElement>, |
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.
Nitpick: Was there a need to rename the prop? I can't see a naming conflict anywhere. 🙈
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.
No indeed, I forgot to remove it 😬
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.
👌 Just confirming that this is probably the case in most if not all field components. 😉
Extracted from #10649
You can have a look at the migration guide for more information