-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[docs] Cleanup the doc pages of the community pickers #7339
Changes from 1 commit
0c0edde
1cf414a
f67883d
2c06236
f729dd3
f9b3d70
e6fd308
a714451
756375f
c5ef301
4b81367
1ec208d
af4d293
1576961
a8c692c
f896d70
7c2f8d2
d8e0b8e
7154635
c1492ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<StaticNextDatePicker displayStaticWrapperAs="desktop" /> | ||
<StaticNextDatePicker /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { Unstable_StaticNextDatePicker as StaticNextDatePicker } from '@mui/x-date-pickers/StaticNextDatePicker'; | ||
|
||
export default function StaticDatePickerLandscape() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<StaticNextDatePicker | ||
orientation="landscape" | ||
defaultValue={dayjs('2022-04-07')} | ||
/> | ||
<StaticNextDatePicker orientation="landscape" /> | ||
</LocalizationProvider> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { Unstable_StaticNextDatePicker as StaticNextDatePicker } from '@mui/x-date-pickers/StaticNextDatePicker'; | ||
|
||
export default function StaticDatePickerLandscape() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<StaticNextDatePicker | ||
orientation="landscape" | ||
defaultValue={dayjs('2022-04-07')} | ||
flaviendelangle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/> | ||
<StaticNextDatePicker orientation="landscape" /> | ||
</LocalizationProvider> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
<StaticNextDatePicker | ||
orientation="landscape" | ||
defaultValue={dayjs('2022-04-07')} | ||
/> | ||
<StaticNextDatePicker orientation="landscape" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,21 +19,14 @@ They will be renamed at the end of the v6 beta phase to have the same name as th | |
(`NextDatePicker` will become `DatePicker`, ...) | ||
::: | ||
|
||
Date pickers are displayed with: | ||
|
||
- Dialogs on mobile | ||
- Text field dropdowns on desktop | ||
|
||
## Basic usage | ||
|
||
The Date Picker is rendered as a modal dialog on mobile, and a textbox with a popup on desktop. | ||
|
||
{{"demo": "BasicDatePicker.js"}} | ||
|
||
## Component composition | ||
|
||
The Date Picker components are built using the `DateField` for the keyboard editing and the `DateCalendar` for the view editing. | ||
flaviendelangle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
All the documented props of those two components can also be passed to the Date Picker components. | ||
The Date Picker component is built using the `DateField` for the keyboard editing, and the `DateCalendar` for the view editing. | ||
flaviendelangle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
All the documented props of those two components can also be passed to the Date Picker component. | ||
|
||
Check-out their documentation page for more information: | ||
|
||
|
@@ -42,27 +35,34 @@ Check-out their documentation page for more information: | |
|
||
## Uncontrolled vs. Controlled | ||
|
||
The component can be uncontrolled or controlled | ||
The Date Picker component can be uncontrolled or controlled | ||
|
||
{{"demo": "DatePickerValue.js"}} | ||
|
||
## Responsiveness | ||
|
||
The Date Picker component is designed and optimized for the device it runs on. | ||
flaviendelangle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
The Date Picker component is available in three variants: | ||
flaviendelangle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- The `MobileNextDatePicker` component works best for touch devices and small screens. | ||
- The `DesktopNextDatePicker` component works best for mouse devices and large screens. | ||
- The `DesktopNextDatePicker` component which works best for mouse devices and large screens. | ||
flaviendelangle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
It renders the views inside a popover and allows editing values directly inside the field. | ||
|
||
By default, the `NextDatePicker` component renders the desktop version if the media query [`@media (pointer: fine)`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer) matches. | ||
This can be customized with the `desktopModeMediaQuery` prop. | ||
- The `MobileNextDatePicker` component which works best for touch devices and small screens. | ||
It renders the view inside a modal and does not allow editing values directly inside the field. | ||
|
||
There are certain caveats when testing pickers, please refer to [this section](/x/react-date-pickers/getting-started/#testing-caveats) for more information. | ||
- The `NextDatePicker` component which will render `DesktopNextDatePicker` or `MobileNextDatePicker` depending on the device it runs on. | ||
|
||
By default, it renders the desktop version if the media query [`@media (pointer: fine)`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/pointer) matches. | ||
LukasTy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This can be customized with the `desktopModeMediaQuery` prop. | ||
|
||
{{"demo": "ResponsiveDatePickers.js"}} | ||
|
||
:::warning | ||
There are certain caveats when testing pickers, please refer to [this section](/x/react-date-pickers/getting-started/#testing-caveats) for more information. | ||
::: | ||
|
||
## Static mode | ||
|
||
It is also possible to render the Date Picker without the modal/popover and text field. | ||
It is also possible to render the Date Picker without the popover/modal and field. | ||
flaviendelangle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This can be helpful when building custom popover/modal containers. | ||
|
||
{{"demo": "StaticDatePickerDemo.js", "bg": true}} | ||
|
@@ -75,7 +75,7 @@ The Date Picker component can be disabled or read-only. | |
|
||
## Views | ||
|
||
The component can contain three views: `day`, `month`, and `year`. | ||
The Date Picker component can contain three views: `day`, `month`, and `year`. | ||
By default, only the `day` and `year` views are enabled. | ||
|
||
You can customize the enabled views using the `views` prop. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @LukasTy done for For |
||
|
@@ -85,7 +85,7 @@ Views will appear in the order they're included in the `views` array. | |
|
||
## Landscape orientation | ||
|
||
By default, the Date Picker automatically sets the orientation based on the `window.orientation` value. | ||
By default, the Date Picker component automatically sets the orientation based on the `window.orientation` value. | ||
|
||
You can force a specific orientation using the `orientation` prop. | ||
|
||
|
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { DemoContainer, DemoItem } from 'docsx/src/modules/components/DemoContainer'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { Unstable_NextDateTimePicker as NextDateTimePicker } from '@mui/x-date-pickers/NextDateTimePicker'; | ||
|
||
export default function DateTimePickerViews() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DemoContainer> | ||
<DemoItem | ||
label={'"year"", "month", "day", "hours", "minutes" and "seconds"'} | ||
> | ||
<NextDateTimePicker | ||
defaultValue={dayjs('2022-04-07T15:30:25')} | ||
views={['year', 'month', 'day', 'hours', 'minutes', 'seconds']} | ||
/> | ||
</DemoItem> | ||
<DemoItem label={'"day", "hours"'}> | ||
<NextDateTimePicker | ||
defaultValue={dayjs('2022-04-07T15:30:25')} | ||
views={['day', 'hours']} | ||
/> | ||
</DemoItem> | ||
<DemoItem label={'"year", "day", "hours", "minutes", "seconds"'}> | ||
<NextDateTimePicker | ||
defaultValue={dayjs('2022-04-07T15:30:25')} | ||
views={['year', 'day', 'hours', 'minutes', 'seconds']} | ||
flaviendelangle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/> | ||
</DemoItem> | ||
</DemoContainer> | ||
</LocalizationProvider> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { DemoContainer, DemoItem } from 'docsx/src/modules/components/DemoContainer'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { Unstable_NextDateTimePicker as NextDateTimePicker } from '@mui/x-date-pickers/NextDateTimePicker'; | ||
|
||
export default function DateTimePickerViews() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DemoContainer> | ||
<DemoItem | ||
label={'"year"", "month", "day", "hours", "minutes" and "seconds"'} | ||
> | ||
<NextDateTimePicker | ||
defaultValue={dayjs('2022-04-07T15:30:25')} | ||
views={['year', 'month', 'day', 'hours', 'minutes', 'seconds']} | ||
/> | ||
</DemoItem> | ||
<DemoItem label={'"day", "hours"'}> | ||
<NextDateTimePicker | ||
defaultValue={dayjs('2022-04-07T15:30:25')} | ||
views={['day', 'hours']} | ||
/> | ||
</DemoItem> | ||
<DemoItem label={'"year", "day", "hours", "minutes", "seconds"'}> | ||
<NextDateTimePicker | ||
defaultValue={dayjs('2022-04-07T15:30:25')} | ||
views={['year', 'day', 'hours', 'minutes', 'seconds']} | ||
/> | ||
</DemoItem> | ||
</DemoContainer> | ||
</LocalizationProvider> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { Unstable_StaticNextDateTimePicker as StaticNextDateTimePicker } from '@mui/x-date-pickers/StaticNextDateTimePicker'; | ||
|
||
export default function StaticDateTimePickerDemo() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<StaticNextDateTimePicker | ||
displayStaticWrapperAs="desktop" | ||
defaultValue={dayjs('2022-04-07T15:30')} | ||
/> | ||
<StaticNextDateTimePicker /> | ||
</LocalizationProvider> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,12 @@ | ||
import * as React from 'react'; | ||
import dayjs from 'dayjs'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { Unstable_StaticNextDateTimePicker as StaticNextDateTimePicker } from '@mui/x-date-pickers/StaticNextDateTimePicker'; | ||
|
||
export default function StaticDateTimePickerDemo() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<StaticNextDateTimePicker | ||
displayStaticWrapperAs="desktop" | ||
defaultValue={dayjs('2022-04-07T15:30')} | ||
/> | ||
<StaticNextDateTimePicker /> | ||
</LocalizationProvider> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
<StaticNextDateTimePicker | ||
displayStaticWrapperAs="desktop" | ||
defaultValue={dayjs('2022-04-07T15:30')} | ||
/> | ||
<StaticNextDateTimePicker /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as React from 'react'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { Unstable_StaticNextDateTimePicker as StaticNextDateTimePicker } from '@mui/x-date-pickers/StaticNextDateTimePicker'; | ||
|
||
export default function StaticDateTimePickerLandscape() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<StaticNextDateTimePicker orientation="landscape" /> | ||
</LocalizationProvider> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as React from 'react'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { Unstable_StaticNextDateTimePicker as StaticNextDateTimePicker } from '@mui/x-date-pickers/StaticNextDateTimePicker'; | ||
|
||
export default function StaticDateTimePickerLandscape() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<StaticNextDateTimePicker orientation="landscape" /> | ||
</LocalizationProvider> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<StaticNextDateTimePicker orientation="landscape" /> |
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.
Now that we have dedicated pages for the view components, I think that the static demos should display the toolbar, otherwise the diff between the two components is hard to understand.