@progress/kendo-react-dateinputs 4.13.0-dev.202111291459 → 4.13.0-dev.202111300702

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 (43) hide show
  1. package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
  2. package/dist/es/calendar/components/Calendar.d.ts +43 -9
  3. package/dist/es/calendar/components/Calendar.js +48 -28
  4. package/dist/es/calendar/components/MultiViewCalendar.d.ts +51 -19
  5. package/dist/es/calendar/components/MultiViewCalendar.js +64 -37
  6. package/dist/es/dateinput/DateInput.d.ts +46 -4
  7. package/dist/es/dateinput/DateInput.js +64 -43
  8. package/dist/es/datepicker/DatePicker.d.ts +63 -9
  9. package/dist/es/datepicker/DatePicker.js +68 -47
  10. package/dist/es/daterangepicker/DateRangePicker.d.ts +51 -11
  11. package/dist/es/daterangepicker/DateRangePicker.js +60 -32
  12. package/dist/es/datetimepicker/DateTimePicker.d.ts +54 -4
  13. package/dist/es/datetimepicker/DateTimePicker.js +54 -33
  14. package/dist/es/hooks/usePickerFloatingLabel.d.ts +1 -1
  15. package/dist/es/main.d.ts +8 -8
  16. package/dist/es/main.js +8 -8
  17. package/dist/es/package-metadata.js +1 -1
  18. package/dist/es/timepicker/TimePicker.d.ts +58 -4
  19. package/dist/es/timepicker/TimePicker.js +59 -38
  20. package/dist/es/utils.d.ts +4 -0
  21. package/dist/es/utils.js +20 -0
  22. package/dist/npm/calendar/components/Calendar.d.ts +43 -9
  23. package/dist/npm/calendar/components/Calendar.js +48 -28
  24. package/dist/npm/calendar/components/MultiViewCalendar.d.ts +51 -19
  25. package/dist/npm/calendar/components/MultiViewCalendar.js +62 -35
  26. package/dist/npm/dateinput/DateInput.d.ts +46 -4
  27. package/dist/npm/dateinput/DateInput.js +64 -43
  28. package/dist/npm/datepicker/DatePicker.d.ts +63 -9
  29. package/dist/npm/datepicker/DatePicker.js +67 -46
  30. package/dist/npm/daterangepicker/DateRangePicker.d.ts +51 -11
  31. package/dist/npm/daterangepicker/DateRangePicker.js +58 -30
  32. package/dist/npm/datetimepicker/DateTimePicker.d.ts +54 -4
  33. package/dist/npm/datetimepicker/DateTimePicker.js +53 -32
  34. package/dist/npm/hooks/usePickerFloatingLabel.d.ts +1 -1
  35. package/dist/npm/main.d.ts +8 -8
  36. package/dist/npm/main.js +7 -0
  37. package/dist/npm/package-metadata.js +1 -1
  38. package/dist/npm/timepicker/TimePicker.d.ts +58 -4
  39. package/dist/npm/timepicker/TimePicker.js +58 -37
  40. package/dist/npm/utils.d.ts +4 -0
  41. package/dist/npm/utils.js +21 -0
  42. package/dist/systemjs/kendo-react-dateinputs.js +1 -1
  43. package/package.json +14 -9
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import * as PropTypes from 'prop-types';
3
- import { CalendarViewEnum, CalendarSettings } from '../models';
3
+ import { CalendarViewEnum, ActiveView, CalendarSettings } from '../models';
4
4
  import { DOMService, ScrollSyncService } from '../services';
5
5
  /**
6
6
  * The arguments for the `change` event of the Calendar. The generic argument sets the target type of the event. Defaults to `Calendar`.
@@ -26,7 +26,7 @@ export interface CalendarChangeEvent<T = Calendar> {
26
26
  /**
27
27
  * Represents the props of the [KendoReact Calendar component]({% slug overview_calendar %}). The generic argument is passed to the `onChange` property and is used as a target in the [`CalendarChangeEvent`]({% slug api_dateinputs_calendarchangeevent %}) interface.
28
28
  */
29
- export interface CalendarProps<T = Calendar> extends CalendarSettings {
29
+ export interface CalendarProps<T = any> extends CalendarSettings {
30
30
  /** @hidden */
31
31
  _ref?: (instance: {
32
32
  element: HTMLDivElement | null;
@@ -52,13 +52,18 @@ export interface CalendarState {
52
52
  activeView: CalendarViewEnum;
53
53
  focusedDate: Date;
54
54
  }
55
- export declare class Calendar extends React.Component<CalendarProps, CalendarState> {
55
+ /** @hidden */
56
+ export declare class CalendarWithoutContext extends React.Component<CalendarProps, CalendarState> {
57
+ /**
58
+ * @hidden
59
+ */
60
+ static displayName: string;
56
61
  /**
57
62
  * @hidden
58
63
  */
59
64
  static propTypes: {
60
65
  className: PropTypes.Requireable<string>;
61
- defaultActiveView: PropTypes.Requireable<string>;
66
+ defaultActiveView: PropTypes.Requireable<ActiveView>;
62
67
  defaultValue: PropTypes.Requireable<Date>;
63
68
  disabled: PropTypes.Requireable<boolean>;
64
69
  focusedDate: PropTypes.Requireable<Date>;
@@ -75,8 +80,8 @@ export declare class Calendar extends React.Component<CalendarProps, CalendarSta
75
80
  tabIndex: PropTypes.Requireable<number>;
76
81
  value: PropTypes.Requireable<Date>;
77
82
  weekNumber: PropTypes.Requireable<boolean>;
78
- topView: (props: CalendarProps<Calendar>, propName: string, componentName: string) => Error;
79
- bottomView: (props: CalendarProps<Calendar>, propName: string, componentName: string) => Error;
83
+ topView: (props: CalendarProps<any>, propName: string, componentName: string) => Error;
84
+ bottomView: (props: CalendarProps<any>, propName: string, componentName: string) => Error;
80
85
  };
81
86
  /**
82
87
  * @hidden
@@ -86,11 +91,11 @@ export declare class Calendar extends React.Component<CalendarProps, CalendarSta
86
91
  min: Date;
87
92
  max: Date;
88
93
  navigation: boolean;
89
- defaultActiveView: string;
94
+ defaultActiveView: ActiveView;
90
95
  defaultValue: any;
91
96
  smoothScroll: boolean;
92
- topView: string;
93
- bottomView: string;
97
+ topView: ActiveView;
98
+ bottomView: ActiveView;
94
99
  };
95
100
  protected dom: DOMService;
96
101
  protected scrollSyncService: ScrollSyncService;
@@ -148,3 +153,32 @@ export declare class Calendar extends React.Component<CalendarProps, CalendarSta
148
153
  private handleMouseDown;
149
154
  private handleClick;
150
155
  }
156
+ /**
157
+ * Represents the PropsContext of the `Calendar` component.
158
+ * Used for global configuration of all `Calendar` instances.
159
+ *
160
+ * For more information, refer to the [DateInputs Props Context]({% slug props-context_dateinputs %}) article.
161
+ */
162
+ export declare const CalendarPropsContext: React.Context<(p: CalendarProps<any>) => CalendarProps<any>>;
163
+ /**
164
+ * Represent the `ref` of the Calendar component.
165
+ */
166
+ export interface CalendarHandle extends Pick<CalendarWithoutContext, keyof CalendarWithoutContext> {
167
+ /**
168
+ * Returns the HTML element of the Calendar component.
169
+ */
170
+ element: HTMLDivElement | null;
171
+ /**
172
+ * Returns the `value` of the Calendar component.
173
+ */
174
+ value: Date | null;
175
+ }
176
+ /** @hidden */
177
+ export declare type Calendar = CalendarHandle;
178
+ /**
179
+ * Represents the KendoReact Calendar Component.
180
+ *
181
+ * Accepts properties of type [CalendarProps]({% slug api_dateinputs_calendarprops %}).
182
+ * Obtaining the `ref` returns an object of type [CalendarHandle]({% slug api_dateinputs_calendarhandle %}).
183
+ */
184
+ export declare const Calendar: React.ForwardRefExoticComponent<CalendarProps<any> & React.RefAttributes<any>>;
@@ -24,10 +24,9 @@ var __assign = (this && this.__assign) || function () {
24
24
  };
25
25
  import * as React from 'react';
26
26
  import * as PropTypes from 'prop-types';
27
- import { classNames, guid, Keys } from '@progress/kendo-react-common';
27
+ import { classNames, guid, Keys, validatePackage, withPropsContext, createPropsContext } from '@progress/kendo-react-common';
28
28
  import { cloneDate, getDate, isEqualDate } from '@progress/kendo-date-math';
29
29
  import { provideIntlService, registerForIntl } from '@progress/kendo-react-intl';
30
- import { validatePackage } from '@progress/kendo-react-common';
31
30
  import { packageMetadata } from '../../package-metadata';
32
31
  import { ViewList } from './ViewList';
33
32
  import { Navigation } from './Navigation';
@@ -37,8 +36,8 @@ import { getToday, dateInRange, isInRange, viewInRange } from '../../utils';
37
36
  import { BusViewService, DOMService, ScrollSyncService, NavigationService } from '../services';
38
37
  var virtualizationProp = function (x) { return x ? x.virtualization : null; };
39
38
  var calculateValue = function (min, max, stateValue, propValue) {
40
- if (min === void 0) { min = Calendar.defaultProps.min; }
41
- if (max === void 0) { max = Calendar.defaultProps.max; }
39
+ if (min === void 0) { min = CalendarWithoutContext.defaultProps.min; }
40
+ if (max === void 0) { max = CalendarWithoutContext.defaultProps.max; }
42
41
  return propValue !== undefined
43
42
  ? propValue !== null && isInRange(getDate(propValue), min, max)
44
43
  ? propValue
@@ -47,9 +46,10 @@ var calculateValue = function (min, max, stateValue, propValue) {
47
46
  ? stateValue
48
47
  : null;
49
48
  };
50
- var Calendar = /** @class */ (function (_super) {
51
- __extends(Calendar, _super);
52
- function Calendar(props) {
49
+ /** @hidden */
50
+ var CalendarWithoutContext = /** @class */ (function (_super) {
51
+ __extends(CalendarWithoutContext, _super);
52
+ function CalendarWithoutContext(props) {
53
53
  var _this = _super.call(this, props) || this;
54
54
  _this.cellUID = guid();
55
55
  _this.id = guid();
@@ -170,7 +170,7 @@ var Calendar = /** @class */ (function (_super) {
170
170
  }
171
171
  };
172
172
  validatePackage(packageMetadata);
173
- var value = calculateValue(_this.min, _this.max, _this.props.defaultValue || Calendar.defaultProps.defaultValue, _this.props.value);
173
+ var value = calculateValue(_this.min, _this.max, _this.props.defaultValue || CalendarWithoutContext.defaultProps.defaultValue, _this.props.value);
174
174
  _this.state = {
175
175
  value: value,
176
176
  activeView: viewInRange(CalendarViewEnum[props.defaultActiveView], _this.bottomView, _this.topView),
@@ -184,7 +184,7 @@ var Calendar = /** @class */ (function (_super) {
184
184
  _this.oldValue = value;
185
185
  return _this;
186
186
  }
187
- Object.defineProperty(Calendar.prototype, "element", {
187
+ Object.defineProperty(CalendarWithoutContext.prototype, "element", {
188
188
  /**
189
189
  * Gets the wrapping element of the Calendar.
190
190
  */
@@ -194,7 +194,7 @@ var Calendar = /** @class */ (function (_super) {
194
194
  enumerable: true,
195
195
  configurable: true
196
196
  });
197
- Object.defineProperty(Calendar.prototype, "value", {
197
+ Object.defineProperty(CalendarWithoutContext.prototype, "value", {
198
198
  /**
199
199
  * Gets the value of the Calendar.
200
200
  */
@@ -208,38 +208,38 @@ var Calendar = /** @class */ (function (_super) {
208
208
  enumerable: true,
209
209
  configurable: true
210
210
  });
211
- Object.defineProperty(Calendar.prototype, "min", {
211
+ Object.defineProperty(CalendarWithoutContext.prototype, "min", {
212
212
  get: function () {
213
213
  return getDate(this.props.min !== undefined
214
214
  ? this.props.min
215
- : Calendar.defaultProps.min);
215
+ : CalendarWithoutContext.defaultProps.min);
216
216
  },
217
217
  enumerable: true,
218
218
  configurable: true
219
219
  });
220
- Object.defineProperty(Calendar.prototype, "max", {
220
+ Object.defineProperty(CalendarWithoutContext.prototype, "max", {
221
221
  get: function () {
222
222
  return getDate(this.props.max !== undefined
223
223
  ? this.props.max
224
- : Calendar.defaultProps.max);
224
+ : CalendarWithoutContext.defaultProps.max);
225
225
  },
226
226
  enumerable: true,
227
227
  configurable: true
228
228
  });
229
- Object.defineProperty(Calendar.prototype, "bottomView", {
229
+ Object.defineProperty(CalendarWithoutContext.prototype, "bottomView", {
230
230
  get: function () {
231
231
  return CalendarViewEnum[this.props.bottomView !== undefined
232
232
  ? this.props.bottomView
233
- : Calendar.defaultProps.bottomView];
233
+ : CalendarWithoutContext.defaultProps.bottomView];
234
234
  },
235
235
  enumerable: true,
236
236
  configurable: true
237
237
  });
238
- Object.defineProperty(Calendar.prototype, "topView", {
238
+ Object.defineProperty(CalendarWithoutContext.prototype, "topView", {
239
239
  get: function () {
240
240
  return CalendarViewEnum[this.props.topView !== undefined
241
241
  ? this.props.topView
242
- : Calendar.defaultProps.topView];
242
+ : CalendarWithoutContext.defaultProps.topView];
243
243
  },
244
244
  enumerable: true,
245
245
  configurable: true
@@ -247,7 +247,7 @@ var Calendar = /** @class */ (function (_super) {
247
247
  /**
248
248
  * @hidden
249
249
  */
250
- Calendar.prototype.componentDidMount = function () {
250
+ CalendarWithoutContext.prototype.componentDidMount = function () {
251
251
  var _this = this;
252
252
  // Async calculation of height to avoid animation cancellation
253
253
  Promise.resolve().then(function () {
@@ -263,7 +263,7 @@ var Calendar = /** @class */ (function (_super) {
263
263
  /**
264
264
  * @hidden
265
265
  */
266
- Calendar.prototype.componentDidUpdate = function (_, prevState) {
266
+ CalendarWithoutContext.prototype.componentDidUpdate = function (_, prevState) {
267
267
  if (prevState.activeView !== this.state.activeView) {
268
268
  this.scrollSyncService.configure(this.state.activeView);
269
269
  }
@@ -276,7 +276,7 @@ var Calendar = /** @class */ (function (_super) {
276
276
  /**
277
277
  * @hidden
278
278
  */
279
- Calendar.prototype.render = function () {
279
+ CalendarWithoutContext.prototype.render = function () {
280
280
  var _this = this;
281
281
  if (this.props._ref) {
282
282
  this.props._ref(this);
@@ -286,9 +286,9 @@ var Calendar = /** @class */ (function (_super) {
286
286
  : this.value !== this.oldValue;
287
287
  var activeView = viewInRange(this.state.activeView, CalendarViewEnum[this.props.bottomView !== undefined
288
288
  ? this.props.bottomView
289
- : Calendar.defaultProps.bottomView], CalendarViewEnum[this.props.topView !== undefined
289
+ : CalendarWithoutContext.defaultProps.bottomView], CalendarViewEnum[this.props.topView !== undefined
290
290
  ? this.props.topView
291
- : Calendar.defaultProps.topView]);
291
+ : CalendarWithoutContext.defaultProps.topView]);
292
292
  var value = calculateValue(this.min, this.max, this.value, this.value);
293
293
  var sanitizedValue = value ? getDate(value) : null;
294
294
  this.focusedDate = getDate(dateInRange(didValueChange && value !== null
@@ -311,7 +311,11 @@ var Calendar = /** @class */ (function (_super) {
311
311
  /**
312
312
  * @hidden
313
313
  */
314
- Calendar.propTypes = {
314
+ CalendarWithoutContext.displayName = 'Calendar';
315
+ /**
316
+ * @hidden
317
+ */
318
+ CalendarWithoutContext.propTypes = {
315
319
  className: PropTypes.string,
316
320
  defaultActiveView: PropTypes.oneOf(['month', 'year', 'decade', 'century']),
317
321
  defaultValue: PropTypes.instanceOf(Date),
@@ -350,7 +354,7 @@ var Calendar = /** @class */ (function (_super) {
350
354
  /**
351
355
  * @hidden
352
356
  */
353
- Calendar.defaultProps = {
357
+ CalendarWithoutContext.defaultProps = {
354
358
  disabled: false,
355
359
  min: MIN_DATE,
356
360
  max: MAX_DATE,
@@ -361,7 +365,23 @@ var Calendar = /** @class */ (function (_super) {
361
365
  topView: 'century',
362
366
  bottomView: 'month'
363
367
  };
364
- return Calendar;
368
+ return CalendarWithoutContext;
365
369
  }(React.Component));
366
- export { Calendar };
367
- registerForIntl(Calendar);
370
+ export { CalendarWithoutContext };
371
+ /**
372
+ * Represents the PropsContext of the `Calendar` component.
373
+ * Used for global configuration of all `Calendar` instances.
374
+ *
375
+ * For more information, refer to the [DateInputs Props Context]({% slug props-context_dateinputs %}) article.
376
+ */
377
+ export var CalendarPropsContext = createPropsContext();
378
+ /* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
379
+ /**
380
+ * Represents the KendoReact Calendar Component.
381
+ *
382
+ * Accepts properties of type [CalendarProps]({% slug api_dateinputs_calendarprops %}).
383
+ * Obtaining the `ref` returns an object of type [CalendarHandle]({% slug api_dateinputs_calendarhandle %}).
384
+ */
385
+ export var Calendar = withPropsContext(CalendarPropsContext, CalendarWithoutContext);
386
+ Calendar.displayName = 'KendoReactCalendar';
387
+ registerForIntl(CalendarWithoutContext);
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import * as PropTypes from 'prop-types';
3
- import { Action, SelectionRange, CalendarViewEnum, SelectionRangeEnd, MultiViewCalendarSettings } from '../models';
3
+ import { Action, ActiveView, SelectionRange, CalendarViewEnum, SelectionRangeEnd, MultiViewCalendarSettings } from '../models';
4
4
  /**
5
5
  * The arguments for the `onChange` event of the MultiViewCalendar. * The generic argument sets the target type of the event. Defaults to `MultiViewCalendar`.
6
6
  */
@@ -13,7 +13,7 @@ export interface MultiViewCalendarChangeEvent<T = MultiViewCalendar> {
13
13
  /**
14
14
  * Represents the props of the [KendoReact MultiViewCalendar component]({% slug overview_multiviewcalendar %}). The generic argument is passed to the `onChange` property and is used as a target in the [`MultiViewCalendarChangeEvent`]({% slug api_dateinputs_multiviewcalendarchangeevent %}) interface.
15
15
  */
16
- export interface MultiViewCalendarProps<T = MultiViewCalendar> extends MultiViewCalendarSettings {
16
+ export interface MultiViewCalendarProps<T = any> extends MultiViewCalendarSettings {
17
17
  /** @hidden */
18
18
  _ref?: (instance: {
19
19
  element: HTMLDivElement | null;
@@ -39,20 +39,22 @@ export interface MultiViewCalendarState {
39
39
  activeView: CalendarViewEnum;
40
40
  focusedDate: Date;
41
41
  }
42
- export declare class MultiViewCalendar extends React.Component<MultiViewCalendarProps, MultiViewCalendarState> {
42
+ /** @hidden */
43
+ export declare class MultiViewCalendarWithoutContext extends React.Component<MultiViewCalendarProps, MultiViewCalendarState> {
44
+ /**
45
+ * @hidden
46
+ */
47
+ static displayName: string;
43
48
  /**
44
49
  * @hidden
45
50
  */
46
51
  static propTypes: {
47
- activeRangeEnd: PropTypes.Requireable<string>;
52
+ activeRangeEnd: PropTypes.Requireable<SelectionRangeEnd>;
48
53
  allowReverse: PropTypes.Requireable<boolean>;
49
- bottomView: PropTypes.Requireable<string>;
54
+ bottomView: PropTypes.Requireable<ActiveView>;
50
55
  className: PropTypes.Requireable<string>;
51
- defaultActiveView: PropTypes.Requireable<string>;
52
- defaultValue: PropTypes.Requireable<Date | Date[] | PropTypes.InferProps<{
53
- start: PropTypes.Requireable<Date>;
54
- end: PropTypes.Requireable<Date>;
55
- }>>;
56
+ defaultActiveView: PropTypes.Requireable<ActiveView>;
57
+ defaultValue: PropTypes.Requireable<any>;
56
58
  disabled: PropTypes.Requireable<boolean>;
57
59
  focusedDate: PropTypes.Requireable<Date>;
58
60
  id: PropTypes.Requireable<string>;
@@ -60,16 +62,13 @@ export declare class MultiViewCalendar extends React.Component<MultiViewCalendar
60
62
  ariaDescribedBy: PropTypes.Requireable<string>;
61
63
  max: PropTypes.Requireable<Date>;
62
64
  min: PropTypes.Requireable<Date>;
63
- mode: PropTypes.Requireable<string>;
65
+ mode: PropTypes.Requireable<import("../models").MultiViewCalendarMode>;
64
66
  onBlur: PropTypes.Requireable<(...args: any[]) => any>;
65
67
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
66
68
  onFocus: PropTypes.Requireable<(...args: any[]) => any>;
67
69
  tabIndex: PropTypes.Requireable<number>;
68
- topView: PropTypes.Requireable<string>;
69
- value: PropTypes.Requireable<Date | Date[] | PropTypes.InferProps<{
70
- start: PropTypes.Requireable<Date>;
71
- end: PropTypes.Requireable<Date>;
72
- }>>;
70
+ topView: PropTypes.Requireable<ActiveView>;
71
+ value: PropTypes.Requireable<any>;
73
72
  views: (props: any, propName: any, componentName: any) => Error;
74
73
  weekNumber: PropTypes.Requireable<boolean>;
75
74
  };
@@ -81,11 +80,11 @@ export declare class MultiViewCalendar extends React.Component<MultiViewCalendar
81
80
  min: Date;
82
81
  max: Date;
83
82
  navigation: boolean;
84
- defaultActiveView: string;
83
+ defaultActiveView: ActiveView;
85
84
  defaultValue: any;
86
- topView: string;
85
+ topView: ActiveView;
87
86
  tabIndex: number;
88
- bottomView: string;
87
+ bottomView: ActiveView;
89
88
  views: number;
90
89
  allowReverse: boolean;
91
90
  };
@@ -165,3 +164,36 @@ export declare class MultiViewCalendar extends React.Component<MultiViewCalendar
165
164
  private handleViewChange;
166
165
  private handleDateChange;
167
166
  }
167
+ /**
168
+ * Represents the PropsContext of the `MultiViewCalendar` component.
169
+ * Used for global configuration of all `MultiViewCalendar` instances.
170
+ *
171
+ * For more information, refer to the [DateInputs Props Context]({% slug props-context_dateinputs %}) article.
172
+ */
173
+ export declare const MultiViewCalendarPropsContext: React.Context<(p: MultiViewCalendarProps<any>) => MultiViewCalendarProps<any>>;
174
+ /**
175
+ * Represent the `ref` of the MultiViewCalendar component.
176
+ */
177
+ export interface MultiViewCalendarHandle extends Pick<MultiViewCalendarWithoutContext, keyof MultiViewCalendarWithoutContext> {
178
+ /**
179
+ * Returns the HTML element of the MultiViewCalendar component.
180
+ */
181
+ element: HTMLDivElement | null;
182
+ /**
183
+ * Gets the current focused date of the MultiViewCalendar.
184
+ */
185
+ focusedDate: Date;
186
+ /**
187
+ * Gets the value of the MultiViewCalendar.
188
+ */
189
+ value: Date | Date[] | SelectionRange | null;
190
+ }
191
+ /** @hidden */
192
+ export declare type MultiViewCalendar = MultiViewCalendarHandle;
193
+ /**
194
+ * Represents the KendoReact MultiViewCalendar Component.
195
+ *
196
+ * Accepts properties of type [MultiViewCalendarProps]({% slug api_dateinputs_multiviewcalendarprops %}).
197
+ * Obtaining the `ref` returns an object of type [MultiViewCalendarHandle]({% slug api_dateinputs_multiviewcalendarhandle %}).
198
+ */
199
+ export declare const MultiViewCalendar: React.ForwardRefExoticComponent<MultiViewCalendarProps<any> & React.RefAttributes<any>>;
@@ -25,7 +25,7 @@ var __assign = (this && this.__assign) || function () {
25
25
  import * as React from 'react';
26
26
  import * as PropTypes from 'prop-types';
27
27
  import { registerForIntl, provideIntlService, registerForLocalization, provideLocalizationService } from '@progress/kendo-react-intl';
28
- import { classNames, guid, Keys } from '@progress/kendo-react-common';
28
+ import { classNames, guid, Keys, createPropsContext, withPropsContext } from '@progress/kendo-react-common';
29
29
  import { cloneDate, isEqualDate, getDate } from '@progress/kendo-date-math';
30
30
  import { Button } from '@progress/kendo-react-buttons';
31
31
  import { Action, CalendarViewEnum, EMPTY_SELECTIONRANGE } from '../models';
@@ -33,19 +33,19 @@ import { Header } from './Header';
33
33
  import { MIN_DATE, MAX_DATE } from '../../defaults';
34
34
  import { messages, prevView, nextView } from '../../messages';
35
35
  import { BusViewService, NavigationService } from '../services';
36
- import { dateInRange, isInRange, viewInRange, getToday } from '../../utils';
36
+ import { dateInRange, isInRange, viewInRange, getToday, nullable } from '../../utils';
37
37
  import { HorizontalViewList } from './HorizontalViewList';
38
38
  import { TodayCommand } from './TodayCommand';
39
39
  var extractDateFromValue = function (min, max, value) {
40
- if (min === void 0) { min = MultiViewCalendar.defaultProps.min; }
41
- if (max === void 0) { max = MultiViewCalendar.defaultProps.max; }
40
+ if (min === void 0) { min = MultiViewCalendarWithoutContext.defaultProps.min; }
41
+ if (max === void 0) { max = MultiViewCalendarWithoutContext.defaultProps.max; }
42
42
  return value instanceof Date && !Array.isArray(value) && isInRange(getDate(value), min, max)
43
43
  ? getDate(value)
44
44
  : null;
45
45
  };
46
46
  var extractMultipleFromValue = function (min, max, value) {
47
- if (min === void 0) { min = MultiViewCalendar.defaultProps.min; }
48
- if (max === void 0) { max = MultiViewCalendar.defaultProps.max; }
47
+ if (min === void 0) { min = MultiViewCalendarWithoutContext.defaultProps.min; }
48
+ if (max === void 0) { max = MultiViewCalendarWithoutContext.defaultProps.max; }
49
49
  return Array.isArray(value)
50
50
  ? value.filter(function (date) { return isInRange(date, min, max); }).map(function (date) { return getDate(date); })
51
51
  : null;
@@ -65,9 +65,10 @@ var extractActiveRange = function (range, single) {
65
65
  ? 'end'
66
66
  : 'start';
67
67
  };
68
- var MultiViewCalendar = /** @class */ (function (_super) {
69
- __extends(MultiViewCalendar, _super);
70
- function MultiViewCalendar(props) {
68
+ /** @hidden */
69
+ var MultiViewCalendarWithoutContext = /** @class */ (function (_super) {
70
+ __extends(MultiViewCalendarWithoutContext, _super);
71
+ function MultiViewCalendarWithoutContext(props) {
71
72
  var _this = _super.call(this, props) || this;
72
73
  _this.selectedDate = null;
73
74
  _this.selectedMultiple = null;
@@ -113,7 +114,7 @@ var MultiViewCalendar = /** @class */ (function (_super) {
113
114
  };
114
115
  _this.isListInRange = function (list) {
115
116
  return _this.min < list[0]
116
- && _this.max > list[Math.max(0, (_this.props.views || MultiViewCalendar.defaultProps.views) - 1)];
117
+ && _this.max > list[Math.max(0, (_this.props.views || MultiViewCalendarWithoutContext.defaultProps.views) - 1)];
117
118
  };
118
119
  _this.navigate = function (action) {
119
120
  _this.calculateFocusFromValue = false;
@@ -287,7 +288,7 @@ var MultiViewCalendar = /** @class */ (function (_super) {
287
288
  };
288
289
  var value = props.value !== undefined
289
290
  ? props.value
290
- : props.defaultValue || MultiViewCalendar.defaultProps.defaultValue;
291
+ : props.defaultValue || MultiViewCalendarWithoutContext.defaultProps.defaultValue;
291
292
  var selectedDate = extractDateFromValue(_this.min, _this.max, value);
292
293
  var selectedMultiple = extractMultipleFromValue(_this.min, _this.max, value);
293
294
  var selectedRange = extractRangeFromValue(value);
@@ -307,7 +308,7 @@ var MultiViewCalendar = /** @class */ (function (_super) {
307
308
  _this.lastViewsCount = _this.props.views || HorizontalViewList.defaultProps.views;
308
309
  return _this;
309
310
  }
310
- Object.defineProperty(MultiViewCalendar.prototype, "element", {
311
+ Object.defineProperty(MultiViewCalendarWithoutContext.prototype, "element", {
311
312
  /**
312
313
  * Gets the wrapping element of the MultiViewCalendar component.
313
314
  */
@@ -317,7 +318,7 @@ var MultiViewCalendar = /** @class */ (function (_super) {
317
318
  enumerable: true,
318
319
  configurable: true
319
320
  });
320
- Object.defineProperty(MultiViewCalendar.prototype, "value", {
321
+ Object.defineProperty(MultiViewCalendarWithoutContext.prototype, "value", {
321
322
  /**
322
323
  * Gets the value of the MultiViewCalendar.
323
324
  */
@@ -331,7 +332,7 @@ var MultiViewCalendar = /** @class */ (function (_super) {
331
332
  enumerable: true,
332
333
  configurable: true
333
334
  });
334
- Object.defineProperty(MultiViewCalendar.prototype, "focusedDate", {
335
+ Object.defineProperty(MultiViewCalendarWithoutContext.prototype, "focusedDate", {
335
336
  /**
336
337
  * Gets the current focused date of the MultiViewCalendar.
337
338
  */
@@ -341,43 +342,43 @@ var MultiViewCalendar = /** @class */ (function (_super) {
341
342
  enumerable: true,
342
343
  configurable: true
343
344
  });
344
- Object.defineProperty(MultiViewCalendar.prototype, "min", {
345
+ Object.defineProperty(MultiViewCalendarWithoutContext.prototype, "min", {
345
346
  get: function () {
346
347
  return getDate(this.props.min !== undefined
347
348
  ? this.props.min
348
- : MultiViewCalendar.defaultProps.min);
349
+ : MultiViewCalendarWithoutContext.defaultProps.min);
349
350
  },
350
351
  enumerable: true,
351
352
  configurable: true
352
353
  });
353
- Object.defineProperty(MultiViewCalendar.prototype, "max", {
354
+ Object.defineProperty(MultiViewCalendarWithoutContext.prototype, "max", {
354
355
  get: function () {
355
356
  return getDate(this.props.max !== undefined
356
357
  ? this.props.max
357
- : MultiViewCalendar.defaultProps.max);
358
+ : MultiViewCalendarWithoutContext.defaultProps.max);
358
359
  },
359
360
  enumerable: true,
360
361
  configurable: true
361
362
  });
362
- Object.defineProperty(MultiViewCalendar.prototype, "bottomView", {
363
+ Object.defineProperty(MultiViewCalendarWithoutContext.prototype, "bottomView", {
363
364
  get: function () {
364
365
  return CalendarViewEnum[this.props.bottomView !== undefined
365
366
  ? this.props.bottomView
366
- : MultiViewCalendar.defaultProps.bottomView];
367
+ : MultiViewCalendarWithoutContext.defaultProps.bottomView];
367
368
  },
368
369
  enumerable: true,
369
370
  configurable: true
370
371
  });
371
- Object.defineProperty(MultiViewCalendar.prototype, "topView", {
372
+ Object.defineProperty(MultiViewCalendarWithoutContext.prototype, "topView", {
372
373
  get: function () {
373
374
  return CalendarViewEnum[this.props.topView !== undefined
374
375
  ? this.props.topView
375
- : MultiViewCalendar.defaultProps.topView];
376
+ : MultiViewCalendarWithoutContext.defaultProps.topView];
376
377
  },
377
378
  enumerable: true,
378
379
  configurable: true
379
380
  });
380
- Object.defineProperty(MultiViewCalendar.prototype, "activeRange", {
381
+ Object.defineProperty(MultiViewCalendarWithoutContext.prototype, "activeRange", {
381
382
  get: function () {
382
383
  return this.props.activeRangeEnd !== undefined
383
384
  ? this.props.activeRangeEnd
@@ -386,7 +387,7 @@ var MultiViewCalendar = /** @class */ (function (_super) {
386
387
  enumerable: true,
387
388
  configurable: true
388
389
  });
389
- Object.defineProperty(MultiViewCalendar.prototype, "todayIsInRange", {
390
+ Object.defineProperty(MultiViewCalendarWithoutContext.prototype, "todayIsInRange", {
390
391
  get: function () {
391
392
  return isInRange(getToday(), getDate(this.min), getDate(this.max));
392
393
  },
@@ -396,13 +397,13 @@ var MultiViewCalendar = /** @class */ (function (_super) {
396
397
  /**
397
398
  * @hidden
398
399
  */
399
- MultiViewCalendar.prototype.componentDidMount = function () {
400
+ MultiViewCalendarWithoutContext.prototype.componentDidMount = function () {
400
401
  this.calculateFocusFromValue = true;
401
402
  };
402
403
  /**
403
404
  * @hidden
404
405
  */
405
- MultiViewCalendar.prototype.componentDidUpdate = function () {
406
+ MultiViewCalendarWithoutContext.prototype.componentDidUpdate = function () {
406
407
  if (this.calendarViewList) {
407
408
  (this.isActive ? this.calendarViewList.focusActiveDate : this.calendarViewList.blurActiveDate)();
408
409
  }
@@ -416,7 +417,7 @@ var MultiViewCalendar = /** @class */ (function (_super) {
416
417
  /**
417
418
  * @hidden
418
419
  */
419
- MultiViewCalendar.prototype.render = function () {
420
+ MultiViewCalendarWithoutContext.prototype.render = function () {
420
421
  var _this = this;
421
422
  if (this.props._ref) {
422
423
  this.props._ref(this);
@@ -464,16 +465,23 @@ var MultiViewCalendar = /** @class */ (function (_super) {
464
465
  /**
465
466
  * @hidden
466
467
  */
467
- MultiViewCalendar.propTypes = {
468
+ MultiViewCalendarWithoutContext.displayName = 'MultiViewCalendar';
469
+ /**
470
+ * @hidden
471
+ */
472
+ MultiViewCalendarWithoutContext.propTypes = {
468
473
  activeRangeEnd: PropTypes.oneOf(['start', 'end']),
469
474
  allowReverse: PropTypes.bool,
470
475
  bottomView: PropTypes.oneOf(['month', 'year', 'decade', 'century']),
471
476
  className: PropTypes.string,
472
477
  defaultActiveView: PropTypes.oneOf(['month', 'year', 'decade', 'century']),
473
478
  defaultValue: PropTypes.oneOfType([
474
- PropTypes.instanceOf(Date),
479
+ nullable(PropTypes.instanceOf(Date)),
475
480
  PropTypes.arrayOf(PropTypes.instanceOf(Date)),
476
- PropTypes.shape({ start: PropTypes.instanceOf(Date), end: PropTypes.instanceOf(Date) })
481
+ PropTypes.shape({
482
+ start: nullable(PropTypes.instanceOf(Date)),
483
+ end: nullable(PropTypes.instanceOf(Date))
484
+ })
477
485
  ]),
478
486
  disabled: PropTypes.bool,
479
487
  focusedDate: PropTypes.instanceOf(Date),
@@ -489,9 +497,12 @@ var MultiViewCalendar = /** @class */ (function (_super) {
489
497
  tabIndex: PropTypes.number,
490
498
  topView: PropTypes.oneOf(['month', 'year', 'decade', 'century']),
491
499
  value: PropTypes.oneOfType([
492
- PropTypes.instanceOf(Date),
500
+ nullable(PropTypes.instanceOf(Date)),
493
501
  PropTypes.arrayOf(PropTypes.instanceOf(Date)),
494
- PropTypes.shape({ start: PropTypes.instanceOf(Date), end: PropTypes.instanceOf(Date) })
502
+ PropTypes.shape({
503
+ start: nullable(PropTypes.instanceOf(Date).isRequired),
504
+ end: nullable(PropTypes.instanceOf(Date).isRequired)
505
+ })
495
506
  ]),
496
507
  views: function (props, propName, componentName) {
497
508
  var views = props[propName];
@@ -506,7 +517,7 @@ var MultiViewCalendar = /** @class */ (function (_super) {
506
517
  /**
507
518
  * @hidden
508
519
  */
509
- MultiViewCalendar.defaultProps = {
520
+ MultiViewCalendarWithoutContext.defaultProps = {
510
521
  disabled: false,
511
522
  min: MIN_DATE,
512
523
  max: MAX_DATE,
@@ -519,8 +530,24 @@ var MultiViewCalendar = /** @class */ (function (_super) {
519
530
  views: 2,
520
531
  allowReverse: false
521
532
  };
522
- return MultiViewCalendar;
533
+ return MultiViewCalendarWithoutContext;
523
534
  }(React.Component));
524
- export { MultiViewCalendar };
525
- registerForIntl(MultiViewCalendar);
526
- registerForLocalization(MultiViewCalendar);
535
+ export { MultiViewCalendarWithoutContext };
536
+ /**
537
+ * Represents the PropsContext of the `MultiViewCalendar` component.
538
+ * Used for global configuration of all `MultiViewCalendar` instances.
539
+ *
540
+ * For more information, refer to the [DateInputs Props Context]({% slug props-context_dateinputs %}) article.
541
+ */
542
+ export var MultiViewCalendarPropsContext = createPropsContext();
543
+ /* eslint-disable @typescript-eslint/no-redeclare -- intentionally naming the component the same as the type */
544
+ /**
545
+ * Represents the KendoReact MultiViewCalendar Component.
546
+ *
547
+ * Accepts properties of type [MultiViewCalendarProps]({% slug api_dateinputs_multiviewcalendarprops %}).
548
+ * Obtaining the `ref` returns an object of type [MultiViewCalendarHandle]({% slug api_dateinputs_multiviewcalendarhandle %}).
549
+ */
550
+ export var MultiViewCalendar = withPropsContext(MultiViewCalendarPropsContext, MultiViewCalendarWithoutContext);
551
+ MultiViewCalendar.displayName = 'KendoReactMultiViewCalendar';
552
+ registerForIntl(MultiViewCalendarWithoutContext);
553
+ registerForLocalization(MultiViewCalendarWithoutContext);