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 the new ownerState object for the clock components and the desktop / mobile wrappers #15669

Merged
merged 4 commits into from
Dec 6, 2024

Conversation

flaviendelangle
Copy link
Member

Part of #14475

@mui-bot
Copy link

mui-bot commented Nov 29, 2024

Deploy preview: https://deploy-preview-15669--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 31048d4

@flaviendelangle flaviendelangle marked this pull request as ready for review November 29, 2024 08:23
@flaviendelangle flaviendelangle changed the title [pickers] Use the new ownerState object for the clock components and the desktop / mobile wrappers [pickers] Use the new ownerState object for the clock components and the desktop / mobile wrappers Nov 29, 2024
const { ownerState: pickerOwnerState } = usePickerPrivateContext();
const ownerState: DigitalClockOwnerState = {
...pickerOwnerState,
hasDigitalClockAlreadyBeenRendered: !!containerRef.current,
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 cleaning the name of this property to keep everything clearly scoped (like isPickerDisabled vs disabled).

/**
* The current meridiem mode of the clock.
*/
clockMeridiemMode: Meridiem | null;
Copy link
Member Author

Choose a reason for hiding this comment

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

Same, I'm correctly scoping isClockDisabled to the clock to distinguish it from isPickerDisabled

@@ -370,7 +379,7 @@ export function Clock(inProps: ClockProps) {
type={type}
viewValue={viewValue}
isInner={isPointerInner}
hasSelected={hasSelected}
isBetweenTwoClockValues={isPointerBetweenTwoClockValues}
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 hasSelected prop name was very unclear to be.
Since it's used in the ownerState of ClockPointer, I added a better name to it.

@@ -63,7 +89,7 @@ const ClockNumberRoot = styled('span', {
},
variants: [
{
props: { inner: true },
props: { isClockNumberInInnerRing: true },
Copy link
Member Author

Choose a reason for hiding this comment

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

Same, inner was very unclear, I made the name more explicit.

@@ -340,10 +342,11 @@ export function PickersPopper(inProps: PickerPopperProps) {
onDismiss,
open,
role,
placement,
placement = 'bottom',
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 applying the default value here to make sure all the slots inside this file get a popperPlacement property.

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.

very nice improvement ... just a small suggestion! 👍🏼

@michelengelen
Copy link
Member

I love the descriptive naming! ❤️

Co-authored-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com>
Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
@flaviendelangle flaviendelangle merged commit 35b3b7e into mui:master Dec 6, 2024
18 checks passed
@flaviendelangle flaviendelangle deleted the ownerState-clock branch December 6, 2024 15:20
LukasTy pushed a commit to LukasTy/mui-x that referenced this pull request Dec 19, 2024
…d the desktop / mobile wrappers (mui#15669)

Signed-off-by: Flavien DELANGLE <flaviendelangle@gmail.com>
Co-authored-by: Michel Engelen <32863416+michelengelen@users.noreply.github.com>
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