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] Remove orientation, isLandscape, isRtl, wrapperVariant and disabled props from PickersLayout #15494

Merged

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Nov 19, 2024

Part of #15495

Extracted from #15300
Follow up on #15492

@flaviendelangle flaviendelangle added breaking change component: pickers This is the name of the generic UI component, not the React module! labels Nov 19, 2024
@flaviendelangle flaviendelangle self-assigned this Nov 19, 2024
@flaviendelangle flaviendelangle force-pushed the remove-usePickerLayoutProps branch 3 times, most recently from 04fa74d to e5d2772 Compare November 19, 2024 17:38
@@ -34,8 +34,8 @@ You can override the actions displayed by passing the `actions` prop to the `act
actions: ['clear'],
},
// The actions will be different between desktop and mobile
actionBar: ({ wrapperVariant }) => ({
actions: wrapperVariant === 'desktop' ? [] : ['clear'],
actionBar: ({ variant }) => ({
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 will try to write a first migration guide for the new ownerState now that we migrated a good portion of the components.

This will be done in a follow up 👍

</LocalizationProvider>
<iframe
title="codesandbox"
src="https://codesandbox.io/embed/https-mui-com-x-migration-migration-pickers-v7-forked-9fz6f6?hidenavigation=1&fontsize=14&view=preview"
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 breaking APIs that were used in the demo, and we want this demo to still use only v6 API,s not v8 APIs.

The layout is not great
It's the same as in https://mui.com/x/migration/migration-data-grid-v4/#using-mui-core-v4-with-v5 and since it's an old migration guide I think it's sufficient

Copy link
Contributor

Choose a reason for hiding this comment

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

This feels fine to me 👌

@@ -276,6 +289,48 @@ const theme = createTheme({
+console.log(readOnly);
```

- The component passed to the `layout` slot no longer receives a `isRtl` prop. If you need to access this information, you can use the `useRtl` hook from `@mui/system`:
Copy link
Member Author

Choose a reason for hiding this comment

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

Alternatively I can suggest to use ownerState.isRtl but I think that's not great.
In any case, probably nobody uses this prop...


const classes = useUtilityClasses(props);
const classes = useUtilityClasses(classesProp, ownerState);
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's weird that we are resolving the props both in usePickerLayout and in PickersLayout
But I won't fix that now since we will probably rework the whole DX

@@ -90,7 +82,10 @@ export const usePicker = <
shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,

// Picker layout
layoutProps: pickerLayoutResponse.layoutProps,
layoutProps: {
Copy link
Member Author

@flaviendelangle flaviendelangle Nov 19, 2024

Choose a reason for hiding this comment

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

I will do a follow up to remove those props as well 😆
Most of them are forwarded directly to the slots handled by the layout so I will probably edit those slots first.

But the goal to have PickersLayout receive 0 prop outside of slotProps.layout is clearly achievable 👌
And it should be doable as well for all the slots it handles but potentially with better DX evolution so I don't think it will be done for v8 and it might require a deprecation phase.

@flaviendelangle flaviendelangle marked this pull request as ready for review November 19, 2024 18:23
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 Nov 21, 2024
Copy link
Contributor

@noraleonte noraleonte left a comment

Choose a reason for hiding this comment

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

Nice improvement, LGTM👌 🚀

</LocalizationProvider>
<iframe
title="codesandbox"
src="https://codesandbox.io/embed/https-mui-com-x-migration-migration-pickers-v7-forked-9fz6f6?hidenavigation=1&fontsize=14&view=preview"
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels fine to me 👌

@flaviendelangle flaviendelangle merged commit 21195d4 into mui:master Nov 26, 2024
18 checks passed
@flaviendelangle flaviendelangle deleted the remove-usePickerLayoutProps branch November 26, 2024 08:07
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