@mui/x-date-pickers 7.0.0-alpha.6 → 7.0.0-alpha.7
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 +185 -3
- package/DateCalendar/DateCalendar.js +6 -4
- package/DateCalendar/DateCalendar.types.d.ts +0 -8
- package/DigitalClock/DigitalClock.js +3 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/TimeClock/TimeClock.js +3 -2
- package/index.js +1 -1
- package/internals/components/PickersInput/PickersFilledInput.js +2 -2
- package/internals/components/PickersInput/PickersStandardInput.js +2 -2
- package/internals/hooks/useViews.d.ts +4 -4
- package/internals/hooks/useViews.js +13 -13
- package/internals/models/props/clock.d.ts +0 -9
- package/legacy/DateCalendar/DateCalendar.js +6 -4
- package/legacy/DigitalClock/DigitalClock.js +3 -2
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/legacy/TimeClock/TimeClock.js +3 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersInput/PickersFilledInput.js +2 -2
- package/legacy/internals/components/PickersInput/PickersStandardInput.js +2 -2
- package/legacy/internals/hooks/useViews.js +13 -13
- package/modern/DateCalendar/DateCalendar.js +6 -4
- package/modern/DigitalClock/DigitalClock.js +3 -2
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/modern/TimeClock/TimeClock.js +3 -2
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersInput/PickersFilledInput.js +2 -2
- package/modern/internals/components/PickersInput/PickersStandardInput.js +2 -2
- package/modern/internals/hooks/useViews.js +13 -13
- package/node/DateCalendar/DateCalendar.js +6 -4
- package/node/DigitalClock/DigitalClock.js +3 -2
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/node/TimeClock/TimeClock.js +3 -2
- package/node/index.js +1 -1
- package/node/internals/components/PickersInput/PickersFilledInput.js +2 -2
- package/node/internals/components/PickersInput/PickersStandardInput.js +2 -2
- package/node/internals/hooks/useViews.js +13 -13
- package/package.json +5 -5
|
@@ -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
|
*/
|
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,
|
|
@@ -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,
|
|
@@ -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/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.7",
|
|
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",
|