Skip to content

Commit

Permalink
Merge branch 'master' into not-contain-not-equal-filter-operators
Browse files Browse the repository at this point in the history
  • Loading branch information
KenanYusuf committed Sep 4, 2024
2 parents 7fe4214 + d7e51c0 commit 6605c46
Show file tree
Hide file tree
Showing 75 changed files with 963 additions and 313 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ default-job: &default-job
REACT_VERSION: << parameters.react-version >>
working_directory: /tmp/mui
docker:
- image: cimg/node:18.20
- image: cimg/node:20.17
# CircleCI has disabled the cache across forks for security reasons.
# Following their official statement, it was a quick solution, they
# are working on providing this feature back with appropriate security measures.
Expand Down
2 changes: 1 addition & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"buildCommand": "build:codesandbox",
"installCommand": "install:codesandbox",
"node": "18",
"node": "20",
"packages": [
"packages/x-license",
"packages/x-data-grid",
Expand Down
4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ module.exports = function getBabelConfig(api) {
'@babel/plugin-transform-runtime',
{
useESModules,
// any package needs to declare 7.4.4 as a runtime dependency. default is ^7.0.0
version: '^7.4.4',
// any package needs to declare 7.25.0 as a runtime dependency. default is ^7.0.0
version: process.env.MUI_BABEL_RUNTIME_VERSION || '^7.25.0',
},
],
[
Expand Down
13 changes: 13 additions & 0 deletions docs/data/common-concepts/custom-components/CustomSlot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react';
import FlightTakeoffIcon from '@mui/icons-material/FlightTakeoff';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

export default function CustomSlot() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker slots={{ openPickerIcon: FlightTakeoffIcon }} />
</LocalizationProvider>
);
}
13 changes: 13 additions & 0 deletions docs/data/common-concepts/custom-components/CustomSlot.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import * as React from 'react';
import FlightTakeoffIcon from '@mui/icons-material/FlightTakeoff';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

export default function CustomSlot() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker slots={{ openPickerIcon: FlightTakeoffIcon }} />
</LocalizationProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<DatePicker slots={{ openPickerIcon: FlightTakeoffIcon }} />
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as React from 'react';
import FlightTakeoffIcon from '@mui/icons-material/FlightTakeoff';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

export default function CustomSlotAndSlotProps() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker
slots={{ openPickerIcon: FlightTakeoffIcon }}
slotProps={{
openPickerIcon: {
color: 'primary',
},
}}
/>
</LocalizationProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as React from 'react';
import FlightTakeoffIcon from '@mui/icons-material/FlightTakeoff';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

export default function CustomSlotAndSlotProps() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker
slots={{ openPickerIcon: FlightTakeoffIcon }}
slotProps={{
openPickerIcon: {
color: 'primary',
},
}}
/>
</LocalizationProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<DatePicker
slots={{ openPickerIcon: FlightTakeoffIcon }}
slotProps={{
openPickerIcon: {
color: 'primary',
},
}}
/>
18 changes: 18 additions & 0 deletions docs/data/common-concepts/custom-components/CustomSlotProps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as React from 'react';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

export default function CustomSlotProps() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker
slotProps={{
openPickerIcon: {
color: 'primary',
},
}}
/>
</LocalizationProvider>
);
}
18 changes: 18 additions & 0 deletions docs/data/common-concepts/custom-components/CustomSlotProps.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as React from 'react';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

export default function CustomSlotProps() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker
slotProps={{
openPickerIcon: {
color: 'primary',
},
}}
/>
</LocalizationProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<DatePicker
slotProps={{
openPickerIcon: {
color: 'primary',
},
}}
/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as React from 'react';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

export default function CustomSlotPropsCallback() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker
slotProps={{
openPickerIcon: (ownerState) => ({
color: ownerState.open ? 'secondary' : 'primary',
}),
}}
/>
</LocalizationProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as React from 'react';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

export default function CustomSlotPropsCallback() {
return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker
slotProps={{
openPickerIcon: (ownerState) => ({
color: ownerState.open ? 'secondary' : 'primary',
}),
}}
/>
</LocalizationProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<DatePicker
slotProps={{
openPickerIcon: (ownerState) => ({
color: ownerState.open ? 'secondary' : 'primary',
}),
}}
/>
63 changes: 63 additions & 0 deletions docs/data/common-concepts/custom-components/TypescriptCasting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import * as React from 'react';

import Stack from '@mui/material/Stack';
import FormControlLabel from '@mui/material/FormControlLabel';
import Switch from '@mui/material/Switch';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { DateCalendar } from '@mui/x-date-pickers/DateCalendar';

import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader';

function DisplayWeekNumberToggle({ value, onChange }) {
return (
<FormControlLabel
sx={{ ml: 2 }}
control={
<Switch
checked={value}
onChange={(event) => onChange(event.target.checked)}
/>
}
label="Display week number"
/>
);
}

function CustomCalendarHeader({
displayWeekNumber,
setDisplayWeekNumber,
...other
}) {
return (
<Stack>
<DisplayWeekNumberToggle
value={displayWeekNumber}
onChange={setDisplayWeekNumber}
/>
<PickersCalendarHeader {...other} />
</Stack>
);
}

export default function TypescriptCasting() {
const [displayWeekNumber, setDisplayWeekNumber] = React.useState(false);

return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DateCalendar
displayWeekNumber={displayWeekNumber}
// Cast the custom component to the type expected by the X component
slots={{
calendarHeader: CustomCalendarHeader,
}}
slotProps={{
calendarHeader: {
displayWeekNumber,
setDisplayWeekNumber,
},
}}
/>
</LocalizationProvider>
);
}
80 changes: 80 additions & 0 deletions docs/data/common-concepts/custom-components/TypescriptCasting.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import * as React from 'react';
import { Dayjs } from 'dayjs';
import Stack from '@mui/material/Stack';
import FormControlLabel from '@mui/material/FormControlLabel';
import Switch from '@mui/material/Switch';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import {
DateCalendar,
DateCalendarSlots,
DateCalendarSlotProps,
} from '@mui/x-date-pickers/DateCalendar';
import { PropsFromSlot } from '@mui/x-date-pickers/models';
import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader';

function DisplayWeekNumberToggle({
value,
onChange,
}: {
value: boolean;
onChange: (value: boolean) => void;
}) {
return (
<FormControlLabel
sx={{ ml: 2 }}
control={
<Switch
checked={value}
onChange={(event) => onChange(event.target.checked)}
/>
}
label="Display week number"
/>
);
}

interface CustomCalendarHeaderProps
extends PropsFromSlot<DateCalendarSlots<Dayjs>['calendarHeader']> {
displayWeekNumber: boolean;
setDisplayWeekNumber: (displayWeekNumber: boolean) => void;
}

function CustomCalendarHeader({
displayWeekNumber,
setDisplayWeekNumber,
...other
}: CustomCalendarHeaderProps) {
return (
<Stack>
<DisplayWeekNumberToggle
value={displayWeekNumber}
onChange={setDisplayWeekNumber}
/>
<PickersCalendarHeader {...other} />
</Stack>
);
}

export default function TypescriptCasting() {
const [displayWeekNumber, setDisplayWeekNumber] = React.useState(false);

return (
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DateCalendar
displayWeekNumber={displayWeekNumber}
// Cast the custom component to the type expected by the X component
slots={{
calendarHeader:
CustomCalendarHeader as DateCalendarSlots<Dayjs>['calendarHeader'],
}}
slotProps={{
calendarHeader: {
displayWeekNumber,
setDisplayWeekNumber,
} as DateCalendarSlotProps<Dayjs>['calendarHeader'],
}}
/>
</LocalizationProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<DateCalendar
displayWeekNumber={displayWeekNumber}
// Cast the custom component to the type expected by the X component
slots={{
calendarHeader:
CustomCalendarHeader as DateCalendarSlots<Dayjs>['calendarHeader'],
}}
slotProps={{
calendarHeader: {
displayWeekNumber,
setDisplayWeekNumber,
} as DateCalendarSlotProps<Dayjs>['calendarHeader'],
}}
/>
Loading

0 comments on commit 6605c46

Please sign in to comment.