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] Simplify the API of the field hooks #11371

Merged
merged 9 commits into from
Dec 13, 2023

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Dec 11, 2023

Extracted from #10649

You can have a look at the migration guide for more information

@flaviendelangle flaviendelangle self-assigned this Dec 11, 2023
@flaviendelangle flaviendelangle added component: pickers This is the name of the generic UI component, not the React module! breaking change labels Dec 11, 2023
import { TextFieldProps } from '@mui/material/TextField';
import { UseFieldResponse } from './useField';

export const useConvertFieldResponseIntoMuiTextFieldProps = <
Copy link
Member Author

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.

@flaviendelangle flaviendelangle changed the title [pickers] Simplify the usage of useClearableField [pickers] Simplify the usage of useClearableField Dec 11, 2023
@mui-bot
Copy link

mui-bot commented Dec 11, 2023

@flaviendelangle flaviendelangle changed the title [pickers] Simplify the usage of useClearableField [pickers] Simplify the API of the field hooks Dec 11, 2023
@flaviendelangle flaviendelangle marked this pull request as ready for review December 11, 2023 12:02
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 11, 2023
Copy link

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

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 11, 2023
flaviendelangle added a commit to flaviendelangle/mui-x that referenced this pull request Dec 12, 2023
Copy link
Member

@alexfauquette alexfauquette left a 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.
Copy link
Member

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.

Suggested change
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).

Copy link
Member Author

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

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 13, 2023
Copy link

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

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 13, 2023
@flaviendelangle flaviendelangle merged commit c85d38b into mui:next Dec 13, 2023
2 checks passed
@flaviendelangle flaviendelangle deleted the clearable-cleanup branch December 13, 2023 10:21
Copy link
Member

@LukasTy LukasTy left a 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>,
Copy link
Member

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. 🙈

Copy link
Member Author

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 😬

Copy link
Member

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. 😉

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.

4 participants