Skip to content
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

[core] Avoid root level @mui/x-date-pickers imports #13120

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
DateRange,
FieldType,
} from '@mui/x-date-pickers-pro/models';
import { BaseSingleInputFieldProps } from '@mui/x-date-pickers';
import { BaseSingleInputFieldProps } from '@mui/x-date-pickers/models';

const BrowserFieldRoot = styled('div', { name: 'BrowserField', slot: 'Root' })({
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import dayjs, { Dayjs } from 'dayjs';
import { DemoContainer, DemoItem } from '@mui/x-date-pickers/internals/demo';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DateRange } from '@mui/x-date-pickers-pro';
import { DateRange } from '@mui/x-date-pickers-pro/models';
import { DateTimeRangePicker } from '@mui/x-date-pickers-pro/DateTimeRangePicker';

export default function DateTimeRangePickerValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ import Stack from '@mui/material/Stack';
import Button from '@mui/material/Button';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import {
FieldSectionType,
FieldSelectedSections,
RangePosition,
} from '@mui/x-date-pickers-pro';
import { FieldSectionType, FieldSelectedSections } from '@mui/x-date-pickers/models';
import { RangePosition } from '@mui/x-date-pickers-pro/models';
import { MultiInputDateRangeField } from '@mui/x-date-pickers-pro/MultiInputDateRangeField';

export default function ControlledSelectedSectionsMultiInputRangeField() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import {
FieldSectionType,
FieldSelectedSections,
FieldRef,
RangeFieldSection,
RangePosition,
} from '@mui/x-date-pickers-pro';
} from '@mui/x-date-pickers/models';
import { RangeFieldSection, RangePosition } from '@mui/x-date-pickers-pro/models';
import { SingleInputDateRangeField } from '@mui/x-date-pickers-pro/SingleInputDateRangeField';

export default function ControlledSelectedSectionsSingleInputRangeField() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DatePicker } from '@mui/x-date-pickers';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

<DatePicker PopperProps={{ onClick: handleClick }} />;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DatePicker } from '@mui/x-date-pickers';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

<DatePicker
componentsProps={{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DatePicker } from '@mui/x-date-pickers';
import { DateRangePicker } from '@mui/x-date-pickers-pro';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
import TextField from '@mui/material/TextField';

<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DatePicker } from '@mui/x-date-pickers';
import { DateRangePicker } from '@mui/x-date-pickers-pro';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
import TextField from '@mui/material/TextField';

<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

<LocalizationProvider>
<DatePicker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';

<LocalizationProvider>
<DatePicker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// @ts-nocheck
import * as React from 'react';
import { DatePicker, dayPickerClasses } from '@mui/x-date-pickers';
import { DateRangePicker, DateRangePickerSlotsComponentsProps } from '@mui/x-date-pickers-pro';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { dayPickerClasses } from '@mui/x-date-pickers/DateCalendar';
// prettier-ignore
import {
DateRangePicker,
DateRangePickerSlotsComponentsProps,
} from '@mui/x-date-pickers-pro/DateRangePicker';
import TextField from '@mui/material/TextField';

const className = dayPickerClasses.root;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// @ts-nocheck
import * as React from 'react';
import { DatePicker, dayCalendarClasses } from '@mui/x-date-pickers';
import { DateRangePicker, DateRangePickerSlotProps } from '@mui/x-date-pickers-pro';
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
import { dayCalendarClasses } from '@mui/x-date-pickers/DateCalendar';
// prettier-ignore
import {
DateRangePicker,
DateRangePickerSlotProps,
} from '@mui/x-date-pickers-pro/DateRangePicker';
import TextField from '@mui/material/TextField';

const className = dayCalendarClasses.root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { expect } from 'chai';
import { spy } from 'sinon';
import { screen, fireEvent, userEvent, act, getByRole } from '@mui-internal/test-utils';
import { createTheme, ThemeProvider } from '@mui/material/styles';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { DesktopDateRangePicker } from '@mui/x-date-pickers-pro/DesktopDateRangePicker';
import { DateRange, LocalizationProvider } from '@mui/x-date-pickers-pro';
import { DateRange } from '@mui/x-date-pickers-pro/models';
import { SingleInputDateRangeField } from '@mui/x-date-pickers-pro/SingleInputDateRangeField';
import {
createPickerRenderer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { DateTimeField } from '@mui/x-date-pickers';
import { DateTimeField } from '@mui/x-date-pickers/DateTimeField';
import { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalali';
import {
createPickerRenderer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { DateTimeField } from '@mui/x-date-pickers';
import { DateTimeField } from '@mui/x-date-pickers/DateTimeField';
import { AdapterDateFnsJalali } from '@mui/x-date-pickers/AdapterDateFnsJalaliV3';
import {
createPickerRenderer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dayjs, { Dayjs } from 'dayjs';
import { DateTimeField } from '@mui/x-date-pickers';
import { DateTimeField } from '@mui/x-date-pickers/DateTimeField';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { AdapterFormats } from '@mui/x-date-pickers/models';
import { expect } from 'chai';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai';
import { DateTime, Settings } from 'luxon';
import { DateTimeField } from '@mui/x-date-pickers';
import { DateTimeField } from '@mui/x-date-pickers/DateTimeField';
import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
import { AdapterFormats } from '@mui/x-date-pickers/models';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import moment, { Moment } from 'moment';
import momentTZ from 'moment-timezone';
import { DateTimeField } from '@mui/x-date-pickers';
import { DateTimeField } from '@mui/x-date-pickers/DateTimeField';
import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment';
import { AdapterFormats } from '@mui/x-date-pickers/models';
import { expect } from 'chai';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import moment from 'moment';
import { expect } from 'chai';
import { DateTimeField } from '@mui/x-date-pickers';
import { DateTimeField } from '@mui/x-date-pickers/DateTimeField';
import { AdapterMomentHijri } from '@mui/x-date-pickers/AdapterMomentHijri';
import { AdapterFormats } from '@mui/x-date-pickers/models';
import {
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,10 @@ async function initializeEnvironment(
});

it('should correctly select hours section when there are no time renderers on v6', async () => {
// The test is flaky on webkit
if (browserType.name() === 'webkit') {
return;
}
await renderFixture(
'DatePicker/DesktopDateTimePickerNoTimeRenderers?enableAccessibleFieldDOMStructure=false',
);
Expand Down