@mui/x-date-pickers-pro 8.0.0-alpha.12 → 8.0.0-alpha.14

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 (159) hide show
  1. package/CHANGELOG.md +430 -0
  2. package/DateRangePicker/DateRangePicker.types.d.ts +2 -2
  3. package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +2 -2
  4. package/DateTimeRangePicker/shared.d.ts +2 -2
  5. package/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -2
  6. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +2 -2
  7. package/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  8. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +2 -2
  9. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
  10. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
  11. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
  12. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +6 -4
  13. package/dateRangeViewRenderers/dateRangeViewRenderers.js +13 -8
  14. package/esm/DateRangePicker/DateRangePicker.types.d.ts +2 -2
  15. package/esm/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +2 -2
  16. package/esm/DateTimeRangePicker/shared.d.ts +2 -2
  17. package/esm/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -2
  18. package/esm/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +2 -2
  19. package/esm/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  20. package/esm/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +2 -2
  21. package/esm/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
  22. package/esm/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
  23. package/esm/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
  24. package/esm/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +6 -4
  25. package/esm/dateRangeViewRenderers/dateRangeViewRenderers.js +13 -8
  26. package/esm/hooks/index.d.ts +2 -1
  27. package/esm/hooks/useMultiInputRangeField/index.d.ts +2 -1
  28. package/esm/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +37 -18
  29. package/esm/hooks/useMultiInputRangeField/useMultiInputRangeField.js +41 -50
  30. package/esm/hooks/useMultiInputRangeField/useMultiInputRangeFieldRootProps.d.ts +11 -0
  31. package/esm/hooks/useMultiInputRangeField/useMultiInputRangeFieldRootProps.js +25 -0
  32. package/esm/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.ts +4 -1
  33. package/esm/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js +3 -2
  34. package/esm/hooks/useMultiInputRangeField/useTextFieldProps.d.ts +30 -0
  35. package/esm/hooks/useMultiInputRangeField/useTextFieldProps.js +141 -0
  36. package/esm/index.js +1 -1
  37. package/esm/internals/hooks/models/index.d.ts +1 -1
  38. package/esm/internals/hooks/models/useRangePicker.d.ts +4 -11
  39. package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +8 -75
  40. package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +17 -5
  41. package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -47
  42. package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +18 -5
  43. package/esm/internals/hooks/useRangePosition.d.ts +1 -4
  44. package/esm/internals/hooks/useRangePosition.js +1 -18
  45. package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +3 -3
  46. package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +2 -2
  47. package/esm/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +26 -32
  48. package/esm/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.ts +1 -1
  49. package/esm/internals/utils/createMultiInputRangeField/useTextFieldProps.d.ts +12 -0
  50. package/esm/internals/utils/createMultiInputRangeField/useTextFieldProps.js +36 -0
  51. package/esm/internals/utils/date-fields-utils.d.ts +4 -1
  52. package/esm/internals/utils/date-fields-utils.js +5 -1
  53. package/esm/internals/utils/releaseInfo.js +1 -1
  54. package/esm/internals/utils/valueManagers.js +31 -30
  55. package/esm/managers/useDateRangeManager.d.ts +2 -4
  56. package/esm/managers/useDateRangeManager.js +8 -1
  57. package/esm/managers/useDateTimeRangeManager.d.ts +2 -4
  58. package/esm/managers/useDateTimeRangeManager.js +8 -1
  59. package/esm/managers/useTimeRangeManager.d.ts +2 -4
  60. package/esm/managers/useTimeRangeManager.js +10 -1
  61. package/esm/models/fields.d.ts +5 -18
  62. package/hooks/index.d.ts +2 -1
  63. package/hooks/useMultiInputRangeField/index.d.ts +2 -1
  64. package/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +37 -18
  65. package/hooks/useMultiInputRangeField/useMultiInputRangeField.js +40 -51
  66. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldRootProps.d.ts +11 -0
  67. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldRootProps.js +31 -0
  68. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.ts +4 -1
  69. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js +3 -1
  70. package/hooks/useMultiInputRangeField/useTextFieldProps.d.ts +30 -0
  71. package/hooks/useMultiInputRangeField/useTextFieldProps.js +149 -0
  72. package/index.js +1 -1
  73. package/internals/hooks/models/index.d.ts +1 -1
  74. package/internals/hooks/models/useRangePicker.d.ts +4 -11
  75. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +7 -74
  76. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +17 -5
  77. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -47
  78. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +18 -5
  79. package/internals/hooks/useRangePosition.d.ts +1 -4
  80. package/internals/hooks/useRangePosition.js +1 -18
  81. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +3 -3
  82. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +2 -2
  83. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +25 -31
  84. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.ts +1 -1
  85. package/internals/utils/createMultiInputRangeField/useTextFieldProps.d.ts +12 -0
  86. package/internals/utils/createMultiInputRangeField/useTextFieldProps.js +44 -0
  87. package/internals/utils/date-fields-utils.d.ts +4 -1
  88. package/internals/utils/date-fields-utils.js +6 -1
  89. package/internals/utils/releaseInfo.js +1 -1
  90. package/internals/utils/valueManagers.js +31 -30
  91. package/managers/useDateRangeManager.d.ts +2 -4
  92. package/managers/useDateRangeManager.js +8 -1
  93. package/managers/useDateTimeRangeManager.d.ts +2 -4
  94. package/managers/useDateTimeRangeManager.js +8 -1
  95. package/managers/useTimeRangeManager.d.ts +2 -4
  96. package/managers/useTimeRangeManager.js +10 -1
  97. package/models/fields.d.ts +5 -18
  98. package/modern/DateRangePicker/DateRangePicker.types.d.ts +2 -2
  99. package/modern/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +2 -2
  100. package/modern/DateTimeRangePicker/shared.d.ts +2 -2
  101. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -2
  102. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +2 -2
  103. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  104. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +2 -2
  105. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
  106. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
  107. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
  108. package/modern/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +6 -4
  109. package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +13 -8
  110. package/modern/hooks/index.d.ts +2 -1
  111. package/modern/hooks/useMultiInputRangeField/index.d.ts +2 -1
  112. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +37 -18
  113. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeField.js +41 -50
  114. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldRootProps.d.ts +11 -0
  115. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldRootProps.js +25 -0
  116. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.ts +4 -1
  117. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js +3 -2
  118. package/modern/hooks/useMultiInputRangeField/useTextFieldProps.d.ts +30 -0
  119. package/modern/hooks/useMultiInputRangeField/useTextFieldProps.js +141 -0
  120. package/modern/index.js +1 -1
  121. package/modern/internals/hooks/models/index.d.ts +1 -1
  122. package/modern/internals/hooks/models/useRangePicker.d.ts +4 -11
  123. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +8 -75
  124. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +17 -5
  125. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -47
  126. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +18 -5
  127. package/modern/internals/hooks/useRangePosition.d.ts +1 -4
  128. package/modern/internals/hooks/useRangePosition.js +1 -18
  129. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +3 -3
  130. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +2 -2
  131. package/modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +26 -32
  132. package/modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.ts +1 -1
  133. package/modern/internals/utils/createMultiInputRangeField/useTextFieldProps.d.ts +12 -0
  134. package/modern/internals/utils/createMultiInputRangeField/useTextFieldProps.js +36 -0
  135. package/modern/internals/utils/date-fields-utils.d.ts +4 -1
  136. package/modern/internals/utils/date-fields-utils.js +5 -1
  137. package/modern/internals/utils/releaseInfo.js +1 -1
  138. package/modern/internals/utils/valueManagers.js +31 -30
  139. package/modern/managers/useDateRangeManager.d.ts +2 -4
  140. package/modern/managers/useDateRangeManager.js +8 -1
  141. package/modern/managers/useDateTimeRangeManager.d.ts +2 -4
  142. package/modern/managers/useDateTimeRangeManager.js +8 -1
  143. package/modern/managers/useTimeRangeManager.d.ts +2 -4
  144. package/modern/managers/useTimeRangeManager.js +10 -1
  145. package/modern/models/fields.d.ts +5 -18
  146. package/package.json +4 -4
  147. package/tsconfig.build.tsbuildinfo +1 -1
  148. package/esm/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.d.ts +0 -17
  149. package/esm/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +0 -59
  150. package/esm/internals/hooks/useEnrichedRangePickerField.d.ts +0 -70
  151. package/esm/internals/hooks/useEnrichedRangePickerField.js +0 -236
  152. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.d.ts +0 -17
  153. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +0 -66
  154. package/internals/hooks/useEnrichedRangePickerField.d.ts +0 -70
  155. package/internals/hooks/useEnrichedRangePickerField.js +0 -245
  156. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.d.ts +0 -17
  157. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +0 -59
  158. package/modern/internals/hooks/useEnrichedRangePickerField.d.ts +0 -70
  159. package/modern/internals/hooks/useEnrichedRangePickerField.js +0 -236
@@ -10,15 +10,15 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
11
  var React = _interopRequireWildcard(require("react"));
12
12
  var _useSlotProps2 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
13
+ var _resolveComponentProps = _interopRequireDefault(require("@mui/utils/resolveComponentProps"));
13
14
  var _xLicense = require("@mui/x-license");
14
15
  var _PickersLayout = require("@mui/x-date-pickers/PickersLayout");
15
16
  var _internals = require("@mui/x-date-pickers/internals");
16
17
  var _hooks = require("@mui/x-date-pickers/hooks");
17
- var _useId = _interopRequireDefault(require("@mui/utils/useId"));
18
- var _useEnrichedRangePickerField = require("../useEnrichedRangePickerField");
19
18
  var _releaseInfo = require("../../utils/releaseInfo");
20
19
  var _useRangePosition = require("../useRangePosition");
21
20
  var _usePickerRangePositionContext = require("../../../hooks/usePickerRangePositionContext");
21
+ var _dateFieldsUtils = require("../../utils/date-fields-utils");
22
22
  var _jsxRuntime = require("react/jsx-runtime");
23
23
  const _excluded = ["props"],
24
24
  _excluded2 = ["ownerState"];
@@ -34,25 +34,11 @@ const useMobileRangePicker = _ref => {
34
34
  slotProps: innerSlotProps,
35
35
  label,
36
36
  inputRef,
37
- readOnly,
38
- disableOpenPicker,
39
37
  localeText
40
38
  } = props;
41
- const startFieldRef = React.useRef(null);
42
- const endFieldRef = React.useRef(null);
43
- const singleInputFieldRef = React.useRef(null);
44
- const fieldType = slots.field.fieldType ?? 'multi-input';
45
- const rangePositionResponse = (0, _useRangePosition.useRangePosition)(props, fieldType === 'single-input' ? singleInputFieldRef : undefined);
46
- const labelId = (0, _useId.default)();
39
+ const fieldType = (0, _dateFieldsUtils.getRangeFieldType)(slots.field);
40
+ const rangePositionResponse = (0, _useRangePosition.useRangePosition)(props);
47
41
  const contextTranslations = (0, _hooks.usePickerTranslations)();
48
- let fieldRef;
49
- if (fieldType === 'single-input') {
50
- fieldRef = singleInputFieldRef;
51
- } else if (rangePositionResponse.rangePosition === 'start') {
52
- fieldRef = startFieldRef;
53
- } else {
54
- fieldRef = endFieldRef;
55
- }
56
42
  const {
57
43
  providerProps,
58
44
  renderCurrentView,
@@ -61,41 +47,21 @@ const useMobileRangePicker = _ref => {
61
47
  props,
62
48
  variant: 'mobile',
63
49
  autoFocusView: true,
64
- fieldRef,
50
+ viewContainerRole: 'dialog',
65
51
  localeText
66
52
  }));
67
-
68
- // Temporary hack to hide the opening button on the range pickers until we have migrate them to the new opening logic.
69
- providerProps.contextValue.triggerStatus = 'hidden';
53
+ const labelId = providerProps.privateContextValue.labelId;
54
+ const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
70
55
  const Field = slots.field;
71
56
  const _useSlotProps = (0, _useSlotProps2.default)({
72
57
  elementType: Field,
73
58
  externalSlotProps: innerSlotProps?.field,
74
- additionalProps: {
75
- // Internal props
76
- readOnly: readOnly ?? true
77
- },
59
+ additionalProps: (0, _extends2.default)({}, fieldType === 'single-input' && isToolbarHidden && {
60
+ id: labelId
61
+ }),
78
62
  ownerState
79
63
  }),
80
64
  fieldProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded2);
81
- const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
82
- const enrichedFieldResponse = (0, _useEnrichedRangePickerField.useEnrichedRangePickerField)((0, _extends2.default)({
83
- variant: 'mobile',
84
- fieldType,
85
- // These direct access to `providerProps` will go away once the range fields handle the picker opening
86
- contextValue: providerProps.contextValue,
87
- fieldPrivateContextValue: providerProps.fieldPrivateContextValue,
88
- readOnly,
89
- labelId,
90
- disableOpenPicker,
91
- localeText,
92
- pickerSlots: slots,
93
- pickerSlotProps: innerSlotProps,
94
- fieldProps,
95
- startFieldRef,
96
- endFieldRef,
97
- singleInputFieldRef
98
- }, rangePositionResponse));
99
65
  const Layout = slots?.layout ?? _PickersLayout.PickersLayout;
100
66
  const finalLocaleText = (0, _extends2.default)({}, contextTranslations, localeText);
101
67
  let labelledById = pickerParams.valueType === 'date-time' ? `${labelId}-start-toolbar ${labelId}-end-toolbar` : labelId;
@@ -120,17 +86,21 @@ const useMobileRangePicker = _ref => {
120
86
  mobilePaper: (0, _extends2.default)({
121
87
  'aria-labelledby': labelledById
122
88
  }, innerSlotProps?.mobilePaper)
89
+ }, fieldType === 'multi-input' && {
90
+ textField: slotOwnerState => {
91
+ return (0, _extends2.default)({}, (0, _resolveComponentProps.default)(innerSlotProps?.textField, slotOwnerState), {
92
+ id: `${labelId}-${slotOwnerState.position}`
93
+ });
94
+ }
123
95
  });
124
96
  const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.PickerProvider, (0, _extends2.default)({}, providerProps, {
125
- // This override will go away once the range fields handle the picker opening
126
- fieldPrivateContextValue: (0, _extends2.default)({}, providerProps.fieldPrivateContextValue, enrichedFieldResponse.fieldPrivateContextValue),
127
97
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.PickerFieldUIContextProvider, {
128
98
  slots: slots,
129
99
  slotProps: slotProps,
130
100
  inputRef: inputRef,
131
101
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_usePickerRangePositionContext.PickerRangePositionContext.Provider, {
132
102
  value: rangePositionResponse,
133
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Field, (0, _extends2.default)({}, enrichedFieldResponse.fieldProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.PickersModalDialog, {
103
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Field, (0, _extends2.default)({}, fieldProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.PickersModalDialog, {
134
104
  slots: slots,
135
105
  slotProps: slotProps,
136
106
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Layout, (0, _extends2.default)({}, slotProps?.layout, {
@@ -1,9 +1,22 @@
1
- import { PickersModalDialogSlots, PickersModalDialogSlotProps, UsePickerViewsProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
- import { RangeOnlyPickerProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from "../models/useRangePicker.js";
3
- export interface UseMobileRangePickerSlots extends UseRangePickerSlots, PickersModalDialogSlots {}
4
- export interface UseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, PickersModalDialogSlotProps {}
1
+ import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
2
+ import { PickerFieldSlotProps, PickerOwnerState } from '@mui/x-date-pickers/models';
3
+ import { PickersModalDialogSlots, PickersModalDialogSlotProps, UsePickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue, PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from '@mui/x-date-pickers/internals';
4
+ import { ExportedPickersLayoutSlotProps, ExportedPickersLayoutSlots, PickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
5
+ import { RangeOnlyPickerProps, UseRangePickerParams, UseRangePickerProps } from "../models/useRangePicker.js";
6
+ export interface UseMobileRangePickerSlots extends PickersModalDialogSlots, ExportedPickersLayoutSlots<PickerRangeValue>, PickerFieldUISlotsFromContext {
7
+ /**
8
+ * Component used to enter the date with the keyboard.
9
+ */
10
+ field: React.ElementType;
11
+ }
12
+ export interface ExportedUseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends PickersModalDialogSlotProps, ExportedPickersLayoutSlotProps<PickerRangeValue>, PickerFieldUISlotPropsFromContext {
13
+ field?: SlotComponentPropsFromProps<PickerFieldSlotProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure> & {
14
+ dateSeparator?: string;
15
+ }, {}, PickerOwnerState>;
16
+ }
17
+ export interface UseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends ExportedUseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, Pick<PickersLayoutSlotProps<PickerRangeValue>, 'toolbar'> {}
5
18
  export interface MobileRangeOnlyPickerProps extends RangeOnlyPickerProps {}
6
- export interface UseMobileRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, TView, any>> extends UseRangePickerProps<TView, TError, TExternalProps> {
19
+ export interface UseMobileRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerProps<PickerRangeValue, TView, TError, any>> extends UseRangePickerProps<TView, TError, TExternalProps> {
7
20
  /**
8
21
  * Overridable component slots.
9
22
  * @default {}
@@ -1,6 +1,3 @@
1
- import * as React from 'react';
2
- import { FieldRef } from '@mui/x-date-pickers/models';
3
- import { PickerRangeValue } from '@mui/x-date-pickers/internals';
4
1
  import { RangePosition } from "../../models/index.js";
5
2
  export interface UseRangePositionProps {
6
3
  /**
@@ -24,4 +21,4 @@ export interface UseRangePositionResponse {
24
21
  rangePosition: RangePosition;
25
22
  setRangePosition: (newPosition: RangePosition) => void;
26
23
  }
27
- export declare const useRangePosition: (props: UseRangePositionProps, singleInputFieldRef?: React.RefObject<FieldRef<PickerRangeValue> | null>) => UseRangePositionResponse;
24
+ export declare const useRangePosition: (props: UseRangePositionProps) => UseRangePositionResponse;
@@ -7,33 +7,16 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.useRangePosition = void 0;
8
8
  var _useControlled = _interopRequireDefault(require("@mui/utils/useControlled"));
9
9
  var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
10
- const useRangePosition = (props, singleInputFieldRef) => {
10
+ const useRangePosition = props => {
11
11
  const [rangePosition, setRangePosition] = (0, _useControlled.default)({
12
12
  name: 'useRangePosition',
13
13
  state: 'rangePosition',
14
14
  controlled: props.rangePosition,
15
15
  default: props.defaultRangePosition ?? 'start'
16
16
  });
17
-
18
- // When using a single input field,
19
- // we want to select the 1st section of the edited date when updating the range position.
20
- const syncRangePositionWithSingleInputField = newRangePosition => {
21
- if (singleInputFieldRef?.current == null) {
22
- return;
23
- }
24
- const sections = singleInputFieldRef.current.getSections();
25
- const targetActiveSectionIndex = newRangePosition === 'start' ? 0 : sections.length / 2;
26
- const activeSectionIndex = singleInputFieldRef.current.getActiveSectionIndex();
27
- // if the active section is already within the target range, we don't need to update it.
28
- if (activeSectionIndex && activeSectionIndex >= targetActiveSectionIndex && activeSectionIndex < targetActiveSectionIndex + sections.length / 2) {
29
- return;
30
- }
31
- singleInputFieldRef.current.setSelectedSections(targetActiveSectionIndex);
32
- };
33
17
  const handleRangePositionChange = (0, _useEventCallback.default)(newRangePosition => {
34
18
  setRangePosition(newRangePosition);
35
19
  props.onRangePositionChange?.(newRangePosition);
36
- syncRangePositionWithSingleInputField(newRangePosition);
37
20
  });
38
21
  return {
39
22
  rangePosition,
@@ -47,10 +47,10 @@ const useStaticRangePicker = _ref => {
47
47
  renderCurrentView
48
48
  } = (0, _internals.usePicker)((0, _extends2.default)({}, pickerParams, {
49
49
  props,
50
+ variant: displayStaticWrapperAs,
50
51
  autoFocusView: autoFocus ?? false,
51
- fieldRef: undefined,
52
- localeText,
53
- variant: displayStaticWrapperAs
52
+ viewContainerRole: null,
53
+ localeText
54
54
  }));
55
55
  const Layout = slots?.layout ?? PickerStaticLayout;
56
56
  const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_usePickerRangePositionContext.PickerRangePositionContext.Provider, {
@@ -1,4 +1,4 @@
1
- import { BasePickerProps, UsePickerParams, ExportedBaseToolbarProps, StaticOnlyPickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue } from '@mui/x-date-pickers/internals';
1
+ import { BasePickerProps, UsePickerParameters, ExportedBaseToolbarProps, StaticOnlyPickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue } from '@mui/x-date-pickers/internals';
2
2
  import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
3
3
  import { UseRangePositionProps } from "../useRangePosition.js";
4
4
  export interface UseStaticRangePickerSlots extends ExportedPickersLayoutSlots<PickerRangeValue> {}
@@ -18,6 +18,6 @@ export interface UseStaticRangePickerProps<TView extends DateOrTimeViewWithMerid
18
18
  */
19
19
  slotProps?: UseStaticRangePickerSlotProps;
20
20
  }
21
- export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerRangeValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator' | 'ref'> {
21
+ export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParameters<PickerRangeValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator' | 'ref'> {
22
22
  props: TExternalProps;
23
23
  }
@@ -22,6 +22,7 @@ var _internals = require("@mui/x-date-pickers/internals");
22
22
  var _hooks = require("@mui/x-date-pickers/hooks");
23
23
  var _PickersTextField = require("@mui/x-date-pickers/PickersTextField");
24
24
  var _useMultiInputRangeField = require("../../../hooks/useMultiInputRangeField");
25
+ var _useTextFieldProps = require("./useTextFieldProps");
25
26
  var _jsxRuntime = require("react/jsx-runtime");
26
27
  const _excluded = ["slots", "slotProps", "className", "classes"];
27
28
  function createMultiInputRangeField({
@@ -59,14 +60,19 @@ function createMultiInputRangeField({
59
60
  // eslint-disable-next-line material-ui/mui-name-matches-component-name
60
61
  name
61
62
  });
63
+ const pickerFieldUIContext = React.useContext(_internals.PickerFieldUIContext);
64
+ const pickerContext = (0, _internals.useNullablePickerContext)();
62
65
  const manager = useManager({
63
66
  enableAccessibleFieldDOMStructure: props.enableAccessibleFieldDOMStructure,
64
67
  dateSeparator: props.dateSeparator
65
68
  });
66
69
  const {
67
- internalProps,
70
+ internalProps: rawInternalProps,
68
71
  forwardedProps
69
72
  } = (0, _hooks.useSplitFieldProps)(themeProps, manager.valueType);
73
+ const internalProps = pickerContext?.variant === 'mobile' ? (0, _extends2.default)({}, rawInternalProps, {
74
+ readOnly: true
75
+ }) : rawInternalProps;
70
76
  const {
71
77
  slots,
72
78
  slotProps,
@@ -76,7 +82,6 @@ function createMultiInputRangeField({
76
82
  otherForwardedProps = (0, _objectWithoutPropertiesLoose2.default)(forwardedProps, _excluded);
77
83
  const classes = useUtilityClasses(classesProp);
78
84
  const ownerState = (0, _internals.useFieldOwnerState)(internalProps);
79
- const pickerContext = (0, _internals.useNullablePickerContext)();
80
85
  const handleRef = (0, _useForkRef.default)(ref, pickerContext?.rootRef);
81
86
  const Root = slots?.root ?? MultiInputRangeFieldRoot;
82
87
  const rootProps = (0, _useSlotProps.default)({
@@ -89,29 +94,22 @@ function createMultiInputRangeField({
89
94
  ownerState,
90
95
  className: (0, _clsx.default)(className, classes.root)
91
96
  });
92
- const startTextFieldProps = (0, _useSlotProps.default)({
93
- elementType: _PickersTextField.PickersTextField,
94
- externalSlotProps: slotProps?.textField,
95
- ownerState: (0, _extends2.default)({}, ownerState, {
96
- position: 'start'
97
- })
97
+ const startTextFieldProps = (0, _useTextFieldProps.useTextFieldProps)({
98
+ slotProps,
99
+ ownerState,
100
+ position: 'start'
98
101
  });
99
- const endTextFieldProps = (0, _useSlotProps.default)({
100
- elementType: _PickersTextField.PickersTextField,
101
- externalSlotProps: slotProps?.textField,
102
- ownerState: (0, _extends2.default)({}, ownerState, {
103
- position: 'end'
104
- })
102
+ const endTextFieldProps = (0, _useTextFieldProps.useTextFieldProps)({
103
+ slotProps,
104
+ ownerState,
105
+ position: 'end'
105
106
  });
106
- const {
107
- startDate,
108
- endDate,
109
- enableAccessibleFieldDOMStructure
110
- } = (0, _useMultiInputRangeField.useMultiInputRangeField)({
107
+ const fieldResponse = (0, _useMultiInputRangeField.useMultiInputRangeField)({
111
108
  manager,
112
109
  internalProps,
113
- startForwardedProps: startTextFieldProps,
114
- endForwardedProps: endTextFieldProps
110
+ rootProps,
111
+ startTextFieldProps,
112
+ endTextFieldProps
115
113
  });
116
114
  const Separator = slots?.separator ?? MultiInputRangeFieldSeparator;
117
115
  const separatorProps = (0, _useSlotProps.default)({
@@ -123,19 +121,15 @@ function createMultiInputRangeField({
123
121
  ownerState,
124
122
  className: classes.separator
125
123
  });
126
- const {
127
- textFieldProps: startDateProps
128
- } = (0, _internals.cleanFieldResponse)(startDate);
129
- const {
130
- textFieldProps: endDateProps
131
- } = (0, _internals.cleanFieldResponse)(endDate);
132
- const TextField = slots?.textField ?? (enableAccessibleFieldDOMStructure === false ? _TextField.default : _PickersTextField.PickersTextField);
133
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, (0, _extends2.default)({}, rootProps, {
124
+ const cleanStartTextFieldResponse = (0, _internals.cleanFieldResponse)(fieldResponse.startTextField);
125
+ const cleanEndTextFieldResponse = (0, _internals.cleanFieldResponse)(fieldResponse.endTextField);
126
+ const TextField = slots?.textField ?? pickerFieldUIContext.slots.textField ?? (fieldResponse.enableAccessibleFieldDOMStructure === false ? _TextField.default : _PickersTextField.PickersTextField);
127
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, (0, _extends2.default)({}, fieldResponse.root, {
134
128
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
135
129
  fullWidth: true
136
- }, startDateProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(Separator, (0, _extends2.default)({}, separatorProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
130
+ }, cleanStartTextFieldResponse.textFieldProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(Separator, (0, _extends2.default)({}, separatorProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
137
131
  fullWidth: true
138
- }, endDateProps))]
132
+ }, cleanEndTextFieldResponse.textFieldProps))]
139
133
  }));
140
134
  });
141
135
  MultiInputRangeField.fieldType = 'multi-input';
@@ -7,7 +7,7 @@ import { FieldOwnerState } from '@mui/x-date-pickers/models';
7
7
  import { PickerManagerEnableAccessibleFieldDOMStructure, PickerManagerFieldInternalProps } from '@mui/x-date-pickers/internals';
8
8
  import { FieldType, MultiInputFieldRefs, RangeFieldSeparatorProps, RangePosition } from "../../../models/index.js";
9
9
  import { PickerAnyRangeManager } from "../../models/managers.js";
10
- export type MultiInputRangeFieldProps<TManager extends PickerAnyRangeManager> = MultiInputFieldRefs & RangeFieldSeparatorProps & Omit<PickerManagerFieldInternalProps<TManager>, 'unstableFieldRef' | 'clearable' | 'onClear'> & Omit<StackProps, 'position' | keyof PickerManagerFieldInternalProps<TManager>> & {
10
+ export type MultiInputRangeFieldProps<TManager extends PickerAnyRangeManager> = MultiInputFieldRefs & RangeFieldSeparatorProps & Omit<PickerManagerFieldInternalProps<TManager>, 'unstableFieldRef' | 'clearable' | 'onClear' | 'focused'> & Omit<StackProps, 'position' | keyof PickerManagerFieldInternalProps<TManager>> & {
11
11
  /**
12
12
  * If `true`, the field is focused during the first mount.
13
13
  * @default false
@@ -0,0 +1,12 @@
1
+ import { PickersTextFieldProps } from '@mui/x-date-pickers/PickersTextField';
2
+ import { FieldOwnerState } from '@mui/x-date-pickers/models';
3
+ import { MultiInputRangeFieldSlotProps } from "./createMultiInputRangeField.types.js";
4
+ export declare function useTextFieldProps({
5
+ slotProps,
6
+ ownerState,
7
+ position
8
+ }: {
9
+ slotProps: MultiInputRangeFieldSlotProps | undefined;
10
+ ownerState: FieldOwnerState;
11
+ position: 'start' | 'end';
12
+ }): PickersTextFieldProps;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useTextFieldProps = useTextFieldProps;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var React = _interopRequireWildcard(require("react"));
11
+ var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
12
+ var _PickersTextField = require("@mui/x-date-pickers/PickersTextField");
13
+ var _hooks = require("@mui/x-date-pickers/hooks");
14
+ var _internals = require("@mui/x-date-pickers/internals");
15
+ var _useNullablePickerRangePositionContext = require("../../hooks/useNullablePickerRangePositionContext");
16
+ function useTextFieldProps({
17
+ slotProps,
18
+ ownerState,
19
+ position
20
+ }) {
21
+ const pickerContext = (0, _internals.useNullablePickerContext)();
22
+ const translations = (0, _hooks.usePickerTranslations)();
23
+ const pickerFieldUIContext = React.useContext(_internals.PickerFieldUIContext);
24
+ const rangePositionContext = (0, _useNullablePickerRangePositionContext.useNullablePickerRangePositionContext)();
25
+ const textFieldProps = (0, _useSlotProps.default)({
26
+ elementType: _PickersTextField.PickersTextField,
27
+ externalSlotProps: (0, _internals.mergeSlotProps)(pickerFieldUIContext.slotProps.textField, slotProps?.textField),
28
+ additionalProps: {
29
+ // TODO: Decide if we also want to set the default labels on standalone fields.
30
+ label: pickerContext ? translations[position] : undefined,
31
+ focused: pickerContext?.open ? rangePositionContext?.rangePosition === position : undefined
32
+ },
33
+ ownerState: (0, _extends2.default)({}, ownerState, {
34
+ position
35
+ })
36
+ });
37
+ if (!textFieldProps.InputProps) {
38
+ textFieldProps.InputProps = {};
39
+ }
40
+ if (pickerContext && position === 'start') {
41
+ textFieldProps.InputProps.ref = pickerContext.triggerRef;
42
+ }
43
+ return textFieldProps;
44
+ }
@@ -17,4 +17,7 @@ export declare const removeLastSeparator: (dateSections: FieldRangeSection[]) =>
17
17
  modified: boolean;
18
18
  startSeparator: string;
19
19
  endSeparator: string;
20
- })[];
20
+ })[];
21
+ export declare function getRangeFieldType(field: React.ElementType & {
22
+ fieldType?: 'single-input' | 'multi-input';
23
+ }): "single-input" | "multi-input";
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ exports.getRangeFieldType = getRangeFieldType;
7
8
  exports.splitDateRangeSections = exports.removeLastSeparator = void 0;
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  const splitDateRangeSections = sections => {
@@ -30,4 +31,8 @@ const removeLastSeparator = dateSections => dateSections.map((section, sectionIn
30
31
  }
31
32
  return section;
32
33
  });
33
- exports.removeLastSeparator = removeLastSeparator;
34
+ exports.removeLastSeparator = removeLastSeparator;
35
+ function getRangeFieldType(field) {
36
+ const fieldType = field.fieldType ?? 'multi-input';
37
+ return fieldType;
38
+ }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getReleaseInfo = void 0;
7
7
  var _utils = require("@mui/utils");
8
8
  const getReleaseInfo = () => {
9
- const releaseInfo = "MTczOTc0NjgwMDAwMA==";
9
+ const releaseInfo = "MTc0MTMwMjAwMDAwMA==";
10
10
  if (process.env.NODE_ENV !== 'production') {
11
11
  // A simple hack to set the value in the test environment (has no build step).
12
12
  // eslint-disable-next-line no-useless-concat
@@ -59,16 +59,8 @@ const getRangeFieldValueManager = ({
59
59
  }
60
60
  return [prevReferenceValue[1], value[1]];
61
61
  },
62
- getSectionsFromValue: (utils, [start, end], fallbackSections, getSectionsFromDate) => {
63
- const separatedFallbackSections = fallbackSections == null ? {
64
- startDate: null,
65
- endDate: null
66
- } : (0, _dateFieldsUtils.splitDateRangeSections)(fallbackSections);
67
- const getSections = (newDate, fallbackDateSections, position) => {
68
- const shouldReUsePrevDateSections = !utils.isValid(newDate) && !!fallbackDateSections;
69
- if (shouldReUsePrevDateSections) {
70
- return fallbackDateSections;
71
- }
62
+ getSectionsFromValue: ([start, end], getSectionsFromDate) => {
63
+ const getSections = (newDate, position) => {
72
64
  const sections = getSectionsFromDate(newDate);
73
65
  return sections.map((section, sectionIndex) => {
74
66
  if (sectionIndex === sections.length - 1 && position === 'start') {
@@ -83,7 +75,7 @@ const getRangeFieldValueManager = ({
83
75
  });
84
76
  });
85
77
  };
86
- return [...getSections(start, separatedFallbackSections.startDate, 'start'), ...getSections(end, separatedFallbackSections.endDate, 'end')];
78
+ return [...getSections(start, 'start'), ...getSections(end, 'end')];
87
79
  },
88
80
  getV7HiddenInputValueFromSections: sections => {
89
81
  const dateRangeSections = (0, _dateFieldsUtils.splitDateRangeSections)(sections);
@@ -103,24 +95,33 @@ const getRangeFieldValueManager = ({
103
95
  return parseDate(dateStr.trim(), referenceValue[index]);
104
96
  });
105
97
  },
106
- getActiveDateManager: (utils, state, activeSection) => {
107
- const index = activeSection.dateName === 'start' ? 0 : 1;
108
- const updateDateInRange = (newDate, prevDateRange) => index === 0 ? [newDate, prevDateRange[1]] : [prevDateRange[0], newDate];
109
- return {
110
- date: state.value[index],
111
- referenceDate: state.referenceValue[index],
112
- getSections: sections => {
113
- const dateRangeSections = (0, _dateFieldsUtils.splitDateRangeSections)(sections);
114
- if (index === 0) {
115
- return (0, _dateFieldsUtils.removeLastSeparator)(dateRangeSections.startDate);
116
- }
117
- return dateRangeSections.endDate;
118
- },
119
- getNewValuesFromNewActiveDate: newActiveDate => ({
120
- value: updateDateInRange(newActiveDate, state.value),
121
- referenceValue: !utils.isValid(newActiveDate) ? state.referenceValue : updateDateInRange(newActiveDate, state.referenceValue)
122
- })
123
- };
98
+ getDateFromSection: (value, activeSection) => value[getActiveDateIndex(activeSection)],
99
+ getDateSectionsFromValue: (sections, activeSection) => {
100
+ const dateRangeSections = (0, _dateFieldsUtils.splitDateRangeSections)(sections);
101
+ if (getActiveDateIndex(activeSection) === 0) {
102
+ return (0, _dateFieldsUtils.removeLastSeparator)(dateRangeSections.startDate);
103
+ }
104
+ return dateRangeSections.endDate;
105
+ },
106
+ updateDateInValue: (value, activeSection, activeDate) => {
107
+ if (getActiveDateIndex(activeSection) === 0) {
108
+ return [activeDate, value[1]];
109
+ }
110
+ return [value[0], activeDate];
111
+ },
112
+ clearDateSections: (sections, activeSection) => {
113
+ const dateRangeSections = (0, _dateFieldsUtils.splitDateRangeSections)(sections);
114
+ if (getActiveDateIndex(activeSection) === 0) {
115
+ return [...dateRangeSections.startDate.map(section => (0, _extends2.default)({}, section, {
116
+ value: ''
117
+ })), ...dateRangeSections.endDate];
118
+ }
119
+ return [...dateRangeSections.startDate, ...dateRangeSections.endDate.map(section => (0, _extends2.default)({}, section, {
120
+ value: ''
121
+ }))];
124
122
  }
125
123
  });
126
- exports.getRangeFieldValueManager = getRangeFieldValueManager;
124
+ exports.getRangeFieldValueManager = getRangeFieldValueManager;
125
+ function getActiveDateIndex(activeSection) {
126
+ return activeSection == null || activeSection.dateName === 'start' ? 0 : 1;
127
+ }
@@ -7,7 +7,5 @@ export declare function useDateRangeManager<TEnableAccessibleFieldDOMStructure e
7
7
  export interface UseDateRangeManagerParameters<TEnableAccessibleFieldDOMStructure extends boolean> extends RangeFieldSeparatorProps {
8
8
  enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
9
9
  }
10
- export type UseDateRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError, DateRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>, DateRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure>>;
11
- export interface DateRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, 'format'>, RangeFieldSeparatorProps, ExportedValidateDateRangeProps {}
12
- interface DateRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure extends boolean> extends UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, ValidateDateRangeProps, RangeFieldSeparatorProps {}
13
- export {};
10
+ export type UseDateRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError, ValidateDateRangeProps, DateRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>>;
11
+ export interface DateRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, 'format'>, RangeFieldSeparatorProps, ExportedValidateDateRangeProps {}
@@ -35,6 +35,13 @@ function useDateRangeManager(parameters = {}) {
35
35
  internalProps
36
36
  })),
37
37
  // TODO v8: Add a real aria label before moving the opening logic to the field on range pickers.
38
- internal_getOpenPickerButtonAriaLabel: () => ''
38
+ internal_getOpenPickerButtonAriaLabel: ({
39
+ value,
40
+ utils,
41
+ localeText
42
+ }) => {
43
+ const formattedValue = utils.isValid(value[0]) ? utils.format(value[0], 'fullDate') : null;
44
+ return localeText.openDatePickerDialogue(formattedValue);
45
+ }
39
46
  }), [enableAccessibleFieldDOMStructure, dateSeparator]);
40
47
  }
@@ -7,7 +7,5 @@ export declare function useDateTimeRangeManager<TEnableAccessibleFieldDOMStructu
7
7
  export interface UseDateTimeRangeManagerParameters<TEnableAccessibleFieldDOMStructure extends boolean> extends RangeFieldSeparatorProps {
8
8
  enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
9
9
  }
10
- export type UseDateTimeRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError, DateTimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>, DateTimeRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure>>;
11
- export interface DateTimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, 'format'>, ExportedValidateDateTimeRangeProps, AmPmProps, RangeFieldSeparatorProps {}
12
- interface DateTimeRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure extends boolean> extends UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, ValidateDateTimeRangeProps, RangeFieldSeparatorProps {}
13
- export {};
10
+ export type UseDateTimeRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError, ValidateDateTimeRangeProps, DateTimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>>;
11
+ export interface DateTimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, 'format'>, ExportedValidateDateTimeRangeProps, AmPmProps, RangeFieldSeparatorProps {}
@@ -35,6 +35,13 @@ function useDateTimeRangeManager(parameters = {}) {
35
35
  defaultDates
36
36
  })),
37
37
  // TODO v8: Add a real aria label before moving the opening logic to the field on range pickers.
38
- internal_getOpenPickerButtonAriaLabel: () => ''
38
+ internal_getOpenPickerButtonAriaLabel: ({
39
+ value,
40
+ utils,
41
+ localeText
42
+ }) => {
43
+ const formattedValue = utils.isValid(value[0]) ? utils.format(value[0], 'fullDate') : null;
44
+ return localeText.openDatePickerDialogue(formattedValue);
45
+ }
39
46
  }), [enableAccessibleFieldDOMStructure, dateSeparator]);
40
47
  }
@@ -7,7 +7,5 @@ export declare function useTimeRangeManager<TEnableAccessibleFieldDOMStructure e
7
7
  export interface UseTimeRangeManagerParameters<TEnableAccessibleFieldDOMStructure extends boolean> extends RangeFieldSeparatorProps {
8
8
  enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
9
9
  }
10
- export type UseTimeRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError, TimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>, TimeRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure>>;
11
- export interface TimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'format'>, ExportedValidateTimeRangeProps, AmPmProps, RangeFieldSeparatorProps {}
12
- interface TimeRangeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure extends boolean> extends UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, ValidateTimeRangeProps {}
13
- export {};
10
+ export type UseTimeRangeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError, ValidateTimeRangeProps, TimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>>;
11
+ export interface TimeRangeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerRangeValue, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'format'>, ExportedValidateTimeRangeProps, AmPmProps, RangeFieldSeparatorProps {}
@@ -33,6 +33,15 @@ function useTimeRangeManager(parameters = {}) {
33
33
  internalProps
34
34
  })),
35
35
  // TODO v8: Add a real aria label before moving the opening logic to the field on range pickers.
36
- internal_getOpenPickerButtonAriaLabel: () => ''
36
+ internal_getOpenPickerButtonAriaLabel: ({
37
+ value,
38
+ utils,
39
+ localeText
40
+ }) => {
41
+ // TODO: Use ampm prop?
42
+ const ampm = utils.is12HourCycleInCurrentLocale();
43
+ const formattedValue = utils.isValid(value[0]) ? utils.format(value[0], ampm ? 'fullTime12h' : 'fullTime24h') : null;
44
+ return localeText.openTimePickerDialogue(formattedValue);
45
+ }
37
46
  }), [enableAccessibleFieldDOMStructure, dateSeparator]);
38
47
  }