diff --git a/docs/src/modules/components/PickersPlayground.tsx b/docs/src/modules/components/PickersPlayground.tsx index 5d47348d87b7..f304336adfea 100644 --- a/docs/src/modules/components/PickersPlayground.tsx +++ b/docs/src/modules/components/PickersPlayground.tsx @@ -32,14 +32,11 @@ import { } from '@mui/x-date-pickers/StaticDateTimePicker'; import { DateOrTimeView } from '@mui/x-date-pickers/models'; import { PickersShortcutsItem } from '@mui/x-date-pickers/PickersShortcuts'; -import { DateRange } from '@mui/x-date-pickers-pro/internals/models'; +import { DateRange } from '@mui/x-date-pickers-pro'; import { DesktopDateRangePicker } from '@mui/x-date-pickers-pro/DesktopDateRangePicker'; import { MobileDateRangePicker } from '@mui/x-date-pickers-pro/MobileDateRangePicker'; import { StaticDateRangePicker } from '@mui/x-date-pickers-pro/StaticDateRangePicker'; -// eslint-disable-next-line no-restricted-imports -import { isDatePickerView } from '@mui/x-date-pickers/internals/utils/date-utils'; -// eslint-disable-next-line no-restricted-imports -import { isTimeView } from '@mui/x-date-pickers/internals/utils/time-utils'; +import { isDatePickerView, isTimeView } from '@mui/x-date-pickers/internals'; function RadioGroupControl({ label, diff --git a/packages/x-date-pickers-pro/src/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.ts b/packages/x-date-pickers-pro/src/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.ts index 039295c74868..1dfb93aeeec0 100644 --- a/packages/x-date-pickers-pro/src/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.ts +++ b/packages/x-date-pickers-pro/src/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.ts @@ -1,7 +1,7 @@ import * as React from 'react'; import { SlotComponentProps } from '@mui/base/utils'; import TextField from '@mui/material/TextField'; -import { FieldsTextFieldProps } from '@mui/x-date-pickers/internals/models/fields'; +import { FieldsTextFieldProps } from '@mui/x-date-pickers/internals'; import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks'; import { UseDateTimeRangeFieldDefaultizedProps, diff --git a/packages/x-date-pickers-pro/src/SingleInputTimeRangeField/SingleInputTimeRangeField.types.ts b/packages/x-date-pickers-pro/src/SingleInputTimeRangeField/SingleInputTimeRangeField.types.ts index 7236f528f407..aee8a1558ebc 100644 --- a/packages/x-date-pickers-pro/src/SingleInputTimeRangeField/SingleInputTimeRangeField.types.ts +++ b/packages/x-date-pickers-pro/src/SingleInputTimeRangeField/SingleInputTimeRangeField.types.ts @@ -1,7 +1,7 @@ import * as React from 'react'; import { SlotComponentProps } from '@mui/base/utils'; import TextField from '@mui/material/TextField'; -import { FieldsTextFieldProps } from '@mui/x-date-pickers/internals/models/fields'; +import { FieldsTextFieldProps } from '@mui/x-date-pickers/internals'; import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks'; import { UseTimeRangeFieldDefaultizedProps, UseTimeRangeFieldProps } from '../internals/models'; diff --git a/packages/x-date-pickers-pro/src/dateRangeViewRenderers/dateRangeViewRenderers.tsx b/packages/x-date-pickers-pro/src/dateRangeViewRenderers/dateRangeViewRenderers.tsx index 1a0913b18a59..0f5a5723c9c8 100644 --- a/packages/x-date-pickers-pro/src/dateRangeViewRenderers/dateRangeViewRenderers.tsx +++ b/packages/x-date-pickers-pro/src/dateRangeViewRenderers/dateRangeViewRenderers.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models'; +import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals'; import { DateRangeCalendar, DateRangeCalendarProps } from '../DateRangeCalendar'; export interface DateRangeViewRendererProps diff --git a/packages/x-date-pickers-pro/src/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.tsx b/packages/x-date-pickers-pro/src/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.tsx index 06561576defd..6e85ef639e91 100644 --- a/packages/x-date-pickers-pro/src/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.tsx +++ b/packages/x-date-pickers-pro/src/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.tsx @@ -11,8 +11,8 @@ import { InferError, ExportedBaseToolbarProps, BaseFieldProps, + DateOrTimeViewWithMeridiem, } from '@mui/x-date-pickers/internals'; -import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models'; import { DesktopRangePickerAdditionalViewProps, UseDesktopRangePickerParams, diff --git a/packages/x-date-pickers-pro/src/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.ts b/packages/x-date-pickers-pro/src/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.ts index 82fb408e07fc..70aea28a4e6d 100644 --- a/packages/x-date-pickers-pro/src/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.ts +++ b/packages/x-date-pickers-pro/src/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.ts @@ -8,8 +8,8 @@ import { BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, + DateOrTimeViewWithMeridiem, } from '@mui/x-date-pickers/internals'; -import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models'; import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, diff --git a/packages/x-date-pickers-pro/src/internals/hooks/useEnrichedRangePickerFieldProps.ts b/packages/x-date-pickers-pro/src/internals/hooks/useEnrichedRangePickerFieldProps.ts index eb7280552870..f348d8403b79 100644 --- a/packages/x-date-pickers-pro/src/internals/hooks/useEnrichedRangePickerFieldProps.ts +++ b/packages/x-date-pickers-pro/src/internals/hooks/useEnrichedRangePickerFieldProps.ts @@ -7,7 +7,6 @@ import useEventCallback from '@mui/utils/useEventCallback'; import useForkRef from '@mui/utils/useForkRef'; import { BaseSingleInputFieldProps, FieldSelectedSections } from '@mui/x-date-pickers/models'; import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks'; -import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models'; import { PickersInputLocaleText } from '@mui/x-date-pickers/locales'; import { BaseFieldProps, @@ -17,6 +16,7 @@ import { WrapperVariant, UsePickerProps, getActiveElement, + DateOrTimeViewWithMeridiem, } from '@mui/x-date-pickers/internals'; import { BaseMultiInputFieldProps, diff --git a/packages/x-date-pickers-pro/src/internals/hooks/useMobileRangePicker/useMobileRangePicker.tsx b/packages/x-date-pickers-pro/src/internals/hooks/useMobileRangePicker/useMobileRangePicker.tsx index 09cb5a63868c..0307dc16b4d2 100644 --- a/packages/x-date-pickers-pro/src/internals/hooks/useMobileRangePicker/useMobileRangePicker.tsx +++ b/packages/x-date-pickers-pro/src/internals/hooks/useMobileRangePicker/useMobileRangePicker.tsx @@ -9,9 +9,9 @@ import { InferError, ExportedBaseToolbarProps, useLocaleText, + DateOrTimeViewWithMeridiem, } from '@mui/x-date-pickers/internals'; import useId from '@mui/utils/useId'; -import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models'; import { MobileRangePickerAdditionalViewProps, UseMobileRangePickerParams, diff --git a/packages/x-date-pickers-pro/src/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.ts b/packages/x-date-pickers-pro/src/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.ts index 5092246c33ce..e718c4795c96 100644 --- a/packages/x-date-pickers-pro/src/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.ts +++ b/packages/x-date-pickers-pro/src/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.ts @@ -8,12 +8,12 @@ import { BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, + DateOrTimeViewWithMeridiem, } from '@mui/x-date-pickers/internals'; import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, } from '@mui/x-date-pickers/PickersLayout'; -import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models'; import { DateRange, RangeFieldSection, BaseRangeNonStaticPickerProps } from '../../models'; import { UseRangePositionProps, UseRangePositionResponse } from '../useRangePosition'; import { diff --git a/packages/x-date-pickers-pro/src/internals/hooks/useStaticRangePicker/useStaticRangePicker.tsx b/packages/x-date-pickers-pro/src/internals/hooks/useStaticRangePicker/useStaticRangePicker.tsx index 606955b29279..19f936054acb 100644 --- a/packages/x-date-pickers-pro/src/internals/hooks/useStaticRangePicker/useStaticRangePicker.tsx +++ b/packages/x-date-pickers-pro/src/internals/hooks/useStaticRangePicker/useStaticRangePicker.tsx @@ -3,8 +3,12 @@ import clsx from 'clsx'; import { styled } from '@mui/material/styles'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { PickersLayout, PickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout'; -import { usePicker, DIALOG_WIDTH, ExportedBaseToolbarProps } from '@mui/x-date-pickers/internals'; -import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models'; +import { + usePicker, + DIALOG_WIDTH, + ExportedBaseToolbarProps, + DateOrTimeViewWithMeridiem, +} from '@mui/x-date-pickers/internals'; import { UseStaticRangePickerParams, UseStaticRangePickerProps, diff --git a/packages/x-date-pickers-pro/src/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.ts b/packages/x-date-pickers-pro/src/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.ts index c44fa2c89bda..0dd78a2c290b 100644 --- a/packages/x-date-pickers-pro/src/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.ts +++ b/packages/x-date-pickers-pro/src/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.ts @@ -4,12 +4,12 @@ import { UsePickerParams, ExportedBaseToolbarProps, StaticOnlyPickerProps, + DateOrTimeViewWithMeridiem, } from '@mui/x-date-pickers/internals'; import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, } from '@mui/x-date-pickers/PickersLayout'; -import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models'; import { DateRange } from '../../models/range'; import { UseRangePositionProps } from '../useRangePosition'; import { RangeFieldSection } from '../../models/fields'; diff --git a/packages/x-date-pickers/src/MultiSectionDigitalClock/tests/describes.MultiSectionDigitalClock.test.tsx b/packages/x-date-pickers/src/MultiSectionDigitalClock/tests/describes.MultiSectionDigitalClock.test.tsx index 27953657a3a8..a83109110967 100644 --- a/packages/x-date-pickers/src/MultiSectionDigitalClock/tests/describes.MultiSectionDigitalClock.test.tsx +++ b/packages/x-date-pickers/src/MultiSectionDigitalClock/tests/describes.MultiSectionDigitalClock.test.tsx @@ -10,7 +10,7 @@ import { describeValue, } from 'test/utils/pickers'; import { MultiSectionDigitalClock } from '@mui/x-date-pickers/MultiSectionDigitalClock'; -import { formatMeridiem } from '@mui/x-date-pickers/internals/utils/date-utils'; +import { formatMeridiem } from '@mui/x-date-pickers/internals'; describe(' - Describes', () => { const { render, clock } = createPickerRenderer({ clock: 'fake' }); diff --git a/packages/x-date-pickers/src/internals/index.ts b/packages/x-date-pickers/src/internals/index.ts index 36728e047c28..ae84cf9ff369 100644 --- a/packages/x-date-pickers/src/internals/index.ts +++ b/packages/x-date-pickers/src/internals/index.ts @@ -90,7 +90,8 @@ export { useLocaleText, useNow, } from './hooks/useUtils'; -export type { ExportedUseViewsOptions } from './hooks/useViews'; +export type { ExportedUseViewsOptions, UseViewsOptions } from './hooks/useViews'; +export { useViews } from './hooks/useViews'; export { useValidation } from './hooks/useValidation'; export type { ValidationProps, Validator, InferError } from './hooks/useValidation'; export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks'; @@ -101,9 +102,15 @@ export type { BasePickerInputProps, BaseNonStaticPickerProps, } from './models/props/basePickerProps'; +export type { BaseClockProps, DesktopOnlyTimePickerProps } from './models/props/clock'; +export type { BaseTabsProps, ExportedBaseTabsProps } from './models/props/tabs'; export type { BaseToolbarProps, ExportedBaseToolbarProps } from './models/props/toolbar'; export type { DefaultizedProps, MakeOptional } from './models/helpers'; -export type { WrapperVariant } from './models/common'; +export type { + WrapperVariant, + TimeViewWithMeridiem, + DateOrTimeViewWithMeridiem, +} from './models/common'; export type { BaseDateValidationProps, BaseTimeValidationProps, @@ -120,7 +127,11 @@ export { replaceInvalidDateByNull, areDatesEqual, getTodayDate, + isDatePickerView, + mergeDateAndTime, + formatMeridiem, } from './utils/date-utils'; +export { resolveTimeViewsResponse } from './utils/date-time-utils'; export { splitFieldInternalAndForwardedProps } from './utils/fields'; export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate'; export { @@ -134,6 +145,7 @@ export { extractValidationProps } from './utils/validation/extractValidationProp export { validateDate } from './utils/validation/validateDate'; export { validateDateTime } from './utils/validation/validateDateTime'; export { validateTime } from './utils/validation/validateTime'; +export { applyDefaultViewProps } from './utils/views'; export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning'; export { DayCalendar } from '../DateCalendar/DayCalendar'; @@ -146,3 +158,5 @@ export type { export type { ExportedDateCalendarProps } from '../DateCalendar/DateCalendar.types'; export { useCalendarState } from '../DateCalendar/useCalendarState'; + +export { isTimeView } from './utils/time-utils'; diff --git a/packages/x-date-pickers/src/internals/models/common.ts b/packages/x-date-pickers/src/internals/models/common.ts index fed0d479c57e..702ab2e87a08 100644 --- a/packages/x-date-pickers/src/internals/models/common.ts +++ b/packages/x-date-pickers/src/internals/models/common.ts @@ -1,4 +1,4 @@ -import { DateView, TimeView } from '@mui/x-date-pickers/models/views'; +import { DateView, TimeView } from '../../models/views'; export type WrapperVariant = 'mobile' | 'desktop' | null; diff --git a/test/utils/pickers/viewHandlers.ts b/test/utils/pickers/viewHandlers.ts index 8a723c2bf2c7..689589174033 100644 --- a/test/utils/pickers/viewHandlers.ts +++ b/test/utils/pickers/viewHandlers.ts @@ -1,7 +1,7 @@ import { fireTouchChangedEvent, userEvent, screen } from '@mui-internal/test-utils'; import { getClockTouchEvent, formatFullTimeValue } from 'test/utils/pickers'; import { MuiPickersAdapter, TimeView } from '@mui/x-date-pickers/models'; -import { formatMeridiem } from '@mui/x-date-pickers/internals/utils/date-utils'; +import { formatMeridiem } from '@mui/x-date-pickers/internals'; type TDate = any;