-
-
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.
- Loading branch information
1 parent
6134015
commit db1bbba
Showing
10 changed files
with
18 additions
and
342 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,3 @@ | ||
import * as React from 'react'; | ||
import { prefixer } from 'stylis'; | ||
import rtlPlugin from 'stylis-plugin-rtl'; | ||
import createCache from '@emotion/cache'; | ||
import { CacheProvider } from '@emotion/react'; | ||
import Box from '@mui/material/Box'; | ||
import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles'; | ||
import { DemoContainer } from '@mui/x-date-pickers/internals/demo'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
import { DateRangeCalendar } from '@mui/x-date-pickers-pro/DateRangeCalendar'; | ||
import { MultiSectionDigitalClock } from '@mui/x-date-pickers/MultiSectionDigitalClock'; | ||
|
||
// Create rtl cache | ||
const cacheRtl = createCache({ | ||
key: 'pickers-rtl-demo', | ||
stylisPlugins: [prefixer, rtlPlugin], | ||
}); | ||
|
||
export default function PickersRTL() { | ||
// Inherit the theme from the docs site (dark/light mode) | ||
const existingTheme = useTheme(); | ||
|
||
const theme = React.useMemo( | ||
() => | ||
createTheme({}, existingTheme, { | ||
direction: 'rtl', | ||
}), | ||
[existingTheme], | ||
); | ||
|
||
return ( | ||
<CacheProvider value={cacheRtl}> | ||
<ThemeProvider theme={theme}> | ||
<div dir="rtl"> | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DemoContainer | ||
components={[ | ||
'DatePicker', | ||
'DateRangeCalendar', | ||
'MultiSectionDigitalClock', | ||
]} | ||
> | ||
<DatePicker | ||
// Setting `dir="rtl"` on the paper is needed if the `<div dir="rtl />` does not contain the portaled element. | ||
// If you set `dir="rtl"` on the `<body />`, you can skip it. | ||
slotProps={{ | ||
desktopPaper: { | ||
dir: 'rtl', | ||
}, | ||
mobilePaper: { | ||
dir: 'rtl', | ||
}, | ||
}} | ||
/> | ||
<DateRangeCalendar /> | ||
<Box sx={{ width: 56 * 3 }}> | ||
<MultiSectionDigitalClock /> | ||
</Box> | ||
</DemoContainer> | ||
</LocalizationProvider> | ||
</div> | ||
</ThemeProvider> | ||
</CacheProvider> | ||
); | ||
export function PickersRTL() { | ||
return null; | ||
} |
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,67 +1,3 @@ | ||
import * as React from 'react'; | ||
import { prefixer } from 'stylis'; | ||
import rtlPlugin from 'stylis-plugin-rtl'; | ||
import createCache from '@emotion/cache'; | ||
import { CacheProvider } from '@emotion/react'; | ||
import Box from '@mui/material/Box'; | ||
import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles'; | ||
import { DemoContainer } from '@mui/x-date-pickers/internals/demo'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
import { DatePicker } from '@mui/x-date-pickers/DatePicker'; | ||
import { DateRangeCalendar } from '@mui/x-date-pickers-pro/DateRangeCalendar'; | ||
import { MultiSectionDigitalClock } from '@mui/x-date-pickers/MultiSectionDigitalClock'; | ||
|
||
// Create rtl cache | ||
const cacheRtl = createCache({ | ||
key: 'pickers-rtl-demo', | ||
stylisPlugins: [prefixer, rtlPlugin], | ||
}); | ||
|
||
export default function PickersRTL() { | ||
// Inherit the theme from the docs site (dark/light mode) | ||
const existingTheme = useTheme(); | ||
|
||
const theme = React.useMemo( | ||
() => | ||
createTheme({}, existingTheme, { | ||
direction: 'rtl', | ||
}), | ||
[existingTheme], | ||
); | ||
|
||
return ( | ||
<CacheProvider value={cacheRtl}> | ||
<ThemeProvider theme={theme}> | ||
<div dir="rtl"> | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<DemoContainer | ||
components={[ | ||
'DatePicker', | ||
'DateRangeCalendar', | ||
'MultiSectionDigitalClock', | ||
]} | ||
> | ||
<DatePicker | ||
// Setting `dir="rtl"` on the paper is needed if the `<div dir="rtl />` does not contain the portaled element. | ||
// If you set `dir="rtl"` on the `<body />`, you can skip it. | ||
slotProps={{ | ||
desktopPaper: { | ||
dir: 'rtl', | ||
}, | ||
mobilePaper: { | ||
dir: 'rtl', | ||
}, | ||
}} | ||
/> | ||
<DateRangeCalendar /> | ||
<Box sx={{ width: 56 * 3 }}> | ||
<MultiSectionDigitalClock /> | ||
</Box> | ||
</DemoContainer> | ||
</LocalizationProvider> | ||
</div> | ||
</ThemeProvider> | ||
</CacheProvider> | ||
); | ||
export function PickersRTL() { | ||
return null; | ||
} |
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
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,50 +1,3 @@ | ||
import * as React from 'react'; | ||
import { prefixer } from 'stylis'; | ||
import rtlPlugin from 'stylis-plugin-rtl'; | ||
import createCache from '@emotion/cache'; | ||
import { CacheProvider } from '@emotion/react'; | ||
import { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalali'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker'; | ||
import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles'; | ||
|
||
// Create rtl cache | ||
const cacheRtl = createCache({ | ||
key: 'adapter-jalali-demo', | ||
stylisPlugins: [prefixer, rtlPlugin], | ||
}); | ||
|
||
export default function AdapterJalali() { | ||
// Inherit the theme from the docs site (dark/light mode) | ||
const existingTheme = useTheme(); | ||
|
||
const theme = React.useMemo( | ||
() => createTheme(existingTheme, { direction: 'rtl' }), | ||
[existingTheme], | ||
); | ||
|
||
return ( | ||
<CacheProvider value={cacheRtl}> | ||
<ThemeProvider theme={theme}> | ||
<div dir="rtl"> | ||
<LocalizationProvider dateAdapter={AdapterDateFnsJalali}> | ||
<DateTimePicker | ||
label="AdapterDateFnsJalali" | ||
defaultValue={new Date(2022, 1, 1, 12)} | ||
// Setting `dir="rtl"` on the paper is needed if the `<div dir="rtl />` does not contain the portaled element. | ||
// If you set `dir="rtl"` on the `<body />`, you can skip it. | ||
slotProps={{ | ||
desktopPaper: { | ||
dir: 'rtl', | ||
}, | ||
mobilePaper: { | ||
dir: 'rtl', | ||
}, | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
</div> | ||
</ThemeProvider> | ||
</CacheProvider> | ||
); | ||
export function PickersRTL() { | ||
return null; | ||
} |
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,50 +1,3 @@ | ||
import * as React from 'react'; | ||
import { prefixer } from 'stylis'; | ||
import rtlPlugin from 'stylis-plugin-rtl'; | ||
import createCache from '@emotion/cache'; | ||
import { CacheProvider } from '@emotion/react'; | ||
import { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalali'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker'; | ||
import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles'; | ||
|
||
// Create rtl cache | ||
const cacheRtl = createCache({ | ||
key: 'adapter-jalali-demo', | ||
stylisPlugins: [prefixer, rtlPlugin], | ||
}); | ||
|
||
export default function AdapterJalali() { | ||
// Inherit the theme from the docs site (dark/light mode) | ||
const existingTheme = useTheme(); | ||
|
||
const theme = React.useMemo( | ||
() => createTheme(existingTheme, { direction: 'rtl' }), | ||
[existingTheme], | ||
); | ||
|
||
return ( | ||
<CacheProvider value={cacheRtl}> | ||
<ThemeProvider theme={theme}> | ||
<div dir="rtl"> | ||
<LocalizationProvider dateAdapter={AdapterDateFnsJalali}> | ||
<DateTimePicker | ||
label="AdapterDateFnsJalali" | ||
defaultValue={new Date(2022, 1, 1, 12)} | ||
// Setting `dir="rtl"` on the paper is needed if the `<div dir="rtl />` does not contain the portaled element. | ||
// If you set `dir="rtl"` on the `<body />`, you can skip it. | ||
slotProps={{ | ||
desktopPaper: { | ||
dir: 'rtl', | ||
}, | ||
mobilePaper: { | ||
dir: 'rtl', | ||
}, | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
</div> | ||
</ThemeProvider> | ||
</CacheProvider> | ||
); | ||
export function PickersRTL() { | ||
return null; | ||
} |
54 changes: 2 additions & 52 deletions
54
docs/data/date-pickers/calendar-systems/AdapterMomentJalali.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,53 +1,3 @@ | ||
import * as React from 'react'; | ||
import { prefixer } from 'stylis'; | ||
import rtlPlugin from 'stylis-plugin-rtl'; | ||
import createCache from '@emotion/cache'; | ||
import { CacheProvider } from '@emotion/react'; | ||
import moment from 'moment-jalaali'; | ||
import { AdapterMomentJalaali } from '@mui/x-date-pickers/AdapterMomentJalaali'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker'; | ||
import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles'; | ||
|
||
// Create rtl cache | ||
const cacheRtl = createCache({ | ||
key: 'adapter-moment-jalali-demo', | ||
stylisPlugins: [prefixer, rtlPlugin], | ||
}); | ||
|
||
export default function AdapterMomentJalali() { | ||
moment.loadPersian({ dialect: 'persian-modern' }); | ||
|
||
// Inherit the theme from the docs site (dark/light mode) | ||
const existingTheme = useTheme(); | ||
|
||
const theme = React.useMemo( | ||
() => createTheme(existingTheme, { direction: 'rtl' }), | ||
[existingTheme], | ||
); | ||
|
||
return ( | ||
<CacheProvider value={cacheRtl}> | ||
<ThemeProvider theme={theme}> | ||
<div dir="rtl"> | ||
<LocalizationProvider dateAdapter={AdapterMomentJalaali}> | ||
<DateTimePicker | ||
label="AdapterMomentJalaali" | ||
defaultValue={moment('2022-02-01T12:00:00')} | ||
// Setting `dir="rtl"` on the paper is needed if the `<div dir="rtl />` does not contain the portaled element. | ||
// If you set `dir="rtl"` on the `<body />`, you can skip it. | ||
slotProps={{ | ||
desktopPaper: { | ||
dir: 'rtl', | ||
}, | ||
mobilePaper: { | ||
dir: 'rtl', | ||
}, | ||
}} | ||
/> | ||
</LocalizationProvider> | ||
</div> | ||
</ThemeProvider> | ||
</CacheProvider> | ||
); | ||
export function PickersRTL() { | ||
return null; | ||
} |
Oops, something went wrong.