@mui/x-date-pickers 7.0.0 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/DatePicker/DatePickerToolbar.js +11 -6
  3. package/DateTimePicker/DateTimePickerToolbar.js +97 -45
  4. package/DayCalendarSkeleton/DayCalendarSkeleton.js +12 -8
  5. package/DigitalClock/DigitalClock.js +14 -6
  6. package/MonthCalendar/PickersMonth.js +12 -6
  7. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -4
  8. package/PickersCalendarHeader/PickersCalendarHeader.js +13 -9
  9. package/PickersDay/PickersDay.js +30 -15
  10. package/PickersLayout/PickersLayout.js +31 -17
  11. package/PickersTextField/PickersFilledInput/PickersFilledInput.js +137 -72
  12. package/PickersTextField/PickersInput/PickersInput.js +76 -54
  13. package/PickersTextField/PickersInputBase/PickersInputBase.js +64 -24
  14. package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +7 -0
  15. package/PickersTextField/PickersOutlinedInput/Outline.js +58 -41
  16. package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +31 -12
  17. package/TimeClock/Clock.js +48 -35
  18. package/TimeClock/ClockNumber.js +12 -7
  19. package/TimeClock/ClockPointer.js +23 -13
  20. package/TimePicker/TimePickerToolbar.js +25 -16
  21. package/YearCalendar/PickersYear.js +12 -6
  22. package/index.js +1 -1
  23. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -6
  24. package/internals/components/PickersPopper.js +12 -8
  25. package/internals/components/PickersToolbar.js +39 -18
  26. package/internals/hooks/useField/useField.js +4 -2
  27. package/internals/hooks/useField/useField.types.d.ts +1 -0
  28. package/internals/hooks/useField/useFieldV6TextField.js +8 -3
  29. package/locales/itIT.js +16 -20
  30. package/locales/zhHK.js +14 -17
  31. package/modern/DatePicker/DatePickerToolbar.js +11 -6
  32. package/modern/DateTimePicker/DateTimePickerToolbar.js +97 -45
  33. package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +12 -8
  34. package/modern/DigitalClock/DigitalClock.js +14 -6
  35. package/modern/MonthCalendar/PickersMonth.js +12 -6
  36. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -4
  37. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +13 -9
  38. package/modern/PickersDay/PickersDay.js +30 -15
  39. package/modern/PickersLayout/PickersLayout.js +31 -17
  40. package/modern/PickersTextField/PickersFilledInput/PickersFilledInput.js +137 -72
  41. package/modern/PickersTextField/PickersInput/PickersInput.js +76 -54
  42. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +64 -24
  43. package/modern/PickersTextField/PickersOutlinedInput/Outline.js +58 -41
  44. package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +31 -12
  45. package/modern/TimeClock/Clock.js +48 -35
  46. package/modern/TimeClock/ClockNumber.js +12 -7
  47. package/modern/TimeClock/ClockPointer.js +23 -13
  48. package/modern/TimePicker/TimePickerToolbar.js +25 -16
  49. package/modern/YearCalendar/PickersYear.js +12 -6
  50. package/modern/index.js +1 -1
  51. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -6
  52. package/modern/internals/components/PickersPopper.js +12 -8
  53. package/modern/internals/components/PickersToolbar.js +39 -18
  54. package/modern/internals/hooks/useField/useField.js +4 -2
  55. package/modern/internals/hooks/useField/useFieldV6TextField.js +8 -3
  56. package/modern/locales/itIT.js +16 -20
  57. package/modern/locales/zhHK.js +14 -17
  58. package/node/DatePicker/DatePickerToolbar.js +11 -6
  59. package/node/DateTimePicker/DateTimePickerToolbar.js +97 -45
  60. package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +12 -8
  61. package/node/DigitalClock/DigitalClock.js +14 -6
  62. package/node/MonthCalendar/PickersMonth.js +12 -6
  63. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +13 -4
  64. package/node/PickersCalendarHeader/PickersCalendarHeader.js +13 -9
  65. package/node/PickersDay/PickersDay.js +30 -15
  66. package/node/PickersLayout/PickersLayout.js +31 -17
  67. package/node/PickersTextField/PickersFilledInput/PickersFilledInput.js +137 -72
  68. package/node/PickersTextField/PickersInput/PickersInput.js +76 -54
  69. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +64 -24
  70. package/node/PickersTextField/PickersOutlinedInput/Outline.js +58 -41
  71. package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +31 -12
  72. package/node/TimeClock/Clock.js +48 -35
  73. package/node/TimeClock/ClockNumber.js +12 -7
  74. package/node/TimeClock/ClockPointer.js +23 -13
  75. package/node/TimePicker/TimePickerToolbar.js +25 -16
  76. package/node/YearCalendar/PickersYear.js +12 -6
  77. package/node/index.js +1 -1
  78. package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -6
  79. package/node/internals/components/PickersPopper.js +12 -8
  80. package/node/internals/components/PickersToolbar.js +39 -18
  81. package/node/internals/hooks/useField/useField.js +4 -2
  82. package/node/internals/hooks/useField/useFieldV6TextField.js +8 -3
  83. package/node/locales/itIT.js +16 -20
  84. package/node/locales/zhHK.js +14 -17
  85. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["children", "className", "label", "notched", "shrink"];
4
4
  import * as React from 'react';
5
5
  import { styled } from '@mui/material/styles';
@@ -37,51 +37,68 @@ const OutlineLabel = styled('span')(({
37
37
  fontSize: 'inherit'
38
38
  }));
39
39
  const OutlineLegend = styled('legend')(({
40
- ownerState,
41
40
  theme
42
- }) => _extends({
41
+ }) => ({
43
42
  float: 'unset',
44
43
  // Fix conflict with bootstrap
45
44
  width: 'auto',
46
45
  // Fix conflict with bootstrap
47
- overflow: 'hidden'
48
- }, !ownerState.withLabel && {
49
- padding: 0,
50
- lineHeight: '11px',
51
- // sync with `height` in `legend` styles
52
- transition: theme.transitions.create('width', {
53
- duration: 150,
54
- easing: theme.transitions.easing.easeOut
55
- })
56
- }, ownerState.withLabel && _extends({
57
- display: 'block',
58
- // Fix conflict with normalize.css and sanitize.css
59
- padding: 0,
60
- height: 11,
61
- // sync with `lineHeight` in `legend` styles
62
- fontSize: '0.75em',
63
- visibility: 'hidden',
64
- maxWidth: 0.01,
65
- transition: theme.transitions.create('max-width', {
66
- duration: 50,
67
- easing: theme.transitions.easing.easeOut
68
- }),
69
- whiteSpace: 'nowrap',
70
- '& > span': {
71
- paddingLeft: 5,
72
- paddingRight: 5,
73
- display: 'inline-block',
74
- opacity: 0,
75
- visibility: 'visible'
76
- }
77
- }, ownerState.notched && {
78
- maxWidth: '100%',
79
- transition: theme.transitions.create('max-width', {
80
- duration: 100,
81
- easing: theme.transitions.easing.easeOut,
82
- delay: 50
83
- })
84
- })));
46
+ overflow: 'hidden',
47
+ // Fix Horizontal scroll when label too long
48
+ variants: [{
49
+ props: {
50
+ withLabel: false
51
+ },
52
+ style: {
53
+ padding: 0,
54
+ lineHeight: '11px',
55
+ // sync with `height` in `legend` styles
56
+ transition: theme.transitions.create('width', {
57
+ duration: 150,
58
+ easing: theme.transitions.easing.easeOut
59
+ })
60
+ }
61
+ }, {
62
+ props: {
63
+ withLabel: true
64
+ },
65
+ style: {
66
+ display: 'block',
67
+ // Fix conflict with normalize.css and sanitize.css
68
+ padding: 0,
69
+ height: 11,
70
+ // sync with `lineHeight` in `legend` styles
71
+ fontSize: '0.75em',
72
+ visibility: 'hidden',
73
+ maxWidth: 0.01,
74
+ transition: theme.transitions.create('max-width', {
75
+ duration: 50,
76
+ easing: theme.transitions.easing.easeOut
77
+ }),
78
+ whiteSpace: 'nowrap',
79
+ '& > span': {
80
+ paddingLeft: 5,
81
+ paddingRight: 5,
82
+ display: 'inline-block',
83
+ opacity: 0,
84
+ visibility: 'visible'
85
+ }
86
+ }
87
+ }, {
88
+ props: {
89
+ withLabel: true,
90
+ notched: true
91
+ },
92
+ style: {
93
+ maxWidth: '100%',
94
+ transition: theme.transitions.create('max-width', {
95
+ duration: 100,
96
+ easing: theme.transitions.easing.easeOut,
97
+ delay: 50
98
+ })
99
+ }
100
+ }]
101
+ }));
85
102
 
86
103
  /**
87
104
  * @ignore - internal component.
@@ -18,8 +18,7 @@ const PickersOutlinedInputRoot = styled(PickersInputBaseRoot, {
18
18
  slot: 'Root',
19
19
  overridesResolver: (props, styles) => styles.root
20
20
  })(({
21
- theme,
22
- ownerState
21
+ theme
23
22
  }) => {
24
23
  const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
25
24
  return {
@@ -36,8 +35,6 @@ const PickersOutlinedInputRoot = styled(PickersInputBaseRoot, {
36
35
  },
37
36
  [`&.${pickersOutlinedInputClasses.focused} .${pickersOutlinedInputClasses.notchedOutline}`]: {
38
37
  borderStyle: 'solid',
39
- // @ts-ignore
40
- borderColor: (theme.vars || theme).palette[ownerState.color].main,
41
38
  borderWidth: 2
42
39
  },
43
40
  [`&.${pickersOutlinedInputClasses.disabled}`]: {
@@ -50,20 +47,37 @@ const PickersOutlinedInputRoot = styled(PickersInputBaseRoot, {
50
47
  },
51
48
  [`&.${pickersOutlinedInputClasses.error} .${pickersOutlinedInputClasses.notchedOutline}`]: {
52
49
  borderColor: (theme.vars || theme).palette.error.main
53
- }
50
+ },
51
+ variants: Object.keys((theme.vars ?? theme).palette)
52
+ // @ts-ignore
53
+ .filter(key => (theme.vars ?? theme).palette[key].main).map(color => ({
54
+ props: {
55
+ color
56
+ },
57
+ style: {
58
+ [`&.${pickersOutlinedInputClasses.focused}:not(.${pickersOutlinedInputClasses.error}) .${pickersOutlinedInputClasses.notchedOutline}`]: {
59
+ // @ts-ignore
60
+ borderColor: (theme.vars || theme).palette[color].main
61
+ }
62
+ }
63
+ }))
54
64
  };
55
65
  });
56
66
  const PickersOutlinedInputSectionsContainer = styled(PickersInputBaseSectionsContainer, {
57
67
  name: 'MuiPickersOutlinedInput',
58
68
  slot: 'SectionsContainer',
59
69
  overridesResolver: (props, styles) => styles.sectionsContainer
60
- })(({
61
- ownerState
62
- }) => _extends({
63
- padding: '16.5px 0'
64
- }, ownerState.size === 'small' && {
65
- padding: '8.5px 0'
66
- }));
70
+ })({
71
+ padding: '16.5px 0',
72
+ variants: [{
73
+ props: {
74
+ size: 'small'
75
+ },
76
+ style: {
77
+ padding: '8.5px 0'
78
+ }
79
+ }]
80
+ });
67
81
  const useUtilityClasses = ownerState => {
68
82
  const {
69
83
  classes
@@ -172,6 +186,11 @@ process.env.NODE_ENV !== "production" ? PickersOutlinedInput.propTypes = {
172
186
  getSectionIndexFromDOMElement: PropTypes.func.isRequired
173
187
  })
174
188
  })]),
189
+ /**
190
+ * The props used for each component slot.
191
+ * @default {}
192
+ */
193
+ slotProps: PropTypes.object,
175
194
  /**
176
195
  * The components used for each slot inside.
177
196
  *
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import * as React from 'react';
3
2
  import clsx from 'clsx';
4
3
  import IconButton from '@mui/material/IconButton';
@@ -66,9 +65,7 @@ const ClockSquareMask = styled('div', {
66
65
  name: 'MuiClock',
67
66
  slot: 'SquareMask',
68
67
  overridesResolver: (_, styles) => styles.squareMask
69
- })(({
70
- ownerState
71
- }) => _extends({
68
+ })({
72
69
  width: '100%',
73
70
  height: '100%',
74
71
  position: 'absolute',
@@ -76,16 +73,22 @@ const ClockSquareMask = styled('div', {
76
73
  outline: 0,
77
74
  // Disable scroll capabilities.
78
75
  touchAction: 'none',
79
- userSelect: 'none'
80
- }, ownerState.disabled ? {} : {
81
- '@media (pointer: fine)': {
82
- cursor: 'pointer',
83
- borderRadius: '50%'
84
- },
85
- '&:active': {
86
- cursor: 'move'
87
- }
88
- }));
76
+ userSelect: 'none',
77
+ variants: [{
78
+ props: {
79
+ disabled: false
80
+ },
81
+ style: {
82
+ '@media (pointer: fine)': {
83
+ cursor: 'pointer',
84
+ borderRadius: '50%'
85
+ },
86
+ '&:active': {
87
+ cursor: 'move'
88
+ }
89
+ }
90
+ }]
91
+ });
89
92
  const ClockPin = styled('div', {
90
93
  name: 'MuiClock',
91
94
  slot: 'Pin',
@@ -107,44 +110,54 @@ const ClockAmButton = styled(IconButton, {
107
110
  slot: 'AmButton',
108
111
  overridesResolver: (_, styles) => styles.amButton
109
112
  })(({
110
- theme,
111
- ownerState
112
- }) => _extends({
113
+ theme
114
+ }) => ({
113
115
  zIndex: 1,
114
116
  position: 'absolute',
115
117
  bottom: 8,
116
118
  left: 8,
117
119
  paddingLeft: 4,
118
120
  paddingRight: 4,
119
- width: CLOCK_HOUR_WIDTH
120
- }, ownerState.meridiemMode === 'am' && {
121
- backgroundColor: (theme.vars || theme).palette.primary.main,
122
- color: (theme.vars || theme).palette.primary.contrastText,
123
- '&:hover': {
124
- backgroundColor: (theme.vars || theme).palette.primary.light
125
- }
121
+ width: CLOCK_HOUR_WIDTH,
122
+ variants: [{
123
+ props: {
124
+ meridiemMode: 'am'
125
+ },
126
+ style: {
127
+ backgroundColor: (theme.vars || theme).palette.primary.main,
128
+ color: (theme.vars || theme).palette.primary.contrastText,
129
+ '&:hover': {
130
+ backgroundColor: (theme.vars || theme).palette.primary.light
131
+ }
132
+ }
133
+ }]
126
134
  }));
127
135
  const ClockPmButton = styled(IconButton, {
128
136
  name: 'MuiClock',
129
137
  slot: 'PmButton',
130
138
  overridesResolver: (_, styles) => styles.pmButton
131
139
  })(({
132
- theme,
133
- ownerState
134
- }) => _extends({
140
+ theme
141
+ }) => ({
135
142
  zIndex: 1,
136
143
  position: 'absolute',
137
144
  bottom: 8,
138
145
  right: 8,
139
146
  paddingLeft: 4,
140
147
  paddingRight: 4,
141
- width: CLOCK_HOUR_WIDTH
142
- }, ownerState.meridiemMode === 'pm' && {
143
- backgroundColor: (theme.vars || theme).palette.primary.main,
144
- color: (theme.vars || theme).palette.primary.contrastText,
145
- '&:hover': {
146
- backgroundColor: (theme.vars || theme).palette.primary.light
147
- }
148
+ width: CLOCK_HOUR_WIDTH,
149
+ variants: [{
150
+ props: {
151
+ meridiemMode: 'pm'
152
+ },
153
+ style: {
154
+ backgroundColor: (theme.vars || theme).palette.primary.main,
155
+ color: (theme.vars || theme).palette.primary.contrastText,
156
+ '&:hover': {
157
+ backgroundColor: (theme.vars || theme).palette.primary.light
158
+ }
159
+ }
160
+ }]
148
161
  }));
149
162
  const ClockMeridiemText = styled(Typography, {
150
163
  name: 'MuiClock',
@@ -178,7 +191,7 @@ export function Clock(inProps) {
178
191
  selectedId,
179
192
  type,
180
193
  viewValue,
181
- disabled,
194
+ disabled = false,
182
195
  readOnly,
183
196
  className
184
197
  } = props;
@@ -28,9 +28,8 @@ const ClockNumberRoot = styled('span', {
28
28
  [`&.${clockNumberClasses.selected}`]: styles.selected
29
29
  }]
30
30
  })(({
31
- theme,
32
- ownerState
33
- }) => _extends({
31
+ theme
32
+ }) => ({
34
33
  height: CLOCK_HOUR_WIDTH,
35
34
  width: CLOCK_HOUR_WIDTH,
36
35
  position: 'absolute',
@@ -50,10 +49,16 @@ const ClockNumberRoot = styled('span', {
50
49
  [`&.${clockNumberClasses.disabled}`]: {
51
50
  pointerEvents: 'none',
52
51
  color: (theme.vars || theme).palette.text.disabled
53
- }
54
- }, ownerState.inner && _extends({}, theme.typography.body2, {
55
- color: (theme.vars || theme).palette.text.secondary
56
- })));
52
+ },
53
+ variants: [{
54
+ props: {
55
+ inner: true
56
+ },
57
+ style: _extends({}, theme.typography.body2, {
58
+ color: (theme.vars || theme).palette.text.secondary
59
+ })
60
+ }]
61
+ }));
57
62
 
58
63
  /**
59
64
  * @ignore - internal component.
@@ -1,5 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["className", "hasSelected", "isInner", "type", "viewValue"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
@@ -23,26 +23,30 @@ const ClockPointerRoot = styled('div', {
23
23
  slot: 'Root',
24
24
  overridesResolver: (_, styles) => styles.root
25
25
  })(({
26
- theme,
27
- ownerState
28
- }) => _extends({
26
+ theme
27
+ }) => ({
29
28
  width: 2,
30
29
  backgroundColor: (theme.vars || theme).palette.primary.main,
31
30
  position: 'absolute',
32
31
  left: 'calc(50% - 1px)',
33
32
  bottom: '50%',
34
- transformOrigin: 'center bottom 0px'
35
- }, ownerState.shouldAnimate && {
36
- transition: theme.transitions.create(['transform', 'height'])
33
+ transformOrigin: 'center bottom 0px',
34
+ variants: [{
35
+ props: {
36
+ shouldAnimate: true
37
+ },
38
+ style: {
39
+ transition: theme.transitions.create(['transform', 'height'])
40
+ }
41
+ }]
37
42
  }));
38
43
  const ClockPointerThumb = styled('div', {
39
44
  name: 'MuiClockPointer',
40
45
  slot: 'Thumb',
41
46
  overridesResolver: (_, styles) => styles.thumb
42
47
  })(({
43
- theme,
44
- ownerState
45
- }) => _extends({
48
+ theme
49
+ }) => ({
46
50
  width: 4,
47
51
  height: 4,
48
52
  backgroundColor: (theme.vars || theme).palette.primary.contrastText,
@@ -51,9 +55,15 @@ const ClockPointerThumb = styled('div', {
51
55
  top: -21,
52
56
  left: `calc(50% - ${CLOCK_HOUR_WIDTH / 2}px)`,
53
57
  border: `${(CLOCK_HOUR_WIDTH - 4) / 2}px solid ${(theme.vars || theme).palette.primary.main}`,
54
- boxSizing: 'content-box'
55
- }, ownerState.hasSelected && {
56
- backgroundColor: (theme.vars || theme).palette.primary.main
58
+ boxSizing: 'content-box',
59
+ variants: [{
60
+ props: {
61
+ hasSelected: true
62
+ },
63
+ style: {
64
+ backgroundColor: (theme.vars || theme).palette.primary.main
65
+ }
66
+ }]
57
67
  }));
58
68
 
59
69
  /**
@@ -53,16 +53,22 @@ const TimePickerToolbarHourMinuteLabel = styled('div', {
53
53
  [`&.${timePickerToolbarClasses.hourMinuteLabelReverse}`]: styles.hourMinuteLabelReverse
54
54
  }, styles.hourMinuteLabel]
55
55
  })(({
56
- theme,
57
- ownerState
56
+ theme
58
57
  }) => _extends({
59
58
  display: 'flex',
60
59
  justifyContent: 'flex-end',
61
60
  alignItems: 'flex-end'
62
- }, ownerState.isLandscape && {
63
- marginTop: 'auto'
64
61
  }, theme.direction === 'rtl' && {
65
62
  flexDirection: 'row-reverse'
63
+ }, {
64
+ variants: [{
65
+ props: {
66
+ isLandscape: true
67
+ },
68
+ style: {
69
+ marginTop: 'auto'
70
+ }
71
+ }]
66
72
  }));
67
73
  TimePickerToolbarHourMinuteLabel.propTypes = {
68
74
  // ----------------------------- Warning --------------------------------
@@ -81,23 +87,26 @@ const TimePickerToolbarAmPmSelection = styled('div', {
81
87
  }, {
82
88
  [`&.${timePickerToolbarClasses.ampmLandscape}`]: styles.ampmLandscape
83
89
  }, styles.ampmSelection]
84
- })(({
85
- ownerState
86
- }) => _extends({
90
+ })({
87
91
  display: 'flex',
88
92
  flexDirection: 'column',
89
93
  marginRight: 'auto',
90
- marginLeft: 12
91
- }, ownerState.isLandscape && {
92
- margin: '4px 0 auto',
93
- flexDirection: 'row',
94
- justifyContent: 'space-around',
95
- flexBasis: '100%'
96
- }, {
94
+ marginLeft: 12,
97
95
  [`& .${timePickerToolbarClasses.ampmLabel}`]: {
98
96
  fontSize: 17
99
- }
100
- }));
97
+ },
98
+ variants: [{
99
+ props: {
100
+ isLandscape: true
101
+ },
102
+ style: {
103
+ margin: '4px 0 auto',
104
+ flexDirection: 'row',
105
+ justifyContent: 'space-around',
106
+ flexBasis: '100%'
107
+ }
108
+ }]
109
+ });
101
110
  TimePickerToolbarAmPmSelection.propTypes = {
102
111
  // ----------------------------- Warning --------------------------------
103
112
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -23,14 +23,20 @@ const PickersYearRoot = styled('div', {
23
23
  name: 'MuiPickersYear',
24
24
  slot: 'Root',
25
25
  overridesResolver: (_, styles) => [styles.root]
26
- })(({
27
- ownerState
28
- }) => ({
29
- flexBasis: ownerState.yearsPerRow === 3 ? '33.3%' : '25%',
26
+ })({
30
27
  display: 'flex',
31
28
  alignItems: 'center',
32
- justifyContent: 'center'
33
- }));
29
+ justifyContent: 'center',
30
+ flexBasis: '33.3%',
31
+ variants: [{
32
+ props: {
33
+ yearsPerRow: 4
34
+ },
35
+ style: {
36
+ flexBasis: '25%'
37
+ }
38
+ }]
39
+ });
34
40
  const PickersYearButton = styled('button', {
35
41
  name: 'MuiPickersYear',
36
42
  slot: 'YearButton',
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.0.0
2
+ * @mui/x-date-pickers v7.1.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,5 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel"],
4
4
  _excluded2 = ["ownerState"],
5
5
  _excluded3 = ["ownerState"];
@@ -34,11 +34,16 @@ const PickersArrowSwitcherButton = styled(IconButton, {
34
34
  name: 'MuiPickersArrowSwitcher',
35
35
  slot: 'Button',
36
36
  overridesResolver: (props, styles) => styles.button
37
- })(({
38
- ownerState
39
- }) => _extends({}, ownerState.hidden && {
40
- visibility: 'hidden'
41
- }));
37
+ })({
38
+ variants: [{
39
+ props: {
40
+ hidden: true
41
+ },
42
+ style: {
43
+ visibility: 'hidden'
44
+ }
45
+ }]
46
+ });
42
47
  const useUtilityClasses = ownerState => {
43
48
  const {
44
49
  classes
@@ -1,5 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["PaperComponent", "popperPlacement", "ownerState", "children", "paperSlotProps", "paperClasses", "onPaperClick", "onPaperTouchStart"];
4
4
  import * as React from 'react';
5
5
  import { useSlotProps } from '@mui/base/utils';
@@ -37,14 +37,18 @@ const PickersPopperPaper = styled(MuiPaper, {
37
37
  name: 'MuiPickersPopper',
38
38
  slot: 'Paper',
39
39
  overridesResolver: (_, styles) => styles.paper
40
- })(({
41
- ownerState
42
- }) => _extends({
40
+ })({
43
41
  outline: 0,
44
- transformOrigin: 'top center'
45
- }, ownerState.placement.includes('top') && {
46
- transformOrigin: 'bottom center'
47
- }));
42
+ transformOrigin: 'top center',
43
+ variants: [{
44
+ props: ({
45
+ placement
46
+ }) => ['top', 'top-start', 'top-end'].includes(placement),
47
+ style: {
48
+ transformOrigin: 'bottom center'
49
+ }
50
+ }]
51
+ });
48
52
  function clickedRootScrollbar(event, doc) {
49
53
  return doc.documentElement.clientWidth < event.clientX || doc.documentElement.clientHeight < event.clientY;
50
54
  }
@@ -1,5 +1,5 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["children", "className", "toolbarTitle", "hidden", "titleId", "isLandscape", "classes", "landscapeDirection"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
@@ -26,36 +26,57 @@ const PickersToolbarRoot = styled('div', {
26
26
  slot: 'Root',
27
27
  overridesResolver: (props, styles) => styles.root
28
28
  })(({
29
- theme,
30
- ownerState
31
- }) => _extends({
29
+ theme
30
+ }) => ({
32
31
  display: 'flex',
33
32
  flexDirection: 'column',
34
33
  alignItems: 'flex-start',
35
34
  justifyContent: 'space-between',
36
- padding: theme.spacing(2, 3)
37
- }, ownerState.isLandscape && {
38
- height: 'auto',
39
- maxWidth: 160,
40
- padding: 16,
41
- justifyContent: 'flex-start',
42
- flexWrap: 'wrap'
35
+ padding: theme.spacing(2, 3),
36
+ variants: [{
37
+ props: {
38
+ isLandscape: true
39
+ },
40
+ style: {
41
+ height: 'auto',
42
+ maxWidth: 160,
43
+ padding: 16,
44
+ justifyContent: 'flex-start',
45
+ flexWrap: 'wrap'
46
+ }
47
+ }]
43
48
  }));
44
49
  const PickersToolbarContent = styled('div', {
45
50
  name: 'MuiPickersToolbar',
46
51
  slot: 'Content',
47
52
  overridesResolver: (props, styles) => styles.content
48
- })(({
49
- ownerState
50
- }) => ({
53
+ })({
51
54
  display: 'flex',
52
55
  flexWrap: 'wrap',
53
56
  width: '100%',
54
- justifyContent: ownerState.isLandscape ? 'flex-start' : 'space-between',
55
- flexDirection: ownerState.isLandscape ? ownerState.landscapeDirection ?? 'column' : 'row',
56
57
  flex: 1,
57
- alignItems: ownerState.isLandscape ? 'flex-start' : 'center'
58
- }));
58
+ justifyContent: 'space-between',
59
+ alignItems: 'center',
60
+ flexDirection: 'row',
61
+ variants: [{
62
+ props: {
63
+ isLandscape: true
64
+ },
65
+ style: {
66
+ justifyContent: 'flex-start',
67
+ alignItems: 'flex-start',
68
+ flexDirection: 'column'
69
+ }
70
+ }, {
71
+ props: {
72
+ isLandscape: true,
73
+ landscapeDirection: 'row'
74
+ },
75
+ style: {
76
+ flexDirection: 'row'
77
+ }
78
+ }]
79
+ });
59
80
  export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersToolbar(inProps, ref) {
60
81
  const props = useThemeProps({
61
82
  props: inProps,