Skip to content

Commit

Permalink
[pickers] Add warning when openTo is invalid based on available `vi…
Browse files Browse the repository at this point in the history
…ews` (#6042)

* Improve `openTo` and `views` JSDoc
  • Loading branch information
LukasTy committed Sep 7, 2022
1 parent 7e3c97a commit 1cd7728
Show file tree
Hide file tree
Showing 67 changed files with 152 additions and 60 deletions.
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"type": {
"name": "enum",
"description": "'day'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'year'"
}
},
"default": "'day'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand Down Expand Up @@ -95,7 +96,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'day'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'year'&gt;"
}
},
"default": "['year', 'day']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/date-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"type": {
"name": "enum",
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
}
},
"default": "'day'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand Down Expand Up @@ -113,7 +114,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'&gt;"
}
},
"default": "['year', 'day', 'hours', 'minutes']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/desktop-date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"type": {
"name": "enum",
"description": "'day'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'year'"
}
},
"default": "'day'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand Down Expand Up @@ -90,7 +91,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'day'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'year'&gt;"
}
},
"default": "['year', 'day']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/desktop-date-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"type": {
"name": "enum",
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
}
},
"default": "'day'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand Down Expand Up @@ -108,7 +109,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'&gt;"
}
},
"default": "['year', 'day', 'hours', 'minutes']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/desktop-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"type": {
"name": "enum",
"description": "'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'seconds'"
}
},
"default": "'hours'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand All @@ -68,7 +69,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'seconds'&gt;"
}
},
"default": "['hours', 'minutes']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/mobile-date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"type": {
"name": "enum",
"description": "'day'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'year'"
}
},
"default": "'day'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand Down Expand Up @@ -88,7 +89,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'day'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'year'&gt;"
}
},
"default": "['year', 'day']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/mobile-date-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"type": {
"name": "enum",
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
}
},
"default": "'day'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand Down Expand Up @@ -106,7 +107,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'&gt;"
}
},
"default": "['year', 'day', 'hours', 'minutes']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/mobile-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"type": {
"name": "enum",
"description": "'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'seconds'"
}
},
"default": "'hours'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand All @@ -66,7 +67,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'seconds'&gt;"
}
},
"default": "['hours', 'minutes']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/static-date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"type": {
"name": "enum",
"description": "'day'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'year'"
}
},
"default": "'day'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand Down Expand Up @@ -88,7 +89,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'day'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'year'&gt;"
}
},
"default": "['year', 'day']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/static-date-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"type": {
"name": "enum",
"description": "'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'"
}
},
"default": "'day'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand Down Expand Up @@ -106,7 +107,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'day'<br>&#124;&nbsp;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'month'<br>&#124;&nbsp;'seconds'<br>&#124;&nbsp;'year'&gt;"
}
},
"default": "['year', 'day', 'hours', 'minutes']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/static-time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"type": {
"name": "enum",
"description": "'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'seconds'"
}
},
"default": "'hours'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand All @@ -66,7 +67,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'seconds'&gt;"
}
},
"default": "['hours', 'minutes']"
}
},
"slots": {
Expand Down
6 changes: 4 additions & 2 deletions docs/pages/x/api/date-pickers/time-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"type": {
"name": "enum",
"description": "'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'seconds'"
}
},
"default": "'hours'"
},
"orientation": {
"type": { "name": "enum", "description": "'landscape'<br>&#124;&nbsp;'portrait'" }
Expand All @@ -73,7 +74,8 @@
"type": {
"name": "arrayOf",
"description": "Array&lt;'hours'<br>&#124;&nbsp;'minutes'<br>&#124;&nbsp;'seconds'&gt;"
}
},
"default": "['hours', 'minutes']"
}
},
"slots": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
2 changes: 1 addition & 1 deletion docs/translations/api-docs/date-pickers/date-picker.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"onViewChange": "Callback fired on view change.<br><br><strong>Signature:</strong><br><code>function(view: ClockPickerView) =&gt; void</code><br><em>view:</em> The new view.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"onViewChange": "Callback fired on view change.<br><br><strong>Signature:</strong><br><code>function(view: ClockPickerView) =&gt; void</code><br><em>view:</em> The new view.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"onViewChange": "Callback fired on view change.<br><br><strong>Signature:</strong><br><code>function(view: ClockPickerView) =&gt; void</code><br><em>view:</em> The new view.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"PaperProps": "Paper props passed down to <a href=\"https://mui.com/material-ui/api/paper/\">Paper</a> component.",
"PopperProps": "Popper props passed down to <a href=\"https://mui.com/material-ui/api/popper/\">Popper</a> component.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"readOnly": "Make picker read only.",
"reduceAnimations": "Disable heavy animations.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"onYearChange": "Callback firing on year change @DateIOType.<br><br><strong>Signature:</strong><br><code>function(year: TDate) =&gt; void</code><br><em>year:</em> The new year.",
"open": "Control the popup or dialog open state.",
"OpenPickerButtonProps": "Props to pass to keyboard adornment button.",
"openTo": "First view to show.",
"openTo": "First view to show. Must be a valid option from <code>views</code> list",
"orientation": "Force rendering in particular orientation.",
"readOnly": "Make picker read only.",
"reduceAnimations": "Disable heavy animations.",
Expand Down
Loading

0 comments on commit 1cd7728

Please sign in to comment.