-
-
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] Use the new ownerState
in usePickersLayout
and useXXXPicker
#14994
[pickers] Use the new ownerState
in usePickersLayout
and useXXXPicker
#14994
Conversation
Deploy preview: https://deploy-preview-14994--material-ui-x.netlify.app/ |
68cfb79
to
17806c3
Compare
wrapperVariant: WrapperVariant; | ||
isLandscape: boolean; |
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.
We could move those two variables to PickerOwnerState
(they are available at the usePicker
level).
But not sure how much isLandscape
makes sense to be accessible everywhere.
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.
We can always do that if we see a need, but IMHO, it would be nice to avoid optional parameters, which might never be defined if someone is not using a Static Picker. 🤷 🤔
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.
which might never be defined if someone is not using a Static Picker.
We could just set it to "desktop" on the destkop picker and "mobile" on the mobile picker.
But I agree, let's wait for an actual need 👍
packages/x-date-pickers/src/internals/components/PickersProvider.tsx
Outdated
Show resolved
Hide resolved
17806c3
to
625d829
Compare
…shortcuts and slots.toolbar
625d829
to
e37a166
Compare
field
, actionBar
, shortcuts
and toolbar
slotsownerState
for the field
, actionBar
, shortcuts
and toolbar
slots
ownerState
for the field
, actionBar
, shortcuts
and toolbar
slotsownerState
for the field
, inputAdornment
, openPickerButton
, actionBar
, shortcuts
and toolbar
slots
ownerState
for the field
, inputAdornment
, openPickerButton
, actionBar
, shortcuts
and toolbar
slotsownerState
for the slots handled by usePickersLayout
and useXXXPicker
ownerState
for the slots handled by usePickersLayout
and useXXXPicker
ownerState
in usePickersLayout
and useXXXPicker
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.
Very nice typing and usage improvement! 💙 💯 👏
wrapperVariant: WrapperVariant; | ||
isLandscape: boolean; |
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.
We can always do that if we see a need, but IMHO, it would be nice to avoid optional parameters, which might never be defined if someone is not using a Static Picker. 🤷 🤔
packages/x-date-pickers/src/internals/hooks/usePickersPrivateContext.ts
Outdated
Show resolved
Hide resolved
packages/x-date-pickers/src/internals/hooks/usePicker/usePickerProvider.ts
Show resolved
Hide resolved
…ontext.ts Co-authored-by: Lukas Tyla <[email protected]> Signed-off-by: Flavien DELANGLE <[email protected]>
…nerState-layout-field
Part of #14475