@mui/x-date-pickers 6.0.2 → 6.0.3
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/index.js +1 -0
- package/AdapterDateFnsJalali/index.js +1 -0
- package/AdapterDayjs/index.js +5 -0
- package/AdapterLuxon/index.js +1 -0
- package/AdapterMoment/index.js +5 -0
- package/AdapterMomentHijri/index.js +5 -0
- package/AdapterMomentJalaali/index.js +5 -0
- package/CHANGELOG.md +58 -5
- package/DateField/DateField.js +4 -0
- package/DateField/DateField.types.d.ts +2 -2
- package/DateField/useDateField.js +5 -3
- package/DateTimeField/DateTimeField.js +4 -0
- package/DateTimeField/DateTimeField.types.d.ts +2 -2
- package/DateTimeField/useDateTimeField.js +5 -3
- package/PickersDay/PickersDay.js +4 -4
- package/TimeField/TimeField.js +4 -0
- package/TimeField/TimeField.types.d.ts +2 -2
- package/TimeField/useTimeField.js +5 -3
- package/index.d.ts +1 -6
- package/index.js +4 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +5 -4
- package/internals/hooks/useField/index.d.ts +2 -2
- package/internals/hooks/useField/index.js +1 -1
- package/internals/hooks/useField/useField.d.ts +1 -1
- package/internals/hooks/useField/useField.js +54 -25
- package/internals/hooks/useField/useField.types.d.ts +24 -12
- package/internals/hooks/useField/useFieldState.d.ts +1 -2
- package/internals/hooks/useField/useFieldState.js +1 -6
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +5 -4
- package/internals/hooks/usePicker/usePicker.d.ts +2 -1
- package/internals/hooks/usePicker/usePicker.types.d.ts +4 -3
- package/internals/hooks/usePicker/usePickerValue.d.ts +8 -8
- package/internals/hooks/usePicker/usePickerValue.js +7 -11
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +2 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/internals/models/fields.d.ts +3 -3
- package/internals/utils/date-utils.d.ts +1 -0
- package/internals/utils/date-utils.js +6 -0
- package/internals/utils/valueManagers.js +4 -5
- package/legacy/AdapterDateFns/index.js +1 -0
- package/legacy/AdapterDateFnsJalali/index.js +1 -0
- package/legacy/AdapterDayjs/index.js +5 -0
- package/legacy/AdapterLuxon/index.js +1 -0
- package/legacy/AdapterMoment/index.js +5 -0
- package/legacy/AdapterMomentHijri/index.js +5 -0
- package/legacy/AdapterMomentJalaali/index.js +5 -0
- package/legacy/DateField/DateField.js +4 -0
- package/legacy/DateField/useDateField.js +4 -2
- package/legacy/DateTimeField/DateTimeField.js +4 -0
- package/legacy/DateTimeField/useDateTimeField.js +4 -2
- package/legacy/PickersDay/PickersDay.js +4 -4
- package/legacy/TimeField/TimeField.js +4 -0
- package/legacy/TimeField/useTimeField.js +4 -2
- package/legacy/index.js +4 -2
- package/legacy/internals/hooks/useField/index.js +1 -1
- package/legacy/internals/hooks/useField/useField.js +79 -39
- package/legacy/internals/hooks/useField/useFieldState.js +1 -8
- package/legacy/internals/hooks/usePicker/usePickerValue.js +9 -13
- package/legacy/internals/index.js +2 -2
- package/legacy/internals/utils/date-utils.js +6 -0
- package/legacy/internals/utils/valueManagers.js +3 -8
- package/legacy/locales/faIR.js +33 -16
- package/legacy/locales/nlNL.js +12 -10
- package/legacy/locales/plPL.js +12 -10
- package/legacy/models/index.js +1 -0
- package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +2 -3
- package/locales/faIR.js +13 -16
- package/locales/nlNL.js +8 -10
- package/locales/plPL.js +8 -10
- package/models/index.d.ts +6 -0
- package/models/index.js +1 -0
- package/models/package.json +6 -0
- package/modern/AdapterDateFns/index.js +1 -0
- package/modern/AdapterDateFnsJalali/index.js +1 -0
- package/modern/AdapterDayjs/index.js +5 -0
- package/modern/AdapterLuxon/index.js +1 -0
- package/modern/AdapterMoment/index.js +5 -0
- package/modern/AdapterMomentHijri/index.js +5 -0
- package/modern/AdapterMomentJalaali/index.js +5 -0
- package/modern/DateField/DateField.js +4 -0
- package/modern/DateField/useDateField.js +5 -3
- package/modern/DateTimeField/DateTimeField.js +4 -0
- package/modern/DateTimeField/useDateTimeField.js +5 -3
- package/modern/PickersDay/PickersDay.js +4 -4
- package/modern/TimeField/TimeField.js +4 -0
- package/modern/TimeField/useTimeField.js +5 -3
- package/modern/index.js +4 -2
- package/modern/internals/hooks/useField/index.js +1 -1
- package/modern/internals/hooks/useField/useField.js +53 -25
- package/modern/internals/hooks/useField/useFieldState.js +1 -6
- package/modern/internals/hooks/usePicker/usePickerValue.js +7 -11
- package/modern/internals/index.js +2 -2
- package/modern/internals/utils/date-utils.js +6 -0
- package/modern/internals/utils/valueManagers.js +4 -5
- package/modern/locales/faIR.js +13 -16
- package/modern/locales/nlNL.js +8 -10
- package/modern/locales/plPL.js +8 -10
- package/modern/models/index.js +1 -0
- package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +2 -3
- package/node/AdapterDateFns/index.js +1 -0
- package/node/AdapterDateFnsJalali/index.js +1 -0
- package/node/AdapterDayjs/index.js +5 -0
- package/node/AdapterLuxon/index.js +1 -0
- package/node/AdapterMoment/index.js +5 -0
- package/node/AdapterMomentHijri/index.js +5 -0
- package/node/AdapterMomentJalaali/index.js +5 -0
- package/node/DateField/DateField.js +4 -0
- package/node/DateField/useDateField.js +5 -3
- package/node/DateTimeField/DateTimeField.js +4 -0
- package/node/DateTimeField/useDateTimeField.js +5 -3
- package/node/PickersDay/PickersDay.js +4 -4
- package/node/TimeField/TimeField.js +4 -0
- package/node/TimeField/useTimeField.js +5 -3
- package/node/index.js +14 -2
- package/node/internals/hooks/useField/index.js +0 -6
- package/node/internals/hooks/useField/useField.js +52 -24
- package/node/internals/hooks/useField/useFieldState.js +1 -6
- package/node/internals/hooks/usePicker/usePickerValue.js +7 -11
- package/node/internals/index.js +6 -6
- package/node/internals/utils/date-utils.js +9 -2
- package/node/internals/utils/valueManagers.js +2 -3
- package/node/locales/faIR.js +13 -16
- package/node/locales/nlNL.js +8 -10
- package/node/locales/plPL.js +8 -10
- package/node/models/index.js +5 -0
- package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +2 -3
- package/package.json +2 -2
- package/tests/describeValue/testPickerOpenCloseLifeCycle.js +2 -3
package/AdapterDateFns/index.js
CHANGED
|
@@ -136,6 +136,7 @@ export class AdapterDateFns extends BaseAdapterDateFns {
|
|
|
136
136
|
return token;
|
|
137
137
|
}).join('');
|
|
138
138
|
};
|
|
139
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
139
140
|
this.getFormatHelperText = format => {
|
|
140
141
|
return this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
|
|
141
142
|
};
|
|
@@ -68,6 +68,7 @@ export class AdapterDateFnsJalali extends BaseAdapterDateFnsJalali {
|
|
|
68
68
|
return token;
|
|
69
69
|
}).join('');
|
|
70
70
|
};
|
|
71
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
71
72
|
this.getFormatHelperText = format => {
|
|
72
73
|
return this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
|
|
73
74
|
};
|
package/AdapterDayjs/index.js
CHANGED
|
@@ -76,6 +76,10 @@ export class AdapterDayjs extends BaseAdapterDayjs {
|
|
|
76
76
|
/* istanbul ignore next */
|
|
77
77
|
return /A|a/.test(this.getLocaleFormats().LT || '');
|
|
78
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
81
|
+
* We should use this one in the future to support all localized formats.
|
|
82
|
+
*/
|
|
79
83
|
this.expandFormat = format => {
|
|
80
84
|
const localeFormats = this.getLocaleFormats();
|
|
81
85
|
|
|
@@ -86,6 +90,7 @@ export class AdapterDayjs extends BaseAdapterDayjs {
|
|
|
86
90
|
return a || localeFormats[b] || t(localeFormats[B]);
|
|
87
91
|
});
|
|
88
92
|
};
|
|
93
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
89
94
|
this.getFormatHelperText = format => {
|
|
90
95
|
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
91
96
|
};
|
package/AdapterLuxon/index.js
CHANGED
|
@@ -91,6 +91,7 @@ export class AdapterLuxon extends BaseAdapterLuxon {
|
|
|
91
91
|
locale: this.locale
|
|
92
92
|
}).replace('yyyyy', 'yyyy');
|
|
93
93
|
};
|
|
94
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
94
95
|
this.getFormatHelperText = format => {
|
|
95
96
|
return this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
|
|
96
97
|
};
|
package/AdapterMoment/index.js
CHANGED
|
@@ -64,6 +64,10 @@ export class AdapterMoment extends BaseAdapterMoment {
|
|
|
64
64
|
start: '[',
|
|
65
65
|
end: ']'
|
|
66
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
69
|
+
* We should use this one in the future to support all localized formats.
|
|
70
|
+
*/
|
|
67
71
|
this.expandFormat = format => {
|
|
68
72
|
// @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
|
|
69
73
|
const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
|
|
@@ -78,6 +82,7 @@ export class AdapterMoment extends BaseAdapterMoment {
|
|
|
78
82
|
this.getCurrentLocaleCode = () => {
|
|
79
83
|
return this.locale || defaultMoment.locale();
|
|
80
84
|
};
|
|
85
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
81
86
|
this.getFormatHelperText = format => {
|
|
82
87
|
return this.expandFormat(format).replace(/a/gi, '(a|p)m').toLocaleLowerCase();
|
|
83
88
|
};
|
|
@@ -48,6 +48,10 @@ export class AdapterMomentHijri extends BaseAdapterMomentHijri {
|
|
|
48
48
|
start: '[',
|
|
49
49
|
end: ']'
|
|
50
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
53
|
+
* We should use this one in the future to support all localized formats.
|
|
54
|
+
*/
|
|
51
55
|
this.expandFormat = format => {
|
|
52
56
|
// @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
|
|
53
57
|
const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
|
|
@@ -59,6 +63,7 @@ export class AdapterMomentHijri extends BaseAdapterMomentHijri {
|
|
|
59
63
|
return token;
|
|
60
64
|
}).join('').replace('dd', 'iDD'); // Fix for https://github.com/dmtrKovalenko/date-io/pull/632
|
|
61
65
|
};
|
|
66
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
62
67
|
this.getFormatHelperText = format => {
|
|
63
68
|
return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('iY', 'Y').replace('iM', 'M').replace('iD', 'D').toLocaleLowerCase();
|
|
64
69
|
};
|
|
@@ -45,6 +45,10 @@ export class AdapterMomentJalaali extends BaseAdapterMomentJalaali {
|
|
|
45
45
|
start: '[',
|
|
46
46
|
end: ']'
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* The current getFormatHelperText method uses an outdated format parsing logic.
|
|
50
|
+
* We should use this one in the future to support all localized formats.
|
|
51
|
+
*/
|
|
48
52
|
this.expandFormat = format => {
|
|
49
53
|
// @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
|
|
50
54
|
const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
|
|
@@ -56,6 +60,7 @@ export class AdapterMomentJalaali extends BaseAdapterMomentJalaali {
|
|
|
56
60
|
return token;
|
|
57
61
|
}).join('').replace('dd', 'jDD'); // Fix for https://github.com/dmtrKovalenko/date-io/pull/632;
|
|
58
62
|
};
|
|
63
|
+
// Redefined here just to show how it can be written using expandFormat
|
|
59
64
|
this.getFormatHelperText = format => {
|
|
60
65
|
return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('jY', 'Y').replace('jM', 'M').replace('jD', 'D').toLocaleLowerCase();
|
|
61
66
|
};
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,60 @@
|
|
|
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.0.3
|
|
7
|
+
|
|
8
|
+
_Mar 23, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Improve Bulgarian (bg-BG), Persian (fa-IR), Polish (pl-PL), and Dutch (nl-NL) locales
|
|
13
|
+
- 🐞 Bugfixes
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
|
|
16
|
+
### `@mui/x-data-grid@v6.0.3` / `@mui/x-data-grid-pro@v6.0.3` / `@mui/x-data-grid-premium@v6.0.3`
|
|
17
|
+
|
|
18
|
+
#### Changes
|
|
19
|
+
|
|
20
|
+
- [DataGrid] Fix overflow calculation issue in column group headers (#8246) @MBilalShafi
|
|
21
|
+
- [DataGridPro] Fix column reorder glitches (#8335) @cherniavskii
|
|
22
|
+
- [l10n] Improve Bulgarian (bg-BG) locale (#8315) @todevmilen
|
|
23
|
+
- [l10n] Improve Persian (fa-IR) locale (#8268) @fakhamatia
|
|
24
|
+
- [l10n] improve Dutch (nl-NL) locale (#8317) @developenguin
|
|
25
|
+
|
|
26
|
+
### `@mui/x-date-pickers@v6.0.3` / `@mui/x-date-pickers-pro@v6.0.3`
|
|
27
|
+
|
|
28
|
+
#### Changes
|
|
29
|
+
|
|
30
|
+
- [fields] Allow to reset the value from the outside (#8287) @flaviendelangle
|
|
31
|
+
- [fields] Cleanup section order generation (#8290) @flaviendelangle
|
|
32
|
+
- [fields] Fix Safari input selection resetting regression (#8295) @LukasTy
|
|
33
|
+
- [fields] Fix editing when all sections are selected (#8330) @flaviendelangle
|
|
34
|
+
- [fields] Fix iOS browser scroll jumping when entering data (#8328) @LukasTy
|
|
35
|
+
- [fields] New prop `unstableFieldRef` to imperatively interact with the selected sections (#8235) @flaviendelangle
|
|
36
|
+
- [pickers] Align date calendar colors (#8318) @LukasTy
|
|
37
|
+
- [pickers] Support invalid dates from the field (#8298) @flaviendelangle
|
|
38
|
+
- [l10n] Improve Persian (fa-IR) locale (#8268) @fakhamatia
|
|
39
|
+
- [l10n] Improve Polish (pl-PL) locale (#8344) @drmats
|
|
40
|
+
- [l10n] improve Dutch (nl-NL) locale (#8317) @developenguin
|
|
41
|
+
|
|
42
|
+
### Docs
|
|
43
|
+
|
|
44
|
+
- [docs] Create examples of pickers with custom fields (#8034) @flaviendelangle
|
|
45
|
+
- [docs] Fix 301 redirections @oliviertassinari
|
|
46
|
+
- [docs] Fix link to React's docs @oliviertassinari
|
|
47
|
+
- [docs] Fix pro license links to point to the same page (#8303) @LukasTy
|
|
48
|
+
- [docs] Give an incentive to upgrade (#8269) @oliviertassinari
|
|
49
|
+
- [docs] Improve contrast on data grid navigation (#8239) @oliviertassinari
|
|
50
|
+
- [docs] Update shortcuts page to use slotProps (#8288) @dcorb
|
|
51
|
+
- [docs] Explain the `shouldDisableTime` migration in more depth (#8348) @LukasTy
|
|
52
|
+
|
|
53
|
+
### Core
|
|
54
|
+
|
|
55
|
+
- [core] Remove unused `visx` chart package (#8259) @LukasTy
|
|
56
|
+
- [core] Upgrade monorepo (#8331) @cherniavskii
|
|
57
|
+
- [charts] Project setup (#8308) @alexfauquette
|
|
58
|
+
- [test] Track visual regressions of column menu and filter/column panels (#8095) @cherniavskii
|
|
59
|
+
|
|
6
60
|
## 6.0.2
|
|
7
61
|
|
|
8
62
|
_Mar 16, 2023_
|
|
@@ -98,11 +152,9 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
|
|
|
98
152
|
|
|
99
153
|
_Mar 3, 2023_
|
|
100
154
|
|
|
101
|
-
We're
|
|
155
|
+
We're excited to [announce the first v6 stable release](https://mui.com/blog/mui-x-v6/)! 🎉🚀
|
|
102
156
|
|
|
103
157
|
This is now the officially supported major version, where we'll keep rolling out new features, bug fixes, and improvements.
|
|
104
|
-
Head over to the [what's new](https://mui.com/x/whats-new/) page to check the highlighted new features.
|
|
105
|
-
|
|
106
158
|
Migration guides are available with a complete list of the breaking changes:
|
|
107
159
|
|
|
108
160
|
- [Data Grid](https://mui.com/x/migration/migration-data-grid-v5/)
|
|
@@ -119,6 +171,7 @@ We'd like to offer a big thanks to the 12 contributors who made this release pos
|
|
|
119
171
|
- experimentalFeatures={{ rowPinning: true }}
|
|
120
172
|
/>
|
|
121
173
|
```
|
|
174
|
+
|
|
122
175
|
- ⚡️ Improved grid performance by rows and cells memoization (#7846) @m4theushw
|
|
123
176
|
- ✨ Fields have a distinct visual state when empty (#8069) @LukasTy
|
|
124
177
|
- 🌍 Improve Czech (cs-CZ) locale (#8113) @BlastyCZ
|
|
@@ -556,14 +609,14 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
|
|
|
556
609
|
```
|
|
557
610
|
|
|
558
611
|
- The `error` and `onError` props were removed - the grid no longer catches errors during rendering.
|
|
559
|
-
To catch errors that happen during rendering use the [error boundary](https://
|
|
612
|
+
To catch errors that happen during rendering use the [error boundary](https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary).
|
|
560
613
|
|
|
561
614
|
- The `components.ErrorOverlay` slot was removed.
|
|
562
615
|
|
|
563
616
|
- The `GridErrorOverlay` component was removed.
|
|
564
617
|
|
|
565
618
|
- The `componentError` event was removed.
|
|
566
|
-
Use the [error boundary](https://
|
|
619
|
+
Use the [error boundary](https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary) to catch errors thrown during rendering.
|
|
567
620
|
|
|
568
621
|
- The `apiRef.current.showError` method was removed.
|
|
569
622
|
The UI for errors is no longer handled by the grid.
|
package/DateField/DateField.js
CHANGED
|
@@ -269,6 +269,10 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
269
269
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
270
270
|
*/
|
|
271
271
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
272
|
+
/**
|
|
273
|
+
* The ref object used to imperatively interact with the field.
|
|
274
|
+
*/
|
|
275
|
+
unstableFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
272
276
|
/**
|
|
273
277
|
* The selected value.
|
|
274
278
|
* Used when the component is controlled.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
3
|
import TextField from '@mui/material/TextField';
|
|
4
|
-
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
4
|
+
import { FieldSection, UseFieldInternalProps } from '../internals/hooks/useField';
|
|
5
5
|
import { DateValidationError } from '../internals/hooks/validation/useDateValidation';
|
|
6
6
|
import { DefaultizedProps, MakeOptional } from '../internals/models/helpers';
|
|
7
7
|
import { BaseDateValidationProps, DayValidationProps, MonthValidationProps, YearValidationProps } from '../internals/hooks/validation/models';
|
|
@@ -11,7 +11,7 @@ export interface UseDateFieldParams<TDate, TChildProps extends {}> {
|
|
|
11
11
|
props: UseDateFieldComponentProps<TDate, TChildProps>;
|
|
12
12
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
13
13
|
}
|
|
14
|
-
export interface UseDateFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<TDate | null, DateValidationError>, 'format'>, DayValidationProps<TDate>, MonthValidationProps<TDate>, YearValidationProps<TDate>, BaseDateValidationProps<TDate> {
|
|
14
|
+
export interface UseDateFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<TDate | null, FieldSection, DateValidationError>, 'format'>, DayValidationProps<TDate>, MonthValidationProps<TDate>, YearValidationProps<TDate>, BaseDateValidationProps<TDate> {
|
|
15
15
|
}
|
|
16
16
|
export type UseDateFieldDefaultizedProps<TDate> = DefaultizedProps<UseDateFieldProps<TDate>, keyof BaseDateValidationProps<TDate> | 'format'>;
|
|
17
17
|
export type UseDateFieldComponentProps<TDate, TChildProps extends {}> = Omit<TChildProps, keyof UseDateFieldProps<TDate>> & UseDateFieldProps<TDate>;
|
|
@@ -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 = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef"];
|
|
4
4
|
import { singleItemFieldValueManager, singleItemValueManager } from '../internals/utils/valueManagers';
|
|
5
5
|
import { useField } from '../internals/hooks/useField';
|
|
6
6
|
import { validateDate } from '../internals/hooks/validation/useDateValidation';
|
|
@@ -38,7 +38,8 @@ export const useDateField = ({
|
|
|
38
38
|
disableFuture,
|
|
39
39
|
disablePast,
|
|
40
40
|
selectedSections,
|
|
41
|
-
onSelectedSectionsChange
|
|
41
|
+
onSelectedSectionsChange,
|
|
42
|
+
unstableFieldRef
|
|
42
43
|
} = _useDefaultizedDateFi,
|
|
43
44
|
other = _objectWithoutPropertiesLoose(_useDefaultizedDateFi, _excluded);
|
|
44
45
|
return useField({
|
|
@@ -59,7 +60,8 @@ export const useDateField = ({
|
|
|
59
60
|
disableFuture,
|
|
60
61
|
disablePast,
|
|
61
62
|
selectedSections,
|
|
62
|
-
onSelectedSectionsChange
|
|
63
|
+
onSelectedSectionsChange,
|
|
64
|
+
unstableFieldRef
|
|
63
65
|
},
|
|
64
66
|
valueManager: singleItemValueManager,
|
|
65
67
|
fieldValueManager: singleItemFieldValueManager,
|
|
@@ -317,6 +317,10 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
317
317
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
318
318
|
*/
|
|
319
319
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
320
|
+
/**
|
|
321
|
+
* The ref object used to imperatively interact with the field.
|
|
322
|
+
*/
|
|
323
|
+
unstableFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
320
324
|
/**
|
|
321
325
|
* The selected value.
|
|
322
326
|
* Used when the component is controlled.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
3
|
import TextField from '@mui/material/TextField';
|
|
4
|
-
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
4
|
+
import { FieldSection, UseFieldInternalProps } from '../internals/hooks/useField';
|
|
5
5
|
import { DateTimeValidationError } from '../internals/hooks/validation/useDateTimeValidation';
|
|
6
6
|
import { DefaultizedProps, MakeOptional } from '../internals/models/helpers';
|
|
7
7
|
import { BaseDateValidationProps, BaseTimeValidationProps, DayValidationProps, MonthValidationProps, TimeValidationProps, YearValidationProps } from '../internals/hooks/validation/models';
|
|
@@ -10,7 +10,7 @@ export interface UseDateTimeFieldParams<TDate, TChildProps extends {}> {
|
|
|
10
10
|
props: UseDateTimeFieldComponentProps<TDate, TChildProps>;
|
|
11
11
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
12
12
|
}
|
|
13
|
-
export interface UseDateTimeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<TDate | null, DateTimeValidationError>, 'format'>, DayValidationProps<TDate>, MonthValidationProps<TDate>, YearValidationProps<TDate>, BaseDateValidationProps<TDate>, TimeValidationProps<TDate>, BaseTimeValidationProps {
|
|
13
|
+
export interface UseDateTimeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<TDate | null, FieldSection, DateTimeValidationError>, 'format'>, DayValidationProps<TDate>, MonthValidationProps<TDate>, YearValidationProps<TDate>, BaseDateValidationProps<TDate>, TimeValidationProps<TDate>, BaseTimeValidationProps {
|
|
14
14
|
/**
|
|
15
15
|
* 12h/24h view for hour selection clock.
|
|
16
16
|
* @default `utils.is12HourCycleInCurrentLocale()`
|
|
@@ -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 = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "disableIgnoringDatePartForTimeValidation", "shouldDisableClock", "shouldDisableTime", "selectedSections", "onSelectedSectionsChange", "ampm"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "disableIgnoringDatePartForTimeValidation", "shouldDisableClock", "shouldDisableTime", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
|
|
4
4
|
import { singleItemFieldValueManager, singleItemValueManager } from '../internals/utils/valueManagers';
|
|
5
5
|
import { useField } from '../internals/hooks/useField';
|
|
6
6
|
import { validateDateTime } from '../internals/hooks/validation/useDateTimeValidation';
|
|
@@ -50,7 +50,8 @@ export const useDateTimeField = ({
|
|
|
50
50
|
shouldDisableTime,
|
|
51
51
|
selectedSections,
|
|
52
52
|
onSelectedSectionsChange,
|
|
53
|
-
ampm
|
|
53
|
+
ampm,
|
|
54
|
+
unstableFieldRef
|
|
54
55
|
} = _useDefaultizedDateTi,
|
|
55
56
|
other = _objectWithoutPropertiesLoose(_useDefaultizedDateTi, _excluded);
|
|
56
57
|
return useField({
|
|
@@ -78,7 +79,8 @@ export const useDateTimeField = ({
|
|
|
78
79
|
disableIgnoringDatePartForTimeValidation,
|
|
79
80
|
selectedSections,
|
|
80
81
|
onSelectedSectionsChange,
|
|
81
|
-
ampm
|
|
82
|
+
ampm,
|
|
83
|
+
unstableFieldRef
|
|
82
84
|
},
|
|
83
85
|
valueManager: singleItemValueManager,
|
|
84
86
|
fieldValueManager: singleItemFieldValueManager,
|
package/PickersDay/PickersDay.js
CHANGED
|
@@ -36,16 +36,16 @@ const styleArg = ({
|
|
|
36
36
|
height: DAY_SIZE,
|
|
37
37
|
borderRadius: '50%',
|
|
38
38
|
padding: 0,
|
|
39
|
-
//
|
|
40
|
-
backgroundColor:
|
|
39
|
+
// explicitly setting to `transparent` to avoid potentially getting impacted by change from the overridden component
|
|
40
|
+
backgroundColor: 'transparent',
|
|
41
41
|
color: (theme.vars || theme).palette.text.primary,
|
|
42
42
|
'@media (pointer: fine)': {
|
|
43
43
|
'&:hover': {
|
|
44
|
-
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.
|
|
44
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.hoverOpacity)
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
'&:focus': {
|
|
48
|
-
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.
|
|
48
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.focusOpacity})` : alpha(theme.palette.primary.main, theme.palette.action.focusOpacity),
|
|
49
49
|
[`&.${pickersDayClasses.selected}`]: {
|
|
50
50
|
willChange: 'background-color',
|
|
51
51
|
backgroundColor: (theme.vars || theme).palette.primary.dark
|
package/TimeField/TimeField.js
CHANGED
|
@@ -280,6 +280,10 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
280
280
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
281
281
|
*/
|
|
282
282
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
283
|
+
/**
|
|
284
|
+
* The ref object used to imperatively interact with the field.
|
|
285
|
+
*/
|
|
286
|
+
unstableFieldRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
283
287
|
/**
|
|
284
288
|
* The selected value.
|
|
285
289
|
* Used when the component is controlled.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
3
|
import TextField from '@mui/material/TextField';
|
|
4
|
-
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
4
|
+
import { FieldSection, UseFieldInternalProps } from '../internals/hooks/useField';
|
|
5
5
|
import { TimeValidationError } from '../internals/hooks/validation/useTimeValidation';
|
|
6
6
|
import { DefaultizedProps, MakeOptional } from '../internals/models/helpers';
|
|
7
7
|
import { BaseTimeValidationProps, TimeValidationProps } from '../internals/hooks/validation/models';
|
|
@@ -10,7 +10,7 @@ export interface UseTimeFieldParams<TDate, TChildProps extends {}> {
|
|
|
10
10
|
props: UseTimeFieldComponentProps<TDate, TChildProps>;
|
|
11
11
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
12
12
|
}
|
|
13
|
-
export interface UseTimeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<TDate | null, TimeValidationError>, 'format'>, TimeValidationProps<TDate>, BaseTimeValidationProps {
|
|
13
|
+
export interface UseTimeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<TDate | null, FieldSection, TimeValidationError>, 'format'>, TimeValidationProps<TDate>, BaseTimeValidationProps {
|
|
14
14
|
/**
|
|
15
15
|
* 12h/24h view for hour selection clock.
|
|
16
16
|
* @default `utils.is12HourCycleInCurrentLocale()`
|
|
@@ -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 = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "disableFuture", "disablePast", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "ampm"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "disableFuture", "disablePast", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
|
|
4
4
|
import { singleItemFieldValueManager, singleItemValueManager } from '../internals/utils/valueManagers';
|
|
5
5
|
import { useField } from '../internals/hooks/useField';
|
|
6
6
|
import { validateTime } from '../internals/hooks/validation/useTimeValidation';
|
|
@@ -38,7 +38,8 @@ export const useTimeField = ({
|
|
|
38
38
|
disableIgnoringDatePartForTimeValidation,
|
|
39
39
|
selectedSections,
|
|
40
40
|
onSelectedSectionsChange,
|
|
41
|
-
ampm
|
|
41
|
+
ampm,
|
|
42
|
+
unstableFieldRef
|
|
42
43
|
} = _useDefaultizedTimeFi,
|
|
43
44
|
other = _objectWithoutPropertiesLoose(_useDefaultizedTimeFi, _excluded);
|
|
44
45
|
return useField({
|
|
@@ -61,7 +62,8 @@ export const useTimeField = ({
|
|
|
61
62
|
disableIgnoringDatePartForTimeValidation,
|
|
62
63
|
selectedSections,
|
|
63
64
|
onSelectedSectionsChange,
|
|
64
|
-
ampm
|
|
65
|
+
ampm,
|
|
66
|
+
unstableFieldRef
|
|
65
67
|
},
|
|
66
68
|
valueManager: singleItemValueManager,
|
|
67
69
|
fieldValueManager: singleItemFieldValueManager,
|
package/index.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ export * from './locales';
|
|
|
5
5
|
export * from './DateField';
|
|
6
6
|
export * from './TimeField';
|
|
7
7
|
export * from './DateTimeField';
|
|
8
|
-
export type { FieldSection, FieldSelectedSections } from './internals/hooks/useField';
|
|
9
|
-
export type { BaseSingleInputFieldProps } from './internals/models/fields';
|
|
10
8
|
export * from './DateCalendar';
|
|
11
9
|
export * from './MonthCalendar';
|
|
12
10
|
export * from './YearCalendar';
|
|
@@ -28,8 +26,5 @@ export * from './timeViewRenderers';
|
|
|
28
26
|
export * from './PickersLayout';
|
|
29
27
|
export * from './PickersActionBar';
|
|
30
28
|
export * from './PickersShortcuts';
|
|
31
|
-
export type { FieldSectionType } from './internals/models/muiPickersAdapter';
|
|
32
|
-
export type { DateValidationError } from './internals/hooks/validation/useDateValidation';
|
|
33
|
-
export type { TimeValidationError } from './internals/hooks/validation/useTimeValidation';
|
|
34
|
-
export type { DateTimeValidationError } from './internals/hooks/validation/useDateTimeValidation';
|
|
35
29
|
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
30
|
+
export * from './models';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers v6.0.
|
|
2
|
+
* @mui/x-date-pickers v6.0.3
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -14,6 +14,7 @@ export * from './locales';
|
|
|
14
14
|
export * from './DateField';
|
|
15
15
|
export * from './TimeField';
|
|
16
16
|
export * from './DateTimeField';
|
|
17
|
+
|
|
17
18
|
// Calendars
|
|
18
19
|
export * from './DateCalendar';
|
|
19
20
|
export * from './MonthCalendar';
|
|
@@ -42,4 +43,5 @@ export * from './timeViewRenderers';
|
|
|
42
43
|
export * from './PickersLayout';
|
|
43
44
|
export * from './PickersActionBar';
|
|
44
45
|
export * from './PickersShortcuts';
|
|
45
|
-
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
46
|
+
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
47
|
+
export * from './models';
|
|
@@ -12,11 +12,12 @@ import { ExportedPickersLayoutSlotsComponent, ExportedPickersLayoutSlotsComponen
|
|
|
12
12
|
import { UsePickerValueNonStaticProps } from '../usePicker/usePickerValue';
|
|
13
13
|
import { UsePickerViewsNonStaticProps, UsePickerViewsProps } from '../usePicker/usePickerViews';
|
|
14
14
|
import { UncapitalizeObjectKeys } from '../../utils/slots-migration';
|
|
15
|
+
import { FieldSection } from '../useField';
|
|
15
16
|
export interface UseDesktopPickerSlotsComponent<TDate, TView extends DateOrTimeView> extends Pick<PickersPopperSlotsComponent, 'DesktopPaper' | 'DesktopTransition' | 'DesktopTrapFocus' | 'Popper'>, ExportedPickersLayoutSlotsComponent<TDate | null, TDate, TView> {
|
|
16
17
|
/**
|
|
17
18
|
* Component used to enter the date with the keyboard.
|
|
18
19
|
*/
|
|
19
|
-
Field: React.ElementType<BaseSingleInputFieldProps<TDate | null, any>>;
|
|
20
|
+
Field: React.ElementType<BaseSingleInputFieldProps<TDate | null, FieldSection, any>>;
|
|
20
21
|
/**
|
|
21
22
|
* Form control with an input to render the value inside the default field.
|
|
22
23
|
* Receives the same props as `@mui/material/TextField`.
|
|
@@ -41,13 +42,13 @@ export interface UseDesktopPickerSlotsComponent<TDate, TView extends DateOrTimeV
|
|
|
41
42
|
export interface UseDesktopPickerSlotsComponentsProps<TDate, TView extends DateOrTimeView> extends ExportedUseDesktopPickerSlotsComponentsProps<TDate, TView>, Pick<PickersLayoutSlotsComponentsProps<TDate | null, TDate, TView>, 'toolbar'> {
|
|
42
43
|
}
|
|
43
44
|
export interface ExportedUseDesktopPickerSlotsComponentsProps<TDate, TView extends DateOrTimeView> extends PickersPopperSlotsComponentsProps, ExportedPickersLayoutSlotsComponentsProps<TDate | null, TDate, TView> {
|
|
44
|
-
field?: SlotComponentProps<React.ElementType<BaseSingleInputFieldProps<TDate | null, unknown>>, {}, UsePickerProps<TDate | null, any, any, any, any>>;
|
|
45
|
+
field?: SlotComponentProps<React.ElementType<BaseSingleInputFieldProps<TDate | null, FieldSection, unknown>>, {}, UsePickerProps<TDate | null, any, FieldSection, any, any, any>>;
|
|
45
46
|
textField?: SlotComponentProps<typeof TextField, {}, Record<string, any>>;
|
|
46
47
|
inputAdornment?: Partial<InputAdornmentProps>;
|
|
47
48
|
openPickerButton?: SlotComponentProps<typeof IconButton, {}, UseDesktopPickerProps<TDate, any, any, any>>;
|
|
48
49
|
openPickerIcon?: Record<string, any>;
|
|
49
50
|
}
|
|
50
|
-
export interface DesktopOnlyPickerProps<TDate> extends BaseNonStaticPickerProps, BaseSingleInputNonStaticPickerProps, UsePickerValueNonStaticProps<TDate | null>, UsePickerViewsNonStaticProps {
|
|
51
|
+
export interface DesktopOnlyPickerProps<TDate> extends BaseNonStaticPickerProps, BaseSingleInputNonStaticPickerProps, UsePickerValueNonStaticProps<TDate | null, FieldSection>, UsePickerViewsNonStaticProps {
|
|
51
52
|
/**
|
|
52
53
|
* If `true`, the `input` element is focused during the first mount.
|
|
53
54
|
*/
|
|
@@ -65,7 +66,7 @@ export interface UseDesktopPickerProps<TDate, TView extends DateOrTimeView, TErr
|
|
|
65
66
|
*/
|
|
66
67
|
slotProps?: UseDesktopPickerSlotsComponentsProps<TDate, TView>;
|
|
67
68
|
}
|
|
68
|
-
export interface UseDesktopPickerParams<TDate, TView extends DateOrTimeView, TExternalProps extends UseDesktopPickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<TDate | null, TDate, TView, TExternalProps, {}>, 'valueManager' | 'validator'> {
|
|
69
|
+
export interface UseDesktopPickerParams<TDate, TView extends DateOrTimeView, TExternalProps extends UseDesktopPickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<TDate | null, TDate, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'validator'> {
|
|
69
70
|
props: TExternalProps;
|
|
70
71
|
getOpenDialogAriaText: (date: TDate | null, utils: MuiPickersAdapter<TDate>) => string;
|
|
71
72
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { useField } from './useField';
|
|
2
|
-
export type { FieldValueManager, FieldSection, UseFieldInternalProps, UseFieldForwardedProps, UseFieldParams, UseFieldResponse, FieldSelectedSections, FieldChangeHandler, FieldChangeHandlerContext, } from './useField.types';
|
|
3
|
-
export { splitFormatIntoSections, addPositionPropertiesToSections, createDateStrForInputFromSections,
|
|
2
|
+
export type { FieldValueManager, FieldSection, UseFieldInternalProps, UseFieldForwardedProps, UseFieldParams, UseFieldResponse, FieldSelectedSections, FieldChangeHandler, FieldChangeHandlerContext, FieldRef, } from './useField.types';
|
|
3
|
+
export { splitFormatIntoSections, addPositionPropertiesToSections, createDateStrForInputFromSections, } from './useField.utils';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { useField } from './useField';
|
|
2
|
-
export { splitFormatIntoSections, addPositionPropertiesToSections, createDateStrForInputFromSections
|
|
2
|
+
export { splitFormatIntoSections, addPositionPropertiesToSections, createDateStrForInputFromSections } from './useField.utils';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FieldSection, UseFieldParams, UseFieldResponse, UseFieldForwardedProps, UseFieldInternalProps } from './useField.types';
|
|
2
|
-
export declare const useField: <TValue, TDate, TSection extends FieldSection, TForwardedProps extends UseFieldForwardedProps, TInternalProps extends UseFieldInternalProps<any, any>>(params: UseFieldParams<TValue, TDate, TSection, TForwardedProps, TInternalProps>) => UseFieldResponse<TForwardedProps>;
|
|
2
|
+
export declare const useField: <TValue, TDate, TSection extends FieldSection, TForwardedProps extends UseFieldForwardedProps, TInternalProps extends UseFieldInternalProps<any, any, any>>(params: UseFieldParams<TValue, TDate, TSection, TForwardedProps, TInternalProps>) => UseFieldResponse<TForwardedProps>;
|