@mui/x-date-pickers-pro 5.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/CHANGELOG.md +3785 -0
  2. package/DateRangePicker/DateRangePicker.d.ts +66 -0
  3. package/DateRangePicker/DateRangePicker.js +519 -0
  4. package/DateRangePicker/DateRangePickerInput.d.ts +37 -0
  5. package/DateRangePicker/DateRangePickerInput.js +128 -0
  6. package/DateRangePicker/DateRangePickerToolbar.d.ts +15 -0
  7. package/DateRangePicker/DateRangePickerToolbar.js +59 -0
  8. package/DateRangePicker/DateRangePickerView.d.ts +41 -0
  9. package/DateRangePicker/DateRangePickerView.js +179 -0
  10. package/DateRangePicker/DateRangePickerViewDesktop.d.ts +30 -0
  11. package/DateRangePicker/DateRangePickerViewDesktop.js +154 -0
  12. package/DateRangePicker/DateRangePickerViewMobile.d.ts +15 -0
  13. package/DateRangePicker/DateRangePickerViewMobile.js +60 -0
  14. package/DateRangePicker/date-range-manager.d.ts +14 -0
  15. package/DateRangePicker/date-range-manager.js +43 -0
  16. package/DateRangePicker/index.d.ts +3 -0
  17. package/DateRangePicker/index.js +1 -0
  18. package/DateRangePicker/package.json +6 -0
  19. package/DateRangePickerDay/DateRangePickerDay.d.ts +52 -0
  20. package/DateRangePickerDay/DateRangePickerDay.js +290 -0
  21. package/DateRangePickerDay/dateRangePickerDayClasses.d.ts +29 -0
  22. package/DateRangePickerDay/dateRangePickerDayClasses.js +5 -0
  23. package/DateRangePickerDay/index.d.ts +4 -0
  24. package/DateRangePickerDay/index.js +2 -0
  25. package/DateRangePickerDay/package.json +6 -0
  26. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +66 -0
  27. package/DesktopDateRangePicker/DesktopDateRangePicker.js +485 -0
  28. package/DesktopDateRangePicker/index.d.ts +2 -0
  29. package/DesktopDateRangePicker/index.js +1 -0
  30. package/DesktopDateRangePicker/package.json +6 -0
  31. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +66 -0
  32. package/MobileDateRangePicker/MobileDateRangePicker.js +495 -0
  33. package/MobileDateRangePicker/index.d.ts +2 -0
  34. package/MobileDateRangePicker/index.js +1 -0
  35. package/MobileDateRangePicker/package.json +6 -0
  36. package/README.md +29 -0
  37. package/StaticDateRangePicker/StaticDateRangePicker.d.ts +69 -0
  38. package/StaticDateRangePicker/StaticDateRangePicker.js +455 -0
  39. package/StaticDateRangePicker/index.d.ts +2 -0
  40. package/StaticDateRangePicker/index.js +1 -0
  41. package/StaticDateRangePicker/package.json +6 -0
  42. package/index.d.ts +7 -0
  43. package/index.js +12 -0
  44. package/internal/hooks/validation/useDateRangeValidation.d.ts +12 -0
  45. package/internal/hooks/validation/useDateRangeValidation.js +27 -0
  46. package/internal/models/dateRange.d.ts +8 -0
  47. package/internal/models/dateRange.js +1 -0
  48. package/internal/models/index.d.ts +1 -0
  49. package/internal/models/index.js +1 -0
  50. package/internal/utils/date-utils.d.ts +7 -0
  51. package/internal/utils/date-utils.js +19 -0
  52. package/internal/utils/releaseInfo.d.ts +1 -0
  53. package/internal/utils/releaseInfo.js +15 -0
  54. package/internal/utils/utils.d.ts +1 -0
  55. package/internal/utils/utils.js +1 -0
  56. package/legacy/DateRangePicker/DateRangePicker.js +528 -0
  57. package/legacy/DateRangePicker/DateRangePickerInput.js +141 -0
  58. package/legacy/DateRangePicker/DateRangePickerToolbar.js +66 -0
  59. package/legacy/DateRangePicker/DateRangePickerView.js +184 -0
  60. package/legacy/DateRangePicker/DateRangePickerViewDesktop.js +172 -0
  61. package/legacy/DateRangePicker/DateRangePickerViewMobile.js +63 -0
  62. package/legacy/DateRangePicker/date-range-manager.js +51 -0
  63. package/legacy/DateRangePicker/index.js +1 -0
  64. package/legacy/DateRangePickerDay/DateRangePickerDay.js +296 -0
  65. package/legacy/DateRangePickerDay/dateRangePickerDayClasses.js +5 -0
  66. package/legacy/DateRangePickerDay/index.js +2 -0
  67. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +494 -0
  68. package/legacy/DesktopDateRangePicker/index.js +1 -0
  69. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +504 -0
  70. package/legacy/MobileDateRangePicker/index.js +1 -0
  71. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +465 -0
  72. package/legacy/StaticDateRangePicker/index.js +1 -0
  73. package/legacy/index.js +12 -0
  74. package/legacy/internal/hooks/validation/useDateRangeValidation.js +33 -0
  75. package/legacy/internal/models/dateRange.js +1 -0
  76. package/legacy/internal/models/index.js +1 -0
  77. package/legacy/internal/utils/date-utils.js +22 -0
  78. package/legacy/internal/utils/releaseInfo.js +15 -0
  79. package/legacy/internal/utils/utils.js +1 -0
  80. package/legacy/themeAugmentation/index.js +3 -0
  81. package/modern/DateRangePicker/DateRangePicker.js +519 -0
  82. package/modern/DateRangePicker/DateRangePickerInput.js +124 -0
  83. package/modern/DateRangePicker/DateRangePickerToolbar.js +59 -0
  84. package/modern/DateRangePicker/DateRangePickerView.js +179 -0
  85. package/modern/DateRangePicker/DateRangePickerViewDesktop.js +154 -0
  86. package/modern/DateRangePicker/DateRangePickerViewMobile.js +60 -0
  87. package/modern/DateRangePicker/date-range-manager.js +43 -0
  88. package/modern/DateRangePicker/index.js +1 -0
  89. package/modern/DateRangePickerDay/DateRangePickerDay.js +290 -0
  90. package/modern/DateRangePickerDay/dateRangePickerDayClasses.js +5 -0
  91. package/modern/DateRangePickerDay/index.js +2 -0
  92. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +485 -0
  93. package/modern/DesktopDateRangePicker/index.js +1 -0
  94. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +495 -0
  95. package/modern/MobileDateRangePicker/index.js +1 -0
  96. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +455 -0
  97. package/modern/StaticDateRangePicker/index.js +1 -0
  98. package/modern/index.js +12 -0
  99. package/modern/internal/hooks/validation/useDateRangeValidation.js +27 -0
  100. package/modern/internal/models/dateRange.js +1 -0
  101. package/modern/internal/models/index.js +1 -0
  102. package/modern/internal/utils/date-utils.js +19 -0
  103. package/modern/internal/utils/releaseInfo.js +15 -0
  104. package/modern/internal/utils/utils.js +1 -0
  105. package/modern/themeAugmentation/index.js +3 -0
  106. package/node/DateRangePicker/DateRangePicker.js +540 -0
  107. package/node/DateRangePicker/DateRangePickerInput.js +148 -0
  108. package/node/DateRangePicker/DateRangePickerToolbar.js +79 -0
  109. package/node/DateRangePicker/DateRangePickerView.js +206 -0
  110. package/node/DateRangePicker/DateRangePickerViewDesktop.js +175 -0
  111. package/node/DateRangePicker/DateRangePickerViewMobile.js +80 -0
  112. package/node/DateRangePicker/date-range-manager.js +52 -0
  113. package/node/DateRangePicker/index.js +13 -0
  114. package/node/DateRangePickerDay/DateRangePickerDay.js +315 -0
  115. package/node/DateRangePickerDay/dateRangePickerDayClasses.js +16 -0
  116. package/node/DateRangePickerDay/index.js +27 -0
  117. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +506 -0
  118. package/node/DesktopDateRangePicker/index.js +13 -0
  119. package/node/MobileDateRangePicker/MobileDateRangePicker.js +516 -0
  120. package/node/MobileDateRangePicker/index.js +13 -0
  121. package/node/StaticDateRangePicker/StaticDateRangePicker.js +475 -0
  122. package/node/StaticDateRangePicker/index.js +13 -0
  123. package/node/index.js +105 -0
  124. package/node/internal/hooks/validation/useDateRangeValidation.js +40 -0
  125. package/node/internal/models/dateRange.js +5 -0
  126. package/node/internal/models/index.js +18 -0
  127. package/node/internal/utils/date-utils.js +40 -0
  128. package/node/internal/utils/releaseInfo.js +25 -0
  129. package/node/internal/utils/utils.js +10 -0
  130. package/node/themeAugmentation/index.js +44 -0
  131. package/package.json +77 -0
  132. package/themeAugmentation/components.d.ts +13 -0
  133. package/themeAugmentation/index.d.ts +3 -0
  134. package/themeAugmentation/index.js +3 -0
  135. package/themeAugmentation/overrides.d.ts +13 -0
  136. package/themeAugmentation/package.json +6 -0
  137. package/themeAugmentation/props.d.ts +12 -0
@@ -0,0 +1,495 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["calendars", "value", "onChange", "mask", "startText", "endText", "inputFormat", "minDate", "maxDate"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { useLicenseVerifier } from '@mui/x-license-pro';
7
+ import { useThemeProps } from '@mui/material/styles';
8
+ import { MobileWrapper, useDefaultDates, useUtils, usePickerState } from '@mui/x-date-pickers/internals';
9
+ import { useDateRangeValidation } from '../internal/hooks/validation/useDateRangeValidation';
10
+ import { DateRangePickerView } from '../DateRangePicker/DateRangePickerView';
11
+ import { DateRangePickerInput } from '../DateRangePicker/DateRangePickerInput';
12
+ import { parseRangeInputValue } from '../internal/utils/date-utils';
13
+ import { getReleaseInfo } from '../internal/utils/releaseInfo';
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ const releaseInfo = getReleaseInfo();
16
+ const PureDateInputComponent = DateRangePickerInput;
17
+ const rangePickerValueManager = {
18
+ emptyValue: [null, null],
19
+ parseInput: parseRangeInputValue,
20
+ areValuesEqual: (utils, a, b) => utils.isEqual(a[0], b[0]) && utils.isEqual(a[1], b[1])
21
+ };
22
+
23
+ /**
24
+ *
25
+ * Demos:
26
+ *
27
+ * - [Date Range Picker](https://mui.com/components/x/react-date-pickers/date-range-picker/)
28
+ *
29
+ * API:
30
+ *
31
+ * - [MobileDateRangePicker API](https://mui.com/api/mobile-date-range-picker/)
32
+ */
33
+ export const MobileDateRangePicker = /*#__PURE__*/React.forwardRef(function MobileDateRangePicker(inProps, ref) {
34
+ const props = useThemeProps({
35
+ props: inProps,
36
+ name: 'MuiMobileDateRangePicker'
37
+ });
38
+ useLicenseVerifier('x-date-pickers-pro', releaseInfo);
39
+
40
+ const {
41
+ calendars = 2,
42
+ value,
43
+ onChange,
44
+ mask = '__/__/____',
45
+ startText = 'Start',
46
+ endText = 'End',
47
+ inputFormat: passedInputFormat,
48
+ minDate: minDateProp,
49
+ maxDate: maxDateProp
50
+ } = props,
51
+ other = _objectWithoutPropertiesLoose(props, _excluded);
52
+
53
+ const utils = useUtils();
54
+ const defaultDates = useDefaultDates();
55
+ const minDate = minDateProp != null ? minDateProp : defaultDates.minDate;
56
+ const maxDate = maxDateProp != null ? maxDateProp : defaultDates.maxDate;
57
+ const [currentlySelectingRangeEnd, setCurrentlySelectingRangeEnd] = React.useState('start');
58
+
59
+ const pickerStateProps = _extends({}, other, {
60
+ value,
61
+ onChange
62
+ });
63
+
64
+ const restProps = _extends({}, other, {
65
+ minDate,
66
+ maxDate
67
+ });
68
+
69
+ const {
70
+ pickerProps,
71
+ inputProps,
72
+ wrapperProps
73
+ } = usePickerState(pickerStateProps, rangePickerValueManager);
74
+ const validationError = useDateRangeValidation(props);
75
+
76
+ const DateInputProps = _extends({}, inputProps, restProps, {
77
+ currentlySelectingRangeEnd,
78
+ inputFormat: passedInputFormat || utils.formats.keyboardDate,
79
+ setCurrentlySelectingRangeEnd,
80
+ startText,
81
+ endText,
82
+ mask,
83
+ validationError,
84
+ ref
85
+ });
86
+
87
+ return /*#__PURE__*/_jsx(MobileWrapper, _extends({}, restProps, wrapperProps, {
88
+ DateInputProps: DateInputProps,
89
+ PureDateInputComponent: PureDateInputComponent,
90
+ children: /*#__PURE__*/_jsx(DateRangePickerView, _extends({
91
+ open: wrapperProps.open,
92
+ DateInputProps: DateInputProps,
93
+ calendars: calendars,
94
+ currentlySelectingRangeEnd: currentlySelectingRangeEnd,
95
+ setCurrentlySelectingRangeEnd: setCurrentlySelectingRangeEnd,
96
+ startText: startText,
97
+ endText: endText
98
+ }, pickerProps, restProps))
99
+ }));
100
+ });
101
+ process.env.NODE_ENV !== "production" ? MobileDateRangePicker.propTypes = {
102
+ // ----------------------------- Warning --------------------------------
103
+ // | These PropTypes are generated from the TypeScript type definitions |
104
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
105
+ // ----------------------------------------------------------------------
106
+
107
+ /**
108
+ * Regular expression to detect "accepted" symbols.
109
+ * @default /\dap/gi
110
+ */
111
+ acceptRegex: PropTypes.instanceOf(RegExp),
112
+
113
+ /**
114
+ * If `true`, `onChange` is fired on click even if the same date is selected.
115
+ * @default false
116
+ */
117
+ allowSameDateSelection: PropTypes.bool,
118
+ autoFocus: PropTypes.bool,
119
+
120
+ /**
121
+ * The number of calendars that render on **desktop**.
122
+ * @default 2
123
+ */
124
+ calendars: PropTypes.oneOf([1, 2, 3]),
125
+
126
+ /**
127
+ * Cancel text message.
128
+ * @default 'Cancel'
129
+ */
130
+ cancelText: PropTypes.node,
131
+ children: PropTypes.node,
132
+
133
+ /**
134
+ * className applied to the root component.
135
+ */
136
+ className: PropTypes.string,
137
+
138
+ /**
139
+ * If `true`, it shows the clear action in the picker dialog.
140
+ * @default false
141
+ */
142
+ clearable: PropTypes.bool,
143
+
144
+ /**
145
+ * Clear text message.
146
+ * @default 'Clear'
147
+ */
148
+ clearText: PropTypes.node,
149
+
150
+ /**
151
+ * The components used for each slot.
152
+ * Either a string to use a HTML element or a component.
153
+ * @default {}
154
+ */
155
+ components: PropTypes.object,
156
+
157
+ /**
158
+ * The props used for each slot inside.
159
+ * @default {}
160
+ */
161
+ componentsProps: PropTypes.object,
162
+
163
+ /**
164
+ * Default calendar month displayed when `value={null}`.
165
+ */
166
+ defaultCalendarMonth: PropTypes.any,
167
+
168
+ /**
169
+ * Props applied to the [`Dialog`](/api/dialog/) element.
170
+ */
171
+ DialogProps: PropTypes.object,
172
+
173
+ /**
174
+ * If `true`, after selecting `start` date calendar will not automatically switch to the month of `end` date.
175
+ * @default false
176
+ */
177
+ disableAutoMonthSwitching: PropTypes.bool,
178
+
179
+ /**
180
+ * If `true` the popup or dialog will immediately close after submitting full date.
181
+ * @default `true` for Desktop, `false` for Mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
182
+ */
183
+ disableCloseOnSelect: PropTypes.bool,
184
+
185
+ /**
186
+ * If `true`, the picker and text field are disabled.
187
+ * @default false
188
+ */
189
+ disabled: PropTypes.bool,
190
+
191
+ /**
192
+ * @default false
193
+ */
194
+ disableFuture: PropTypes.bool,
195
+
196
+ /**
197
+ * If `true`, todays date is rendering without highlighting with circle.
198
+ * @default false
199
+ */
200
+ disableHighlightToday: PropTypes.bool,
201
+
202
+ /**
203
+ * Disable mask on the keyboard, this should be used rarely. Consider passing proper mask for your format.
204
+ * @default false
205
+ */
206
+ disableMaskedInput: PropTypes.bool,
207
+
208
+ /**
209
+ * Do not render open picker button (renders only text field with validation).
210
+ * @default false
211
+ */
212
+ disableOpenPicker: PropTypes.bool,
213
+
214
+ /**
215
+ * @default false
216
+ */
217
+ disablePast: PropTypes.bool,
218
+
219
+ /**
220
+ * Text for end input label and toolbar placeholder.
221
+ * @default 'End'
222
+ */
223
+ endText: PropTypes.node,
224
+
225
+ /**
226
+ * Get aria-label text for control that opens picker dialog. Aria-label text must include selected date. @DateIOType
227
+ * @default (value, utils) => `Choose date, selected date is ${utils.format(utils.date(value), 'fullDate')}`
228
+ * @param {ParseableDate<TDateValue>} value The date from which we want to add an aria-text.
229
+ * @param {MuiPickersAdapter<TDateValue>} utils The utils to manipulate the date.
230
+ * @returns {string} The aria-text to render inside the dialog.
231
+ */
232
+ getOpenDialogAriaText: PropTypes.func,
233
+
234
+ /**
235
+ * Get aria-label text for switching between views button.
236
+ * @param {CalendarPickerView} currentView The view from which we want to get the button text.
237
+ * @returns {string} The label of the view.
238
+ */
239
+ getViewSwitchingButtonText: PropTypes.func,
240
+ ignoreInvalidInputs: PropTypes.bool,
241
+
242
+ /**
243
+ * Props to pass to keyboard input adornment.
244
+ */
245
+ InputAdornmentProps: PropTypes.object,
246
+
247
+ /**
248
+ * Format string.
249
+ */
250
+ inputFormat: PropTypes.string,
251
+ InputProps: PropTypes.object,
252
+
253
+ /**
254
+ * Pass a ref to the `input` element.
255
+ */
256
+ inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
257
+ current: PropTypes.object
258
+ })]),
259
+ label: PropTypes.node,
260
+
261
+ /**
262
+ * Left arrow icon aria-label text.
263
+ */
264
+ leftArrowButtonText: PropTypes.string,
265
+
266
+ /**
267
+ * If `true` renders `LoadingComponent` in calendar instead of calendar view.
268
+ * Can be used to preload information and show it in calendar.
269
+ * @default false
270
+ */
271
+ loading: PropTypes.bool,
272
+
273
+ /**
274
+ * Custom mask. Can be used to override generate from format. (e.g. `__/__/____ __:__` or `__/__/____ __:__ _M`).
275
+ * @default '__/__/____'
276
+ */
277
+ mask: PropTypes.string,
278
+
279
+ /**
280
+ * Max selectable date. @DateIOType
281
+ * @default defaultMaxDate
282
+ */
283
+ maxDate: PropTypes.any,
284
+
285
+ /**
286
+ * Min selectable date. @DateIOType
287
+ * @default defaultMinDate
288
+ */
289
+ minDate: PropTypes.any,
290
+
291
+ /**
292
+ * Ok button text.
293
+ * @default 'OK'
294
+ */
295
+ okText: PropTypes.node,
296
+
297
+ /**
298
+ * Callback fired when date is accepted @DateIOType.
299
+ * @param {TDateValue} date The date that was just accepted.
300
+ */
301
+ onAccept: PropTypes.func,
302
+
303
+ /**
304
+ * Callback fired when the value (the selected date range) changes @DateIOType.
305
+ * @param {DateRange<TDate>} date The new parsed date range.
306
+ * @param {string} keyboardInputValue The current value of the keyboard input.
307
+ */
308
+ onChange: PropTypes.func.isRequired,
309
+
310
+ /**
311
+ * Callback fired when the popup requests to be closed.
312
+ * Use in controlled mode (see open).
313
+ */
314
+ onClose: PropTypes.func,
315
+
316
+ /**
317
+ * Callback that fired when input value or new `value` prop validation returns **new** validation error (or value is valid after error).
318
+ * In case of validation error detected `reason` prop return non-null value and `TextField` must be displayed in `error` state.
319
+ * This can be used to render appropriate form error.
320
+ *
321
+ * [Read the guide](https://next.material-ui-pickers.dev/guides/forms) about form integration and error displaying.
322
+ * @DateIOType
323
+ *
324
+ * @param {TError} reason The reason why the current value is not valid.
325
+ * @param {TDateValue} value The invalid value.
326
+ */
327
+ onError: PropTypes.func,
328
+
329
+ /**
330
+ * Callback firing on month change. @DateIOType
331
+ * @param {TDate} month The new month.
332
+ */
333
+ onMonthChange: PropTypes.func,
334
+
335
+ /**
336
+ * Callback fired when the popup requests to be opened.
337
+ * Use in controlled mode (see open).
338
+ */
339
+ onOpen: PropTypes.func,
340
+
341
+ /**
342
+ * Callback fired on view change.
343
+ * @param {CalendarPickerView} view The new view.
344
+ */
345
+ onViewChange: PropTypes.func,
346
+
347
+ /**
348
+ * Control the popup or dialog open state.
349
+ */
350
+ open: PropTypes.bool,
351
+
352
+ /**
353
+ * Props to pass to keyboard adornment button.
354
+ */
355
+ OpenPickerButtonProps: PropTypes.object,
356
+
357
+ /**
358
+ * Force rendering in particular orientation.
359
+ */
360
+ orientation: PropTypes.oneOf(['landscape', 'portrait']),
361
+
362
+ /**
363
+ * Make picker read only.
364
+ * @default false
365
+ */
366
+ readOnly: PropTypes.bool,
367
+
368
+ /**
369
+ * Disable heavy animations.
370
+ * @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
371
+ */
372
+ reduceAnimations: PropTypes.bool,
373
+
374
+ /**
375
+ * Custom renderer for `<DateRangePicker />` days. @DateIOType
376
+ * @example (date, dateRangePickerDayProps) => <DateRangePickerDay {...dateRangePickerDayProps} />
377
+ * @param {TDate} day The day to render.
378
+ * @param {DateRangePickerDayProps<TDate>} dateRangePickerDayProps The props of the day to render.
379
+ * @returns {JSX.Element} The element representing the day.
380
+ */
381
+ renderDay: PropTypes.func,
382
+
383
+ /**
384
+ * The `renderInput` prop allows you to customize the rendered input.
385
+ * The `startProps` and `endProps` arguments of this render prop contains props of [TextField](https://mui.com/api/text-field/#textfield-api),
386
+ * that you need to forward to the range start/end inputs respectively.
387
+ * Pay specific attention to the `ref` and `inputProps` keys.
388
+ * @example
389
+ * ```jsx
390
+ * <DateRangePicker
391
+ * renderInput={(startProps, endProps) => (
392
+ * <React.Fragment>
393
+ * <TextField {...startProps} />
394
+ * <Box sx={{ mx: 2 }}> to </Box>
395
+ * <TextField {...endProps} />
396
+ * </React.Fragment>;
397
+ * )}
398
+ * />
399
+ * ````
400
+ * @param {MuiTextFieldProps} startProps Props that you need to forward to the range start input.
401
+ * @param {MuiTextFieldProps} endProps Props that you need to forward to the range end input.
402
+ * @returns {React.ReactElement} The range input to render.
403
+ */
404
+ renderInput: PropTypes.func.isRequired,
405
+
406
+ /**
407
+ * Component displaying when passed `loading` true.
408
+ * @returns {React.ReactNode} The node to render when loading.
409
+ * @default () => <span data-mui-test="loading-progress">...</span>
410
+ */
411
+ renderLoading: PropTypes.func,
412
+
413
+ /**
414
+ * Custom formatter to be passed into Rifm component.
415
+ * @param {string} str The un-formatted string.
416
+ * @returns {string} The formatted string.
417
+ */
418
+ rifmFormatter: PropTypes.func,
419
+
420
+ /**
421
+ * Right arrow icon aria-label text.
422
+ */
423
+ rightArrowButtonText: PropTypes.string,
424
+
425
+ /**
426
+ * Disable specific date. @DateIOType
427
+ * @param {TDate} day The date to check.
428
+ * @returns {boolean} If `true` the day will be disabled.
429
+ */
430
+ shouldDisableDate: PropTypes.func,
431
+
432
+ /**
433
+ * Disable specific years dynamically.
434
+ * Works like `shouldDisableDate` but for year selection view @DateIOType.
435
+ * @param {TDate} year The year to test.
436
+ * @returns {boolean} Return `true` if the year should be disabled.
437
+ */
438
+ shouldDisableYear: PropTypes.func,
439
+
440
+ /**
441
+ * If `true`, days that have `outsideCurrentMonth={true}` are displayed.
442
+ * @default false
443
+ */
444
+ showDaysOutsideCurrentMonth: PropTypes.bool,
445
+
446
+ /**
447
+ * If `true`, the today button is displayed. **Note** that `showClearButton` has a higher priority.
448
+ * @default false
449
+ */
450
+ showTodayButton: PropTypes.bool,
451
+
452
+ /**
453
+ * If `true`, show the toolbar even in desktop mode.
454
+ */
455
+ showToolbar: PropTypes.bool,
456
+
457
+ /**
458
+ * Text for start input label and toolbar placeholder.
459
+ * @default 'Start'
460
+ */
461
+ startText: PropTypes.node,
462
+
463
+ /**
464
+ * Today text message.
465
+ * @default 'Today'
466
+ */
467
+ todayText: PropTypes.node,
468
+
469
+ /**
470
+ * Component that will replace default toolbar renderer.
471
+ */
472
+ ToolbarComponent: PropTypes.elementType,
473
+
474
+ /**
475
+ * Date format, that is displaying in toolbar.
476
+ */
477
+ toolbarFormat: PropTypes.string,
478
+
479
+ /**
480
+ * Mobile picker date value placeholder, displaying if `value` === `null`.
481
+ * @default '–'
482
+ */
483
+ toolbarPlaceholder: PropTypes.node,
484
+
485
+ /**
486
+ * Mobile picker title, displaying in the toolbar.
487
+ * @default 'Select date range'
488
+ */
489
+ toolbarTitle: PropTypes.node,
490
+
491
+ /**
492
+ * The value of the date range picker.
493
+ */
494
+ value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.any, PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])).isRequired
495
+ } : void 0;
@@ -0,0 +1,2 @@
1
+ export { MobileDateRangePicker } from './MobileDateRangePicker';
2
+ export type { MobileDateRangePickerProps } from './MobileDateRangePicker';
@@ -0,0 +1 @@
1
+ export { MobileDateRangePicker } from './MobileDateRangePicker';
@@ -0,0 +1,6 @@
1
+ {
2
+ "sideEffects": false,
3
+ "module": "./index.js",
4
+ "main": "../node/MobileDateRangePicker/index.js",
5
+ "types": "./index.d.ts"
6
+ }
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # @mui/x-date-pickers
2
+
3
+ This package is the community edition of the date picker component.
4
+ It's part of MUI X, an open core extension of MUI, with advanced components.
5
+
6
+ ## Installation
7
+
8
+ Install the package in your project directory with:
9
+
10
+ ```sh
11
+ // with npm
12
+ npm install @mui/x-date-pickers
13
+
14
+ // with yarn
15
+ yarn add @mui/x-date-pickers
16
+ ```
17
+
18
+ This component has three peer dependencies that you will need to install as well.
19
+
20
+ ```json
21
+ "peerDependencies": {
22
+ "@mui/material": "^5.0.0",
23
+ "react": "^17.0.0"
24
+ },
25
+ ```
26
+
27
+ ## Documentation
28
+
29
+ [The documentation](https://mui.com/components/x/react-date-pickers/date-picker/)
@@ -0,0 +1,69 @@
1
+ import * as React from 'react';
2
+ import { PickerStaticWrapperProps, ValidationProps } from '@mui/x-date-pickers/internals';
3
+ import { RangeInput, DateRange } from '../internal/models/dateRange';
4
+ import { DateRangeValidationError } from '../internal/hooks/validation/useDateRangeValidation';
5
+ import { ExportedDateRangePickerViewProps } from '../DateRangePicker/DateRangePickerView';
6
+ import { ExportedDateRangePickerInputProps } from '../DateRangePicker/DateRangePickerInput';
7
+ interface BaseDateRangePickerProps<TDate> extends ExportedDateRangePickerViewProps<TDate>, ValidationProps<DateRangeValidationError, RangeInput<TDate>>, ExportedDateRangePickerInputProps {
8
+ /**
9
+ * The components used for each slot.
10
+ * Either a string to use a HTML element or a component.
11
+ * @default {}
12
+ */
13
+ components?: ExportedDateRangePickerViewProps<TDate>['components'] & ExportedDateRangePickerInputProps['components'];
14
+ /**
15
+ * Text for end input label and toolbar placeholder.
16
+ * @default 'End'
17
+ */
18
+ endText?: React.ReactNode;
19
+ /**
20
+ * Custom mask. Can be used to override generate from format. (e.g. `__/__/____ __:__` or `__/__/____ __:__ _M`).
21
+ * @default '__/__/____'
22
+ */
23
+ mask?: ExportedDateRangePickerInputProps['mask'];
24
+ /**
25
+ * Min selectable date. @DateIOType
26
+ */
27
+ minDate?: TDate;
28
+ /**
29
+ * Max selectable date. @DateIOType
30
+ */
31
+ maxDate?: TDate;
32
+ /**
33
+ * Callback fired when the value (the selected date range) changes @DateIOType.
34
+ * @param {DateRange<TDate>} date The new parsed date range.
35
+ * @param {string} keyboardInputValue The current value of the keyboard input.
36
+ */
37
+ onChange: (date: DateRange<TDate>, keyboardInputValue?: string) => void;
38
+ /**
39
+ * Text for start input label and toolbar placeholder.
40
+ * @default 'Start'
41
+ */
42
+ startText?: React.ReactNode;
43
+ /**
44
+ * The value of the date range picker.
45
+ */
46
+ value: RangeInput<TDate>;
47
+ }
48
+ export interface StaticDateRangePickerProps<TDate = unknown> extends BaseDateRangePickerProps<TDate> {
49
+ /**
50
+ * Force static wrapper inner components to be rendered in mobile or desktop mode.
51
+ * @default 'mobile'
52
+ */
53
+ displayStaticWrapperAs?: PickerStaticWrapperProps['displayStaticWrapperAs'];
54
+ }
55
+ declare type StaticDateRangePickerComponent = (<TDate>(props: StaticDateRangePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
56
+ propTypes?: any;
57
+ };
58
+ /**
59
+ *
60
+ * Demos:
61
+ *
62
+ * - [Date Range Picker](https://mui.com/components/x/react-date-pickers/date-range-picker/)
63
+ *
64
+ * API:
65
+ *
66
+ * - [StaticDateRangePicker API](https://mui.com/api/static-date-range-picker/)
67
+ */
68
+ export declare const StaticDateRangePicker: StaticDateRangePickerComponent;
69
+ export {};