-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Create the doc of the new time, date time and date range picke…
…rs (#6958)
- Loading branch information
1 parent
522b138
commit b673ec1
Showing
126 changed files
with
2,569 additions
and
922 deletions.
There are no files selected for viewing
22 changes: 2 additions & 20 deletions
22
docs/data/date-pickers/date-range-picker/BasicDateRangePicker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,12 @@ | ||
import * as React from 'react'; | ||
|
||
import TextField from '@mui/material/TextField'; | ||
import Box from '@mui/material/Box'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers-pro'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs'; | ||
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker'; | ||
import { Unstable_NextDateRangePicker as NextDateRangePicker } from '@mui/x-date-pickers-pro/NextDateRangePicker'; | ||
|
||
export default function BasicDateRangePicker() { | ||
const [value, setValue] = React.useState([null, null]); | ||
|
||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DateRangePicker | ||
localeText={{ start: 'Check-in', end: 'Check-out' }} | ||
value={value} | ||
onChange={(newValue) => { | ||
setValue(newValue); | ||
}} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
<NextDateRangePicker localeText={{ start: 'Check-in', end: 'Check-out' }} /> | ||
</LocalizationProvider> | ||
); | ||
} |
22 changes: 2 additions & 20 deletions
22
docs/data/date-pickers/date-range-picker/BasicDateRangePicker.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,12 @@ | ||
import * as React from 'react'; | ||
import { Dayjs } from 'dayjs'; | ||
import TextField from '@mui/material/TextField'; | ||
import Box from '@mui/material/Box'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers-pro'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs'; | ||
import { DateRangePicker, DateRange } from '@mui/x-date-pickers-pro/DateRangePicker'; | ||
import { Unstable_NextDateRangePicker as NextDateRangePicker } from '@mui/x-date-pickers-pro/NextDateRangePicker'; | ||
|
||
export default function BasicDateRangePicker() { | ||
const [value, setValue] = React.useState<DateRange<Dayjs>>([null, null]); | ||
|
||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DateRangePicker | ||
localeText={{ start: 'Check-in', end: 'Check-out' }} | ||
value={value} | ||
onChange={(newValue) => { | ||
setValue(newValue); | ||
}} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
<NextDateRangePicker localeText={{ start: 'Check-in', end: 'Check-out' }} /> | ||
</LocalizationProvider> | ||
); | ||
} |
15 changes: 1 addition & 14 deletions
15
docs/data/date-pickers/date-range-picker/BasicDateRangePicker.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,3 @@ | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DateRangePicker | ||
localeText={{ start: 'Check-in', end: 'Check-out' }} | ||
value={value} | ||
onChange={(newValue) => { | ||
setValue(newValue); | ||
}} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
<NextDateRangePicker localeText={{ start: 'Check-in', end: 'Check-out' }} /> | ||
</LocalizationProvider> |
85 changes: 32 additions & 53 deletions
85
docs/data/date-pickers/date-range-picker/CalendarsDateRangePicker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,43 @@ | ||
import * as React from 'react'; | ||
|
||
import PropTypes from 'prop-types'; | ||
import Box from '@mui/material/Box'; | ||
import Stack from '@mui/material/Stack'; | ||
import Typography from '@mui/material/Typography'; | ||
import TextField from '@mui/material/TextField'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers-pro'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs'; | ||
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker'; | ||
import Box from '@mui/material/Box'; | ||
import { Unstable_NextDateRangePicker as NextDateRangePicker } from '@mui/x-date-pickers-pro/NextDateRangePicker'; | ||
|
||
export default function CalendarsDateRangePicker() { | ||
const [value, setValue] = React.useState([null, null]); | ||
function GridItem({ label, children, spacing = 1 }) { | ||
return ( | ||
<Box sx={{ display: 'flex', flexDirection: 'column' }}> | ||
<Typography variant="body2" sx={{ mb: spacing }}> | ||
{label} | ||
</Typography> | ||
{children} | ||
</Box> | ||
); | ||
} | ||
|
||
GridItem.propTypes = { | ||
children: PropTypes.node, | ||
label: PropTypes.string.isRequired, | ||
spacing: PropTypes.number, | ||
}; | ||
|
||
export default function CalendarsDateRangePicker() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<div> | ||
<Typography sx={{ mt: 2, mb: 1 }}>1 calendar </Typography> | ||
<DateRangePicker | ||
calendars={1} | ||
value={value} | ||
onChange={(newValue) => { | ||
setValue(newValue); | ||
}} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
<Typography sx={{ mt: 2, mb: 1 }}>2 calendars</Typography> | ||
<DateRangePicker | ||
calendars={2} | ||
value={value} | ||
onChange={(newValue) => { | ||
setValue(newValue); | ||
}} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
<Typography sx={{ mt: 2, mb: 1 }}>3 calendars</Typography> | ||
<DateRangePicker | ||
calendars={3} | ||
value={value} | ||
onChange={(newValue) => { | ||
setValue(newValue); | ||
}} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
</div> | ||
<Stack spacing={4}> | ||
<GridItem label="1 calendar" spacing={2}> | ||
<NextDateRangePicker calendars={1} /> | ||
</GridItem> | ||
<GridItem label="2 calendars" spacing={2}> | ||
<NextDateRangePicker calendars={2} /> | ||
</GridItem> | ||
<GridItem label="3 calendars" spacing={2}> | ||
<NextDateRangePicker calendars={3} /> | ||
</GridItem> | ||
</Stack> | ||
</LocalizationProvider> | ||
); | ||
} |
86 changes: 33 additions & 53 deletions
86
docs/data/date-pickers/date-range-picker/CalendarsDateRangePicker.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,44 @@ | ||
import * as React from 'react'; | ||
import { Dayjs } from 'dayjs'; | ||
import Box from '@mui/material/Box'; | ||
import Stack from '@mui/material/Stack'; | ||
import Typography from '@mui/material/Typography'; | ||
import TextField from '@mui/material/TextField'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers-pro'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs'; | ||
import { DateRangePicker, DateRange } from '@mui/x-date-pickers-pro/DateRangePicker'; | ||
import Box from '@mui/material/Box'; | ||
import { Unstable_NextDateRangePicker as NextDateRangePicker } from '@mui/x-date-pickers-pro/NextDateRangePicker'; | ||
|
||
export default function CalendarsDateRangePicker() { | ||
const [value, setValue] = React.useState<DateRange<Dayjs>>([null, null]); | ||
function GridItem({ | ||
label, | ||
children, | ||
spacing = 1, | ||
}: { | ||
label: string; | ||
children: React.ReactNode; | ||
spacing?: number; | ||
}) { | ||
return ( | ||
<Box sx={{ display: 'flex', flexDirection: 'column' }}> | ||
<Typography variant="body2" sx={{ mb: spacing }}> | ||
{label} | ||
</Typography> | ||
{children} | ||
</Box> | ||
); | ||
} | ||
|
||
export default function CalendarsDateRangePicker() { | ||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<div> | ||
<Typography sx={{ mt: 2, mb: 1 }}>1 calendar </Typography> | ||
<DateRangePicker | ||
calendars={1} | ||
value={value} | ||
onChange={(newValue) => { | ||
setValue(newValue); | ||
}} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
<Typography sx={{ mt: 2, mb: 1 }}>2 calendars</Typography> | ||
<DateRangePicker | ||
calendars={2} | ||
value={value} | ||
onChange={(newValue) => { | ||
setValue(newValue); | ||
}} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
<Typography sx={{ mt: 2, mb: 1 }}>3 calendars</Typography> | ||
<DateRangePicker | ||
calendars={3} | ||
value={value} | ||
onChange={(newValue) => { | ||
setValue(newValue); | ||
}} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
</div> | ||
<Stack spacing={4}> | ||
<GridItem label="1 calendar" spacing={2}> | ||
<NextDateRangePicker calendars={1} /> | ||
</GridItem> | ||
<GridItem label="2 calendars" spacing={2}> | ||
<NextDateRangePicker calendars={2} /> | ||
</GridItem> | ||
<GridItem label="3 calendars" spacing={2}> | ||
<NextDateRangePicker calendars={3} /> | ||
</GridItem> | ||
</Stack> | ||
</LocalizationProvider> | ||
); | ||
} |
13 changes: 13 additions & 0 deletions
13
docs/data/date-pickers/date-range-picker/CalendarsDateRangePicker.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<Stack spacing={4}> | ||
<GridItem label="1 calendar" spacing={2}> | ||
<NextDateRangePicker calendars={1} /> | ||
</GridItem> | ||
<GridItem label="2 calendars" spacing={2}> | ||
<NextDateRangePicker calendars={2} /> | ||
</GridItem> | ||
<GridItem label="3 calendars" spacing={2}> | ||
<NextDateRangePicker calendars={3} /> | ||
</GridItem> | ||
</Stack> | ||
</LocalizationProvider> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 2 additions & 11 deletions
13
docs/data/date-pickers/date-range-picker/CustomDateRangePickerDay.tsx.preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<StaticDateRangePicker | ||
<StaticNextDateRangePicker | ||
displayStaticWrapperAs="desktop" | ||
label="date range" | ||
value={value} | ||
onChange={(newValue) => setValue(newValue)} | ||
defaultValue={[dayjs('2022-04-07'), dayjs('2022-04-10')]} | ||
components={{ Day: DateRangePickerDay }} | ||
renderInput={(startProps, endProps) => ( | ||
<React.Fragment> | ||
<TextField {...startProps} /> | ||
<Box sx={{ mx: 2 }}> to </Box> | ||
<TextField {...endProps} /> | ||
</React.Fragment> | ||
)} | ||
/> | ||
</LocalizationProvider> |
Oops, something went wrong.