@mui/x-date-pickers 8.6.0 → 8.8.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.
- package/CHANGELOG.md +202 -1
- package/PickersTextField/PickersInputBase/PickersInputBase.js +1 -0
- package/esm/PickersTextField/PickersInputBase/PickersInputBase.js +2 -0
- package/esm/index.js +1 -1
- package/esm/internals/components/PickerFieldUI.js +2 -0
- package/esm/internals/components/PickerPopper/PickerPopper.js +2 -0
- package/esm/internals/components/PickerProvider.js +2 -0
- package/esm/internals/hooks/useClockReferenceDate.js +2 -2
- package/esm/internals/hooks/useControlledValue.d.ts +2 -2
- package/esm/internals/hooks/useControlledValue.js +1 -1
- package/esm/internals/hooks/useField/useField.types.d.ts +2 -2
- package/esm/internals/hooks/useField/useFieldState.js +2 -0
- package/esm/internals/hooks/useField/useFieldV6TextField.js +2 -0
- package/esm/internals/hooks/useField/useFieldV7TextField.js +2 -0
- package/esm/internals/hooks/useNullableFieldPrivateContext.js +2 -0
- package/esm/internals/hooks/usePicker/hooks/useOrientation.js +2 -0
- package/esm/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +2 -0
- package/esm/internals/hooks/usePicker/usePicker.js +2 -0
- package/esm/internals/hooks/usePicker/usePicker.types.d.ts +3 -3
- package/esm/internals/hooks/useViews.js +2 -0
- package/esm/internals/models/manager.d.ts +3 -3
- package/index.js +1 -1
- package/internals/components/PickerFieldUI.js +1 -0
- package/internals/components/PickerPopper/PickerPopper.js +1 -0
- package/internals/components/PickerProvider.js +1 -0
- package/internals/hooks/useClockReferenceDate.js +2 -2
- package/internals/hooks/useControlledValue.d.ts +2 -2
- package/internals/hooks/useControlledValue.js +1 -1
- package/internals/hooks/useField/useField.types.d.ts +2 -2
- package/internals/hooks/useField/useFieldState.js +1 -0
- package/internals/hooks/useField/useFieldV6TextField.js +1 -0
- package/internals/hooks/useField/useFieldV7TextField.js +1 -0
- package/internals/hooks/useNullableFieldPrivateContext.js +1 -0
- package/internals/hooks/usePicker/hooks/useOrientation.js +1 -0
- package/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +1 -0
- package/internals/hooks/usePicker/usePicker.js +1 -0
- package/internals/hooks/usePicker/usePicker.types.d.ts +3 -3
- package/internals/hooks/useViews.js +1 -0
- package/internals/models/manager.d.ts +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,207 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.8.0
|
|
9
|
+
|
|
10
|
+
_Jul 11, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 📊 Chart zoom preview can be enabled
|
|
15
|
+
|
|
16
|
+
<img width="758" alt="chart with x-axis preview" src="https://github.com/user-attachments/assets/50ce6f61-16dc-4e9b-a727-ca65d80927d7" />
|
|
17
|
+
|
|
18
|
+
- 🌎 Add Indonesian (id-ID) locale on the Data Grid
|
|
19
|
+
|
|
20
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
21
|
+
@kennarddh
|
|
22
|
+
|
|
23
|
+
The following are all team members who have contributed to this release:
|
|
24
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @JCQuintas, @KenanYusuf, @LukasTy, @MBilalShafi, @noraleonte, @prakhargupta1, @rita-codes, @siriwatknp
|
|
25
|
+
|
|
26
|
+
### Data Grid
|
|
27
|
+
|
|
28
|
+
#### `@mui/x-data-grid@8.8.0`
|
|
29
|
+
|
|
30
|
+
- [DataGrid] Fix `useGridSelector` missing subscription in `React.StrictMode` (#18676) @cherniavskii
|
|
31
|
+
- [DataGrid] Fix scrollbar filler `z-index` (#18688) @KenanYusuf
|
|
32
|
+
- [DataGrid] Set correct data source cache chunk size when pagination is disabled (#18636) @arminmeh
|
|
33
|
+
- [l10n] Add Indonesian (id-ID) locale (#18710) @kennarddh
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid-pro@8.8.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
36
|
+
|
|
37
|
+
Same changes as in `@mui/x-data-grid@8.8.0`, plus:
|
|
38
|
+
|
|
39
|
+
- [DataGridPro] Fix row ordering not auto-scrolling when moving beyond viewport (#18557) @MBilalShafi
|
|
40
|
+
- [DataGridPro] Set correct parent paths when tree is refreshed with data source tree data and row grouping (#18715) @arminmeh
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-data-grid-premium@8.8.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
43
|
+
|
|
44
|
+
Same changes as in `@mui/x-data-grid-pro@8.8.0`.
|
|
45
|
+
|
|
46
|
+
### Date and Time Pickers
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-date-pickers@8.8.0`
|
|
49
|
+
|
|
50
|
+
Internal changes.
|
|
51
|
+
|
|
52
|
+
#### `@mui/x-date-pickers-pro@8.8.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
53
|
+
|
|
54
|
+
Same changes as in `@mui/x-date-pickers@8.8.0`.
|
|
55
|
+
|
|
56
|
+
### Charts
|
|
57
|
+
|
|
58
|
+
#### `@mui/x-charts@8.8.0`
|
|
59
|
+
|
|
60
|
+
- [charts] Add control to the axis highlight (#17900) @alexfauquette
|
|
61
|
+
- [charts] Avoid processing area plot data if area isn't used in series (#18712) @bernardobelchior
|
|
62
|
+
- [charts] Make smarter default domain limit (#18506) @alexfauquette
|
|
63
|
+
|
|
64
|
+
#### `@mui/x-charts-pro@8.8.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
65
|
+
|
|
66
|
+
Same changes as in `@mui/x-charts@8.8.0`, plus:
|
|
67
|
+
|
|
68
|
+
- [charts-pro] Add `funnelDirection` to control pyramid direction (#18568) @JCQuintas
|
|
69
|
+
- [charts-pro] Add `onBeforeExport` callback (#18722) @bernardobelchior
|
|
70
|
+
- [charts-pro] Add chart zoom preview (#18267) @bernardobelchior
|
|
71
|
+
- [charts-pro] Allow customizing scatter preview marker size (#18726) @bernardobelchior
|
|
72
|
+
- [charts-pro] Allow disabling the copy of styles in charts export (#18753) @bernardobelchior
|
|
73
|
+
|
|
74
|
+
### Tree View
|
|
75
|
+
|
|
76
|
+
#### `@mui/x-tree-view@8.8.0`
|
|
77
|
+
|
|
78
|
+
- [tree view] Fix state update that caused scrolling bug when lazy loading and `checkboxSelection` are enabled (#18749) @rita-codes
|
|
79
|
+
|
|
80
|
+
#### `@mui/x-tree-view-pro@8.8.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
81
|
+
|
|
82
|
+
Same changes as in `@mui/x-tree-view@8.8.0`.
|
|
83
|
+
|
|
84
|
+
### Codemod
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-codemod@8.8.0`
|
|
87
|
+
|
|
88
|
+
Internal changes.
|
|
89
|
+
|
|
90
|
+
### Docs
|
|
91
|
+
|
|
92
|
+
- [docs] Add standalone Pyramid chart page to improve SEO (#18527) @prakhargupta1
|
|
93
|
+
- [docs] Add example to customise line interaction (#18539) @alexfauquette
|
|
94
|
+
- [docs] Fix `size` column filtering in files tree demo (#17952) @cherniavskii
|
|
95
|
+
- [docs] Generate `llms.txt` for X and their products (#18595) @siriwatknp
|
|
96
|
+
- [docs] Improve bar chart demos on mobile (#18721) @alexfauquette
|
|
97
|
+
- [docs] Refine charts overview page (#17447) @noraleonte
|
|
98
|
+
|
|
99
|
+
### Miscellaneous
|
|
100
|
+
|
|
101
|
+
- [code-infra] Ensure all `@mui/*` packages are picked by `Material UI` renovate group (#18711) @LukasTy
|
|
102
|
+
- [code-infra] Fix broken CI (#18716) @LukasTy
|
|
103
|
+
- [code-infra] Refactor `prettier` config resolving (#18720) @LukasTy
|
|
104
|
+
- [test] Increase data points in chart benchmarks (#18714) @bernardobelchior
|
|
105
|
+
|
|
106
|
+
## 8.7.0
|
|
107
|
+
|
|
108
|
+
_Jul 4, 2025_
|
|
109
|
+
|
|
110
|
+
We'd like to extend a big thank you to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
111
|
+
|
|
112
|
+
- 📊 Add `useChartProApiRef` for easier access to the API
|
|
113
|
+
- 📆 Support different start and end `referenceDate` props on range components
|
|
114
|
+
- 📚 Documentation improvements
|
|
115
|
+
- 🐞 Bugfixes
|
|
116
|
+
- 🌎 Improve Greek (el-GR) translations on the Charts
|
|
117
|
+
- 🌎 Improve Danish (da-DK) locale on the Data Grid
|
|
118
|
+
|
|
119
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
120
|
+
@ShahrazH, @vadimkuragkovskiy, @whythecode
|
|
121
|
+
|
|
122
|
+
The following are all team members who have contributed to this release:
|
|
123
|
+
@alexfauquette, @brijeshb42, @mapache-salvaje, @arminmeh, @bernardobelchior, @bharatkashyap, @Janpot, @JCQuintas, @KenanYusuf, @LukasTy, @michelengelen, @rita-codes
|
|
124
|
+
|
|
125
|
+
### Data Grid
|
|
126
|
+
|
|
127
|
+
#### `@mui/x-data-grid@8.7.0`
|
|
128
|
+
|
|
129
|
+
- [DataGrid] Fix column state restore with controlled column visibility model (#18567) @arminmeh
|
|
130
|
+
- [DataGrid] Fix styling virtualized column headers (#18603) @KenanYusuf
|
|
131
|
+
- [l10n] Improve Danish (da-DK) locale (#18537) @ShahrazH
|
|
132
|
+
|
|
133
|
+
#### `@mui/x-data-grid-pro@8.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
134
|
+
|
|
135
|
+
Same changes as in `@mui/x-data-grid@8.7.0`.
|
|
136
|
+
|
|
137
|
+
#### `@mui/x-data-grid-premium@8.7.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
138
|
+
|
|
139
|
+
Same changes as in `@mui/x-data-grid-pro@8.7.0`.
|
|
140
|
+
|
|
141
|
+
### Date and Time Pickers
|
|
142
|
+
|
|
143
|
+
#### `@mui/x-date-pickers@8.7.0`
|
|
144
|
+
|
|
145
|
+
- [pickers] Support different `start` and `end` `referenceDate` props on range components (#18549) @LukasTy
|
|
146
|
+
|
|
147
|
+
#### `@mui/x-date-pickers-pro@8.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
148
|
+
|
|
149
|
+
Same changes as in `@mui/x-date-pickers@8.7.0`.
|
|
150
|
+
|
|
151
|
+
### Charts
|
|
152
|
+
|
|
153
|
+
#### `@mui/x-charts@8.7.0`
|
|
154
|
+
|
|
155
|
+
- [charts] Export `ChartsReferenceLineProps` (#18598) @bernardobelchior
|
|
156
|
+
- [charts] Extract bar and line plot logic into reusable hooks (#18541) @bernardobelchior
|
|
157
|
+
- [charts] Extract plot logic into separate files for reuse (#18522) @bernardobelchior
|
|
158
|
+
- [charts] Profile charts benchmarks using chromium (#18528) @bernardobelchior
|
|
159
|
+
- [l10n] Add Greek (el-GR) locale to charts (#18548) @whythecode
|
|
160
|
+
|
|
161
|
+
#### `@mui/x-charts-pro@8.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
162
|
+
|
|
163
|
+
Same changes as in `@mui/x-charts@8.7.0`, plus:
|
|
164
|
+
|
|
165
|
+
- [charts-pro] Add `useChartProApiRef` for easier refs (#18013) @JCQuintas
|
|
166
|
+
- [charts-pro] Add tests and classes to zoom slider (#18660) @JCQuintas
|
|
167
|
+
- [charts-pro] Fix geometry not handling gestures in specific scenarios (#18651) @JCQuintas
|
|
168
|
+
- [charts-pro] Rename `useChartApiContext` to `useChartProApiContext` (#18565) @JCQuintas
|
|
169
|
+
- [charts-pro] Zoom pointer improvements (#17480) @JCQuintas
|
|
170
|
+
|
|
171
|
+
### Tree View
|
|
172
|
+
|
|
173
|
+
#### `@mui/x-tree-view@8.7.0`
|
|
174
|
+
|
|
175
|
+
Internal changes.
|
|
176
|
+
|
|
177
|
+
#### `@mui/x-tree-view-pro@8.7.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
178
|
+
|
|
179
|
+
Same changes as in `@mui/x-tree-view@8.7.0`, plus:
|
|
180
|
+
|
|
181
|
+
- [tree view pro] Add missing `dataSource` JSDoc (#18650) @LukasTy
|
|
182
|
+
|
|
183
|
+
### Docs
|
|
184
|
+
|
|
185
|
+
- [docs] Add MCP stub (#18204) @bharatkashyap
|
|
186
|
+
- [docs] Fix AI Assistant proxy rewrite prefix (#18661) @arminmeh
|
|
187
|
+
- [docs] Improve test README.MD (#18634) @LukasTy
|
|
188
|
+
- [docs] Provide workaround for pie chart composition (#18600) @alexfauquette
|
|
189
|
+
- [docs][charts] Add donut chart as a special case of a pie chart (#18652) @bernardobelchior
|
|
190
|
+
- [docs][charts] Centralize country and continent data (#18604) @bernardobelchior
|
|
191
|
+
- [docs][data grid] Audit and revise the Pro row docs (#17926) @mapache-salvaje
|
|
192
|
+
- [docs][pickers] Add mention of theme augmentation in relevant migration section (#18608) @LukasTy
|
|
193
|
+
|
|
194
|
+
### Core
|
|
195
|
+
|
|
196
|
+
- [core] Avoid stringifying `document` object (#18657) @vadimkuragkovskiy
|
|
197
|
+
|
|
198
|
+
### Miscellaneous
|
|
199
|
+
|
|
200
|
+
- [code-infra] Bump code-infra version and fix breaking changes (#18653) @brijeshb42
|
|
201
|
+
- [code-infra] Ensure `material-ui/disallow-react-api-in-server-components` ESLint rule is applied (#18570) @LukasTy
|
|
202
|
+
- [code-infra] Migrate to flat eslint config (#18562) @brijeshb42
|
|
203
|
+
- [code-infra] Refactor eslint config (#18643) @LukasTy
|
|
204
|
+
- [infra] Add renovatebot rule for latest infra packages (#18609) @Janpot
|
|
205
|
+
- [infra] Move pushArgos script to code-infra (#18667) @Janpot
|
|
206
|
+
- [infra] Updates release script to fetch latest major version from upstream (#18552) @michelengelen
|
|
207
|
+
- [release] Add missing contributor to changelog (#18561) @bernardobelchior
|
|
208
|
+
|
|
8
209
|
## 8.6.0
|
|
9
210
|
|
|
10
211
|
_Jun 27, 2025_
|
|
@@ -19,7 +220,7 @@ We'd like to extend a big thank you to the 12 contributors who made this release
|
|
|
19
220
|
- 🌎 Improve German (de-DE) locale
|
|
20
221
|
|
|
21
222
|
Special thanks go out to the community members for their valuable contributions:
|
|
22
|
-
@ShahrazH, @vadimka123
|
|
223
|
+
@omalyutin, @ShahrazH, @vadimka123
|
|
23
224
|
|
|
24
225
|
The following are all team members who have contributed to this release:
|
|
25
226
|
@arminmeh, @bernardobelchior, @JCQuintas, @KenanYusuf, @LukasTy, @MBilalShafi, @michelengelen, @noraleonte, @rita-codes, @sai6855
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef", "onFocus", "onBlur", "classes", "ownerState"];
|
package/esm/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["PaperComponent", "ownerState", "children", "paperSlotProps", "paperClasses", "onPaperClick", "onPaperTouchStart"];
|
|
@@ -18,8 +18,8 @@ export const useClockReferenceDate = ({
|
|
|
18
18
|
timezone,
|
|
19
19
|
getTodayDate: () => getTodayDate(adapter, timezone, 'date')
|
|
20
20
|
}),
|
|
21
|
-
// We
|
|
22
|
-
[] // eslint-disable-line react-hooks/exhaustive-deps
|
|
21
|
+
// We want the `referenceDate` to update on prop and `timezone` change (https://github.com/mui/mui-x/issues/10804)
|
|
22
|
+
[referenceDateProp, timezone] // eslint-disable-line react-hooks/exhaustive-deps
|
|
23
23
|
);
|
|
24
24
|
return value ?? referenceDate;
|
|
25
25
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PickerValueManager } from "../models/index.js";
|
|
1
|
+
import type { PickerRangeValue, PickerValueManager } from "../models/index.js";
|
|
2
2
|
import { PickersTimezone, PickerValidDate } from "../../models/index.js";
|
|
3
3
|
import { PickerValidValue } from "../models/index.js";
|
|
4
4
|
/**
|
|
@@ -28,7 +28,7 @@ interface UseValueWithTimezoneParameters<TValue extends PickerValidValue, TChang
|
|
|
28
28
|
* It does not need to have its default value.
|
|
29
29
|
* This is only used to determine the timezone to use when `props.value` and `props.defaultValue` are not defined.
|
|
30
30
|
*/
|
|
31
|
-
referenceDate
|
|
31
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
32
32
|
onChange: TChange | undefined;
|
|
33
33
|
valueManager: PickerValueManager<TValue, any>;
|
|
34
34
|
}
|
|
@@ -39,7 +39,7 @@ export const useControlledValue = ({
|
|
|
39
39
|
return inputTimezone;
|
|
40
40
|
}
|
|
41
41
|
if (referenceDate) {
|
|
42
|
-
return adapter.getTimezone(referenceDate);
|
|
42
|
+
return adapter.getTimezone(Array.isArray(referenceDate) ? referenceDate[0] : referenceDate);
|
|
43
43
|
}
|
|
44
44
|
return 'default';
|
|
45
45
|
}, [timezoneProp, inputTimezone, referenceDate, adapter]);
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapter, TimezoneProps, FieldSectionContentType, PickerValidDate, FieldRef, OnErrorProps, InferFieldSection, PickerManager, PickerValueType } from "../../../models/index.js";
|
|
3
3
|
import { InternalPropNames } from "../../../hooks/useSplitFieldProps.js";
|
|
4
4
|
import type { PickersSectionElement, PickersSectionListRef } from "../../../PickersSectionList/index.js";
|
|
5
|
-
import { FormProps, InferNonNullablePickerValue, PickerValidValue } from "../../models/index.js";
|
|
5
|
+
import { FormProps, InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "../../models/index.js";
|
|
6
6
|
export interface UseFieldParameters<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean, TError, TValidationProps extends {}, TProps extends UseFieldProps<TEnableAccessibleFieldDOMStructure>> {
|
|
7
7
|
manager: PickerManager<TValue, TEnableAccessibleFieldDOMStructure, TError, TValidationProps, any>;
|
|
8
8
|
props: TProps;
|
|
@@ -23,7 +23,7 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
|
|
|
23
23
|
* For example, on time fields it will be used to determine the date to set.
|
|
24
24
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
25
25
|
*/
|
|
26
|
-
referenceDate?: PickerValidDate;
|
|
26
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
27
27
|
/**
|
|
28
28
|
* Callback fired when the value changes.
|
|
29
29
|
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SxProps } from '@mui/system';
|
|
2
2
|
import { Theme } from '@mui/material/styles';
|
|
3
3
|
import { InferError, OnErrorProps, PickerChangeHandlerContext, PickerOwnerState, PickerValidDate, PickerValueType, TimezoneProps } from "../../../models/index.js";
|
|
4
|
-
import { DateOrTimeViewWithMeridiem, FormProps, PickerOrientation, PickerValidValue, PickerValueManager, PickerVariant } from "../../models/index.js";
|
|
4
|
+
import { DateOrTimeViewWithMeridiem, FormProps, PickerOrientation, PickerRangeValue, PickerValidValue, PickerValueManager, PickerVariant } from "../../models/index.js";
|
|
5
5
|
import { Validator } from "../../../validation/index.js";
|
|
6
6
|
import { UseViewsOptions } from "../useViews.js";
|
|
7
7
|
import { PickerProviderProps } from "../../components/PickerProvider.js";
|
|
@@ -48,7 +48,7 @@ export interface UsePickerBaseProps<TValue extends PickerValidValue, TView exten
|
|
|
48
48
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
49
49
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
50
50
|
*/
|
|
51
|
-
referenceDate?: PickerValidDate;
|
|
51
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
52
52
|
/**
|
|
53
53
|
* Force rendering in particular orientation.
|
|
54
54
|
*/
|
|
@@ -108,7 +108,7 @@ export interface UsePickerNonStaticProps extends Omit<PickerFieldPrivateContextV
|
|
|
108
108
|
name?: string;
|
|
109
109
|
}
|
|
110
110
|
export interface UsePickerProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerProps<TValue, TView, TError, any>> extends UsePickerBaseProps<TValue, TView, TError, TExternalProps>, UsePickerNonStaticProps {
|
|
111
|
-
referenceDate?: PickerValidDate;
|
|
111
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
112
112
|
className?: string;
|
|
113
113
|
sx?: SxProps<Theme>;
|
|
114
114
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MuiPickersAdapter, PickerManager, PickersTimezone, PickerValidDate, PickerValueType } from "../../models/index.js";
|
|
2
2
|
import type { GetDefaultReferenceDateProps } from "../utils/getDefaultReferenceDate.js";
|
|
3
|
-
import { InferNonNullablePickerValue, PickerValidValue } from "./value.js";
|
|
3
|
+
import { InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "./value.js";
|
|
4
4
|
import type { UseFieldInternalProps } from "../hooks/useField/index.js";
|
|
5
5
|
export type PickerAnyManager = PickerManager<any, any, any, any, any>;
|
|
6
6
|
type PickerManagerProperties<TManager extends PickerAnyManager> = TManager extends PickerManager<infer TValue, infer TEnableAccessibleFieldDOMStructure, infer TError, infer TValidationProps, infer TFieldInternalProps> ? {
|
|
@@ -43,7 +43,7 @@ export interface PickerValueManager<TValue extends PickerValidValue, TError> {
|
|
|
43
43
|
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
44
44
|
* Method returning the reference value to use when mounting the component.
|
|
45
45
|
* @param {object} params The params of the method.
|
|
46
|
-
* @param {PickerValidDate | undefined} params.referenceDate The referenceDate provided by the user.
|
|
46
|
+
* @param {PickerValidDate | PickerValidDate[] | undefined} params.referenceDate The referenceDate provided by the user.
|
|
47
47
|
* @param {TValue} params.value The value provided by the user.
|
|
48
48
|
* @param {GetDefaultReferenceDateProps} params.props The validation props needed to compute the reference value.
|
|
49
49
|
* @param {MuiPickersAdapter} params.adapter The Picker date adapter instance.
|
|
@@ -53,7 +53,7 @@ export interface PickerValueManager<TValue extends PickerValidValue, TError> {
|
|
|
53
53
|
* @returns {TValue} The reference value to use for non-provided dates.
|
|
54
54
|
*/
|
|
55
55
|
getInitialReferenceValue: (params: {
|
|
56
|
-
referenceDate
|
|
56
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
57
57
|
value: TValue;
|
|
58
58
|
props: GetDefaultReferenceDateProps;
|
|
59
59
|
adapter: MuiPickersAdapter;
|
package/index.js
CHANGED
|
@@ -25,8 +25,8 @@ const useClockReferenceDate = ({
|
|
|
25
25
|
timezone,
|
|
26
26
|
getTodayDate: () => (0, _dateUtils.getTodayDate)(adapter, timezone, 'date')
|
|
27
27
|
}),
|
|
28
|
-
// We
|
|
29
|
-
[] // eslint-disable-line react-hooks/exhaustive-deps
|
|
28
|
+
// We want the `referenceDate` to update on prop and `timezone` change (https://github.com/mui/mui-x/issues/10804)
|
|
29
|
+
[referenceDateProp, timezone] // eslint-disable-line react-hooks/exhaustive-deps
|
|
30
30
|
);
|
|
31
31
|
return value ?? referenceDate;
|
|
32
32
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PickerValueManager } from "../models/index.js";
|
|
1
|
+
import type { PickerRangeValue, PickerValueManager } from "../models/index.js";
|
|
2
2
|
import { PickersTimezone, PickerValidDate } from "../../models/index.js";
|
|
3
3
|
import { PickerValidValue } from "../models/index.js";
|
|
4
4
|
/**
|
|
@@ -28,7 +28,7 @@ interface UseValueWithTimezoneParameters<TValue extends PickerValidValue, TChang
|
|
|
28
28
|
* It does not need to have its default value.
|
|
29
29
|
* This is only used to determine the timezone to use when `props.value` and `props.defaultValue` are not defined.
|
|
30
30
|
*/
|
|
31
|
-
referenceDate
|
|
31
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
32
32
|
onChange: TChange | undefined;
|
|
33
33
|
valueManager: PickerValueManager<TValue, any>;
|
|
34
34
|
}
|
|
@@ -46,7 +46,7 @@ const useControlledValue = ({
|
|
|
46
46
|
return inputTimezone;
|
|
47
47
|
}
|
|
48
48
|
if (referenceDate) {
|
|
49
|
-
return adapter.getTimezone(referenceDate);
|
|
49
|
+
return adapter.getTimezone(Array.isArray(referenceDate) ? referenceDate[0] : referenceDate);
|
|
50
50
|
}
|
|
51
51
|
return 'default';
|
|
52
52
|
}, [timezoneProp, inputTimezone, referenceDate, adapter]);
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapter, TimezoneProps, FieldSectionContentType, PickerValidDate, FieldRef, OnErrorProps, InferFieldSection, PickerManager, PickerValueType } from "../../../models/index.js";
|
|
3
3
|
import { InternalPropNames } from "../../../hooks/useSplitFieldProps.js";
|
|
4
4
|
import type { PickersSectionElement, PickersSectionListRef } from "../../../PickersSectionList/index.js";
|
|
5
|
-
import { FormProps, InferNonNullablePickerValue, PickerValidValue } from "../../models/index.js";
|
|
5
|
+
import { FormProps, InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "../../models/index.js";
|
|
6
6
|
export interface UseFieldParameters<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean, TError, TValidationProps extends {}, TProps extends UseFieldProps<TEnableAccessibleFieldDOMStructure>> {
|
|
7
7
|
manager: PickerManager<TValue, TEnableAccessibleFieldDOMStructure, TError, TValidationProps, any>;
|
|
8
8
|
props: TProps;
|
|
@@ -23,7 +23,7 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
|
|
|
23
23
|
* For example, on time fields it will be used to determine the date to set.
|
|
24
24
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
25
25
|
*/
|
|
26
|
-
referenceDate?: PickerValidDate;
|
|
26
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
27
27
|
/**
|
|
28
28
|
* Callback fired when the value changes.
|
|
29
29
|
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SxProps } from '@mui/system';
|
|
2
2
|
import { Theme } from '@mui/material/styles';
|
|
3
3
|
import { InferError, OnErrorProps, PickerChangeHandlerContext, PickerOwnerState, PickerValidDate, PickerValueType, TimezoneProps } from "../../../models/index.js";
|
|
4
|
-
import { DateOrTimeViewWithMeridiem, FormProps, PickerOrientation, PickerValidValue, PickerValueManager, PickerVariant } from "../../models/index.js";
|
|
4
|
+
import { DateOrTimeViewWithMeridiem, FormProps, PickerOrientation, PickerRangeValue, PickerValidValue, PickerValueManager, PickerVariant } from "../../models/index.js";
|
|
5
5
|
import { Validator } from "../../../validation/index.js";
|
|
6
6
|
import { UseViewsOptions } from "../useViews.js";
|
|
7
7
|
import { PickerProviderProps } from "../../components/PickerProvider.js";
|
|
@@ -48,7 +48,7 @@ export interface UsePickerBaseProps<TValue extends PickerValidValue, TView exten
|
|
|
48
48
|
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
49
49
|
* @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
|
|
50
50
|
*/
|
|
51
|
-
referenceDate?: PickerValidDate;
|
|
51
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
52
52
|
/**
|
|
53
53
|
* Force rendering in particular orientation.
|
|
54
54
|
*/
|
|
@@ -108,7 +108,7 @@ export interface UsePickerNonStaticProps extends Omit<PickerFieldPrivateContextV
|
|
|
108
108
|
name?: string;
|
|
109
109
|
}
|
|
110
110
|
export interface UsePickerProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerProps<TValue, TView, TError, any>> extends UsePickerBaseProps<TValue, TView, TError, TExternalProps>, UsePickerNonStaticProps {
|
|
111
|
-
referenceDate?: PickerValidDate;
|
|
111
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
112
112
|
className?: string;
|
|
113
113
|
sx?: SxProps<Theme>;
|
|
114
114
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MuiPickersAdapter, PickerManager, PickersTimezone, PickerValidDate, PickerValueType } from "../../models/index.js";
|
|
2
2
|
import type { GetDefaultReferenceDateProps } from "../utils/getDefaultReferenceDate.js";
|
|
3
|
-
import { InferNonNullablePickerValue, PickerValidValue } from "./value.js";
|
|
3
|
+
import { InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "./value.js";
|
|
4
4
|
import type { UseFieldInternalProps } from "../hooks/useField/index.js";
|
|
5
5
|
export type PickerAnyManager = PickerManager<any, any, any, any, any>;
|
|
6
6
|
type PickerManagerProperties<TManager extends PickerAnyManager> = TManager extends PickerManager<infer TValue, infer TEnableAccessibleFieldDOMStructure, infer TError, infer TValidationProps, infer TFieldInternalProps> ? {
|
|
@@ -43,7 +43,7 @@ export interface PickerValueManager<TValue extends PickerValidValue, TError> {
|
|
|
43
43
|
* @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
|
|
44
44
|
* Method returning the reference value to use when mounting the component.
|
|
45
45
|
* @param {object} params The params of the method.
|
|
46
|
-
* @param {PickerValidDate | undefined} params.referenceDate The referenceDate provided by the user.
|
|
46
|
+
* @param {PickerValidDate | PickerValidDate[] | undefined} params.referenceDate The referenceDate provided by the user.
|
|
47
47
|
* @param {TValue} params.value The value provided by the user.
|
|
48
48
|
* @param {GetDefaultReferenceDateProps} params.props The validation props needed to compute the reference value.
|
|
49
49
|
* @param {MuiPickersAdapter} params.adapter The Picker date adapter instance.
|
|
@@ -53,7 +53,7 @@ export interface PickerValueManager<TValue extends PickerValidValue, TError> {
|
|
|
53
53
|
* @returns {TValue} The reference value to use for non-provided dates.
|
|
54
54
|
*/
|
|
55
55
|
getInitialReferenceValue: (params: {
|
|
56
|
-
referenceDate
|
|
56
|
+
referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
|
|
57
57
|
value: TValue;
|
|
58
58
|
props: GetDefaultReferenceDateProps;
|
|
59
59
|
adapter: MuiPickersAdapter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The community edition of the MUI X Date and Time Picker components.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/runtime": "^7.27.6",
|
|
39
|
-
"@mui/utils": "^7.
|
|
39
|
+
"@mui/utils": "^7.2.0",
|
|
40
40
|
"@types/react-transition-group": "^4.4.12",
|
|
41
41
|
"clsx": "^2.1.1",
|
|
42
42
|
"prop-types": "^15.8.1",
|
|
43
43
|
"react-transition-group": "^4.4.5",
|
|
44
|
-
"@mui/x-internals": "8.
|
|
44
|
+
"@mui/x-internals": "8.8.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@emotion/react": "^11.9.0",
|