@mui/x-date-pickers-pro 5.0.0-alpha.2 β†’ 5.0.0-alpha.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +163 -10
  2. package/DateRangePicker/DateRangePicker.d.ts +2 -2
  3. package/DateRangePicker/DateRangePicker.js +28 -42
  4. package/DateRangePicker/DateRangePickerInput.d.ts +8 -4
  5. package/DateRangePicker/DateRangePickerInput.js +19 -7
  6. package/DateRangePicker/DateRangePickerToolbar.d.ts +2 -3
  7. package/DateRangePicker/DateRangePickerToolbar.js +1 -1
  8. package/DateRangePicker/DateRangePickerView.d.ts +37 -20
  9. package/DateRangePicker/DateRangePickerView.js +14 -12
  10. package/DateRangePicker/DateRangePickerViewDesktop.d.ts +3 -3
  11. package/DateRangePicker/DateRangePickerViewDesktop.js +13 -13
  12. package/DateRangePicker/DateRangePickerViewMobile.d.ts +18 -3
  13. package/DateRangePicker/DateRangePickerViewMobile.js +22 -13
  14. package/DateRangePicker/shared.d.ts +11 -21
  15. package/DateRangePicker/shared.js +8 -1
  16. package/DateRangePickerDay/DateRangePickerDay.js +0 -7
  17. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +2 -2
  18. package/DesktopDateRangePicker/DesktopDateRangePicker.js +37 -67
  19. package/LICENSE +2 -2
  20. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +2 -2
  21. package/MobileDateRangePicker/MobileDateRangePicker.js +31 -52
  22. package/StaticDateRangePicker/StaticDateRangePicker.d.ts +4 -55
  23. package/StaticDateRangePicker/StaticDateRangePicker.js +42 -112
  24. package/index.js +1 -1
  25. package/internal/hooks/validation/useDateRangeValidation.d.ts +4 -4
  26. package/internal/models/dateRange.d.ts +0 -2
  27. package/internal/utils/date-utils.d.ts +2 -2
  28. package/internal/utils/releaseInfo.js +1 -1
  29. package/legacy/DateRangePicker/DateRangePicker.js +28 -42
  30. package/legacy/DateRangePicker/DateRangePickerInput.js +19 -7
  31. package/legacy/DateRangePicker/DateRangePickerToolbar.js +3 -3
  32. package/legacy/DateRangePicker/DateRangePickerView.js +16 -14
  33. package/legacy/DateRangePicker/DateRangePickerViewDesktop.js +13 -13
  34. package/legacy/DateRangePicker/DateRangePickerViewMobile.js +25 -12
  35. package/legacy/DateRangePicker/shared.js +12 -1
  36. package/legacy/DateRangePickerDay/DateRangePickerDay.js +0 -7
  37. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +40 -68
  38. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +31 -54
  39. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +43 -116
  40. package/legacy/index.js +1 -1
  41. package/legacy/internal/utils/releaseInfo.js +1 -1
  42. package/modern/DateRangePicker/DateRangePicker.js +28 -42
  43. package/modern/DateRangePicker/DateRangePickerInput.js +19 -7
  44. package/modern/DateRangePicker/DateRangePickerToolbar.js +1 -1
  45. package/modern/DateRangePicker/DateRangePickerView.js +14 -12
  46. package/modern/DateRangePicker/DateRangePickerViewDesktop.js +13 -13
  47. package/modern/DateRangePicker/DateRangePickerViewMobile.js +22 -13
  48. package/modern/DateRangePicker/shared.js +8 -1
  49. package/modern/DateRangePickerDay/DateRangePickerDay.js +0 -7
  50. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +37 -67
  51. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +31 -52
  52. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +42 -112
  53. package/modern/index.js +1 -1
  54. package/modern/internal/utils/releaseInfo.js +1 -1
  55. package/node/DateRangePicker/DateRangePicker.js +28 -42
  56. package/node/DateRangePicker/DateRangePickerInput.js +18 -6
  57. package/node/DateRangePicker/DateRangePickerToolbar.js +1 -1
  58. package/node/DateRangePicker/DateRangePickerView.js +15 -13
  59. package/node/DateRangePicker/DateRangePickerViewDesktop.js +13 -13
  60. package/node/DateRangePicker/DateRangePickerViewMobile.js +22 -13
  61. package/node/DateRangePicker/shared.js +12 -1
  62. package/node/DateRangePickerDay/DateRangePickerDay.js +0 -7
  63. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +36 -64
  64. package/node/MobileDateRangePicker/MobileDateRangePicker.js +30 -52
  65. package/node/StaticDateRangePicker/StaticDateRangePicker.js +41 -108
  66. package/node/index.js +1 -1
  67. package/node/internal/utils/releaseInfo.js +1 -1
  68. package/package.json +7 -7
  69. package/themeAugmentation/components.d.ts +2 -2
  70. package/themeAugmentation/overrides.d.ts +2 -2
  71. package/themeAugmentation/props.d.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,159 @@
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
+ ## v5.11.0
7
+
8
+ _May 13, 2022_
9
+
10
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - πŸš€ Premium plan release
13
+
14
+ We’re happy to announce that the Premium plan is [finally out](https://mui.com/blog/premium-plan-release/)!
15
+ With it, MUI X officially steps up to the next level, supporting the most advanced use cases for UI components.
16
+
17
+ This plan is available through the new `@mui/x-data-grid-premium` package, which contains the row grouping and the Excel export features.
18
+
19
+ If you were already using the row grouping feature, you can upgrade by [installing](https://mui.com/x/react-data-grid/getting-started/#installation) `@mui/x-data-grid-premium` and replace `DataGridPro` with `DataGridPremium`, as follows.
20
+ Note that the experimental flag is not required anymore to use the row grouping.
21
+
22
+ ```diff
23
+ -import { DataGridPro } from '@mui/x-data-grid-pro';
24
+ +import { DataGridPremium } from '@mui/x-data-grid-premium';
25
+
26
+ -<DataGridPro experimentalFeatures={{ rowGrouping: true }} />
27
+ +<DataGridPremium />
28
+ ```
29
+
30
+ For more information about the revised pricing model please have a look at the [blog post](https://mui.com/blog/premium-plan-release/#the-new-licensing-model).
31
+
32
+ - πŸ‘” Add Excel export
33
+
34
+ - πŸ”Ž Quick filtering
35
+
36
+ You can now add a quick filtering search bar to your grid.
37
+ To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar.
38
+
39
+ More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/#quick-filter)
40
+
41
+ ![image](https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png)
42
+
43
+ - 🐞 Bugs fixes
44
+
45
+ ### `@mui/x-data-grid@v5.11.0` / `@mui/x-data-grid-pro@v5.11.0` / `@mui/x-data-grid-premium@v5.11.0`
46
+
47
+ #### Breaking changes
48
+
49
+ - Moving row grouping to premium package
50
+
51
+ The use of `rowGrouping` in the `@mui/x-data-grid-pro` package is deprecated. The experimental flag will be removed in an upcoming release.
52
+
53
+ #### Changes
54
+
55
+ - [DataGrid] Add TypeScript support to the `sx` prop in inner components (#4743) @lindapaiste
56
+ - [DataGrid] Add props to control cell mode (#4210) @m4theushw
57
+ - [DataGrid] Add quick filtering engine (#4317) @alexfauquette
58
+ - [DataGrid] Check focus validity whenever the rows in state changes (#4683) @flaviendelangle
59
+ - [DataGrid] Fix infinite scroll when dragging column header cell over row cell (#4735) @DjoSmer
60
+ - [DataGrid] Fix scroll jump when using keyboard navigation (#4515) @cherniavskii
61
+ - [DataGrid] Improve sorting accessibility (#4379) @cherniavskii
62
+ - [DataGrid] New `getRowGroupChildren` API method (#4304) @flaviendelangle
63
+ - [DataGrid] Publish `preferencePanelClose` event only once when clicking on another panel button (#4810) @flaviendelangle
64
+ - [DataGrid] Update focused action if the currently focused one is removed (#4694) @m4theushw
65
+ - [DataGrid] Add `onChange` callback to edit components (#4621) @m4theushw
66
+ - [DataGrid] Add `keepNonExistentRowsSelected` prop (#4786) @willsoto
67
+ - [DataGrid] Prevent crash if row is removed with click (#4831) @m4theushw
68
+ - [DataGridPro] Fix detail panel not taking full width (#4610) @cherniavskii
69
+ - [DataGridPremium] Add Excel export (#3981) @alexfauquette
70
+ - [DataGridPremium] Bootstrap `@mui/x-data-grid-premium` (#4223) @flaviendelangle
71
+ - [DataGridPremium] Fix Excel date serialization when row grouping is enabled (#4774) @cherniavskii
72
+ - [l10n] Improve German (de-DE) locale (#4748) @sebastianfrey
73
+ - [l10n] Improve German (de-DE) locale (#4668) @izu-co
74
+
75
+ ### `@mui/x-date-pickers@5.0.0-alpha.3` / `@mui/x-date-pickers-pro@5.0.0-alpha.3`
76
+
77
+ #### Breaking changes
78
+
79
+ - Rework the auto-closing behavior of the pickers.
80
+
81
+ The `disableCloseOnSelect` prop has been replaced by a new `closeOnSelect` prop which has the opposite behavior.
82
+ The default behavior remains the same (close after the last step on desktop but not on mobile).
83
+
84
+ ```diff
85
+ // If you don't want to close after the last step
86
+ -<DatePicker disableCloseOnSelect={false} />
87
+ +<DatePicker closeOnSelect />
88
+
89
+ // If you want to close after the last step
90
+ -<DatePicker disableCloseOnSelect />
91
+ +<DatePicker closeOnSelect={false} />
92
+ ```
93
+
94
+ #### Changes
95
+
96
+ - [DatePicker] Ignore <kbd>Escape</kbd> when the picker is already closed (#4770) @mikewolfd
97
+ - [DatePicker] Make month year order changeable in header (#4695) @gky360
98
+ - [DateRangePicker] Open view on click, <kbd>Enter</kbd> or <kbd>Space</kbd> instead of focus (#4747) @alexfauquette
99
+ - [DateRangePicker] Refactor tests (#4745) @flaviendelangle
100
+ - [DateRangePicker] Remove `orientation` prop (#4665) @m4theushw
101
+ - [DateTimePicker] `Toolbar` should be visible by default on mobile (#4833) @flaviendelangle
102
+ - [MonthPicker] New prop `shouldDisableMonth` (#4708) @someone635
103
+ - [TimePicker] Disable and invalidate date with minutes not matching `minutesStep` (#4726) @flaviendelangle
104
+ - [TimePicker] Don't merge with previous value when new value is not valid (#4847) @flaviendelangle
105
+ - [TimePicker] Refactor `isTimeDisabled` method (#4688) @flaviendelangle
106
+ - [pickers] Add details in invalid mask error (#4501) @alexfauquette
107
+ - [pickers] Add explicit interfaces for components slots and components slots props (#4589) @flaviendelangle
108
+ - [pickers] Add missing `peerDependencies` for `yarn pnp` users (#4763) @nate-summercook
109
+ - [pickers] Add overrides to `PickersArrowSwitcher` (#4672) @m4theushw
110
+ - [pickers] Clean component interfaces and remove non-implemented props (#4758) @flaviendelangle
111
+ - [pickers] Do not apply the current time when no date provided in `DayPicker` (#4649) @flaviendelangle
112
+ - [pickers] Document and refacto the value manager (#4701) @flaviendelangle
113
+ - [pickers] Drop `allowSameDateSelection` prop (#4808) @flaviendelangle
114
+ - [pickers] Enable mask by default when using `ampm=true` (#4731) @alexfauquette
115
+ - [pickers] Fix `disabled` and `readOnly` behavior on calendar and clock (#4645) @alexfauquette
116
+ - [pickers] Invalid character does not delete last digit (#4839) @alexfauquette
117
+ - [pickers] Rename prop `date` into `parsedValue` when it can contain a range (#4736) @flaviendelangle
118
+ - [pickers] Rework `TDate`, `TInputDate`, `TValue` and `TInputValue` generics (#4617) @flaviendelangle
119
+ - [pickers] Rework the date lifecycle in `usePickerState` (#4408) @flaviendelangle
120
+
121
+ ### Docs
122
+
123
+ - [docs] Add `scopePathNames` property to column page (#4811) @flaviendelangle
124
+ - [docs] Add label to each demo (#4667) @m4theushw
125
+ - [docs] Correctly capitalize <kbd>Ctrl</kbd> (#4707) @oliviertassinari
126
+ - [docs] Fix documentation on `ampm` prop (#4846) @alexfauquette
127
+ - [docs] Generate the event documentation from `GridEventLookup` (#4725) @flaviendelangle
128
+ - [docs] Keep columns section expanded when switching between pages (#4816) @cherniavskii
129
+ - [docs] Move `useKeepGroupingColumnsHidden` on `@mui/x-data-grid-premium` (#4319) @flaviendelangle
130
+ - [docs] Remove legacy pages for old URLs (#4575) @m4theushw
131
+ - [docs] Remove remaining pages in `docs/pages/api-docs` folder (#4709) @m4theushw
132
+ - [docs] SEO fixes (#4711) @oliviertassinari
133
+ - [docs] Set type number to movie column year (#4753) @flaviendelangle
134
+ - [docs] Simplify server examples (#4186) @alexfauquette
135
+ - [docs] Small typo (#4670) @flaviendelangle
136
+ - [docs] Split the 'Columns' page (#4600) @flaviendelangle
137
+ - [docs] Stop using `GridEvents` enum in documentation (#4699) @flaviendelangle
138
+ - [docs] Update mono repo to get copy code block (#4691) @siriwatknp
139
+ - [docs] Update the feature table in the Getting Started page of the data grid (#4619) @flaviendelangle
140
+ - [docs] Add demo for Premium (#4750) @m4theushw
141
+
142
+ ### Core
143
+
144
+ - [core] Check if `process` is available (#4193) @m4theushw
145
+ - [core] Fix naming collision (#4853) @alexfauquette
146
+ - [core] Prevent out-of-memory when type-checking in CI (#4697) @flaviendelangle
147
+ - [core] Remove `rowsCache` from state (#4480) @m4theushw
148
+ - [core] Rework `DayPicker` api (#4783) @flaviendelangle
149
+ - [core] Update `x-license-pro` license to handle premium package (#4315) @DanailH
150
+ - [core] Update monorepo & version (#4789) @oliviertassinari
151
+ - [core] Update monorepo (#4772) @flaviendelangle
152
+ - [core] Stop using `GridEvents` enum (#4698, #4696, #4685) @flaviendelangle
153
+ - [core] Update monorepo (#4854) @cherniavskii
154
+ - [license] Allow to limit some packages to a specific license plan (#4651) @flaviendelangle
155
+ - [test] Fix path to detect `DataGrid` tests (#4752) @m4theushw
156
+ - [test] Reset cleanup tracking on Karma tests (#4679) @m4theushw
157
+ - [test] Restore `sinon` sandbox after each `karma` test (#4689) @m4theushw
158
+
6
159
  ## v5.10.0
7
160
 
8
161
  _Apr 25, 2022_
@@ -49,7 +202,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
49
202
 
50
203
  Now the data grid and pickers components support the concurrent mode.
51
204
 
52
- - 🎁 Add support for [Column spanning](https://mui.com/x/react-data-grid/columns/#column-spanning) (#4020) @cherniavskii
205
+ - 🎁 Add support for [Column spanning](https://mui.com/x/react-data-grid/column-spanning/) (#4020) @cherniavskii
53
206
 
54
207
  <img src="https://user-images.githubusercontent.com/13808724/162926746-93bcb180-3c9d-4eb9-afc7-c3908a5c6406.png" width="788">
55
208
 
@@ -672,7 +825,7 @@ A big thanks to the 9 contributors who made this release possible. Here are some
672
825
  />
673
826
  ```
674
827
 
675
- See the [documentation](https://mui.com/x/react-data-grid/columns/#column-visibility) for more details.
828
+ See the [documentation](https://mui.com/x/react-data-grid/column-visibility/) for more details.
676
829
 
677
830
  The `hide` property from `GridColDef` still works but has been deprecated.
678
831
 
@@ -828,7 +981,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
828
981
 
829
982
  ### `@mui/x-data-grid@v5.2.0` / `@mui/x-data-grid-pro@v5.2.0`
830
983
 
831
- - πŸš€ Introduce the [column pinning](https://mui.com/x/react-data-grid/columns/#column-pinning) feature (#2946) @m4theushw
984
+ - πŸš€ Introduce the [column pinning](https://mui.com/x/react-data-grid/column-pinning/) feature (#2946) @m4theushw
832
985
 
833
986
  <img src="https://user-images.githubusercontent.com/42154031/145425635-b6314fbe-2f1e-4b73-908f-33ee1fda20c7.gif" width="964" height="657">
834
987
 
@@ -1782,7 +1935,7 @@ A big thanks to the 9 contributors who made this release possible. Here are some
1782
1935
  - πŸ“š Migrate to the new documentation infrastructure and design (#2441) (@DanailH, @m4theushw)
1783
1936
  - 🎁 Add `actions` column type (#2385) @m4theushw
1784
1937
 
1785
- See the documentation for [more details](https://mui.com/x/react-data-grid/columns/#column-types).
1938
+ See the documentation for [more details](https://mui.com/x/react-data-grid/column-definition/#column-types).
1786
1939
 
1787
1940
  - πŸ‘ Allow to disable virtualization with the `disableVirtualization` prop (#2326) @m4theushw
1788
1941
  - πŸš€ Introduce the new `isRowSelected` api method (#2523) @flaviendelangle
@@ -2404,11 +2557,11 @@ _July 1, 2021_
2404
2557
  Big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
2405
2558
 
2406
2559
  - 🐞 As a focus of Q2, we have kept fixing bugs
2407
- - πŸ’… End users are now allowed to copy the selected rows to the clipboard with <kbd>CTRL</kbd> + <kbd>c</kbd> (#1929) @m4theushw
2560
+ - πŸ’… End users are now allowed to copy the selected rows to the clipboard with <kbd>Ctrl</kbd> + <kbd>c</kbd> (#1929) @m4theushw
2408
2561
  - πŸ› We have fixed the `Select all` checkbox. When triggered, it should only select the filtered rows (#1879) @ZeeshanTamboli
2409
2562
  - ⚑️ We have added a new `singleSelect` column type (#1956) @DanailH
2410
2563
 
2411
- Using the column `type: 'singleSelect'` defaults to `Select` component when the cell is in `edit` mode. You can find the documentation [following this link](https://mui.com/x/react-data-grid/columns/#column-types).
2564
+ Using the column `type: 'singleSelect'` defaults to `Select` component when the cell is in `edit` mode. You can find the documentation [following this link](https://mui.com/x/react-data-grid/column-definition/#column-types).
2412
2565
 
2413
2566
  ```jsx
2414
2567
  <DataGrid
@@ -2604,7 +2757,7 @@ _June 9, 2021_
2604
2757
  Big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
2605
2758
 
2606
2759
  - πŸ’… Allow to customize GridToolbarExport's CSV export (#1695) @michallukowski
2607
- - πŸ› Allow to deselect rows with <kbd>CTRL</kbd> + click (#1813) @ZeeshanTamboli
2760
+ - πŸ› Allow to deselect rows with <kbd>Ctrl</kbd> + click (#1813) @ZeeshanTamboli
2608
2761
  - ⚑️ Refactor scroll size detector (#1703) @dtassone
2609
2762
  - πŸ“– Add [documentation](https://mui.com/x/api/data-grid/) for interfaces and events (#1529) @m4theushw
2610
2763
  - 🐞 Bugfixes
@@ -2631,7 +2784,7 @@ Big thanks to the 6 contributors who made this release possible. Here are some h
2631
2784
 
2632
2785
  - [DataGrid] Add `valueParser` to parse values entered by the user (#1785) @m4theushw
2633
2786
  - [DataGrid] Allow to customize GridToolbarExport's CSV export (#1695) @michallukowski
2634
- - [DataGrid] Allow to deselect rows with <kbd>CTRL</kbd> + click (#1813) @ZeeshanTamboli
2787
+ - [DataGrid] Allow to deselect rows with <kbd>Ctrl</kbd> + click (#1813) @ZeeshanTamboli
2635
2788
  - [DataGrid] Improve general architecture to better isolate hooks (#1720) @dtassone
2636
2789
  - [DataGrid] Fix cell height after changing grid density (#1819) @DanailH
2637
2790
  - [DataGrid] Fix fluid columns width when available `viewportWidth` < 0 (#1816) @DanailH
@@ -3153,7 +3306,7 @@ Big thanks to the 8 contributors who made this release possible. Here are some h
3153
3306
  - [DataGrid] Rename `useGridBaseComponentProps` hook to `useGridSlotComponentProps` (#1252) @DanailH
3154
3307
  - [DataGrid] Rename modules (#1292) @DanailH
3155
3308
  - [DataGrid] Rename all events related to column reordering, e.g. `GRID_COL_REORDER_START` -> `GRID_COLUMN_REORDER_START` (#1299) @m4theushw
3156
- - [DataGrid] Methods `onColItemDragStart`, `onColHeaderDragOver`, `onColItemDragOver`, `onColItemDragEnter` removed from the grid API. Prefer listening to [column reordering events](https://mui.com/x/react-data-grid/columns/#column-reorder) (#1299) @m4theushw
3309
+ - [DataGrid] Methods `onColItemDragStart`, `onColHeaderDragOver`, `onColItemDragOver`, `onColItemDragEnter` removed from the grid API. Prefer listening to [column reordering events](https://mui.com/x/react-data-grid/column-ordering/) (#1299) @m4theushw
3157
3310
  - [DataGrid] Calling `apiRef.current.getColumnHeaderParams` returns a `GridColumnHeaderParams` instead of `GridColParams` (#1299) @m4theushw
3158
3311
  - [DataGrid] Events that follow the pattern `GRID_COLUMN_HEADER_xxx` will be called with a `GridColumnHeaderParams` instead of `GridColParams` (#1299) @m4theushw
3159
3312
  - [DataGrid] The `renderHeader` will be called with a `GridColumnHeaderParams` instead of `GridColParams` (#1299) @m4theushw
@@ -3521,7 +3674,7 @@ _Jan 14, 2021_
3521
3674
  Big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
3522
3675
 
3523
3676
  - πŸŽ› Add support for Column selector (#837) @DanailH @dtassone.
3524
- The feature can be triggered from the toolbar or the column menu. Check [the documentation](https://mui.com/x/react-data-grid/columns/#column-selector).
3677
+ The feature can be triggered from the toolbar or the column menu. Check [the documentation](https://mui.com/x/react-data-grid/column-definition/#column-selector).
3525
3678
 
3526
3679
  ![column selector](https://user-images.githubusercontent.com/3165635/104791267-6ff77300-579a-11eb-9338-11a8fde83258.gif)
3527
3680
 
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { DesktopDateRangePickerProps } from '../DesktopDateRangePicker';
3
3
  import { MobileDateRangePickerProps } from '../MobileDateRangePicker';
4
- export interface DateRangePickerProps<TDate> extends DesktopDateRangePickerProps<TDate>, MobileDateRangePickerProps<TDate> {
4
+ export interface DateRangePickerProps<TInputDate, TDate> extends DesktopDateRangePickerProps<TInputDate, TDate>, MobileDateRangePickerProps<TInputDate, TDate> {
5
5
  /**
6
6
  * CSS media query when `Mobile` mode will be changed to `Desktop`.
7
7
  * @default '@media (pointer: fine)'
@@ -9,7 +9,7 @@ export interface DateRangePickerProps<TDate> extends DesktopDateRangePickerProps
9
9
  */
10
10
  desktopModeMediaQuery?: string;
11
11
  }
12
- declare type DateRangePickerComponent = (<TDate>(props: DateRangePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
12
+ declare type DateRangePickerComponent = (<TInputDate, TDate = TInputDate>(props: DateRangePickerProps<TInputDate, TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
13
13
  propTypes?: any;
14
14
  };
15
15
  /**
@@ -71,12 +71,6 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
71
71
  * @default /\dap/gi
72
72
  */
73
73
  acceptRegex: PropTypes.instanceOf(RegExp),
74
-
75
- /**
76
- * If `true`, `onChange` is fired on click even if the same date is selected.
77
- * @default false
78
- */
79
- allowSameDateSelection: PropTypes.bool,
80
74
  autoFocus: PropTypes.bool,
81
75
 
82
76
  /**
@@ -109,6 +103,12 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
109
103
  */
110
104
  clearText: PropTypes.node,
111
105
 
106
+ /**
107
+ * If `true` the popup or dialog will immediately close after submitting full date.
108
+ * @default `true` for Desktop, `false` for Mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
109
+ */
110
+ closeOnSelect: PropTypes.bool,
111
+
112
112
  /**
113
113
  * The components used for each slot.
114
114
  * Either a string to use an HTML element or a component.
@@ -145,12 +145,6 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
145
145
  */
146
146
  disableAutoMonthSwitching: PropTypes.bool,
147
147
 
148
- /**
149
- * If `true` the popup or dialog will immediately close after submitting full date.
150
- * @default `true` for Desktop, `false` for Mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
151
- */
152
- disableCloseOnSelect: PropTypes.bool,
153
-
154
148
  /**
155
149
  * If `true`, the picker and text field are disabled.
156
150
  * @default false
@@ -193,11 +187,11 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
193
187
 
194
188
  /**
195
189
  * Get aria-label text for control that opens picker dialog. Aria-label text must include selected date. @DateIOType
196
- * @template TDateValue
197
- * @param {ParseableDate<TDateValue>} value The date from which we want to add an aria-text.
198
- * @param {MuiPickersAdapter<TDateValue>} utils The utils to manipulate the date.
190
+ * @template TInputDate, TDate
191
+ * @param {TInputDate} date The date from which we want to add an aria-text.
192
+ * @param {MuiPickersAdapter<TDate>} utils The utils to manipulate the date.
199
193
  * @returns {string} The aria-text to render inside the dialog.
200
- * @default (value, utils) => `Choose date, selected date is ${utils.format(utils.date(value), 'fullDate')}`
194
+ * @default (date, utils) => `Choose date, selected date is ${utils.format(utils.date(date), 'fullDate')}`
201
195
  */
202
196
  getOpenDialogAriaText: PropTypes.func,
203
197
 
@@ -248,13 +242,11 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
248
242
 
249
243
  /**
250
244
  * Max selectable date. @DateIOType
251
- * @default defaultMaxDate
252
245
  */
253
246
  maxDate: PropTypes.any,
254
247
 
255
248
  /**
256
249
  * Min selectable date. @DateIOType
257
- * @default defaultMinDate
258
250
  */
259
251
  minDate: PropTypes.any,
260
252
 
@@ -266,8 +258,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
266
258
 
267
259
  /**
268
260
  * Callback fired when date is accepted @DateIOType.
269
- * @template TDateValue
270
- * @param {TDateValue} date The date that was just accepted.
261
+ * @template TValue
262
+ * @param {TValue} value The value that was just accepted.
271
263
  */
272
264
  onAccept: PropTypes.func,
273
265
 
@@ -293,16 +285,17 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
293
285
  * [Read the guide](https://next.material-ui-pickers.dev/guides/forms) about form integration and error displaying.
294
286
  * @DateIOType
295
287
  *
296
- * @template TError, TDateValue
288
+ * @template TError, TInputValue
297
289
  * @param {TError} reason The reason why the current value is not valid.
298
- * @param {TDateValue} value The invalid value.
290
+ * @param {TInputValue} value The invalid value.
299
291
  */
300
292
  onError: PropTypes.func,
301
293
 
302
294
  /**
303
- * Callback firing on month change. @DateIOType
295
+ * Callback firing on month change @DateIOType.
304
296
  * @template TDate
305
- * @param {TDate} month The new month.
297
+ * @param {TDate} month The new year.
298
+ * @returns {void|Promise} -
306
299
  */
307
300
  onMonthChange: PropTypes.func,
308
301
 
@@ -328,11 +321,6 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
328
321
  */
329
322
  OpenPickerButtonProps: PropTypes.object,
330
323
 
331
- /**
332
- * Force rendering in particular orientation.
333
- */
334
- orientation: PropTypes.oneOf(['landscape', 'portrait']),
335
-
336
324
  /**
337
325
  * Paper props passed down to [Paper](https://mui.com/material-ui/api/paper/) component.
338
326
  */
@@ -415,6 +403,15 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
415
403
  */
416
404
  shouldDisableDate: PropTypes.func,
417
405
 
406
+ /**
407
+ * Disable specific months dynamically.
408
+ * Works like `shouldDisableDate` but for month selection view @DateIOType.
409
+ * @template TDate
410
+ * @param {TDate} month The month to check.
411
+ * @returns {boolean} If `true` the month will be disabled.
412
+ */
413
+ shouldDisableMonth: PropTypes.func,
414
+
418
415
  /**
419
416
  * Disable specific years dynamically.
420
417
  * Works like `shouldDisableDate` but for year selection view @DateIOType.
@@ -453,22 +450,11 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
453
450
  */
454
451
  todayText: PropTypes.node,
455
452
 
456
- /**
457
- * Component that will replace default toolbar renderer.
458
- */
459
- ToolbarComponent: PropTypes.elementType,
460
-
461
453
  /**
462
454
  * Date format, that is displaying in toolbar.
463
455
  */
464
456
  toolbarFormat: PropTypes.string,
465
457
 
466
- /**
467
- * Mobile picker date value placeholder, displaying if `value` === `null`.
468
- * @default '–'
469
- */
470
- toolbarPlaceholder: PropTypes.node,
471
-
472
458
  /**
473
459
  * Mobile picker title, displaying in the toolbar.
474
460
  * @default 'Select date range'
@@ -481,7 +467,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
481
467
  TransitionComponent: PropTypes.elementType,
482
468
 
483
469
  /**
484
- * The value of the date range picker.
470
+ * The value of the picker.
485
471
  */
486
- value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.any, PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])).isRequired
472
+ value: PropTypes.arrayOf(PropTypes.any).isRequired
487
473
  } : void 0;
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { DateInputProps, ExportedDateInputProps, MuiTextFieldProps } from '@mui/x-date-pickers/internals';
3
- import { RangeInput, DateRange, CurrentlySelectingRangeEndProps } from '../internal/models/dateRange';
3
+ import { CurrentlySelectingRangeEndProps, DateRange } from '../internal/models/dateRange';
4
4
  import { DateRangeValidationError } from '../internal/hooks/validation/useDateRangeValidation';
5
- export interface ExportedDateRangePickerInputProps extends Omit<ExportedDateInputProps<RangeInput<any>, DateRange<any>>, 'renderInput'> {
5
+ export interface ExportedDateRangePickerInputProps<TInputDate, TDate> extends Omit<ExportedDateInputProps<TInputDate, TDate>, 'renderInput'> {
6
6
  /**
7
7
  * The `renderInput` prop allows you to customize the rendered input.
8
8
  * The `startProps` and `endProps` arguments of this render prop contains props of [TextField](https://mui.com/material-ui/api/text-field/#props),
@@ -25,13 +25,17 @@ export interface ExportedDateRangePickerInputProps extends Omit<ExportedDateInpu
25
25
  * @returns {React.ReactElement} The range input to render.
26
26
  */
27
27
  renderInput: (startProps: MuiTextFieldProps, endProps: MuiTextFieldProps) => React.ReactElement;
28
+ onChange: (date: DateRange<TDate>, keyboardInputValue?: string) => void;
28
29
  }
29
- export interface DateRangeInputProps extends ExportedDateRangePickerInputProps, CurrentlySelectingRangeEndProps, Omit<DateInputProps<RangeInput<any>, DateRange<any>>, 'validationError' | 'renderInput'> {
30
+ export interface DateRangeInputProps<TInputDate, TDate> extends ExportedDateRangePickerInputProps<TInputDate, TDate>, Omit<DateInputProps<TInputDate, TDate>, keyof ExportedDateRangePickerInputProps<TInputDate, TDate> | 'rawValue' | 'validationError'>, CurrentlySelectingRangeEndProps {
30
31
  startText: React.ReactNode;
31
32
  endText: React.ReactNode;
32
33
  validationError: DateRangeValidationError;
34
+ rawValue: DateRange<TInputDate>;
33
35
  }
36
+ declare type DatePickerInputComponent = <TInputDate, TDate>(props: DateRangeInputProps<TInputDate, TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element;
34
37
  /**
35
38
  * @ignore - internal component.
36
39
  */
37
- export declare const DateRangePickerInput: React.ForwardRefExoticComponent<DateRangeInputProps & React.RefAttributes<HTMLDivElement>>;
40
+ export declare const DateRangePickerInput: DatePickerInputComponent;
41
+ export {};
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["currentlySelectingRangeEnd", "disableOpenPicker", "endText", "onBlur", "onChange", "open", "openPicker", "rawValue", "rawValue", "readOnly", "renderInput", "setCurrentlySelectingRangeEnd", "startText", "TextFieldProps", "validationError"];
4
4
  import * as React from 'react';
5
5
  import { styled } from '@mui/material/styles';
6
- import { useUtils, executeInTheNextEventLoopTick, WrapperVariantContext, useMaskedInput } from '@mui/x-date-pickers/internals';
6
+ import { useUtils, executeInTheNextEventLoopTick, useMaskedInput, onSpaceOrEnter } from '@mui/x-date-pickers/internals';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const DateRangePickerInputRoot = styled('div')(({
9
9
  theme
@@ -41,7 +41,6 @@ export const DateRangePickerInput = /*#__PURE__*/React.forwardRef(function DateR
41
41
  const utils = useUtils();
42
42
  const startRef = React.useRef(null);
43
43
  const endRef = React.useRef(null);
44
- const wrapperVariant = React.useContext(WrapperVariantContext);
45
44
  React.useEffect(() => {
46
45
  if (!open) {
47
46
  return;
@@ -89,7 +88,18 @@ export const DateRangePickerInput = /*#__PURE__*/React.forwardRef(function DateR
89
88
  }
90
89
  };
91
90
 
92
- const openOnFocus = wrapperVariant === 'desktop';
91
+ const focusOnRangeEnd = () => {
92
+ if (open && setCurrentlySelectingRangeEnd) {
93
+ setCurrentlySelectingRangeEnd('end');
94
+ }
95
+ };
96
+
97
+ const focusOnRangeStart = () => {
98
+ if (open && setCurrentlySelectingRangeEnd) {
99
+ setCurrentlySelectingRangeEnd('start');
100
+ }
101
+ };
102
+
93
103
  const startInputProps = useMaskedInput(_extends({}, other, {
94
104
  readOnly,
95
105
  rawValue: start,
@@ -101,8 +111,9 @@ export const DateRangePickerInput = /*#__PURE__*/React.forwardRef(function DateR
101
111
  focused: open && currentlySelectingRangeEnd === 'start'
102
112
  }),
103
113
  inputProps: {
104
- onClick: !openOnFocus ? openRangeStartSelection : undefined,
105
- onFocus: openOnFocus ? openRangeStartSelection : undefined
114
+ onClick: openRangeStartSelection,
115
+ onKeyDown: onSpaceOrEnter(openRangeStartSelection),
116
+ onFocus: focusOnRangeStart
106
117
  }
107
118
  }));
108
119
  const endInputProps = useMaskedInput(_extends({}, other, {
@@ -116,8 +127,9 @@ export const DateRangePickerInput = /*#__PURE__*/React.forwardRef(function DateR
116
127
  focused: open && currentlySelectingRangeEnd === 'end'
117
128
  }),
118
129
  inputProps: {
119
- onClick: !openOnFocus ? openRangeEndSelection : undefined,
120
- onFocus: openOnFocus ? openRangeEndSelection : undefined
130
+ onClick: openRangeEndSelection,
131
+ onKeyDown: onSpaceOrEnter(openRangeEndSelection),
132
+ onFocus: focusOnRangeEnd
121
133
  }
122
134
  }));
123
135
  return /*#__PURE__*/_jsx(DateRangePickerInputRoot, {
@@ -1,13 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import { BaseToolbarProps } from '@mui/x-date-pickers/internals';
3
3
  import { DateRange, CurrentlySelectingRangeEndProps } from '../internal/models';
4
- interface DateRangePickerToolbarProps<TDate> extends CurrentlySelectingRangeEndProps, Pick<BaseToolbarProps<TDate>, 'isMobileKeyboardViewOpen' | 'toggleMobileKeyboardView' | 'toolbarTitle' | 'toolbarFormat'> {
5
- date: DateRange<TDate>;
4
+ interface DateRangePickerToolbarProps<TDate> extends CurrentlySelectingRangeEndProps, Pick<BaseToolbarProps<TDate, DateRange<TDate>>, 'isMobileKeyboardViewOpen' | 'toggleMobileKeyboardView' | 'toolbarTitle' | 'toolbarFormat' | 'parsedValue'> {
6
5
  startText: React.ReactNode;
7
6
  endText: React.ReactNode;
8
7
  }
9
8
  /**
10
9
  * @ignore - internal component.
11
10
  */
12
- export declare const DateRangePickerToolbar: <TDate extends unknown>({ currentlySelectingRangeEnd, date: [start, end], endText, isMobileKeyboardViewOpen, setCurrentlySelectingRangeEnd, startText, toggleMobileKeyboardView, toolbarFormat, toolbarTitle, }: DateRangePickerToolbarProps<TDate>) => JSX.Element;
11
+ export declare const DateRangePickerToolbar: <TDate extends unknown>({ currentlySelectingRangeEnd, parsedValue: [start, end], endText, isMobileKeyboardViewOpen, setCurrentlySelectingRangeEnd, startText, toggleMobileKeyboardView, toolbarFormat, toolbarTitle, }: DateRangePickerToolbarProps<TDate>) => JSX.Element;
13
12
  export {};
@@ -21,7 +21,7 @@ const DateRangePickerToolbarContainer = styled('div')({
21
21
 
22
22
  export const DateRangePickerToolbar = ({
23
23
  currentlySelectingRangeEnd,
24
- date: [start, end],
24
+ parsedValue: [start, end],
25
25
  endText,
26
26
  isMobileKeyboardViewOpen,
27
27
  setCurrentlySelectingRangeEnd,
@@ -1,10 +1,25 @@
1
1
  import * as React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { BasePickerProps, WrapperVariant, PickerSelectionState, ExportedCalendarPickerProps } from '@mui/x-date-pickers/internals';
4
- import { DateRange, CurrentlySelectingRangeEndProps, RangeInput } from '../internal/models/dateRange';
2
+ import { ExportedCalendarPickerProps, PickerStatePickerProps } from '@mui/x-date-pickers/internals';
3
+ import { DateRange, CurrentlySelectingRangeEndProps } from '../internal/models/dateRange';
4
+ import { DateRangePickerViewMobileSlotsComponent, DateRangePickerViewMobileSlotsComponentsProps } from './DateRangePickerViewMobile';
5
5
  import { DateRangeInputProps } from './DateRangePickerInput';
6
6
  import { ExportedDesktopDateRangeCalendarProps } from './DateRangePickerViewDesktop';
7
- export interface ExportedDateRangePickerViewProps<TDate> extends ExportedDesktopDateRangeCalendarProps<TDate>, Omit<ExportedCalendarPickerProps<TDate>, 'onYearChange' | 'renderDay'>, Omit<BasePickerProps<RangeInput<TDate>, DateRange<TDate>>, 'value' | 'onChange'> {
7
+ export interface DateRangePickerViewSlotsComponent extends DateRangePickerViewMobileSlotsComponent {
8
+ }
9
+ export interface DateRangePickerViewSlotsComponentsProps extends DateRangePickerViewMobileSlotsComponentsProps {
10
+ }
11
+ export interface ExportedDateRangePickerViewProps<TDate> extends ExportedDesktopDateRangeCalendarProps<TDate>, Omit<ExportedCalendarPickerProps<TDate>, 'onYearChange' | 'renderDay'> {
12
+ /**
13
+ * The components used for each slot.
14
+ * Either a string to use an HTML element or a component.
15
+ * @default {}
16
+ */
17
+ components?: Partial<DateRangePickerViewSlotsComponent>;
18
+ /**
19
+ * The props used for each slot inside.
20
+ * @default {}
21
+ */
22
+ componentsProps?: Partial<DateRangePickerViewSlotsComponentsProps>;
8
23
  /**
9
24
  * If `true`, after selecting `start` date calendar will not automatically switch to the month of `end` date.
10
25
  * @default false
@@ -15,26 +30,28 @@ export interface ExportedDateRangePickerViewProps<TDate> extends ExportedDesktop
15
30
  * @default 'Select date range'
16
31
  */
17
32
  toolbarTitle?: React.ReactNode;
33
+ /**
34
+ * Date format, that is displaying in toolbar.
35
+ */
36
+ toolbarFormat?: string;
37
+ /**
38
+ * If `true`, show the toolbar even in desktop mode.
39
+ */
40
+ showToolbar?: boolean;
41
+ /**
42
+ * className applied to the root component.
43
+ */
44
+ className?: string;
18
45
  }
19
- interface DateRangePickerViewProps<TDate> extends CurrentlySelectingRangeEndProps, ExportedDateRangePickerViewProps<TDate> {
46
+ interface DateRangePickerViewProps<TInputDate, TDate> extends CurrentlySelectingRangeEndProps, ExportedDateRangePickerViewProps<TDate>, PickerStatePickerProps<DateRange<TDate>> {
20
47
  calendars: 1 | 2 | 3;
21
48
  open: boolean;
22
49
  startText: React.ReactNode;
23
50
  endText: React.ReactNode;
24
- isMobileKeyboardViewOpen: boolean;
25
- toggleMobileKeyboardView: () => void;
26
- DateInputProps: DateRangeInputProps;
27
- date: DateRange<TDate>;
28
- onDateChange: (date: DateRange<TDate>, currentWrapperVariant: WrapperVariant, isFinish?: PickerSelectionState) => void;
29
- }
30
- /**
31
- * @ignore - internal component.
32
- */
33
- export declare function DateRangePickerView<TDate>(props: DateRangePickerViewProps<TDate>): JSX.Element;
34
- export declare namespace DateRangePickerView {
35
- var propTypes: {
36
- calendars: PropTypes.Requireable<number>;
37
- disableAutoMonthSwitching: PropTypes.Requireable<boolean>;
38
- };
51
+ DateInputProps: DateRangeInputProps<TInputDate, TDate>;
39
52
  }
53
+ declare type DateRangePickerViewComponent = (<TInputDate, TDate = TInputDate>(props: DateRangePickerViewProps<TInputDate, TDate>) => JSX.Element) & {
54
+ propTypes?: any;
55
+ };
56
+ export declare const DateRangePickerView: DateRangePickerViewComponent;
40
57
  export {};