@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.
Files changed (41) hide show
  1. package/CHANGELOG.md +185 -3
  2. package/DateCalendar/DateCalendar.js +6 -4
  3. package/DateCalendar/DateCalendar.types.d.ts +0 -8
  4. package/DigitalClock/DigitalClock.js +3 -2
  5. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  6. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
  7. package/TimeClock/TimeClock.js +3 -2
  8. package/index.js +1 -1
  9. package/internals/components/PickersInput/PickersFilledInput.js +2 -2
  10. package/internals/components/PickersInput/PickersStandardInput.js +2 -2
  11. package/internals/hooks/useViews.d.ts +4 -4
  12. package/internals/hooks/useViews.js +13 -13
  13. package/internals/models/props/clock.d.ts +0 -9
  14. package/legacy/DateCalendar/DateCalendar.js +6 -4
  15. package/legacy/DigitalClock/DigitalClock.js +3 -2
  16. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  17. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
  18. package/legacy/TimeClock/TimeClock.js +3 -2
  19. package/legacy/index.js +1 -1
  20. package/legacy/internals/components/PickersInput/PickersFilledInput.js +2 -2
  21. package/legacy/internals/components/PickersInput/PickersStandardInput.js +2 -2
  22. package/legacy/internals/hooks/useViews.js +13 -13
  23. package/modern/DateCalendar/DateCalendar.js +6 -4
  24. package/modern/DigitalClock/DigitalClock.js +3 -2
  25. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  26. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
  27. package/modern/TimeClock/TimeClock.js +3 -2
  28. package/modern/index.js +1 -1
  29. package/modern/internals/components/PickersInput/PickersFilledInput.js +2 -2
  30. package/modern/internals/components/PickersInput/PickersStandardInput.js +2 -2
  31. package/modern/internals/hooks/useViews.js +13 -13
  32. package/node/DateCalendar/DateCalendar.js +6 -4
  33. package/node/DigitalClock/DigitalClock.js +3 -2
  34. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
  35. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
  36. package/node/TimeClock/TimeClock.js +3 -2
  37. package/node/index.js +1 -1
  38. package/node/internals/components/PickersInput/PickersFilledInput.js +2 -2
  39. package/node/internals/components/PickersInput/PickersStandardInput.js +2 -2
  40. package/node/internals/hooks/useViews.js +13 -13
  41. 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 TDate, TView
395
- * @param {TDate | null} value The new value.
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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.0.0-alpha.6
2
+ * @mui/x-date-pickers v7.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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
- '&:after': {
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
- '&:before': {
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
- '&:after': {
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
- '&:before': {
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 (isSelectionFinishedOnCurrentView) {
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.6",
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.5",
38
- "@mui/base": "^5.0.0-beta.27",
39
- "@mui/system": "^5.15.0",
40
- "@mui/utils": "^5.15.0",
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",