@mui/x-date-pickers 7.7.1 → 7.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +0 -1
  2. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +0 -1
  3. package/CHANGELOG.md +166 -1
  4. package/DateCalendar/DayCalendar.js +7 -6
  5. package/DateCalendar/useCalendarState.d.ts +1 -1
  6. package/DatePicker/DatePickerToolbar.js +4 -3
  7. package/DateTimePicker/DateTimePickerTabs.d.ts +2 -1
  8. package/DateTimePicker/DateTimePickerTabs.js +4 -4
  9. package/DateTimePicker/DateTimePickerToolbar.js +5 -4
  10. package/DesktopDatePicker/DesktopDatePicker.js +4 -3
  11. package/DesktopDateTimePicker/DesktopDateTimePicker.js +7 -4
  12. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +1 -1
  13. package/DesktopTimePicker/DesktopTimePicker.js +4 -3
  14. package/DigitalClock/DigitalClock.js +4 -3
  15. package/MobileDatePicker/MobileDatePicker.js +4 -3
  16. package/MobileDateTimePicker/MobileDateTimePicker.js +4 -3
  17. package/MobileTimePicker/MobileTimePicker.js +4 -3
  18. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
  19. package/PickersActionBar/PickersActionBar.js +6 -6
  20. package/PickersCalendarHeader/PickersCalendarHeader.js +6 -5
  21. package/TimeClock/Clock.js +4 -3
  22. package/TimeClock/ClockNumbers.d.ts +1 -1
  23. package/TimeClock/TimeClock.js +9 -8
  24. package/TimePicker/TimePickerToolbar.js +4 -3
  25. package/hooks/index.d.ts +1 -0
  26. package/hooks/index.js +2 -1
  27. package/hooks/useClearableField.js +3 -3
  28. package/hooks/usePickersTranslations.d.ts +2 -0
  29. package/hooks/usePickersTranslations.js +2 -0
  30. package/index.js +1 -1
  31. package/internals/components/PickerViewRoot/PickerViewRoot.d.ts +0 -1
  32. package/internals/hooks/date-helpers-hooks.d.ts +1 -1
  33. package/internals/hooks/defaultizedFieldProps.d.ts +2 -2
  34. package/internals/hooks/useField/useField.d.ts +3 -3
  35. package/internals/hooks/useField/useField.utils.d.ts +3 -3
  36. package/internals/hooks/useField/useFieldState.js +6 -5
  37. package/internals/hooks/useField/useFieldV6TextField.js +9 -3
  38. package/internals/hooks/useField/useFieldV7TextField.js +6 -5
  39. package/internals/hooks/usePicker/usePickerValue.types.d.ts +0 -1
  40. package/internals/hooks/useUtils.d.ts +0 -1
  41. package/internals/hooks/useUtils.js +0 -1
  42. package/internals/index.d.ts +1 -1
  43. package/internals/index.js +1 -1
  44. package/internals/utils/date-utils.d.ts +1 -1
  45. package/internals/utils/validation/extractValidationProps.d.ts +1 -1
  46. package/internals/utils/views.d.ts +1 -1
  47. package/internals/utils/warning.d.ts +1 -1
  48. package/modern/DateCalendar/DayCalendar.js +7 -6
  49. package/modern/DatePicker/DatePickerToolbar.js +4 -3
  50. package/modern/DateTimePicker/DateTimePickerTabs.js +4 -4
  51. package/modern/DateTimePicker/DateTimePickerToolbar.js +5 -4
  52. package/modern/DesktopDatePicker/DesktopDatePicker.js +4 -3
  53. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +7 -4
  54. package/modern/DesktopTimePicker/DesktopTimePicker.js +4 -3
  55. package/modern/DigitalClock/DigitalClock.js +4 -3
  56. package/modern/MobileDatePicker/MobileDatePicker.js +4 -3
  57. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +4 -3
  58. package/modern/MobileTimePicker/MobileTimePicker.js +4 -3
  59. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -7
  60. package/modern/PickersActionBar/PickersActionBar.js +6 -6
  61. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +6 -5
  62. package/modern/TimeClock/Clock.js +4 -3
  63. package/modern/TimeClock/TimeClock.js +9 -8
  64. package/modern/TimePicker/TimePickerToolbar.js +4 -3
  65. package/modern/hooks/index.js +2 -1
  66. package/modern/hooks/useClearableField.js +3 -3
  67. package/modern/hooks/usePickersTranslations.js +2 -0
  68. package/modern/index.js +1 -1
  69. package/modern/internals/hooks/useField/useFieldState.js +6 -5
  70. package/modern/internals/hooks/useField/useFieldV6TextField.js +9 -3
  71. package/modern/internals/hooks/useField/useFieldV7TextField.js +6 -5
  72. package/modern/internals/hooks/useUtils.js +0 -1
  73. package/modern/internals/index.js +1 -1
  74. package/node/DateCalendar/DayCalendar.js +6 -5
  75. package/node/DatePicker/DatePickerToolbar.js +3 -2
  76. package/node/DateTimePicker/DateTimePickerTabs.js +4 -4
  77. package/node/DateTimePicker/DateTimePickerToolbar.js +5 -4
  78. package/node/DesktopDatePicker/DesktopDatePicker.js +3 -2
  79. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  80. package/node/DesktopTimePicker/DesktopTimePicker.js +3 -2
  81. package/node/DigitalClock/DigitalClock.js +3 -2
  82. package/node/MobileDatePicker/MobileDatePicker.js +3 -2
  83. package/node/MobileDateTimePicker/MobileDateTimePicker.js +3 -2
  84. package/node/MobileTimePicker/MobileTimePicker.js +3 -2
  85. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +7 -6
  86. package/node/PickersActionBar/PickersActionBar.js +6 -6
  87. package/node/PickersCalendarHeader/PickersCalendarHeader.js +5 -4
  88. package/node/TimeClock/Clock.js +3 -2
  89. package/node/TimeClock/TimeClock.js +8 -7
  90. package/node/TimePicker/TimePickerToolbar.js +3 -2
  91. package/node/hooks/index.js +8 -1
  92. package/node/hooks/useClearableField.js +3 -3
  93. package/node/hooks/usePickersTranslations.js +9 -0
  94. package/node/index.js +1 -1
  95. package/node/internals/hooks/useField/useFieldState.js +5 -4
  96. package/node/internals/hooks/useField/useFieldV6TextField.js +9 -3
  97. package/node/internals/hooks/useField/useFieldV7TextField.js +5 -4
  98. package/node/internals/hooks/useUtils.js +1 -3
  99. package/node/internals/index.js +0 -6
  100. package/package.json +3 -3
  101. package/timeViewRenderers/timeViewRenderers.d.ts +1 -1
@@ -5,7 +5,7 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import Button from '@mui/material/Button';
7
7
  import DialogActions from '@mui/material/DialogActions';
8
- import { useLocaleText } from '../internals/hooks/useUtils';
8
+ import { usePickersTranslations } from '../hooks/usePickersTranslations';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  /**
11
11
  * Demos:
@@ -26,7 +26,7 @@ function PickersActionBar(props) {
26
26
  actions
27
27
  } = props,
28
28
  other = _objectWithoutPropertiesLoose(props, _excluded);
29
- const localeText = useLocaleText();
29
+ const translations = usePickersTranslations();
30
30
  if (actions == null || actions.length === 0) {
31
31
  return null;
32
32
  }
@@ -35,22 +35,22 @@ function PickersActionBar(props) {
35
35
  case 'clear':
36
36
  return /*#__PURE__*/_jsx(Button, {
37
37
  onClick: onClear,
38
- children: localeText.clearButtonLabel
38
+ children: translations.clearButtonLabel
39
39
  }, actionType);
40
40
  case 'cancel':
41
41
  return /*#__PURE__*/_jsx(Button, {
42
42
  onClick: onCancel,
43
- children: localeText.cancelButtonLabel
43
+ children: translations.cancelButtonLabel
44
44
  }, actionType);
45
45
  case 'accept':
46
46
  return /*#__PURE__*/_jsx(Button, {
47
47
  onClick: onAccept,
48
- children: localeText.okButtonLabel
48
+ children: translations.okButtonLabel
49
49
  }, actionType);
50
50
  case 'today':
51
51
  return /*#__PURE__*/_jsx(Button, {
52
52
  onClick: onSetToday,
53
- children: localeText.todayButtonLabel
53
+ children: translations.todayButtonLabel
54
54
  }, actionType);
55
55
  default:
56
56
  return null;
@@ -10,7 +10,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
11
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
12
12
  import IconButton from '@mui/material/IconButton';
13
- import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
13
+ import { usePickersTranslations } from '../hooks/usePickersTranslations';
14
+ import { useUtils } from '../internals/hooks/useUtils';
14
15
  import { PickersFadeTransitionGroup } from '../DateCalendar/PickersFadeTransitionGroup';
15
16
  import { ArrowDropDownIcon } from '../icons';
16
17
  import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher';
@@ -107,7 +108,7 @@ const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
107
108
  * - [PickersCalendarHeader API](https://mui.com/x/api/date-pickers/pickers-calendar-header/)
108
109
  */
109
110
  const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalendarHeader(inProps, ref) {
110
- const localeText = useLocaleText();
111
+ const translations = usePickersTranslations();
111
112
  const utils = useUtils();
112
113
  const props = useThemeProps({
113
114
  props: inProps,
@@ -141,7 +142,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
141
142
  externalSlotProps: slotProps?.switchViewButton,
142
143
  additionalProps: {
143
144
  size: 'small',
144
- 'aria-label': localeText.calendarViewSwitchingButtonAriaLabel(view)
145
+ 'aria-label': translations.calendarViewSwitchingButtonAriaLabel(view)
145
146
  },
146
147
  ownerState,
147
148
  className: classes.switchViewButton
@@ -216,10 +217,10 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
216
217
  slotProps: slotProps,
217
218
  onGoToPrevious: selectPreviousMonth,
218
219
  isPreviousDisabled: isPreviousMonthDisabled,
219
- previousLabel: localeText.previousMonth,
220
+ previousLabel: translations.previousMonth,
220
221
  onGoToNext: selectNextMonth,
221
222
  isNextDisabled: isNextMonthDisabled,
222
- nextLabel: localeText.nextMonth
223
+ nextLabel: translations.nextMonth
223
224
  })
224
225
  })]
225
226
  }));
@@ -5,7 +5,8 @@ import Typography from '@mui/material/Typography';
5
5
  import { styled, useThemeProps } from '@mui/material/styles';
6
6
  import { unstable_useEnhancedEffect as useEnhancedEffect, unstable_composeClasses as composeClasses } from '@mui/utils';
7
7
  import { ClockPointer } from './ClockPointer';
8
- import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
8
+ import { usePickersTranslations } from '../hooks/usePickersTranslations';
9
+ import { useUtils } from '../internals/hooks/useUtils';
9
10
  import { CLOCK_HOUR_WIDTH, getHours, getMinutes } from './shared';
10
11
  import { getClockUtilityClass } from './clockClasses';
11
12
  import { formatMeridiem } from '../internals/utils/date-utils';
@@ -196,7 +197,7 @@ export function Clock(inProps) {
196
197
  } = props;
197
198
  const ownerState = props;
198
199
  const utils = useUtils();
199
- const localeText = useLocaleText();
200
+ const translations = usePickersTranslations();
200
201
  const isMoving = React.useRef(false);
201
202
  const classes = useUtilityClasses(ownerState);
202
203
  const isSelectedTimeDisabled = isTimeDisabled(viewValue, type);
@@ -312,7 +313,7 @@ export function Clock(inProps) {
312
313
  })]
313
314
  }), /*#__PURE__*/_jsx(ClockWrapper, {
314
315
  "aria-activedescendant": selectedId,
315
- "aria-label": localeText.clockLabelText(type, value, utils),
316
+ "aria-label": translations.clockLabelText(type, value, utils),
316
317
  ref: listboxRef,
317
318
  role: "listbox",
318
319
  onKeyDown: handleKeyDown,
@@ -18,7 +18,7 @@ interface GetHourNumbersOptions<TDate extends PickerValidDate> {
18
18
  * @ignore - internal component.
19
19
  */
20
20
  export declare const getHourNumbers: <TDate extends PickerValidDate>({ ampm, value, getClockNumberText, isDisabled, selectedId, utils, }: GetHourNumbersOptions<TDate>) => React.JSX.Element[];
21
- export declare const getMinutesNumbers: <TDate extends PickerValidDate>({ utils, value, isDisabled, getClockNumberText, selectedId, }: Omit<GetHourNumbersOptions<TDate>, 'ampm' | 'value'> & {
21
+ export declare const getMinutesNumbers: <TDate extends PickerValidDate>({ utils, value, isDisabled, getClockNumberText, selectedId, }: Omit<GetHourNumbersOptions<TDate>, "ampm" | "value"> & {
22
22
  value: number;
23
23
  }) => React.JSX.Element[];
24
24
  export {};
@@ -6,7 +6,8 @@ import clsx from 'clsx';
6
6
  import PropTypes from 'prop-types';
7
7
  import { styled, useThemeProps } from '@mui/material/styles';
8
8
  import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
9
- import { useUtils, useNow, useLocaleText } from '../internals/hooks/useUtils';
9
+ import { usePickersTranslations } from '../hooks/usePickersTranslations';
10
+ import { useUtils, useNow } from '../internals/hooks/useUtils';
10
11
  import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher';
11
12
  import { convertValueToMeridiem, createIsAfterIgnoreDatePart } from '../internals/utils/time-utils';
12
13
  import { useViews } from '../internals/hooks/useViews';
@@ -114,7 +115,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
114
115
  props,
115
116
  timezone
116
117
  });
117
- const localeText = useLocaleText();
118
+ const translations = usePickersTranslations();
118
119
  const now = useNow(timezone);
119
120
  const {
120
121
  view,
@@ -227,7 +228,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
227
228
  utils,
228
229
  ampm,
229
230
  onChange: handleHoursChange,
230
- getClockNumberText: localeText.hoursClockNumberText,
231
+ getClockNumberText: translations.hoursClockNumberText,
231
232
  isDisabled: hourValue => disabled || isTimeDisabled(hourValue, 'hours'),
232
233
  selectedId
233
234
  })
@@ -246,7 +247,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
246
247
  utils,
247
248
  value: minutesValue,
248
249
  onChange: handleMinutesChange,
249
- getClockNumberText: localeText.minutesClockNumberText,
250
+ getClockNumberText: translations.minutesClockNumberText,
250
251
  isDisabled: minuteValue => disabled || isTimeDisabled(minuteValue, 'minutes'),
251
252
  selectedId
252
253
  })
@@ -265,7 +266,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
265
266
  utils,
266
267
  value: secondsValue,
267
268
  onChange: handleSecondsChange,
268
- getClockNumberText: localeText.secondsClockNumberText,
269
+ getClockNumberText: translations.secondsClockNumberText,
269
270
  isDisabled: secondValue => disabled || isTimeDisabled(secondValue, 'seconds'),
270
271
  selectedId
271
272
  })
@@ -274,7 +275,7 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
274
275
  default:
275
276
  throw new Error('You must provide the type for ClockView');
276
277
  }
277
- }, [view, utils, value, ampm, localeText.hoursClockNumberText, localeText.minutesClockNumberText, localeText.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, isTimeDisabled, selectedId, disabled]);
278
+ }, [view, utils, value, ampm, translations.hoursClockNumberText, translations.minutesClockNumberText, translations.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, isTimeDisabled, selectedId, disabled]);
278
279
  const ownerState = props;
279
280
  const classes = useUtilityClasses(ownerState);
280
281
  return /*#__PURE__*/_jsxs(TimeClockRoot, _extends({
@@ -301,10 +302,10 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
301
302
  slotProps: slotProps,
302
303
  onGoToPrevious: () => setView(previousView),
303
304
  isPreviousDisabled: !previousView,
304
- previousLabel: localeText.openPreviousView,
305
+ previousLabel: translations.openPreviousView,
305
306
  onGoToNext: () => setView(nextView),
306
307
  isNextDisabled: !nextView,
307
- nextLabel: localeText.openNextView,
308
+ nextLabel: translations.openNextView,
308
309
  ownerState: ownerState
309
310
  })]
310
311
  }));
@@ -11,7 +11,8 @@ import { PickersToolbarText } from '../internals/components/PickersToolbarText';
11
11
  import { PickersToolbarButton } from '../internals/components/PickersToolbarButton';
12
12
  import { PickersToolbar } from '../internals/components/PickersToolbar';
13
13
  import { arrayIncludes } from '../internals/utils/utils';
14
- import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
14
+ import { usePickersTranslations } from '../hooks/usePickersTranslations';
15
+ import { useUtils } from '../internals/hooks/useUtils';
15
16
  import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
16
17
  import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from './timePickerToolbarClasses';
17
18
  import { formatMeridiem } from '../internals/utils/date-utils';
@@ -131,7 +132,7 @@ function TimePickerToolbar(inProps) {
131
132
  } = props,
132
133
  other = _objectWithoutPropertiesLoose(props, _excluded);
133
134
  const utils = useUtils();
134
- const localeText = useLocaleText();
135
+ const translations = usePickersTranslations();
135
136
  const isRtl = useRtl();
136
137
  const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours'));
137
138
  const {
@@ -152,7 +153,7 @@ function TimePickerToolbar(inProps) {
152
153
  });
153
154
  return /*#__PURE__*/_jsxs(TimePickerToolbarRoot, _extends({
154
155
  landscapeDirection: "row",
155
- toolbarTitle: localeText.timePickerToolbarTitle,
156
+ toolbarTitle: translations.timePickerToolbarTitle,
156
157
  isLandscape: isLandscape,
157
158
  ownerState: ownerState,
158
159
  className: clsx(classes.root, className)
package/hooks/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export { useClearableField } from './useClearableField';
2
2
  export type { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps, UseClearableFieldResponse, } from './useClearableField';
3
+ export { usePickersTranslations } from './usePickersTranslations';
package/hooks/index.js CHANGED
@@ -1 +1,2 @@
1
- export { useClearableField } from './useClearableField';
1
+ export { useClearableField } from './useClearableField';
2
+ export { usePickersTranslations } from './usePickersTranslations';
@@ -7,10 +7,10 @@ import { useSlotProps } from '@mui/base/utils';
7
7
  import MuiIconButton from '@mui/material/IconButton';
8
8
  import InputAdornment from '@mui/material/InputAdornment';
9
9
  import { ClearIcon } from '../icons';
10
- import { useLocaleText } from '../internals/hooks/useUtils';
10
+ import { usePickersTranslations } from './usePickersTranslations';
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  export const useClearableField = props => {
13
- const localeText = useLocaleText();
13
+ const translations = usePickersTranslations();
14
14
  const {
15
15
  clearable,
16
16
  onClear,
@@ -28,7 +28,7 @@ export const useClearableField = props => {
28
28
  ownerState: {},
29
29
  className: 'clearButton',
30
30
  additionalProps: {
31
- title: localeText.fieldClearLabel
31
+ title: translations.fieldClearLabel
32
32
  }
33
33
  }),
34
34
  iconButtonProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
@@ -0,0 +1,2 @@
1
+ import { PickerValidDate } from '../models';
2
+ export declare const usePickersTranslations: <TDate extends PickerValidDate>() => import("..").PickersLocaleText<TDate>;
@@ -0,0 +1,2 @@
1
+ import { useLocalizationContext } from '../internals/hooks/useUtils';
2
+ export const usePickersTranslations = () => useLocalizationContext().localeText;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.7.1
2
+ * @mui/x-date-pickers v7.9.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const PickerViewRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -12,5 +12,5 @@ export declare function useNextMonthDisabled<TDate extends PickerValidDate>(mont
12
12
  export declare function usePreviousMonthDisabled<TDate extends PickerValidDate>(month: TDate, { disablePast, minDate, timezone, }: Pick<MonthValidationOptions<TDate>, 'disablePast' | 'minDate' | 'timezone'>): boolean;
13
13
  export declare function useMeridiemMode<TDate extends PickerValidDate>(date: TDate | null, ampm: boolean | undefined, onChange: PickerOnChangeFn<TDate>, selectionState?: PickerSelectionState): {
14
14
  meridiemMode: import("../utils/time-utils").Meridiem | null;
15
- handleMeridiemChange: (mode: 'am' | 'pm') => void;
15
+ handleMeridiemChange: (mode: "am" | "pm") => void;
16
16
  };
@@ -9,11 +9,11 @@ export interface UseDefaultizedTimeFieldBaseProps extends BaseTimeValidationProp
9
9
  format?: string;
10
10
  }
11
11
  export declare const useDefaultizedTimeField: <TDate extends PickerValidDate, TKnownProps extends UseDefaultizedTimeFieldBaseProps & {
12
- ampm?: boolean | undefined;
12
+ ampm?: boolean;
13
13
  }, TAllProps extends {}>(props: TKnownProps & TAllProps) => TAllProps & DefaultizedProps<TKnownProps, keyof UseDefaultizedTimeFieldBaseProps>;
14
14
  export interface UseDefaultizedDateTimeFieldBaseProps<TDate extends PickerValidDate> extends BaseDateValidationProps<TDate>, BaseTimeValidationProps {
15
15
  format?: string;
16
16
  }
17
17
  export declare const useDefaultizedDateTimeField: <TDate extends PickerValidDate, TKnownProps extends UseDefaultizedDateTimeFieldBaseProps<TDate> & DateTimeValidationProps<TDate> & TimeValidationProps<TDate> & {
18
- ampm?: boolean | undefined;
18
+ ampm?: boolean;
19
19
  }, TAllProps extends {}>(props: TKnownProps & TAllProps) => TAllProps & DefaultizedProps<TKnownProps, keyof UseDefaultizedDateTimeFieldBaseProps<any>>;
@@ -1,5 +1,5 @@
1
- import { UseFieldParams, UseFieldResponse, UseFieldCommonForwardedProps, UseFieldInternalProps } from './useField.types';
1
+ import { UseFieldParams, UseFieldResponse, UseFieldCommonForwardedProps, UseFieldInternalProps, UseFieldForwardedProps } from './useField.types';
2
2
  import { PickerValidDate, FieldSection } from '../../../models';
3
- export declare const useField: <TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldCommonForwardedProps & (TEnableAccessibleFieldDOMStructure extends false ? import("./useField.types").UseFieldV6ForwardedProps : import("./useField.types").UseFieldV7ForwardedProps), TInternalProps extends UseFieldInternalProps<any, any, any, TEnableAccessibleFieldDOMStructure, any> & {
4
- minutesStep?: number | undefined;
3
+ export declare const useField: <TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldCommonForwardedProps & UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure>, TInternalProps extends UseFieldInternalProps<any, any, any, TEnableAccessibleFieldDOMStructure, any> & {
4
+ minutesStep?: number;
5
5
  }>(params: UseFieldParams<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TForwardedProps, TInternalProps>) => UseFieldResponse<TEnableAccessibleFieldDOMStructure, TForwardedProps>;
@@ -1,6 +1,6 @@
1
1
  import { AvailableAdjustKeyCode, FieldSectionsValueBoundaries, SectionOrdering, FieldSectionValueBoundaries, FieldParsedSelectedSections } from './useField.types';
2
2
  import { FieldSectionType, FieldValueType, FieldSection, MuiPickersAdapter, FieldSectionContentType, PickersTimezone, PickerValidDate, FieldSelectedSections } from '../../../models';
3
- export declare const getDateSectionConfigFromFormatToken: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, formatToken: string) => Pick<FieldSection, 'type' | 'contentType'> & {
3
+ export declare const getDateSectionConfigFromFormatToken: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, formatToken: string) => Pick<FieldSection, "type" | "contentType"> & {
4
4
  maxLength: number | undefined;
5
5
  };
6
6
  export declare const getDaysInWeekStr: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, timezone: PickersTimezone, format: string) => string[];
@@ -16,11 +16,11 @@ export declare const isStringNumber: (valueStr: string, localizedDigits: string[
16
16
  * Warning: Should only be called with non-localized digits. Call `removeLocalizedDigits` with your value if needed.
17
17
  */
18
18
  export declare const cleanLeadingZeros: (valueStr: string, size: number) => string;
19
- export declare const cleanDigitSectionValue: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, value: number, sectionBoundaries: FieldSectionValueBoundaries<TDate, any>, localizedDigits: string[], section: Pick<FieldSection, 'format' | 'type' | 'contentType' | 'hasLeadingZerosInFormat' | 'hasLeadingZerosInInput' | 'maxLength'>) => string;
19
+ export declare const cleanDigitSectionValue: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, value: number, sectionBoundaries: FieldSectionValueBoundaries<TDate, any>, localizedDigits: string[], section: Pick<FieldSection, "format" | "type" | "contentType" | "hasLeadingZerosInFormat" | "hasLeadingZerosInInput" | "maxLength">) => string;
20
20
  export declare const adjustSectionValue: <TDate extends PickerValidDate, TSection extends FieldSection>(utils: MuiPickersAdapter<TDate>, timezone: PickersTimezone, section: TSection, keyCode: AvailableAdjustKeyCode, sectionsValueBoundaries: FieldSectionsValueBoundaries<TDate>, localizedDigits: string[], activeDate: TDate | null, stepsAttributes?: {
21
21
  minutesStep?: number;
22
22
  }) => string;
23
- export declare const getSectionVisibleValue: (section: FieldSection, target: 'input-rtl' | 'input-ltr' | 'non-input', localizedDigits: string[]) => string;
23
+ export declare const getSectionVisibleValue: (section: FieldSection, target: "input-rtl" | "input-ltr" | "non-input", localizedDigits: string[]) => string;
24
24
  export declare const changeSectionValueFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, valueStr: string, currentFormat: string, newFormat: string) => string;
25
25
  export declare const doesSectionFormatHaveLeadingZeros: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, timezone: PickersTimezone, contentType: FieldSectionContentType, sectionType: FieldSectionType, format: string) => boolean;
26
26
  /**
@@ -2,14 +2,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import useControlled from '@mui/utils/useControlled';
4
4
  import { useRtl } from '@mui/system/RtlProvider';
5
- import { useUtils, useLocaleText, useLocalizationContext } from '../useUtils';
5
+ import { usePickersTranslations } from '../../../hooks/usePickersTranslations';
6
+ import { useUtils, useLocalizationContext } from '../useUtils';
6
7
  import { mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections, parseSelectedSections, getLocalizedDigits } from './useField.utils';
7
8
  import { buildSectionsFromFormat } from './buildSectionsFromFormat';
8
9
  import { useValueWithTimezone } from '../useValueWithTimezone';
9
10
  import { getSectionTypeGranularity } from '../../utils/getDefaultReferenceDate';
10
11
  export const useFieldState = params => {
11
12
  const utils = useUtils();
12
- const localeText = useLocaleText();
13
+ const translations = usePickersTranslations();
13
14
  const adapter = useLocalizationContext();
14
15
  const isRtl = useRtl();
15
16
  const {
@@ -48,7 +49,7 @@ export const useFieldState = params => {
48
49
  const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, date => buildSectionsFromFormat({
49
50
  utils,
50
51
  timezone,
51
- localeText,
52
+ localeText: translations,
52
53
  localizedDigits,
53
54
  format,
54
55
  date,
@@ -56,7 +57,7 @@ export const useFieldState = params => {
56
57
  shouldRespectLeadingZeros,
57
58
  enableAccessibleFieldDOMStructure,
58
59
  isRtl
59
- })), [fieldValueManager, format, localeText, localizedDigits, isRtl, shouldRespectLeadingZeros, utils, formatDensity, timezone, enableAccessibleFieldDOMStructure]);
60
+ })), [fieldValueManager, format, translations, localizedDigits, isRtl, shouldRespectLeadingZeros, utils, formatDensity, timezone, enableAccessibleFieldDOMStructure]);
60
61
  const [state, setState] = React.useState(() => {
61
62
  const sections = getSectionsFromValue(valueFromTheOutside);
62
63
  validateSections(sections, valueType);
@@ -156,7 +157,7 @@ export const useFieldState = params => {
156
157
  const sections = buildSectionsFromFormat({
157
158
  utils,
158
159
  timezone,
159
- localeText,
160
+ localeText: translations,
160
161
  localizedDigits,
161
162
  format,
162
163
  date,
@@ -103,6 +103,13 @@ export const useFieldV6TextField = params => {
103
103
  inputRef.current.setSelectionRange(selectionStart, selectionEnd);
104
104
  }
105
105
  }
106
+ setTimeout(() => {
107
+ // handle case when the selection is not updated correctly
108
+ // could happen on Android
109
+ if (inputRef.current && inputRef.current === getActiveElement(document) && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
110
+ interactions.syncSelectionToDOM();
111
+ }
112
+ });
106
113
  }
107
114
 
108
115
  // Even reading this variable seems to do the trick, but also setting it just to make use of it
@@ -265,10 +272,9 @@ export const useFieldV6TextField = params => {
265
272
  if (keyPressed.length === 0) {
266
273
  if (isAndroid()) {
267
274
  setTempAndroidValueStr(valueStr);
268
- } else {
269
- resetCharacterQuery();
270
- clearActiveSection();
271
275
  }
276
+ resetCharacterQuery();
277
+ clearActiveSection();
272
278
  return;
273
279
  }
274
280
  applyCharacterEditing({
@@ -5,7 +5,8 @@ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
5
5
  import useId from '@mui/utils/useId';
6
6
  import { getSectionValueNow, getSectionValueText, parseSelectedSections } from './useField.utils';
7
7
  import { getActiveElement } from '../../utils/utils';
8
- import { useLocaleText, useUtils } from '../useUtils';
8
+ import { usePickersTranslations } from '../../../hooks/usePickersTranslations';
9
+ import { useUtils } from '../useUtils';
9
10
  export const useFieldV7TextField = params => {
10
11
  const {
11
12
  internalProps: {
@@ -38,7 +39,7 @@ export const useFieldV7TextField = params => {
38
39
  } = params;
39
40
  const sectionListRef = React.useRef(null);
40
41
  const handleSectionListRef = useForkRef(inSectionListRef, sectionListRef);
41
- const localeText = useLocaleText();
42
+ const translations = usePickersTranslations();
42
43
  const utils = useUtils();
43
44
  const id = useId();
44
45
  const [focused, setFocused] = React.useState(false);
@@ -341,8 +342,8 @@ export const useFieldV7TextField = params => {
341
342
  'aria-valuenow': getSectionValueNow(section, utils),
342
343
  'aria-valuemin': sectionBoundaries[section.type].minimum,
343
344
  'aria-valuemax': sectionBoundaries[section.type].maximum,
344
- 'aria-valuetext': section.value ? getSectionValueText(section, utils) : localeText.empty,
345
- 'aria-label': localeText[section.type],
345
+ 'aria-valuetext': section.value ? getSectionValueText(section, utils) : translations.empty,
346
+ 'aria-label': translations[section.type],
346
347
  'aria-disabled': disabled,
347
348
  spellCheck: isEditable ? false : undefined,
348
349
  autoCapitalize: isEditable ? 'off' : undefined,
@@ -364,7 +365,7 @@ export const useFieldV7TextField = params => {
364
365
  }
365
366
  };
366
367
  });
367
- }, [state.sections, getInputContentFocusHandler, handleInputContentPaste, handleInputContentDragOver, handleInputContentInput, getInputContainerClickHandler, handleInputContentMouseUp, disabled, readOnly, isContainerEditable, localeText, utils, sectionBoundaries, id]);
368
+ }, [state.sections, getInputContentFocusHandler, handleInputContentPaste, handleInputContentDragOver, handleInputContentInput, getInputContainerClickHandler, handleInputContentMouseUp, disabled, readOnly, isContainerEditable, translations, utils, sectionBoundaries, id]);
368
369
  const handleValueStrChange = useEventCallback(event => {
369
370
  updateValueFromValueStr(event.target.value);
370
371
  });
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { FieldChangeHandlerContext, UseFieldInternalProps } from '../useField';
3
2
  import { InferError, Validator } from '../useValidation';
4
3
  import { UseFieldValidationProps } from '../useField/useField.types';
@@ -9,5 +9,4 @@ export declare const useDefaultDates: <TDate extends PickerValidDate>() => {
9
9
  minDate: TDate;
10
10
  maxDate: TDate;
11
11
  };
12
- export declare const useLocaleText: <TDate extends PickerValidDate>() => PickersLocaleText<TDate>;
13
12
  export declare const useNow: <TDate extends PickerValidDate>(timezone: PickersTimezone) => TDate;
@@ -17,7 +17,6 @@ export const useLocalizationContext = () => {
17
17
  };
18
18
  export const useUtils = () => useLocalizationContext().utils;
19
19
  export const useDefaultDates = () => useLocalizationContext().defaultDates;
20
- export const useLocaleText = () => useLocalizationContext().localeText;
21
20
  export const useNow = timezone => {
22
21
  const utils = useUtils();
23
22
  const now = React.useRef();
@@ -32,7 +32,7 @@ export type { UsePickerValueNonStaticProps, PickerValueManager, PickerSelectionS
32
32
  export type { UsePickerViewsNonStaticProps, PickerViewRendererLookup, PickerViewRenderer, UsePickerViewsProps, } from './hooks/usePicker/usePickerViews';
33
33
  export { useStaticPicker } from './hooks/useStaticPicker';
34
34
  export type { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps, } from './hooks/useStaticPicker';
35
- export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText, useNow, } from './hooks/useUtils';
35
+ export { useLocalizationContext, useDefaultDates, useUtils, useNow } from './hooks/useUtils';
36
36
  export type { ExportedUseViewsOptions, UseViewsOptions } from './hooks/useViews';
37
37
  export { useViews } from './hooks/useViews';
38
38
  export { useValidation } from './hooks/useValidation';
@@ -13,7 +13,7 @@ export { useControlledValueWithTimezone } from './hooks/useValueWithTimezone';
13
13
  export { useField, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from './hooks/useField';
14
14
  export { usePicker } from './hooks/usePicker';
15
15
  export { useStaticPicker } from './hooks/useStaticPicker';
16
- export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText, useNow } from './hooks/useUtils';
16
+ export { useLocalizationContext, useDefaultDates, useUtils, useNow } from './hooks/useUtils';
17
17
  export { useViews } from './hooks/useViews';
18
18
  export { useValidation } from './hooks/useValidation';
19
19
  export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
@@ -17,7 +17,7 @@ export declare const applyDefaultDate: <TDate extends PickerValidDate>(utils: Mu
17
17
  export declare const areDatesEqual: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, a: TDate, b: TDate) => boolean;
18
18
  export declare const getMonthsInYear: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, year: TDate) => TDate[];
19
19
  export declare const getTodayDate: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, timezone: PickersTimezone, valueType?: FieldValueType) => TDate;
20
- export declare const formatMeridiem: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, meridiem: 'am' | 'pm') => string;
20
+ export declare const formatMeridiem: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, meridiem: "am" | "pm") => string;
21
21
  export declare const isDatePickerView: (view: DateOrTimeViewWithMeridiem) => view is DateView;
22
22
  export declare const resolveDateFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, { format, views }: {
23
23
  format?: string;
@@ -8,4 +8,4 @@ export declare const DATE_TIME_VALIDATION_PROP_NAMES: (keyof DateTimeValidationP
8
8
  */
9
9
  export declare const extractValidationProps: <Props extends {
10
10
  [key: string]: any;
11
- }>(props: Props) => Pick<Props, "ampm" | "disableFuture" | "disablePast" | "maxDate" | "minDate" | "minutesStep" | "shouldDisableDate" | "shouldDisableMonth" | "shouldDisableYear" | "minTime" | "maxTime" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "minDateTime" | "maxDateTime">;
11
+ }>(props: Props) => Pick<Props, "minDate" | "maxDate" | "ampm" | "disableFuture" | "disablePast" | "minutesStep" | "shouldDisableDate" | "shouldDisableMonth" | "shouldDisableYear" | "minTime" | "maxTime" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "minDateTime" | "maxDateTime">;
@@ -1,6 +1,6 @@
1
1
  import { DateOrTimeView } from '../../models';
2
2
  import { DateOrTimeViewWithMeridiem } from '../models';
3
- export declare const areViewsEqual: <TView extends DateOrTimeView>(views: ReadonlyArray<DateOrTimeView>, expectedViews: TView[]) => views is readonly TView[];
3
+ export declare const areViewsEqual: <TView extends DateOrTimeView>(views: ReadonlyArray<DateOrTimeView>, expectedViews: TView[]) => views is ReadonlyArray<TView>;
4
4
  export declare const applyDefaultViewProps: <TView extends DateOrTimeViewWithMeridiem>({ openTo, defaultOpenTo, views, defaultViews, }: {
5
5
  openTo: TView | undefined;
6
6
  defaultOpenTo: TView;
@@ -1,4 +1,4 @@
1
1
  export declare const buildDeprecatedPropsWarning: (message: string | string[]) => (deprecatedProps: {
2
2
  [key: string]: any;
3
3
  }) => void;
4
- export declare const buildWarning: (message: string | string[], gravity?: 'warning' | 'error') => () => void;
4
+ export declare const buildWarning: (message: string | string[], gravity?: "warning" | "error") => () => void;
@@ -11,7 +11,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
11
11
  import { unstable_composeClasses as composeClasses, unstable_useControlled as useControlled } from '@mui/utils';
12
12
  import clsx from 'clsx';
13
13
  import { PickersDay } from '../PickersDay/PickersDay';
14
- import { useUtils, useNow, useLocaleText } from '../internals/hooks/useUtils';
14
+ import { usePickersTranslations } from '../hooks/usePickersTranslations';
15
+ import { useUtils, useNow } from '../internals/hooks/useUtils';
15
16
  import { DAY_SIZE, DAY_MARGIN } from '../internals/constants/dimensions';
16
17
  import { PickersSlideTransition } from './PickersSlideTransition';
17
18
  import { useIsDateDisabled } from './useIsDateDisabled';
@@ -261,7 +262,7 @@ export function DayCalendar(inProps) {
261
262
  disableFuture,
262
263
  timezone
263
264
  });
264
- const localeText = useLocaleText();
265
+ const translations = usePickersTranslations();
265
266
  const [internalHasFocus, setInternalHasFocus] = useControlled({
266
267
  name: 'DayCalendar',
267
268
  state: 'hasFocus',
@@ -403,9 +404,9 @@ export function DayCalendar(inProps) {
403
404
  children: [displayWeekNumber && /*#__PURE__*/_jsx(PickersCalendarWeekNumberLabel, {
404
405
  variant: "caption",
405
406
  role: "columnheader",
406
- "aria-label": localeText.calendarWeekNumberHeaderLabel,
407
+ "aria-label": translations.calendarWeekNumberHeaderLabel,
407
408
  className: classes.weekNumberLabel,
408
- children: localeText.calendarWeekNumberHeaderText
409
+ children: translations.calendarWeekNumberHeaderText
409
410
  }), getWeekdays(utils, now).map((weekday, i) => /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
410
411
  variant: "caption",
411
412
  role: "columnheader",
@@ -438,8 +439,8 @@ export function DayCalendar(inProps) {
438
439
  children: [displayWeekNumber && /*#__PURE__*/_jsx(PickersCalendarWeekNumber, {
439
440
  className: classes.weekNumber,
440
441
  role: "rowheader",
441
- "aria-label": localeText.calendarWeekNumberAriaLabelText(utils.getWeekNumber(week[0])),
442
- children: localeText.calendarWeekNumberText(utils.getWeekNumber(week[0]))
442
+ "aria-label": translations.calendarWeekNumberAriaLabelText(utils.getWeekNumber(week[0])),
443
+ children: translations.calendarWeekNumberText(utils.getWeekNumber(week[0]))
443
444
  }), week.map((day, dayIndex) => /*#__PURE__*/_jsx(WrappedDay, {
444
445
  parentProps: props,
445
446
  day: day,
@@ -8,7 +8,8 @@ import Typography from '@mui/material/Typography';
8
8
  import { styled, useThemeProps } from '@mui/material/styles';
9
9
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
10
10
  import { PickersToolbar } from '../internals/components/PickersToolbar';
11
- import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
11
+ import { usePickersTranslations } from '../hooks/usePickersTranslations';
12
+ import { useUtils } from '../internals/hooks/useUtils';
12
13
  import { getDatePickerToolbarUtilityClass } from './datePickerToolbarClasses';
13
14
  import { resolveDateFormat } from '../internals/utils/date-utils';
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -66,7 +67,7 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
66
67
  } = props,
67
68
  other = _objectWithoutPropertiesLoose(props, _excluded);
68
69
  const utils = useUtils();
69
- const localeText = useLocaleText();
70
+ const translations = usePickersTranslations();
70
71
  const classes = useUtilityClasses(props);
71
72
  const dateText = React.useMemo(() => {
72
73
  if (!value) {
@@ -81,7 +82,7 @@ export const DatePickerToolbar = /*#__PURE__*/React.forwardRef(function DatePick
81
82
  const ownerState = props;
82
83
  return /*#__PURE__*/_jsx(DatePickerToolbarRoot, _extends({
83
84
  ref: ref,
84
- toolbarTitle: localeText.datePickerToolbarTitle,
85
+ toolbarTitle: translations.datePickerToolbarTitle,
85
86
  isLandscape: isLandscape,
86
87
  className: clsx(classes.root, className)
87
88
  }, other, {