@mui/x-date-pickers-pro 9.0.0-alpha.2 → 9.0.0-alpha.4
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 +246 -1
- package/DateRangeCalendar/DateRangeCalendar.js +18 -15
- package/DateRangeCalendar/DateRangeCalendar.mjs +7 -4
- package/DateRangePickerDay/DateRangePickerDay.js +40 -37
- package/DateRangePickerDay/DateRangePickerDay.mjs +38 -35
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +8 -2
- package/MultiInputDateRangeField/MultiInputDateRangeField.mjs +8 -2
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +8 -2
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.mjs +8 -2
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +8 -2
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.mjs +8 -2
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
- package/SingleInputDateRangeField/SingleInputDateRangeField.mjs +4 -4
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.mjs +4 -4
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.mjs +4 -4
- package/hooks/useMultiInputRangeField/useMultiInputRangeField.js +4 -4
- package/hooks/useMultiInputRangeField/useMultiInputRangeField.mjs +4 -4
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.mts +4 -1
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.ts +4 -1
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js +5 -5
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.mjs +5 -5
- package/hooks/useMultiInputRangeField/useTextFieldProps.js +2 -2
- package/hooks/useMultiInputRangeField/useTextFieldProps.mjs +2 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -6
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.mjs +6 -2
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.mts +3 -4
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -4
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -6
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.mjs +6 -2
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.mts +3 -4
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -4
- package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.mts +1 -1
- package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.ts +1 -1
- package/models/fields.d.mts +10 -4
- package/models/fields.d.ts +10 -4
- package/package.json +4 -4
|
@@ -76,6 +76,10 @@ MultiInputDateRangeField.propTypes = {
|
|
|
76
76
|
* @default true
|
|
77
77
|
*/
|
|
78
78
|
enableAccessibleFieldDOMStructure: PropTypes.bool,
|
|
79
|
+
/**
|
|
80
|
+
* The ref object used to interact with the end field imperatively.
|
|
81
|
+
*/
|
|
82
|
+
endFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
79
83
|
/**
|
|
80
84
|
* Format of the date when rendered in the input(s).
|
|
81
85
|
*/
|
|
@@ -181,6 +185,10 @@ MultiInputDateRangeField.propTypes = {
|
|
|
181
185
|
* @default 0
|
|
182
186
|
*/
|
|
183
187
|
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
188
|
+
/**
|
|
189
|
+
* The ref object used to interact with the start field imperatively.
|
|
190
|
+
*/
|
|
191
|
+
startFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
184
192
|
style: PropTypes.object,
|
|
185
193
|
/**
|
|
186
194
|
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
|
@@ -194,8 +202,6 @@ MultiInputDateRangeField.propTypes = {
|
|
|
194
202
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
195
203
|
*/
|
|
196
204
|
timezone: PropTypes.string,
|
|
197
|
-
unstableEndFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
198
|
-
unstableStartFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
199
205
|
/**
|
|
200
206
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
201
207
|
*
|
|
@@ -90,6 +90,10 @@ MultiInputDateTimeRangeField.propTypes = {
|
|
|
90
90
|
* @default true
|
|
91
91
|
*/
|
|
92
92
|
enableAccessibleFieldDOMStructure: _propTypes.default.bool,
|
|
93
|
+
/**
|
|
94
|
+
* The ref object used to interact with the end field imperatively.
|
|
95
|
+
*/
|
|
96
|
+
endFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
93
97
|
/**
|
|
94
98
|
* Format of the date when rendered in the input(s).
|
|
95
99
|
*/
|
|
@@ -225,6 +229,10 @@ MultiInputDateTimeRangeField.propTypes = {
|
|
|
225
229
|
* @default 0
|
|
226
230
|
*/
|
|
227
231
|
spacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
|
|
232
|
+
/**
|
|
233
|
+
* The ref object used to interact with the start field imperatively.
|
|
234
|
+
*/
|
|
235
|
+
startFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
228
236
|
style: _propTypes.default.object,
|
|
229
237
|
/**
|
|
230
238
|
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
|
@@ -238,8 +246,6 @@ MultiInputDateTimeRangeField.propTypes = {
|
|
|
238
246
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
239
247
|
*/
|
|
240
248
|
timezone: _propTypes.default.string,
|
|
241
|
-
unstableEndFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
242
|
-
unstableStartFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
243
249
|
/**
|
|
244
250
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
245
251
|
*
|
|
@@ -86,6 +86,10 @@ MultiInputDateTimeRangeField.propTypes = {
|
|
|
86
86
|
* @default true
|
|
87
87
|
*/
|
|
88
88
|
enableAccessibleFieldDOMStructure: PropTypes.bool,
|
|
89
|
+
/**
|
|
90
|
+
* The ref object used to interact with the end field imperatively.
|
|
91
|
+
*/
|
|
92
|
+
endFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
89
93
|
/**
|
|
90
94
|
* Format of the date when rendered in the input(s).
|
|
91
95
|
*/
|
|
@@ -221,6 +225,10 @@ MultiInputDateTimeRangeField.propTypes = {
|
|
|
221
225
|
* @default 0
|
|
222
226
|
*/
|
|
223
227
|
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
228
|
+
/**
|
|
229
|
+
* The ref object used to interact with the start field imperatively.
|
|
230
|
+
*/
|
|
231
|
+
startFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
224
232
|
style: PropTypes.object,
|
|
225
233
|
/**
|
|
226
234
|
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
|
@@ -234,8 +242,6 @@ MultiInputDateTimeRangeField.propTypes = {
|
|
|
234
242
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
235
243
|
*/
|
|
236
244
|
timezone: PropTypes.string,
|
|
237
|
-
unstableEndFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
238
|
-
unstableStartFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
239
245
|
/**
|
|
240
246
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
241
247
|
*
|
|
@@ -91,6 +91,10 @@ MultiInputTimeRangeField.propTypes = {
|
|
|
91
91
|
* @default true
|
|
92
92
|
*/
|
|
93
93
|
enableAccessibleFieldDOMStructure: _propTypes.default.bool,
|
|
94
|
+
/**
|
|
95
|
+
* The ref object used to interact with the end field imperatively.
|
|
96
|
+
*/
|
|
97
|
+
endFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
94
98
|
/**
|
|
95
99
|
* Format of the date when rendered in the input(s).
|
|
96
100
|
*/
|
|
@@ -198,6 +202,10 @@ MultiInputTimeRangeField.propTypes = {
|
|
|
198
202
|
* @default 0
|
|
199
203
|
*/
|
|
200
204
|
spacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
|
|
205
|
+
/**
|
|
206
|
+
* The ref object used to interact with the start field imperatively.
|
|
207
|
+
*/
|
|
208
|
+
startFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
201
209
|
style: _propTypes.default.object,
|
|
202
210
|
/**
|
|
203
211
|
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
|
@@ -211,8 +219,6 @@ MultiInputTimeRangeField.propTypes = {
|
|
|
211
219
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
212
220
|
*/
|
|
213
221
|
timezone: _propTypes.default.string,
|
|
214
|
-
unstableEndFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
215
|
-
unstableStartFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
216
222
|
/**
|
|
217
223
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
218
224
|
*
|
|
@@ -87,6 +87,10 @@ MultiInputTimeRangeField.propTypes = {
|
|
|
87
87
|
* @default true
|
|
88
88
|
*/
|
|
89
89
|
enableAccessibleFieldDOMStructure: PropTypes.bool,
|
|
90
|
+
/**
|
|
91
|
+
* The ref object used to interact with the end field imperatively.
|
|
92
|
+
*/
|
|
93
|
+
endFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
90
94
|
/**
|
|
91
95
|
* Format of the date when rendered in the input(s).
|
|
92
96
|
*/
|
|
@@ -194,6 +198,10 @@ MultiInputTimeRangeField.propTypes = {
|
|
|
194
198
|
* @default 0
|
|
195
199
|
*/
|
|
196
200
|
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
|
201
|
+
/**
|
|
202
|
+
* The ref object used to interact with the start field imperatively.
|
|
203
|
+
*/
|
|
204
|
+
startFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
197
205
|
style: PropTypes.object,
|
|
198
206
|
/**
|
|
199
207
|
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
|
@@ -207,8 +215,6 @@ MultiInputTimeRangeField.propTypes = {
|
|
|
207
215
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
208
216
|
*/
|
|
209
217
|
timezone: PropTypes.string,
|
|
210
|
-
unstableEndFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
211
|
-
unstableStartFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
212
218
|
/**
|
|
213
219
|
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
|
|
214
220
|
*
|
|
@@ -114,6 +114,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
114
114
|
* @default true
|
|
115
115
|
*/
|
|
116
116
|
enableAccessibleFieldDOMStructure: _propTypes.default.bool,
|
|
117
|
+
/**
|
|
118
|
+
* The ref object used to imperatively interact with the field.
|
|
119
|
+
*/
|
|
120
|
+
fieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
117
121
|
/**
|
|
118
122
|
* If `true`, the component is displayed in focused state.
|
|
119
123
|
*/
|
|
@@ -309,10 +313,6 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
309
313
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
310
314
|
*/
|
|
311
315
|
timezone: _propTypes.default.string,
|
|
312
|
-
/**
|
|
313
|
-
* The ref object used to imperatively interact with the field.
|
|
314
|
-
*/
|
|
315
|
-
unstableFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
316
316
|
/**
|
|
317
317
|
* The selected value.
|
|
318
318
|
* Used when the component is controlled.
|
|
@@ -107,6 +107,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
107
107
|
* @default true
|
|
108
108
|
*/
|
|
109
109
|
enableAccessibleFieldDOMStructure: PropTypes.bool,
|
|
110
|
+
/**
|
|
111
|
+
* The ref object used to imperatively interact with the field.
|
|
112
|
+
*/
|
|
113
|
+
fieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
110
114
|
/**
|
|
111
115
|
* If `true`, the component is displayed in focused state.
|
|
112
116
|
*/
|
|
@@ -302,10 +306,6 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
|
|
|
302
306
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
303
307
|
*/
|
|
304
308
|
timezone: PropTypes.string,
|
|
305
|
-
/**
|
|
306
|
-
* The ref object used to imperatively interact with the field.
|
|
307
|
-
*/
|
|
308
|
-
unstableFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
309
309
|
/**
|
|
310
310
|
* The selected value.
|
|
311
311
|
* Used when the component is controlled.
|
|
@@ -124,6 +124,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
124
124
|
* @default true
|
|
125
125
|
*/
|
|
126
126
|
enableAccessibleFieldDOMStructure: _propTypes.default.bool,
|
|
127
|
+
/**
|
|
128
|
+
* The ref object used to imperatively interact with the field.
|
|
129
|
+
*/
|
|
130
|
+
fieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
127
131
|
/**
|
|
128
132
|
* If `true`, the component is displayed in focused state.
|
|
129
133
|
*/
|
|
@@ -349,10 +353,6 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
349
353
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
350
354
|
*/
|
|
351
355
|
timezone: _propTypes.default.string,
|
|
352
|
-
/**
|
|
353
|
-
* The ref object used to imperatively interact with the field.
|
|
354
|
-
*/
|
|
355
|
-
unstableFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
356
356
|
/**
|
|
357
357
|
* The selected value.
|
|
358
358
|
* Used when the component is controlled.
|
|
@@ -117,6 +117,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
117
117
|
* @default true
|
|
118
118
|
*/
|
|
119
119
|
enableAccessibleFieldDOMStructure: PropTypes.bool,
|
|
120
|
+
/**
|
|
121
|
+
* The ref object used to imperatively interact with the field.
|
|
122
|
+
*/
|
|
123
|
+
fieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
120
124
|
/**
|
|
121
125
|
* If `true`, the component is displayed in focused state.
|
|
122
126
|
*/
|
|
@@ -342,10 +346,6 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
|
|
|
342
346
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
343
347
|
*/
|
|
344
348
|
timezone: PropTypes.string,
|
|
345
|
-
/**
|
|
346
|
-
* The ref object used to imperatively interact with the field.
|
|
347
|
-
*/
|
|
348
|
-
unstableFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
349
349
|
/**
|
|
350
350
|
* The selected value.
|
|
351
351
|
* Used when the component is controlled.
|
|
@@ -124,6 +124,10 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
124
124
|
* @default true
|
|
125
125
|
*/
|
|
126
126
|
enableAccessibleFieldDOMStructure: _propTypes.default.bool,
|
|
127
|
+
/**
|
|
128
|
+
* The ref object used to imperatively interact with the field.
|
|
129
|
+
*/
|
|
130
|
+
fieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
127
131
|
/**
|
|
128
132
|
* If `true`, the component is displayed in focused state.
|
|
129
133
|
*/
|
|
@@ -321,10 +325,6 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
321
325
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
322
326
|
*/
|
|
323
327
|
timezone: _propTypes.default.string,
|
|
324
|
-
/**
|
|
325
|
-
* The ref object used to imperatively interact with the field.
|
|
326
|
-
*/
|
|
327
|
-
unstableFieldRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
328
328
|
/**
|
|
329
329
|
* The selected value.
|
|
330
330
|
* Used when the component is controlled.
|
|
@@ -117,6 +117,10 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
117
117
|
* @default true
|
|
118
118
|
*/
|
|
119
119
|
enableAccessibleFieldDOMStructure: PropTypes.bool,
|
|
120
|
+
/**
|
|
121
|
+
* The ref object used to imperatively interact with the field.
|
|
122
|
+
*/
|
|
123
|
+
fieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
120
124
|
/**
|
|
121
125
|
* If `true`, the component is displayed in focused state.
|
|
122
126
|
*/
|
|
@@ -314,10 +318,6 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
|
|
|
314
318
|
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
315
319
|
*/
|
|
316
320
|
timezone: PropTypes.string,
|
|
317
|
-
/**
|
|
318
|
-
* The ref object used to imperatively interact with the field.
|
|
319
|
-
*/
|
|
320
|
-
unstableFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
321
321
|
/**
|
|
322
322
|
* The selected value.
|
|
323
323
|
* Used when the component is controlled.
|
|
@@ -74,8 +74,8 @@ function useMultiInputRangeField(parameters) {
|
|
|
74
74
|
enableAccessibleFieldDOMStructure,
|
|
75
75
|
autoFocus,
|
|
76
76
|
referenceDate,
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
startFieldRef,
|
|
78
|
+
endFieldRef
|
|
79
79
|
} = internalPropsWithDefaults;
|
|
80
80
|
const {
|
|
81
81
|
value,
|
|
@@ -100,8 +100,8 @@ function useMultiInputRangeField(parameters) {
|
|
|
100
100
|
const selectedSectionsResponse = (0, _useMultiInputRangeFieldSelectedSections.useMultiInputRangeFieldSelectedSections)({
|
|
101
101
|
selectedSections,
|
|
102
102
|
onSelectedSectionsChange,
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
startFieldRef,
|
|
104
|
+
endFieldRef
|
|
105
105
|
});
|
|
106
106
|
const sharedInternalProps = {
|
|
107
107
|
disabled,
|
|
@@ -70,8 +70,8 @@ export function useMultiInputRangeField(parameters) {
|
|
|
70
70
|
enableAccessibleFieldDOMStructure,
|
|
71
71
|
autoFocus,
|
|
72
72
|
referenceDate,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
startFieldRef,
|
|
74
|
+
endFieldRef
|
|
75
75
|
} = internalPropsWithDefaults;
|
|
76
76
|
const {
|
|
77
77
|
value,
|
|
@@ -96,8 +96,8 @@ export function useMultiInputRangeField(parameters) {
|
|
|
96
96
|
const selectedSectionsResponse = useMultiInputRangeFieldSelectedSections({
|
|
97
97
|
selectedSections,
|
|
98
98
|
onSelectedSectionsChange,
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
startFieldRef,
|
|
100
|
+
endFieldRef
|
|
101
101
|
});
|
|
102
102
|
const sharedInternalProps = {
|
|
103
103
|
disabled,
|
|
@@ -4,7 +4,10 @@ import { FieldRef, FieldSelectedSections } from '@mui/x-date-pickers/models';
|
|
|
4
4
|
import { MultiInputFieldRefs } from "../../models/index.mjs";
|
|
5
5
|
interface UseMultiInputRangeFieldSelectedSectionsParameters extends Pick<UseFieldInternalProps<PickerRangeValue, any, any>, 'selectedSections' | 'onSelectedSectionsChange'>, MultiInputFieldRefs {}
|
|
6
6
|
export interface UseMultiInputFieldSelectedSectionsResponseItem {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The ref object used to imperatively interact with the field.
|
|
9
|
+
*/
|
|
10
|
+
fieldRef?: React.Ref<FieldRef<PickerValue>>;
|
|
8
11
|
selectedSections: FieldSelectedSections;
|
|
9
12
|
onSelectedSectionsChange: (newSelectedSections: FieldSelectedSections) => void;
|
|
10
13
|
}
|
|
@@ -4,7 +4,10 @@ import { FieldRef, FieldSelectedSections } from '@mui/x-date-pickers/models';
|
|
|
4
4
|
import { MultiInputFieldRefs } from "../../models/index.js";
|
|
5
5
|
interface UseMultiInputRangeFieldSelectedSectionsParameters extends Pick<UseFieldInternalProps<PickerRangeValue, any, any>, 'selectedSections' | 'onSelectedSectionsChange'>, MultiInputFieldRefs {}
|
|
6
6
|
export interface UseMultiInputFieldSelectedSectionsResponseItem {
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The ref object used to imperatively interact with the field.
|
|
9
|
+
*/
|
|
10
|
+
fieldRef?: React.Ref<FieldRef<PickerValue>>;
|
|
8
11
|
selectedSections: FieldSelectedSections;
|
|
9
12
|
onSelectedSectionsChange: (newSelectedSections: FieldSelectedSections) => void;
|
|
10
13
|
}
|
|
@@ -14,12 +14,12 @@ var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallb
|
|
|
14
14
|
* @ignore - internal hook.
|
|
15
15
|
*/
|
|
16
16
|
const useMultiInputRangeFieldSelectedSections = parameters => {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
17
|
+
const endFieldRef = React.useRef(null);
|
|
18
|
+
const handleEndFieldRef = (0, _useForkRef.default)(parameters.endFieldRef, endFieldRef);
|
|
19
19
|
const [startSelectedSection, setStartSelectedSection] = React.useState(parameters.selectedSections ?? null);
|
|
20
20
|
const [endSelectedSection, setEndSelectedSection] = React.useState(null);
|
|
21
21
|
const getActiveField = () => {
|
|
22
|
-
if (
|
|
22
|
+
if (endFieldRef.current && endFieldRef.current.isFieldFocused()) {
|
|
23
23
|
return 'end';
|
|
24
24
|
}
|
|
25
25
|
return 'start';
|
|
@@ -39,12 +39,12 @@ const useMultiInputRangeFieldSelectedSections = parameters => {
|
|
|
39
39
|
const activeField = getActiveField();
|
|
40
40
|
return {
|
|
41
41
|
start: {
|
|
42
|
-
|
|
42
|
+
fieldRef: parameters.startFieldRef,
|
|
43
43
|
selectedSections: activeField === 'start' && parameters.selectedSections !== undefined ? parameters.selectedSections : startSelectedSection,
|
|
44
44
|
onSelectedSectionsChange: handleStartSelectedSectionChange
|
|
45
45
|
},
|
|
46
46
|
end: {
|
|
47
|
-
|
|
47
|
+
fieldRef: handleEndFieldRef,
|
|
48
48
|
selectedSections: activeField === 'end' && parameters.selectedSections !== undefined ? parameters.selectedSections : endSelectedSection,
|
|
49
49
|
onSelectedSectionsChange: handleEndSelectedSectionChange
|
|
50
50
|
}
|
|
@@ -7,12 +7,12 @@ import useEventCallback from '@mui/utils/useEventCallback';
|
|
|
7
7
|
* @ignore - internal hook.
|
|
8
8
|
*/
|
|
9
9
|
export const useMultiInputRangeFieldSelectedSections = parameters => {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const endFieldRef = React.useRef(null);
|
|
11
|
+
const handleEndFieldRef = useForkRef(parameters.endFieldRef, endFieldRef);
|
|
12
12
|
const [startSelectedSection, setStartSelectedSection] = React.useState(parameters.selectedSections ?? null);
|
|
13
13
|
const [endSelectedSection, setEndSelectedSection] = React.useState(null);
|
|
14
14
|
const getActiveField = () => {
|
|
15
|
-
if (
|
|
15
|
+
if (endFieldRef.current && endFieldRef.current.isFieldFocused()) {
|
|
16
16
|
return 'end';
|
|
17
17
|
}
|
|
18
18
|
return 'start';
|
|
@@ -32,12 +32,12 @@ export const useMultiInputRangeFieldSelectedSections = parameters => {
|
|
|
32
32
|
const activeField = getActiveField();
|
|
33
33
|
return {
|
|
34
34
|
start: {
|
|
35
|
-
|
|
35
|
+
fieldRef: parameters.startFieldRef,
|
|
36
36
|
selectedSections: activeField === 'start' && parameters.selectedSections !== undefined ? parameters.selectedSections : startSelectedSection,
|
|
37
37
|
onSelectedSectionsChange: handleStartSelectedSectionChange
|
|
38
38
|
},
|
|
39
39
|
end: {
|
|
40
|
-
|
|
40
|
+
fieldRef: handleEndFieldRef,
|
|
41
41
|
selectedSections: activeField === 'end' && parameters.selectedSections !== undefined ? parameters.selectedSections : endSelectedSection,
|
|
42
42
|
onSelectedSectionsChange: handleEndSelectedSectionChange
|
|
43
43
|
}
|
|
@@ -121,8 +121,8 @@ function useTextFieldProps(parameters) {
|
|
|
121
121
|
if (!pickerContext?.open || pickerContext?.variant === 'mobile') {
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
|
-
fieldPrivateContext?.fieldRef
|
|
125
|
-
if (!fieldPrivateContext?.fieldRef
|
|
124
|
+
fieldPrivateContext?.fieldRef?.current?.focusField();
|
|
125
|
+
if (!fieldPrivateContext?.fieldRef?.current || pickerContext.view === pickerContext.initialView) {
|
|
126
126
|
// could happen when the user is switching between the inputs
|
|
127
127
|
previousRangePosition.current = rangePosition;
|
|
128
128
|
return;
|
|
@@ -114,8 +114,8 @@ export function useTextFieldProps(parameters) {
|
|
|
114
114
|
if (!pickerContext?.open || pickerContext?.variant === 'mobile') {
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
fieldPrivateContext?.fieldRef
|
|
118
|
-
if (!fieldPrivateContext?.fieldRef
|
|
117
|
+
fieldPrivateContext?.fieldRef?.current?.focusField();
|
|
118
|
+
if (!fieldPrivateContext?.fieldRef?.current || pickerContext.view === pickerContext.initialView) {
|
|
119
119
|
// could happen when the user is switching between the inputs
|
|
120
120
|
previousRangePosition.current = rangePosition;
|
|
121
121
|
return;
|
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -9,9 +9,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var _useSlotProps2 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
11
11
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
12
|
-
var
|
|
12
|
+
var _internals = require("@mui/x-license/internals");
|
|
13
13
|
var _PickersLayout = require("@mui/x-date-pickers/PickersLayout");
|
|
14
|
-
var
|
|
14
|
+
var _internals2 = require("@mui/x-date-pickers/internals");
|
|
15
15
|
var _useRangePosition = require("../useRangePosition");
|
|
16
16
|
var _usePickerRangePositionContext = require("../../../hooks/usePickerRangePositionContext");
|
|
17
17
|
var _dateFieldsUtils = require("../../utils/date-fields-utils");
|
|
@@ -25,7 +25,11 @@ const useDesktopRangePicker = _ref => {
|
|
|
25
25
|
steps
|
|
26
26
|
} = _ref,
|
|
27
27
|
pickerParams = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
28
|
-
(0,
|
|
28
|
+
(0, _internals.useLicenseVerifier)({
|
|
29
|
+
releaseDate: "MTc3Mzk2NDgwMDAwMA==",
|
|
30
|
+
version: "9.0.0-alpha.4",
|
|
31
|
+
name: 'x-date-pickers-pro'
|
|
32
|
+
});
|
|
29
33
|
const {
|
|
30
34
|
slots,
|
|
31
35
|
slotProps,
|
|
@@ -47,7 +51,7 @@ const useDesktopRangePicker = _ref => {
|
|
|
47
51
|
providerProps,
|
|
48
52
|
renderCurrentView,
|
|
49
53
|
ownerState
|
|
50
|
-
} = (0,
|
|
54
|
+
} = (0, _internals2.usePicker)((0, _extends2.default)({}, pickerParams, {
|
|
51
55
|
props,
|
|
52
56
|
variant: 'desktop',
|
|
53
57
|
autoFocusView: viewContainerRole === 'dialog',
|
|
@@ -67,7 +71,7 @@ const useDesktopRangePicker = _ref => {
|
|
|
67
71
|
}),
|
|
68
72
|
fieldProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded2);
|
|
69
73
|
const Layout = slots?.layout ?? _PickersLayout.PickersLayout;
|
|
70
|
-
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
74
|
+
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals2.PickerProvider, (0, _extends2.default)({}, providerProps, {
|
|
71
75
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_usePickerRangePositionContext.PickerRangePositionContext.Provider, {
|
|
72
76
|
value: rangePositionResponse,
|
|
73
77
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Field, (0, _extends2.default)({}, fieldProps, {
|
|
@@ -75,7 +79,7 @@ const useDesktopRangePicker = _ref => {
|
|
|
75
79
|
slotProps: (0, _extends2.default)({}, slotProps, fieldProps.slotProps)
|
|
76
80
|
}, isSingleInput && {
|
|
77
81
|
inputRef
|
|
78
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
82
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals2.PickerPopper, {
|
|
79
83
|
slots: slots,
|
|
80
84
|
slotProps: slotProps,
|
|
81
85
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Layout, (0, _extends2.default)({}, slotProps?.layout, {
|
|
@@ -4,7 +4,7 @@ const _excluded = ["props", "steps"],
|
|
|
4
4
|
_excluded2 = ["ownerState"];
|
|
5
5
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
|
-
import { useLicenseVerifier } from '@mui/x-license/
|
|
7
|
+
import { useLicenseVerifier } from '@mui/x-license/internals';
|
|
8
8
|
import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
|
|
9
9
|
import { usePicker, PickerPopper, PickerProvider } from '@mui/x-date-pickers/internals';
|
|
10
10
|
import { useRangePosition } from "../useRangePosition.mjs";
|
|
@@ -18,7 +18,11 @@ export const useDesktopRangePicker = _ref => {
|
|
|
18
18
|
steps
|
|
19
19
|
} = _ref,
|
|
20
20
|
pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
|
-
useLicenseVerifier(
|
|
21
|
+
useLicenseVerifier({
|
|
22
|
+
releaseDate: "MTc3Mzk2NDgwMDAwMA==",
|
|
23
|
+
version: "9.0.0-alpha.4",
|
|
24
|
+
name: 'x-date-pickers-pro'
|
|
25
|
+
});
|
|
22
26
|
const {
|
|
23
27
|
slots,
|
|
24
28
|
slotProps,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
2
|
-
import {
|
|
2
|
+
import { PickerOwnerState } from '@mui/x-date-pickers/models';
|
|
3
3
|
import { PickerPopperSlots, PickerPopperSlotProps, UsePickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue, PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { ExportedPickersLayoutSlotProps, ExportedPickersLayoutSlots } from '@mui/x-date-pickers/PickersLayout';
|
|
5
5
|
import { NonStaticRangePickerProps, NonStaticRangePickerHookParameters, UseRangePickerProps } from "../../models/index.mjs";
|
|
6
|
+
import { PickerRangeFieldSlotProps } from "../../../models/index.mjs";
|
|
6
7
|
export interface UseDesktopRangePickerSlots extends PickerPopperSlots, ExportedPickersLayoutSlots<PickerRangeValue>, PickerFieldUISlotsFromContext {
|
|
7
8
|
/**
|
|
8
9
|
* Component used to enter the date with the keyboard.
|
|
@@ -10,9 +11,7 @@ export interface UseDesktopRangePickerSlots extends PickerPopperSlots, ExportedP
|
|
|
10
11
|
field: React.ElementType;
|
|
11
12
|
}
|
|
12
13
|
export interface UseDesktopRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends PickerPopperSlotProps, ExportedPickersLayoutSlotProps<PickerRangeValue>, PickerFieldUISlotPropsFromContext {
|
|
13
|
-
field?: SlotComponentPropsFromProps<
|
|
14
|
-
dateSeparator?: string;
|
|
15
|
-
}, {}, PickerOwnerState>;
|
|
14
|
+
field?: SlotComponentPropsFromProps<PickerRangeFieldSlotProps<TEnableAccessibleFieldDOMStructure>, {}, PickerOwnerState>;
|
|
16
15
|
}
|
|
17
16
|
export interface DesktopRangeOnlyPickerProps extends NonStaticRangePickerProps {
|
|
18
17
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
2
|
-
import {
|
|
2
|
+
import { PickerOwnerState } from '@mui/x-date-pickers/models';
|
|
3
3
|
import { PickerPopperSlots, PickerPopperSlotProps, UsePickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue, PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from '@mui/x-date-pickers/internals';
|
|
4
4
|
import { ExportedPickersLayoutSlotProps, ExportedPickersLayoutSlots } from '@mui/x-date-pickers/PickersLayout';
|
|
5
5
|
import { NonStaticRangePickerProps, NonStaticRangePickerHookParameters, UseRangePickerProps } from "../../models/index.js";
|
|
6
|
+
import { PickerRangeFieldSlotProps } from "../../../models/index.js";
|
|
6
7
|
export interface UseDesktopRangePickerSlots extends PickerPopperSlots, ExportedPickersLayoutSlots<PickerRangeValue>, PickerFieldUISlotsFromContext {
|
|
7
8
|
/**
|
|
8
9
|
* Component used to enter the date with the keyboard.
|
|
@@ -10,9 +11,7 @@ export interface UseDesktopRangePickerSlots extends PickerPopperSlots, ExportedP
|
|
|
10
11
|
field: React.ElementType;
|
|
11
12
|
}
|
|
12
13
|
export interface UseDesktopRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends PickerPopperSlotProps, ExportedPickersLayoutSlotProps<PickerRangeValue>, PickerFieldUISlotPropsFromContext {
|
|
13
|
-
field?: SlotComponentPropsFromProps<
|
|
14
|
-
dateSeparator?: string;
|
|
15
|
-
}, {}, PickerOwnerState>;
|
|
14
|
+
field?: SlotComponentPropsFromProps<PickerRangeFieldSlotProps<TEnableAccessibleFieldDOMStructure>, {}, PickerOwnerState>;
|
|
16
15
|
}
|
|
17
16
|
export interface DesktopRangeOnlyPickerProps extends NonStaticRangePickerProps {
|
|
18
17
|
/**
|
|
@@ -10,9 +10,9 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
10
10
|
var _useSlotProps2 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
11
11
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
12
12
|
var _resolveComponentProps = _interopRequireDefault(require("@mui/utils/resolveComponentProps"));
|
|
13
|
-
var
|
|
13
|
+
var _internals = require("@mui/x-license/internals");
|
|
14
14
|
var _PickersLayout = require("@mui/x-date-pickers/PickersLayout");
|
|
15
|
-
var
|
|
15
|
+
var _internals2 = require("@mui/x-date-pickers/internals");
|
|
16
16
|
var _hooks = require("@mui/x-date-pickers/hooks");
|
|
17
17
|
var _useRangePosition = require("../useRangePosition");
|
|
18
18
|
var _usePickerRangePositionContext = require("../../../hooks/usePickerRangePositionContext");
|
|
@@ -27,7 +27,11 @@ const useMobileRangePicker = _ref => {
|
|
|
27
27
|
steps
|
|
28
28
|
} = _ref,
|
|
29
29
|
pickerParams = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
30
|
-
(0,
|
|
30
|
+
(0, _internals.useLicenseVerifier)({
|
|
31
|
+
releaseDate: "MTc3Mzk2NDgwMDAwMA==",
|
|
32
|
+
version: "9.0.0-alpha.4",
|
|
33
|
+
name: 'x-date-pickers-pro'
|
|
34
|
+
});
|
|
31
35
|
const {
|
|
32
36
|
slots,
|
|
33
37
|
slotProps: innerSlotProps,
|
|
@@ -47,7 +51,7 @@ const useMobileRangePicker = _ref => {
|
|
|
47
51
|
providerProps,
|
|
48
52
|
renderCurrentView,
|
|
49
53
|
ownerState
|
|
50
|
-
} = (0,
|
|
54
|
+
} = (0, _internals2.usePicker)((0, _extends2.default)({}, pickerParams, {
|
|
51
55
|
props,
|
|
52
56
|
variant: 'mobile',
|
|
53
57
|
autoFocusView: true,
|
|
@@ -99,7 +103,7 @@ const useMobileRangePicker = _ref => {
|
|
|
99
103
|
});
|
|
100
104
|
}
|
|
101
105
|
});
|
|
102
|
-
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
106
|
+
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals2.PickerProvider, (0, _extends2.default)({}, providerProps, {
|
|
103
107
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_usePickerRangePositionContext.PickerRangePositionContext.Provider, {
|
|
104
108
|
value: rangePositionResponse,
|
|
105
109
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Field, (0, _extends2.default)({}, fieldProps, {
|
|
@@ -107,7 +111,7 @@ const useMobileRangePicker = _ref => {
|
|
|
107
111
|
slotProps: (0, _extends2.default)({}, slotProps, fieldProps.slotProps)
|
|
108
112
|
}, isSingleInput && {
|
|
109
113
|
inputRef
|
|
110
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
114
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals2.PickersModalDialog, {
|
|
111
115
|
slots: slots,
|
|
112
116
|
slotProps: slotProps,
|
|
113
117
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Layout, (0, _extends2.default)({}, slotProps?.layout, {
|