@progress/kendo-react-dateinputs 5.14.0-dev.202305151331 → 5.14.0-dev.202305191608

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.
@@ -142,7 +142,9 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
142
142
  });
143
143
  _this.valueDuringOnChange = value;
144
144
  _this.showDuringOnChange = false;
145
- _this.shouldFocusDateInput = true;
145
+ if (!_this.mobileMode) {
146
+ _this.shouldFocusDateInput = true;
147
+ }
146
148
  var onChange = _this.props.onChange;
147
149
  if (onChange) {
148
150
  onChange.call(undefined, {
@@ -428,12 +430,10 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
428
430
  */
429
431
  DatePickerWithoutContext.prototype.render = function () {
430
432
  var _this = this;
431
- 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;
432
- var _e = this.state.windowWidth, windowWidth = _e === void 0 ? 0 : _e;
433
+ 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;
433
434
  var show = this.show;
434
435
  var value = this.value;
435
436
  var isValid = !this.validityStyles || this.validity.valid;
436
- var renderAdaptive = windowWidth <= MOBILE_MEDIUM_DEVISE && adaptive;
437
437
  var dateInputProps = {
438
438
  disabled: disabled,
439
439
  format: format,
@@ -476,8 +476,8 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
476
476
  _b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: onFocus, onBlur: onBlur, onClick: _this.mobileMode ? _this.handleIconClick : undefined },
477
477
  React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: 'combobox', readonly: _this.mobileMode, ariaExpanded: _this.show, ariaControls: _this._popupId }, dateInputProps)),
478
478
  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 }),
479
- !renderAdaptive && _this.renderPopup()),
480
- renderAdaptive && _this.renderAdaptivePopup()));
479
+ !_this.mobileMode && _this.renderPopup()),
480
+ _this.mobileMode && _this.renderAdaptivePopup()));
481
481
  }));
482
482
  return this.props.label
483
483
  ? (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 } }))
@@ -74,6 +74,14 @@ export interface DateTimePickerProps extends DateTimePickerSettings, FormCompone
74
74
  * @default `solid`
75
75
  */
76
76
  fillMode?: null | 'solid' | 'flat' | 'outline';
77
+ /**
78
+ * Providing different rendering of the popup element based on the screen dimensions.
79
+ */
80
+ adaptive?: boolean;
81
+ /**
82
+ * Specifies the text that is rendered as title in the adaptive popup.
83
+ */
84
+ adaptiveTitle?: string;
77
85
  }
78
86
  /**
79
87
  * @hidden
@@ -82,6 +90,7 @@ export interface DateTimePickerState {
82
90
  value: Date | null;
83
91
  show: boolean;
84
92
  focused: boolean;
93
+ windowWidth?: number;
85
94
  }
86
95
  /** @hidden */
87
96
  export declare class DateTimePickerWithoutContext extends React.Component<DateTimePickerProps, DateTimePickerState> implements FormComponent {
@@ -183,6 +192,8 @@ export declare class DateTimePickerWithoutContext extends React.Component<DateTi
183
192
  private nextTickId;
184
193
  private shouldFocusDateInput;
185
194
  private prevShow;
195
+ private observerResize?;
196
+ private get document();
186
197
  constructor(props: DateTimePickerProps);
187
198
  /**
188
199
  * Gets the wrapping element of the DateTimePicker.
@@ -204,6 +215,10 @@ export declare class DateTimePickerWithoutContext extends React.Component<DateTi
204
215
  * Gets the `name` property of the DateTimePicker.
205
216
  */
206
217
  get name(): string | undefined;
218
+ /**
219
+ * The mobile mode of the ComboBox.
220
+ */
221
+ get mobileMode(): boolean;
207
222
  protected get min(): Date;
208
223
  protected get max(): Date;
209
224
  /**
@@ -242,6 +257,8 @@ export declare class DateTimePickerWithoutContext extends React.Component<DateTi
242
257
  * @hidden
243
258
  */
244
259
  render(): JSX.Element;
260
+ private renderPicker;
261
+ private renderAdaptivePopup;
245
262
  protected setShow(show: boolean): void;
246
263
  protected nextTick(f: () => any): void;
247
264
  private handleReject;
@@ -252,6 +269,7 @@ export declare class DateTimePickerWithoutContext extends React.Component<DateTi
252
269
  private handleIconMouseDown;
253
270
  private handleKeyDown;
254
271
  private dateInputElement;
272
+ private calculateMedia;
255
273
  }
256
274
  /**
257
275
  * Represents the PropsContext of the `DateTimePicker` component.
@@ -31,16 +31,19 @@ import { cloneDate } from '@progress/kendo-date-math';
31
31
  import { classNames, guid, Keys, AsyncFocusBlur, createPropsContext, withPropsContext, kendoThemeMaps } from '@progress/kendo-react-common';
32
32
  import { calendarIcon } from '@progress/kendo-svg-icons';
33
33
  import { DateInput } from '../dateinput/DateInput';
34
- import { validatePackage } from '@progress/kendo-react-common';
34
+ import { validatePackage, canUseDOM } from '@progress/kendo-react-common';
35
35
  import { Button } from '@progress/kendo-react-buttons';
36
36
  import { packageMetadata } from '../package-metadata';
37
37
  import { MIN_DATE, MAX_DATE, isInDateRange, MAX_TIME } from '../utils';
38
- import { messages, toggleDateTimeSelector } from '../messages';
38
+ import { MOBILE_MEDIUM_DEVISE } from '../common/constants';
39
+ import { dateTimePickerCancel, dateTimePickerSet, messages, toggleDateTimeSelector } from '../messages';
39
40
  import { registerForLocalization, provideLocalizationService } from '@progress/kendo-react-intl';
40
41
  import { DateTimeSelector } from './DateTimeSelector';
41
42
  import { isInTimeRange } from '../timepicker/utils';
42
43
  import { MIN_TIME } from '../utils';
43
44
  import { PickerFloatingLabel } from '../hooks/usePickerFloatingLabel';
45
+ import { AdaptiveMode } from '../common/AdaptiveMode';
46
+ import { ActionSheetContent } from '@progress/kendo-react-layout';
44
47
  /** @hidden */
45
48
  var DateTimePickerWithoutContext = /** @class */ (function (_super) {
46
49
  __extends(DateTimePickerWithoutContext, _super);
@@ -61,6 +64,31 @@ var DateTimePickerWithoutContext = /** @class */ (function (_super) {
61
64
  dateInputElement.focus();
62
65
  }
63
66
  };
67
+ _this.renderPicker = function () {
68
+ var _a = _this.props, disabled = _a.disabled, minTime = _a.minTime, maxTime = _a.maxTime, format = _a.format, calendar = _a.calendar, cancelButton = _a.cancelButton, weekNumber = _a.weekNumber, focusedDate = _a.focusedDate;
69
+ return (React.createElement(DateTimeSelector, { ref: function (dateTimeSelector) { _this._dateTimeSelector = dateTimeSelector; }, cancelButton: cancelButton, steps: _this.props.steps, value: _this.value, onChange: _this.handleValueChange, onReject: _this.handleReject, disabled: disabled, weekNumber: weekNumber, min: _this.min, max: _this.max, minTime: minTime, maxTime: maxTime, focusedDate: focusedDate, format: format, calendar: calendar, mobileMode: _this.mobileMode, footerActions: !_this.mobileMode }));
70
+ };
71
+ _this.renderAdaptivePopup = function () {
72
+ var _a = _this.state.windowWidth, windowWidth = _a === void 0 ? 0 : _a;
73
+ var cancelText = provideLocalizationService(_this)
74
+ .toLanguageString(dateTimePickerCancel, messages[dateTimePickerCancel]);
75
+ var applyText = provideLocalizationService(_this)
76
+ .toLanguageString(dateTimePickerSet, messages[dateTimePickerSet]);
77
+ var actionSheetProps = {
78
+ expand: _this.show,
79
+ onClose: _this.handleBlur,
80
+ adaptiveTitle: _this.props.adaptiveTitle,
81
+ windowWidth: windowWidth,
82
+ footer: {
83
+ cancelText: cancelText,
84
+ onCancel: function (event) { var _a; return (_a = _this._dateTimeSelector) === null || _a === void 0 ? void 0 : _a.handleReject(event); },
85
+ applyText: applyText,
86
+ onApply: function (event) { var _a; return (_a = _this._dateTimeSelector) === null || _a === void 0 ? void 0 : _a.handleAccept(event); }
87
+ }
88
+ };
89
+ return (React.createElement(AdaptiveMode, __assign({}, actionSheetProps),
90
+ React.createElement(ActionSheetContent, { className: '!k-overflow-hidden' }, _this.renderPicker())));
91
+ };
64
92
  _this.handleReject = function () {
65
93
  _this.shouldFocusDateInput = true;
66
94
  _this.setShow(false);
@@ -72,7 +100,9 @@ var DateTimePickerWithoutContext = /** @class */ (function (_super) {
72
100
  });
73
101
  _this.valueDuringOnChange = event.value;
74
102
  _this.showDuringOnChange = false;
75
- _this.shouldFocusDateInput = true;
103
+ if (!_this.mobileMode) {
104
+ _this.shouldFocusDateInput = true;
105
+ }
76
106
  var onChange = _this.props.onChange;
77
107
  if (onChange) {
78
108
  onChange.call(undefined, {
@@ -129,6 +159,17 @@ var DateTimePickerWithoutContext = /** @class */ (function (_super) {
129
159
  };
130
160
  return _this;
131
161
  }
162
+ Object.defineProperty(DateTimePickerWithoutContext.prototype, "document", {
163
+ get: function () {
164
+ if (!canUseDOM) {
165
+ return;
166
+ }
167
+ // useful only for user actions
168
+ return (this.element && this.element.ownerDocument) || document;
169
+ },
170
+ enumerable: false,
171
+ configurable: true
172
+ });
132
173
  Object.defineProperty(DateTimePickerWithoutContext.prototype, "element", {
133
174
  /**
134
175
  * Gets the wrapping element of the DateTimePicker.
@@ -188,6 +229,17 @@ var DateTimePickerWithoutContext = /** @class */ (function (_super) {
188
229
  enumerable: false,
189
230
  configurable: true
190
231
  });
232
+ Object.defineProperty(DateTimePickerWithoutContext.prototype, "mobileMode", {
233
+ /**
234
+ * The mobile mode of the ComboBox.
235
+ */
236
+ get: function () {
237
+ var isAdaptive = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE && this.props.adaptive;
238
+ return !!isAdaptive;
239
+ },
240
+ enumerable: false,
241
+ configurable: true
242
+ });
191
243
  Object.defineProperty(DateTimePickerWithoutContext.prototype, "min", {
192
244
  get: function () {
193
245
  return this.props.min !== undefined
@@ -265,10 +317,15 @@ var DateTimePickerWithoutContext = /** @class */ (function (_super) {
265
317
  * @hidden
266
318
  */
267
319
  DateTimePickerWithoutContext.prototype.componentDidMount = function () {
320
+ var _a;
321
+ this.observerResize = canUseDOM && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this));
268
322
  if (this.show) {
269
323
  // If defaultShow is true during the initial render, the popup is not aligned.
270
324
  this.forceUpdate();
271
325
  }
326
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
327
+ this.observerResize.observe(this.document.body);
328
+ }
272
329
  };
273
330
  /**
274
331
  * @hidden
@@ -290,14 +347,18 @@ var DateTimePickerWithoutContext = /** @class */ (function (_super) {
290
347
  * @hidden
291
348
  */
292
349
  DateTimePickerWithoutContext.prototype.componentWillUnmount = function () {
350
+ var _a;
293
351
  clearTimeout(this.nextTickId);
352
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
353
+ this.observerResize.disconnect();
354
+ }
294
355
  };
295
356
  /**
296
357
  * @hidden
297
358
  */
298
359
  DateTimePickerWithoutContext.prototype.render = function () {
299
360
  var _this = this;
300
- var _a = this.props, _b = _a.size, size = _b === void 0 ? DateTimePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? DateTimePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? DateTimePickerWithoutContext.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, cancelButton = _a.cancelButton, minTime = _a.minTime, maxTime = _a.maxTime, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy, _e = _a.popup, PopupComponent = _e === void 0 ? Popup : _e, calendar = _a.calendar;
361
+ var _a = this.props, _b = _a.size, size = _b === void 0 ? DateTimePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? DateTimePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? DateTimePickerWithoutContext.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, minTime = _a.minTime, maxTime = _a.maxTime, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy, _e = _a.popup, PopupComponent = _e === void 0 ? Popup : _e;
301
362
  var isValid = !this.validityStyles || this.validity.valid;
302
363
  var dataInputProps = {
303
364
  id: id,
@@ -330,30 +391,31 @@ var DateTimePickerWithoutContext = /** @class */ (function (_super) {
330
391
  var dateTimePicker = (React.createElement(AsyncFocusBlur, { onFocus: this.handleFocus, onBlur: this.handleBlur, onSyncFocus: this.props.onFocus, onSyncBlur: this.props.onBlur }, function (_a) {
331
392
  var _b;
332
393
  var onFocus = _a.onFocus, onBlur = _a.onBlur;
333
- return (React.createElement("div", { ref: function (div) {
334
- _this._element = div;
335
- }, className: classNames('k-input', 'k-datetimepicker', (_b = {},
336
- _b["k-input-".concat(kendoThemeMaps.sizeMap[size] || size)] = size,
337
- _b["k-rounded-".concat(kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
338
- _b["k-input-".concat(fillMode)] = fillMode,
339
- _b['k-invalid'] = !isValid,
340
- _b['k-required'] = _this.required,
341
- _b['k-disabled'] = _this.props.disabled,
342
- _b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: onFocus, onBlur: onBlur },
343
- React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: "combobox", ariaControls: _this._popupId }, dataInputProps)),
344
- React.createElement(Button, __assign({ tabIndex: -1, type: "button", icon: 'calendar', svgIcon: calendarIcon, onMouseDown: _this.handleIconMouseDown, onClick: _this.handleDateIconClick, title: provideLocalizationService(_this)
345
- .toLanguageString(toggleDateTimeSelector, messages[toggleDateTimeSelector]), className: "k-input-button", rounded: null }, {
346
- 'aria-label': provideLocalizationService(_this)
347
- .toLanguageString(toggleDateTimeSelector, messages[toggleDateTimeSelector])
348
- })),
349
- React.createElement(PopupComponent, { show: _this.show, animate: _this.element !== null, anchor: _this.element, popupClass: "k-datetime-container k-reset", id: _this._popupId, anchorAlign: {
350
- horizontal: 'left',
351
- vertical: 'bottom'
352
- }, popupAlign: {
353
- horizontal: 'left',
354
- vertical: 'top'
355
- } },
356
- React.createElement(DateTimeSelector, { ref: function (dateTimeSelector) { _this._dateTimeSelector = dateTimeSelector; }, cancelButton: cancelButton, steps: _this.props.steps, value: _this.value, onChange: _this.handleValueChange, onReject: _this.handleReject, disabled: disabled, weekNumber: weekNumber, min: _this.min, max: _this.max, minTime: minTime, maxTime: maxTime, focusedDate: focusedDate, format: format, calendar: calendar }))));
394
+ return (React.createElement(React.Fragment, null,
395
+ React.createElement("div", { ref: function (div) {
396
+ _this._element = div;
397
+ }, className: classNames('k-input', 'k-datetimepicker', (_b = {},
398
+ _b["k-input-".concat(kendoThemeMaps.sizeMap[size] || size)] = size,
399
+ _b["k-rounded-".concat(kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
400
+ _b["k-input-".concat(fillMode)] = fillMode,
401
+ _b['k-invalid'] = !isValid,
402
+ _b['k-required'] = _this.required,
403
+ _b['k-disabled'] = _this.props.disabled,
404
+ _b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: !_this.mobileMode ? onFocus : undefined, onBlur: onBlur, onClick: _this.mobileMode ? _this.handleDateIconClick : undefined },
405
+ React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: "combobox", ariaControls: _this._popupId, readonly: _this.mobileMode }, dataInputProps)),
406
+ React.createElement(Button, __assign({ tabIndex: -1, type: "button", icon: 'calendar', svgIcon: calendarIcon, onMouseDown: _this.handleIconMouseDown, onClick: _this.handleDateIconClick, title: provideLocalizationService(_this)
407
+ .toLanguageString(toggleDateTimeSelector, messages[toggleDateTimeSelector]), className: "k-input-button", rounded: null }, {
408
+ 'aria-label': provideLocalizationService(_this)
409
+ .toLanguageString(toggleDateTimeSelector, messages[toggleDateTimeSelector])
410
+ })),
411
+ React.createElement(PopupComponent, { show: _this.show, animate: _this.element !== null, anchor: _this.element, popupClass: "k-datetime-container k-reset", id: _this._popupId, anchorAlign: {
412
+ horizontal: 'left',
413
+ vertical: 'bottom'
414
+ }, popupAlign: {
415
+ horizontal: 'left',
416
+ vertical: 'top'
417
+ } }, !_this.mobileMode && _this.renderPicker())),
418
+ _this.mobileMode && _this.renderAdaptivePopup()));
357
419
  }));
358
420
  return this.props.label
359
421
  ? (React.createElement(PickerFloatingLabel, { dateInput: this._dateInput, label: this.props.label, editorId: id, editorValid: isValid, editorDisabled: this.props.disabled, children: dateTimePicker, style: { width: this.props.width } }))
@@ -372,6 +434,14 @@ var DateTimePickerWithoutContext = /** @class */ (function (_super) {
372
434
  clearTimeout(this.nextTickId);
373
435
  this.nextTickId = window.setTimeout(function () { return f(); });
374
436
  };
437
+ DateTimePickerWithoutContext.prototype.calculateMedia = function (entries) {
438
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
439
+ var entry = entries_1[_i];
440
+ this.setState({ windowWidth: entry.target.clientWidth });
441
+ }
442
+ ;
443
+ };
444
+ ;
375
445
  /**
376
446
  * @hidden
377
447
  */
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { DateFormatOptions } from '@progress/kendo-react-intl';
2
+ import { LocalizationService, DateFormatOptions } from '@progress/kendo-react-intl';
3
3
  import { Calendar, CalendarProps } from '../calendar/components/Calendar';
4
4
  import { TimePart } from '../timepicker/TimePart';
5
5
  import { DateInputIncrementalSteps } from '../dateinput/models';
@@ -41,6 +41,8 @@ export interface DateTimeSelectorProps<T = DateTimeSelector> {
41
41
  format?: string | DateFormatOptions;
42
42
  calendar?: React.ComponentType<CalendarProps<any>>;
43
43
  steps?: DateInputIncrementalSteps;
44
+ mobileMode?: boolean;
45
+ footerActions?: boolean;
44
46
  }
45
47
  /**
46
48
  * @hidden
@@ -54,6 +56,12 @@ export interface DateTimeSelectorState {
54
56
  * @hidden
55
57
  */
56
58
  export declare class DateTimeSelector extends React.Component<DateTimeSelectorProps, DateTimeSelectorState> {
59
+ /**
60
+ * @hidden
61
+ */
62
+ static defaultProps: {
63
+ footerActions: boolean;
64
+ };
57
65
  private _calendar;
58
66
  private _timePart;
59
67
  private _cancelButton;
@@ -63,6 +71,7 @@ export declare class DateTimeSelector extends React.Component<DateTimeSelectorPr
63
71
  get calendar(): Calendar | null;
64
72
  get timePart(): TimePart | null;
65
73
  protected get hasDateValue(): boolean;
74
+ protected get localizationService(): LocalizationService;
66
75
  constructor(props: DateTimeSelectorProps);
67
76
  componentDidUpdate(): void;
68
77
  render(): JSX.Element;
@@ -75,8 +84,9 @@ export declare class DateTimeSelector extends React.Component<DateTimeSelectorPr
75
84
  protected mergeTime(current: Date | null, candidate: Date | null): Date | null;
76
85
  protected mergeDate(candidate: Date | null, value: Date): Date | null;
77
86
  protected move: (direction: 'left' | 'right') => void;
78
- private handleReject;
79
- private handleAccept;
87
+ private dateTimeFooter;
88
+ handleReject: (event: React.SyntheticEvent<any>) => void;
89
+ handleAccept: (event: React.SyntheticEvent<any>, timeOverride?: Date) => void;
80
90
  private handleNowClick;
81
91
  private handleCalendarValueChange;
82
92
  private handleTimeListContainerChange;
@@ -75,6 +75,14 @@ var DateTimeSelector = /** @class */ (function (_super) {
75
75
  _this.shouldFocusPart = true;
76
76
  _this.setState({ tab: nextPart });
77
77
  };
78
+ _this.dateTimeFooter = function () {
79
+ var cancelButton = _this.props.cancelButton;
80
+ var cancelMessage = _this.localizationService.toLanguageString(cancel, messages[cancel]);
81
+ var setMessage = _this.localizationService.toLanguageString(set, messages[set]);
82
+ return (React.createElement("div", { className: "k-datetime-footer k-actions k-actions-stretched " },
83
+ cancelButton && React.createElement(Button, __assign({ type: "button", ref: function (btn) { _this._cancelButton = btn; }, className: "k-time-cancel", onClick: _this.handleReject, title: cancelMessage }, { 'aria-label': cancelMessage }), cancelMessage),
84
+ React.createElement(Button, __assign({ type: "button", themeColor: "primary", ref: function (btn) { _this._acceptButton = btn; }, className: "k-time-accept", disabled: !_this.hasDateValue, onClick: _this.handleAccept, title: setMessage }, { 'aria-label': setMessage }), setMessage)));
85
+ };
78
86
  _this.handleReject = function (event) {
79
87
  _this.setState({ dateValue: _this.props.value, timeValue: _this.props.value || MIDNIGHT_DATE });
80
88
  var value = _this.mergeDate(_this.props.value, _this.props.value || MIDNIGHT_DATE);
@@ -175,6 +183,13 @@ var DateTimeSelector = /** @class */ (function (_super) {
175
183
  enumerable: false,
176
184
  configurable: true
177
185
  });
186
+ Object.defineProperty(DateTimeSelector.prototype, "localizationService", {
187
+ get: function () {
188
+ return provideLocalizationService(this);
189
+ },
190
+ enumerable: false,
191
+ configurable: true
192
+ });
178
193
  DateTimeSelector.prototype.componentDidUpdate = function () {
179
194
  if (this.shouldFocusPart) {
180
195
  this.focus({ preventScroll: true });
@@ -183,17 +198,14 @@ var DateTimeSelector = /** @class */ (function (_super) {
183
198
  };
184
199
  DateTimeSelector.prototype.render = function () {
185
200
  var _this = this;
186
- var _a = this.props, disabled = _a.disabled, cancelButton = _a.cancelButton, min = _a.min, max = _a.max, weekNumber = _a.weekNumber, focusedDate = _a.focusedDate, format = _a.format;
201
+ var _a = this.props, disabled = _a.disabled, min = _a.min, max = _a.max, weekNumber = _a.weekNumber, focusedDate = _a.focusedDate, format = _a.format, mobileMode = _a.mobileMode, footerActions = _a.footerActions;
187
202
  var rootClassName = classNames({
188
203
  'k-date-tab': this.state.tab === 'date',
189
204
  'k-time-tab': this.state.tab === 'time',
190
205
  'k-disabled': disabled
191
206
  }, 'k-datetime-wrap');
192
- var localizationService = provideLocalizationService(this);
193
- var dateMessage = localizationService.toLanguageString(date, messages[date]);
194
- var timeMessage = localizationService.toLanguageString(time, messages[time]);
195
- var cancelMessage = localizationService.toLanguageString(cancel, messages[cancel]);
196
- var setMessage = localizationService.toLanguageString(set, messages[set]);
207
+ var dateMessage = this.localizationService.toLanguageString(date, messages[date]);
208
+ var timeMessage = this.localizationService.toLanguageString(time, messages[time]);
197
209
  var calendarProps = {
198
210
  min: min,
199
211
  max: max,
@@ -213,10 +225,9 @@ var DateTimeSelector = /** @class */ (function (_super) {
213
225
  React.createElement("div", { className: "k-datetime-calendar-wrap", ref: function (e) { return _this._calendarWrap = e; } }, this.props.calendar ?
214
226
  React.createElement(this.props.calendar, __assign({}, calendarProps)) :
215
227
  React.createElement(Calendar, __assign({ ref: function (calendar) { _this._calendar = calendar; } }, calendarProps))),
216
- React.createElement("div", { className: "k-datetime-time-wrap" }, React.createElement(TimePart, { key: 1, onNowClick: this.handleNowClick, disabled: disabled || this.state.tab !== 'time', ref: function (timePart) { _this._timePart = timePart; }, min: this.minTime || MIN_TIME, max: this.maxTime || MAX_TIME, steps: this.props.steps, value: this.state.timeValue, format: format, onChange: this.handleTimeListContainerChange, onMount: this.handleTimePartMount }))),
217
- React.createElement("div", { className: "k-datetime-footer k-actions k-actions-stretched " },
218
- cancelButton && React.createElement(Button, __assign({ type: "button", ref: function (btn) { _this._cancelButton = btn; }, className: "k-time-cancel", onClick: this.handleReject, title: cancelMessage }, { 'aria-label': cancelMessage }), cancelMessage),
219
- React.createElement(Button, __assign({ type: "button", themeColor: "primary", ref: function (btn) { _this._acceptButton = btn; }, className: "k-time-accept", disabled: !this.hasDateValue, onClick: this.handleAccept, title: setMessage }, { 'aria-label': setMessage }), setMessage))));
228
+ React.createElement("div", { className: "k-datetime-time-wrap" },
229
+ React.createElement("div", { className: mobileMode ? 'k-reset k-timeselector-lg k-timeselector' : '' }, React.createElement(TimePart, { key: 1, onNowClick: this.handleNowClick, disabled: disabled || this.state.tab !== 'time', ref: function (timePart) { _this._timePart = timePart; }, min: this.minTime || MIN_TIME, max: this.maxTime || MAX_TIME, steps: this.props.steps, value: this.state.timeValue, format: format, onChange: this.handleTimeListContainerChange, onMount: this.handleTimePartMount, mobileMode: mobileMode })))),
230
+ footerActions && this.dateTimeFooter()));
220
231
  };
221
232
  Object.defineProperty(DateTimeSelector.prototype, "minTime", {
222
233
  get: function () {
@@ -254,6 +265,12 @@ var DateTimeSelector = /** @class */ (function (_super) {
254
265
  DateTimeSelector.prototype.mergeDate = function (candidate, value) {
255
266
  return candidate ? setTime(candidate || getToday(), value) : value;
256
267
  };
268
+ /**
269
+ * @hidden
270
+ */
271
+ DateTimeSelector.defaultProps = {
272
+ footerActions: true
273
+ };
257
274
  return DateTimeSelector;
258
275
  }(React.Component));
259
276
  export { DateTimeSelector };
@@ -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: 1684155027,
8
+ publishDate: 1684510606,
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
  };
@@ -145,7 +145,9 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
145
145
  });
146
146
  _this.valueDuringOnChange = value;
147
147
  _this.showDuringOnChange = false;
148
- _this.shouldFocusDateInput = true;
148
+ if (!_this.mobileMode) {
149
+ _this.shouldFocusDateInput = true;
150
+ }
149
151
  var onChange = _this.props.onChange;
150
152
  if (onChange) {
151
153
  onChange.call(undefined, {
@@ -431,12 +433,10 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
431
433
  */
432
434
  DatePickerWithoutContext.prototype.render = function () {
433
435
  var _this = this;
434
- 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;
435
- var _e = this.state.windowWidth, windowWidth = _e === void 0 ? 0 : _e;
436
+ 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;
436
437
  var show = this.show;
437
438
  var value = this.value;
438
439
  var isValid = !this.validityStyles || this.validity.valid;
439
- var renderAdaptive = windowWidth <= constants_1.MOBILE_MEDIUM_DEVISE && adaptive;
440
440
  var dateInputProps = {
441
441
  disabled: disabled,
442
442
  format: format,
@@ -479,8 +479,8 @@ var DatePickerWithoutContext = /** @class */ (function (_super) {
479
479
  _b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: onFocus, onBlur: onBlur, onClick: _this.mobileMode ? _this.handleIconClick : undefined },
480
480
  React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: 'combobox', readonly: _this.mobileMode, ariaExpanded: _this.show, ariaControls: _this._popupId }, dateInputProps)),
481
481
  React.createElement(_this.toggleButtonComp, { type: "button", icon: "calendar", svgIcon: kendo_svg_icons_1.calendarIcon, title: toggleButtonTitle, className: "k-input-button", rounded: null, onClick: _this.handleIconClick, "aria-label": toggleButtonTitle, onMouseDown: _this.handleIconMouseDown }),
482
- !renderAdaptive && _this.renderPopup()),
483
- renderAdaptive && _this.renderAdaptivePopup()));
482
+ !_this.mobileMode && _this.renderPopup()),
483
+ _this.mobileMode && _this.renderAdaptivePopup()));
484
484
  }));
485
485
  return this.props.label
486
486
  ? (React.createElement(usePickerFloatingLabel_1.PickerFloatingLabel, { dateInput: this._dateInput, label: this.props.label, editorId: id, editorValid: isValid, editorDisabled: this.props.disabled, children: datepicker, style: { width: this.props.width } }))
@@ -74,6 +74,14 @@ export interface DateTimePickerProps extends DateTimePickerSettings, FormCompone
74
74
  * @default `solid`
75
75
  */
76
76
  fillMode?: null | 'solid' | 'flat' | 'outline';
77
+ /**
78
+ * Providing different rendering of the popup element based on the screen dimensions.
79
+ */
80
+ adaptive?: boolean;
81
+ /**
82
+ * Specifies the text that is rendered as title in the adaptive popup.
83
+ */
84
+ adaptiveTitle?: string;
77
85
  }
78
86
  /**
79
87
  * @hidden
@@ -82,6 +90,7 @@ export interface DateTimePickerState {
82
90
  value: Date | null;
83
91
  show: boolean;
84
92
  focused: boolean;
93
+ windowWidth?: number;
85
94
  }
86
95
  /** @hidden */
87
96
  export declare class DateTimePickerWithoutContext extends React.Component<DateTimePickerProps, DateTimePickerState> implements FormComponent {
@@ -183,6 +192,8 @@ export declare class DateTimePickerWithoutContext extends React.Component<DateTi
183
192
  private nextTickId;
184
193
  private shouldFocusDateInput;
185
194
  private prevShow;
195
+ private observerResize?;
196
+ private get document();
186
197
  constructor(props: DateTimePickerProps);
187
198
  /**
188
199
  * Gets the wrapping element of the DateTimePicker.
@@ -204,6 +215,10 @@ export declare class DateTimePickerWithoutContext extends React.Component<DateTi
204
215
  * Gets the `name` property of the DateTimePicker.
205
216
  */
206
217
  get name(): string | undefined;
218
+ /**
219
+ * The mobile mode of the ComboBox.
220
+ */
221
+ get mobileMode(): boolean;
207
222
  protected get min(): Date;
208
223
  protected get max(): Date;
209
224
  /**
@@ -242,6 +257,8 @@ export declare class DateTimePickerWithoutContext extends React.Component<DateTi
242
257
  * @hidden
243
258
  */
244
259
  render(): JSX.Element;
260
+ private renderPicker;
261
+ private renderAdaptivePopup;
245
262
  protected setShow(show: boolean): void;
246
263
  protected nextTick(f: () => any): void;
247
264
  private handleReject;
@@ -252,6 +269,7 @@ export declare class DateTimePickerWithoutContext extends React.Component<DateTi
252
269
  private handleIconMouseDown;
253
270
  private handleKeyDown;
254
271
  private dateInputElement;
272
+ private calculateMedia;
255
273
  }
256
274
  /**
257
275
  * Represents the PropsContext of the `DateTimePicker` component.