From 51cc2b35eea99b265f73682eb8836e54c550e8ed Mon Sep 17 00:00:00 2001 From: flavien Date: Wed, 6 Nov 2024 10:56:00 +0100 Subject: [PATCH 1/3] [pickers] Remove plural in Pickers on the new contexts --- .../custom-components/ActionBarComponent.js | 4 +-- .../custom-components/ActionBarComponent.tsx | 4 +-- .../behavior-button/MaterialDatePicker.js | 10 +++--- .../behavior-button/MaterialDatePicker.tsx | 10 +++--- .../MaterialDateRangePicker.js | 10 +++--- .../MaterialDateRangePicker.tsx | 10 +++--- .../MaterialDatePicker.js | 10 +++--- .../MaterialDatePicker.tsx | 10 +++--- .../date-pickers/localization/localization.md | 6 ++-- .../migration-pickers-v7.md | 36 ++++++++++++++++++- .../DateRangePickerToolbar.tsx | 4 +-- .../DateTimeRangePickerTabs.tsx | 4 +-- .../DateTimeRangePickerToolbar.tsx | 4 +-- .../DesktopDateTimeRangePicker.tsx | 4 +-- .../PickersRangeCalendarHeader.tsx | 4 +-- .../useDesktopRangePicker.tsx | 6 ++-- .../hooks/useEnrichedRangePickerFieldProps.ts | 4 +-- .../useMobileRangePicker.tsx | 10 +++--- .../useStaticRangePicker.tsx | 6 ++-- .../src/DateCalendar/DayCalendar.tsx | 4 +-- .../src/DatePicker/DatePickerToolbar.tsx | 4 +-- .../src/DateTimePicker/DateTimePickerTabs.tsx | 4 +-- .../DateTimePicker/DateTimePickerToolbar.tsx | 4 +-- .../DesktopDatePicker/DesktopDatePicker.tsx | 4 +-- .../DesktopDateTimePicker.tsx | 8 ++--- .../DesktopTimePicker/DesktopTimePicker.tsx | 4 +-- .../src/DigitalClock/DigitalClock.tsx | 4 +-- .../src/MobileDatePicker/MobileDatePicker.tsx | 4 +-- .../MobileDateTimePicker.tsx | 4 +-- .../src/MobileTimePicker/MobileTimePicker.tsx | 4 +-- .../MultiSectionDigitalClock.tsx | 4 +-- .../src/PickersActionBar/PickersActionBar.tsx | 4 +-- .../PickersCalendarHeader.tsx | 4 +-- .../src/PickersLayout/PickersLayout.types.ts | 6 ++-- .../x-date-pickers/src/PickersLayout/index.ts | 2 +- .../src/PickersLayout/usePickerLayout.tsx | 10 +++--- .../x-date-pickers/src/TimeClock/Clock.tsx | 4 +-- .../src/TimeClock/TimeClock.tsx | 4 +-- .../src/TimePicker/TimePickerToolbar.tsx | 4 +-- packages/x-date-pickers/src/hooks/index.tsx | 4 +-- .../src/hooks/useClearableField.tsx | 4 +-- .../src/hooks/useParsedFormat.ts | 4 +-- .../src/hooks/usePickerContext.ts | 19 ++++++++++ ...anslations.ts => usePickerTranslations.ts} | 2 +- .../src/hooks/usePickersContext.ts | 19 ---------- ...PickersProvider.tsx => PickerProvider.tsx} | 24 ++++++------- .../useDesktopPicker/useDesktopPicker.tsx | 6 ++-- .../internals/hooks/useField/useFieldState.ts | 4 +-- .../hooks/useField/useFieldV7TextField.ts | 4 +-- .../hooks/useMobilePicker/useMobilePicker.tsx | 6 ++-- .../hooks/usePicker/usePickerProvider.ts | 16 ++++----- .../hooks/usePickerPrivateContext.ts | 17 +++++++++ .../hooks/usePickersPrivateContext.ts | 17 --------- .../hooks/useStaticPicker/useStaticPicker.tsx | 6 ++-- .../x-date-pickers/src/internals/index.ts | 2 +- scripts/x-date-pickers-pro.exports.json | 6 ++-- scripts/x-date-pickers.exports.json | 6 ++-- 57 files changed, 223 insertions(+), 189 deletions(-) create mode 100644 packages/x-date-pickers/src/hooks/usePickerContext.ts rename packages/x-date-pickers/src/hooks/{usePickersTranslations.ts => usePickerTranslations.ts} (51%) delete mode 100644 packages/x-date-pickers/src/hooks/usePickersContext.ts rename packages/x-date-pickers/src/internals/components/{PickersProvider.tsx => PickerProvider.tsx} (65%) create mode 100644 packages/x-date-pickers/src/internals/hooks/usePickerPrivateContext.ts delete mode 100644 packages/x-date-pickers/src/internals/hooks/usePickersPrivateContext.ts diff --git a/docs/data/date-pickers/custom-components/ActionBarComponent.js b/docs/data/date-pickers/custom-components/ActionBarComponent.js index 799d4441ee332..94e402db3cb9d 100644 --- a/docs/data/date-pickers/custom-components/ActionBarComponent.js +++ b/docs/data/date-pickers/custom-components/ActionBarComponent.js @@ -9,11 +9,11 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { StaticDatePicker } from '@mui/x-date-pickers/StaticDatePicker'; -import { usePickersTranslations } from '@mui/x-date-pickers/hooks'; +import { usePickerTranslations } from '@mui/x-date-pickers/hooks'; function CustomActionBar(props) { const { onAccept, onClear, onCancel, onSetToday, actions, className } = props; - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const [anchorEl, setAnchorEl] = React.useState(null); const open = Boolean(anchorEl); const id = useId(); diff --git a/docs/data/date-pickers/custom-components/ActionBarComponent.tsx b/docs/data/date-pickers/custom-components/ActionBarComponent.tsx index a5a6319516c90..e28c354c962a4 100644 --- a/docs/data/date-pickers/custom-components/ActionBarComponent.tsx +++ b/docs/data/date-pickers/custom-components/ActionBarComponent.tsx @@ -9,11 +9,11 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { StaticDatePicker } from '@mui/x-date-pickers/StaticDatePicker'; import { PickersActionBarProps } from '@mui/x-date-pickers/PickersActionBar'; -import { usePickersTranslations } from '@mui/x-date-pickers/hooks'; +import { usePickerTranslations } from '@mui/x-date-pickers/hooks'; function CustomActionBar(props: PickersActionBarProps) { const { onAccept, onClear, onCancel, onSetToday, actions, className } = props; - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const [anchorEl, setAnchorEl] = React.useState(null); const open = Boolean(anchorEl); const id = useId(); diff --git a/docs/data/date-pickers/custom-field/behavior-button/MaterialDatePicker.js b/docs/data/date-pickers/custom-field/behavior-button/MaterialDatePicker.js index 6082f6580ca7c..f9306981aac0c 100644 --- a/docs/data/date-pickers/custom-field/behavior-button/MaterialDatePicker.js +++ b/docs/data/date-pickers/custom-field/behavior-button/MaterialDatePicker.js @@ -7,7 +7,7 @@ import { useValidation, validateDate } from '@mui/x-date-pickers/validation'; import { useSplitFieldProps, useParsedFormat, - usePickersContext, + usePickerContext, } from '@mui/x-date-pickers/hooks'; function ButtonDateField(props) { @@ -24,7 +24,7 @@ function ButtonDateField(props) { ...other } = forwardedProps; - const pickersContext = usePickersContext(); + const pickerContext = usePickerContext(); const parsedFormat = useParsedFormat(internalProps); const { hasValidationError } = useValidation({ @@ -35,10 +35,10 @@ function ButtonDateField(props) { }); const handleTogglePicker = (event) => { - if (pickersContext.open) { - pickersContext.onClose(event); + if (pickerContext.open) { + pickerContext.onClose(event); } else { - pickersContext.onOpen(event); + pickerContext.onOpen(event); } }; diff --git a/docs/data/date-pickers/custom-field/behavior-button/MaterialDatePicker.tsx b/docs/data/date-pickers/custom-field/behavior-button/MaterialDatePicker.tsx index ae9ffb08d896c..ac64ebd3a5f01 100644 --- a/docs/data/date-pickers/custom-field/behavior-button/MaterialDatePicker.tsx +++ b/docs/data/date-pickers/custom-field/behavior-button/MaterialDatePicker.tsx @@ -11,7 +11,7 @@ import { useValidation, validateDate } from '@mui/x-date-pickers/validation'; import { useSplitFieldProps, useParsedFormat, - usePickersContext, + usePickerContext, } from '@mui/x-date-pickers/hooks'; function ButtonDateField(props: DatePickerFieldProps) { @@ -28,7 +28,7 @@ function ButtonDateField(props: DatePickerFieldProps) { ...other } = forwardedProps; - const pickersContext = usePickersContext(); + const pickerContext = usePickerContext(); const parsedFormat = useParsedFormat(internalProps); const { hasValidationError } = useValidation({ @@ -39,10 +39,10 @@ function ButtonDateField(props: DatePickerFieldProps) { }); const handleTogglePicker = (event: React.UIEvent) => { - if (pickersContext.open) { - pickersContext.onClose(event); + if (pickerContext.open) { + pickerContext.onClose(event); } else { - pickersContext.onOpen(event); + pickerContext.onOpen(event); } }; diff --git a/docs/data/date-pickers/custom-field/behavior-button/MaterialDateRangePicker.js b/docs/data/date-pickers/custom-field/behavior-button/MaterialDateRangePicker.js index f9fc03f45d578..7c56f7a2693a0 100644 --- a/docs/data/date-pickers/custom-field/behavior-button/MaterialDateRangePicker.js +++ b/docs/data/date-pickers/custom-field/behavior-button/MaterialDateRangePicker.js @@ -9,7 +9,7 @@ import { validateDateRange } from '@mui/x-date-pickers-pro/validation'; import { useSplitFieldProps, useParsedFormat, - usePickersContext, + usePickerContext, } from '@mui/x-date-pickers/hooks'; function ButtonDateRangeField(props) { @@ -26,7 +26,7 @@ function ButtonDateRangeField(props) { ...other } = forwardedProps; - const pickersContext = usePickersContext(); + const pickerContext = usePickerContext(); const parsedFormat = useParsedFormat(internalProps); const { hasValidationError } = useValidation({ @@ -37,10 +37,10 @@ function ButtonDateRangeField(props) { }); const handleTogglePicker = (event) => { - if (pickersContext.open) { - pickersContext.onClose(event); + if (pickerContext.open) { + pickerContext.onClose(event); } else { - pickersContext.onOpen(event); + pickerContext.onOpen(event); } }; diff --git a/docs/data/date-pickers/custom-field/behavior-button/MaterialDateRangePicker.tsx b/docs/data/date-pickers/custom-field/behavior-button/MaterialDateRangePicker.tsx index 522fe8a047b4e..fbc0cd45c51ee 100644 --- a/docs/data/date-pickers/custom-field/behavior-button/MaterialDateRangePicker.tsx +++ b/docs/data/date-pickers/custom-field/behavior-button/MaterialDateRangePicker.tsx @@ -13,7 +13,7 @@ import { validateDateRange } from '@mui/x-date-pickers-pro/validation'; import { useSplitFieldProps, useParsedFormat, - usePickersContext, + usePickerContext, } from '@mui/x-date-pickers/hooks'; function ButtonDateRangeField(props: DateRangePickerFieldProps) { @@ -30,7 +30,7 @@ function ButtonDateRangeField(props: DateRangePickerFieldProps) { ...other } = forwardedProps; - const pickersContext = usePickersContext(); + const pickerContext = usePickerContext(); const parsedFormat = useParsedFormat(internalProps); const { hasValidationError } = useValidation({ @@ -41,10 +41,10 @@ function ButtonDateRangeField(props: DateRangePickerFieldProps) { }); const handleTogglePicker = (event: React.UIEvent) => { - if (pickersContext.open) { - pickersContext.onClose(event); + if (pickerContext.open) { + pickerContext.onClose(event); } else { - pickersContext.onOpen(event); + pickerContext.onOpen(event); } }; diff --git a/docs/data/date-pickers/custom-field/behavior-read-only-text-field/MaterialDatePicker.js b/docs/data/date-pickers/custom-field/behavior-read-only-text-field/MaterialDatePicker.js index 7c83e6a7480aa..1e7d773f6fdf6 100644 --- a/docs/data/date-pickers/custom-field/behavior-read-only-text-field/MaterialDatePicker.js +++ b/docs/data/date-pickers/custom-field/behavior-read-only-text-field/MaterialDatePicker.js @@ -7,7 +7,7 @@ import { useValidation, validateDate } from '@mui/x-date-pickers/validation'; import { useSplitFieldProps, useParsedFormat, - usePickersContext, + usePickerContext, } from '@mui/x-date-pickers/hooks'; import { CalendarIcon } from '@mui/x-date-pickers/icons'; @@ -16,7 +16,7 @@ function ReadOnlyDateField(props) { const { value, timezone, format } = internalProps; const { InputProps, slotProps, slots, ...other } = forwardedProps; - const pickersContext = usePickersContext(); + const pickerContext = usePickerContext(); const parsedFormat = useParsedFormat(internalProps); const { hasValidationError } = useValidation({ @@ -27,10 +27,10 @@ function ReadOnlyDateField(props) { }); const handleTogglePicker = (event) => { - if (pickersContext.open) { - pickersContext.onClose(event); + if (pickerContext.open) { + pickerContext.onClose(event); } else { - pickersContext.onOpen(event); + pickerContext.onOpen(event); } }; diff --git a/docs/data/date-pickers/custom-field/behavior-read-only-text-field/MaterialDatePicker.tsx b/docs/data/date-pickers/custom-field/behavior-read-only-text-field/MaterialDatePicker.tsx index 9c06797fc2fcc..1fd235a778199 100644 --- a/docs/data/date-pickers/custom-field/behavior-read-only-text-field/MaterialDatePicker.tsx +++ b/docs/data/date-pickers/custom-field/behavior-read-only-text-field/MaterialDatePicker.tsx @@ -11,7 +11,7 @@ import { useValidation, validateDate } from '@mui/x-date-pickers/validation'; import { useSplitFieldProps, useParsedFormat, - usePickersContext, + usePickerContext, } from '@mui/x-date-pickers/hooks'; import { CalendarIcon } from '@mui/x-date-pickers/icons'; @@ -20,7 +20,7 @@ function ReadOnlyDateField(props: DatePickerFieldProps) { const { value, timezone, format } = internalProps; const { InputProps, slotProps, slots, ...other } = forwardedProps; - const pickersContext = usePickersContext(); + const pickerContext = usePickerContext(); const parsedFormat = useParsedFormat(internalProps); const { hasValidationError } = useValidation({ @@ -31,10 +31,10 @@ function ReadOnlyDateField(props: DatePickerFieldProps) { }); const handleTogglePicker = (event: React.UIEvent) => { - if (pickersContext.open) { - pickersContext.onClose(event); + if (pickerContext.open) { + pickerContext.onClose(event); } else { - pickersContext.onOpen(event); + pickerContext.onOpen(event); } }; diff --git a/docs/data/date-pickers/localization/localization.md b/docs/data/date-pickers/localization/localization.md index dab97f4bcb5dd..f447c100f5f7b 100644 --- a/docs/data/date-pickers/localization/localization.md +++ b/docs/data/date-pickers/localization/localization.md @@ -134,12 +134,12 @@ Note that these translations of the date and time picker components depend on th ## Access the translations in slots and subcomponents -You can use the `usePickersTranslations` hook to access the translations in your custom components. +You can use the `usePickerTranslations` hook to access the translations in your custom components. ```tsx -import { usePickersTranslations } from '@mui/x-date-pickers/hooks'; +import { usePickerTranslations } from '@mui/x-date-pickers/hooks'; -const translations = usePickersTranslations(); +const translations = usePickerTranslations(); ``` :::info diff --git a/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md b/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md index a7c30b0a931ba..818bae23e3f6b 100644 --- a/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md +++ b/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md @@ -259,6 +259,40 @@ const theme = createTheme({ }); ``` +## Renamed variables + +The following variables were renamed to have a coherent naming for the `Picker` / `Pickers` prefix: + +- `usePickersTranslation` + + ```diff + - import { usePickersTranslation } from '@mui/x-date-pickers/hooks'; + - import { usePickersTranslation } from '@mui/x-date-pickers'; + - import { usePickersTranslation } from '@mui/x-date-pickers-pro'; + + + import { usePickerTranslation } from '@mui/x-date-pickers/hooks'; + + import { usePickerTranslation } from '@mui/x-date-pickers'; + + import { usePickerTranslation } from '@mui/x-date-pickers-pro'; + + - const translations = usePickersTranslation(); + + const translations = usePickerTranslation(); + ``` + + - `usePickersContext` + + ```diff + - import { usePickersContext } from '@mui/x-date-pickers/hooks'; + - import { usePickersContext } from '@mui/x-date-pickers'; + - import { usePickersContext } from '@mui/x-date-pickers-pro'; + + + import { usePickersContext } from '@mui/x-date-pickers/hooks'; + + import { usePickersContext } from '@mui/x-date-pickers'; + + import { usePickersContext } from '@mui/x-date-pickers-pro'; + + - const pickersContext = usePickersContext(); + + const pickerContext = usePickerContext(); + ``` + ## Removed types The following types are no longer exported by `@mui/x-date-pickers` and/or `@mui/x-date-pickers-pro`. @@ -381,7 +415,7 @@ If you have customized those translation keys, you have to update them following - If you using this translation key in a custom component: ```diff - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); -const clockLabelText = translations.clockLabelText( - view, diff --git a/packages/x-date-pickers-pro/src/DateRangePicker/DateRangePickerToolbar.tsx b/packages/x-date-pickers-pro/src/DateRangePicker/DateRangePickerToolbar.tsx index 8273067b4870e..6e70d33da5fef 100644 --- a/packages/x-date-pickers-pro/src/DateRangePicker/DateRangePickerToolbar.tsx +++ b/packages/x-date-pickers-pro/src/DateRangePicker/DateRangePickerToolbar.tsx @@ -13,7 +13,7 @@ import { ExportedBaseToolbarProps, PickerRangeValue, } from '@mui/x-date-pickers/internals'; -import { usePickersTranslations } from '@mui/x-date-pickers/hooks'; +import { usePickerTranslations } from '@mui/x-date-pickers/hooks'; import { UseRangePositionResponse } from '../internals/hooks/useRangePosition'; import { DateRangePickerToolbarClasses, @@ -91,7 +91,7 @@ const DateRangePickerToolbar = React.forwardRef(function DateRangePickerToolbar( ...other } = props; - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) diff --git a/packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerTabs.tsx b/packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerTabs.tsx index dac5929e25672..a4139a783f6c6 100644 --- a/packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerTabs.tsx +++ b/packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerTabs.tsx @@ -12,7 +12,7 @@ import { ExportedBaseTabsProps, isDatePickerView, } from '@mui/x-date-pickers/internals'; -import { usePickersTranslations } from '@mui/x-date-pickers/hooks'; +import { usePickerTranslations } from '@mui/x-date-pickers/hooks'; import IconButton from '@mui/material/IconButton'; import Button from '@mui/material/Button'; import { @@ -123,7 +123,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs( sx, } = props; - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const classes = useUtilityClasses(props); const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]); const isPreviousHidden = value === 'start-date'; diff --git a/packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerToolbar.tsx b/packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerToolbar.tsx index cb78335558edf..aee4054975187 100644 --- a/packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerToolbar.tsx +++ b/packages/x-date-pickers-pro/src/DateTimeRangePicker/DateTimeRangePickerToolbar.tsx @@ -12,7 +12,7 @@ import { WrapperVariant, PickerRangeValue, } from '@mui/x-date-pickers/internals'; -import { usePickersTranslations } from '@mui/x-date-pickers/hooks'; +import { usePickerTranslations } from '@mui/x-date-pickers/hooks'; import { PickerValidDate } from '@mui/x-date-pickers/models'; import { DateTimePickerToolbarProps, @@ -156,7 +156,7 @@ const DateTimeRangePickerToolbar = React.forwardRef(function DateTimeRangePicker toolbarPlaceholder, }; - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const ownerState = props; const classes = useUtilityClasses(ownerState); diff --git a/packages/x-date-pickers-pro/src/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.tsx b/packages/x-date-pickers-pro/src/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.tsx index e40fc1df38fe2..c33ac34784034 100644 --- a/packages/x-date-pickers-pro/src/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.tsx +++ b/packages/x-date-pickers-pro/src/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.tsx @@ -13,7 +13,7 @@ import { } from '@mui/x-date-pickers/internals'; import { extractValidationProps } from '@mui/x-date-pickers/validation'; import { PickerOwnerState } from '@mui/x-date-pickers/models'; -import { PickersLayoutOwnerState } from '@mui/x-date-pickers/PickersLayout'; +import { PickerLayoutOwnerState } from '@mui/x-date-pickers/PickersLayout'; import resolveComponentProps from '@mui/utils/resolveComponentProps'; import { refType } from '@mui/utils'; import { @@ -193,7 +193,7 @@ const DesktopDateTimeRangePicker = React.forwardRef(function DesktopDateTimeRang toolbarVariant: 'desktop', ...defaultizedProps.slotProps?.toolbar, }, - actionBar: (ownerState: PickersLayoutOwnerState) => ({ + actionBar: (ownerState: PickerLayoutOwnerState) => ({ actions: actionBarActions, ...resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState), }), diff --git a/packages/x-date-pickers-pro/src/PickersRangeCalendarHeader/PickersRangeCalendarHeader.tsx b/packages/x-date-pickers-pro/src/PickersRangeCalendarHeader/PickersRangeCalendarHeader.tsx index af72f72fd33a4..52ac562a8e402 100644 --- a/packages/x-date-pickers-pro/src/PickersRangeCalendarHeader/PickersRangeCalendarHeader.tsx +++ b/packages/x-date-pickers-pro/src/PickersRangeCalendarHeader/PickersRangeCalendarHeader.tsx @@ -9,7 +9,7 @@ import { usePreviousMonthDisabled, useUtils, } from '@mui/x-date-pickers/internals'; -import { usePickersTranslations } from '@mui/x-date-pickers/hooks'; +import { usePickerTranslations } from '@mui/x-date-pickers/hooks'; import { PickersRangeCalendarHeaderProps } from './PickersRangeCalendarHeader.types'; type PickersRangeCalendarHeaderComponent = (( @@ -28,7 +28,7 @@ const PickersRangeCalendarHeader = React.forwardRef(function PickersRangeCalenda ref: React.Ref, ) { const utils = useUtils(); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const { calendars, month, monthIndex, labelId, ...other } = props; const { 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 a5d29869d304c..67ddaddd225e1 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 @@ -10,7 +10,7 @@ import { ExportedBaseToolbarProps, DateOrTimeViewWithMeridiem, ExportedBaseTabsProps, - PickersProvider, + PickerProvider, PickerRangeValue, } from '@mui/x-date-pickers/internals'; import { FieldRef, InferError, PickerOwnerState } from '@mui/x-date-pickers/models'; @@ -203,7 +203,7 @@ export const useDesktopRangePicker = < const Layout = slots?.layout ?? PickersLayout; const renderPicker = () => ( - + - + ); return { 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 efe41c95ec799..80b5dc2b99eeb 100644 --- a/packages/x-date-pickers-pro/src/internals/hooks/useEnrichedRangePickerFieldProps.ts +++ b/packages/x-date-pickers-pro/src/internals/hooks/useEnrichedRangePickerFieldProps.ts @@ -16,7 +16,7 @@ import { import { UseClearableFieldSlots, UseClearableFieldSlotProps, - usePickersTranslations, + usePickerTranslations, } from '@mui/x-date-pickers/hooks'; import { PickersInputLocaleText } from '@mui/x-date-pickers/locales'; import { @@ -170,7 +170,7 @@ const useMultiInputFieldSlotProps = < TError >; - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const handleStartFieldRef = useForkRef(fieldProps.unstableStartFieldRef, startFieldRef); const handleEndFieldRef = useForkRef(fieldProps.unstableEndFieldRef, endFieldRef); 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 aa9ab1b34b537..e7679af817a9c 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 @@ -8,10 +8,10 @@ import { ExportedBaseToolbarProps, DateOrTimeViewWithMeridiem, ExportedBaseTabsProps, - PickersProvider, + PickerProvider, PickerRangeValue, } from '@mui/x-date-pickers/internals'; -import { usePickersTranslations } from '@mui/x-date-pickers/hooks'; +import { usePickerTranslations } from '@mui/x-date-pickers/hooks'; import { FieldRef, InferError, PickerOwnerState } from '@mui/x-date-pickers/models'; import useId from '@mui/utils/useId'; import { @@ -74,7 +74,7 @@ export const useMobileRangePicker = < fieldType === 'single-input' ? startFieldRef : undefined, ); const labelId = useId(); - const contextTranslations = usePickersTranslations(); + const contextTranslations = usePickerTranslations(); const { open, @@ -208,7 +208,7 @@ export const useMobileRangePicker = < }; const renderPicker = () => ( - + - + ); return { 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 7fdd442279fc7..a2597d5bb2d1f 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 @@ -7,7 +7,7 @@ import { DIALOG_WIDTH, ExportedBaseToolbarProps, DateOrTimeViewWithMeridiem, - PickersProvider, + PickerProvider, PickerRangeValue, } from '@mui/x-date-pickers/internals'; import { @@ -69,7 +69,7 @@ export const useStaticRangePicker = < }; const renderPicker = () => ( - + {renderCurrentView()} - + ); return { renderPicker }; diff --git a/packages/x-date-pickers/src/DateCalendar/DayCalendar.tsx b/packages/x-date-pickers/src/DateCalendar/DayCalendar.tsx index b11eb878113d5..229c764fde1bc 100644 --- a/packages/x-date-pickers/src/DateCalendar/DayCalendar.tsx +++ b/packages/x-date-pickers/src/DateCalendar/DayCalendar.tsx @@ -11,7 +11,7 @@ import { import clsx from 'clsx'; import { DefaultizedProps, SlotComponentPropsFromProps } from '@mui/x-internals/types'; import { PickersDay, PickersDayProps, ExportedPickersDayProps } from '../PickersDay/PickersDay'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils, useNow } from '../internals/hooks/useUtils'; import { PickerOnChangeFn } from '../internals/hooks/useViews'; import { DAY_SIZE, DAY_MARGIN } from '../internals/constants/dimensions'; @@ -385,7 +385,7 @@ export function DayCalendar(inProps: DayCalendarProps) { timezone, }); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const [internalHasFocus, setInternalHasFocus] = useControlled({ name: 'DayCalendar', diff --git a/packages/x-date-pickers/src/DatePicker/DatePickerToolbar.tsx b/packages/x-date-pickers/src/DatePicker/DatePickerToolbar.tsx index 518a67af8914f..47da0086f1f21 100644 --- a/packages/x-date-pickers/src/DatePicker/DatePickerToolbar.tsx +++ b/packages/x-date-pickers/src/DatePicker/DatePickerToolbar.tsx @@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography'; import { styled, useThemeProps } from '@mui/material/styles'; import composeClasses from '@mui/utils/composeClasses'; import { PickersToolbar } from '../internals/components/PickersToolbar'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar'; import { DateView, PickerValidDate } from '../models'; @@ -90,7 +90,7 @@ export const DatePickerToolbar = React.forwardRef(function DatePickerToolbar( ...other } = props; const utils = useUtils(); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const classes = useUtilityClasses(props); const dateText = React.useMemo(() => { diff --git a/packages/x-date-pickers/src/DateTimePicker/DateTimePickerTabs.tsx b/packages/x-date-pickers/src/DateTimePicker/DateTimePickerTabs.tsx index 6f5a2a802b493..ea833fccc8777 100644 --- a/packages/x-date-pickers/src/DateTimePicker/DateTimePickerTabs.tsx +++ b/packages/x-date-pickers/src/DateTimePicker/DateTimePickerTabs.tsx @@ -8,7 +8,7 @@ import { styled, useThemeProps } from '@mui/material/styles'; import composeClasses from '@mui/utils/composeClasses'; import { TimeIcon, DateRangeIcon } from '../icons'; import { DateOrTimeViewWithMeridiem } from '../internals/models'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { DateTimePickerTabsClasses, getDateTimePickerTabsUtilityClass, @@ -106,7 +106,7 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps: DateTimePickerTa sx, } = props; - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const classes = useUtilityClasses(props); const handleChange = (event: React.SyntheticEvent, value: TabValue) => { diff --git a/packages/x-date-pickers/src/DateTimePicker/DateTimePickerToolbar.tsx b/packages/x-date-pickers/src/DateTimePicker/DateTimePickerToolbar.tsx index 760e096260068..0777eee1f5d9d 100644 --- a/packages/x-date-pickers/src/DateTimePicker/DateTimePickerToolbar.tsx +++ b/packages/x-date-pickers/src/DateTimePicker/DateTimePickerToolbar.tsx @@ -9,7 +9,7 @@ import { MakeOptional } from '@mui/x-internals/types'; import { PickersToolbarText } from '../internals/components/PickersToolbarText'; import { PickersToolbar } from '../internals/components/PickersToolbar'; import { PickersToolbarButton } from '../internals/components/PickersToolbarButton'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar'; import { @@ -259,7 +259,7 @@ function DateTimePickerToolbar(inProps: DateTimePickerToolbarProps) { const showAmPmControl = Boolean(ampm && !ampmInClock); const isDesktop = toolbarVariant === 'desktop'; - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const classes = useUtilityClasses(ownerState); const toolbarTitle = inToolbarTitle ?? translations.dateTimePickerToolbarTitle; diff --git a/packages/x-date-pickers/src/DesktopDatePicker/DesktopDatePicker.tsx b/packages/x-date-pickers/src/DesktopDatePicker/DesktopDatePicker.tsx index 2965274f70516..0a3d26a8440bb 100644 --- a/packages/x-date-pickers/src/DesktopDatePicker/DesktopDatePicker.tsx +++ b/packages/x-date-pickers/src/DesktopDatePicker/DesktopDatePicker.tsx @@ -6,7 +6,7 @@ import { refType } from '@mui/utils'; import { singleItemValueManager } from '../internals/utils/valueManagers'; import { DesktopDatePickerProps } from './DesktopDatePicker.types'; import { DatePickerViewRenderers, useDatePickerDefaultizedProps } from '../DatePicker/shared'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { validateDate, extractValidationProps } from '../validation'; import { DateView, PickerOwnerState } from '../models'; @@ -38,7 +38,7 @@ const DesktopDatePicker = React.forwardRef(function DesktopDatePicker< inProps: DesktopDatePickerProps, ref: React.Ref, ) { - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const utils = useUtils(); // Props with the default values common to all date pickers diff --git a/packages/x-date-pickers/src/DesktopDateTimePicker/DesktopDateTimePicker.tsx b/packages/x-date-pickers/src/DesktopDateTimePicker/DesktopDateTimePicker.tsx index 38cd175d522db..46d23d3b4950a 100644 --- a/packages/x-date-pickers/src/DesktopDateTimePicker/DesktopDateTimePicker.tsx +++ b/packages/x-date-pickers/src/DesktopDateTimePicker/DesktopDateTimePicker.tsx @@ -13,7 +13,7 @@ import { DateTimePickerViewRenderers, } from '../DateTimePicker/shared'; import { renderDateViewCalendar } from '../dateViewRenderers/dateViewRenderers'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { validateDateTime, extractValidationProps } from '../validation'; import { DateOrTimeViewWithMeridiem } from '../internals/models'; @@ -42,7 +42,7 @@ import { UsePickerViewsProps } from '../internals/hooks/usePicker/usePickerViews import { isInternalTimeView } from '../internals/utils/time-utils'; import { isDatePickerView } from '../internals/utils/date-utils'; import { buildGetOpenDialogAriaText } from '../locales/utils/getPickersLocalization'; -import { PickersLayoutOwnerState } from '../PickersLayout'; +import { PickerLayoutOwnerState } from '../PickersLayout'; const rendererInterceptor = function rendererInterceptor< TView extends DateOrTimeViewWithMeridiem, @@ -130,7 +130,7 @@ const DesktopDateTimePicker = React.forwardRef(function DesktopDateTimePicker< inProps: DesktopDateTimePickerProps, ref: React.Ref, ) { - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const utils = useUtils(); // Props with the default values common to all date time pickers @@ -205,7 +205,7 @@ const DesktopDateTimePicker = React.forwardRef(function DesktopDateTimePicker< hidden: true, ...defaultizedProps.slotProps?.tabs, }, - actionBar: (ownerState: PickersLayoutOwnerState) => ({ + actionBar: (ownerState: PickerLayoutOwnerState) => ({ actions: actionBarActions, ...resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState), }), diff --git a/packages/x-date-pickers/src/DesktopTimePicker/DesktopTimePicker.tsx b/packages/x-date-pickers/src/DesktopTimePicker/DesktopTimePicker.tsx index 7496b80d2e264..4f907b56acd0f 100644 --- a/packages/x-date-pickers/src/DesktopTimePicker/DesktopTimePicker.tsx +++ b/packages/x-date-pickers/src/DesktopTimePicker/DesktopTimePicker.tsx @@ -7,7 +7,7 @@ import { singleItemValueManager } from '../internals/utils/valueManagers'; import { TimeField } from '../TimeField'; import { DesktopTimePickerProps } from './DesktopTimePicker.types'; import { TimePickerViewRenderers, useTimePickerDefaultizedProps } from '../TimePicker/shared'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { extractValidationProps, validateTime } from '../validation'; import { ClockIcon } from '../icons'; @@ -44,7 +44,7 @@ const DesktopTimePicker = React.forwardRef(function DesktopTimePicker< inProps: DesktopTimePickerProps, ref: React.Ref, ) { - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const utils = useUtils(); // Props with the default values common to all time pickers diff --git a/packages/x-date-pickers/src/DigitalClock/DigitalClock.tsx b/packages/x-date-pickers/src/DigitalClock/DigitalClock.tsx index a5e1f5813a6b3..99648bf0228bf 100644 --- a/packages/x-date-pickers/src/DigitalClock/DigitalClock.tsx +++ b/packages/x-date-pickers/src/DigitalClock/DigitalClock.tsx @@ -9,7 +9,7 @@ import composeClasses from '@mui/utils/composeClasses'; import MenuItem from '@mui/material/MenuItem'; import MenuList from '@mui/material/MenuList'; import useForkRef from '@mui/utils/useForkRef'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils, useNow } from '../internals/hooks/useUtils'; import { createIsAfterIgnoreDatePart } from '../internals/utils/time-utils'; import { PickerViewRoot } from '../internals/components/PickerViewRoot'; @@ -167,7 +167,7 @@ export const DigitalClock = React.forwardRef(function DigitalClock( valueManager: singleItemValueManager, }); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const now = useNow(timezone); const ownerState = React.useMemo( diff --git a/packages/x-date-pickers/src/MobileDatePicker/MobileDatePicker.tsx b/packages/x-date-pickers/src/MobileDatePicker/MobileDatePicker.tsx index 4db881d752516..d84ccffb2a8c1 100644 --- a/packages/x-date-pickers/src/MobileDatePicker/MobileDatePicker.tsx +++ b/packages/x-date-pickers/src/MobileDatePicker/MobileDatePicker.tsx @@ -6,7 +6,7 @@ import { refType } from '@mui/utils'; import { useMobilePicker } from '../internals/hooks/useMobilePicker'; import { MobileDatePickerProps } from './MobileDatePicker.types'; import { DatePickerViewRenderers, useDatePickerDefaultizedProps } from '../DatePicker/shared'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { extractValidationProps, validateDate } from '../validation'; import { DateView, PickerOwnerState } from '../models'; @@ -37,7 +37,7 @@ const MobileDatePicker = React.forwardRef(function MobileDatePicker< inProps: MobileDatePickerProps, ref: React.Ref, ) { - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const utils = useUtils(); // Props with the default values common to all date pickers diff --git a/packages/x-date-pickers/src/MobileDateTimePicker/MobileDateTimePicker.tsx b/packages/x-date-pickers/src/MobileDateTimePicker/MobileDateTimePicker.tsx index 6d9c1b3c7bb54..805bfc4c0076c 100644 --- a/packages/x-date-pickers/src/MobileDateTimePicker/MobileDateTimePicker.tsx +++ b/packages/x-date-pickers/src/MobileDateTimePicker/MobileDateTimePicker.tsx @@ -10,7 +10,7 @@ import { DateTimePickerViewRenderers, useDateTimePickerDefaultizedProps, } from '../DateTimePicker/shared'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { extractValidationProps, validateDateTime } from '../validation'; import { DateOrTimeView, PickerOwnerState } from '../models'; @@ -41,7 +41,7 @@ const MobileDateTimePicker = React.forwardRef(function MobileDateTimePicker< inProps: MobileDateTimePickerProps, ref: React.Ref, ) { - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const utils = useUtils(); // Props with the default values common to all date time pickers diff --git a/packages/x-date-pickers/src/MobileTimePicker/MobileTimePicker.tsx b/packages/x-date-pickers/src/MobileTimePicker/MobileTimePicker.tsx index 43c653c1661a4..4c45e713330df 100644 --- a/packages/x-date-pickers/src/MobileTimePicker/MobileTimePicker.tsx +++ b/packages/x-date-pickers/src/MobileTimePicker/MobileTimePicker.tsx @@ -7,7 +7,7 @@ import { singleItemValueManager } from '../internals/utils/valueManagers'; import { TimeField } from '../TimeField'; import { MobileTimePickerProps } from './MobileTimePicker.types'; import { TimePickerViewRenderers, useTimePickerDefaultizedProps } from '../TimePicker/shared'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { extractValidationProps, validateTime } from '../validation'; import { PickerOwnerState, TimeView } from '../models'; @@ -37,7 +37,7 @@ const MobileTimePicker = React.forwardRef(function MobileTimePicker< inProps: MobileTimePickerProps, ref: React.Ref, ) { - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const utils = useUtils(); // Props with the default values common to all time pickers diff --git a/packages/x-date-pickers/src/MultiSectionDigitalClock/MultiSectionDigitalClock.tsx b/packages/x-date-pickers/src/MultiSectionDigitalClock/MultiSectionDigitalClock.tsx index 5648dbcc8d88d..ef980d15999e1 100644 --- a/packages/x-date-pickers/src/MultiSectionDigitalClock/MultiSectionDigitalClock.tsx +++ b/packages/x-date-pickers/src/MultiSectionDigitalClock/MultiSectionDigitalClock.tsx @@ -6,7 +6,7 @@ import { useRtl } from '@mui/system/RtlProvider'; import { styled, useThemeProps } from '@mui/material/styles'; import useEventCallback from '@mui/utils/useEventCallback'; import composeClasses from '@mui/utils/composeClasses'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils, useNow } from '../internals/hooks/useUtils'; import { convertValueToMeridiem, createIsAfterIgnoreDatePart } from '../internals/utils/time-utils'; import { useViews } from '../internals/hooks/useViews'; @@ -117,7 +117,7 @@ export const MultiSectionDigitalClock = React.forwardRef(function MultiSectionDi valueManager: singleItemValueManager, }); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const now = useNow(timezone); const timeSteps = React.useMemo>( diff --git a/packages/x-date-pickers/src/PickersActionBar/PickersActionBar.tsx b/packages/x-date-pickers/src/PickersActionBar/PickersActionBar.tsx index 59725fcb880a0..fc234d531ee84 100644 --- a/packages/x-date-pickers/src/PickersActionBar/PickersActionBar.tsx +++ b/packages/x-date-pickers/src/PickersActionBar/PickersActionBar.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import PropTypes from 'prop-types'; import Button from '@mui/material/Button'; import DialogActions, { DialogActionsProps } from '@mui/material/DialogActions'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; export type PickersActionBarAction = 'clear' | 'cancel' | 'accept' | 'today'; @@ -33,7 +33,7 @@ export interface PickersActionBarProps extends DialogActionsProps { function PickersActionBar(props: PickersActionBarProps) { const { onAccept, onClear, onCancel, onSetToday, actions, ...other } = props; - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); if (actions == null || actions.length === 0) { return null; diff --git a/packages/x-date-pickers/src/PickersCalendarHeader/PickersCalendarHeader.tsx b/packages/x-date-pickers/src/PickersCalendarHeader/PickersCalendarHeader.tsx index 238618dea4634..a3e90e38d7b9f 100644 --- a/packages/x-date-pickers/src/PickersCalendarHeader/PickersCalendarHeader.tsx +++ b/packages/x-date-pickers/src/PickersCalendarHeader/PickersCalendarHeader.tsx @@ -7,7 +7,7 @@ import { styled, useThemeProps } from '@mui/material/styles'; import useSlotProps from '@mui/utils/useSlotProps'; import composeClasses from '@mui/utils/composeClasses'; import IconButton from '@mui/material/IconButton'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { PickersFadeTransitionGroup } from '../DateCalendar/PickersFadeTransitionGroup'; import { ArrowDropDownIcon } from '../icons'; @@ -133,7 +133,7 @@ const PickersCalendarHeader = React.forwardRef(function PickersCalendarHeader( inProps: PickersCalendarHeaderProps, ref: React.Ref, ) { - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const utils = useUtils(); const props = useThemeProps({ props: inProps, name: 'MuiPickersCalendarHeader' }); diff --git a/packages/x-date-pickers/src/PickersLayout/PickersLayout.types.ts b/packages/x-date-pickers/src/PickersLayout/PickersLayout.types.ts index 503256858729d..fc3f594a45652 100644 --- a/packages/x-date-pickers/src/PickersLayout/PickersLayout.types.ts +++ b/packages/x-date-pickers/src/PickersLayout/PickersLayout.types.ts @@ -34,7 +34,7 @@ export interface ExportedPickersLayoutSlots; } -export interface PickersLayoutOwnerState extends PickerOwnerState { +export interface PickerLayoutOwnerState extends PickerOwnerState { wrapperVariant: WrapperVariant; isLandscape: boolean; } @@ -43,11 +43,11 @@ export interface ExportedPickersLayoutSlotProps; + actionBar?: SlotComponentProps; /** * Props passed down to the shortcuts component. */ - shortcuts?: SlotComponentProps; + shortcuts?: SlotComponentProps; /** * Props passed down to the layoutRoot component. */ diff --git a/packages/x-date-pickers/src/PickersLayout/index.ts b/packages/x-date-pickers/src/PickersLayout/index.ts index 817295fc1c420..9ebccbefd9d25 100644 --- a/packages/x-date-pickers/src/PickersLayout/index.ts +++ b/packages/x-date-pickers/src/PickersLayout/index.ts @@ -5,7 +5,7 @@ export type { PickersLayoutSlotProps, ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, - PickersLayoutOwnerState, + PickerLayoutOwnerState, } from './PickersLayout.types'; export { default as usePickerLayout } from './usePickerLayout'; diff --git a/packages/x-date-pickers/src/PickersLayout/usePickerLayout.tsx b/packages/x-date-pickers/src/PickersLayout/usePickerLayout.tsx index aa34a0a0c06aa..85d8a5358beeb 100644 --- a/packages/x-date-pickers/src/PickersLayout/usePickerLayout.tsx +++ b/packages/x-date-pickers/src/PickersLayout/usePickerLayout.tsx @@ -3,12 +3,12 @@ import * as React from 'react'; import useSlotProps from '@mui/utils/useSlotProps'; import composeClasses from '@mui/utils/composeClasses'; import { PickersActionBar, PickersActionBarAction } from '../PickersActionBar'; -import { PickersLayoutOwnerState, PickersLayoutProps, SubComponents } from './PickersLayout.types'; +import { PickerLayoutOwnerState, PickersLayoutProps, SubComponents } from './PickersLayout.types'; import { getPickersLayoutUtilityClass, PickersLayoutClasses } from './pickersLayoutClasses'; import { PickersShortcuts } from '../PickersShortcuts'; import { BaseToolbarProps } from '../internals/models/props/toolbar'; import { DateOrTimeViewWithMeridiem } from '../internals/models'; -import { usePickersPrivateContext } from '../internals/hooks/usePickersPrivateContext'; +import { usePickerPrivateContext } from '../internals/hooks/usePickerPrivateContext'; function toolbarHasView( toolbarProps: BaseToolbarProps | any, @@ -18,7 +18,7 @@ function toolbarHasView( const useUtilityClasses = ( classes: Partial | undefined, - ownerState: PickersLayoutOwnerState, + ownerState: PickerLayoutOwnerState, ) => { const { isLandscape } = ownerState; const slots = { @@ -43,7 +43,7 @@ interface UsePickerLayoutResponse extends SubComponents {} const usePickerLayout = ( props: PickersLayoutProps, ): UsePickerLayoutResponse => { - const { ownerState: pickersOwnerState } = usePickersPrivateContext(); + const { ownerState: pickersOwnerState } = usePickerPrivateContext(); const { wrapperVariant, @@ -71,7 +71,7 @@ const usePickerLayout = ( // - For range pickers value: [PickerValidDate | null, PickerValidDate | null] } = props as PickersLayoutPropsWithValueRequired; - const ownerState: PickersLayoutOwnerState = { + const ownerState: PickerLayoutOwnerState = { ...pickersOwnerState, wrapperVariant, isLandscape, diff --git a/packages/x-date-pickers/src/TimeClock/Clock.tsx b/packages/x-date-pickers/src/TimeClock/Clock.tsx index 216f6d29d5a19..f4ba60071a0ff 100644 --- a/packages/x-date-pickers/src/TimeClock/Clock.tsx +++ b/packages/x-date-pickers/src/TimeClock/Clock.tsx @@ -8,7 +8,7 @@ import { unstable_composeClasses as composeClasses, } from '@mui/utils'; import { ClockPointer } from './ClockPointer'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import type { PickerSelectionState } from '../internals/hooks/usePicker'; import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks'; @@ -224,7 +224,7 @@ export function Clock(inProps: ClockProps) { const ownerState = props; const utils = useUtils(); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const isMoving = React.useRef(false); const classes = useUtilityClasses(ownerState); diff --git a/packages/x-date-pickers/src/TimeClock/TimeClock.tsx b/packages/x-date-pickers/src/TimeClock/TimeClock.tsx index 07e885a201933..9e480cbd02593 100644 --- a/packages/x-date-pickers/src/TimeClock/TimeClock.tsx +++ b/packages/x-date-pickers/src/TimeClock/TimeClock.tsx @@ -4,7 +4,7 @@ import clsx from 'clsx'; import PropTypes from 'prop-types'; import { styled, useThemeProps } from '@mui/material/styles'; import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils, useNow } from '../internals/hooks/useUtils'; import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher'; import { convertValueToMeridiem, createIsAfterIgnoreDatePart } from '../internals/utils/time-utils'; @@ -126,7 +126,7 @@ export const TimeClock = React.forwardRef(function TimeClock( timezone, }); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const now = useNow(timezone); const { view, setView, previousView, nextView, setValueAndGoToNextView } = useViews({ diff --git a/packages/x-date-pickers/src/TimePicker/TimePickerToolbar.tsx b/packages/x-date-pickers/src/TimePicker/TimePickerToolbar.tsx index bd5f40f736b8e..82da87243d9e4 100644 --- a/packages/x-date-pickers/src/TimePicker/TimePickerToolbar.tsx +++ b/packages/x-date-pickers/src/TimePicker/TimePickerToolbar.tsx @@ -9,7 +9,7 @@ import { PickersToolbarText } from '../internals/components/PickersToolbarText'; import { PickersToolbarButton } from '../internals/components/PickersToolbarButton'; import { PickersToolbar } from '../internals/components/PickersToolbar'; import { arrayIncludes } from '../internals/utils/utils'; -import { usePickersTranslations } from '../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../hooks/usePickerTranslations'; import { useUtils } from '../internals/hooks/useUtils'; import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks'; import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar'; @@ -166,7 +166,7 @@ function TimePickerToolbar(inProps: TimePickerToolbarProps) { ...other } = props; const utils = useUtils(); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const isRtl = useRtl(); const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours')); diff --git a/packages/x-date-pickers/src/hooks/index.tsx b/packages/x-date-pickers/src/hooks/index.tsx index a3d200fd8757b..7bb38ae80378a 100644 --- a/packages/x-date-pickers/src/hooks/index.tsx +++ b/packages/x-date-pickers/src/hooks/index.tsx @@ -6,10 +6,10 @@ export type { UseClearableFieldResponse, } from './useClearableField'; -export { usePickersTranslations } from './usePickersTranslations'; +export { usePickerTranslations } from './usePickerTranslations'; export { useSplitFieldProps } from './useSplitFieldProps'; export { useParsedFormat } from './useParsedFormat'; -export { usePickersContext } from './usePickersContext'; +export { usePickerContext } from './usePickerContext'; diff --git a/packages/x-date-pickers/src/hooks/useClearableField.tsx b/packages/x-date-pickers/src/hooks/useClearableField.tsx index 08bceb35a493d..a53e94d6b531d 100644 --- a/packages/x-date-pickers/src/hooks/useClearableField.tsx +++ b/packages/x-date-pickers/src/hooks/useClearableField.tsx @@ -6,7 +6,7 @@ import MuiIconButton from '@mui/material/IconButton'; import InputAdornment from '@mui/material/InputAdornment'; import { SxProps } from '@mui/system'; import { ClearIcon } from '../icons'; -import { usePickersTranslations } from './usePickersTranslations'; +import { usePickerTranslations } from './usePickerTranslations'; export interface ExportedUseClearableFieldProps { /** @@ -53,7 +53,7 @@ export type UseClearableFieldResponse( props: TFieldProps, ): UseClearableFieldResponse => { - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const { clearable, onClear, InputProps, sx, slots, slotProps, ...other } = props; diff --git a/packages/x-date-pickers/src/hooks/useParsedFormat.ts b/packages/x-date-pickers/src/hooks/useParsedFormat.ts index a42e9c6524164..f32b345fccb9a 100644 --- a/packages/x-date-pickers/src/hooks/useParsedFormat.ts +++ b/packages/x-date-pickers/src/hooks/useParsedFormat.ts @@ -4,7 +4,7 @@ import { useRtl } from '@mui/system/RtlProvider'; import { useUtils } from '../internals/hooks/useUtils'; import { buildSectionsFromFormat } from '../internals/hooks/useField/buildSectionsFromFormat'; import { getLocalizedDigits } from '../internals/hooks/useField/useField.utils'; -import { usePickersTranslations } from './usePickersTranslations'; +import { usePickerTranslations } from './usePickerTranslations'; import type { UseFieldInternalProps } from '../internals/hooks/useField'; interface UseParsedFormatParameters @@ -26,7 +26,7 @@ export const useParsedFormat = (parameters: UseParsedFormatParameters) => { const { format, formatDensity = 'dense', shouldRespectLeadingZeros = false } = parameters; const utils = useUtils(); const isRtl = useRtl(); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const localizedDigits = React.useMemo(() => getLocalizedDigits(utils), [utils]); return React.useMemo(() => { diff --git a/packages/x-date-pickers/src/hooks/usePickerContext.ts b/packages/x-date-pickers/src/hooks/usePickerContext.ts new file mode 100644 index 0000000000000..ba3d36ed8854a --- /dev/null +++ b/packages/x-date-pickers/src/hooks/usePickerContext.ts @@ -0,0 +1,19 @@ +'use client'; +import * as React from 'react'; +import { PickerContext } from '../internals/components/PickerProvider'; + +/** + * Returns the context passed by the picker that wraps the current component. + */ +export const usePickerContext = () => { + const value = React.useContext(PickerContext); + if (value == null) { + throw new Error( + [ + 'MUI X: The `usePickerContext` can only be called in fields that are used as a slot of a picker component', + ].join('\n'), + ); + } + + return value; +}; diff --git a/packages/x-date-pickers/src/hooks/usePickersTranslations.ts b/packages/x-date-pickers/src/hooks/usePickerTranslations.ts similarity index 51% rename from packages/x-date-pickers/src/hooks/usePickersTranslations.ts rename to packages/x-date-pickers/src/hooks/usePickerTranslations.ts index 02c0e6399d6bc..6dc3416997c95 100644 --- a/packages/x-date-pickers/src/hooks/usePickersTranslations.ts +++ b/packages/x-date-pickers/src/hooks/usePickerTranslations.ts @@ -1,4 +1,4 @@ 'use client'; import { useLocalizationContext } from '../internals/hooks/useUtils'; -export const usePickersTranslations = () => useLocalizationContext().localeText; +export const usePickerTranslations = () => useLocalizationContext().localeText; diff --git a/packages/x-date-pickers/src/hooks/usePickersContext.ts b/packages/x-date-pickers/src/hooks/usePickersContext.ts deleted file mode 100644 index 1303af42b886f..0000000000000 --- a/packages/x-date-pickers/src/hooks/usePickersContext.ts +++ /dev/null @@ -1,19 +0,0 @@ -'use client'; -import * as React from 'react'; -import { PickersContext } from '../internals/components/PickersProvider'; - -/** - * Returns the context passed by the picker that wraps the current component. - */ -export const usePickersContext = () => { - const value = React.useContext(PickersContext); - if (value == null) { - throw new Error( - [ - 'MUI X: The `usePickersContext` can only be called in fields that are used as a slot of a picker component', - ].join('\n'), - ); - } - - return value; -}; diff --git a/packages/x-date-pickers/src/internals/components/PickersProvider.tsx b/packages/x-date-pickers/src/internals/components/PickerProvider.tsx similarity index 65% rename from packages/x-date-pickers/src/internals/components/PickersProvider.tsx rename to packages/x-date-pickers/src/internals/components/PickerProvider.tsx index 0f1d329814724..9a3df53baecef 100644 --- a/packages/x-date-pickers/src/internals/components/PickersProvider.tsx +++ b/packages/x-date-pickers/src/internals/components/PickerProvider.tsx @@ -3,9 +3,9 @@ import { PickerOwnerState } from '../../models'; import { PickersInputLocaleText } from '../../locales'; import { LocalizationProvider } from '../../LocalizationProvider'; -export const PickersContext = React.createContext(null); +export const PickerContext = React.createContext(null); -export const PickersPrivateContext = React.createContext(null); +export const PickerPrivateContext = React.createContext(null); /** * Provides the context for the various parts of a picker component: @@ -14,26 +14,26 @@ export const PickersPrivateContext = React.createContext - + + {children} - - + + ); } -export interface PickersProviderProps { - contextValue: PickersContextValue; - privateContextValue: PickersPrivateContextValue; +export interface PickerProviderProps { + contextValue: PickerContextValue; + privateContextValue: PickerPrivateContextValue; localeText: PickersInputLocaleText | undefined; children: React.ReactNode; } -export interface PickersContextValue { +export interface PickerContextValue { /** * Open the picker. * @param {React.UIEvent} event The DOM event that triggered the change. @@ -49,7 +49,7 @@ export interface PickersContextValue { */ open: boolean; } -export interface PickersPrivateContextValue { +export interface PickerPrivateContextValue { /** * The ownerState of the picker. */ diff --git a/packages/x-date-pickers/src/internals/hooks/useDesktopPicker/useDesktopPicker.tsx b/packages/x-date-pickers/src/internals/hooks/useDesktopPicker/useDesktopPicker.tsx index 9158434b71af9..b9e5f1edb0bee 100644 --- a/packages/x-date-pickers/src/internals/hooks/useDesktopPicker/useDesktopPicker.tsx +++ b/packages/x-date-pickers/src/internals/hooks/useDesktopPicker/useDesktopPicker.tsx @@ -21,7 +21,7 @@ import { PickerOwnerState, } from '../../../models'; import { DateOrTimeViewWithMeridiem } from '../../models'; -import { PickersProvider } from '../../components/PickersProvider'; +import { PickerProvider } from '../../components/PickerProvider'; /** * Hook managing all the single-date desktop pickers: @@ -207,7 +207,7 @@ export const useDesktopPicker = < const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef); const renderPicker = () => ( - + - + ); return { renderPicker }; diff --git a/packages/x-date-pickers/src/internals/hooks/useField/useFieldState.ts b/packages/x-date-pickers/src/internals/hooks/useField/useFieldState.ts index 1282c4c6b5783..6dc432fc0d124 100644 --- a/packages/x-date-pickers/src/internals/hooks/useField/useFieldState.ts +++ b/packages/x-date-pickers/src/internals/hooks/useField/useFieldState.ts @@ -1,7 +1,7 @@ import * as React from 'react'; import useControlled from '@mui/utils/useControlled'; import { useRtl } from '@mui/system/RtlProvider'; -import { usePickersTranslations } from '../../../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../../../hooks/usePickerTranslations'; import { useUtils, useLocalizationContext } from '../useUtils'; import { UseFieldInternalProps, @@ -81,7 +81,7 @@ export const useFieldState = < >, ): UseFieldStateResponse => { const utils = useUtils(); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const adapter = useLocalizationContext(); const isRtl = useRtl(); diff --git a/packages/x-date-pickers/src/internals/hooks/useField/useFieldV7TextField.ts b/packages/x-date-pickers/src/internals/hooks/useField/useFieldV7TextField.ts index c6fc37752e6ec..6f71bc76df8a0 100644 --- a/packages/x-date-pickers/src/internals/hooks/useField/useFieldV7TextField.ts +++ b/packages/x-date-pickers/src/internals/hooks/useField/useFieldV7TextField.ts @@ -11,7 +11,7 @@ import { } from './useField.types'; import { getActiveElement } from '../../utils/utils'; import { PickersSectionElement, PickersSectionListRef } from '../../../PickersSectionList'; -import { usePickersTranslations } from '../../../hooks/usePickersTranslations'; +import { usePickerTranslations } from '../../../hooks/usePickerTranslations'; import { useUtils } from '../useUtils'; export const useFieldV7TextField: UseFieldTextField = (params) => { @@ -44,7 +44,7 @@ export const useFieldV7TextField: UseFieldTextField = (params) => { const sectionListRef = React.useRef(null); const handleSectionListRef = useForkRef(inSectionListRef, sectionListRef); - const translations = usePickersTranslations(); + const translations = usePickerTranslations(); const utils = useUtils(); const id = useId(); diff --git a/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.tsx b/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.tsx index 917c358b6737e..088160ff9b5e7 100644 --- a/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.tsx +++ b/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.tsx @@ -20,7 +20,7 @@ import { PickerOwnerState, } from '../../../models'; import { DateOrTimeViewWithMeridiem } from '../../models'; -import { PickersProvider } from '../../components/PickersProvider'; +import { PickerProvider } from '../../components/PickerProvider'; /** * Hook managing all the single-date mobile pickers: @@ -160,7 +160,7 @@ export const useMobilePicker = < const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef); const renderPicker = () => ( - + - + ); return { renderPicker }; diff --git a/packages/x-date-pickers/src/internals/hooks/usePicker/usePickerProvider.ts b/packages/x-date-pickers/src/internals/hooks/usePicker/usePickerProvider.ts index e3bec5e1b8e10..67e8d1eab3514 100644 --- a/packages/x-date-pickers/src/internals/hooks/usePicker/usePickerProvider.ts +++ b/packages/x-date-pickers/src/internals/hooks/usePicker/usePickerProvider.ts @@ -2,25 +2,25 @@ import * as React from 'react'; import { FieldSection, PickerOwnerState } from '../../../models'; import { UsePickerValueResponse } from './usePickerValue.types'; import { - PickersProviderProps, - PickersContextValue, - PickersPrivateContextValue, -} from '../../components/PickersProvider'; + PickerProviderProps, + PickerContextValue, + PickerPrivateContextValue, +} from '../../components/PickerProvider'; export interface UsePickerProviderParameters - extends Pick { + extends Pick { pickerValueResponse: UsePickerValueResponse; ownerState: PickerOwnerState; } -export interface UsePickerProviderReturnValue extends Omit {} +export interface UsePickerProviderReturnValue extends Omit {} export function usePickerProvider( parameters: UsePickerProviderParameters, ): UsePickerProviderReturnValue { const { pickerValueResponse, ownerState, localeText } = parameters; - const contextValue = React.useMemo( + const contextValue = React.useMemo( () => ({ onOpen: pickerValueResponse.actions.onOpen, onClose: pickerValueResponse.actions.onClose, @@ -33,7 +33,7 @@ export function usePickerProvider( ], ); - const privateContextValue = React.useMemo( + const privateContextValue = React.useMemo( () => ({ ownerState }), [ownerState], ); diff --git a/packages/x-date-pickers/src/internals/hooks/usePickerPrivateContext.ts b/packages/x-date-pickers/src/internals/hooks/usePickerPrivateContext.ts new file mode 100644 index 0000000000000..35a6a14b02bf3 --- /dev/null +++ b/packages/x-date-pickers/src/internals/hooks/usePickerPrivateContext.ts @@ -0,0 +1,17 @@ +'use client'; +import * as React from 'react'; +import { PickerContext, PickerPrivateContextValue } from '../components/PickerProvider'; + +/** + * Returns the private context passed by the picker that wraps the current component. + */ +export const usePickerPrivateContext = () => { + const value = React.useContext(PickerContext) as PickerPrivateContextValue | null; + if (value == null) { + throw new Error( + 'MUI X: The `usePickerPrivateContext` can only be called in components that are used inside a picker component.', + ); + } + + return value; +}; diff --git a/packages/x-date-pickers/src/internals/hooks/usePickersPrivateContext.ts b/packages/x-date-pickers/src/internals/hooks/usePickersPrivateContext.ts deleted file mode 100644 index 9d03e894944ad..0000000000000 --- a/packages/x-date-pickers/src/internals/hooks/usePickersPrivateContext.ts +++ /dev/null @@ -1,17 +0,0 @@ -'use client'; -import * as React from 'react'; -import { PickersContext, PickersPrivateContextValue } from '../components/PickersProvider'; - -/** - * Returns the private context passed by the picker that wraps the current component. - */ -export const usePickersPrivateContext = () => { - const value = React.useContext(PickersContext) as PickersPrivateContextValue | null; - if (value == null) { - throw new Error( - 'MUI X: The `usePickersPrivateContext` can only be called in components that are used inside a picker component.', - ); - } - - return value; -}; diff --git a/packages/x-date-pickers/src/internals/hooks/useStaticPicker/useStaticPicker.tsx b/packages/x-date-pickers/src/internals/hooks/useStaticPicker/useStaticPicker.tsx index 38dc4787f8d19..15ffa93d984e2 100644 --- a/packages/x-date-pickers/src/internals/hooks/useStaticPicker/useStaticPicker.tsx +++ b/packages/x-date-pickers/src/internals/hooks/useStaticPicker/useStaticPicker.tsx @@ -3,7 +3,7 @@ import clsx from 'clsx'; import { styled } from '@mui/material/styles'; import { UseStaticPickerParams, UseStaticPickerProps } from './useStaticPicker.types'; import { usePicker } from '../usePicker'; -import { PickersProvider } from '../../components/PickersProvider'; +import { PickerProvider } from '../../components/PickerProvider'; import { PickersLayout } from '../../../PickersLayout'; import { DIALOG_WIDTH } from '../../constants/dimensions'; import { FieldSection, PickerValidDate } from '../../../models'; @@ -50,7 +50,7 @@ export const useStaticPicker = < const Layout = slots?.layout ?? PickerStaticLayout; const renderPicker = () => ( - + {renderCurrentView()} - + ); return { renderPicker }; diff --git a/packages/x-date-pickers/src/internals/index.ts b/packages/x-date-pickers/src/internals/index.ts index 11a6e4657b7f3..ff38c2ef314bf 100644 --- a/packages/x-date-pickers/src/internals/index.ts +++ b/packages/x-date-pickers/src/internals/index.ts @@ -4,7 +4,7 @@ export type { PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, } from './components/PickersArrowSwitcher'; -export { PickersProvider } from './components/PickersProvider'; +export { PickerProvider } from './components/PickerProvider'; export { PickersModalDialog } from './components/PickersModalDialog'; export type { PickersModalDialogSlots, diff --git a/scripts/x-date-pickers-pro.exports.json b/scripts/x-date-pickers-pro.exports.json index 836e164724c10..7c230f5ab3018 100644 --- a/scripts/x-date-pickers-pro.exports.json +++ b/scripts/x-date-pickers-pro.exports.json @@ -249,6 +249,7 @@ { "name": "NonEmptyDateRange", "kind": "TypeAlias" }, { "name": "OnErrorProps", "kind": "Interface" }, { "name": "PickerChangeHandlerContext", "kind": "Interface" }, + { "name": "PickerLayoutOwnerState", "kind": "Interface" }, { "name": "PickerOwnerState", "kind": "Interface" }, { "name": "PickersActionBar", "kind": "Function" }, { "name": "PickersActionBarAction", "kind": "TypeAlias" }, @@ -293,7 +294,6 @@ { "name": "pickersLayoutClasses", "kind": "Variable" }, { "name": "PickersLayoutClassKey", "kind": "TypeAlias" }, { "name": "PickersLayoutContentWrapper", "kind": "Variable" }, - { "name": "PickersLayoutOwnerState", "kind": "Interface" }, { "name": "PickersLayoutProps", "kind": "Interface" }, { "name": "PickersLayoutRoot", "kind": "Variable" }, { "name": "PickersLayoutSlotProps", "kind": "Interface" }, @@ -421,9 +421,9 @@ { "name": "UseMultiInputTimeRangeFieldComponentProps", "kind": "TypeAlias" }, { "name": "UseMultiInputTimeRangeFieldProps", "kind": "Interface" }, { "name": "useParsedFormat", "kind": "Variable" }, + { "name": "usePickerContext", "kind": "Variable" }, { "name": "usePickerLayout", "kind": "ExportAssignment" }, - { "name": "usePickersContext", "kind": "Variable" }, - { "name": "usePickersTranslations", "kind": "Variable" }, + { "name": "usePickerTranslations", "kind": "Variable" }, { "name": "UseSingleInputDateRangeFieldProps", "kind": "Interface" }, { "name": "UseSingleInputDateTimeRangeFieldProps", "kind": "Interface" }, { "name": "UseSingleInputTimeRangeFieldProps", "kind": "Interface" }, diff --git a/scripts/x-date-pickers.exports.json b/scripts/x-date-pickers.exports.json index 94e004c0da2de..ca30d64e8fc49 100644 --- a/scripts/x-date-pickers.exports.json +++ b/scripts/x-date-pickers.exports.json @@ -163,6 +163,7 @@ { "name": "MultiSectionDigitalClockSlots", "kind": "Interface" }, { "name": "OnErrorProps", "kind": "Interface" }, { "name": "PickerChangeHandlerContext", "kind": "Interface" }, + { "name": "PickerLayoutOwnerState", "kind": "Interface" }, { "name": "PickerOwnerState", "kind": "Interface" }, { "name": "PickersActionBar", "kind": "Function" }, { "name": "PickersActionBarAction", "kind": "TypeAlias" }, @@ -207,7 +208,6 @@ { "name": "pickersLayoutClasses", "kind": "Variable" }, { "name": "PickersLayoutClassKey", "kind": "TypeAlias" }, { "name": "PickersLayoutContentWrapper", "kind": "Variable" }, - { "name": "PickersLayoutOwnerState", "kind": "Interface" }, { "name": "PickersLayoutProps", "kind": "Interface" }, { "name": "PickersLayoutRoot", "kind": "Variable" }, { "name": "PickersLayoutSlotProps", "kind": "Interface" }, @@ -305,9 +305,9 @@ { "name": "UseDateFieldProps", "kind": "Interface" }, { "name": "UseDateTimeFieldProps", "kind": "Interface" }, { "name": "useParsedFormat", "kind": "Variable" }, + { "name": "usePickerContext", "kind": "Variable" }, { "name": "usePickerLayout", "kind": "ExportAssignment" }, - { "name": "usePickersContext", "kind": "Variable" }, - { "name": "usePickersTranslations", "kind": "Variable" }, + { "name": "usePickerTranslations", "kind": "Variable" }, { "name": "useSplitFieldProps", "kind": "Variable" }, { "name": "UseTimeFieldProps", "kind": "Interface" }, { "name": "useValidation", "kind": "Function" }, From a6c9a7e99d96c818d79b6bef1efa75d48d0cf016 Mon Sep 17 00:00:00 2001 From: Flavien DELANGLE Date: Wed, 6 Nov 2024 16:17:05 +0100 Subject: [PATCH 2/3] Update docs/data/migration/migration-pickers-v7/migration-pickers-v7.md Co-authored-by: Lukas Tyla Signed-off-by: Flavien DELANGLE --- .../data/migration/migration-pickers-v7/migration-pickers-v7.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md b/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md index 818bae23e3f6b..57d3f72f2bb8b 100644 --- a/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md +++ b/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md @@ -261,7 +261,7 @@ const theme = createTheme({ ## Renamed variables -The following variables were renamed to have a coherent naming for the `Picker` / `Pickers` prefix: +The following variables were renamed to have a coherent `Picker` / `Pickers` prefix: - `usePickersTranslation` From 9c75522d9b9a0c424280f5d67f628328f35728e3 Mon Sep 17 00:00:00 2001 From: Flavien DELANGLE Date: Wed, 6 Nov 2024 16:17:18 +0100 Subject: [PATCH 3/3] Update docs/data/migration/migration-pickers-v7/migration-pickers-v7.md Co-authored-by: Lukas Tyla Signed-off-by: Flavien DELANGLE --- .../migration/migration-pickers-v7/migration-pickers-v7.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md b/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md index 57d3f72f2bb8b..3338d198e311b 100644 --- a/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md +++ b/docs/data/migration/migration-pickers-v7/migration-pickers-v7.md @@ -285,9 +285,9 @@ The following variables were renamed to have a coherent `Picker` / `Pickers` pre - import { usePickersContext } from '@mui/x-date-pickers'; - import { usePickersContext } from '@mui/x-date-pickers-pro'; - + import { usePickersContext } from '@mui/x-date-pickers/hooks'; - + import { usePickersContext } from '@mui/x-date-pickers'; - + import { usePickersContext } from '@mui/x-date-pickers-pro'; + + import { usePickerContext } from '@mui/x-date-pickers/hooks'; + + import { usePickerContext } from '@mui/x-date-pickers'; + + import { usePickerContext } from '@mui/x-date-pickers-pro'; - const pickersContext = usePickersContext(); + const pickerContext = usePickerContext();