@mui/x-date-pickers 6.1.0 → 6.2.1
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/AdapterDayjs/AdapterDayjs.d.ts +114 -0
- package/AdapterDayjs/AdapterDayjs.js +387 -0
- package/AdapterDayjs/index.d.ts +1 -28
- package/AdapterDayjs/index.js +1 -102
- package/CHANGELOG.md +101 -1
- package/DateCalendar/DateCalendar.types.d.ts +1 -1
- package/DateCalendar/DayCalendar.d.ts +1 -1
- package/DateField/DateField.js +6 -0
- package/DateField/useDateField.js +3 -1
- package/DatePicker/DatePicker.js +6 -0
- package/DateTimeField/DateTimeField.js +6 -0
- package/DateTimeField/useDateTimeField.js +3 -1
- package/DateTimePicker/DateTimePicker.js +6 -0
- package/DateTimePicker/shared.js +3 -1
- package/DesktopDatePicker/DesktopDatePicker.js +7 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +7 -0
- package/DesktopTimePicker/DesktopTimePicker.js +7 -0
- package/LocalizationProvider/LocalizationProvider.d.ts +1 -1
- package/LocalizationProvider/LocalizationProvider.js +1 -1
- package/MobileDatePicker/MobileDatePicker.js +7 -0
- package/MobileDateTimePicker/MobileDateTimePicker.js +7 -0
- package/MobileTimePicker/MobileTimePicker.js +7 -0
- package/README.md +1 -0
- package/StaticDatePicker/StaticDatePicker.js +1 -0
- package/StaticDateTimePicker/StaticDateTimePicker.js +3 -2
- package/StaticTimePicker/StaticTimePicker.js +3 -2
- package/TimeClock/TimeClock.types.d.ts +1 -1
- package/TimeField/TimeField.js +6 -0
- package/TimeField/useTimeField.js +3 -1
- package/TimePicker/TimePicker.js +6 -0
- package/index.js +1 -1
- package/internals/components/PickersModalDialog.d.ts +1 -1
- package/internals/components/PickersPopper.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -14
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -2
- package/internals/hooks/useField/useField.types.d.ts +7 -2
- package/internals/hooks/useField/useField.utils.d.ts +3 -3
- package/internals/hooks/useField/useField.utils.js +16 -4
- package/internals/hooks/useField/useFieldState.js +4 -3
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.js +12 -10
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +2 -2
- package/internals/hooks/usePicker/index.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.js +2 -0
- package/internals/hooks/usePicker/usePicker.types.d.ts +2 -2
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerValue.d.ts +4 -180
- package/internals/hooks/usePicker/usePickerValue.js +191 -159
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +235 -0
- package/internals/hooks/usePicker/usePickerValue.types.js +1 -0
- package/internals/hooks/usePicker/usePickerViews.d.ts +1 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +1 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.js +10 -10
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/models/props/basePickerProps.d.ts +6 -0
- package/internals/utils/valueManagers.js +1 -1
- package/legacy/AdapterDayjs/AdapterDayjs.js +403 -0
- package/legacy/AdapterDayjs/index.js +1 -119
- package/legacy/DateField/DateField.js +6 -0
- package/legacy/DateField/useDateField.js +3 -1
- package/legacy/DatePicker/DatePicker.js +6 -0
- package/legacy/DateTimeField/DateTimeField.js +6 -0
- package/legacy/DateTimeField/useDateTimeField.js +3 -1
- package/legacy/DateTimePicker/DateTimePicker.js +6 -0
- package/legacy/DateTimePicker/shared.js +3 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +7 -0
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +7 -0
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +7 -0
- package/legacy/LocalizationProvider/LocalizationProvider.js +1 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +7 -0
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +7 -0
- package/legacy/MobileTimePicker/MobileTimePicker.js +7 -0
- package/legacy/StaticDatePicker/StaticDatePicker.js +1 -0
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +3 -2
- package/legacy/StaticTimePicker/StaticTimePicker.js +3 -2
- package/legacy/TimeField/TimeField.js +6 -0
- package/legacy/TimeField/useTimeField.js +3 -1
- package/legacy/TimePicker/TimePicker.js +6 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -10
- package/legacy/internals/hooks/useField/useField.utils.js +24 -9
- package/legacy/internals/hooks/useField/useFieldState.js +6 -4
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +7 -6
- package/legacy/internals/hooks/usePicker/usePicker.js +2 -0
- package/legacy/internals/hooks/usePicker/usePickerValue.js +186 -159
- package/legacy/internals/hooks/usePicker/usePickerValue.types.js +1 -0
- package/legacy/internals/hooks/useStaticPicker/useStaticPicker.js +7 -8
- package/legacy/internals/utils/valueManagers.js +2 -2
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
- package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
- package/legacy/tests/describeGregorianAdapter/index.js +1 -0
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +273 -0
- package/legacy/tests/describeGregorianAdapter/testFormat.js +26 -0
- package/legacy/tests/describeGregorianAdapter/testLocalization.js +15 -0
- package/legacy/tests/describeValidation/describeValidation.js +2 -1
- package/legacy/tests/describeValidation/testMinutesViewValidation.js +201 -0
- package/legacy/tests/describeValue/testPickerActionBar.js +52 -3
- package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/models/adapters.d.ts +21 -20
- package/models/fields.d.ts +1 -0
- package/modern/AdapterDayjs/AdapterDayjs.js +386 -0
- package/modern/AdapterDayjs/index.js +1 -101
- package/modern/DateField/DateField.js +6 -0
- package/modern/DateField/useDateField.js +3 -1
- package/modern/DatePicker/DatePicker.js +6 -0
- package/modern/DateTimeField/DateTimeField.js +6 -0
- package/modern/DateTimeField/useDateTimeField.js +3 -1
- package/modern/DateTimePicker/DateTimePicker.js +6 -0
- package/modern/DateTimePicker/shared.js +3 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +7 -0
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +7 -0
- package/modern/DesktopTimePicker/DesktopTimePicker.js +7 -0
- package/modern/LocalizationProvider/LocalizationProvider.js +1 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +7 -0
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +7 -0
- package/modern/MobileTimePicker/MobileTimePicker.js +7 -0
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -0
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +3 -2
- package/modern/StaticTimePicker/StaticTimePicker.js +3 -2
- package/modern/TimeField/TimeField.js +6 -0
- package/modern/TimeField/useTimeField.js +3 -1
- package/modern/TimePicker/TimePicker.js +6 -0
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -14
- package/modern/internals/hooks/useField/useField.utils.js +16 -4
- package/modern/internals/hooks/useField/useFieldState.js +4 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +12 -10
- package/modern/internals/hooks/usePicker/usePicker.js +2 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +191 -159
- package/modern/internals/hooks/usePicker/usePickerValue.types.js +1 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +10 -10
- package/modern/internals/utils/valueManagers.js +1 -1
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
- package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
- package/modern/tests/describeGregorianAdapter/index.js +1 -0
- package/modern/tests/describeGregorianAdapter/testCalculations.js +272 -0
- package/modern/tests/describeGregorianAdapter/testFormat.js +27 -0
- package/modern/tests/describeGregorianAdapter/testLocalization.js +16 -0
- package/modern/tests/describeValidation/describeValidation.js +2 -1
- package/modern/tests/describeValidation/testMinutesViewValidation.js +200 -0
- package/modern/tests/describeValue/testPickerActionBar.js +52 -3
- package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/node/AdapterDayjs/AdapterDayjs.js +395 -0
- package/node/AdapterDayjs/index.js +6 -104
- package/node/DateField/DateField.js +6 -0
- package/node/DateField/useDateField.js +3 -1
- package/node/DatePicker/DatePicker.js +6 -0
- package/node/DateTimeField/DateTimeField.js +6 -0
- package/node/DateTimeField/useDateTimeField.js +3 -1
- package/node/DateTimePicker/DateTimePicker.js +6 -0
- package/node/DateTimePicker/shared.js +3 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +7 -0
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +7 -0
- package/node/DesktopTimePicker/DesktopTimePicker.js +7 -0
- package/node/LocalizationProvider/LocalizationProvider.js +1 -1
- package/node/MobileDatePicker/MobileDatePicker.js +7 -0
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +7 -0
- package/node/MobileTimePicker/MobileTimePicker.js +7 -0
- package/node/StaticDatePicker/StaticDatePicker.js +1 -0
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +3 -2
- package/node/StaticTimePicker/StaticTimePicker.js +3 -2
- package/node/TimeField/TimeField.js +6 -0
- package/node/TimeField/useTimeField.js +3 -1
- package/node/TimePicker/TimePicker.js +6 -0
- package/node/index.js +1 -1
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -14
- package/node/internals/hooks/useField/useField.utils.js +16 -4
- package/node/internals/hooks/useField/useFieldState.js +4 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +12 -10
- package/node/internals/hooks/usePicker/usePicker.js +2 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +191 -158
- package/node/internals/hooks/usePicker/usePickerValue.types.js +5 -0
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +10 -10
- package/node/internals/utils/valueManagers.js +1 -1
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +29 -0
- package/node/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +5 -0
- package/node/tests/describeGregorianAdapter/index.js +18 -0
- package/node/tests/describeGregorianAdapter/testCalculations.js +279 -0
- package/node/tests/describeGregorianAdapter/testFormat.js +34 -0
- package/node/tests/describeGregorianAdapter/testLocalization.js +23 -0
- package/node/tests/describeValidation/describeValidation.js +2 -1
- package/node/tests/describeValidation/testMinutesViewValidation.js +210 -0
- package/node/tests/describeValue/testPickerActionBar.js +52 -3
- package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
- package/package.json +9 -9
- package/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
- package/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
- package/tests/describeGregorianAdapter/index.js +1 -0
- package/tests/describeGregorianAdapter/testCalculations.js +272 -0
- package/tests/describeGregorianAdapter/testFormat.js +27 -0
- package/tests/describeGregorianAdapter/testLocalization.js +16 -0
- package/tests/describeValidation/describeValidation.js +2 -1
- package/tests/describeValidation/testMinutesViewValidation.js +200 -0
- package/tests/describeValue/testPickerActionBar.js +52 -3
- package/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,109 @@
|
|
|
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.2.1
|
|
7
|
+
|
|
8
|
+
_Apr 20, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 Add virtualization to row detail panels (#7969) @yaredtsy
|
|
13
|
+
- 🐞 Bugfixes
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
|
|
16
|
+
### `@mui/x-data-grid@v6.2.1` / `@mui/x-data-grid-pro@v6.2.1` / `@mui/x-data-grid-premium@v6.2.1`
|
|
17
|
+
|
|
18
|
+
#### Changes
|
|
19
|
+
|
|
20
|
+
- [DataGrid] Add `getTogglableColumns` to `Hide all` and `Show all` actions (#8496) @MBilalShafi
|
|
21
|
+
- [DataGrid] Add Grid + Joy UI experiment page (#8067) @cherniavskii
|
|
22
|
+
- [DataGrid] Fix print style when rendering inside Shadow DOM (#8656) @Bwatermelon
|
|
23
|
+
- [DataGrid] Replace `GridAutoSizer` with `ResizeObserver` (#8091) @m4theushw
|
|
24
|
+
- [DataGrid] Use stable ID for the placeholder filter item (#8603) @m4theushw
|
|
25
|
+
- [DataGridPro] Virtualize row detail panels (#7969) @yaredtsy
|
|
26
|
+
|
|
27
|
+
### `@mui/x-date-pickers@v6.2.1` / `@mui/x-date-pickers-pro@v6.2.1`
|
|
28
|
+
|
|
29
|
+
#### Changes
|
|
30
|
+
|
|
31
|
+
- [pickers] Do not include the time in date components when going to today (#8657) @flaviendelangle
|
|
32
|
+
- [pickers] Sync internal state with controlled value (#8674) @alexfauquette
|
|
33
|
+
|
|
34
|
+
### `@mui/x-codemod@v6.0.6`
|
|
35
|
+
|
|
36
|
+
#### Changes
|
|
37
|
+
|
|
38
|
+
- [codemod] Avoid filter failures on object prototype properties (#8647) @LukasTy
|
|
39
|
+
|
|
40
|
+
### Docs
|
|
41
|
+
|
|
42
|
+
- [docs] Add no-op service worker to fix stale cache issue (#8598) @cherniavskii
|
|
43
|
+
- [docs] Clarify what `AdapterDayjs` is in the Getting Started page (#8219) @flaviendelangle
|
|
44
|
+
- [docs] Fix typo on picker page description (#8611) @maxolasersquad
|
|
45
|
+
- [docs] Improve section title in Getting Started page (#8648) @flaviendelangle
|
|
46
|
+
- [docs] Inform about input format modification (#8458) @alexfauquette
|
|
47
|
+
|
|
48
|
+
### Core
|
|
49
|
+
|
|
50
|
+
- [core] Fix release date (#8618) @flaviendelangle
|
|
51
|
+
- [core] Upgrade monorepo (#8668) @MBilalShafi
|
|
52
|
+
- [charts] Support Tooltip (#8356) @alexfauquette
|
|
53
|
+
|
|
54
|
+
## 6.2.0
|
|
55
|
+
|
|
56
|
+
_Apr 14, 2023_
|
|
57
|
+
|
|
58
|
+
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
59
|
+
|
|
60
|
+
- Add `@mui/base` as a `peerDependency` of `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` (#8590) @LukasTy
|
|
61
|
+
|
|
62
|
+
Both libraries were not working correctly if used without `@mui/base`.
|
|
63
|
+
Most package manager should automatically use the `@mui/base` version installed for `@mui/material`.
|
|
64
|
+
|
|
65
|
+
- The value rendered in the picker or field input no longer has spaces around the `/` characters (#8425) @flaviendelangle
|
|
66
|
+
|
|
67
|
+
You can use the `formatDensity='spacious'` prop to add it back.
|
|
68
|
+
More information on [the dedicated doc section](https://mui.com/x/react-date-pickers/custom-field/#change-the-format-density)
|
|
69
|
+
|
|
70
|
+
- 🌍 Improve French (fr-FR) and Urdu (ur-PK) and locales.
|
|
71
|
+
- 🐞 Bugfixes
|
|
72
|
+
- 📚 Documentation improvements
|
|
73
|
+
|
|
74
|
+
### `@mui/x-data-grid@v6.2.0` / `@mui/x-data-grid-pro@v6.2.0` / `@mui/x-data-grid-premium@v6.2.0`
|
|
75
|
+
|
|
76
|
+
#### Changes
|
|
77
|
+
|
|
78
|
+
- [DataGrid] Reset selection state on `checkboxSelection` toggle (#8522) @MBilalShafi
|
|
79
|
+
- [DataGrid] Use `baseSelect` slot instead of `baseTextField` with `select={true}` (#8110) @cherniavskii
|
|
80
|
+
- [l10n] Improve French (fr-FR) locale (#8537) @vallereaugabriel
|
|
81
|
+
- [l10n] Improve Urdu (ur-PK) locale (#8513) @SFARPak
|
|
82
|
+
|
|
83
|
+
### `@mui/x-date-pickers@v6.2.0` / `@mui/x-date-pickers-pro@v6.2.0`
|
|
84
|
+
|
|
85
|
+
#### Changes
|
|
86
|
+
|
|
87
|
+
- [DateTimePicker] Fix `TimeClock` validation ignoring date by default (#8570) @LukasTy
|
|
88
|
+
- [fields] Fix reliance on section order (#8545) @LukasTy
|
|
89
|
+
- [fields] Make the space between format separators controllable (#8425) @flaviendelangle
|
|
90
|
+
- [pickers] Add `@mui/base` to `peerDependencies` (#8590) @LukasTy
|
|
91
|
+
- [pickers] Fix JSDoc for `formatDensity` prop (#8601) @flaviendelangle
|
|
92
|
+
- [pickers] Improve value lifecycle on non-controlled pickers (#8312) @flaviendelangle
|
|
93
|
+
- [pickers] Migrate `AdapterDayjs` to our repository (#8487) @flaviendelangle
|
|
94
|
+
|
|
95
|
+
### Docs
|
|
96
|
+
|
|
97
|
+
- [docs] Fix "Custom day rendering" demo alignment (#8541) @LukasTy
|
|
98
|
+
- [docs] Fix **below** typo (#8576) @alexfauquette
|
|
99
|
+
|
|
100
|
+
### Core
|
|
101
|
+
|
|
102
|
+
- [core] Optimize `renovate` rules (#8575) @LukasTy
|
|
103
|
+
- [core] Upgrade monorepo (#8578) @cherniavskii
|
|
104
|
+
- [core] Update last release date (#8569) @DanailH
|
|
105
|
+
|
|
6
106
|
## 6.1.0
|
|
7
107
|
|
|
8
|
-
_Apr
|
|
108
|
+
_Apr 10, 2023_
|
|
9
109
|
|
|
10
110
|
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
11
111
|
|
|
@@ -5,7 +5,7 @@ import { PickersCalendarHeaderSlotsComponent, PickersCalendarHeaderSlotsComponen
|
|
|
5
5
|
import { DayCalendarSlotsComponent, DayCalendarSlotsComponentsProps, ExportedDayCalendarProps } from './DayCalendar';
|
|
6
6
|
import { DateCalendarClasses } from './dateCalendarClasses';
|
|
7
7
|
import { BaseDateValidationProps, YearValidationProps, MonthValidationProps, DayValidationProps } from '../internals/hooks/validation/models';
|
|
8
|
-
import { PickerSelectionState } from '../internals/hooks/usePicker/usePickerValue';
|
|
8
|
+
import { PickerSelectionState } from '../internals/hooks/usePicker/usePickerValue.types';
|
|
9
9
|
import { ExportedUseViewsOptions } from '../internals/hooks/useViews';
|
|
10
10
|
import { DateView } from '../models';
|
|
11
11
|
import { DefaultizedProps } from '../internals/models/helpers';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentProps } from '@mui/base';
|
|
2
|
+
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
3
|
import { PickersDay, PickersDayProps, ExportedPickersDayProps } from '../PickersDay/PickersDay';
|
|
4
4
|
import { PickerOnChangeFn } from '../internals/hooks/useViews';
|
|
5
5
|
import { SlideDirection, SlideTransitionProps } from './PickersSlideTransition';
|
package/DateField/DateField.js
CHANGED
|
@@ -120,6 +120,12 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
120
120
|
* Format of the date when rendered in the input(s).
|
|
121
121
|
*/
|
|
122
122
|
format: PropTypes.string,
|
|
123
|
+
/**
|
|
124
|
+
* Density of the format when rendered in the input.
|
|
125
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
126
|
+
* @default "dense"
|
|
127
|
+
*/
|
|
128
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
123
129
|
/**
|
|
124
130
|
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
125
131
|
*/
|
|
@@ -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", "unstableFieldRef"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "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';
|
|
@@ -27,6 +27,7 @@ export const useDateField = ({
|
|
|
27
27
|
value,
|
|
28
28
|
defaultValue,
|
|
29
29
|
format,
|
|
30
|
+
formatDensity,
|
|
30
31
|
onChange,
|
|
31
32
|
readOnly,
|
|
32
33
|
onError,
|
|
@@ -49,6 +50,7 @@ export const useDateField = ({
|
|
|
49
50
|
value,
|
|
50
51
|
defaultValue,
|
|
51
52
|
format,
|
|
53
|
+
formatDensity,
|
|
52
54
|
onChange,
|
|
53
55
|
readOnly,
|
|
54
56
|
onError,
|
package/DatePicker/DatePicker.js
CHANGED
|
@@ -127,6 +127,12 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
127
127
|
* Defaults to localized format based on the used `views`.
|
|
128
128
|
*/
|
|
129
129
|
format: PropTypes.string,
|
|
130
|
+
/**
|
|
131
|
+
* Density of the format when rendered in the input.
|
|
132
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
133
|
+
* @default "dense"
|
|
134
|
+
*/
|
|
135
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
130
136
|
/**
|
|
131
137
|
* Pass a ref to the `input` element.
|
|
132
138
|
*/
|
|
@@ -130,6 +130,12 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
130
130
|
* Format of the date when rendered in the input(s).
|
|
131
131
|
*/
|
|
132
132
|
format: PropTypes.string,
|
|
133
|
+
/**
|
|
134
|
+
* Density of the format when rendered in the input.
|
|
135
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
136
|
+
* @default "dense"
|
|
137
|
+
*/
|
|
138
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
133
139
|
/**
|
|
134
140
|
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
135
141
|
*/
|
|
@@ -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", "unstableFieldRef"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "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';
|
|
@@ -32,6 +32,7 @@ export const useDateTimeField = ({
|
|
|
32
32
|
value,
|
|
33
33
|
defaultValue,
|
|
34
34
|
format,
|
|
35
|
+
formatDensity,
|
|
35
36
|
onChange,
|
|
36
37
|
readOnly,
|
|
37
38
|
onError,
|
|
@@ -61,6 +62,7 @@ export const useDateTimeField = ({
|
|
|
61
62
|
value,
|
|
62
63
|
defaultValue,
|
|
63
64
|
format,
|
|
65
|
+
formatDensity,
|
|
64
66
|
onChange,
|
|
65
67
|
readOnly,
|
|
66
68
|
onError,
|
|
@@ -142,6 +142,12 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
142
142
|
* Defaults to localized format based on the used `views`.
|
|
143
143
|
*/
|
|
144
144
|
format: PropTypes.string,
|
|
145
|
+
/**
|
|
146
|
+
* Density of the format when rendered in the input.
|
|
147
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
148
|
+
* @default "dense"
|
|
149
|
+
*/
|
|
150
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
145
151
|
/**
|
|
146
152
|
* Pass a ref to the `input` element.
|
|
147
153
|
*/
|
package/DateTimePicker/shared.js
CHANGED
|
@@ -37,7 +37,9 @@ export function useDateTimePickerDefaultizedProps(props, name) {
|
|
|
37
37
|
localeText,
|
|
38
38
|
orientation: (_themeProps$orientati = themeProps.orientation) != null ? _themeProps$orientati : 'portrait',
|
|
39
39
|
// TODO: Remove from public API
|
|
40
|
-
disableIgnoringDatePartForTimeValidation: (_themeProps$disableIg = themeProps.disableIgnoringDatePartForTimeValidation) != null ? _themeProps$disableIg : Boolean(themeProps.minDateTime || themeProps.maxDateTime
|
|
40
|
+
disableIgnoringDatePartForTimeValidation: (_themeProps$disableIg = themeProps.disableIgnoringDatePartForTimeValidation) != null ? _themeProps$disableIg : Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
|
|
41
|
+
// allow time clock to correctly check time validity: https://github.com/mui/mui-x/issues/8520
|
|
42
|
+
themeProps.disablePast || themeProps.disableFuture),
|
|
41
43
|
disableFuture: (_themeProps$disableFu = themeProps.disableFuture) != null ? _themeProps$disableFu : false,
|
|
42
44
|
disablePast: (_themeProps$disablePa = themeProps.disablePast) != null ? _themeProps$disablePa : false,
|
|
43
45
|
minDate: applyDefaultDate(utils, (_themeProps$minDateTi = themeProps.minDateTime) != null ? _themeProps$minDateTi : themeProps.minDate, defaultDates.minDate),
|
|
@@ -49,6 +49,7 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
49
49
|
} = useDesktopPicker({
|
|
50
50
|
props,
|
|
51
51
|
valueManager: singleItemValueManager,
|
|
52
|
+
valueType: 'date',
|
|
52
53
|
getOpenDialogAriaText: localeText.openDatePickerDialogue,
|
|
53
54
|
validator: validateDate
|
|
54
55
|
});
|
|
@@ -143,6 +144,12 @@ DesktopDatePicker.propTypes = {
|
|
|
143
144
|
* Defaults to localized format based on the used `views`.
|
|
144
145
|
*/
|
|
145
146
|
format: PropTypes.string,
|
|
147
|
+
/**
|
|
148
|
+
* Density of the format when rendered in the input.
|
|
149
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
150
|
+
* @default "dense"
|
|
151
|
+
*/
|
|
152
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
146
153
|
/**
|
|
147
154
|
* Pass a ref to the `input` element.
|
|
148
155
|
*/
|
|
@@ -57,6 +57,7 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
|
|
|
57
57
|
} = useDesktopPicker({
|
|
58
58
|
props,
|
|
59
59
|
valueManager: singleItemValueManager,
|
|
60
|
+
valueType: 'date-time',
|
|
60
61
|
getOpenDialogAriaText: localeText.openDatePickerDialogue,
|
|
61
62
|
validator: validateDateTime
|
|
62
63
|
});
|
|
@@ -166,6 +167,12 @@ DesktopDateTimePicker.propTypes = {
|
|
|
166
167
|
* Defaults to localized format based on the used `views`.
|
|
167
168
|
*/
|
|
168
169
|
format: PropTypes.string,
|
|
170
|
+
/**
|
|
171
|
+
* Density of the format when rendered in the input.
|
|
172
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
173
|
+
* @default "dense"
|
|
174
|
+
*/
|
|
175
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
169
176
|
/**
|
|
170
177
|
* Pass a ref to the `input` element.
|
|
171
178
|
*/
|
|
@@ -49,6 +49,7 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
|
|
|
49
49
|
} = useDesktopPicker({
|
|
50
50
|
props,
|
|
51
51
|
valueManager: singleItemValueManager,
|
|
52
|
+
valueType: 'time',
|
|
52
53
|
getOpenDialogAriaText: localeText.openTimePickerDialogue,
|
|
53
54
|
validator: validateTime
|
|
54
55
|
});
|
|
@@ -132,6 +133,12 @@ DesktopTimePicker.propTypes = {
|
|
|
132
133
|
* Defaults to localized format based on the used `views`.
|
|
133
134
|
*/
|
|
134
135
|
format: PropTypes.string,
|
|
136
|
+
/**
|
|
137
|
+
* Density of the format when rendered in the input.
|
|
138
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
139
|
+
* @default "dense"
|
|
140
|
+
*/
|
|
141
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
135
142
|
/**
|
|
136
143
|
* Pass a ref to the `input` element.
|
|
137
144
|
*/
|
|
@@ -17,7 +17,7 @@ export interface LocalizationProviderProps<TDate> {
|
|
|
17
17
|
children?: React.ReactNode;
|
|
18
18
|
/**
|
|
19
19
|
* Date library adapter class function.
|
|
20
|
-
* @see See the localization provider {@link https://mui.com/x/react-date-pickers/getting-started/#
|
|
20
|
+
* @see See the localization provider {@link https://mui.com/x/react-date-pickers/getting-started/#setup-your-date-library-adapter date adapter setup section} for more details.
|
|
21
21
|
*/
|
|
22
22
|
dateAdapter?: new (...args: any) => MuiPickersAdapter<TDate>;
|
|
23
23
|
/** Formats that are used for any child pickers */
|
|
@@ -90,7 +90,7 @@ process.env.NODE_ENV !== "production" ? LocalizationProvider.propTypes = {
|
|
|
90
90
|
children: PropTypes.node,
|
|
91
91
|
/**
|
|
92
92
|
* Date library adapter class function.
|
|
93
|
-
* @see See the localization provider {@link https://mui.com/x/react-date-pickers/getting-started/#
|
|
93
|
+
* @see See the localization provider {@link https://mui.com/x/react-date-pickers/getting-started/#setup-your-date-library-adapter date adapter setup section} for more details.
|
|
94
94
|
*/
|
|
95
95
|
dateAdapter: PropTypes.func,
|
|
96
96
|
/**
|
|
@@ -46,6 +46,7 @@ const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker
|
|
|
46
46
|
} = useMobilePicker({
|
|
47
47
|
props,
|
|
48
48
|
valueManager: singleItemValueManager,
|
|
49
|
+
valueType: 'date',
|
|
49
50
|
getOpenDialogAriaText: localeText.openDatePickerDialogue,
|
|
50
51
|
validator: validateDate
|
|
51
52
|
});
|
|
@@ -140,6 +141,12 @@ MobileDatePicker.propTypes = {
|
|
|
140
141
|
* Defaults to localized format based on the used `views`.
|
|
141
142
|
*/
|
|
142
143
|
format: PropTypes.string,
|
|
144
|
+
/**
|
|
145
|
+
* Density of the format when rendered in the input.
|
|
146
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
147
|
+
* @default "dense"
|
|
148
|
+
*/
|
|
149
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
143
150
|
/**
|
|
144
151
|
* Pass a ref to the `input` element.
|
|
145
152
|
*/
|
|
@@ -55,6 +55,7 @@ const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTi
|
|
|
55
55
|
} = useMobilePicker({
|
|
56
56
|
props,
|
|
57
57
|
valueManager: singleItemValueManager,
|
|
58
|
+
valueType: 'date-time',
|
|
58
59
|
getOpenDialogAriaText: localeText.openDatePickerDialogue,
|
|
59
60
|
validator: validateDateTime
|
|
60
61
|
});
|
|
@@ -164,6 +165,12 @@ MobileDateTimePicker.propTypes = {
|
|
|
164
165
|
* Defaults to localized format based on the used `views`.
|
|
165
166
|
*/
|
|
166
167
|
format: PropTypes.string,
|
|
168
|
+
/**
|
|
169
|
+
* Density of the format when rendered in the input.
|
|
170
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
171
|
+
* @default "dense"
|
|
172
|
+
*/
|
|
173
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
167
174
|
/**
|
|
168
175
|
* Pass a ref to the `input` element.
|
|
169
176
|
*/
|
|
@@ -48,6 +48,7 @@ const MobileTimePicker = /*#__PURE__*/React.forwardRef(function MobileTimePicker
|
|
|
48
48
|
} = useMobilePicker({
|
|
49
49
|
props,
|
|
50
50
|
valueManager: singleItemValueManager,
|
|
51
|
+
valueType: 'time',
|
|
51
52
|
getOpenDialogAriaText: localeText.openTimePickerDialogue,
|
|
52
53
|
validator: validateTime
|
|
53
54
|
});
|
|
@@ -131,6 +132,12 @@ MobileTimePicker.propTypes = {
|
|
|
131
132
|
* Defaults to localized format based on the used `views`.
|
|
132
133
|
*/
|
|
133
134
|
format: PropTypes.string,
|
|
135
|
+
/**
|
|
136
|
+
* Density of the format when rendered in the input.
|
|
137
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
138
|
+
* @default "dense"
|
|
139
|
+
*/
|
|
140
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
134
141
|
/**
|
|
135
142
|
* Pass a ref to the `input` element.
|
|
136
143
|
*/
|
package/README.md
CHANGED
|
@@ -42,8 +42,9 @@ const StaticDateTimePicker = /*#__PURE__*/React.forwardRef(function StaticDateTi
|
|
|
42
42
|
} = useStaticPicker({
|
|
43
43
|
props,
|
|
44
44
|
valueManager: singleItemValueManager,
|
|
45
|
-
|
|
46
|
-
validator: validateDateTime
|
|
45
|
+
valueType: 'date-time',
|
|
46
|
+
validator: validateDateTime,
|
|
47
|
+
ref
|
|
47
48
|
});
|
|
48
49
|
return renderPicker();
|
|
49
50
|
});
|
|
@@ -34,8 +34,9 @@ const StaticTimePicker = /*#__PURE__*/React.forwardRef(function StaticTimePicker
|
|
|
34
34
|
} = useStaticPicker({
|
|
35
35
|
props,
|
|
36
36
|
valueManager: singleItemValueManager,
|
|
37
|
-
|
|
38
|
-
validator: validateTime
|
|
37
|
+
valueType: 'time',
|
|
38
|
+
validator: validateTime,
|
|
39
|
+
ref
|
|
39
40
|
});
|
|
40
41
|
return renderPicker();
|
|
41
42
|
});
|
|
@@ -4,7 +4,7 @@ import { TimeClockClasses } from './timeClockClasses';
|
|
|
4
4
|
import { TimeValidationProps, BaseTimeValidationProps } from '../internals/hooks/validation/models';
|
|
5
5
|
import { PickersArrowSwitcherSlotsComponent, PickersArrowSwitcherSlotsComponentsProps } from '../internals/components/PickersArrowSwitcher';
|
|
6
6
|
import { TimeView } from '../models';
|
|
7
|
-
import { PickerSelectionState } from '../internals/hooks/usePicker/usePickerValue';
|
|
7
|
+
import { PickerSelectionState } from '../internals/hooks/usePicker/usePickerValue.types';
|
|
8
8
|
import { UncapitalizeObjectKeys } from '../internals/utils/slots-migration';
|
|
9
9
|
export interface ExportedTimeClockProps<TDate> extends TimeValidationProps<TDate>, BaseTimeValidationProps {
|
|
10
10
|
/**
|
package/TimeField/TimeField.js
CHANGED
|
@@ -130,6 +130,12 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
130
130
|
* Format of the date when rendered in the input(s).
|
|
131
131
|
*/
|
|
132
132
|
format: PropTypes.string,
|
|
133
|
+
/**
|
|
134
|
+
* Density of the format when rendered in the input.
|
|
135
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
136
|
+
* @default "dense"
|
|
137
|
+
*/
|
|
138
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
133
139
|
/**
|
|
134
140
|
* Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
|
|
135
141
|
*/
|
|
@@ -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", "unstableFieldRef"];
|
|
3
|
+
const _excluded = ["value", "defaultValue", "format", "formatDensity", "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';
|
|
@@ -25,6 +25,7 @@ export const useTimeField = ({
|
|
|
25
25
|
value,
|
|
26
26
|
defaultValue,
|
|
27
27
|
format,
|
|
28
|
+
formatDensity,
|
|
28
29
|
onChange,
|
|
29
30
|
readOnly,
|
|
30
31
|
onError,
|
|
@@ -49,6 +50,7 @@ export const useTimeField = ({
|
|
|
49
50
|
value,
|
|
50
51
|
defaultValue,
|
|
51
52
|
format,
|
|
53
|
+
formatDensity,
|
|
52
54
|
onChange,
|
|
53
55
|
readOnly,
|
|
54
56
|
onError,
|
package/TimePicker/TimePicker.js
CHANGED
|
@@ -116,6 +116,12 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
116
116
|
* Defaults to localized format based on the used `views`.
|
|
117
117
|
*/
|
|
118
118
|
format: PropTypes.string,
|
|
119
|
+
/**
|
|
120
|
+
* Density of the format when rendered in the input.
|
|
121
|
+
* Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
|
|
122
|
+
* @default "dense"
|
|
123
|
+
*/
|
|
124
|
+
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
119
125
|
/**
|
|
120
126
|
* Pass a ref to the `input` element.
|
|
121
127
|
*/
|
package/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { DialogProps as MuiDialogProps } from '@mui/material/Dialog';
|
|
|
3
3
|
import { PaperProps as MuiPaperProps } from '@mui/material/Paper/Paper';
|
|
4
4
|
import { TransitionProps as MuiTransitionProps } from '@mui/material/transitions/transition';
|
|
5
5
|
import { UncapitalizeObjectKeys } from '../utils/slots-migration';
|
|
6
|
-
import { UsePickerValueActions } from '../hooks/usePicker/usePickerValue';
|
|
6
|
+
import { UsePickerValueActions } from '../hooks/usePicker/usePickerValue.types';
|
|
7
7
|
export interface PickersModalDialogSlotsComponent {
|
|
8
8
|
/**
|
|
9
9
|
* Custom component for the dialog inside which the views are rendered on mobile.
|
|
@@ -6,7 +6,7 @@ import { TrapFocusProps as MuiTrapFocusProps } from '@mui/material/Unstable_Trap
|
|
|
6
6
|
import { TransitionProps as MuiTransitionProps } from '@mui/material/transitions';
|
|
7
7
|
import { PickersPopperClasses } from './pickersPopperClasses';
|
|
8
8
|
import { UncapitalizeObjectKeys } from '../utils/slots-migration';
|
|
9
|
-
import { UsePickerValueActions } from '../hooks/usePicker/usePickerValue';
|
|
9
|
+
import { UsePickerValueActions } from '../hooks/usePicker/usePickerValue.types';
|
|
10
10
|
export interface PickersPopperSlotsComponent {
|
|
11
11
|
/**
|
|
12
12
|
* Custom component for the paper rendered inside the desktop picker's Popper.
|
|
@@ -7,6 +7,6 @@ import { DateOrTimeView } from '../../../models';
|
|
|
7
7
|
* - DesktopDateTimePicker
|
|
8
8
|
* - DesktopTimePicker
|
|
9
9
|
*/
|
|
10
|
-
export declare const useDesktopPicker: <TDate, TView extends DateOrTimeView, TExternalProps extends UseDesktopPickerProps<TDate, TView, any, TExternalProps>>({ props,
|
|
10
|
+
export declare const useDesktopPicker: <TDate, TView extends DateOrTimeView, TExternalProps extends UseDesktopPickerProps<TDate, TView, any, TExternalProps>>({ props, getOpenDialogAriaText, ...pickerParams }: UseDesktopPickerParams<TDate, TView, TExternalProps>) => {
|
|
11
11
|
renderPicker: () => JSX.Element;
|
|
12
12
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
4
|
-
_excluded2 = ["ownerState"]
|
|
3
|
+
const _excluded = ["props", "getOpenDialogAriaText"],
|
|
4
|
+
_excluded2 = ["ownerState"],
|
|
5
|
+
_excluded3 = ["ownerState"];
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import { useSlotProps } from '@mui/base/utils';
|
|
7
8
|
import MuiInputAdornment from '@mui/material/InputAdornment';
|
|
@@ -21,19 +22,20 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
21
22
|
* - DesktopDateTimePicker
|
|
22
23
|
* - DesktopTimePicker
|
|
23
24
|
*/
|
|
24
|
-
export const useDesktopPicker =
|
|
25
|
-
props,
|
|
26
|
-
valueManager,
|
|
27
|
-
getOpenDialogAriaText,
|
|
28
|
-
validator
|
|
29
|
-
}) => {
|
|
25
|
+
export const useDesktopPicker = _ref => {
|
|
30
26
|
var _innerSlotProps$toolb, _innerSlotProps$toolb2, _slots$inputAdornment, _slots$openPickerButt, _slots$layout;
|
|
27
|
+
let {
|
|
28
|
+
props,
|
|
29
|
+
getOpenDialogAriaText
|
|
30
|
+
} = _ref,
|
|
31
|
+
pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
31
32
|
const {
|
|
32
33
|
slots,
|
|
33
34
|
slotProps: innerSlotProps,
|
|
34
35
|
className,
|
|
35
36
|
sx,
|
|
36
37
|
format,
|
|
38
|
+
formatDensity,
|
|
37
39
|
label,
|
|
38
40
|
inputRef,
|
|
39
41
|
readOnly,
|
|
@@ -54,15 +56,13 @@ export const useDesktopPicker = ({
|
|
|
54
56
|
renderCurrentView,
|
|
55
57
|
shouldRestoreFocus,
|
|
56
58
|
fieldProps: pickerFieldProps
|
|
57
|
-
} = usePicker({
|
|
59
|
+
} = usePicker(_extends({}, pickerParams, {
|
|
58
60
|
props,
|
|
59
61
|
inputRef: internalInputRef,
|
|
60
|
-
valueManager,
|
|
61
|
-
validator,
|
|
62
62
|
autoFocusView: true,
|
|
63
63
|
additionalViewProps: {},
|
|
64
64
|
wrapperVariant: 'desktop'
|
|
65
|
-
});
|
|
65
|
+
}));
|
|
66
66
|
const InputAdornment = (_slots$inputAdornment = slots.inputAdornment) != null ? _slots$inputAdornment : MuiInputAdornment;
|
|
67
67
|
const _useSlotProps = useSlotProps({
|
|
68
68
|
elementType: InputAdornment,
|
|
@@ -72,7 +72,7 @@ export const useDesktopPicker = ({
|
|
|
72
72
|
},
|
|
73
73
|
ownerState: props
|
|
74
74
|
}),
|
|
75
|
-
inputAdornmentProps = _objectWithoutPropertiesLoose(_useSlotProps,
|
|
75
|
+
inputAdornmentProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
76
76
|
const OpenPickerButton = (_slots$openPickerButt = slots.openPickerButton) != null ? _slots$openPickerButt : IconButton;
|
|
77
77
|
const _useSlotProps2 = useSlotProps({
|
|
78
78
|
elementType: OpenPickerButton,
|
|
@@ -85,7 +85,7 @@ export const useDesktopPicker = ({
|
|
|
85
85
|
},
|
|
86
86
|
ownerState: props
|
|
87
87
|
}),
|
|
88
|
-
openPickerButtonProps = _objectWithoutPropertiesLoose(_useSlotProps2,
|
|
88
|
+
openPickerButtonProps = _objectWithoutPropertiesLoose(_useSlotProps2, _excluded3);
|
|
89
89
|
const OpenPickerIcon = slots.openPickerIcon;
|
|
90
90
|
const Field = slots.field;
|
|
91
91
|
const fieldProps = useSlotProps({
|
|
@@ -99,6 +99,7 @@ export const useDesktopPicker = ({
|
|
|
99
99
|
className,
|
|
100
100
|
sx,
|
|
101
101
|
format,
|
|
102
|
+
formatDensity,
|
|
102
103
|
label,
|
|
103
104
|
autoFocus: autoFocus && !props.open
|
|
104
105
|
}),
|
|
@@ -8,7 +8,7 @@ import { PickersPopperSlotsComponent, PickersPopperSlotsComponentsProps } from '
|
|
|
8
8
|
import { UsePickerParams, UsePickerProps } from '../usePicker';
|
|
9
9
|
import { BaseSingleInputFieldProps, FieldSection, DateOrTimeView, MuiPickersAdapter } from '../../../models';
|
|
10
10
|
import { ExportedPickersLayoutSlotsComponent, ExportedPickersLayoutSlotsComponentsProps, PickersLayoutSlotsComponentsProps } from '../../../PickersLayout/PickersLayout.types';
|
|
11
|
-
import { UsePickerValueNonStaticProps } from '../usePicker/usePickerValue';
|
|
11
|
+
import { UsePickerValueNonStaticProps } from '../usePicker/usePickerValue.types';
|
|
12
12
|
import { UsePickerViewsNonStaticProps, UsePickerViewsProps } from '../usePicker/usePickerViews';
|
|
13
13
|
import { UncapitalizeObjectKeys } from '../../utils/slots-migration';
|
|
14
14
|
export interface UseDesktopPickerSlotsComponent<TDate, TView extends DateOrTimeView> extends Pick<PickersPopperSlotsComponent, 'DesktopPaper' | 'DesktopTransition' | 'DesktopTrapFocus' | 'Popper'>, ExportedPickersLayoutSlotsComponent<TDate | null, TDate, TView> {
|
|
@@ -64,7 +64,7 @@ export interface UseDesktopPickerProps<TDate, TView extends DateOrTimeView, TErr
|
|
|
64
64
|
*/
|
|
65
65
|
slotProps?: UseDesktopPickerSlotsComponentsProps<TDate, TView>;
|
|
66
66
|
}
|
|
67
|
-
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'> {
|
|
67
|
+
export interface UseDesktopPickerParams<TDate, TView extends DateOrTimeView, TExternalProps extends UseDesktopPickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<TDate | null, TDate, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
|
|
68
68
|
props: TExternalProps;
|
|
69
69
|
getOpenDialogAriaText: (date: TDate | null, utils: MuiPickersAdapter<TDate>) => string;
|
|
70
70
|
}
|