[pickers] Use the new `ownerState` in `DateCalendar`, `DateRangeCalendar`, `MonthCalendar` and `YearCalendar`
Part of #14475
Another day, another PR for the ownerState :laughing: , now that we have the context it's easy to migrate the slots piece by piece.
I did not change the ownerState passed to the styleOverrides of PickersDay and its range counterpart because I want @noraleonte DX proposal before. But IMHO this ownerState should eventually be 100% identical to the one passed to slots.day.
Changes
Changes on usePickersPrivateContext
- Does not crash when used outside of a picker (instead we have a default
ownerStateobject with everything marked asfalse. Alternatively I could update theownerStatein the views to bePickerOwnerState | {}orPartial<PickerOwnerState>but I think the default value is easier to work with.
Updated slots
I only added the selected and disabled properties to the day, month and year ownerState because they are often needed to build our classes and I think it's nice being consistent between the three.
I can add month and year objets to match day if you think it's useful. day is used in DateRangeCalendar so I need to have it.
-
day:PickerOwnerState & { day: TDate, isDaySelected: boolean, isDayDisabled: boolean } -
monthButton: PickerOwnerState & { isMonthSelected: boolean, isMonthDisabled: boolean } -
yearButton: PickerOwnerState & { isYearSelected: boolean, isYearDisabled: boolean } -
calendarHeader: PickerOwnerState
Deploy preview: https://deploy-preview-15171--material-ui-x.netlify.app/
Generated by :no_entry_sign: dangerJS against 322686338d0b086035b2d984391e947bccc25833
This pull request has conflicts, please resolve those before we can evaluate the pull request.
This pull request has conflicts, please resolve those before we can evaluate the pull request.