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 slots in the mobile and desktop wrappers instead of XXXComponent and XXXProps #6381

Merged
merged 26 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ export default function PaperContentComponent() {
</React.Fragment>
)}
components={{ PaperContent: RangeShortcutsPanel }}
PaperProps={{ sx: { display: 'flex', flexDirection: 'row' } }}
componentsProps={{ paperContent: { setValue } }}
componentsProps={{
desktopPaper: { sx: { display: 'flex', flexDirection: 'row' } },
paperContent: { setValue },
}}
/>
<StaticDateRangePicker
displayStaticWrapperAs="desktop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,10 @@ export default function PaperContentComponent() {
</React.Fragment>
)}
components={{ PaperContent: RangeShortcutsPanel }}
PaperProps={{ sx: { display: 'flex', flexDirection: 'row' } }}
componentsProps={{ paperContent: { setValue } }}
componentsProps={{
desktopPaper: { sx: { display: 'flex', flexDirection: 'row' } },
paperContent: { setValue },
}}
/>
<StaticDateRangePicker
displayStaticWrapperAs="desktop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ In the example below, the actions are the same as in the section above, but they

## Paper content

The paper content is available on all desktop picker components.
The paper content is available on all desktop and static picker components.
It adds a flexible way to extend what is rendered in the picker paper.

You can provide any custom component to this slot as long as it passes `children` down maintaining original picker behavior.
Expand Down
17 changes: 13 additions & 4 deletions docs/pages/x/api/date-pickers/date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"type": { "name": "string" },
"default": "'@media (pointer: fine)'"
},
"DialogProps": { "type": { "name": "object" } },
"disabled": { "type": { "name": "bool" } },
"disableFuture": { "type": { "name": "bool" } },
"disableHighlightToday": { "type": { "name": "bool" } },
Expand Down Expand Up @@ -62,8 +61,6 @@
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
},
"PaperProps": { "type": { "name": "object" } },
"PopperProps": { "type": { "name": "object" } },
"readOnly": { "type": { "name": "bool" } },
"reduceAnimations": {
"type": { "name": "bool" },
Expand All @@ -89,7 +86,6 @@
"toolbarFormat": { "type": { "name": "string" } },
"toolbarPlaceholder": { "type": { "name": "node" }, "default": "'–'" },
"toolbarTitle": { "type": { "name": "node" }, "default": "'Select date'" },
"TransitionComponent": { "type": { "name": "elementType" } },
"value": { "type": { "name": "any" } },
"views": {
"type": {
Expand All @@ -102,10 +98,23 @@
"slots": {
"ActionBar": { "default": "PickersActionBar", "type": { "name": "elementType" } },
"Day": { "default": "PickersDay", "type": { "name": "elementType" } },
"DesktopPaper": { "default": "PickersPopperPaper", "type": { "name": "elementType" } },
"DesktopTransition": {
"default": "Grow from @mui/material",
"type": { "name": "elementType" }
},
"DesktopTrapFocus": {
"default": "TrapFocus from @mui/material",
"type": { "name": "elementType" }
},
"Dialog": { "default": "PickersModalDialogRoot", "type": { "name": "elementType" } },
"LeftArrowIcon": { "default": "ArrowLeft", "type": { "name": "elementType" } },
"MobilePaper": { "default": "Paper from @mui/material", "type": { "name": "elementType" } },
"MobileTransition": { "default": "Fade from @mui/material", "type": { "name": "elementType" } },
"NextIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"OpenPickerIcon": { "default": "Calendar or Clock", "type": { "name": "elementType" } },
"PaperContent": { "default": "React.Fragment", "type": { "name": "elementType" } },
"Popper": { "default": "Popper from @mui/material", "type": { "name": "elementType" } },
"PreviousIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"RightArrowIcon": { "default": "ArrowRight", "type": { "name": "elementType" } },
"SwitchViewButton": { "default": "IconButton", "type": { "name": "elementType" } },
Expand Down
19 changes: 14 additions & 5 deletions docs/pages/x/api/date-pickers/date-range-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"type": { "name": "string" },
"default": "'@media (pointer: fine)'"
},
"DialogProps": { "type": { "name": "object" } },
"disableAutoMonthSwitching": { "type": { "name": "bool" } },
"disabled": { "type": { "name": "bool" } },
"disableFuture": { "type": { "name": "bool" } },
Expand Down Expand Up @@ -57,8 +56,6 @@
"onViewChange": { "type": { "name": "func" } },
"open": { "type": { "name": "bool" } },
"OpenPickerButtonProps": { "type": { "name": "object" } },
"PaperProps": { "type": { "name": "object" } },
"PopperProps": { "type": { "name": "object" } },
"readOnly": { "type": { "name": "bool" } },
"reduceAnimations": {
"type": { "name": "bool" },
Expand All @@ -81,16 +78,28 @@
}
},
"toolbarFormat": { "type": { "name": "string" } },
"toolbarTitle": { "type": { "name": "node" }, "default": "'Select date range'" },
"TransitionComponent": { "type": { "name": "elementType" } }
"toolbarTitle": { "type": { "name": "node" }, "default": "'Select date range'" }
},
"slots": {
"ActionBar": { "default": "PickersActionBar", "type": { "name": "elementType" } },
"Day": { "default": "DateRangePickersDay", "type": { "name": "elementType" } },
"DesktopPaper": { "default": "PickersPopperPaper", "type": { "name": "elementType" } },
"DesktopTransition": {
"default": "Grow from @mui/material",
"type": { "name": "elementType" }
},
"DesktopTrapFocus": {
"default": "TrapFocus from @mui/material",
"type": { "name": "elementType" }
},
"Dialog": { "default": "PickersModalDialogRoot", "type": { "name": "elementType" } },
"LeftArrowIcon": { "default": "ArrowLeft", "type": { "name": "elementType" } },
"MobilePaper": { "default": "Paper from @mui/material", "type": { "name": "elementType" } },
"MobileTransition": { "default": "Fade from @mui/material", "type": { "name": "elementType" } },
"NextIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"OpenPickerIcon": { "default": "Calendar or Clock", "type": { "name": "elementType" } },
"PaperContent": { "default": "React.Fragment", "type": { "name": "elementType" } },
"Popper": { "default": "Popper from @mui/material", "type": { "name": "elementType" } },
"PreviousIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"RightArrowIcon": { "default": "ArrowRight", "type": { "name": "elementType" } },
"SwitchViewButton": { "default": "IconButton", "type": { "name": "elementType" } },
Expand Down
17 changes: 13 additions & 4 deletions docs/pages/x/api/date-pickers/date-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"type": { "name": "string" },
"default": "'@media (pointer: fine)'"
},
"DialogProps": { "type": { "name": "object" } },
"disabled": { "type": { "name": "bool" } },
"disableFuture": { "type": { "name": "bool" } },
"disableHighlightToday": { "type": { "name": "bool" } },
Expand Down Expand Up @@ -72,8 +71,6 @@
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
},
"PaperProps": { "type": { "name": "object" } },
"PopperProps": { "type": { "name": "object" } },
"readOnly": { "type": { "name": "bool" } },
"reduceAnimations": {
"type": { "name": "bool" },
Expand Down Expand Up @@ -101,7 +98,6 @@
"toolbarFormat": { "type": { "name": "string" } },
"toolbarPlaceholder": { "type": { "name": "node" }, "default": "'–'" },
"toolbarTitle": { "type": { "name": "node" }, "default": "'Select date & time'" },
"TransitionComponent": { "type": { "name": "elementType" } },
"value": { "type": { "name": "any" } },
"views": {
"type": {
Expand All @@ -114,10 +110,23 @@
"slots": {
"ActionBar": { "default": "PickersActionBar", "type": { "name": "elementType" } },
"Day": { "default": "PickersDay", "type": { "name": "elementType" } },
"DesktopPaper": { "default": "PickersPopperPaper", "type": { "name": "elementType" } },
"DesktopTransition": {
"default": "Grow from @mui/material",
"type": { "name": "elementType" }
},
"DesktopTrapFocus": {
"default": "TrapFocus from @mui/material",
"type": { "name": "elementType" }
},
"Dialog": { "default": "PickersModalDialogRoot", "type": { "name": "elementType" } },
"LeftArrowIcon": { "default": "ArrowLeft", "type": { "name": "elementType" } },
"MobilePaper": { "default": "Paper from @mui/material", "type": { "name": "elementType" } },
"MobileTransition": { "default": "Fade from @mui/material", "type": { "name": "elementType" } },
"NextIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"OpenPickerIcon": { "default": "Calendar or Clock", "type": { "name": "elementType" } },
"PaperContent": { "default": "React.Fragment", "type": { "name": "elementType" } },
"Popper": { "default": "Popper from @mui/material", "type": { "name": "elementType" } },
"PreviousIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"RightArrowIcon": { "default": "ArrowRight", "type": { "name": "elementType" } },
"SwitchViewButton": { "default": "IconButton", "type": { "name": "elementType" } },
Expand Down
13 changes: 10 additions & 3 deletions docs/pages/x/api/date-pickers/desktop-date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
},
"PaperProps": { "type": { "name": "object" } },
"PopperProps": { "type": { "name": "object" } },
"readOnly": { "type": { "name": "bool" } },
"reduceAnimations": {
"type": { "name": "bool" },
Expand All @@ -84,7 +82,6 @@
"toolbarFormat": { "type": { "name": "string" } },
"toolbarPlaceholder": { "type": { "name": "node" }, "default": "'–'" },
"toolbarTitle": { "type": { "name": "node" }, "default": "'Select date'" },
"TransitionComponent": { "type": { "name": "elementType" } },
"value": { "type": { "name": "any" } },
"views": {
"type": {
Expand All @@ -97,10 +94,20 @@
"slots": {
"ActionBar": { "default": "PickersActionBar", "type": { "name": "elementType" } },
"Day": { "default": "PickersDay", "type": { "name": "elementType" } },
"DesktopPaper": { "default": "PickersPopperPaper", "type": { "name": "elementType" } },
"DesktopTransition": {
"default": "Grow from @mui/material",
"type": { "name": "elementType" }
},
"DesktopTrapFocus": {
"default": "TrapFocus from @mui/material",
"type": { "name": "elementType" }
},
"LeftArrowIcon": { "default": "ArrowLeft", "type": { "name": "elementType" } },
"NextIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"OpenPickerIcon": { "default": "Calendar or Clock", "type": { "name": "elementType" } },
"PaperContent": { "default": "React.Fragment", "type": { "name": "elementType" } },
"Popper": { "default": "Popper from @mui/material", "type": { "name": "elementType" } },
"PreviousIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"RightArrowIcon": { "default": "ArrowRight", "type": { "name": "elementType" } },
"SwitchViewButton": { "default": "IconButton", "type": { "name": "elementType" } },
Expand Down
15 changes: 11 additions & 4 deletions docs/pages/x/api/date-pickers/desktop-date-range-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
"onViewChange": { "type": { "name": "func" } },
"open": { "type": { "name": "bool" } },
"OpenPickerButtonProps": { "type": { "name": "object" } },
"PaperProps": { "type": { "name": "object" } },
"PopperProps": { "type": { "name": "object" } },
"readOnly": { "type": { "name": "bool" } },
"reduceAnimations": {
"type": { "name": "bool" },
Expand All @@ -76,16 +74,25 @@
}
},
"toolbarFormat": { "type": { "name": "string" } },
"toolbarTitle": { "type": { "name": "node" }, "default": "'Select date range'" },
"TransitionComponent": { "type": { "name": "elementType" } }
"toolbarTitle": { "type": { "name": "node" }, "default": "'Select date range'" }
},
"slots": {
"ActionBar": { "default": "PickersActionBar", "type": { "name": "elementType" } },
"Day": { "default": "DateRangePickersDay", "type": { "name": "elementType" } },
"DesktopPaper": { "default": "PickersPopperPaper", "type": { "name": "elementType" } },
"DesktopTransition": {
"default": "Grow from @mui/material",
"type": { "name": "elementType" }
},
"DesktopTrapFocus": {
"default": "TrapFocus from @mui/material",
"type": { "name": "elementType" }
},
"LeftArrowIcon": { "default": "ArrowLeft", "type": { "name": "elementType" } },
"NextIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"OpenPickerIcon": { "default": "Calendar or Clock", "type": { "name": "elementType" } },
"PaperContent": { "default": "React.Fragment", "type": { "name": "elementType" } },
"Popper": { "default": "Popper from @mui/material", "type": { "name": "elementType" } },
"PreviousIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"RightArrowIcon": { "default": "ArrowRight", "type": { "name": "elementType" } },
"SwitchViewButton": { "default": "IconButton", "type": { "name": "elementType" } },
Expand Down
13 changes: 10 additions & 3 deletions docs/pages/x/api/date-pickers/desktop-date-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
},
"PaperProps": { "type": { "name": "object" } },
"PopperProps": { "type": { "name": "object" } },
"readOnly": { "type": { "name": "bool" } },
"reduceAnimations": {
"type": { "name": "bool" },
Expand Down Expand Up @@ -96,7 +94,6 @@
"toolbarFormat": { "type": { "name": "string" } },
"toolbarPlaceholder": { "type": { "name": "node" }, "default": "'–'" },
"toolbarTitle": { "type": { "name": "node" }, "default": "'Select date & time'" },
"TransitionComponent": { "type": { "name": "elementType" } },
"value": { "type": { "name": "any" } },
"views": {
"type": {
Expand All @@ -109,10 +106,20 @@
"slots": {
"ActionBar": { "default": "PickersActionBar", "type": { "name": "elementType" } },
"Day": { "default": "PickersDay", "type": { "name": "elementType" } },
"DesktopPaper": { "default": "PickersPopperPaper", "type": { "name": "elementType" } },
"DesktopTransition": {
"default": "Grow from @mui/material",
"type": { "name": "elementType" }
},
"DesktopTrapFocus": {
"default": "TrapFocus from @mui/material",
"type": { "name": "elementType" }
},
"LeftArrowIcon": { "default": "ArrowLeft", "type": { "name": "elementType" } },
"NextIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"OpenPickerIcon": { "default": "Calendar or Clock", "type": { "name": "elementType" } },
"PaperContent": { "default": "React.Fragment", "type": { "name": "elementType" } },
"Popper": { "default": "Popper from @mui/material", "type": { "name": "elementType" } },
"PreviousIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"RightArrowIcon": { "default": "ArrowRight", "type": { "name": "elementType" } },
"SwitchViewButton": { "default": "IconButton", "type": { "name": "elementType" } },
Expand Down
13 changes: 10 additions & 3 deletions docs/pages/x/api/date-pickers/desktop-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,12 @@
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
},
"PaperProps": { "type": { "name": "object" } },
"PopperProps": { "type": { "name": "object" } },
"readOnly": { "type": { "name": "bool" } },
"rifmFormatter": { "type": { "name": "func" } },
"shouldDisableTime": { "type": { "name": "func" } },
"showToolbar": { "type": { "name": "bool" } },
"ToolbarComponent": { "type": { "name": "elementType" }, "default": "TimePickerToolbar" },
"toolbarTitle": { "type": { "name": "node" }, "default": "'Select time'" },
"TransitionComponent": { "type": { "name": "elementType" } },
"value": { "type": { "name": "any" } },
"views": {
"type": {
Expand All @@ -72,10 +69,20 @@
},
"slots": {
"ActionBar": { "default": "PickersActionBar", "type": { "name": "elementType" } },
"DesktopPaper": { "default": "PickersPopperPaper", "type": { "name": "elementType" } },
"DesktopTransition": {
"default": "Grow from @mui/material",
"type": { "name": "elementType" }
},
"DesktopTrapFocus": {
"default": "TrapFocus from @mui/material",
"type": { "name": "elementType" }
},
"LeftArrowIcon": { "default": "ArrowLeft", "type": { "name": "elementType" } },
"NextIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"OpenPickerIcon": { "default": "Calendar or Clock", "type": { "name": "elementType" } },
"PaperContent": { "default": "React.Fragment", "type": { "name": "elementType" } },
"Popper": { "default": "Popper from @mui/material", "type": { "name": "elementType" } },
"PreviousIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"RightArrowIcon": { "default": "ArrowRight", "type": { "name": "elementType" } }
},
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/x/api/date-pickers/mobile-date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"default": "(day) => day.charAt(0).toUpperCase()"
},
"defaultCalendarMonth": { "type": { "name": "any" } },
"DialogProps": { "type": { "name": "object" } },
"disabled": { "type": { "name": "bool" } },
"disableFuture": { "type": { "name": "bool" } },
"disableHighlightToday": { "type": { "name": "bool" } },
Expand Down Expand Up @@ -95,7 +94,10 @@
"slots": {
"ActionBar": { "default": "PickersActionBar", "type": { "name": "elementType" } },
"Day": { "default": "PickersDay", "type": { "name": "elementType" } },
"Dialog": { "default": "PickersModalDialogRoot", "type": { "name": "elementType" } },
"LeftArrowIcon": { "default": "ArrowLeft", "type": { "name": "elementType" } },
"MobilePaper": { "default": "Paper from @mui/material", "type": { "name": "elementType" } },
"MobileTransition": { "default": "Fade from @mui/material", "type": { "name": "elementType" } },
"NextIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"OpenPickerIcon": { "default": "Calendar or Clock", "type": { "name": "elementType" } },
"PreviousIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
Expand Down
4 changes: 3 additions & 1 deletion docs/pages/x/api/date-pickers/mobile-date-range-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"default": "(day) => day.charAt(0).toUpperCase()"
},
"defaultCalendarMonth": { "type": { "name": "any" } },
"DialogProps": { "type": { "name": "object" } },
"disableAutoMonthSwitching": { "type": { "name": "bool" } },
"disabled": { "type": { "name": "bool" } },
"disableFuture": { "type": { "name": "bool" } },
Expand Down Expand Up @@ -80,7 +79,10 @@
"slots": {
"ActionBar": { "default": "PickersActionBar", "type": { "name": "elementType" } },
"Day": { "default": "DateRangePickersDay", "type": { "name": "elementType" } },
"Dialog": { "default": "PickersModalDialogRoot", "type": { "name": "elementType" } },
"LeftArrowIcon": { "default": "ArrowLeft", "type": { "name": "elementType" } },
"MobilePaper": { "default": "Paper from @mui/material", "type": { "name": "elementType" } },
"MobileTransition": { "default": "Fade from @mui/material", "type": { "name": "elementType" } },
"NextIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
"OpenPickerIcon": { "default": "Calendar or Clock", "type": { "name": "elementType" } },
"PreviousIconButton": { "default": "IconButton", "type": { "name": "elementType" } },
Expand Down
Loading