@mui/x-date-pickers 6.16.3 → 6.18.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 (57) hide show
  1. package/AdapterDateFns/AdapterDateFns.js +1 -1
  2. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
  3. package/AdapterDayjs/AdapterDayjs.js +1 -1
  4. package/AdapterLuxon/AdapterLuxon.js +1 -1
  5. package/CHANGELOG.md +127 -0
  6. package/DateCalendar/DateCalendar.d.ts +3 -2
  7. package/DateCalendar/DateCalendar.js +3 -2
  8. package/DateCalendar/DayCalendar.js +1 -3
  9. package/MonthCalendar/MonthCalendar.d.ts +9 -0
  10. package/MonthCalendar/MonthCalendar.js +9 -0
  11. package/PickersCalendarHeader/PickersCalendarHeader.d.ts +1 -62
  12. package/PickersCalendarHeader/PickersCalendarHeader.js +17 -6
  13. package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +75 -0
  14. package/PickersCalendarHeader/PickersCalendarHeader.types.js +1 -0
  15. package/PickersCalendarHeader/index.d.ts +1 -1
  16. package/YearCalendar/YearCalendar.d.ts +9 -0
  17. package/YearCalendar/YearCalendar.js +9 -0
  18. package/index.js +1 -1
  19. package/internals/components/FakeTextField/FakeTextField.d.ts +15 -3
  20. package/internals/components/FakeTextField/FakeTextField.js +35 -18
  21. package/legacy/AdapterDateFns/AdapterDateFns.js +1 -1
  22. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
  23. package/legacy/AdapterDayjs/AdapterDayjs.js +1 -1
  24. package/legacy/AdapterLuxon/AdapterLuxon.js +1 -1
  25. package/legacy/DateCalendar/DateCalendar.js +3 -2
  26. package/legacy/DateCalendar/DayCalendar.js +1 -3
  27. package/legacy/MonthCalendar/MonthCalendar.js +9 -0
  28. package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +18 -6
  29. package/legacy/PickersCalendarHeader/PickersCalendarHeader.types.js +1 -0
  30. package/legacy/YearCalendar/YearCalendar.js +9 -0
  31. package/legacy/index.js +1 -1
  32. package/legacy/internals/components/FakeTextField/FakeTextField.js +41 -15
  33. package/modern/AdapterDateFns/AdapterDateFns.js +1 -1
  34. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
  35. package/modern/AdapterDayjs/AdapterDayjs.js +1 -1
  36. package/modern/AdapterLuxon/AdapterLuxon.js +1 -1
  37. package/modern/DateCalendar/DateCalendar.js +3 -2
  38. package/modern/DateCalendar/DayCalendar.js +1 -3
  39. package/modern/MonthCalendar/MonthCalendar.js +9 -0
  40. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +16 -5
  41. package/modern/PickersCalendarHeader/PickersCalendarHeader.types.js +1 -0
  42. package/modern/YearCalendar/YearCalendar.js +9 -0
  43. package/modern/index.js +1 -1
  44. package/modern/internals/components/FakeTextField/FakeTextField.js +35 -18
  45. package/node/AdapterDateFns/AdapterDateFns.js +1 -1
  46. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
  47. package/node/AdapterDayjs/AdapterDayjs.js +1 -1
  48. package/node/AdapterLuxon/AdapterLuxon.js +1 -1
  49. package/node/DateCalendar/DateCalendar.js +3 -2
  50. package/node/DateCalendar/DayCalendar.js +1 -3
  51. package/node/MonthCalendar/MonthCalendar.js +9 -0
  52. package/node/PickersCalendarHeader/PickersCalendarHeader.js +17 -4
  53. package/node/PickersCalendarHeader/PickersCalendarHeader.types.js +5 -0
  54. package/node/YearCalendar/YearCalendar.js +9 -0
  55. package/node/index.js +1 -1
  56. package/node/internals/components/FakeTextField/FakeTextField.js +36 -19
  57. package/package.json +4 -4
@@ -76,10 +76,11 @@ var DateCalendarViewTransitionContainer = styled(PickersFadeTransitionGroup, {
76
76
  }
77
77
  })({});
78
78
  /**
79
- *
80
79
  * Demos:
81
80
  *
82
- * - [Date Picker](https://mui.com/x/react-date-pickers/date-picker/)
81
+ * - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
82
+ * - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
83
+ * - [Validation](https://mui.com/x/react-date-pickers/validation/)
83
84
  *
84
85
  * API:
85
86
  *
@@ -458,9 +458,7 @@ export function DayCalendar(inProps) {
458
458
  children: localeText.calendarWeekNumberHeaderText
459
459
  }), getWeekdays(utils, now).map(function (weekday, i) {
460
460
  var _dayOfWeekFormatter;
461
- // regression-prevention:
462
- // since 'weekdayShort' now always returns an abbreviated form we slice the first 2 letters from it.
463
- var day = utils.format(weekday, 'weekdayShort').slice(0, 2);
461
+ var day = utils.format(weekday, 'weekdayShort');
464
462
  return /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
465
463
  variant: "caption",
466
464
  role: "columnheader",
@@ -54,6 +54,15 @@ var MonthCalendarRoot = styled('div', {
54
54
  // avoid padding increasing width over defined
55
55
  boxSizing: 'border-box'
56
56
  });
57
+ /**
58
+ * Demos:
59
+ *
60
+ * - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
61
+ *
62
+ * API:
63
+ *
64
+ * - [MonthCalendar API](https://mui.com/x/api/date-pickers/month-calendar/)
65
+ */
57
66
  export var MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inProps, ref) {
58
67
  var props = useMonthCalendarDefaultizedProps(inProps, 'MuiMonthCalendar');
59
68
  var className = props.className,
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
- var _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
4
+ var _excluded = ["slots", "slotProps", "components", "componentsProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
5
5
  _excluded2 = ["ownerState"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
@@ -17,8 +17,6 @@ import { ArrowDropDownIcon } from '../icons';
17
17
  import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher';
18
18
  import { usePreviousMonthDisabled, useNextMonthDisabled } from '../internals/hooks/date-helpers-hooks';
19
19
  import { getPickersCalendarHeaderUtilityClass, pickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
20
-
21
- // We keep the interface to allow module augmentation
22
20
  import { jsx as _jsx } from "react/jsx-runtime";
23
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
22
  var useUtilityClasses = function useUtilityClasses(ownerState) {
@@ -116,7 +114,7 @@ var PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
116
114
  * - [PickersCalendarHeader API](https://mui.com/x/api/date-pickers/pickers-calendar-header/)
117
115
  */
118
116
  var PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalendarHeader(inProps, ref) {
119
- var _slots$switchViewButt, _slots$switchViewIcon;
117
+ var _ref5, _slots$switchViewButt, _ref6, _slots$switchViewIcon;
120
118
  var localeText = useLocaleText();
121
119
  var utils = useUtils();
122
120
  var props = useThemeProps({
@@ -125,6 +123,8 @@ var PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalend
125
123
  });
126
124
  var slots = props.slots,
127
125
  slotProps = props.slotProps,
126
+ components = props.components,
127
+ componentsProps = props.componentsProps,
128
128
  month = props.currentMonth,
129
129
  disabled = props.disabled,
130
130
  disableFuture = props.disableFuture,
@@ -142,7 +142,7 @@ var PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalend
142
142
  other = _objectWithoutProperties(props, _excluded);
143
143
  var ownerState = props;
144
144
  var classes = useUtilityClasses(props);
145
- var SwitchViewButton = (_slots$switchViewButt = slots == null ? void 0 : slots.switchViewButton) != null ? _slots$switchViewButt : PickersCalendarHeaderSwitchViewButton;
145
+ var SwitchViewButton = (_ref5 = (_slots$switchViewButt = slots == null ? void 0 : slots.switchViewButton) != null ? _slots$switchViewButt : components == null ? void 0 : components.SwitchViewButton) != null ? _ref5 : PickersCalendarHeaderSwitchViewButton;
146
146
  var switchViewButtonProps = useSlotProps({
147
147
  elementType: SwitchViewButton,
148
148
  externalSlotProps: slotProps == null ? void 0 : slotProps.switchViewButton,
@@ -153,7 +153,7 @@ var PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalend
153
153
  ownerState: ownerState,
154
154
  className: classes.switchViewButton
155
155
  });
156
- var SwitchViewIcon = (_slots$switchViewIcon = slots == null ? void 0 : slots.switchViewIcon) != null ? _slots$switchViewIcon : PickersCalendarHeaderSwitchViewIcon;
156
+ var SwitchViewIcon = (_ref6 = (_slots$switchViewIcon = slots == null ? void 0 : slots.switchViewIcon) != null ? _slots$switchViewIcon : components == null ? void 0 : components.SwitchViewIcon) != null ? _ref6 : PickersCalendarHeaderSwitchViewIcon;
157
157
  // The spread is here to avoid this bug mui/material-ui#34056
158
158
  var _useSlotProps = useSlotProps({
159
159
  elementType: SwitchViewIcon,
@@ -250,6 +250,18 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
250
250
  * className applied to the root element.
251
251
  */
252
252
  className: PropTypes.string,
253
+ /**
254
+ * Overridable components.
255
+ * @default {}
256
+ * @deprecated Please use `slots`.
257
+ */
258
+ components: PropTypes.object,
259
+ /**
260
+ * The props used for each component slot.
261
+ * @default {}
262
+ * @deprecated Please use `slotProps`.
263
+ */
264
+ componentsProps: PropTypes.object,
253
265
  currentMonth: PropTypes.any.isRequired,
254
266
  disabled: PropTypes.bool,
255
267
  disableFuture: PropTypes.bool,
@@ -60,6 +60,15 @@ var YearCalendarRoot = styled('div', {
60
60
  boxSizing: 'border-box',
61
61
  position: 'relative'
62
62
  });
63
+ /**
64
+ * Demos:
65
+ *
66
+ * - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
67
+ *
68
+ * API:
69
+ *
70
+ * - [YearCalendar API](https://mui.com/x/api/date-pickers/year-calendar/)
71
+ */
63
72
  export var YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps, ref) {
64
73
  var props = useYearCalendarDefaultizedProps(inProps, 'MuiYearCalendar');
65
74
  var autoFocus = props.autoFocus,
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v6.16.3
2
+ * @mui/x-date-pickers v6.18.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,23 +1,49 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["before", "after"];
3
+ var _excluded = ["elements", "valueStr", "onValueStrChange", "id", "error", "InputProps", "inputProps", "autoFocus", "disabled", "valueType", "ownerState"];
4
4
  import * as React from 'react';
5
- import Stack from '@mui/material/Stack';
5
+ import Box from '@mui/material/Box';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { createElement as _createElement } from "react";
7
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
9
  export var FakeTextField = /*#__PURE__*/React.forwardRef(function FakeTextField(props, ref) {
9
- var elements = props.elements;
10
- return /*#__PURE__*/_jsx(Stack, {
11
- direction: "row",
12
- spacing: 1,
13
- ref: ref,
14
- children: elements.map(function (_ref, elementIndex) {
15
- var before = _ref.before,
16
- after = _ref.after,
17
- otherElementProps = _objectWithoutProperties(_ref, _excluded);
18
- return /*#__PURE__*/_jsxs(React.Fragment, {
19
- children: [before, /*#__PURE__*/_jsx("input", _extends({}, otherElementProps)), after]
20
- }, elementIndex);
21
- })
10
+ var elements = props.elements,
11
+ valueStr = props.valueStr,
12
+ onValueStrChange = props.onValueStrChange,
13
+ id = props.id,
14
+ error = props.error,
15
+ InputProps = props.InputProps,
16
+ inputProps = props.inputProps,
17
+ autoFocus = props.autoFocus,
18
+ disabled = props.disabled,
19
+ valueType = props.valueType,
20
+ ownerState = props.ownerState,
21
+ other = _objectWithoutProperties(props, _excluded);
22
+ return /*#__PURE__*/_jsxs(React.Fragment, {
23
+ children: [/*#__PURE__*/_jsx(Box, _extends({
24
+ ref: ref
25
+ }, other, {
26
+ style: {
27
+ display: 'inline-block',
28
+ border: '1px solid black',
29
+ borderRadius: 4,
30
+ padding: '2px 4px',
31
+ color: valueType === 'placeholder' ? 'grey' : 'black'
32
+ },
33
+ children: elements.map(function (_ref, elementIndex) {
34
+ var container = _ref.container,
35
+ content = _ref.content,
36
+ before = _ref.before,
37
+ after = _ref.after;
38
+ return /*#__PURE__*/_createElement("span", _extends({}, container, {
39
+ key: elementIndex
40
+ }), /*#__PURE__*/_jsx("span", _extends({}, before)), /*#__PURE__*/_jsx("span", _extends({}, content)), /*#__PURE__*/_jsx("span", _extends({}, after)));
41
+ })
42
+ })), /*#__PURE__*/_jsx("input", {
43
+ type: "hidden",
44
+ value: valueStr,
45
+ onChange: onValueStrChange,
46
+ id: id
47
+ })]
22
48
  });
23
49
  });
@@ -228,7 +228,7 @@ const defaultFormats = {
228
228
  monthShort: 'MMM',
229
229
  dayOfMonth: 'd',
230
230
  weekday: 'EEEE',
231
- weekdayShort: 'EEE',
231
+ weekdayShort: 'EEEEEE',
232
232
  hours24h: 'HH',
233
233
  hours12h: 'hh',
234
234
  meridiem: 'aa',
@@ -228,7 +228,7 @@ const defaultFormats = {
228
228
  monthShort: 'MMM',
229
229
  dayOfMonth: 'd',
230
230
  weekday: 'EEEE',
231
- weekdayShort: 'EEE',
231
+ weekdayShort: 'EEEEEE',
232
232
  hours24h: 'HH',
233
233
  hours12h: 'hh',
234
234
  meridiem: 'aa',
@@ -99,7 +99,7 @@ const defaultFormats = {
99
99
  monthShort: 'MMM',
100
100
  dayOfMonth: 'D',
101
101
  weekday: 'dddd',
102
- weekdayShort: 'ddd',
102
+ weekdayShort: 'dd',
103
103
  hours24h: 'HH',
104
104
  hours12h: 'hh',
105
105
  meridiem: 'A',
@@ -113,7 +113,7 @@ const defaultFormats = {
113
113
  monthShort: 'MMM',
114
114
  dayOfMonth: 'd',
115
115
  weekday: 'cccc',
116
- weekdayShort: 'ccc',
116
+ weekdayShort: 'ccccc',
117
117
  hours24h: 'HH',
118
118
  hours12h: 'hh',
119
119
  meridiem: 'a',
@@ -71,10 +71,11 @@ const DateCalendarViewTransitionContainer = styled(PickersFadeTransitionGroup, {
71
71
  overridesResolver: (props, styles) => styles.viewTransitionContainer
72
72
  })({});
73
73
  /**
74
- *
75
74
  * Demos:
76
75
  *
77
- * - [Date Picker](https://mui.com/x/react-date-pickers/date-picker/)
76
+ * - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
77
+ * - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
78
+ * - [Validation](https://mui.com/x/react-date-pickers/validation/)
78
79
  *
79
80
  * API:
80
81
  *
@@ -412,9 +412,7 @@ export function DayCalendar(inProps) {
412
412
  className: classes.weekNumberLabel,
413
413
  children: localeText.calendarWeekNumberHeaderText
414
414
  }), getWeekdays(utils, now).map((weekday, i) => {
415
- // regression-prevention:
416
- // since 'weekdayShort' now always returns an abbreviated form we slice the first 2 letters from it.
417
- const day = utils.format(weekday, 'weekdayShort').slice(0, 2);
415
+ const day = utils.format(weekday, 'weekdayShort');
418
416
  return /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
419
417
  variant: "caption",
420
418
  role: "columnheader",
@@ -53,6 +53,15 @@ const MonthCalendarRoot = styled('div', {
53
53
  // avoid padding increasing width over defined
54
54
  boxSizing: 'border-box'
55
55
  });
56
+ /**
57
+ * Demos:
58
+ *
59
+ * - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
60
+ *
61
+ * API:
62
+ *
63
+ * - [MonthCalendar API](https://mui.com/x/api/date-pickers/month-calendar/)
64
+ */
56
65
  export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inProps, ref) {
57
66
  const props = useMonthCalendarDefaultizedProps(inProps, 'MuiMonthCalendar');
58
67
  const {
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
3
+ const _excluded = ["slots", "slotProps", "components", "componentsProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
4
4
  _excluded2 = ["ownerState"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
@@ -16,8 +16,6 @@ import { ArrowDropDownIcon } from '../icons';
16
16
  import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher';
17
17
  import { usePreviousMonthDisabled, useNextMonthDisabled } from '../internals/hooks/date-helpers-hooks';
18
18
  import { getPickersCalendarHeaderUtilityClass, pickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
19
-
20
- // We keep the interface to allow module augmentation
21
19
  import { jsx as _jsx } from "react/jsx-runtime";
22
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
23
21
  const useUtilityClasses = ownerState => {
@@ -115,6 +113,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
115
113
  const {
116
114
  slots,
117
115
  slotProps,
116
+ components,
118
117
  currentMonth: month,
119
118
  disabled,
120
119
  disableFuture,
@@ -133,7 +132,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
133
132
  other = _objectWithoutPropertiesLoose(props, _excluded);
134
133
  const ownerState = props;
135
134
  const classes = useUtilityClasses(props);
136
- const SwitchViewButton = slots?.switchViewButton ?? PickersCalendarHeaderSwitchViewButton;
135
+ const SwitchViewButton = slots?.switchViewButton ?? components?.SwitchViewButton ?? PickersCalendarHeaderSwitchViewButton;
137
136
  const switchViewButtonProps = useSlotProps({
138
137
  elementType: SwitchViewButton,
139
138
  externalSlotProps: slotProps?.switchViewButton,
@@ -144,7 +143,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
144
143
  ownerState,
145
144
  className: classes.switchViewButton
146
145
  });
147
- const SwitchViewIcon = slots?.switchViewIcon ?? PickersCalendarHeaderSwitchViewIcon;
146
+ const SwitchViewIcon = slots?.switchViewIcon ?? components?.SwitchViewIcon ?? PickersCalendarHeaderSwitchViewIcon;
148
147
  // The spread is here to avoid this bug mui/material-ui#34056
149
148
  const _useSlotProps = useSlotProps({
150
149
  elementType: SwitchViewIcon,
@@ -234,6 +233,18 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
234
233
  * className applied to the root element.
235
234
  */
236
235
  className: PropTypes.string,
236
+ /**
237
+ * Overridable components.
238
+ * @default {}
239
+ * @deprecated Please use `slots`.
240
+ */
241
+ components: PropTypes.object,
242
+ /**
243
+ * The props used for each component slot.
244
+ * @default {}
245
+ * @deprecated Please use `slotProps`.
246
+ */
247
+ componentsProps: PropTypes.object,
237
248
  currentMonth: PropTypes.any.isRequired,
238
249
  disabled: PropTypes.bool,
239
250
  disableFuture: PropTypes.bool,
@@ -58,6 +58,15 @@ const YearCalendarRoot = styled('div', {
58
58
  boxSizing: 'border-box',
59
59
  position: 'relative'
60
60
  });
61
+ /**
62
+ * Demos:
63
+ *
64
+ * - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
65
+ *
66
+ * API:
67
+ *
68
+ * - [YearCalendar API](https://mui.com/x/api/date-pickers/year-calendar/)
69
+ */
61
70
  export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps, ref) {
62
71
  const props = useYearCalendarDefaultizedProps(inProps, 'MuiYearCalendar');
63
72
  const {
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v6.16.3
2
+ * @mui/x-date-pickers v6.18.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,27 +1,44 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["before", "after"];
3
+ const _excluded = ["elements", "valueStr", "onValueStrChange", "id", "error", "InputProps", "inputProps", "autoFocus", "disabled", "valueType", "ownerState"];
4
4
  import * as React from 'react';
5
- import Stack from '@mui/material/Stack';
5
+ import Box from '@mui/material/Box';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { createElement as _createElement } from "react";
7
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
9
  export const FakeTextField = /*#__PURE__*/React.forwardRef(function FakeTextField(props, ref) {
9
10
  const {
10
- elements
11
- } = props;
12
- return /*#__PURE__*/_jsx(Stack, {
13
- direction: "row",
14
- spacing: 1,
15
- ref: ref,
16
- children: elements.map((_ref, elementIndex) => {
17
- let {
18
- before,
19
- after
20
- } = _ref,
21
- otherElementProps = _objectWithoutPropertiesLoose(_ref, _excluded);
22
- return /*#__PURE__*/_jsxs(React.Fragment, {
23
- children: [before, /*#__PURE__*/_jsx("input", _extends({}, otherElementProps)), after]
24
- }, elementIndex);
25
- })
11
+ elements,
12
+ valueStr,
13
+ onValueStrChange,
14
+ id,
15
+ valueType
16
+ } = props,
17
+ other = _objectWithoutPropertiesLoose(props, _excluded);
18
+ return /*#__PURE__*/_jsxs(React.Fragment, {
19
+ children: [/*#__PURE__*/_jsx(Box, _extends({
20
+ ref: ref
21
+ }, other, {
22
+ style: {
23
+ display: 'inline-block',
24
+ border: '1px solid black',
25
+ borderRadius: 4,
26
+ padding: '2px 4px',
27
+ color: valueType === 'placeholder' ? 'grey' : 'black'
28
+ },
29
+ children: elements.map(({
30
+ container,
31
+ content,
32
+ before,
33
+ after
34
+ }, elementIndex) => /*#__PURE__*/_createElement("span", _extends({}, container, {
35
+ key: elementIndex
36
+ }), /*#__PURE__*/_jsx("span", _extends({}, before)), /*#__PURE__*/_jsx("span", _extends({}, content)), /*#__PURE__*/_jsx("span", _extends({}, after))))
37
+ })), /*#__PURE__*/_jsx("input", {
38
+ type: "hidden",
39
+ value: valueStr,
40
+ onChange: onValueStrChange,
41
+ id: id
42
+ })]
26
43
  });
27
44
  });
@@ -237,7 +237,7 @@ const defaultFormats = {
237
237
  monthShort: 'MMM',
238
238
  dayOfMonth: 'd',
239
239
  weekday: 'EEEE',
240
- weekdayShort: 'EEE',
240
+ weekdayShort: 'EEEEEE',
241
241
  hours24h: 'HH',
242
242
  hours12h: 'hh',
243
243
  meridiem: 'aa',
@@ -237,7 +237,7 @@ const defaultFormats = {
237
237
  monthShort: 'MMM',
238
238
  dayOfMonth: 'd',
239
239
  weekday: 'EEEE',
240
- weekdayShort: 'EEE',
240
+ weekdayShort: 'EEEEEE',
241
241
  hours24h: 'HH',
242
242
  hours12h: 'hh',
243
243
  meridiem: 'aa',
@@ -107,7 +107,7 @@ const defaultFormats = {
107
107
  monthShort: 'MMM',
108
108
  dayOfMonth: 'D',
109
109
  weekday: 'dddd',
110
- weekdayShort: 'ddd',
110
+ weekdayShort: 'dd',
111
111
  hours24h: 'HH',
112
112
  hours12h: 'hh',
113
113
  meridiem: 'A',
@@ -121,7 +121,7 @@ const defaultFormats = {
121
121
  monthShort: 'MMM',
122
122
  dayOfMonth: 'd',
123
123
  weekday: 'cccc',
124
- weekdayShort: 'ccc',
124
+ weekdayShort: 'ccccc',
125
125
  hours24h: 'HH',
126
126
  hours12h: 'hh',
127
127
  meridiem: 'a',
@@ -79,10 +79,11 @@ const DateCalendarViewTransitionContainer = (0, _styles.styled)(_PickersFadeTran
79
79
  overridesResolver: (props, styles) => styles.viewTransitionContainer
80
80
  })({});
81
81
  /**
82
- *
83
82
  * Demos:
84
83
  *
85
- * - [Date Picker](https://mui.com/x/react-date-pickers/date-picker/)
84
+ * - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
85
+ * - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
86
+ * - [Validation](https://mui.com/x/react-date-pickers/validation/)
86
87
  *
87
88
  * API:
88
89
  *
@@ -420,9 +420,7 @@ function DayCalendar(inProps) {
420
420
  className: classes.weekNumberLabel,
421
421
  children: localeText.calendarWeekNumberHeaderText
422
422
  }), (0, _dateUtils.getWeekdays)(utils, now).map((weekday, i) => {
423
- // regression-prevention:
424
- // since 'weekdayShort' now always returns an abbreviated form we slice the first 2 letters from it.
425
- const day = utils.format(weekday, 'weekdayShort').slice(0, 2);
423
+ const day = utils.format(weekday, 'weekdayShort');
426
424
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersCalendarWeekDayLabel, {
427
425
  variant: "caption",
428
426
  role: "columnheader",
@@ -63,6 +63,15 @@ const MonthCalendarRoot = (0, _styles.styled)('div', {
63
63
  // avoid padding increasing width over defined
64
64
  boxSizing: 'border-box'
65
65
  });
66
+ /**
67
+ * Demos:
68
+ *
69
+ * - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
70
+ *
71
+ * API:
72
+ *
73
+ * - [MonthCalendar API](https://mui.com/x/api/date-pickers/month-calendar/)
74
+ */
66
75
  const MonthCalendar = exports.MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inProps, ref) {
67
76
  const props = useMonthCalendarDefaultizedProps(inProps, 'MuiMonthCalendar');
68
77
  const {
@@ -22,8 +22,8 @@ var _PickersArrowSwitcher = require("../internals/components/PickersArrowSwitche
22
22
  var _dateHelpersHooks = require("../internals/hooks/date-helpers-hooks");
23
23
  var _pickersCalendarHeaderClasses = require("./pickersCalendarHeaderClasses");
24
24
  var _jsxRuntime = require("react/jsx-runtime");
25
- const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
26
- _excluded2 = ["ownerState"]; // We keep the interface to allow module augmentation
25
+ const _excluded = ["slots", "slotProps", "components", "componentsProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone"],
26
+ _excluded2 = ["ownerState"];
27
27
  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); }
28
28
  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; }
29
29
  const useUtilityClasses = ownerState => {
@@ -121,6 +121,7 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
121
121
  const {
122
122
  slots,
123
123
  slotProps,
124
+ components,
124
125
  currentMonth: month,
125
126
  disabled,
126
127
  disableFuture,
@@ -139,7 +140,7 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
139
140
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
140
141
  const ownerState = props;
141
142
  const classes = useUtilityClasses(props);
142
- const SwitchViewButton = slots?.switchViewButton ?? PickersCalendarHeaderSwitchViewButton;
143
+ const SwitchViewButton = slots?.switchViewButton ?? components?.SwitchViewButton ?? PickersCalendarHeaderSwitchViewButton;
143
144
  const switchViewButtonProps = (0, _utils.useSlotProps)({
144
145
  elementType: SwitchViewButton,
145
146
  externalSlotProps: slotProps?.switchViewButton,
@@ -150,7 +151,7 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
150
151
  ownerState,
151
152
  className: classes.switchViewButton
152
153
  });
153
- const SwitchViewIcon = slots?.switchViewIcon ?? PickersCalendarHeaderSwitchViewIcon;
154
+ const SwitchViewIcon = slots?.switchViewIcon ?? components?.SwitchViewIcon ?? PickersCalendarHeaderSwitchViewIcon;
154
155
  // The spread is here to avoid this bug mui/material-ui#34056
155
156
  const _useSlotProps = (0, _utils.useSlotProps)({
156
157
  elementType: SwitchViewIcon,
@@ -240,6 +241,18 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
240
241
  * className applied to the root element.
241
242
  */
242
243
  className: _propTypes.default.string,
244
+ /**
245
+ * Overridable components.
246
+ * @default {}
247
+ * @deprecated Please use `slots`.
248
+ */
249
+ components: _propTypes.default.object,
250
+ /**
251
+ * The props used for each component slot.
252
+ * @default {}
253
+ * @deprecated Please use `slotProps`.
254
+ */
255
+ componentsProps: _propTypes.default.object,
243
256
  currentMonth: _propTypes.default.any.isRequired,
244
257
  disabled: _propTypes.default.bool,
245
258
  disableFuture: _propTypes.default.bool,
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -67,6 +67,15 @@ const YearCalendarRoot = (0, _styles.styled)('div', {
67
67
  boxSizing: 'border-box',
68
68
  position: 'relative'
69
69
  });
70
+ /**
71
+ * Demos:
72
+ *
73
+ * - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
74
+ *
75
+ * API:
76
+ *
77
+ * - [YearCalendar API](https://mui.com/x/api/date-pickers/year-calendar/)
78
+ */
70
79
  const YearCalendar = exports.YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps, ref) {
71
80
  const props = useYearCalendarDefaultizedProps(inProps, 'MuiYearCalendar');
72
81
  const {
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v6.16.3
2
+ * @mui/x-date-pickers v6.18.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the