@mui/x-date-pickers 8.11.2 → 8.12.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 +231 -0
- package/DateField/DateField.js +6 -3
- package/DateTimeField/DateTimeField.js +6 -3
- package/DateTimePicker/shared.d.ts +1 -0
- package/DateTimePicker/shared.js +4 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +3 -1
- package/TimeField/TimeField.js +6 -3
- package/esm/DateField/DateField.js +7 -4
- package/esm/DateTimeField/DateTimeField.js +7 -4
- package/esm/DateTimePicker/shared.d.ts +1 -0
- package/esm/DateTimePicker/shared.js +4 -0
- package/esm/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
- package/esm/MobileDateTimePicker/MobileDateTimePicker.js +3 -1
- package/esm/TimeField/TimeField.js +7 -4
- package/esm/index.js +1 -1
- package/esm/internals/components/PickerFieldUI.d.ts +0 -10
- package/esm/internals/components/PickerFieldUI.js +15 -10
- package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -12
- package/esm/internals/hooks/useField/useFieldState.js +3 -2
- package/esm/internals/hooks/useMobilePicker/useMobilePicker.js +10 -12
- package/index.js +1 -1
- package/internals/components/PickerFieldUI.d.ts +0 -10
- package/internals/components/PickerFieldUI.js +15 -10
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -12
- package/internals/hooks/useField/useFieldState.js +3 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.js +10 -12
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,237 @@
|
|
|
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.12.0
|
|
9
|
+
|
|
10
|
+
_Sep 25, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🤝 Grid-Charts integration
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
👉 [🎥 Watch the full video](https://github.com/user-attachments/assets/28f1848e-dc85-4077-8756-a3e88afd4e54)
|
|
19
|
+
|
|
20
|
+
- ⌨️ Charts keyboard navigation
|
|
21
|
+
- ⚡️ Charts: Add new `renderer="svg-batch"` prop to Scatter charts that provides improved performance for large datasets
|
|
22
|
+
- 🐞 Bugfixes
|
|
23
|
+
- 📚 Documentation improvements
|
|
24
|
+
- 🧰 Codemod requires Node >=20.19
|
|
25
|
+
|
|
26
|
+
`@mui/x-codemod` minimum supported Node version is `20.19`.
|
|
27
|
+
This was only the case due to using the v18 `yargs` package; this now explicitly aligns with it. (#18979)
|
|
28
|
+
|
|
29
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
30
|
+
@deade1e, @sai6855, @thomas-mcdonald
|
|
31
|
+
|
|
32
|
+
The following are all team members who have contributed to this release:
|
|
33
|
+
@alexfauquette, @bernardobelchior, @flaviendelangle, @Janpot, @JCQuintas, @LukasTy, @michelengelen, @prakhargupta1, @rita-codes, @siriwatknp, @arminmeh, @romgrk
|
|
34
|
+
|
|
35
|
+
### Data Grid
|
|
36
|
+
|
|
37
|
+
#### `@mui/x-data-grid@8.12.0`
|
|
38
|
+
|
|
39
|
+
- [DataGrid] Fix flex column width diff calculation while resizing (#19667) @arminmeh
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-data-grid-pro@8.12.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-data-grid@8.12.0`.
|
|
44
|
+
|
|
45
|
+
#### `@mui/x-data-grid-premium@8.12.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
46
|
+
|
|
47
|
+
Same changes as in `@mui/x-data-grid-pro@8.12.0`, plus:
|
|
48
|
+
|
|
49
|
+
- [DataGridPremium] Grid-Charts integration (#18021) @arminmeh
|
|
50
|
+
- [DataGridPremium] Fix sorting and filtering of the tree group columns with aggregation (#19607) @arminmeh
|
|
51
|
+
- [DataGridPremium] Disable aggregation on the grouping column by default (#19692) @arminmeh
|
|
52
|
+
- [DataGridPremium] Do not rely on the group separation constant to retrieve the column name for the charts panel (#19677) @arminmeh
|
|
53
|
+
- [DataGridPremium] Fix stale aggregation state (#19690) @arminmeh
|
|
54
|
+
- [DataGridPremium] Fix pivot column being hidden on autosizing (#19699) @cherniavskii
|
|
55
|
+
|
|
56
|
+
### Date and Time Pickers
|
|
57
|
+
|
|
58
|
+
#### `@mui/x-date-pickers@8.12.0`
|
|
59
|
+
|
|
60
|
+
- [pickers] Ensure reference value is not updated for invalid values (#19635) @michelengelen
|
|
61
|
+
- [pickers] Fix `slotProps.textField.slotProps.htmlInput` resolution (#19713) @LukasTy
|
|
62
|
+
- [pickers] Preserve time format when using single column layout on Time Range Picker (#19626) @sai6855
|
|
63
|
+
- [pickers] Preserve time format when using single column layout on Date Time Picker and Date Time Range Picker (#19608) @sai6855
|
|
64
|
+
|
|
65
|
+
#### `@mui/x-date-pickers-pro@8.12.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
66
|
+
|
|
67
|
+
Same changes as in `@mui/x-date-pickers@8.12.0`.
|
|
68
|
+
|
|
69
|
+
### Charts
|
|
70
|
+
|
|
71
|
+
#### `@mui/x-charts@8.12.0`
|
|
72
|
+
|
|
73
|
+
- [charts] Add batch renderer for scatter chart (#19075) @bernardobelchior
|
|
74
|
+
- [charts] Add renderer suffix to performance benchmarks (#19620) @bernardobelchior
|
|
75
|
+
- [charts] Document how plugins can be used (#19343) @alexfauquette
|
|
76
|
+
- [charts] Export chart plugins per series type (#19337) @alexfauquette
|
|
77
|
+
- [charts] Export plugins (#19335) @alexfauquette
|
|
78
|
+
- [charts] Fix horizontal layout and toolbar (#19655) @alexfauquette
|
|
79
|
+
- [charts] Fix performance issue with JS animations (#19606) @bernardobelchior
|
|
80
|
+
- [charts] Fix piecewise scale causing wrong colors in axis with min/max (#19610) @bernardobelchior
|
|
81
|
+
- [charts] Fix zoom discard inconsistency (#19535) @bernardobelchior
|
|
82
|
+
- [charts] Introduce keyboard navigation (#19155) @alexfauquette
|
|
83
|
+
- [charts] Refactor `getAxisExtremum` (#19627) @bernardobelchior
|
|
84
|
+
- [charts] Remove unused code path from `getAxisScale` (#19673) @bernardobelchior
|
|
85
|
+
- [charts] Make new hideLegend prop on ChartWrapper optional (#19694) @thomas-mcdonald
|
|
86
|
+
- [charts] Fix chart crash in test environment (#19711) @JCQuintas
|
|
87
|
+
|
|
88
|
+
#### `@mui/x-charts-pro@8.12.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
89
|
+
|
|
90
|
+
Same changes as in `@mui/x-charts@8.12.0`, plus:
|
|
91
|
+
|
|
92
|
+
- [charts-pro] Add `valueFormatter` to sankey (#19636) @JCQuintas
|
|
93
|
+
- [charts-pro] Allow `source/target` keywords in sankey link color (#19634) @JCQuintas
|
|
94
|
+
- [charts-pro] Allow exporting `SankeyChart` (#19659) @JCQuintas
|
|
95
|
+
- [charts-pro] Fix axis inversion when using axis `max` and `filterMode: 'discard'` (#19200) @bernardobelchior
|
|
96
|
+
|
|
97
|
+
#### `@mui/x-charts-premium@8.12.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
98
|
+
|
|
99
|
+
Same changes as in `@mui/x-charts-pro@8.12.0`, plus:
|
|
100
|
+
|
|
101
|
+
- [charts-premium] Grid-Charts integration (#18021) @arminmeh
|
|
102
|
+
|
|
103
|
+
### Tree View
|
|
104
|
+
|
|
105
|
+
#### `@mui/x-tree-view@8.12.0`
|
|
106
|
+
|
|
107
|
+
- [tree view] Allow to pass `null` to the icon slots (#19569) @flaviendelangle
|
|
108
|
+
- [tree view] Fix `apiRef.current.isItemExpanded()` method (#19619) @flaviendelangle
|
|
109
|
+
|
|
110
|
+
#### `@mui/x-tree-view-pro@8.12.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
111
|
+
|
|
112
|
+
Same changes as in `@mui/x-tree-view@8.12.0`.
|
|
113
|
+
|
|
114
|
+
### Codemod
|
|
115
|
+
|
|
116
|
+
#### `@mui/x-codemod@8.12.0`
|
|
117
|
+
|
|
118
|
+
- [codemod] Bump `engines.node` to `>=20.19` to align with `yargs` package (#18979) @LukasTy
|
|
119
|
+
|
|
120
|
+
### Docs
|
|
121
|
+
|
|
122
|
+
- [docs] Add missing label to Charts example (#19616) @prakhargupta1
|
|
123
|
+
- [docs] Replace axis type and axis data with a table (#19618) @prakhargupta1
|
|
124
|
+
- [docs] Add Charts example collection page (#18353) @prakhargupta1
|
|
125
|
+
- [docs] Add a Charts demo showcasing bar and scatter composition (#19605) @prakhargupta1
|
|
126
|
+
- [docs] Add composition Charts demo for legends and tooltip (#19602) @prakhargupta1
|
|
127
|
+
- [docs] Add recipe about server-side data export (#19617) @siriwatknp
|
|
128
|
+
- [docs] Clarify DataGrid layout requirements (#19413) @romgrk
|
|
129
|
+
- [docs] Fix `ExportServerSideData` demo layout shift (#19669) @siriwatknp
|
|
130
|
+
- [docs] Improve server-side `updateRow()` description (#19554) @deade1e
|
|
131
|
+
- [docs] Show how to customize drawing area background (#19682) @alexfauquette
|
|
132
|
+
- [docs] Add hook documentation pages (#19334) @Copilot
|
|
133
|
+
|
|
134
|
+
### Core
|
|
135
|
+
|
|
136
|
+
- [code-infra] Add copilot instructions specific to x repo (#19623) @JCQuintas
|
|
137
|
+
- [code-infra] Load `tsx` files in visual regression (#19595) @JCQuintas
|
|
138
|
+
- [code-infra] Remove renovate automerge (#19501) @Janpot
|
|
139
|
+
- [code-infra] Update `DEFAULT_TIMESTAMP` format to ISO 8601 (#19624) @Janpot
|
|
140
|
+
- [code-infra] Update `findLatestTaggedVersion` to filter tags based on major version (#19693) @michelengelen
|
|
141
|
+
- [code-infra] Fix changelog generation for charts premium (#19701) @JCQuintas
|
|
142
|
+
- [code-infra] Run prettier on `createReleasePR.mjs` (#19702) @bernardobelchior
|
|
143
|
+
- [code-infra] Make `x-charts-premium` releasable (#18959) @JCQuintas
|
|
144
|
+
- [docs-infra] Ensure `create-playground` script only runs if target file is absent (#19603) @michelengelen
|
|
145
|
+
- [docs-infra] Add @prakhargupta1 as a codeowner of the docs (#19679) @alexfauquette
|
|
146
|
+
|
|
147
|
+
### Miscellaneous
|
|
148
|
+
|
|
149
|
+
- [test] Reduce time for wheel zoom test (#19571) @alexfauquette
|
|
150
|
+
- Change `matchPackageNames` to `matchDepNames` for date-fns-v2 @Janpot
|
|
151
|
+
- Remove groupName for date-fns-v2 in renovate.json @Janpot
|
|
152
|
+
|
|
153
|
+
## 8.11.3
|
|
154
|
+
|
|
155
|
+
_Sep 16, 2025_
|
|
156
|
+
|
|
157
|
+
We'd like to extend a big thank you to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
158
|
+
|
|
159
|
+
- 🐞 Bugfixes
|
|
160
|
+
- 📚 Documentation improvements
|
|
161
|
+
|
|
162
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
163
|
+
@sai6855
|
|
164
|
+
|
|
165
|
+
The following are all team members who have contributed to this release:
|
|
166
|
+
@alexfauquette, @bernardobelchior, @brijeshb42, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @LukasTy, @rita-codes, @siriwatknp
|
|
167
|
+
|
|
168
|
+
### Data Grid
|
|
169
|
+
|
|
170
|
+
#### `@mui/x-data-grid@8.11.3`
|
|
171
|
+
|
|
172
|
+
- [DataGrid] Fix numeric font size not being applied (#19552) @cherniavskii
|
|
173
|
+
- [DataGrid] Improve `operator` types to display literal values (#19529) @siriwatknp
|
|
174
|
+
|
|
175
|
+
#### `@mui/x-data-grid-pro@8.11.3` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
176
|
+
|
|
177
|
+
Same changes as in `@mui/x-data-grid@8.11.3`.
|
|
178
|
+
|
|
179
|
+
#### `@mui/x-data-grid-premium@8.11.3` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
180
|
+
|
|
181
|
+
Same changes as in `@mui/x-data-grid-pro@8.11.3`.
|
|
182
|
+
|
|
183
|
+
### Date and Time Pickers
|
|
184
|
+
|
|
185
|
+
#### `@mui/x-date-pickers@8.11.3`
|
|
186
|
+
|
|
187
|
+
- [pickers] Refactor `slots` and `slotProps` propagation strategy (#18867) @LukasTy
|
|
188
|
+
|
|
189
|
+
#### `@mui/x-date-pickers-pro@8.11.3` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
190
|
+
|
|
191
|
+
Same changes as in `@mui/x-date-pickers@8.11.3`.
|
|
192
|
+
|
|
193
|
+
### Charts
|
|
194
|
+
|
|
195
|
+
#### `@mui/x-charts@8.11.3`
|
|
196
|
+
|
|
197
|
+
- [charts] Add `inline-` piecewise legend options (#19382) @JCQuintas
|
|
198
|
+
- [charts] Add bar gradient example (#19174) @bernardobelchior
|
|
199
|
+
- [charts] Ignore empty tick labels in label overlap computation (#19547) @alexfauquette
|
|
200
|
+
- [charts] Rename `isBandScale` to `isDiscreteScale` (#19514) @bernardobelchior
|
|
201
|
+
- [charts] Fix legend position affecting toolbar's position (#19257) @sai6855
|
|
202
|
+
|
|
203
|
+
#### `@mui/x-charts-pro@8.11.3` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
204
|
+
|
|
205
|
+
Same changes as in `@mui/x-charts@8.11.3`, plus:
|
|
206
|
+
|
|
207
|
+
- [charts-pro] Add chart title and caption to export demo (#19524) @bernardobelchior
|
|
208
|
+
|
|
209
|
+
### Tree View
|
|
210
|
+
|
|
211
|
+
#### `@mui/x-tree-view@8.11.3`
|
|
212
|
+
|
|
213
|
+
- [tree view] Stop looping through all items to publish the `removeItem` event (#19500) @flaviendelangle
|
|
214
|
+
- [tree view] Support flat DOM structure (#19350) @flaviendelangle
|
|
215
|
+
- [tree view] Update cursor styles for disabled TreeItem (#19548) @sai6855
|
|
216
|
+
|
|
217
|
+
#### `@mui/x-tree-view-pro@8.11.3` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
218
|
+
|
|
219
|
+
Same changes as in `@mui/x-tree-view@8.11.3`.
|
|
220
|
+
|
|
221
|
+
### Codemod
|
|
222
|
+
|
|
223
|
+
#### `@mui/x-codemod@8.11.3`
|
|
224
|
+
|
|
225
|
+
Internal changes.
|
|
226
|
+
|
|
227
|
+
### Docs
|
|
228
|
+
|
|
229
|
+
- [docs] Add styling row group recipe (#19349) @siriwatknp
|
|
230
|
+
- [docs] Group demos data into the dataset folder (#19549) @alexfauquette
|
|
231
|
+
- [docs] Add `shiny` bar chart example at the top (#19416) @JCQuintas
|
|
232
|
+
|
|
233
|
+
### Core
|
|
234
|
+
|
|
235
|
+
- [code-infra] Axios update (#19577) @Janpot
|
|
236
|
+
- [code-infra] Remove usage of copy-files command from code-infra (#19518) @brijeshb42
|
|
237
|
+
- [internal] Fix naming to match convention @oliviertassinari
|
|
238
|
+
|
|
8
239
|
## 8.11.2
|
|
9
240
|
|
|
10
241
|
_Sep 10, 2025_
|
package/DateField/DateField.js
CHANGED
|
@@ -43,11 +43,14 @@ const DateField = exports.DateField = /*#__PURE__*/React.forwardRef(function Dat
|
|
|
43
43
|
externalForwardedProps: other
|
|
44
44
|
});
|
|
45
45
|
const fieldResponse = (0, _useDateField.useDateField)(textFieldProps);
|
|
46
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUIContextProvider, {
|
|
47
47
|
slots: slots,
|
|
48
48
|
slotProps: slotProps,
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
inputRef: other.inputRef,
|
|
50
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
|
|
51
|
+
fieldResponse: fieldResponse,
|
|
52
|
+
defaultOpenPickerIcon: _icons.CalendarIcon
|
|
53
|
+
})
|
|
51
54
|
});
|
|
52
55
|
});
|
|
53
56
|
if (process.env.NODE_ENV !== "production") DateField.displayName = "DateField";
|
|
@@ -43,11 +43,14 @@ const DateTimeField = exports.DateTimeField = /*#__PURE__*/React.forwardRef(func
|
|
|
43
43
|
externalForwardedProps: other
|
|
44
44
|
});
|
|
45
45
|
const fieldResponse = (0, _useDateTimeField.useDateTimeField)(textFieldProps);
|
|
46
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUIContextProvider, {
|
|
47
47
|
slots: slots,
|
|
48
48
|
slotProps: slotProps,
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
inputRef: other.inputRef,
|
|
50
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
|
|
51
|
+
fieldResponse: fieldResponse,
|
|
52
|
+
defaultOpenPickerIcon: _icons.CalendarIcon
|
|
53
|
+
})
|
|
51
54
|
});
|
|
52
55
|
});
|
|
53
56
|
if (process.env.NODE_ENV !== "production") DateTimeField.displayName = "DateTimeField";
|
|
@@ -67,6 +67,7 @@ export interface BaseDateTimePickerProps extends Omit<BasePickerInputProps<Picke
|
|
|
67
67
|
type UseDateTimePickerDefaultizedProps<Props extends BaseDateTimePickerProps> = LocalizedComponent<Omit<DefaultizedProps<Props, 'openTo' | 'orientation' | 'ampm' | ValidateDateTimePropsToDefault>, 'views'>> & {
|
|
68
68
|
shouldRenderTimeInASingleColumn: boolean;
|
|
69
69
|
views: readonly DateOrTimeViewWithMeridiem[];
|
|
70
|
+
viewsForFormatting: readonly DateOrTimeViewWithMeridiem[];
|
|
70
71
|
};
|
|
71
72
|
export declare function useDateTimePickerDefaultizedProps<Props extends BaseDateTimePickerProps>(props: Props, name: string): UseDateTimePickerDefaultizedProps<Props>;
|
|
72
73
|
export {};
|
package/DateTimePicker/shared.js
CHANGED
|
@@ -51,12 +51,16 @@ function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
51
51
|
timeSteps: themeProps.timeSteps,
|
|
52
52
|
views: defaultViews
|
|
53
53
|
});
|
|
54
|
+
|
|
55
|
+
// Keep the original views for format calculation (before filtering)
|
|
56
|
+
const viewsForFormatting = ampm ? [...defaultViews, 'meridiem'] : defaultViews;
|
|
54
57
|
return (0, _extends2.default)({}, themeProps, validationProps, {
|
|
55
58
|
timeSteps,
|
|
56
59
|
openTo,
|
|
57
60
|
shouldRenderTimeInASingleColumn,
|
|
58
61
|
thresholdToRenderTimeInASingleColumn,
|
|
59
62
|
views,
|
|
63
|
+
viewsForFormatting,
|
|
60
64
|
ampm,
|
|
61
65
|
localeText,
|
|
62
66
|
orientation: themeProps.orientation ?? 'portrait',
|
|
@@ -119,7 +119,9 @@ const DesktopDateTimePicker = exports.DesktopDateTimePicker = /*#__PURE__*/React
|
|
|
119
119
|
// Props with the default values specific to the desktop variant
|
|
120
120
|
const props = (0, _extends2.default)({}, defaultizedProps, {
|
|
121
121
|
viewRenderers,
|
|
122
|
-
format: (0, _dateTimeUtils.resolveDateTimeFormat)(adapter,
|
|
122
|
+
format: (0, _dateTimeUtils.resolveDateTimeFormat)(adapter, (0, _extends2.default)({}, defaultizedProps, {
|
|
123
|
+
views: defaultizedProps.viewsForFormatting
|
|
124
|
+
})),
|
|
123
125
|
views,
|
|
124
126
|
yearsPerRow: defaultizedProps.yearsPerRow ?? 4,
|
|
125
127
|
ampmInClock,
|
|
@@ -65,7 +65,9 @@ const MobileDateTimePicker = exports.MobileDateTimePicker = /*#__PURE__*/React.f
|
|
|
65
65
|
// Props with the default values specific to the mobile variant
|
|
66
66
|
const props = (0, _extends2.default)({}, defaultizedProps, {
|
|
67
67
|
viewRenderers,
|
|
68
|
-
format: (0, _dateTimeUtils.resolveDateTimeFormat)(adapter,
|
|
68
|
+
format: (0, _dateTimeUtils.resolveDateTimeFormat)(adapter, (0, _extends2.default)({}, defaultizedProps, {
|
|
69
|
+
views: defaultizedProps.viewsForFormatting
|
|
70
|
+
})),
|
|
69
71
|
views,
|
|
70
72
|
ampmInClock,
|
|
71
73
|
slots: (0, _extends2.default)({
|
package/TimeField/TimeField.js
CHANGED
|
@@ -43,11 +43,14 @@ const TimeField = exports.TimeField = /*#__PURE__*/React.forwardRef(function Tim
|
|
|
43
43
|
externalForwardedProps: other
|
|
44
44
|
});
|
|
45
45
|
const fieldResponse = (0, _useTimeField.useTimeField)(textFieldProps);
|
|
46
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUIContextProvider, {
|
|
47
47
|
slots: slots,
|
|
48
48
|
slotProps: slotProps,
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
inputRef: other.inputRef,
|
|
50
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
|
|
51
|
+
fieldResponse: fieldResponse,
|
|
52
|
+
defaultOpenPickerIcon: _icons.ClockIcon
|
|
53
|
+
})
|
|
51
54
|
});
|
|
52
55
|
});
|
|
53
56
|
if (process.env.NODE_ENV !== "production") TimeField.displayName = "TimeField";
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { useThemeProps } from '@mui/material/styles';
|
|
8
8
|
import refType from '@mui/utils/refType';
|
|
9
9
|
import { useDateField } from "./useDateField.js";
|
|
10
|
-
import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
10
|
+
import { PickerFieldUI, PickerFieldUIContextProvider, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
11
11
|
import { CalendarIcon } from "../icons/index.js";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
/**
|
|
@@ -36,11 +36,14 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRe
|
|
|
36
36
|
externalForwardedProps: other
|
|
37
37
|
});
|
|
38
38
|
const fieldResponse = useDateField(textFieldProps);
|
|
39
|
-
return /*#__PURE__*/_jsx(
|
|
39
|
+
return /*#__PURE__*/_jsx(PickerFieldUIContextProvider, {
|
|
40
40
|
slots: slots,
|
|
41
41
|
slotProps: slotProps,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
inputRef: other.inputRef,
|
|
43
|
+
children: /*#__PURE__*/_jsx(PickerFieldUI, {
|
|
44
|
+
fieldResponse: fieldResponse,
|
|
45
|
+
defaultOpenPickerIcon: CalendarIcon
|
|
46
|
+
})
|
|
44
47
|
});
|
|
45
48
|
});
|
|
46
49
|
if (process.env.NODE_ENV !== "production") DateField.displayName = "DateField";
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { useThemeProps } from '@mui/material/styles';
|
|
8
8
|
import refType from '@mui/utils/refType';
|
|
9
9
|
import { useDateTimeField } from "./useDateTimeField.js";
|
|
10
|
-
import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
10
|
+
import { PickerFieldUI, PickerFieldUIContextProvider, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
11
11
|
import { CalendarIcon } from "../icons/index.js";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
/**
|
|
@@ -36,11 +36,14 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
36
36
|
externalForwardedProps: other
|
|
37
37
|
});
|
|
38
38
|
const fieldResponse = useDateTimeField(textFieldProps);
|
|
39
|
-
return /*#__PURE__*/_jsx(
|
|
39
|
+
return /*#__PURE__*/_jsx(PickerFieldUIContextProvider, {
|
|
40
40
|
slots: slots,
|
|
41
41
|
slotProps: slotProps,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
inputRef: other.inputRef,
|
|
43
|
+
children: /*#__PURE__*/_jsx(PickerFieldUI, {
|
|
44
|
+
fieldResponse: fieldResponse,
|
|
45
|
+
defaultOpenPickerIcon: CalendarIcon
|
|
46
|
+
})
|
|
44
47
|
});
|
|
45
48
|
});
|
|
46
49
|
if (process.env.NODE_ENV !== "production") DateTimeField.displayName = "DateTimeField";
|
|
@@ -67,6 +67,7 @@ export interface BaseDateTimePickerProps extends Omit<BasePickerInputProps<Picke
|
|
|
67
67
|
type UseDateTimePickerDefaultizedProps<Props extends BaseDateTimePickerProps> = LocalizedComponent<Omit<DefaultizedProps<Props, 'openTo' | 'orientation' | 'ampm' | ValidateDateTimePropsToDefault>, 'views'>> & {
|
|
68
68
|
shouldRenderTimeInASingleColumn: boolean;
|
|
69
69
|
views: readonly DateOrTimeViewWithMeridiem[];
|
|
70
|
+
viewsForFormatting: readonly DateOrTimeViewWithMeridiem[];
|
|
70
71
|
};
|
|
71
72
|
export declare function useDateTimePickerDefaultizedProps<Props extends BaseDateTimePickerProps>(props: Props, name: string): UseDateTimePickerDefaultizedProps<Props>;
|
|
72
73
|
export {};
|
|
@@ -43,12 +43,16 @@ export function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
43
43
|
timeSteps: themeProps.timeSteps,
|
|
44
44
|
views: defaultViews
|
|
45
45
|
});
|
|
46
|
+
|
|
47
|
+
// Keep the original views for format calculation (before filtering)
|
|
48
|
+
const viewsForFormatting = ampm ? [...defaultViews, 'meridiem'] : defaultViews;
|
|
46
49
|
return _extends({}, themeProps, validationProps, {
|
|
47
50
|
timeSteps,
|
|
48
51
|
openTo,
|
|
49
52
|
shouldRenderTimeInASingleColumn,
|
|
50
53
|
thresholdToRenderTimeInASingleColumn,
|
|
51
54
|
views,
|
|
55
|
+
viewsForFormatting,
|
|
52
56
|
ampm,
|
|
53
57
|
localeText,
|
|
54
58
|
orientation: themeProps.orientation ?? 'portrait',
|
|
@@ -112,7 +112,9 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
|
|
|
112
112
|
// Props with the default values specific to the desktop variant
|
|
113
113
|
const props = _extends({}, defaultizedProps, {
|
|
114
114
|
viewRenderers,
|
|
115
|
-
format: resolveDateTimeFormat(adapter, defaultizedProps
|
|
115
|
+
format: resolveDateTimeFormat(adapter, _extends({}, defaultizedProps, {
|
|
116
|
+
views: defaultizedProps.viewsForFormatting
|
|
117
|
+
})),
|
|
116
118
|
views,
|
|
117
119
|
yearsPerRow: defaultizedProps.yearsPerRow ?? 4,
|
|
118
120
|
ampmInClock,
|
|
@@ -58,7 +58,9 @@ const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTi
|
|
|
58
58
|
// Props with the default values specific to the mobile variant
|
|
59
59
|
const props = _extends({}, defaultizedProps, {
|
|
60
60
|
viewRenderers,
|
|
61
|
-
format: resolveDateTimeFormat(adapter, defaultizedProps
|
|
61
|
+
format: resolveDateTimeFormat(adapter, _extends({}, defaultizedProps, {
|
|
62
|
+
views: defaultizedProps.viewsForFormatting
|
|
63
|
+
})),
|
|
62
64
|
views,
|
|
63
65
|
ampmInClock,
|
|
64
66
|
slots: _extends({
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { useThemeProps } from '@mui/material/styles';
|
|
8
8
|
import refType from '@mui/utils/refType';
|
|
9
9
|
import { useTimeField } from "./useTimeField.js";
|
|
10
|
-
import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
10
|
+
import { PickerFieldUI, PickerFieldUIContextProvider, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
11
11
|
import { ClockIcon } from "../icons/index.js";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
/**
|
|
@@ -36,11 +36,14 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, inRe
|
|
|
36
36
|
externalForwardedProps: other
|
|
37
37
|
});
|
|
38
38
|
const fieldResponse = useTimeField(textFieldProps);
|
|
39
|
-
return /*#__PURE__*/_jsx(
|
|
39
|
+
return /*#__PURE__*/_jsx(PickerFieldUIContextProvider, {
|
|
40
40
|
slots: slots,
|
|
41
41
|
slotProps: slotProps,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
inputRef: other.inputRef,
|
|
43
|
+
children: /*#__PURE__*/_jsx(PickerFieldUI, {
|
|
44
|
+
fieldResponse: fieldResponse,
|
|
45
|
+
defaultOpenPickerIcon: ClockIcon
|
|
46
|
+
})
|
|
44
47
|
});
|
|
45
48
|
});
|
|
46
49
|
if (process.env.NODE_ENV !== "production") TimeField.displayName = "TimeField";
|
package/esm/index.js
CHANGED
|
@@ -47,16 +47,6 @@ export interface ExportedPickerFieldUIProps {
|
|
|
47
47
|
openPickerButtonPosition?: 'start' | 'end';
|
|
48
48
|
}
|
|
49
49
|
export interface PickerFieldUIProps<TEnableAccessibleFieldDOMStructure extends boolean, TProps extends UseFieldProps<TEnableAccessibleFieldDOMStructure>> {
|
|
50
|
-
/**
|
|
51
|
-
* Overridable component slots.
|
|
52
|
-
* @default {}
|
|
53
|
-
*/
|
|
54
|
-
slots?: PickerFieldUISlots;
|
|
55
|
-
/**
|
|
56
|
-
* The props used for each component slot.
|
|
57
|
-
* @default {}
|
|
58
|
-
*/
|
|
59
|
-
slotProps?: PickerFieldUISlotProps;
|
|
60
50
|
/**
|
|
61
51
|
* Object returned by the `useField` hook or one of its wrapper (for example `useDateField`).
|
|
62
52
|
*/
|
|
@@ -123,8 +123,6 @@ export const PickerFieldUIContext = /*#__PURE__*/React.createContext({
|
|
|
123
123
|
if (process.env.NODE_ENV !== "production") PickerFieldUIContext.displayName = "PickerFieldUIContext";
|
|
124
124
|
export function PickerFieldUI(props) {
|
|
125
125
|
const {
|
|
126
|
-
slots,
|
|
127
|
-
slotProps,
|
|
128
126
|
fieldResponse,
|
|
129
127
|
defaultOpenPickerIcon
|
|
130
128
|
} = props;
|
|
@@ -147,11 +145,11 @@ export function PickerFieldUI(props) {
|
|
|
147
145
|
const triggerStatus = pickerContext ? pickerContext.triggerStatus : 'hidden';
|
|
148
146
|
const clearButtonPosition = clearable ? clearButtonPositionProp : null;
|
|
149
147
|
const openPickerButtonPosition = triggerStatus !== 'hidden' ? openPickerButtonPositionProp : null;
|
|
150
|
-
const TextField =
|
|
151
|
-
const InputAdornment =
|
|
148
|
+
const TextField = pickerFieldUIContext.slots.textField ?? (fieldResponse.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
|
|
149
|
+
const InputAdornment = pickerFieldUIContext.slots.inputAdornment ?? MuiInputAdornment;
|
|
152
150
|
const _useSlotProps = useSlotProps({
|
|
153
151
|
elementType: InputAdornment,
|
|
154
|
-
externalSlotProps:
|
|
152
|
+
externalSlotProps: pickerFieldUIContext.slotProps.inputAdornment,
|
|
155
153
|
additionalProps: {
|
|
156
154
|
position: 'start'
|
|
157
155
|
},
|
|
@@ -162,7 +160,7 @@ export function PickerFieldUI(props) {
|
|
|
162
160
|
startInputAdornmentProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded4);
|
|
163
161
|
const _useSlotProps2 = useSlotProps({
|
|
164
162
|
elementType: InputAdornment,
|
|
165
|
-
externalSlotProps:
|
|
163
|
+
externalSlotProps: pickerFieldUIContext.slotProps.inputAdornment,
|
|
166
164
|
additionalProps: {
|
|
167
165
|
position: 'end'
|
|
168
166
|
},
|
|
@@ -193,11 +191,11 @@ export function PickerFieldUI(props) {
|
|
|
193
191
|
externalSlotProps: pickerFieldUIContext.slotProps.openPickerIcon,
|
|
194
192
|
ownerState
|
|
195
193
|
});
|
|
196
|
-
const ClearButton =
|
|
194
|
+
const ClearButton = pickerFieldUIContext.slots.clearButton ?? MuiIconButton;
|
|
197
195
|
// We don't want to forward the `ownerState` to the `<IconButton />` component, see mui/material-ui#34056
|
|
198
196
|
const _useSlotProps4 = useSlotProps({
|
|
199
197
|
elementType: ClearButton,
|
|
200
|
-
externalSlotProps:
|
|
198
|
+
externalSlotProps: pickerFieldUIContext.slotProps.clearButton,
|
|
201
199
|
className: 'clearButton',
|
|
202
200
|
additionalProps: {
|
|
203
201
|
title: translations.fieldClearLabel,
|
|
@@ -211,10 +209,10 @@ export function PickerFieldUI(props) {
|
|
|
211
209
|
ownerState
|
|
212
210
|
}),
|
|
213
211
|
clearButtonProps = _objectWithoutPropertiesLoose(_useSlotProps4, _excluded7);
|
|
214
|
-
const ClearIcon =
|
|
212
|
+
const ClearIcon = pickerFieldUIContext.slots.clearIcon ?? MuiClearIcon;
|
|
215
213
|
const clearIconProps = useSlotProps({
|
|
216
214
|
elementType: ClearIcon,
|
|
217
|
-
externalSlotProps:
|
|
215
|
+
externalSlotProps: pickerFieldUIContext.slotProps.clearIcon,
|
|
218
216
|
additionalProps: {
|
|
219
217
|
fontSize: 'small'
|
|
220
218
|
},
|
|
@@ -244,6 +242,10 @@ export function PickerFieldUI(props) {
|
|
|
244
242
|
}))]
|
|
245
243
|
}));
|
|
246
244
|
}
|
|
245
|
+
// handle the case of showing custom `inputAdornment` for Field components
|
|
246
|
+
if (!additionalTextFieldInputProps?.endAdornment && !additionalTextFieldInputProps?.startAdornment && pickerFieldUIContext.slots.inputAdornment) {
|
|
247
|
+
additionalTextFieldInputProps.endAdornment = /*#__PURE__*/_jsx(InputAdornment, _extends({}, endInputAdornmentProps));
|
|
248
|
+
}
|
|
247
249
|
if (clearButtonPosition != null) {
|
|
248
250
|
textFieldProps.sx = [{
|
|
249
251
|
'& .clearButton': {
|
|
@@ -263,6 +265,9 @@ export function PickerFieldUI(props) {
|
|
|
263
265
|
}
|
|
264
266
|
const resolvedTextFieldInputProps = materialMajor >= 6 && textFieldProps?.slotProps?.input ? resolveComponentProps(mergeSlotProps(textFieldInputProps, additionalTextFieldInputProps), ownerState) : _extends({}, textFieldInputProps, additionalTextFieldInputProps);
|
|
265
267
|
|
|
268
|
+
// We need to resolve the `inputProps` since we are messing with those props in this component.
|
|
269
|
+
textFieldProps.inputProps = materialMajor >= 6 && textFieldProps?.slotProps?.htmlInput ? resolveComponentProps(textFieldProps.slotProps.htmlInput, ownerState) : textFieldProps.inputProps;
|
|
270
|
+
|
|
266
271
|
// Remove the `input` slotProps to avoid them overriding the manually resolved `InputProps`.
|
|
267
272
|
// Relevant on `materialMajor >= 6` since `slotProps` would take precedence.
|
|
268
273
|
delete textFieldProps?.slotProps?.input;
|
|
@@ -8,7 +8,6 @@ import { PickerPopper } from "../../components/PickerPopper/PickerPopper.js";
|
|
|
8
8
|
import { usePicker } from "../usePicker/index.js";
|
|
9
9
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
10
10
|
import { PickerProvider } from "../../components/PickerProvider.js";
|
|
11
|
-
import { PickerFieldUIContextProvider } from "../../components/PickerFieldUI.js";
|
|
12
11
|
import { createNonRangePickerStepNavigation } from "../../utils/createNonRangePickerStepNavigation.js";
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -75,21 +74,20 @@ export const useDesktopPicker = _ref => {
|
|
|
75
74
|
'aria-labelledby': labelledById
|
|
76
75
|
}, innerSlotProps?.popper)
|
|
77
76
|
});
|
|
78
|
-
const renderPicker = () => /*#__PURE__*/
|
|
79
|
-
children: /*#__PURE__*/
|
|
77
|
+
const renderPicker = () => /*#__PURE__*/_jsxs(PickerProvider, _extends({}, providerProps, {
|
|
78
|
+
children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps, {
|
|
80
79
|
slots: slots,
|
|
81
80
|
slotProps: slotProps,
|
|
82
|
-
inputRef: inputRef
|
|
83
|
-
|
|
81
|
+
inputRef: inputRef
|
|
82
|
+
})), /*#__PURE__*/_jsx(PickerPopper, {
|
|
83
|
+
slots: slots,
|
|
84
|
+
slotProps: slotProps,
|
|
85
|
+
children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
|
|
84
86
|
slots: slots,
|
|
85
87
|
slotProps: slotProps,
|
|
86
|
-
children:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
children: renderCurrentView()
|
|
90
|
-
}))
|
|
91
|
-
})]
|
|
92
|
-
})
|
|
88
|
+
children: renderCurrentView()
|
|
89
|
+
}))
|
|
90
|
+
})]
|
|
93
91
|
}));
|
|
94
92
|
if (process.env.NODE_ENV !== "production") renderPicker.displayName = "renderPicker";
|
|
95
93
|
return {
|
|
@@ -305,8 +305,9 @@ export const useFieldState = parameters => {
|
|
|
305
305
|
|
|
306
306
|
// If `prop.value` changes, we update the state to reflect the new value
|
|
307
307
|
if (value !== state.lastExternalValue) {
|
|
308
|
+
const isActiveDateInvalid = sectionToUpdateOnNextInvalidDateRef.current != null && !adapter.isValid(fieldValueManager.getDateFromSection(value, state.sections[sectionToUpdateOnNextInvalidDateRef.current.sectionIndex]));
|
|
308
309
|
let sections;
|
|
309
|
-
if (
|
|
310
|
+
if (isActiveDateInvalid) {
|
|
310
311
|
sections = setSectionValue(sectionToUpdateOnNextInvalidDateRef.current.sectionIndex, sectionToUpdateOnNextInvalidDateRef.current.value);
|
|
311
312
|
} else {
|
|
312
313
|
sections = getSectionsFromValue(value);
|
|
@@ -319,7 +320,7 @@ export const useFieldState = parameters => {
|
|
|
319
320
|
isRtl,
|
|
320
321
|
locale: adapter.locale
|
|
321
322
|
},
|
|
322
|
-
referenceValue: fieldValueManager.updateReferenceValue(adapter, value, prevState.referenceValue),
|
|
323
|
+
referenceValue: isActiveDateInvalid ? prevState.referenceValue : fieldValueManager.updateReferenceValue(adapter, value, prevState.referenceValue),
|
|
323
324
|
tempValueStrAndroid: null
|
|
324
325
|
}));
|
|
325
326
|
}
|
|
@@ -8,7 +8,6 @@ import { PickersModalDialog } from "../../components/PickersModalDialog.js";
|
|
|
8
8
|
import { usePicker } from "../usePicker/index.js";
|
|
9
9
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
10
10
|
import { PickerProvider } from "../../components/PickerProvider.js";
|
|
11
|
-
import { PickerFieldUIContextProvider } from "../../components/PickerFieldUI.js";
|
|
12
11
|
import { createNonRangePickerStepNavigation } from "../../utils/createNonRangePickerStepNavigation.js";
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -75,21 +74,20 @@ export const useMobilePicker = _ref => {
|
|
|
75
74
|
'aria-labelledby': labelledById
|
|
76
75
|
}, innerSlotProps?.mobilePaper)
|
|
77
76
|
});
|
|
78
|
-
const renderPicker = () => /*#__PURE__*/
|
|
79
|
-
children: /*#__PURE__*/
|
|
77
|
+
const renderPicker = () => /*#__PURE__*/_jsxs(PickerProvider, _extends({}, providerProps, {
|
|
78
|
+
children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps, {
|
|
80
79
|
slots: slots,
|
|
81
80
|
slotProps: slotProps,
|
|
82
|
-
inputRef: inputRef
|
|
83
|
-
|
|
81
|
+
inputRef: inputRef
|
|
82
|
+
})), /*#__PURE__*/_jsx(PickersModalDialog, {
|
|
83
|
+
slots: slots,
|
|
84
|
+
slotProps: slotProps,
|
|
85
|
+
children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
|
|
84
86
|
slots: slots,
|
|
85
87
|
slotProps: slotProps,
|
|
86
|
-
children:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
children: renderCurrentView()
|
|
90
|
-
}))
|
|
91
|
-
})]
|
|
92
|
-
})
|
|
88
|
+
children: renderCurrentView()
|
|
89
|
+
}))
|
|
90
|
+
})]
|
|
93
91
|
}));
|
|
94
92
|
if (process.env.NODE_ENV !== "production") renderPicker.displayName = "renderPicker";
|
|
95
93
|
return {
|
package/index.js
CHANGED
|
@@ -47,16 +47,6 @@ export interface ExportedPickerFieldUIProps {
|
|
|
47
47
|
openPickerButtonPosition?: 'start' | 'end';
|
|
48
48
|
}
|
|
49
49
|
export interface PickerFieldUIProps<TEnableAccessibleFieldDOMStructure extends boolean, TProps extends UseFieldProps<TEnableAccessibleFieldDOMStructure>> {
|
|
50
|
-
/**
|
|
51
|
-
* Overridable component slots.
|
|
52
|
-
* @default {}
|
|
53
|
-
*/
|
|
54
|
-
slots?: PickerFieldUISlots;
|
|
55
|
-
/**
|
|
56
|
-
* The props used for each component slot.
|
|
57
|
-
* @default {}
|
|
58
|
-
*/
|
|
59
|
-
slotProps?: PickerFieldUISlotProps;
|
|
60
50
|
/**
|
|
61
51
|
* Object returned by the `useField` hook or one of its wrapper (for example `useDateField`).
|
|
62
52
|
*/
|
|
@@ -136,8 +136,6 @@ const PickerFieldUIContext = exports.PickerFieldUIContext = /*#__PURE__*/React.c
|
|
|
136
136
|
if (process.env.NODE_ENV !== "production") PickerFieldUIContext.displayName = "PickerFieldUIContext";
|
|
137
137
|
function PickerFieldUI(props) {
|
|
138
138
|
const {
|
|
139
|
-
slots,
|
|
140
|
-
slotProps,
|
|
141
139
|
fieldResponse,
|
|
142
140
|
defaultOpenPickerIcon
|
|
143
141
|
} = props;
|
|
@@ -160,11 +158,11 @@ function PickerFieldUI(props) {
|
|
|
160
158
|
const triggerStatus = pickerContext ? pickerContext.triggerStatus : 'hidden';
|
|
161
159
|
const clearButtonPosition = clearable ? clearButtonPositionProp : null;
|
|
162
160
|
const openPickerButtonPosition = triggerStatus !== 'hidden' ? openPickerButtonPositionProp : null;
|
|
163
|
-
const TextField =
|
|
164
|
-
const InputAdornment =
|
|
161
|
+
const TextField = pickerFieldUIContext.slots.textField ?? (fieldResponse.enableAccessibleFieldDOMStructure === false ? _TextField.default : _PickersTextField.PickersTextField);
|
|
162
|
+
const InputAdornment = pickerFieldUIContext.slots.inputAdornment ?? _InputAdornment.default;
|
|
165
163
|
const _useSlotProps = (0, _useSlotProps5.default)({
|
|
166
164
|
elementType: InputAdornment,
|
|
167
|
-
externalSlotProps:
|
|
165
|
+
externalSlotProps: pickerFieldUIContext.slotProps.inputAdornment,
|
|
168
166
|
additionalProps: {
|
|
169
167
|
position: 'start'
|
|
170
168
|
},
|
|
@@ -175,7 +173,7 @@ function PickerFieldUI(props) {
|
|
|
175
173
|
startInputAdornmentProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded4);
|
|
176
174
|
const _useSlotProps2 = (0, _useSlotProps5.default)({
|
|
177
175
|
elementType: InputAdornment,
|
|
178
|
-
externalSlotProps:
|
|
176
|
+
externalSlotProps: pickerFieldUIContext.slotProps.inputAdornment,
|
|
179
177
|
additionalProps: {
|
|
180
178
|
position: 'end'
|
|
181
179
|
},
|
|
@@ -206,11 +204,11 @@ function PickerFieldUI(props) {
|
|
|
206
204
|
externalSlotProps: pickerFieldUIContext.slotProps.openPickerIcon,
|
|
207
205
|
ownerState
|
|
208
206
|
});
|
|
209
|
-
const ClearButton =
|
|
207
|
+
const ClearButton = pickerFieldUIContext.slots.clearButton ?? _IconButton.default;
|
|
210
208
|
// We don't want to forward the `ownerState` to the `<IconButton />` component, see mui/material-ui#34056
|
|
211
209
|
const _useSlotProps4 = (0, _useSlotProps5.default)({
|
|
212
210
|
elementType: ClearButton,
|
|
213
|
-
externalSlotProps:
|
|
211
|
+
externalSlotProps: pickerFieldUIContext.slotProps.clearButton,
|
|
214
212
|
className: 'clearButton',
|
|
215
213
|
additionalProps: {
|
|
216
214
|
title: translations.fieldClearLabel,
|
|
@@ -224,10 +222,10 @@ function PickerFieldUI(props) {
|
|
|
224
222
|
ownerState
|
|
225
223
|
}),
|
|
226
224
|
clearButtonProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps4, _excluded7);
|
|
227
|
-
const ClearIcon =
|
|
225
|
+
const ClearIcon = pickerFieldUIContext.slots.clearIcon ?? _icons.ClearIcon;
|
|
228
226
|
const clearIconProps = (0, _useSlotProps5.default)({
|
|
229
227
|
elementType: ClearIcon,
|
|
230
|
-
externalSlotProps:
|
|
228
|
+
externalSlotProps: pickerFieldUIContext.slotProps.clearIcon,
|
|
231
229
|
additionalProps: {
|
|
232
230
|
fontSize: 'small'
|
|
233
231
|
},
|
|
@@ -257,6 +255,10 @@ function PickerFieldUI(props) {
|
|
|
257
255
|
}))]
|
|
258
256
|
}));
|
|
259
257
|
}
|
|
258
|
+
// handle the case of showing custom `inputAdornment` for Field components
|
|
259
|
+
if (!additionalTextFieldInputProps?.endAdornment && !additionalTextFieldInputProps?.startAdornment && pickerFieldUIContext.slots.inputAdornment) {
|
|
260
|
+
additionalTextFieldInputProps.endAdornment = /*#__PURE__*/(0, _jsxRuntime.jsx)(InputAdornment, (0, _extends2.default)({}, endInputAdornmentProps));
|
|
261
|
+
}
|
|
260
262
|
if (clearButtonPosition != null) {
|
|
261
263
|
textFieldProps.sx = [{
|
|
262
264
|
'& .clearButton': {
|
|
@@ -276,6 +278,9 @@ function PickerFieldUI(props) {
|
|
|
276
278
|
}
|
|
277
279
|
const resolvedTextFieldInputProps = _version.major >= 6 && textFieldProps?.slotProps?.input ? (0, _resolveComponentProps.default)(mergeSlotProps(textFieldInputProps, additionalTextFieldInputProps), ownerState) : (0, _extends2.default)({}, textFieldInputProps, additionalTextFieldInputProps);
|
|
278
280
|
|
|
281
|
+
// We need to resolve the `inputProps` since we are messing with those props in this component.
|
|
282
|
+
textFieldProps.inputProps = _version.major >= 6 && textFieldProps?.slotProps?.htmlInput ? (0, _resolveComponentProps.default)(textFieldProps.slotProps.htmlInput, ownerState) : textFieldProps.inputProps;
|
|
283
|
+
|
|
279
284
|
// Remove the `input` slotProps to avoid them overriding the manually resolved `InputProps`.
|
|
280
285
|
// Relevant on `materialMajor >= 6` since `slotProps` would take precedence.
|
|
281
286
|
delete textFieldProps?.slotProps?.input;
|
|
@@ -14,7 +14,6 @@ var _PickerPopper = require("../../components/PickerPopper/PickerPopper");
|
|
|
14
14
|
var _usePicker = require("../usePicker");
|
|
15
15
|
var _PickersLayout = require("../../../PickersLayout");
|
|
16
16
|
var _PickerProvider = require("../../components/PickerProvider");
|
|
17
|
-
var _PickerFieldUI = require("../../components/PickerFieldUI");
|
|
18
17
|
var _createNonRangePickerStepNavigation = require("../../utils/createNonRangePickerStepNavigation");
|
|
19
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
19
|
const _excluded = ["props", "steps"],
|
|
@@ -82,21 +81,20 @@ const useDesktopPicker = _ref => {
|
|
|
82
81
|
'aria-labelledby': labelledById
|
|
83
82
|
}, innerSlotProps?.popper)
|
|
84
83
|
});
|
|
85
|
-
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.
|
|
86
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
84
|
+
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickerProvider.PickerProvider, (0, _extends2.default)({}, providerProps, {
|
|
85
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Field, (0, _extends2.default)({}, fieldProps, {
|
|
87
86
|
slots: slots,
|
|
88
87
|
slotProps: slotProps,
|
|
89
|
-
inputRef: inputRef
|
|
90
|
-
|
|
88
|
+
inputRef: inputRef
|
|
89
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerPopper.PickerPopper, {
|
|
90
|
+
slots: slots,
|
|
91
|
+
slotProps: slotProps,
|
|
92
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Layout, (0, _extends2.default)({}, slotProps?.layout, {
|
|
91
93
|
slots: slots,
|
|
92
94
|
slotProps: slotProps,
|
|
93
|
-
children:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
children: renderCurrentView()
|
|
97
|
-
}))
|
|
98
|
-
})]
|
|
99
|
-
})
|
|
95
|
+
children: renderCurrentView()
|
|
96
|
+
}))
|
|
97
|
+
})]
|
|
100
98
|
}));
|
|
101
99
|
if (process.env.NODE_ENV !== "production") renderPicker.displayName = "renderPicker";
|
|
102
100
|
return {
|
|
@@ -312,8 +312,9 @@ const useFieldState = parameters => {
|
|
|
312
312
|
|
|
313
313
|
// If `prop.value` changes, we update the state to reflect the new value
|
|
314
314
|
if (value !== state.lastExternalValue) {
|
|
315
|
+
const isActiveDateInvalid = sectionToUpdateOnNextInvalidDateRef.current != null && !adapter.isValid(fieldValueManager.getDateFromSection(value, state.sections[sectionToUpdateOnNextInvalidDateRef.current.sectionIndex]));
|
|
315
316
|
let sections;
|
|
316
|
-
if (
|
|
317
|
+
if (isActiveDateInvalid) {
|
|
317
318
|
sections = setSectionValue(sectionToUpdateOnNextInvalidDateRef.current.sectionIndex, sectionToUpdateOnNextInvalidDateRef.current.value);
|
|
318
319
|
} else {
|
|
319
320
|
sections = getSectionsFromValue(value);
|
|
@@ -326,7 +327,7 @@ const useFieldState = parameters => {
|
|
|
326
327
|
isRtl,
|
|
327
328
|
locale: adapter.locale
|
|
328
329
|
},
|
|
329
|
-
referenceValue: fieldValueManager.updateReferenceValue(adapter, value, prevState.referenceValue),
|
|
330
|
+
referenceValue: isActiveDateInvalid ? prevState.referenceValue : fieldValueManager.updateReferenceValue(adapter, value, prevState.referenceValue),
|
|
330
331
|
tempValueStrAndroid: null
|
|
331
332
|
}));
|
|
332
333
|
}
|
|
@@ -14,7 +14,6 @@ var _PickersModalDialog = require("../../components/PickersModalDialog");
|
|
|
14
14
|
var _usePicker = require("../usePicker");
|
|
15
15
|
var _PickersLayout = require("../../../PickersLayout");
|
|
16
16
|
var _PickerProvider = require("../../components/PickerProvider");
|
|
17
|
-
var _PickerFieldUI = require("../../components/PickerFieldUI");
|
|
18
17
|
var _createNonRangePickerStepNavigation = require("../../utils/createNonRangePickerStepNavigation");
|
|
19
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
19
|
const _excluded = ["props", "steps"],
|
|
@@ -82,21 +81,20 @@ const useMobilePicker = _ref => {
|
|
|
82
81
|
'aria-labelledby': labelledById
|
|
83
82
|
}, innerSlotProps?.mobilePaper)
|
|
84
83
|
});
|
|
85
|
-
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.
|
|
86
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
84
|
+
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickerProvider.PickerProvider, (0, _extends2.default)({}, providerProps, {
|
|
85
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Field, (0, _extends2.default)({}, fieldProps, {
|
|
87
86
|
slots: slots,
|
|
88
87
|
slotProps: slotProps,
|
|
89
|
-
inputRef: inputRef
|
|
90
|
-
|
|
88
|
+
inputRef: inputRef
|
|
89
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickersModalDialog.PickersModalDialog, {
|
|
90
|
+
slots: slots,
|
|
91
|
+
slotProps: slotProps,
|
|
92
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Layout, (0, _extends2.default)({}, slotProps?.layout, {
|
|
91
93
|
slots: slots,
|
|
92
94
|
slotProps: slotProps,
|
|
93
|
-
children:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
children: renderCurrentView()
|
|
97
|
-
}))
|
|
98
|
-
})]
|
|
99
|
-
})
|
|
95
|
+
children: renderCurrentView()
|
|
96
|
+
}))
|
|
97
|
+
})]
|
|
100
98
|
}));
|
|
101
99
|
if (process.env.NODE_ENV !== "production") renderPicker.displayName = "renderPicker";
|
|
102
100
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.12.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The community edition of the MUI X Date and Time Picker components.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
41
|
"react-transition-group": "^4.4.5",
|
|
42
|
-
"@mui/x-internals": "8.
|
|
42
|
+
"@mui/x-internals": "8.12.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@emotion/react": "^11.9.0",
|