Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle committed Oct 29, 2024
1 parent a1e1090 commit a2435b0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
11 changes: 5 additions & 6 deletions docs/data/common-concepts/custom-components/custom-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ you can declare your component using the `PropsFromSlot` interface:
```tsx
function CustomCalendarHeader({
currentMonth,
}: PropsFromSlot<DateCalendarSlots<Dayjs>['calendarHeader']>) {
}: PropsFromSlot<DateCalendarSlots['calendarHeader']>) {
return <div>{currentMonth?.format('MM-DD-YYYY')}</div>;
}
```
Expand All @@ -129,7 +129,7 @@ import { DateCalendarSlots } from '@mui/x-date-pickers';
type ToolbarProps = PropsFromSlot<GridSlots['toolbar']>;

// Most of the picker slots interfaces need to receive the date type as a generic.
type CalendarHeaderProps = PropsFromSlot<DateCalendarSlots<Dayjs>['calendarHeader']>;
type CalendarHeaderProps = PropsFromSlot<DateCalendarSlots['calendarHeader']>;
```

:::
Expand All @@ -140,7 +140,7 @@ If you are passing additional props to your slot, you can add them to the props

```ts
interface CustomCalendarHeaderProps
extends PropsFromSlot<DateCalendarSlots<Dayjs>['calendarHeader']> {
extends PropsFromSlot<DateCalendarSlots['calendarHeader']> {
displayWeekNumber: boolean;
setDisplayWeekNumber: (displayWeekNumber: boolean) => void;
}
Expand Down Expand Up @@ -178,14 +178,13 @@ function MyApp() {
<DateCalendar
displayWeekNumber={displayWeekNumber}
slots={{
calendarHeader:
CustomCalendarHeader as DateCalendarSlots<Dayjs>['calendarHeader'],
calendarHeader: CustomCalendarHeader as DateCalendarSlots['calendarHeader'],
}}
slotProps={{
calendarHeader: {
displayWeekNumber,
setDisplayWeekNumber,
} as DateCalendarSlotProps<Dayjs>['calendarHeader'],
} as DateCalendarSlotProps['calendarHeader'],
}}
/>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';

import Button from '@mui/material/Button';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react';
import { Dayjs } from 'dayjs';
import Button from '@mui/material/Button';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
Expand All @@ -15,7 +14,7 @@ import {
usePickersContext,
} from '@mui/x-date-pickers/hooks';

function ButtonDateField(props: DatePickerFieldProps<Dayjs>) {
function ButtonDateField(props: DatePickerFieldProps) {
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { value, timezone, format } = internalProps;
const {
Expand Down Expand Up @@ -62,7 +61,7 @@ function ButtonDateField(props: DatePickerFieldProps<Dayjs>) {
);
}

function ButtonFieldDatePicker(props: DatePickerProps<Dayjs>) {
function ButtonFieldDatePicker(props: DatePickerProps) {
return (
<DatePicker {...props} slots={{ ...props.slots, field: ButtonDateField }} />
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
usePickersContext,
} from '@mui/x-date-pickers/hooks';

function ButtonDateRangeField(props: DateRangePickerFieldProps<Dayjs>) {
function ButtonDateRangeField(props: DateRangePickerFieldProps) {
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { value, timezone, format } = internalProps;
const {
Expand Down Expand Up @@ -49,7 +49,7 @@ function ButtonDateRangeField(props: DateRangePickerFieldProps<Dayjs>) {
};

const formattedValue = (value ?? [null, null])
.map((date) => (date == null ? parsedFormat : date.format(format)))
.map((date) => (date == null ? parsedFormat : (date as Dayjs).format(format)))
.join(' – ');

return (
Expand All @@ -68,7 +68,7 @@ function ButtonDateRangeField(props: DateRangePickerFieldProps<Dayjs>) {
// TODO v8: Will be removed before the end of the alpha since single input will become the default field.
ButtonDateRangeField.fieldType = 'single-input';

function ButtonFieldDateRangePicker(props: DateRangePickerProps<Dayjs>) {
function ButtonFieldDateRangePicker(props: DateRangePickerProps) {
return (
<DateRangePicker
{...props}
Expand Down

0 comments on commit a2435b0

Please sign in to comment.