@progress/kendo-react-dateinputs 5.13.0-dev.202304051130 → 5.13.0-dev.202304110959

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.
@@ -251,9 +251,9 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
251
251
  */
252
252
  CalendarWithoutContext.prototype.componentDidMount = function () {
253
253
  var _this = this;
254
- setScrollbarWidth();
255
254
  // Async calculation of height to avoid animation cancellation
256
255
  Promise.resolve().then(function () {
256
+ setScrollbarWidth();
257
257
  if (!_this._element) {
258
258
  return;
259
259
  }
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ /** @hidden */
3
+ export interface AdaptiveModeProps {
4
+ navigatable?: boolean;
5
+ navigatableElements?: string[];
6
+ expand: boolean;
7
+ animation?: boolean;
8
+ adaptiveTitle?: string | React.ReactNode;
9
+ onClose?: (event: React.SyntheticEvent) => void;
10
+ windowWidth?: number;
11
+ children: React.ReactNode;
12
+ }
13
+ /** @hidden */
14
+ export declare const AdaptiveMode: (props: AdaptiveModeProps) => JSX.Element;
@@ -0,0 +1,38 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import * as React from 'react';
13
+ import { ActionSheet, ActionSheetHeader } from '@progress/kendo-react-layout';
14
+ import { xIcon } from '@progress/kendo-svg-icons';
15
+ import { Button } from '@progress/kendo-react-buttons';
16
+ import { MOBILE_SMALL_DEVISE } from '../common/constants';
17
+ /** @hidden */
18
+ export var AdaptiveMode = function (props) {
19
+ var defaultProps = {
20
+ navigatable: props.navigatable || false,
21
+ navigatableElements: props.navigatableElements || [],
22
+ expand: props.expand,
23
+ animation: props.animation === false ? false : true,
24
+ onClose: props.onClose,
25
+ animationStyles: props.windowWidth && props.windowWidth <= MOBILE_SMALL_DEVISE ? { top: 0, width: '100%', height: '100%' } : undefined,
26
+ className: props.windowWidth && props.windowWidth <= MOBILE_SMALL_DEVISE
27
+ ? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
28
+ : 'k-adaptive-actionsheet k-actionsheet-bottom'
29
+ };
30
+ return (React.createElement(ActionSheet, __assign({}, defaultProps),
31
+ React.createElement(ActionSheetHeader, { className: 'k-text-center' },
32
+ React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
33
+ React.createElement("div", { className: "k-actionsheet-title" },
34
+ React.createElement("div", null, props.adaptiveTitle)),
35
+ React.createElement("div", { className: "k-actionsheet-actions" },
36
+ React.createElement(Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", icon: 'x', svgIcon: xIcon, onClick: props.onClose })))),
37
+ props.children));
38
+ };
@@ -0,0 +1,4 @@
1
+ /** @hidden */
2
+ export declare const MOBILE_SMALL_DEVISE: number;
3
+ /** @hidden */
4
+ export declare const MOBILE_MEDIUM_DEVISE: number;
@@ -0,0 +1,4 @@
1
+ /** @hidden */
2
+ export var MOBILE_SMALL_DEVISE = 500;
3
+ /** @hidden */
4
+ export var MOBILE_MEDIUM_DEVISE = 768;
@@ -72,6 +72,14 @@ export interface DatePickerProps extends DatePickerSettings, FormComponentProps
72
72
  * @default `solid`
73
73
  */
74
74
  fillMode?: null | 'solid' | 'flat' | 'outline';
75
+ /**
76
+ * Providing different rendering of the popup element based on the screen dimensions.
77
+ */
78
+ adaptive?: boolean;
79
+ /**
80
+ * Specifies the text that is rendered as title in the adaptive popup.
81
+ */
82
+ adaptiveTitle?: string;
75
83
  }
76
84
  /**
77
85
  * @hidden
@@ -80,6 +88,7 @@ export interface DatePickerState {
80
88
  value: Date | null;
81
89
  show: boolean;
82
90
  focused: boolean;
91
+ windowWidth?: number;
83
92
  }
84
93
  /** @hidden */
85
94
  export declare class DatePickerWithoutContext extends React.Component<DatePickerProps, DatePickerState> implements FormComponent {
@@ -146,6 +155,8 @@ export declare class DatePickerWithoutContext extends React.Component<DatePicker
146
155
  size: PropTypes.Requireable<"small" | "medium" | "large" | null | undefined>;
147
156
  rounded: PropTypes.Requireable<"small" | "medium" | "full" | "large" | null | undefined>;
148
157
  fillMode: PropTypes.Requireable<"flat" | "outline" | "solid" | null | undefined>;
158
+ adaptive: PropTypes.Requireable<boolean>;
159
+ adaptiveTitle: PropTypes.Requireable<string>;
149
160
  };
150
161
  /**
151
162
  * @hidden
@@ -184,11 +195,17 @@ export declare class DatePickerWithoutContext extends React.Component<DatePicker
184
195
  private nextTickId;
185
196
  private shouldFocusDateInput;
186
197
  private prevShow;
198
+ private observerResize?;
199
+ private get document();
187
200
  constructor(props: DatePickerProps);
188
201
  /**
189
202
  * Gets the wrapping element of the DatePickerWithoutContext.
190
203
  */
191
204
  get element(): HTMLSpanElement | null;
205
+ /**
206
+ * The mobile mode of the DatePicker.
207
+ */
208
+ get mobileMode(): boolean;
192
209
  /**
193
210
  * Gets the DateInput component inside the DatePicker component.
194
211
  */
@@ -254,6 +271,8 @@ export declare class DatePickerWithoutContext extends React.Component<DatePicker
254
271
  protected setShow(show: boolean): void;
255
272
  protected mergeTime(value: Date | null): Date | null;
256
273
  protected nextTick(f: () => any): void;
274
+ private renderPopup;
275
+ private renderAdaptivePopup;
257
276
  private handleInputValueChange;
258
277
  private handleCalendarValueChange;
259
278
  private handleValueChange;
@@ -262,6 +281,7 @@ export declare class DatePickerWithoutContext extends React.Component<DatePicker
262
281
  private handleIconClick;
263
282
  private handleIconMouseDown;
264
283
  private handleKeyDown;
284
+ private calculateMedia;
265
285
  }
266
286
  /**
267
287
  * Represents the PropsContext of the `DatePicker` component.
@@ -39,7 +39,7 @@ import * as React from 'react';
39
39
  import * as PropTypes from 'prop-types';
40
40
  import { Popup } from '@progress/kendo-react-popup';
41
41
  import { getDate, cloneDate } from '@progress/kendo-date-math';
42
- import { classNames, guid, Keys, AsyncFocusBlur, createPropsContext, withPropsContext, validatePackage, kendoThemeMaps } from '@progress/kendo-react-common';
42
+ import { classNames, guid, Keys, AsyncFocusBlur, createPropsContext, withPropsContext, validatePackage, kendoThemeMaps, canUseDOM } from '@progress/kendo-react-common';
43
43
  import { calendarIcon } from '@progress/kendo-svg-icons';
44
44
  import { packageMetadata } from '../package-metadata';
45
45
  import { DateInput } from '../dateinput/DateInput';
@@ -51,6 +51,9 @@ import { registerForLocalization, provideLocalizationService } from '@progress/k
51
51
  import { ToggleButton } from './ToggleButton';
52
52
  import { PickerWrap } from '../common/PickerWrap';
53
53
  import { PickerFloatingLabel } from '../hooks/usePickerFloatingLabel';
54
+ import { ActionSheetContent } from '@progress/kendo-react-layout';
55
+ import { AdaptiveMode } from '../common/AdaptiveMode';
56
+ import { MOBILE_MEDIUM_DEVISE } from '../common/constants';
54
57
  /** @hidden */
55
58
  var DatePickerWithoutContext = /** @class */ (function (_super) {
56
59
  __extends(DatePickerWithoutContext, _super);
@@ -83,6 +86,46 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
83
86
  ? nextProps.show
84
87
  : nextState.show;
85
88
  };
89
+ _this.renderPopup = function () {
90
+ var _a = _this.props, disabled = _a.disabled, min = _a.min, max = _a.max, weekNumber = _a.weekNumber, focusedDate = _a.focusedDate;
91
+ var _b = _this.props.popupSettings, popupClass = _b.popupClass, otherPopupSettings = __rest(_b, ["popupClass"]);
92
+ var show = _this.show;
93
+ var value = _this.value;
94
+ var sanitizedValue = value && getDate(value);
95
+ var popupClassNames = classNames('k-calendar-container k-group k-reset', popupClass);
96
+ var popupProps = __assign({ popupClass: 'k-datepicker-popup', show: show, anchor: _this._element, className: popupClassNames, id: _this._popupId, anchorAlign: {
97
+ horizontal: 'left',
98
+ vertical: 'bottom'
99
+ }, popupAlign: {
100
+ horizontal: 'left',
101
+ vertical: 'top'
102
+ } }, otherPopupSettings);
103
+ var calendarProps = {
104
+ disabled: disabled,
105
+ value: sanitizedValue,
106
+ min: min,
107
+ max: max,
108
+ weekNumber: weekNumber,
109
+ focusedDate: focusedDate,
110
+ onChange: _this.handleCalendarValueChange
111
+ };
112
+ if (_this.mobileMode) {
113
+ return React.createElement(_this.calendarComp, __assign({ _ref: _this.setCalendarRef }, calendarProps));
114
+ }
115
+ return (React.createElement(_this.popupComp, __assign({}, popupProps),
116
+ React.createElement(_this.calendarComp, __assign({ _ref: _this.setCalendarRef }, calendarProps))));
117
+ };
118
+ _this.renderAdaptivePopup = function () {
119
+ var _a = _this.state.windowWidth, windowWidth = _a === void 0 ? 0 : _a;
120
+ var actionSheetProps = {
121
+ expand: _this.show,
122
+ onClose: _this.handleBlur,
123
+ adaptiveTitle: _this.props.adaptiveTitle,
124
+ windowWidth: windowWidth
125
+ };
126
+ return (React.createElement(AdaptiveMode, __assign({}, actionSheetProps),
127
+ React.createElement(ActionSheetContent, { className: '!k-overflow-hidden' }, _this.renderPopup())));
128
+ };
86
129
  _this.handleInputValueChange = function (event) {
87
130
  _this.handleValueChange(event.value, event);
88
131
  };
@@ -150,6 +193,17 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
150
193
  };
151
194
  return _this;
152
195
  }
196
+ Object.defineProperty(DatePickerWithoutContext.prototype, "document", {
197
+ get: function () {
198
+ if (!canUseDOM) {
199
+ return;
200
+ }
201
+ // useful only for user actions
202
+ return (this.element && this.element.ownerDocument) || document;
203
+ },
204
+ enumerable: false,
205
+ configurable: true
206
+ });
153
207
  Object.defineProperty(DatePickerWithoutContext.prototype, "element", {
154
208
  /**
155
209
  * Gets the wrapping element of the DatePickerWithoutContext.
@@ -160,6 +214,17 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
160
214
  enumerable: false,
161
215
  configurable: true
162
216
  });
217
+ Object.defineProperty(DatePickerWithoutContext.prototype, "mobileMode", {
218
+ /**
219
+ * The mobile mode of the DatePicker.
220
+ */
221
+ get: function () {
222
+ var isAdaptive = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE && this.props.adaptive;
223
+ return !!isAdaptive;
224
+ },
225
+ enumerable: false,
226
+ configurable: true
227
+ });
163
228
  Object.defineProperty(DatePickerWithoutContext.prototype, "dateInput", {
164
229
  /**
165
230
  * Gets the DateInput component inside the DatePicker component.
@@ -320,10 +385,15 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
320
385
  * @hidden
321
386
  */
322
387
  DatePickerWithoutContext.prototype.componentDidMount = function () {
388
+ var _a;
389
+ this.observerResize = canUseDOM && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this));
323
390
  if (this.show) {
324
391
  // If defaultShow is true during the initial render, the popup is not aligned.
325
392
  this.forceUpdate();
326
393
  }
394
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
395
+ this.observerResize.observe(this.document.body);
396
+ }
327
397
  };
328
398
  /**
329
399
  * @hidden
@@ -345,20 +415,23 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
345
415
  * @hidden
346
416
  */
347
417
  DatePickerWithoutContext.prototype.componentWillUnmount = function () {
418
+ var _a;
348
419
  clearTimeout(this.nextTickId);
420
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
421
+ this.observerResize.disconnect();
422
+ }
349
423
  };
350
424
  /**
351
425
  * @hidden
352
426
  */
353
427
  DatePickerWithoutContext.prototype.render = function () {
354
428
  var _this = this;
355
- var _a = this.props, _b = _a.size, size = _b === void 0 ? DatePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? DatePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? DatePickerWithoutContext.defaultProps.fillMode : _d, disabled = _a.disabled, tabIndex = _a.tabIndex, title = _a.title, id = _a.id, format = _a.format, formatPlaceholder = _a.formatPlaceholder, min = _a.min, max = _a.max, weekNumber = _a.weekNumber, focusedDate = _a.focusedDate, className = _a.className, width = _a.width, name = _a.name, validationMessage = _a.validationMessage, required = _a.required, validityStyles = _a.validityStyles, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy, ariaLabel = _a.ariaLabel;
356
- var _e = this.props.popupSettings, popupClass = _e.popupClass, otherPopupSettings = __rest(_e, ["popupClass"]);
429
+ var _a = this.props, _b = _a.size, size = _b === void 0 ? DatePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? DatePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? DatePickerWithoutContext.defaultProps.fillMode : _d, disabled = _a.disabled, tabIndex = _a.tabIndex, title = _a.title, id = _a.id, format = _a.format, formatPlaceholder = _a.formatPlaceholder, min = _a.min, max = _a.max, className = _a.className, width = _a.width, name = _a.name, validationMessage = _a.validationMessage, required = _a.required, validityStyles = _a.validityStyles, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy, ariaLabel = _a.ariaLabel, adaptive = _a.adaptive;
430
+ var _e = this.state.windowWidth, windowWidth = _e === void 0 ? 0 : _e;
357
431
  var show = this.show;
358
432
  var value = this.value;
359
- var sanitizedValue = value && getDate(value);
360
433
  var isValid = !this.validityStyles || this.validity.valid;
361
- var popupClassNames = classNames('k-calendar-container k-group k-reset', popupClass);
434
+ var renderAdaptive = windowWidth <= MOBILE_MEDIUM_DEVISE && adaptive;
362
435
  var dateInputProps = {
363
436
  disabled: disabled,
364
437
  format: format,
@@ -385,39 +458,24 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
385
458
  fillMode: null,
386
459
  rounded: null
387
460
  };
388
- var popupProps = __assign({ popupClass: 'k-datepicker-popup', show: show, anchor: this._element, className: popupClassNames, id: this._popupId, anchorAlign: {
389
- horizontal: 'left',
390
- vertical: 'bottom'
391
- }, popupAlign: {
392
- horizontal: 'left',
393
- vertical: 'top'
394
- } }, otherPopupSettings);
395
- var calendarProps = {
396
- disabled: disabled,
397
- value: sanitizedValue,
398
- min: min,
399
- max: max,
400
- weekNumber: weekNumber,
401
- focusedDate: focusedDate,
402
- onChange: this.handleCalendarValueChange
403
- };
404
461
  var toggleButtonTitle = provideLocalizationService(this)
405
462
  .toLanguageString(toggleCalendar, messages[toggleCalendar]);
406
463
  var datepicker = (React.createElement(AsyncFocusBlur, { onFocus: this.handleFocus, onBlur: this.handleBlur, onSyncBlur: this.props.onBlur, onSyncFocus: this.props.onFocus }, function (_a) {
407
464
  var _b;
408
465
  var onFocus = _a.onFocus, onBlur = _a.onBlur;
409
- return (React.createElement("span", { ref: function (span) { _this._element = span; }, className: classNames('k-input', 'k-datepicker', (_b = {},
410
- _b["k-input-".concat(kendoThemeMaps.sizeMap[size] || size)] = size,
411
- _b["k-rounded-".concat(kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
412
- _b["k-input-".concat(fillMode)] = fillMode,
413
- _b['k-invalid'] = !isValid,
414
- _b['k-required'] = _this.required,
415
- _b['k-disabled'] = _this.props.disabled,
416
- _b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: onFocus, onBlur: onBlur },
417
- React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: 'combobox', ariaExpanded: _this.show, ariaControls: _this._popupId }, dateInputProps)),
418
- React.createElement(_this.toggleButtonComp, { type: "button", icon: "calendar", svgIcon: calendarIcon, title: toggleButtonTitle, className: "k-input-button", rounded: null, onClick: _this.handleIconClick, "aria-label": toggleButtonTitle, onMouseDown: _this.handleIconMouseDown }),
419
- React.createElement(_this.popupComp, __assign({}, popupProps),
420
- React.createElement(_this.calendarComp, __assign({ _ref: _this.setCalendarRef }, calendarProps)))));
466
+ return (React.createElement(React.Fragment, null,
467
+ React.createElement("span", { ref: function (span) { _this._element = span; }, className: classNames('k-input', 'k-datepicker', (_b = {},
468
+ _b["k-input-".concat(kendoThemeMaps.sizeMap[size] || size)] = size,
469
+ _b["k-rounded-".concat(kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
470
+ _b["k-input-".concat(fillMode)] = fillMode,
471
+ _b['k-invalid'] = !isValid,
472
+ _b['k-required'] = _this.required,
473
+ _b['k-disabled'] = _this.props.disabled,
474
+ _b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: onFocus, onBlur: onBlur },
475
+ React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: 'combobox', ariaExpanded: _this.show, ariaControls: _this._popupId }, dateInputProps)),
476
+ React.createElement(_this.toggleButtonComp, { type: "button", icon: "calendar", svgIcon: calendarIcon, title: toggleButtonTitle, className: "k-input-button", rounded: null, onClick: _this.handleIconClick, "aria-label": toggleButtonTitle, onMouseDown: _this.handleIconMouseDown }),
477
+ !renderAdaptive && _this.renderPopup()),
478
+ renderAdaptive && _this.renderAdaptivePopup()));
421
479
  }));
422
480
  return this.props.label
423
481
  ? (React.createElement(PickerFloatingLabel, { dateInput: this._dateInput, label: this.props.label, editorId: id, editorValid: isValid, editorDisabled: this.props.disabled, children: datepicker, style: { width: this.props.width } }))
@@ -439,6 +497,14 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
439
497
  clearTimeout(this.nextTickId);
440
498
  this.nextTickId = window.setTimeout(function () { return f(); });
441
499
  };
500
+ DatePickerWithoutContext.prototype.calculateMedia = function (entries) {
501
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
502
+ var entry = entries_1[_i];
503
+ this.setState({ windowWidth: entry.target.clientWidth });
504
+ }
505
+ ;
506
+ };
507
+ ;
442
508
  /**
443
509
  * @hidden
444
510
  */
@@ -507,7 +573,9 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
507
573
  valid: PropTypes.bool,
508
574
  size: PropTypes.oneOf([null, 'small', 'medium', 'large']),
509
575
  rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']),
510
- fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline'])
576
+ fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']),
577
+ adaptive: PropTypes.bool,
578
+ adaptiveTitle: PropTypes.string
511
579
  };
512
580
  /**
513
581
  * @hidden
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-dateinputs',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1680692205,
8
+ publishDate: 1681205843,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -254,9 +254,9 @@ var CalendarWithoutContext = /** @class */ (function (_super) {
254
254
  */
255
255
  CalendarWithoutContext.prototype.componentDidMount = function () {
256
256
  var _this = this;
257
- (0, kendo_react_common_1.setScrollbarWidth)();
258
257
  // Async calculation of height to avoid animation cancellation
259
258
  Promise.resolve().then(function () {
259
+ (0, kendo_react_common_1.setScrollbarWidth)();
260
260
  if (!_this._element) {
261
261
  return;
262
262
  }
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ /** @hidden */
3
+ export interface AdaptiveModeProps {
4
+ navigatable?: boolean;
5
+ navigatableElements?: string[];
6
+ expand: boolean;
7
+ animation?: boolean;
8
+ adaptiveTitle?: string | React.ReactNode;
9
+ onClose?: (event: React.SyntheticEvent) => void;
10
+ windowWidth?: number;
11
+ children: React.ReactNode;
12
+ }
13
+ /** @hidden */
14
+ export declare const AdaptiveMode: (props: AdaptiveModeProps) => JSX.Element;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.AdaptiveMode = void 0;
15
+ var React = require("react");
16
+ var kendo_react_layout_1 = require("@progress/kendo-react-layout");
17
+ var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
18
+ var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
19
+ var constants_1 = require("../common/constants");
20
+ /** @hidden */
21
+ var AdaptiveMode = function (props) {
22
+ var defaultProps = {
23
+ navigatable: props.navigatable || false,
24
+ navigatableElements: props.navigatableElements || [],
25
+ expand: props.expand,
26
+ animation: props.animation === false ? false : true,
27
+ onClose: props.onClose,
28
+ animationStyles: props.windowWidth && props.windowWidth <= constants_1.MOBILE_SMALL_DEVISE ? { top: 0, width: '100%', height: '100%' } : undefined,
29
+ className: props.windowWidth && props.windowWidth <= constants_1.MOBILE_SMALL_DEVISE
30
+ ? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
31
+ : 'k-adaptive-actionsheet k-actionsheet-bottom'
32
+ };
33
+ return (React.createElement(kendo_react_layout_1.ActionSheet, __assign({}, defaultProps),
34
+ React.createElement(kendo_react_layout_1.ActionSheetHeader, { className: 'k-text-center' },
35
+ React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
36
+ React.createElement("div", { className: "k-actionsheet-title" },
37
+ React.createElement("div", null, props.adaptiveTitle)),
38
+ React.createElement("div", { className: "k-actionsheet-actions" },
39
+ React.createElement(kendo_react_buttons_1.Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", icon: 'x', svgIcon: kendo_svg_icons_1.xIcon, onClick: props.onClose })))),
40
+ props.children));
41
+ };
42
+ exports.AdaptiveMode = AdaptiveMode;
@@ -0,0 +1,4 @@
1
+ /** @hidden */
2
+ export declare const MOBILE_SMALL_DEVISE: number;
3
+ /** @hidden */
4
+ export declare const MOBILE_MEDIUM_DEVISE: number;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MOBILE_MEDIUM_DEVISE = exports.MOBILE_SMALL_DEVISE = void 0;
4
+ /** @hidden */
5
+ exports.MOBILE_SMALL_DEVISE = 500;
6
+ /** @hidden */
7
+ exports.MOBILE_MEDIUM_DEVISE = 768;
@@ -72,6 +72,14 @@ export interface DatePickerProps extends DatePickerSettings, FormComponentProps
72
72
  * @default `solid`
73
73
  */
74
74
  fillMode?: null | 'solid' | 'flat' | 'outline';
75
+ /**
76
+ * Providing different rendering of the popup element based on the screen dimensions.
77
+ */
78
+ adaptive?: boolean;
79
+ /**
80
+ * Specifies the text that is rendered as title in the adaptive popup.
81
+ */
82
+ adaptiveTitle?: string;
75
83
  }
76
84
  /**
77
85
  * @hidden
@@ -80,6 +88,7 @@ export interface DatePickerState {
80
88
  value: Date | null;
81
89
  show: boolean;
82
90
  focused: boolean;
91
+ windowWidth?: number;
83
92
  }
84
93
  /** @hidden */
85
94
  export declare class DatePickerWithoutContext extends React.Component<DatePickerProps, DatePickerState> implements FormComponent {
@@ -146,6 +155,8 @@ export declare class DatePickerWithoutContext extends React.Component<DatePicker
146
155
  size: PropTypes.Requireable<"small" | "medium" | "large" | null | undefined>;
147
156
  rounded: PropTypes.Requireable<"small" | "medium" | "full" | "large" | null | undefined>;
148
157
  fillMode: PropTypes.Requireable<"flat" | "outline" | "solid" | null | undefined>;
158
+ adaptive: PropTypes.Requireable<boolean>;
159
+ adaptiveTitle: PropTypes.Requireable<string>;
149
160
  };
150
161
  /**
151
162
  * @hidden
@@ -184,11 +195,17 @@ export declare class DatePickerWithoutContext extends React.Component<DatePicker
184
195
  private nextTickId;
185
196
  private shouldFocusDateInput;
186
197
  private prevShow;
198
+ private observerResize?;
199
+ private get document();
187
200
  constructor(props: DatePickerProps);
188
201
  /**
189
202
  * Gets the wrapping element of the DatePickerWithoutContext.
190
203
  */
191
204
  get element(): HTMLSpanElement | null;
205
+ /**
206
+ * The mobile mode of the DatePicker.
207
+ */
208
+ get mobileMode(): boolean;
192
209
  /**
193
210
  * Gets the DateInput component inside the DatePicker component.
194
211
  */
@@ -254,6 +271,8 @@ export declare class DatePickerWithoutContext extends React.Component<DatePicker
254
271
  protected setShow(show: boolean): void;
255
272
  protected mergeTime(value: Date | null): Date | null;
256
273
  protected nextTick(f: () => any): void;
274
+ private renderPopup;
275
+ private renderAdaptivePopup;
257
276
  private handleInputValueChange;
258
277
  private handleCalendarValueChange;
259
278
  private handleValueChange;
@@ -262,6 +281,7 @@ export declare class DatePickerWithoutContext extends React.Component<DatePicker
262
281
  private handleIconClick;
263
282
  private handleIconMouseDown;
264
283
  private handleKeyDown;
284
+ private calculateMedia;
265
285
  }
266
286
  /**
267
287
  * Represents the PropsContext of the `DatePicker` component.