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] Use usePickerContext() and usePickerActionsContext() to get the actions in the actionBar slot and in internal components #15843

Merged
merged 13 commits into from
Dec 19, 2024

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Dec 11, 2024

Part of #15495
Part of #16059

What?

  • Use setView instead of onOpen and onClose on all the internal components
  • Create a new usePickerActionsContext() to get the actions from the slots
  • Use usePickerActionsContext() in all the slots (and remove the props)

Why?

  • Prepare for composition

@flaviendelangle flaviendelangle added breaking change component: pickers This is the name of the generic UI component, not the React module! labels Dec 11, 2024
@mui-bot
Copy link

mui-bot commented Dec 11, 2024

/**
* Closes the picker and accepts the current value if it is not equal to the last accepted value.
*/
dismissViews: () => void;
Copy link
Member Author

@flaviendelangle flaviendelangle Dec 11, 2024

Choose a reason for hiding this comment

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

I would love to get rid of this method 😬

It was never used in a public component but was part of the public API since it was passed to PickersLayout ( 🤦 ).
I'm making it private so we can modify it, remove it in the future.

*/
open: boolean;
clearValue: () => void;
Copy link
Member Author

Choose a reason for hiding this comment

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

The main thing I would like to discuss is the naming of those methods.

I tried to be consistent with setOpen (vs onOpen / onClose).

@flaviendelangle flaviendelangle self-assigned this Dec 11, 2024
… the actions in the actionBar slot and in internal components
@flaviendelangle flaviendelangle changed the title [pickers] Use usePickerContext() and usePickerActionsContext() to get the actions in the actionBar slot and in internal components [pickers] Use usePickerContext() and usePickerActionsContext() to get the actions in the actionBar slot and in internal components Dec 13, 2024
Copy link
Member

@michelengelen michelengelen left a comment

Choose a reason for hiding this comment

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

nothing blocking here as well ... LGTM

@flaviendelangle flaviendelangle merged commit 9a8aa05 into mui:master Dec 19, 2024
16 checks passed
@flaviendelangle flaviendelangle deleted the actions-context branch December 19, 2024 15:59
lauri865 pushed a commit to lauri865/mui-x that referenced this pull request Dec 20, 2024
… get the actions in the `actionBar` slot and in internal components (mui#15843)

Signed-off-by: Flavien DELANGLE <[email protected]>
Co-authored-by: Michel Engelen <[email protected]>
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