@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.
- package/AdapterDateFns/AdapterDateFns.js +1 -1
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
- package/AdapterDayjs/AdapterDayjs.js +1 -1
- package/AdapterLuxon/AdapterLuxon.js +1 -1
- package/CHANGELOG.md +127 -0
- package/DateCalendar/DateCalendar.d.ts +3 -2
- package/DateCalendar/DateCalendar.js +3 -2
- package/DateCalendar/DayCalendar.js +1 -3
- package/MonthCalendar/MonthCalendar.d.ts +9 -0
- package/MonthCalendar/MonthCalendar.js +9 -0
- package/PickersCalendarHeader/PickersCalendarHeader.d.ts +1 -62
- package/PickersCalendarHeader/PickersCalendarHeader.js +17 -6
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +75 -0
- package/PickersCalendarHeader/PickersCalendarHeader.types.js +1 -0
- package/PickersCalendarHeader/index.d.ts +1 -1
- package/YearCalendar/YearCalendar.d.ts +9 -0
- package/YearCalendar/YearCalendar.js +9 -0
- package/index.js +1 -1
- package/internals/components/FakeTextField/FakeTextField.d.ts +15 -3
- package/internals/components/FakeTextField/FakeTextField.js +35 -18
- package/legacy/AdapterDateFns/AdapterDateFns.js +1 -1
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
- package/legacy/AdapterDayjs/AdapterDayjs.js +1 -1
- package/legacy/AdapterLuxon/AdapterLuxon.js +1 -1
- package/legacy/DateCalendar/DateCalendar.js +3 -2
- package/legacy/DateCalendar/DayCalendar.js +1 -3
- package/legacy/MonthCalendar/MonthCalendar.js +9 -0
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +18 -6
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.types.js +1 -0
- package/legacy/YearCalendar/YearCalendar.js +9 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/components/FakeTextField/FakeTextField.js +41 -15
- package/modern/AdapterDateFns/AdapterDateFns.js +1 -1
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
- package/modern/AdapterDayjs/AdapterDayjs.js +1 -1
- package/modern/AdapterLuxon/AdapterLuxon.js +1 -1
- package/modern/DateCalendar/DateCalendar.js +3 -2
- package/modern/DateCalendar/DayCalendar.js +1 -3
- package/modern/MonthCalendar/MonthCalendar.js +9 -0
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +16 -5
- package/modern/PickersCalendarHeader/PickersCalendarHeader.types.js +1 -0
- package/modern/YearCalendar/YearCalendar.js +9 -0
- package/modern/index.js +1 -1
- package/modern/internals/components/FakeTextField/FakeTextField.js +35 -18
- package/node/AdapterDateFns/AdapterDateFns.js +1 -1
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +1 -1
- package/node/AdapterDayjs/AdapterDayjs.js +1 -1
- package/node/AdapterLuxon/AdapterLuxon.js +1 -1
- package/node/DateCalendar/DateCalendar.js +3 -2
- package/node/DateCalendar/DayCalendar.js +1 -3
- package/node/MonthCalendar/MonthCalendar.js +9 -0
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +17 -4
- package/node/PickersCalendarHeader/PickersCalendarHeader.types.js +5 -0
- package/node/YearCalendar/YearCalendar.js +9 -0
- package/node/index.js +1 -1
- package/node/internals/components/FakeTextField/FakeTextField.js +36 -19
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,133 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.18.0
|
|
7
|
+
|
|
8
|
+
_Nov 3, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 The Charts package is now officially stable!
|
|
13
|
+
- 🥧 Pie charts are now animated.
|
|
14
|
+
- 📈 Line charts now support partial data, and can interpolate missing data.
|
|
15
|
+
|
|
16
|
+
<img width="380" alt="line charts with partial data" src="https://github.com/mui/mui-x/assets/45398769/385ecf77-19b2-4a03-8aef-5d547db1d9ad">
|
|
17
|
+
|
|
18
|
+
- ✨ Allow to ignore [diacritics](https://en.wikipedia.org/wiki/Diacritic) when filtering
|
|
19
|
+
- 📚 Documentation improvements
|
|
20
|
+
|
|
21
|
+
### Data Grid
|
|
22
|
+
|
|
23
|
+
#### `@mui/x-data-grid@6.18.0`
|
|
24
|
+
|
|
25
|
+
- [DataGrid] Allow to ignore [diacritics](https://en.wikipedia.org/wiki/Diacritic) when filtering (#10569) @cherniavskii
|
|
26
|
+
- [DataGrid] Fix a typo in `gridFilterApi` (#10786) @vu-dao-93
|
|
27
|
+
- [DataGrid] Fix `undefined` row id (#10670) @romgrk
|
|
28
|
+
- [DataGrid] Make column autosizing work with dynamic row height (#10693) @cherniavskii
|
|
29
|
+
- [l10n] Allow to customize sorting label per column (#10839) @JerryWu1234
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-pro@6.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid@6.18.0`.
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid-premium@6.18.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
36
|
+
|
|
37
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.0`.
|
|
38
|
+
|
|
39
|
+
### Date Pickers
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-date-pickers@6.18.0`
|
|
42
|
+
|
|
43
|
+
- [pickers] Add reference links to calendar components (#10644) @michelengelen
|
|
44
|
+
|
|
45
|
+
#### `@mui/x-date-pickers-pro@6.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
46
|
+
|
|
47
|
+
Same changes as in `@mui/x-date-pickers@6.18.0`.
|
|
48
|
+
|
|
49
|
+
### Charts / `@mui/x-charts@6.18.0`
|
|
50
|
+
|
|
51
|
+
- [charts] Add animation on pie chart (#10782) @alexfauquette
|
|
52
|
+
- [charts] Add reference links to shared/misc chart components (#10660) @michelengelen
|
|
53
|
+
- [charts] Allows to connect nulls (#10803) @alexfauquette
|
|
54
|
+
- [charts] Fix axis highlight in dark mode (#10820) @LukasTy
|
|
55
|
+
|
|
56
|
+
### Docs
|
|
57
|
+
|
|
58
|
+
- [docs] Add a data grid recipe for autosizing columns after fetching row-data (#10822) @michelengelen
|
|
59
|
+
- [docs] Add a data grid recipe showing how to remove cell outline on `focus` (#10843) @michelengelen
|
|
60
|
+
- [docs] Add demo about how to use charts margin (#10886) @alexfauquette
|
|
61
|
+
- [docs] Improve custom field input demos readability (#10559) @LukasTy
|
|
62
|
+
|
|
63
|
+
### Core
|
|
64
|
+
|
|
65
|
+
- [core] Generate `slot` API descriptions based on `slots` or `components` (#10879) @LukasTy
|
|
66
|
+
|
|
67
|
+
## 6.17.0
|
|
68
|
+
|
|
69
|
+
_Oct 27, 2023_
|
|
70
|
+
|
|
71
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
72
|
+
|
|
73
|
+
- 🎁 The Tree View package is now officially stable!
|
|
74
|
+
|
|
75
|
+

|
|
76
|
+
|
|
77
|
+
- ✨ Improve the handling of non-numeric values by Data Grid aggregation
|
|
78
|
+
- 🚀 Support lines with different domains on the line charts
|
|
79
|
+
- 🐞 Bugfixes
|
|
80
|
+
- 📚 Documentation improvements
|
|
81
|
+
|
|
82
|
+
### Data Grid
|
|
83
|
+
|
|
84
|
+
#### `@mui/x-data-grid@6.17.0`
|
|
85
|
+
|
|
86
|
+
- [DataGrid] Allow custom debounce time for row positions calculation (#10708) @cherniavskii
|
|
87
|
+
- [DataGrid] Persist stable row index for focused row (#10674) @cherniavskii
|
|
88
|
+
|
|
89
|
+
#### `@mui/x-data-grid-pro@6.17.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
90
|
+
|
|
91
|
+
Same changes as in `@mui/x-data-grid@6.17.0`, plus:
|
|
92
|
+
|
|
93
|
+
- [DataGridPro] Fix `undefined` values passed to `valueFormatter` for tree leaf nodes (#10748) @cherniavskii
|
|
94
|
+
|
|
95
|
+
#### `@mui/x-data-grid-premium@6.17.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
96
|
+
|
|
97
|
+
Same changes as in `@mui/x-data-grid-pro@6.17.0`, plus:
|
|
98
|
+
|
|
99
|
+
- [DataGridPremium] Fix `avg` aggregation to ignore non-numeric values (#10787) @cherniavskii
|
|
100
|
+
- [DataGridPremium] Fix `size` aggregation to ignore `undefined` values (#10745) @cherniavskii
|
|
101
|
+
- [DataGridPremium] Fix `sum` aggregation to ignore non-numeric values (#10730) @cherniavskii
|
|
102
|
+
- [DataGridPremium] Fix cell selection throwing index error on second page and beyond (#10784) @MBilalShafi
|
|
103
|
+
|
|
104
|
+
### Date Pickers
|
|
105
|
+
|
|
106
|
+
#### `@mui/x-date-pickers@6.17.0`
|
|
107
|
+
|
|
108
|
+
- [fields] POC: Use `contentEditable` on `FakeTextField` (#10779) @flaviendelangle
|
|
109
|
+
- [pickers] Fix weekday label localization (#10809) @LukasTy
|
|
110
|
+
|
|
111
|
+
#### `@mui/x-date-pickers-pro@6.17.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
112
|
+
|
|
113
|
+
Same changes as in `@mui/x-date-pickers@6.17.0`.
|
|
114
|
+
|
|
115
|
+
### Charts / `@mui/x-charts@6.0.0-alpha.17`
|
|
116
|
+
|
|
117
|
+
- [charts] Fix text position in Safari (#10815) @lhilgert9
|
|
118
|
+
- [charts] Support lines with different domains (#10801) @alexfauquette
|
|
119
|
+
|
|
120
|
+
### Tree View / `@mui/x-tree-view@6.17.0`
|
|
121
|
+
|
|
122
|
+
No change
|
|
123
|
+
|
|
124
|
+
### Docs
|
|
125
|
+
|
|
126
|
+
- [docs] Correct editing related props' description (#10798) @MBilalShafi
|
|
127
|
+
- [docs] Fix RTL data grid demo (#10728) @oliviertassinari
|
|
128
|
+
- [docs] Fix unclosed warning (#10796) @flaviendelangle
|
|
129
|
+
- [docs] Improve performance of `Save and restore the state from external storage` recipe (#10811) @michelengelen
|
|
130
|
+
|
|
131
|
+
- [test] Add missing type on `cleanText` utility function (#10780) @flaviendelangle
|
|
132
|
+
|
|
6
133
|
## 6.16.3
|
|
7
134
|
|
|
8
135
|
_Oct 20, 2023_
|
|
@@ -4,10 +4,11 @@ type DateCalendarComponent = (<TDate>(props: DateCalendarProps<TDate> & React.Re
|
|
|
4
4
|
propTypes?: any;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
7
|
* Demos:
|
|
9
8
|
*
|
|
10
|
-
* - [
|
|
9
|
+
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
|
10
|
+
* - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
|
|
11
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
11
12
|
*
|
|
12
13
|
* API:
|
|
13
14
|
*
|
|
@@ -72,10 +72,11 @@ const DateCalendarViewTransitionContainer = styled(PickersFadeTransitionGroup, {
|
|
|
72
72
|
overridesResolver: (props, styles) => styles.viewTransitionContainer
|
|
73
73
|
})({});
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
75
|
* Demos:
|
|
77
76
|
*
|
|
78
|
-
* - [
|
|
77
|
+
* - [DatePicker](https://mui.com/x/react-date-pickers/date-picker/)
|
|
78
|
+
* - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
|
|
79
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
79
80
|
*
|
|
80
81
|
* API:
|
|
81
82
|
*
|
|
@@ -414,9 +414,7 @@ export function DayCalendar(inProps) {
|
|
|
414
414
|
children: localeText.calendarWeekNumberHeaderText
|
|
415
415
|
}), getWeekdays(utils, now).map((weekday, i) => {
|
|
416
416
|
var _dayOfWeekFormatter;
|
|
417
|
-
|
|
418
|
-
// since 'weekdayShort' now always returns an abbreviated form we slice the first 2 letters from it.
|
|
419
|
-
const day = utils.format(weekday, 'weekdayShort').slice(0, 2);
|
|
417
|
+
const day = utils.format(weekday, 'weekdayShort');
|
|
420
418
|
return /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
|
|
421
419
|
variant: "caption",
|
|
422
420
|
role: "columnheader",
|
|
@@ -5,5 +5,14 @@ export declare function useMonthCalendarDefaultizedProps<TDate>(props: MonthCale
|
|
|
5
5
|
type MonthCalendarComponent = (<TDate>(props: MonthCalendarProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
6
6
|
propTypes?: any;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Demos:
|
|
10
|
+
*
|
|
11
|
+
* - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
|
|
12
|
+
*
|
|
13
|
+
* API:
|
|
14
|
+
*
|
|
15
|
+
* - [MonthCalendar API](https://mui.com/x/api/date-pickers/month-calendar/)
|
|
16
|
+
*/
|
|
8
17
|
export declare const MonthCalendar: MonthCalendarComponent;
|
|
9
18
|
export {};
|
|
@@ -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,66 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { SlotComponentProps } from '@mui/base/utils';
|
|
4
|
-
import IconButton from '@mui/material/IconButton';
|
|
5
|
-
import SvgIcon from '@mui/material/SvgIcon';
|
|
6
|
-
import { SlideDirection } from '../DateCalendar/PickersSlideTransition';
|
|
7
|
-
import { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlotsComponent, PickersArrowSwitcherSlotsComponentsProps } from '../internals/components/PickersArrowSwitcher';
|
|
8
|
-
import { MonthValidationOptions } from '../internals/hooks/date-helpers-hooks';
|
|
9
|
-
import { DateView } from '../models';
|
|
10
|
-
import { PickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
|
|
11
|
-
import { UncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
12
|
-
export type ExportedPickersCalendarHeaderProps<TDate> = Pick<PickersCalendarHeaderProps<TDate>, 'classes' | 'slots' | 'slotProps'>;
|
|
13
|
-
export interface PickersCalendarHeaderSlotsComponent extends PickersArrowSwitcherSlotsComponent {
|
|
14
|
-
/**
|
|
15
|
-
* Button displayed to switch between different calendar views.
|
|
16
|
-
* @default IconButton
|
|
17
|
-
*/
|
|
18
|
-
SwitchViewButton?: React.ElementType;
|
|
19
|
-
/**
|
|
20
|
-
* Icon displayed in the SwitchViewButton. Rotated by 180° when the open view is 'year'.
|
|
21
|
-
* @default ArrowDropDown
|
|
22
|
-
*/
|
|
23
|
-
SwitchViewIcon?: React.ElementType;
|
|
24
|
-
}
|
|
25
|
-
export interface PickersCalendarHeaderComponentsPropsOverrides {
|
|
26
|
-
}
|
|
27
|
-
type PickersCalendarHeaderOwnerState<TDate> = PickersCalendarHeaderProps<TDate>;
|
|
28
|
-
export interface PickersCalendarHeaderSlotsComponentsProps<TDate> extends PickersArrowSwitcherSlotsComponentsProps {
|
|
29
|
-
switchViewButton?: SlotComponentProps<typeof IconButton, PickersCalendarHeaderComponentsPropsOverrides, PickersCalendarHeaderOwnerState<TDate>>;
|
|
30
|
-
switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderComponentsPropsOverrides, undefined>;
|
|
31
|
-
}
|
|
32
|
-
export interface PickersCalendarHeaderProps<TDate> extends ExportedPickersArrowSwitcherProps, MonthValidationOptions<TDate> {
|
|
33
|
-
/**
|
|
34
|
-
* Overridable component slots.
|
|
35
|
-
* @default {}
|
|
36
|
-
*/
|
|
37
|
-
slots?: UncapitalizeObjectKeys<PickersCalendarHeaderSlotsComponent>;
|
|
38
|
-
/**
|
|
39
|
-
* The props used for each component slot.
|
|
40
|
-
* @default {}
|
|
41
|
-
*/
|
|
42
|
-
slotProps?: PickersCalendarHeaderSlotsComponentsProps<TDate>;
|
|
43
|
-
currentMonth: TDate;
|
|
44
|
-
disabled?: boolean;
|
|
45
|
-
views: readonly DateView[];
|
|
46
|
-
onMonthChange: (date: TDate, slideDirection: SlideDirection) => void;
|
|
47
|
-
view: DateView;
|
|
48
|
-
reduceAnimations: boolean;
|
|
49
|
-
onViewChange?: (view: DateView) => void;
|
|
50
|
-
labelId?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Override or extend the styles applied to the component.
|
|
53
|
-
*/
|
|
54
|
-
classes?: Partial<PickersCalendarHeaderClasses>;
|
|
55
|
-
/**
|
|
56
|
-
* className applied to the root element.
|
|
57
|
-
*/
|
|
58
|
-
className?: string;
|
|
59
|
-
/**
|
|
60
|
-
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
61
|
-
*/
|
|
62
|
-
sx?: SxProps<Theme>;
|
|
63
|
-
}
|
|
2
|
+
import { PickersCalendarHeaderProps } from './PickersCalendarHeader.types';
|
|
64
3
|
type PickersCalendarHeaderComponent = (<TDate>(props: PickersCalendarHeaderProps<TDate> & React.RefAttributes<HTMLButtonElement>) => React.JSX.Element) & {
|
|
65
4
|
propTypes?: any;
|
|
66
5
|
};
|
|
@@ -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 => {
|
|
@@ -106,7 +104,7 @@ const PickersCalendarHeaderSwitchViewIcon = styled(ArrowDropDownIcon, {
|
|
|
106
104
|
* - [PickersCalendarHeader API](https://mui.com/x/api/date-pickers/pickers-calendar-header/)
|
|
107
105
|
*/
|
|
108
106
|
const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalendarHeader(inProps, ref) {
|
|
109
|
-
var _slots$switchViewButt, _slots$switchViewIcon;
|
|
107
|
+
var _ref, _slots$switchViewButt, _ref2, _slots$switchViewIcon;
|
|
110
108
|
const localeText = useLocaleText();
|
|
111
109
|
const utils = useUtils();
|
|
112
110
|
const props = useThemeProps({
|
|
@@ -116,6 +114,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
116
114
|
const {
|
|
117
115
|
slots,
|
|
118
116
|
slotProps,
|
|
117
|
+
components,
|
|
119
118
|
currentMonth: month,
|
|
120
119
|
disabled,
|
|
121
120
|
disableFuture,
|
|
@@ -134,7 +133,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
134
133
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
135
134
|
const ownerState = props;
|
|
136
135
|
const classes = useUtilityClasses(props);
|
|
137
|
-
const SwitchViewButton = (_slots$switchViewButt = slots == null ? void 0 : slots.switchViewButton) != null ? _slots$switchViewButt : PickersCalendarHeaderSwitchViewButton;
|
|
136
|
+
const SwitchViewButton = (_ref = (_slots$switchViewButt = slots == null ? void 0 : slots.switchViewButton) != null ? _slots$switchViewButt : components == null ? void 0 : components.SwitchViewButton) != null ? _ref : PickersCalendarHeaderSwitchViewButton;
|
|
138
137
|
const switchViewButtonProps = useSlotProps({
|
|
139
138
|
elementType: SwitchViewButton,
|
|
140
139
|
externalSlotProps: slotProps == null ? void 0 : slotProps.switchViewButton,
|
|
@@ -145,7 +144,7 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
145
144
|
ownerState,
|
|
146
145
|
className: classes.switchViewButton
|
|
147
146
|
});
|
|
148
|
-
const SwitchViewIcon = (_slots$switchViewIcon = slots == null ? void 0 : slots.switchViewIcon) != null ? _slots$switchViewIcon : PickersCalendarHeaderSwitchViewIcon;
|
|
147
|
+
const SwitchViewIcon = (_ref2 = (_slots$switchViewIcon = slots == null ? void 0 : slots.switchViewIcon) != null ? _slots$switchViewIcon : components == null ? void 0 : components.SwitchViewIcon) != null ? _ref2 : PickersCalendarHeaderSwitchViewIcon;
|
|
149
148
|
// The spread is here to avoid this bug mui/material-ui#34056
|
|
150
149
|
const _useSlotProps = useSlotProps({
|
|
151
150
|
elementType: SwitchViewIcon,
|
|
@@ -235,6 +234,18 @@ process.env.NODE_ENV !== "production" ? PickersCalendarHeader.propTypes = {
|
|
|
235
234
|
* className applied to the root element.
|
|
236
235
|
*/
|
|
237
236
|
className: PropTypes.string,
|
|
237
|
+
/**
|
|
238
|
+
* Overridable components.
|
|
239
|
+
* @default {}
|
|
240
|
+
* @deprecated Please use `slots`.
|
|
241
|
+
*/
|
|
242
|
+
components: PropTypes.object,
|
|
243
|
+
/**
|
|
244
|
+
* The props used for each component slot.
|
|
245
|
+
* @default {}
|
|
246
|
+
* @deprecated Please use `slotProps`.
|
|
247
|
+
*/
|
|
248
|
+
componentsProps: PropTypes.object,
|
|
238
249
|
currentMonth: PropTypes.any.isRequired,
|
|
239
250
|
disabled: PropTypes.bool,
|
|
240
251
|
disableFuture: PropTypes.bool,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
|
+
import IconButton from '@mui/material/IconButton';
|
|
4
|
+
import SvgIcon from '@mui/material/SvgIcon';
|
|
5
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
6
|
+
import { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlotsComponent, PickersArrowSwitcherSlotsComponentsProps } from '../internals/components/PickersArrowSwitcher';
|
|
7
|
+
import { MonthValidationOptions } from '../internals/hooks/date-helpers-hooks';
|
|
8
|
+
import { UncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
9
|
+
import { DateView } from '../models/views';
|
|
10
|
+
import { SlideDirection } from '../DateCalendar/PickersSlideTransition';
|
|
11
|
+
import { PickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
|
|
12
|
+
export interface PickersCalendarHeaderSlotsComponent extends PickersArrowSwitcherSlotsComponent {
|
|
13
|
+
/**
|
|
14
|
+
* Button displayed to switch between different calendar views.
|
|
15
|
+
* @default IconButton
|
|
16
|
+
*/
|
|
17
|
+
SwitchViewButton?: React.ElementType;
|
|
18
|
+
/**
|
|
19
|
+
* Icon displayed in the SwitchViewButton. Rotated by 180° when the open view is 'year'.
|
|
20
|
+
* @default ArrowDropDown
|
|
21
|
+
*/
|
|
22
|
+
SwitchViewIcon?: React.ElementType;
|
|
23
|
+
}
|
|
24
|
+
export interface PickersCalendarHeaderComponentsPropsOverrides {
|
|
25
|
+
}
|
|
26
|
+
export type PickersCalendarHeaderOwnerState<TDate> = PickersCalendarHeaderProps<TDate>;
|
|
27
|
+
export interface PickersCalendarHeaderSlotsComponentsProps<TDate> extends PickersArrowSwitcherSlotsComponentsProps {
|
|
28
|
+
switchViewButton?: SlotComponentProps<typeof IconButton, PickersCalendarHeaderComponentsPropsOverrides, PickersCalendarHeaderOwnerState<TDate>>;
|
|
29
|
+
switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderComponentsPropsOverrides, undefined>;
|
|
30
|
+
}
|
|
31
|
+
export interface PickersCalendarHeaderProps<TDate> extends ExportedPickersArrowSwitcherProps, MonthValidationOptions<TDate> {
|
|
32
|
+
/**
|
|
33
|
+
* Overridable components.
|
|
34
|
+
* @default {}
|
|
35
|
+
* @deprecated Please use `slots`.
|
|
36
|
+
*/
|
|
37
|
+
components?: PickersCalendarHeaderSlotsComponent;
|
|
38
|
+
/**
|
|
39
|
+
* The props used for each component slot.
|
|
40
|
+
* @default {}
|
|
41
|
+
* @deprecated Please use `slotProps`.
|
|
42
|
+
*/
|
|
43
|
+
componentsProps?: PickersCalendarHeaderSlotsComponentsProps<TDate>;
|
|
44
|
+
/**
|
|
45
|
+
* Overridable component slots.
|
|
46
|
+
* @default {}
|
|
47
|
+
*/
|
|
48
|
+
slots?: UncapitalizeObjectKeys<PickersCalendarHeaderSlotsComponent>;
|
|
49
|
+
/**
|
|
50
|
+
* The props used for each component slot.
|
|
51
|
+
* @default {}
|
|
52
|
+
*/
|
|
53
|
+
slotProps?: PickersCalendarHeaderSlotsComponentsProps<TDate>;
|
|
54
|
+
currentMonth: TDate;
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
views: readonly DateView[];
|
|
57
|
+
onMonthChange: (date: TDate, slideDirection: SlideDirection) => void;
|
|
58
|
+
view: DateView;
|
|
59
|
+
reduceAnimations: boolean;
|
|
60
|
+
onViewChange?: (view: DateView) => void;
|
|
61
|
+
labelId?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Override or extend the styles applied to the component.
|
|
64
|
+
*/
|
|
65
|
+
classes?: Partial<PickersCalendarHeaderClasses>;
|
|
66
|
+
/**
|
|
67
|
+
* className applied to the root element.
|
|
68
|
+
*/
|
|
69
|
+
className?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
72
|
+
*/
|
|
73
|
+
sx?: SxProps<Theme>;
|
|
74
|
+
}
|
|
75
|
+
export type ExportedPickersCalendarHeaderProps<TDate> = Pick<PickersCalendarHeaderProps<TDate>, 'classes' | 'slots' | 'slotProps'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { pickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
|
|
2
2
|
export type { PickersCalendarHeaderClassKey, PickersCalendarHeaderClasses, } from './pickersCalendarHeaderClasses';
|
|
3
3
|
export { PickersCalendarHeader } from './PickersCalendarHeader';
|
|
4
|
-
export type { PickersCalendarHeaderProps, PickersCalendarHeaderSlotsComponent, PickersCalendarHeaderSlotsComponentsProps, ExportedPickersCalendarHeaderProps, } from './PickersCalendarHeader';
|
|
4
|
+
export type { PickersCalendarHeaderProps, PickersCalendarHeaderSlotsComponent, PickersCalendarHeaderSlotsComponentsProps, ExportedPickersCalendarHeaderProps, } from './PickersCalendarHeader.types';
|
|
@@ -3,5 +3,14 @@ import { YearCalendarProps } from './YearCalendar.types';
|
|
|
3
3
|
type YearCalendarComponent = (<TDate>(props: YearCalendarProps<TDate>) => React.JSX.Element) & {
|
|
4
4
|
propTypes?: any;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Demos:
|
|
8
|
+
*
|
|
9
|
+
* - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
|
|
10
|
+
*
|
|
11
|
+
* API:
|
|
12
|
+
*
|
|
13
|
+
* - [YearCalendar API](https://mui.com/x/api/date-pickers/year-calendar/)
|
|
14
|
+
*/
|
|
6
15
|
export declare const YearCalendar: YearCalendarComponent;
|
|
7
16
|
export {};
|
|
@@ -59,6 +59,15 @@ const YearCalendarRoot = styled('div', {
|
|
|
59
59
|
boxSizing: 'border-box',
|
|
60
60
|
position: 'relative'
|
|
61
61
|
});
|
|
62
|
+
/**
|
|
63
|
+
* Demos:
|
|
64
|
+
*
|
|
65
|
+
* - [DateCalendar](https://mui.com/x/react-date-pickers/date-calendar/)
|
|
66
|
+
*
|
|
67
|
+
* API:
|
|
68
|
+
*
|
|
69
|
+
* - [YearCalendar API](https://mui.com/x/api/date-pickers/year-calendar/)
|
|
70
|
+
*/
|
|
62
71
|
export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps, ref) {
|
|
63
72
|
const props = useYearCalendarDefaultizedProps(inProps, 'MuiYearCalendar');
|
|
64
73
|
const {
|
package/index.js
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export interface FakeTextFieldElement
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
export interface FakeTextFieldElement {
|
|
3
|
+
container: React.HTMLAttributes<HTMLSpanElement>;
|
|
4
|
+
content: React.HTMLAttributes<HTMLSpanElement>;
|
|
5
|
+
before: React.HTMLAttributes<HTMLSpanElement>;
|
|
6
|
+
after: React.HTMLAttributes<HTMLSpanElement>;
|
|
5
7
|
}
|
|
6
8
|
interface FakeTextFieldProps {
|
|
7
9
|
elements: FakeTextFieldElement[];
|
|
10
|
+
valueStr: string;
|
|
11
|
+
onValueStrChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
12
|
+
error: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
InputProps: any;
|
|
15
|
+
inputProps: any;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
ownerState?: any;
|
|
19
|
+
valueType: 'value' | 'placeholder';
|
|
8
20
|
}
|
|
9
21
|
export declare const FakeTextField: React.ForwardRefExoticComponent<FakeTextFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
22
|
export {};
|
|
@@ -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 = ["
|
|
3
|
+
const _excluded = ["elements", "valueStr", "onValueStrChange", "id", "error", "InputProps", "inputProps", "autoFocus", "disabled", "valueType", "ownerState"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
});
|