@mui/x-date-pickers-pro 6.0.0-beta.4 → 6.0.0-beta.5

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 (71) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/DateRangePicker/DateRangePicker.js +1 -1
  3. package/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  4. package/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  5. package/MultiInputDateRangeField/MultiInputDateRangeField.js +1 -1
  6. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +1 -1
  7. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +1 -1
  8. package/SingleInputDateRangeField/SingleInputDateRangeField.js +1 -1
  9. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +5 -4
  10. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +5 -4
  11. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
  12. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +5 -4
  13. package/index.d.ts +2 -0
  14. package/index.js +1 -1
  15. package/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +22 -22
  16. package/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +22 -22
  17. package/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +22 -22
  18. package/internal/models/fields.d.ts +0 -2
  19. package/internal/utils/date-fields-utils.d.ts +7 -7
  20. package/internal/utils/releaseInfo.js +1 -1
  21. package/legacy/DateRangePicker/DateRangePicker.js +1 -1
  22. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  23. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  24. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +1 -1
  25. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +1 -1
  26. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +1 -1
  27. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +1 -1
  28. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
  29. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
  30. package/legacy/index.js +1 -1
  31. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +26 -22
  32. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +26 -22
  33. package/legacy/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +26 -22
  34. package/legacy/internal/utils/releaseInfo.js +1 -1
  35. package/legacy/tests/describeRangeValidation/describeRangeValidation.js +2 -1
  36. package/legacy/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +291 -0
  37. package/modern/DateRangePicker/DateRangePicker.js +1 -1
  38. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  39. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  40. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +1 -1
  41. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +1 -1
  42. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +1 -1
  43. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +1 -1
  44. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -3
  45. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +3 -3
  46. package/modern/index.js +1 -1
  47. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +21 -20
  48. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +21 -20
  49. package/modern/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +21 -20
  50. package/modern/internal/utils/releaseInfo.js +1 -1
  51. package/modern/tests/describeRangeValidation/describeRangeValidation.js +2 -1
  52. package/modern/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +285 -0
  53. package/node/DateRangePicker/DateRangePicker.js +1 -1
  54. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -1
  55. package/node/MobileDateRangePicker/MobileDateRangePicker.js +1 -1
  56. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +1 -1
  57. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +1 -1
  58. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +1 -1
  59. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +1 -1
  60. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -3
  61. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +3 -3
  62. package/node/index.js +1 -1
  63. package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +21 -20
  64. package/node/internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +21 -20
  65. package/node/internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +21 -20
  66. package/node/internal/utils/releaseInfo.js +1 -1
  67. package/node/tests/describeRangeValidation/describeRangeValidation.js +2 -1
  68. package/node/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +294 -0
  69. package/package.json +2 -2
  70. package/tests/describeRangeValidation/describeRangeValidation.js +2 -1
  71. package/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +285 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,60 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.0.0-beta.5
7
+
8
+ _Feb 23, 2023_
9
+
10
+ We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - ⚡️ Add web worker support for Excel export (#7770) @m4theushw
13
+ - 🎁 Add a button to remove all filters on the data grid filter panel (#7326) @MBilalShafi
14
+ - ⚙️ Allow to customize options label and value in the data grid `singleSelect` column (#7684) @m4theushw
15
+ - 📚 Documentation improvements
16
+ - 🐞 Bugfixes
17
+
18
+ ### `@mui/x-data-grid@v6.0.0-beta.5` / `@mui/x-data-grid-pro@v6.0.0-beta.5` / `@mui/x-data-grid-premium@v6.0.0-beta.5`
19
+
20
+ #### Changes
21
+
22
+ - [DataGrid] Allow to customize label and value for `singleSelect` (#7684) @m4theushw
23
+ - [DataGrid] Fix `ownerState` being `undefined` in theme style overrides (#7964) @lolaignatova
24
+ - [DataGrid] Introduce `slots` and deprecate `components` (#7882) @MBilalShafi
25
+ - [DataGridPro] Add `Remove All` option in filter panel (#7326) @MBilalShafi
26
+ - [DataGridPremium] Add web worker support for Excel export (#7770) @m4theushw
27
+
28
+ ### `@mui/x-date-pickers@v6.0.0-beta.5` / `@mui/x-date-pickers-pro@v6.0.0-beta.5`
29
+
30
+ #### Breaking changes
31
+
32
+ - The `MuiDateSectionName` type was renamed to `FieldSectionType`
33
+
34
+ #### Changes
35
+
36
+ - [fields] Fix multi input range fields validation when uncontrolled (#8002) @LukasTy
37
+ - [fields] Fix single input time range fields slot props (#7988) @LukasTy
38
+ - [fields] Make the `ArrowUp` / `ArrowDown` edition only impact the active section (#7993) @flaviendelangle
39
+ - [fields] Fix single input range fields clearing (#7995) @flaviendelangle
40
+ - [fields] Clean the section object (#8009) @flaviendelangle
41
+ - [pickers] Fix `textField` slot `error` prop propagation (#7987) @LukasTy
42
+
43
+ ### `@mui/x-codemod@v6.0.0-beta.5`
44
+
45
+ #### Changes
46
+
47
+ - [codemod] Add `apiRef.current.getRowIndex` to `DataGrid` renaming codemod (#8001) @MBilalShafi
48
+
49
+ ### Docs
50
+
51
+ - [docs] Fine tune range fields demos (#7992) @LukasTy
52
+ - [docs] Fix a few scroll issues on mobile (#7900) @oliviertassinari
53
+ - [docs] Fix inconsistency in the data grid migration guide (#7963) @MBilalShafi
54
+
55
+ ### Core
56
+
57
+ - [core] Fix `moment` locale on adapter tests (#8020) @flaviendelangle
58
+ - [test] Support all adapters on the field tests about the formats (#7996) @flaviendelangle
59
+
6
60
  ## 6.0.0-beta.4
7
61
 
8
62
  _Feb 16, 2023_
@@ -2179,6 +2233,26 @@ You can find more information about the new api, including how to set those tran
2179
2233
  - [test] Skip tests for column pinning and dynamic row height (#5997) @m4theushw
2180
2234
  - [website] Improve security header @oliviertassinari
2181
2235
 
2236
+ ## 5.17.25
2237
+
2238
+ _Feb 23, 2023_
2239
+
2240
+ We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
2241
+
2242
+ - 🐞 Bugfixes
2243
+
2244
+ ### `@mui/x-data-grid@v5.17.25` / `@mui/x-data-grid-pro@v5.17.25` / `@mui/x-data-grid-premium@v5.17.25`
2245
+
2246
+ #### Changes
2247
+
2248
+ - [DataGrid] Fix `ownerState` being `undefined` in theme style overrides (#7757) @lolaignatova
2249
+
2250
+ ### `@mui/x-date-pickers@v5.0.20` / `@mui/x-date-pickers-pro@v5.0.20`
2251
+
2252
+ #### Changes
2253
+
2254
+ - [DateTimePicker] Ensure toolbar `viewType` is correctly updated (#7942) @LukasTy
2255
+
2182
2256
  ## 5.17.24
2183
2257
 
2184
2258
  _Feb 16, 2023_
@@ -243,7 +243,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
243
243
  * This prop accept four formats:
244
244
  * 1. If a number is provided, the section at this index will be selected.
245
245
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
246
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
246
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
247
247
  * 4. If `null` is provided, no section will be selected
248
248
  * If not provided, the selected sections will be handled internally.
249
249
  */
@@ -251,7 +251,7 @@ DesktopDateRangePicker.propTypes = {
251
251
  * This prop accept four formats:
252
252
  * 1. If a number is provided, the section at this index will be selected.
253
253
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
254
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
254
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
255
255
  * 4. If `null` is provided, no section will be selected
256
256
  * If not provided, the selected sections will be handled internally.
257
257
  */
@@ -254,7 +254,7 @@ MobileDateRangePicker.propTypes = {
254
254
  * This prop accept four formats:
255
255
  * 1. If a number is provided, the section at this index will be selected.
256
256
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
257
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
257
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
258
258
  * 4. If `null` is provided, no section will be selected
259
259
  * If not provided, the selected sections will be handled internally.
260
260
  */
@@ -251,7 +251,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
251
251
  * This prop accept four formats:
252
252
  * 1. If a number is provided, the section at this index will be selected.
253
253
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
254
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
254
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
255
255
  * 4. If `null` is provided, no section will be selected
256
256
  * If not provided, the selected sections will be handled internally.
257
257
  */
@@ -293,7 +293,7 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
293
293
  * This prop accept four formats:
294
294
  * 1. If a number is provided, the section at this index will be selected.
295
295
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
296
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
296
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
297
297
  * 4. If `null` is provided, no section will be selected
298
298
  * If not provided, the selected sections will be handled internally.
299
299
  */
@@ -267,7 +267,7 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
267
267
  * This prop accept four formats:
268
268
  * 1. If a number is provided, the section at this index will be selected.
269
269
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
270
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
270
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
271
271
  * 4. If `null` is provided, no section will be selected
272
272
  * If not provided, the selected sections will be handled internally.
273
273
  */
@@ -216,7 +216,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
216
216
  * This prop accept four formats:
217
217
  * 1. If a number is provided, the section at this index will be selected.
218
218
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
219
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
219
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
220
220
  * 4. If `null` is provided, no section will be selected
221
221
  * If not provided, the selected sections will be handled internally.
222
222
  */
@@ -10,22 +10,23 @@ import { useSlotProps } from '@mui/base/utils';
10
10
  import { useSingleInputDateTimeRangeField } from './useSingleInputDateTimeRangeField';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const SingleInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleInputDateTimeRangeField(inProps, ref) {
13
- var _ref, _slots$input;
13
+ var _ref, _slots$textField, _slotProps$textField;
14
14
  const themeProps = useThemeProps({
15
15
  props: inProps,
16
16
  name: 'MuiSingleInputDateTimeRangeField'
17
17
  });
18
18
  const {
19
19
  slots,
20
+ slotProps,
20
21
  components,
21
22
  componentsProps
22
23
  } = themeProps,
23
24
  other = _objectWithoutPropertiesLoose(themeProps, _excluded);
24
25
  const ownerState = themeProps;
25
- const Input = (_ref = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components == null ? void 0 : components.Input) != null ? _ref : TextField;
26
+ const Input = (_ref = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : components == null ? void 0 : components.TextField) != null ? _ref : TextField;
26
27
  const inputProps = useSlotProps({
27
28
  elementType: Input,
28
- externalSlotProps: componentsProps == null ? void 0 : componentsProps.input,
29
+ externalSlotProps: (_slotProps$textField = slotProps == null ? void 0 : slotProps.textField) != null ? _slotProps$textField : componentsProps == null ? void 0 : componentsProps.textField,
29
30
  externalForwardedProps: other,
30
31
  ownerState
31
32
  });
@@ -248,7 +249,7 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
248
249
  * This prop accept four formats:
249
250
  * 1. If a number is provided, the section at this index will be selected.
250
251
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
251
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
252
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
252
253
  * 4. If `null` is provided, no section will be selected
253
254
  * If not provided, the selected sections will be handled internally.
254
255
  */
@@ -39,11 +39,12 @@ export interface SingleInputDateTimeRangeFieldProps<TDate> extends UseSingleInpu
39
39
  export type SingleInputDateTimeRangeFieldOwnerState<TDate> = SingleInputDateTimeRangeFieldProps<TDate>;
40
40
  export interface SingleInputDateTimeRangeFieldSlotsComponent {
41
41
  /**
42
- * Input rendered.
43
- * @default TextField
42
+ * Form control with an input to render the value.
43
+ * Receives the same props as `@mui/material/TextField`.
44
+ * @default TextField from '@mui/material'
44
45
  */
45
- Input?: React.ElementType;
46
+ TextField?: React.ElementType;
46
47
  }
47
48
  export interface SingleInputDateTimeRangeFieldSlotsComponentsProps<TDate> {
48
- input?: SlotComponentProps<typeof TextField, {}, SingleInputDateTimeRangeFieldOwnerState<TDate>>;
49
+ textField?: SlotComponentProps<typeof TextField, {}, SingleInputDateTimeRangeFieldOwnerState<TDate>>;
49
50
  }
@@ -10,7 +10,7 @@ import { useSlotProps } from '@mui/base/utils';
10
10
  import { useSingleInputTimeRangeField } from './useSingleInputTimeRangeField';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  const SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleInputTimeRangeField(inProps, ref) {
13
- var _ref, _slots$input, _slotProps$input;
13
+ var _ref, _slots$textField, _slotProps$textField;
14
14
  const themeProps = useThemeProps({
15
15
  props: inProps,
16
16
  name: 'MuiSingleInputTimeRangeField'
@@ -23,10 +23,10 @@ const SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleI
23
23
  } = themeProps,
24
24
  other = _objectWithoutPropertiesLoose(themeProps, _excluded);
25
25
  const ownerState = themeProps;
26
- const Input = (_ref = (_slots$input = slots == null ? void 0 : slots.input) != null ? _slots$input : components == null ? void 0 : components.Input) != null ? _ref : TextField;
26
+ const Input = (_ref = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : components == null ? void 0 : components.TextField) != null ? _ref : TextField;
27
27
  const inputProps = useSlotProps({
28
28
  elementType: Input,
29
- externalSlotProps: (_slotProps$input = slotProps == null ? void 0 : slotProps.input) != null ? _slotProps$input : componentsProps == null ? void 0 : componentsProps.input,
29
+ externalSlotProps: (_slotProps$textField = slotProps == null ? void 0 : slotProps.textField) != null ? _slotProps$textField : componentsProps == null ? void 0 : componentsProps.textField,
30
30
  externalForwardedProps: other,
31
31
  ownerState
32
32
  });
@@ -233,7 +233,7 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
233
233
  * This prop accept four formats:
234
234
  * 1. If a number is provided, the section at this index will be selected.
235
235
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
236
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
236
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
237
237
  * 4. If `null` is provided, no section will be selected
238
238
  * If not provided, the selected sections will be handled internally.
239
239
  */
@@ -39,11 +39,12 @@ export interface SingleInputTimeRangeFieldProps<TDate> extends UseSingleInputTim
39
39
  export type SingleInputTimeRangeFieldOwnerState<TDate> = SingleInputTimeRangeFieldProps<TDate>;
40
40
  export interface SingleInputTimeRangeFieldSlotsComponent {
41
41
  /**
42
- * Input rendered.
43
- * @default TextField
42
+ * Form control with an input to render the value.
43
+ * Receives the same props as `@mui/material/TextField`.
44
+ * @default TextField from '@mui/material'
44
45
  */
45
- Input?: React.ElementType;
46
+ TextField?: React.ElementType;
46
47
  }
47
48
  export interface SingleInputTimeRangeFieldSlotsComponentsProps<TDate> {
48
- input?: SlotComponentProps<typeof TextField, {}, SingleInputTimeRangeFieldOwnerState<TDate>>;
49
+ textField?: SlotComponentProps<typeof TextField, {}, SingleInputTimeRangeFieldOwnerState<TDate>>;
49
50
  }
package/index.d.ts CHANGED
@@ -15,5 +15,7 @@ export * from './MobileDateRangePicker';
15
15
  export * from './StaticDateRangePicker';
16
16
  export * from './dateRangeViewRenderers';
17
17
  export type { DateRangeValidationError } from './internal/hooks/validation/useDateRangeValidation';
18
+ export type { DateTimeRangeValidationError } from './internal/hooks/validation/useDateTimeRangeValidation';
19
+ export type { TimeRangeValidationError } from './internal/hooks/validation/useTimeRangeValidation';
18
20
  export type { DateRange } from './internal/models/range';
19
21
  export type { UseDateRangeFieldProps } from './internal/models/dateRange';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v6.0.0-beta.4
2
+ * @mui/x-date-pickers-pro v6.0.0-beta.5
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import useEventCallback from '@mui/utils/useEventCallback';
4
4
  import { unstable_useDateField as useDateField } from '@mui/x-date-pickers/DateField';
5
5
  import { useLocalizationContext, useValidation } from '@mui/x-date-pickers/internals';
6
+ import useControlled from '@mui/utils/useControlled';
6
7
  import { useDefaultizedDateRangeFieldProps } from '../../../SingleInputDateRangeField/useSingleInputDateRangeField';
7
8
  import { validateDateRange } from '../validation/useDateRangeValidation';
8
9
  import { rangeValueManager } from '../../utils/valueManagers';
@@ -13,7 +14,7 @@ export const useMultiInputDateRangeField = ({
13
14
  startInputRef,
14
15
  endInputRef
15
16
  }) => {
16
- var _ref2;
17
+ var _firstDefaultValue$cu;
17
18
  const sharedProps = useDefaultizedDateRangeFieldProps(inSharedProps);
18
19
  const adapter = useLocalizationContext();
19
20
  const {
@@ -25,16 +26,18 @@ export const useMultiInputDateRangeField = ({
25
26
  readOnly
26
27
  } = sharedProps;
27
28
  const firstDefaultValue = React.useRef(defaultValue);
29
+ const [value, setValue] = useControlled({
30
+ name: 'useMultiInputDateRangeField',
31
+ state: 'value',
32
+ controlled: valueProp,
33
+ default: (_firstDefaultValue$cu = firstDefaultValue.current) != null ? _firstDefaultValue$cu : rangeValueManager.emptyValue
34
+ });
28
35
 
29
36
  // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
30
37
  const buildChangeHandler = index => {
31
- if (!onChange) {
32
- return () => {};
33
- }
34
38
  return (newDate, rawContext) => {
35
- var _ref;
36
- const currentDateRange = (_ref = valueProp != null ? valueProp : firstDefaultValue.current) != null ? _ref : rangeValueManager.emptyValue;
37
- const newDateRange = index === 0 ? [newDate, currentDateRange[1]] : [currentDateRange[0], newDate];
39
+ const newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
40
+ setValue(newDateRange);
38
41
  const context = _extends({}, rawContext, {
39
42
  validationError: validateDateRange({
40
43
  adapter,
@@ -44,12 +47,17 @@ export const useMultiInputDateRangeField = ({
44
47
  })
45
48
  })
46
49
  });
47
- onChange(newDateRange, context);
50
+ onChange == null ? void 0 : onChange(newDateRange, context);
48
51
  };
49
52
  };
50
53
  const handleStartDateChange = useEventCallback(buildChangeHandler(0));
51
54
  const handleEndDateChange = useEventCallback(buildChangeHandler(1));
52
- const startInputProps = _extends({}, inStartTextFieldProps, {
55
+ const validationError = useValidation(_extends({}, sharedProps, {
56
+ value
57
+ }), validateDateRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
58
+ const startInputProps = _extends({
59
+ error: !!validationError[0]
60
+ }, inStartTextFieldProps, {
53
61
  disabled,
54
62
  readOnly,
55
63
  format,
@@ -57,7 +65,9 @@ export const useMultiInputDateRangeField = ({
57
65
  defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
58
66
  onChange: handleStartDateChange
59
67
  });
60
- const endInputProps = _extends({}, inEndTextFieldProps, {
68
+ const endInputProps = _extends({
69
+ error: !!validationError[1]
70
+ }, inEndTextFieldProps, {
61
71
  format,
62
72
  disabled,
63
73
  readOnly,
@@ -65,24 +75,14 @@ export const useMultiInputDateRangeField = ({
65
75
  defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
66
76
  onChange: handleEndDateChange
67
77
  });
68
- const rawStartDateResponse = useDateField({
78
+ const startDateResponse = useDateField({
69
79
  props: startInputProps,
70
80
  inputRef: startInputRef
71
81
  });
72
- const rawEndDateResponse = useDateField({
82
+ const endDateResponse = useDateField({
73
83
  props: endInputProps,
74
84
  inputRef: endInputRef
75
85
  });
76
- const value = (_ref2 = valueProp != null ? valueProp : firstDefaultValue.current) != null ? _ref2 : rangeValueManager.emptyValue;
77
- const validationError = useValidation(_extends({}, sharedProps, {
78
- value
79
- }), validateDateRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
80
- const startDateResponse = _extends({}, rawStartDateResponse, {
81
- error: !!validationError[0]
82
- });
83
- const endDateResponse = _extends({}, rawEndDateResponse, {
84
- error: !!validationError[1]
85
- });
86
86
  return {
87
87
  startDate: startDateResponse,
88
88
  endDate: endDateResponse
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import useEventCallback from '@mui/utils/useEventCallback';
4
4
  import { unstable_useDateTimeField as useDateTimeField } from '@mui/x-date-pickers/DateTimeField';
5
5
  import { applyDefaultDate, useDefaultDates, useLocalizationContext, useUtils, useValidation } from '@mui/x-date-pickers/internals';
6
+ import useControlled from '@mui/utils/useControlled';
6
7
  import { validateDateTimeRange } from '../validation/useDateTimeRangeValidation';
7
8
  import { rangeValueManager } from '../../utils/valueManagers';
8
9
  export const useDefaultizedDateTimeRangeFieldProps = props => {
@@ -29,7 +30,7 @@ export const useMultiInputDateTimeRangeField = ({
29
30
  startInputRef,
30
31
  endInputRef
31
32
  }) => {
32
- var _ref2;
33
+ var _firstDefaultValue$cu;
33
34
  const sharedProps = useDefaultizedDateTimeRangeFieldProps(inSharedProps);
34
35
  const adapter = useLocalizationContext();
35
36
  const {
@@ -41,16 +42,18 @@ export const useMultiInputDateTimeRangeField = ({
41
42
  readOnly
42
43
  } = sharedProps;
43
44
  const firstDefaultValue = React.useRef(defaultValue);
45
+ const [value, setValue] = useControlled({
46
+ name: 'useMultiInputDateTimeRangeField',
47
+ state: 'value',
48
+ controlled: valueProp,
49
+ default: (_firstDefaultValue$cu = firstDefaultValue.current) != null ? _firstDefaultValue$cu : rangeValueManager.emptyValue
50
+ });
44
51
 
45
52
  // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
46
53
  const buildChangeHandler = index => {
47
- if (!onChange) {
48
- return () => {};
49
- }
50
54
  return (newDate, rawContext) => {
51
- var _ref;
52
- const currentDateRange = (_ref = valueProp != null ? valueProp : firstDefaultValue.current) != null ? _ref : rangeValueManager.emptyValue;
53
- const newDateRange = index === 0 ? [newDate, currentDateRange[1]] : [currentDateRange[0], newDate];
55
+ const newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
56
+ setValue(newDateRange);
54
57
  const context = _extends({}, rawContext, {
55
58
  validationError: validateDateTimeRange({
56
59
  adapter,
@@ -60,12 +63,17 @@ export const useMultiInputDateTimeRangeField = ({
60
63
  })
61
64
  })
62
65
  });
63
- onChange(newDateRange, context);
66
+ onChange == null ? void 0 : onChange(newDateRange, context);
64
67
  };
65
68
  };
66
69
  const handleStartDateChange = useEventCallback(buildChangeHandler(0));
67
70
  const handleEndDateChange = useEventCallback(buildChangeHandler(1));
68
- const startInputProps = _extends({}, inStartTextFieldProps, {
71
+ const validationError = useValidation(_extends({}, sharedProps, {
72
+ value
73
+ }), validateDateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
74
+ const startInputProps = _extends({
75
+ error: !!validationError[0]
76
+ }, inStartTextFieldProps, {
69
77
  format,
70
78
  disabled,
71
79
  readOnly,
@@ -73,7 +81,9 @@ export const useMultiInputDateTimeRangeField = ({
73
81
  defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
74
82
  onChange: handleStartDateChange
75
83
  });
76
- const endInputProps = _extends({}, inEndTextFieldProps, {
84
+ const endInputProps = _extends({
85
+ error: !!validationError[1]
86
+ }, inEndTextFieldProps, {
77
87
  format,
78
88
  disabled,
79
89
  readOnly,
@@ -81,24 +91,14 @@ export const useMultiInputDateTimeRangeField = ({
81
91
  defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
82
92
  onChange: handleEndDateChange
83
93
  });
84
- const rawStartDateResponse = useDateTimeField({
94
+ const startDateResponse = useDateTimeField({
85
95
  props: startInputProps,
86
96
  inputRef: startInputRef
87
97
  });
88
- const rawEndDateResponse = useDateTimeField({
98
+ const endDateResponse = useDateTimeField({
89
99
  props: endInputProps,
90
100
  inputRef: endInputRef
91
101
  });
92
- const value = (_ref2 = valueProp != null ? valueProp : firstDefaultValue.current) != null ? _ref2 : rangeValueManager.emptyValue;
93
- const validationError = useValidation(_extends({}, sharedProps, {
94
- value
95
- }), validateDateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
96
- const startDateResponse = _extends({}, rawStartDateResponse, {
97
- error: !!validationError[0]
98
- });
99
- const endDateResponse = _extends({}, rawEndDateResponse, {
100
- error: !!validationError[1]
101
- });
102
102
  return {
103
103
  startDate: startDateResponse,
104
104
  endDate: endDateResponse
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import useEventCallback from '@mui/utils/useEventCallback';
4
4
  import { unstable_useTimeField as useTimeField } from '@mui/x-date-pickers/TimeField';
5
5
  import { useLocalizationContext, useUtils, useValidation } from '@mui/x-date-pickers/internals';
6
+ import useControlled from '@mui/utils/useControlled';
6
7
  import { validateTimeRange } from '../validation/useTimeRangeValidation';
7
8
  import { rangeValueManager } from '../../utils/valueManagers';
8
9
  export const useDefaultizedTimeRangeFieldProps = props => {
@@ -23,7 +24,7 @@ export const useMultiInputTimeRangeField = ({
23
24
  startInputRef,
24
25
  endInputRef
25
26
  }) => {
26
- var _ref2;
27
+ var _firstDefaultValue$cu;
27
28
  const sharedProps = useDefaultizedTimeRangeFieldProps(inSharedProps);
28
29
  const adapter = useLocalizationContext();
29
30
  const {
@@ -35,16 +36,18 @@ export const useMultiInputTimeRangeField = ({
35
36
  readOnly
36
37
  } = sharedProps;
37
38
  const firstDefaultValue = React.useRef(defaultValue);
39
+ const [value, setValue] = useControlled({
40
+ name: 'useMultiInputTimeRangeField',
41
+ state: 'value',
42
+ controlled: valueProp,
43
+ default: (_firstDefaultValue$cu = firstDefaultValue.current) != null ? _firstDefaultValue$cu : rangeValueManager.emptyValue
44
+ });
38
45
 
39
46
  // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
40
47
  const buildChangeHandler = index => {
41
- if (!onChange) {
42
- return () => {};
43
- }
44
48
  return (newDate, rawContext) => {
45
- var _ref;
46
- const currentDateRange = (_ref = valueProp != null ? valueProp : firstDefaultValue.current) != null ? _ref : rangeValueManager.emptyValue;
47
- const newDateRange = index === 0 ? [newDate, currentDateRange[1]] : [currentDateRange[0], newDate];
49
+ const newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
50
+ setValue(newDateRange);
48
51
  const context = _extends({}, rawContext, {
49
52
  validationError: validateTimeRange({
50
53
  adapter,
@@ -54,12 +57,17 @@ export const useMultiInputTimeRangeField = ({
54
57
  })
55
58
  })
56
59
  });
57
- onChange(newDateRange, context);
60
+ onChange == null ? void 0 : onChange(newDateRange, context);
58
61
  };
59
62
  };
60
63
  const handleStartDateChange = useEventCallback(buildChangeHandler(0));
61
64
  const handleEndDateChange = useEventCallback(buildChangeHandler(1));
62
- const startInputProps = _extends({}, inStartTextFieldProps, {
65
+ const validationError = useValidation(_extends({}, sharedProps, {
66
+ value
67
+ }), validateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
68
+ const startInputProps = _extends({
69
+ error: !!validationError[0]
70
+ }, inStartTextFieldProps, {
63
71
  format,
64
72
  disabled,
65
73
  readOnly,
@@ -67,7 +75,9 @@ export const useMultiInputTimeRangeField = ({
67
75
  defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
68
76
  onChange: handleStartDateChange
69
77
  });
70
- const endInputProps = _extends({}, inEndTextFieldProps, {
78
+ const endInputProps = _extends({
79
+ error: !!validationError[1]
80
+ }, inEndTextFieldProps, {
71
81
  format,
72
82
  disabled,
73
83
  readOnly,
@@ -75,24 +85,14 @@ export const useMultiInputTimeRangeField = ({
75
85
  defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
76
86
  onChange: handleEndDateChange
77
87
  });
78
- const rawStartDateResponse = useTimeField({
88
+ const startDateResponse = useTimeField({
79
89
  props: startInputProps,
80
90
  inputRef: startInputRef
81
91
  });
82
- const rawEndDateResponse = useTimeField({
92
+ const endDateResponse = useTimeField({
83
93
  props: endInputProps,
84
94
  inputRef: endInputRef
85
95
  });
86
- const value = (_ref2 = valueProp != null ? valueProp : firstDefaultValue.current) != null ? _ref2 : rangeValueManager.emptyValue;
87
- const validationError = useValidation(_extends({}, sharedProps, {
88
- value
89
- }), validateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
90
- const startDateResponse = _extends({}, rawStartDateResponse, {
91
- error: !!validationError[0]
92
- });
93
- const endDateResponse = _extends({}, rawEndDateResponse, {
94
- error: !!validationError[1]
95
- });
96
96
  return {
97
97
  startDate: startDateResponse,
98
98
  endDate: endDateResponse
@@ -4,8 +4,6 @@ import { BaseFieldProps, FieldSection } from '@mui/x-date-pickers/internals';
4
4
  export interface RangeFieldSection extends FieldSection {
5
5
  dateName: 'start' | 'end';
6
6
  }
7
- export interface RangeFieldSectionWithoutPosition extends Omit<RangeFieldSection, 'start' | 'end' | 'startInInput' | 'endInInput'> {
8
- }
9
7
  /**
10
8
  * Props the `textField` slot of the multi input field can receive when used inside a picker.
11
9
  */
@@ -6,17 +6,17 @@ export declare const splitDateRangeSections: (sections: RangeFieldSection[]) =>
6
6
  export declare const removeLastSeparator: (dateSections: RangeFieldSection[]) => (RangeFieldSection | {
7
7
  separator: null;
8
8
  dateName: "end" | "start";
9
+ value: string;
10
+ format: string;
11
+ placeholder: string;
12
+ type: import("@mui/x-date-pickers").FieldSectionType;
13
+ contentType: "letter" | "digit";
14
+ hasLeadingZeros: boolean;
15
+ modified: boolean;
9
16
  start: number;
10
17
  end: number;
11
18
  startInInput: number;
12
19
  endInInput: number;
13
- value: string;
14
- placeholder: string;
15
20
  startSeparator: string;
16
21
  endSeparator: string;
17
- dateSectionName: import("@mui/x-date-pickers").MuiDateSectionName;
18
- contentType: "letter" | "digit";
19
- formatValue: string;
20
- edited: boolean;
21
- hasTrailingZeroes: boolean;
22
22
  })[];
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY3NjQ5ODQwMDAwMA==";
3
+ const releaseInfo = "MTY3NzEwNjgwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -242,7 +242,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
242
242
  * This prop accept four formats:
243
243
  * 1. If a number is provided, the section at this index will be selected.
244
244
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
245
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
245
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
246
246
  * 4. If `null` is provided, no section will be selected
247
247
  * If not provided, the selected sections will be handled internally.
248
248
  */
@@ -250,7 +250,7 @@ DesktopDateRangePicker.propTypes = {
250
250
  * This prop accept four formats:
251
251
  * 1. If a number is provided, the section at this index will be selected.
252
252
  * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
253
- * 3. If a string of type `MuiDateSectionName` is provided, the first section with that name will be selected.
253
+ * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
254
254
  * 4. If `null` is provided, no section will be selected
255
255
  * If not provided, the selected sections will be handled internally.
256
256
  */