@mui/x-date-pickers 7.0.0-alpha.6 → 7.0.0-alpha.8
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/AdapterDateFns/AdapterDateFns.d.ts +4 -21
- package/AdapterDateFns/AdapterDateFns.js +11 -255
- package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +62 -0
- package/AdapterDateFnsBase/AdapterDateFnsBase.js +291 -0
- package/AdapterDateFnsBase/index.d.ts +1 -0
- package/AdapterDateFnsBase/index.js +1 -0
- package/AdapterDateFnsBase/package.json +6 -0
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +80 -0
- package/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
- package/AdapterDateFnsV3/index.d.ts +1 -0
- package/AdapterDateFnsV3/index.js +1 -0
- package/AdapterDateFnsV3/package.json +6 -0
- package/CHANGELOG.md +357 -49
- package/DateCalendar/DateCalendar.js +6 -4
- package/DateCalendar/DateCalendar.types.d.ts +0 -8
- package/DatePicker/DatePickerToolbar.d.ts +2 -2
- package/DatePicker/DatePickerToolbar.js +2 -7
- package/DigitalClock/DigitalClock.js +4 -2
- package/DigitalClock/DigitalClock.types.d.ts +5 -0
- package/LocalizationProvider/LocalizationProvider.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +10 -13
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +5 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/PickersSectionList/PickersSectionList.js +1 -1
- package/TimeClock/TimeClock.js +4 -2
- package/TimeClock/TimeClock.types.d.ts +5 -0
- package/hooks/useClearableField.js +3 -3
- package/index.js +1 -1
- package/internals/components/PickersInput/PickersFilledInput.js +2 -2
- package/internals/components/PickersInput/PickersInput.d.ts +2 -4
- package/internals/components/PickersInput/PickersInput.js +2 -3
- package/internals/components/PickersInput/PickersStandardInput.js +2 -2
- package/internals/hooks/useField/useField.utils.js +5 -5
- package/internals/hooks/usePicker/index.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/internals/hooks/useUtils.js +2 -2
- package/internals/hooks/useViews.d.ts +4 -4
- package/internals/hooks/useViews.js +15 -15
- package/internals/index.d.ts +9 -3
- package/internals/index.js +6 -2
- package/internals/models/common.d.ts +1 -1
- package/internals/models/helpers.d.ts +1 -0
- package/internals/models/props/clock.d.ts +0 -9
- package/internals/utils/views.js +1 -1
- package/legacy/AdapterDateFns/AdapterDateFns.js +222 -458
- package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +293 -0
- package/legacy/AdapterDateFnsBase/index.js +1 -0
- package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +306 -0
- package/legacy/AdapterDateFnsV3/index.js +1 -0
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -6
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -6
- package/legacy/DateCalendar/DateCalendar.js +6 -4
- package/legacy/DatePicker/DatePickerToolbar.js +2 -7
- package/legacy/DigitalClock/DigitalClock.js +4 -2
- package/legacy/LocalizationProvider/LocalizationProvider.js +1 -1
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +10 -13
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/legacy/PickersSectionList/PickersSectionList.js +1 -1
- package/legacy/TimeClock/TimeClock.js +4 -2
- package/legacy/hooks/useClearableField.js +3 -3
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersInput/PickersFilledInput.js +2 -2
- package/legacy/internals/components/PickersInput/PickersInput.js +2 -3
- package/legacy/internals/components/PickersInput/PickersStandardInput.js +2 -2
- package/legacy/internals/hooks/useField/useField.utils.js +5 -5
- package/legacy/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/legacy/internals/hooks/useUtils.js +2 -2
- package/legacy/internals/hooks/useViews.js +15 -15
- package/legacy/internals/index.js +6 -2
- package/legacy/internals/utils/views.js +1 -1
- package/legacy/locales/index.js +1 -0
- package/locales/enUS.d.ts +1 -1
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/mk.d.ts +1 -1
- package/locales/utils/getPickersLocalization.d.ts +1 -1
- package/modern/AdapterDateFns/AdapterDateFns.js +11 -254
- package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +290 -0
- package/modern/AdapterDateFnsBase/index.js +1 -0
- package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
- package/modern/AdapterDateFnsV3/index.js +1 -0
- package/modern/DateCalendar/DateCalendar.js +6 -4
- package/modern/DatePicker/DatePickerToolbar.js +2 -7
- package/modern/DigitalClock/DigitalClock.js +4 -2
- package/modern/LocalizationProvider/LocalizationProvider.js +1 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +10 -13
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/modern/PickersSectionList/PickersSectionList.js +1 -1
- package/modern/TimeClock/TimeClock.js +4 -2
- package/modern/hooks/useClearableField.js +3 -3
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersInput/PickersFilledInput.js +2 -2
- package/modern/internals/components/PickersInput/PickersInput.js +2 -3
- package/modern/internals/components/PickersInput/PickersStandardInput.js +2 -2
- package/modern/internals/hooks/useField/useField.utils.js +5 -5
- package/modern/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/modern/internals/hooks/useUtils.js +2 -2
- package/modern/internals/hooks/useViews.js +15 -15
- package/modern/internals/index.js +6 -2
- package/modern/internals/utils/views.js +1 -1
- package/modern/locales/index.js +1 -0
- package/node/AdapterDateFns/AdapterDateFns.js +11 -254
- package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +298 -0
- package/node/AdapterDateFnsBase/index.js +12 -0
- package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +295 -0
- package/node/AdapterDateFnsV3/index.js +12 -0
- package/node/DateCalendar/DateCalendar.js +6 -4
- package/node/DatePicker/DatePickerToolbar.js +0 -4
- package/node/DigitalClock/DigitalClock.js +4 -2
- package/node/LocalizationProvider/LocalizationProvider.js +1 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +10 -13
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/node/PickersSectionList/PickersSectionList.js +1 -1
- package/node/TimeClock/TimeClock.js +4 -2
- package/node/hooks/useClearableField.js +3 -3
- package/node/index.js +1 -1
- package/node/internals/components/PickersInput/PickersFilledInput.js +2 -2
- package/node/internals/components/PickersInput/PickersInput.js +2 -3
- package/node/internals/components/PickersInput/PickersStandardInput.js +2 -2
- package/node/internals/hooks/useField/useField.utils.js +5 -5
- package/node/internals/hooks/usePicker/usePickerValue.js +2 -2
- package/node/internals/hooks/useUtils.js +2 -2
- package/node/internals/hooks/useViews.js +15 -15
- package/node/internals/index.js +47 -1
- package/node/internals/utils/views.js +1 -1
- package/node/locales/index.js +11 -0
- package/package.json +6 -6
|
@@ -131,7 +131,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
131
131
|
}, [ampm, inViews]);
|
|
132
132
|
const {
|
|
133
133
|
view,
|
|
134
|
-
|
|
134
|
+
setValueAndGoToNextView,
|
|
135
135
|
focusedView
|
|
136
136
|
} = (0, _useViews.useViews)({
|
|
137
137
|
view: inView,
|
|
@@ -143,7 +143,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
143
143
|
onFocusedViewChange
|
|
144
144
|
});
|
|
145
145
|
const handleMeridiemValueChange = (0, _useEventCallback.default)(newValue => {
|
|
146
|
-
|
|
146
|
+
setValueAndGoToNextView(newValue, 'finish', 'meridiem');
|
|
147
147
|
});
|
|
148
148
|
const {
|
|
149
149
|
meridiemMode,
|
|
@@ -224,11 +224,6 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
224
224
|
throw new Error('not supported');
|
|
225
225
|
}
|
|
226
226
|
}, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableTime, utils, disableFuture, disablePast, now, views]);
|
|
227
|
-
const handleSectionChange = (0, _useEventCallback.default)((sectionView, newValue) => {
|
|
228
|
-
const viewIndex = views.indexOf(sectionView);
|
|
229
|
-
const nextView = views[viewIndex + 1];
|
|
230
|
-
setValueAndGoToView(newValue, nextView, sectionView);
|
|
231
|
-
});
|
|
232
227
|
const buildViewProps = React.useCallback(viewToBuild => {
|
|
233
228
|
switch (viewToBuild) {
|
|
234
229
|
case 'hours':
|
|
@@ -236,7 +231,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
236
231
|
return {
|
|
237
232
|
onChange: hours => {
|
|
238
233
|
const valueWithMeridiem = (0, _timeUtils.convertValueToMeridiem)(hours, meridiemMode, ampm);
|
|
239
|
-
|
|
234
|
+
setValueAndGoToNextView(utils.setHours(valueOrReferenceDate, valueWithMeridiem), 'finish', 'hours');
|
|
240
235
|
},
|
|
241
236
|
items: (0, _MultiSectionDigitalClock.getHourSectionOptions)({
|
|
242
237
|
now,
|
|
@@ -254,7 +249,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
254
249
|
{
|
|
255
250
|
return {
|
|
256
251
|
onChange: minutes => {
|
|
257
|
-
|
|
252
|
+
setValueAndGoToNextView(utils.setMinutes(valueOrReferenceDate, minutes), 'finish', 'minutes');
|
|
258
253
|
},
|
|
259
254
|
items: (0, _MultiSectionDigitalClock.getTimeSectionOptions)({
|
|
260
255
|
value: utils.getMinutes(valueOrReferenceDate),
|
|
@@ -271,7 +266,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
271
266
|
{
|
|
272
267
|
return {
|
|
273
268
|
onChange: seconds => {
|
|
274
|
-
|
|
269
|
+
setValueAndGoToNextView(utils.setSeconds(valueOrReferenceDate, seconds), 'finish', 'seconds');
|
|
275
270
|
},
|
|
276
271
|
items: (0, _MultiSectionDigitalClock.getTimeSectionOptions)({
|
|
277
272
|
value: utils.getSeconds(valueOrReferenceDate),
|
|
@@ -308,7 +303,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
308
303
|
default:
|
|
309
304
|
throw new Error(`Unknown view: ${viewToBuild} found.`);
|
|
310
305
|
}
|
|
311
|
-
}, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, localeText.hoursClockNumberText, localeText.minutesClockNumberText, localeText.secondsClockNumberText, meridiemMode,
|
|
306
|
+
}, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, localeText.hoursClockNumberText, localeText.minutesClockNumberText, localeText.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, disabled, isTimeDisabled, handleMeridiemChange]);
|
|
312
307
|
const viewTimeOptions = React.useMemo(() => {
|
|
313
308
|
return views.reduce((result, currentView) => {
|
|
314
309
|
return (0, _extends2.default)({}, result, {
|
|
@@ -406,8 +401,9 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
|
|
|
406
401
|
minutesStep: _propTypes.default.number,
|
|
407
402
|
/**
|
|
408
403
|
* Callback fired when the value changes.
|
|
409
|
-
* @template
|
|
410
|
-
* @
|
|
404
|
+
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
405
|
+
* @template TView The view type. Will be one of date or time views.
|
|
406
|
+
* @param {TValue} value The new value.
|
|
411
407
|
* @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
|
|
412
408
|
* @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
|
|
413
409
|
*/
|
|
@@ -499,6 +495,7 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
|
|
|
499
495
|
view: _propTypes.default.oneOf(['hours', 'meridiem', 'minutes', 'seconds']),
|
|
500
496
|
/**
|
|
501
497
|
* Available views.
|
|
498
|
+
* @default ['hours', 'minutes']
|
|
502
499
|
*/
|
|
503
500
|
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['hours', 'meridiem', 'minutes', 'seconds']).isRequired)
|
|
504
501
|
} : void 0;
|
|
@@ -56,7 +56,7 @@ const MultiSectionDigitalClockSectionRoot = (0, _styles.styled)(_MenuList.defaul
|
|
|
56
56
|
'&:not(:first-of-type)': {
|
|
57
57
|
borderLeft: `1px solid ${(theme.vars || theme).palette.divider}`
|
|
58
58
|
},
|
|
59
|
-
'
|
|
59
|
+
'&::after': {
|
|
60
60
|
display: 'block',
|
|
61
61
|
content: '""',
|
|
62
62
|
// subtracting the height of one item, extra margin and borders to make sure the max height is correct
|
|
@@ -125,17 +125,13 @@ const MultiSectionDigitalClockSection = exports.MultiSectionDigitalClockSection
|
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
const activeItem = containerRef.current.querySelector('[role="option"][tabindex="0"], [role="option"][aria-selected="true"]');
|
|
128
|
+
if (active && autoFocus && activeItem) {
|
|
129
|
+
activeItem.focus();
|
|
130
|
+
}
|
|
128
131
|
if (!activeItem || previousActive.current === activeItem) {
|
|
129
|
-
// Handle setting the ref to null if the selected item is ever reset via UI
|
|
130
|
-
if (previousActive.current !== activeItem) {
|
|
131
|
-
previousActive.current = activeItem;
|
|
132
|
-
}
|
|
133
132
|
return;
|
|
134
133
|
}
|
|
135
134
|
previousActive.current = activeItem;
|
|
136
|
-
if (active && autoFocus) {
|
|
137
|
-
activeItem.focus();
|
|
138
|
-
}
|
|
139
135
|
const offsetTop = activeItem.offsetTop;
|
|
140
136
|
|
|
141
137
|
// Subtracting the 4px of extra margin intended for the first visible section item
|
|
@@ -125,7 +125,7 @@ const PickersSectionList = exports.PickersSectionList = /*#__PURE__*/React.forwa
|
|
|
125
125
|
const handleRootRef = (0, _useForkRef.default)(ref, rootRef);
|
|
126
126
|
const getRoot = methodName => {
|
|
127
127
|
if (!rootRef.current) {
|
|
128
|
-
throw new Error(`MUI: Cannot call sectionListRef.${methodName} before the mount of the component
|
|
128
|
+
throw new Error(`MUI X: Cannot call sectionListRef.${methodName} before the mount of the component.`);
|
|
129
129
|
}
|
|
130
130
|
return rootRef.current;
|
|
131
131
|
};
|
|
@@ -391,8 +391,9 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
391
391
|
minutesStep: _propTypes.default.number,
|
|
392
392
|
/**
|
|
393
393
|
* Callback fired when the value changes.
|
|
394
|
-
* @template
|
|
395
|
-
* @
|
|
394
|
+
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
395
|
+
* @template TView The view type. Will be one of date or time views.
|
|
396
|
+
* @param {TValue} value The new value.
|
|
396
397
|
* @param {PickerSelectionState | undefined} selectionState Indicates if the date selection is complete.
|
|
397
398
|
* @param {TView | undefined} selectedView Indicates the view in which the selection has been made.
|
|
398
399
|
*/
|
|
@@ -470,6 +471,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
470
471
|
view: _propTypes.default.oneOf(['hours', 'minutes', 'seconds']),
|
|
471
472
|
/**
|
|
472
473
|
* Available views.
|
|
474
|
+
* @default ['hours', 'minutes']
|
|
473
475
|
*/
|
|
474
476
|
views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['hours', 'minutes', 'seconds']).isRequired)
|
|
475
477
|
} : void 0;
|
|
@@ -49,8 +49,8 @@ const useClearableField = props => {
|
|
|
49
49
|
});
|
|
50
50
|
return (0, _extends2.default)({}, other, {
|
|
51
51
|
InputProps: (0, _extends2.default)({}, InputProps, {
|
|
52
|
-
endAdornment:
|
|
53
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAdornment.default, {
|
|
52
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
53
|
+
children: [clearable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAdornment.default, {
|
|
54
54
|
position: "end",
|
|
55
55
|
sx: {
|
|
56
56
|
marginRight: InputProps?.endAdornment ? -1 : -1.5
|
|
@@ -62,7 +62,7 @@ const useClearableField = props => {
|
|
|
62
62
|
}, endClearIconProps))
|
|
63
63
|
}))
|
|
64
64
|
}), InputProps?.endAdornment]
|
|
65
|
-
})
|
|
65
|
+
})
|
|
66
66
|
}),
|
|
67
67
|
sx: [{
|
|
68
68
|
'& .clearButton': {
|
package/node/index.js
CHANGED
|
@@ -52,7 +52,7 @@ const FilledInputRoot = (0, _styles.styled)(_PickersInput.PickersInputRoot, {
|
|
|
52
52
|
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.disabledBg : disabledBackground
|
|
53
53
|
}
|
|
54
54
|
}, !ownerState.disableUnderline && {
|
|
55
|
-
'
|
|
55
|
+
'&::after': {
|
|
56
56
|
borderBottom: `2px solid ${(theme.vars || theme).palette[ownerState.color || 'primary']?.main}`,
|
|
57
57
|
left: 0,
|
|
58
58
|
bottom: 0,
|
|
@@ -77,7 +77,7 @@ const FilledInputRoot = (0, _styles.styled)(_PickersInput.PickersInputRoot, {
|
|
|
77
77
|
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
'
|
|
80
|
+
'&::before': {
|
|
81
81
|
borderBottom: `1px solid ${theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})` : bottomLineColor}`,
|
|
82
82
|
left: 0,
|
|
83
83
|
bottom: 0,
|
|
@@ -8,7 +8,6 @@ exports.PickersInputSectionsContainer = exports.PickersInputRoot = exports.Picke
|
|
|
8
8
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
12
11
|
var _FormControl = require("@mui/material/FormControl");
|
|
13
12
|
var _styles = require("@mui/material/styles");
|
|
14
13
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
@@ -22,7 +21,7 @@ const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "
|
|
|
22
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
23
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
23
|
const round = value => Math.round(value * 1e5) / 1e5;
|
|
25
|
-
const PickersInputRoot = exports.PickersInputRoot = (0, _styles.styled)(
|
|
24
|
+
const PickersInputRoot = exports.PickersInputRoot = (0, _styles.styled)('div', {
|
|
26
25
|
name: 'MuiPickersInput',
|
|
27
26
|
slot: 'Root',
|
|
28
27
|
overridesResolver: (props, styles) => styles.root
|
|
@@ -168,7 +167,7 @@ const PickersInput = exports.PickersInput = /*#__PURE__*/React.forwardRef(functi
|
|
|
168
167
|
const handleInputRef = (0, _useForkRef.default)(inputProps?.ref, inputRef);
|
|
169
168
|
const muiFormControl = (0, _FormControl.useFormControl)();
|
|
170
169
|
if (!muiFormControl) {
|
|
171
|
-
throw new Error('MUI: PickersInput should always be used inside a PickersTextField component');
|
|
170
|
+
throw new Error('MUI X: PickersInput should always be used inside a PickersTextField component');
|
|
172
171
|
}
|
|
173
172
|
const handleInputFocus = event => {
|
|
174
173
|
// Fix a bug with IE11 where the focus/blur events are triggered
|
|
@@ -35,7 +35,7 @@ const StandardInputRoot = (0, _styles.styled)(_PickersInput.PickersInputRoot, {
|
|
|
35
35
|
marginTop: 16
|
|
36
36
|
}
|
|
37
37
|
}, !ownerState.disableUnderline && {
|
|
38
|
-
'
|
|
38
|
+
'&::after': {
|
|
39
39
|
background: 'red',
|
|
40
40
|
borderBottom: `2px solid ${(theme.vars || theme).palette[ownerState.color].main}`,
|
|
41
41
|
left: 0,
|
|
@@ -61,7 +61,7 @@ const StandardInputRoot = (0, _styles.styled)(_PickersInput.PickersInputRoot, {
|
|
|
61
61
|
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
'
|
|
64
|
+
'&::before': {
|
|
65
65
|
borderBottom: `1px solid ${bottomLineColor}`,
|
|
66
66
|
left: 0,
|
|
67
67
|
bottom: 0,
|
|
@@ -10,7 +10,7 @@ var _dateUtils = require("../../utils/date-utils");
|
|
|
10
10
|
const getDateSectionConfigFromFormatToken = (utils, formatToken) => {
|
|
11
11
|
const config = utils.formatTokenMap[formatToken];
|
|
12
12
|
if (config == null) {
|
|
13
|
-
throw new Error([`MUI: The token "${formatToken}" is not supported by the Date and Time Pickers.`, 'Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.'].join('\n'));
|
|
13
|
+
throw new Error([`MUI X: The token "${formatToken}" is not supported by the Date and Time Pickers.`, 'Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.'].join('\n'));
|
|
14
14
|
}
|
|
15
15
|
if (typeof config === 'string') {
|
|
16
16
|
return {
|
|
@@ -91,7 +91,7 @@ exports.cleanLeadingZeros = cleanLeadingZeros;
|
|
|
91
91
|
const cleanDigitSectionValue = (utils, timezone, value, sectionBoundaries, section) => {
|
|
92
92
|
if (process.env.NODE_ENV !== 'production') {
|
|
93
93
|
if (section.type !== 'day' && section.contentType === 'digit-with-letter') {
|
|
94
|
-
throw new Error([`MUI: The token "${section.format}" is a digit format with letter in it.'
|
|
94
|
+
throw new Error([`MUI X: The token "${section.format}" is a digit format with letter in it.'
|
|
95
95
|
This type of format is only supported for 'day' sections`].join('\n'));
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -374,7 +374,7 @@ const splitFormatIntoSections = (utils, timezone, localeText, format, date, form
|
|
|
374
374
|
maxLength = sectionValue === '' ? utils.formatByString(now, token).length : sectionValue.length;
|
|
375
375
|
} else {
|
|
376
376
|
if (sectionConfig.maxLength == null) {
|
|
377
|
-
throw new Error(`MUI: The token ${token} should have a 'maxDigitNumber' property on it's adapter`);
|
|
377
|
+
throw new Error(`MUI X: The token ${token} should have a 'maxDigitNumber' property on it's adapter`);
|
|
378
378
|
}
|
|
379
379
|
maxLength = sectionConfig.maxLength;
|
|
380
380
|
if (isValidDate) {
|
|
@@ -405,7 +405,7 @@ const splitFormatIntoSections = (utils, timezone, localeText, format, date, form
|
|
|
405
405
|
nextFormat = utils.expandFormat(prevFormat);
|
|
406
406
|
formatExpansionOverflow -= 1;
|
|
407
407
|
if (formatExpansionOverflow < 0) {
|
|
408
|
-
throw new Error('MUI: The format expansion seems to be enter in an infinite loop. Please open an issue with the format passed to the picker component');
|
|
408
|
+
throw new Error('MUI X: The format expansion seems to be enter in an infinite loop. Please open an issue with the format passed to the picker component.');
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
const expandedFormat = nextFormat;
|
|
@@ -623,7 +623,7 @@ const validateSections = (sections, valueType) => {
|
|
|
623
623
|
}
|
|
624
624
|
const invalidSection = sections.find(section => !supportedSections.includes(section.type));
|
|
625
625
|
if (invalidSection) {
|
|
626
|
-
console.warn(`MUI: The field component you are using is not compatible with the "${invalidSection.type}" date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
626
|
+
console.warn(`MUI X: The field component you are using is not compatible with the "${invalidSection.type}" date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
627
627
|
warnedOnceInvalidSection = true;
|
|
628
628
|
}
|
|
629
629
|
}
|
|
@@ -146,12 +146,12 @@ const usePickerValue = ({
|
|
|
146
146
|
if (process.env.NODE_ENV !== 'production') {
|
|
147
147
|
React.useEffect(() => {
|
|
148
148
|
if (isControlled !== (inValue !== undefined)) {
|
|
149
|
-
console.error([`MUI: A component is changing the ${isControlled ? '' : 'un'}controlled value of a picker to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled value` + 'for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
149
|
+
console.error([`MUI X: A component is changing the ${isControlled ? '' : 'un'}controlled value of a picker to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled value` + 'for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
|
|
150
150
|
}
|
|
151
151
|
}, [inValue]);
|
|
152
152
|
React.useEffect(() => {
|
|
153
153
|
if (!isControlled && defaultValue !== inDefaultValue) {
|
|
154
|
-
console.error([`MUI: A component is changing the defaultValue of an uncontrolled picker after being initialized. ` + `To suppress this warning opt to use a controlled value.`].join('\n'));
|
|
154
|
+
console.error([`MUI X: A component is changing the defaultValue of an uncontrolled picker after being initialized. ` + `To suppress this warning opt to use a controlled value.`].join('\n'));
|
|
155
155
|
}
|
|
156
156
|
}, [JSON.stringify(defaultValue)]);
|
|
157
157
|
}
|
|
@@ -14,10 +14,10 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
14
14
|
const useLocalizationContext = () => {
|
|
15
15
|
const localization = React.useContext(_LocalizationProvider.MuiPickersAdapterContext);
|
|
16
16
|
if (localization === null) {
|
|
17
|
-
throw new Error(['MUI: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
|
|
17
|
+
throw new Error(['MUI X: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
|
|
18
18
|
}
|
|
19
19
|
if (localization.utils === null) {
|
|
20
|
-
throw new Error(['MUI: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
|
|
20
|
+
throw new Error(['MUI X: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
|
|
21
21
|
}
|
|
22
22
|
const localeText = React.useMemo(() => (0, _extends2.default)({}, _enUS.DEFAULT_LOCALE, localization.localeText), [localization.localeText]);
|
|
23
23
|
return React.useMemo(() => (0, _extends2.default)({}, localization, {
|
|
@@ -24,11 +24,11 @@ function useViews({
|
|
|
24
24
|
if (process.env.NODE_ENV !== 'production') {
|
|
25
25
|
if (!warnedOnceNotValidView) {
|
|
26
26
|
if (inView != null && !views.includes(inView)) {
|
|
27
|
-
console.warn(`MUI: \`view="${inView}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
27
|
+
console.warn(`MUI X: \`view="${inView}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
28
28
|
warnedOnceNotValidView = true;
|
|
29
29
|
}
|
|
30
30
|
if (inView == null && openTo != null && !views.includes(openTo)) {
|
|
31
|
-
console.warn(`MUI: \`openTo="${openTo}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
31
|
+
console.warn(`MUI X: \`openTo="${openTo}"\` is not a valid prop.`, `It must be an element of \`views=["${views.join('", "')}"]\`.`);
|
|
32
32
|
warnedOnceNotValidView = true;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -72,11 +72,12 @@ function useViews({
|
|
|
72
72
|
onFocusedViewChange?.(viewToFocus, hasFocus);
|
|
73
73
|
});
|
|
74
74
|
const handleChangeView = (0, _useEventCallback.default)(newView => {
|
|
75
|
+
// always keep the focused view in sync
|
|
76
|
+
handleFocusedViewChange(newView, true);
|
|
75
77
|
if (newView === view) {
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
80
|
setView(newView);
|
|
79
|
-
handleFocusedViewChange(newView, true);
|
|
80
81
|
if (onViewChange) {
|
|
81
82
|
onViewChange(newView);
|
|
82
83
|
}
|
|
@@ -85,7 +86,6 @@ function useViews({
|
|
|
85
86
|
if (nextView) {
|
|
86
87
|
handleChangeView(nextView);
|
|
87
88
|
}
|
|
88
|
-
handleFocusedViewChange(nextView, true);
|
|
89
89
|
});
|
|
90
90
|
const setValueAndGoToNextView = (0, _useEventCallback.default)((value, currentViewSelectionState, selectedView) => {
|
|
91
91
|
const isSelectionFinishedOnCurrentView = currentViewSelectionState === 'finish';
|
|
@@ -94,18 +94,19 @@ function useViews({
|
|
|
94
94
|
// but when it's not the final view given all `views` -> overall selection state should be `partial`.
|
|
95
95
|
views.indexOf(selectedView) < views.length - 1 : Boolean(nextView);
|
|
96
96
|
const globalSelectionState = isSelectionFinishedOnCurrentView && hasMoreViews ? 'partial' : currentViewSelectionState;
|
|
97
|
-
onChange(value, globalSelectionState);
|
|
98
|
-
if
|
|
97
|
+
onChange(value, globalSelectionState, selectedView);
|
|
98
|
+
// Detects if the selected view is not the active one.
|
|
99
|
+
// Can happen if multiple views are displayed, like in `DesktopDateTimePicker` or `MultiSectionDigitalClock`.
|
|
100
|
+
if (selectedView && selectedView !== view) {
|
|
101
|
+
const nextViewAfterSelected = views[views.indexOf(selectedView) + 1];
|
|
102
|
+
if (nextViewAfterSelected) {
|
|
103
|
+
// move to next view after the selected one
|
|
104
|
+
handleChangeView(nextViewAfterSelected);
|
|
105
|
+
}
|
|
106
|
+
} else if (isSelectionFinishedOnCurrentView) {
|
|
99
107
|
goToNextView();
|
|
100
108
|
}
|
|
101
109
|
});
|
|
102
|
-
const setValueAndGoToView = (0, _useEventCallback.default)((value, newView, selectedView) => {
|
|
103
|
-
onChange(value, newView ? 'partial' : 'finish', selectedView);
|
|
104
|
-
if (newView) {
|
|
105
|
-
handleChangeView(newView);
|
|
106
|
-
handleFocusedViewChange(newView, true);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
110
|
return {
|
|
110
111
|
view,
|
|
111
112
|
setView: handleChangeView,
|
|
@@ -116,7 +117,6 @@ function useViews({
|
|
|
116
117
|
// Always return up-to-date default view instead of the initial one (i.e. defaultView.current)
|
|
117
118
|
defaultView: views.includes(openTo) ? openTo : views[0],
|
|
118
119
|
goToNextView,
|
|
119
|
-
setValueAndGoToNextView
|
|
120
|
-
setValueAndGoToView
|
|
120
|
+
setValueAndGoToNextView
|
|
121
121
|
};
|
|
122
122
|
}
|
package/node/internals/index.js
CHANGED
|
@@ -69,6 +69,12 @@ Object.defineProperty(exports, "applyDefaultDate", {
|
|
|
69
69
|
return _dateUtils.applyDefaultDate;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
+
Object.defineProperty(exports, "applyDefaultViewProps", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _views.applyDefaultViewProps;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
72
78
|
Object.defineProperty(exports, "areDatesEqual", {
|
|
73
79
|
enumerable: true,
|
|
74
80
|
get: function () {
|
|
@@ -111,6 +117,12 @@ Object.defineProperty(exports, "extractValidationProps", {
|
|
|
111
117
|
return _extractValidationProps.extractValidationProps;
|
|
112
118
|
}
|
|
113
119
|
});
|
|
120
|
+
Object.defineProperty(exports, "formatMeridiem", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _dateUtils.formatMeridiem;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
114
126
|
Object.defineProperty(exports, "getActiveElement", {
|
|
115
127
|
enumerable: true,
|
|
116
128
|
get: function () {
|
|
@@ -129,6 +141,24 @@ Object.defineProperty(exports, "getTodayDate", {
|
|
|
129
141
|
return _dateUtils.getTodayDate;
|
|
130
142
|
}
|
|
131
143
|
});
|
|
144
|
+
Object.defineProperty(exports, "isDatePickerView", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () {
|
|
147
|
+
return _dateUtils.isDatePickerView;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "isTimeView", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return _timeUtils.isTimeView;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "mergeDateAndTime", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _dateUtils.mergeDateAndTime;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
132
162
|
Object.defineProperty(exports, "onSpaceOrEnter", {
|
|
133
163
|
enumerable: true,
|
|
134
164
|
get: function () {
|
|
@@ -171,6 +201,12 @@ Object.defineProperty(exports, "replaceInvalidDateByNull", {
|
|
|
171
201
|
return _dateUtils.replaceInvalidDateByNull;
|
|
172
202
|
}
|
|
173
203
|
});
|
|
204
|
+
Object.defineProperty(exports, "resolveTimeViewsResponse", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function () {
|
|
207
|
+
return _dateTimeUtils.resolveTimeViewsResponse;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
174
210
|
Object.defineProperty(exports, "splitFieldInternalAndForwardedProps", {
|
|
175
211
|
enumerable: true,
|
|
176
212
|
get: function () {
|
|
@@ -261,6 +297,12 @@ Object.defineProperty(exports, "useValidation", {
|
|
|
261
297
|
return _useValidation.useValidation;
|
|
262
298
|
}
|
|
263
299
|
});
|
|
300
|
+
Object.defineProperty(exports, "useViews", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () {
|
|
303
|
+
return _useViews.useViews;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
264
306
|
Object.defineProperty(exports, "validateDate", {
|
|
265
307
|
enumerable: true,
|
|
266
308
|
get: function () {
|
|
@@ -295,10 +337,12 @@ var _useField = require("./hooks/useField");
|
|
|
295
337
|
var _usePicker = require("./hooks/usePicker");
|
|
296
338
|
var _useStaticPicker = require("./hooks/useStaticPicker");
|
|
297
339
|
var _useUtils = require("./hooks/useUtils");
|
|
340
|
+
var _useViews = require("./hooks/useViews");
|
|
298
341
|
var _useValidation = require("./hooks/useValidation");
|
|
299
342
|
var _dateHelpersHooks = require("./hooks/date-helpers-hooks");
|
|
300
343
|
var _convertFieldResponseIntoMuiTextFieldProps = require("./utils/convertFieldResponseIntoMuiTextFieldProps");
|
|
301
344
|
var _dateUtils = require("./utils/date-utils");
|
|
345
|
+
var _dateTimeUtils = require("./utils/date-time-utils");
|
|
302
346
|
var _fields = require("./utils/fields");
|
|
303
347
|
var _getDefaultReferenceDate = require("./utils/getDefaultReferenceDate");
|
|
304
348
|
var _utils = require("./utils/utils");
|
|
@@ -307,6 +351,8 @@ var _extractValidationProps = require("./utils/validation/extractValidationProps
|
|
|
307
351
|
var _validateDate = require("./utils/validation/validateDate");
|
|
308
352
|
var _validateDateTime = require("./utils/validation/validateDateTime");
|
|
309
353
|
var _validateTime = require("./utils/validation/validateTime");
|
|
354
|
+
var _views = require("./utils/views");
|
|
310
355
|
var _warning = require("./utils/warning");
|
|
311
356
|
var _DayCalendar = require("../DateCalendar/DayCalendar");
|
|
312
|
-
var _useCalendarState = require("../DateCalendar/useCalendarState");
|
|
357
|
+
var _useCalendarState = require("../DateCalendar/useCalendarState");
|
|
358
|
+
var _timeUtils = require("./utils/time-utils");
|
|
@@ -26,7 +26,7 @@ const applyDefaultViewProps = ({
|
|
|
26
26
|
} else if (viewsWithDefault.length > 0) {
|
|
27
27
|
openToWithDefault = viewsWithDefault[0];
|
|
28
28
|
} else {
|
|
29
|
-
throw new Error('MUI: The `views` prop must contain at least one view');
|
|
29
|
+
throw new Error('MUI X: The `views` prop must contain at least one view.');
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
32
|
views: viewsWithDefault,
|
package/node/locales/index.js
CHANGED
|
@@ -36,6 +36,17 @@ Object.keys(_csCZ).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
var _daDK = require("./daDK");
|
|
40
|
+
Object.keys(_daDK).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _daDK[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _daDK[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
39
50
|
var _deDE = require("./deDE");
|
|
40
51
|
Object.keys(_deDE).forEach(function (key) {
|
|
41
52
|
if (key === "default" || key === "__esModule") return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.8",
|
|
4
4
|
"description": "The community edition of the date picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"directory": "packages/x-date-pickers"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@babel/runtime": "^7.23.
|
|
38
|
-
"@mui/base": "^5.0.0-beta.
|
|
39
|
-
"@mui/system": "^5.15.
|
|
40
|
-
"@mui/utils": "^5.15.
|
|
37
|
+
"@babel/runtime": "^7.23.7",
|
|
38
|
+
"@mui/base": "^5.0.0-beta.29",
|
|
39
|
+
"@mui/system": "^5.15.2",
|
|
40
|
+
"@mui/utils": "^5.15.2",
|
|
41
41
|
"@types/react-transition-group": "^4.4.10",
|
|
42
42
|
"clsx": "^2.0.0",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@emotion/react": "^11.9.0",
|
|
48
48
|
"@emotion/styled": "^11.8.1",
|
|
49
49
|
"@mui/material": "^5.8.6",
|
|
50
|
-
"date-fns": "^2.25.0",
|
|
50
|
+
"date-fns": "^2.25.0 || ^3.2.0",
|
|
51
51
|
"date-fns-jalali": "^2.13.0-0",
|
|
52
52
|
"dayjs": "^1.10.7",
|
|
53
53
|
"luxon": "^3.0.2",
|