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

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.
@@ -8,7 +8,14 @@ export interface AdaptiveModeProps {
8
8
  adaptiveTitle?: string | React.ReactNode;
9
9
  onClose?: (event: React.SyntheticEvent) => void;
10
10
  windowWidth?: number;
11
+ mobileFilter?: React.ReactNode;
11
12
  children: React.ReactNode;
13
+ footer?: {
14
+ cancelText: string;
15
+ onCancel: (event: React.SyntheticEvent) => void;
16
+ applyText: string;
17
+ onApply: (event: React.SyntheticEvent) => void;
18
+ };
12
19
  }
13
20
  /** @hidden */
14
21
  export declare const AdaptiveMode: (props: AdaptiveModeProps) => JSX.Element;
@@ -10,20 +10,22 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import * as React from 'react';
13
- import { ActionSheet, ActionSheetHeader } from '@progress/kendo-react-layout';
13
+ import { ActionSheet, ActionSheetFooter, ActionSheetHeader } from '@progress/kendo-react-layout';
14
14
  import { xIcon } from '@progress/kendo-svg-icons';
15
15
  import { Button } from '@progress/kendo-react-buttons';
16
- import { MOBILE_SMALL_DEVISE } from '../common/constants';
16
+ /** @hidden */
17
+ var MOBILE_SMALL_DEVISE = 500;
17
18
  /** @hidden */
18
19
  export var AdaptiveMode = function (props) {
20
+ var footer = props.footer, children = props.children, _a = props.windowWidth, windowWidth = _a === void 0 ? 0 : _a, navigatable = props.navigatable, navigatableElements = props.navigatableElements, expand = props.expand, animation = props.animation, onClose = props.onClose, adaptiveTitle = props.adaptiveTitle, mobileFilter = props.mobileFilter;
19
21
  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
22
+ navigatable: navigatable || false,
23
+ navigatableElements: navigatableElements || [],
24
+ expand: expand,
25
+ animation: animation === false ? false : true,
26
+ onClose: onClose,
27
+ animationStyles: windowWidth <= MOBILE_SMALL_DEVISE ? { top: 0, width: '100%', height: '100%' } : undefined,
28
+ className: windowWidth <= MOBILE_SMALL_DEVISE
27
29
  ? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
28
30
  : 'k-adaptive-actionsheet k-actionsheet-bottom'
29
31
  };
@@ -31,8 +33,13 @@ export var AdaptiveMode = function (props) {
31
33
  React.createElement(ActionSheetHeader, { className: 'k-text-center' },
32
34
  React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
33
35
  React.createElement("div", { className: "k-actionsheet-title" },
34
- React.createElement("div", null, props.adaptiveTitle)),
36
+ React.createElement("div", null, adaptiveTitle)),
35
37
  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
+ React.createElement(Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", icon: 'x', svgIcon: xIcon, onClick: onClose }))),
39
+ mobileFilter &&
40
+ React.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, mobileFilter)),
41
+ children,
42
+ footer && React.createElement(ActionSheetFooter, { className: 'k-actions k-actions-stretched' },
43
+ React.createElement(Button, { size: "large", tabIndex: 0, "aria-label": footer.cancelText, "aria-disabled": "false", type: "button", onClick: function (event) { return footer.onCancel(event); } }, footer.cancelText),
44
+ React.createElement(Button, { tabIndex: 0, themeColor: "primary", size: "large", "aria-label": footer.applyText, "aria-disabled": "false", type: "button", onClick: function (event) { return footer.onApply(event); } }, footer.applyText))));
38
45
  };
@@ -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: 1683705068,
8
+ publishDate: 1684155027,
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
  };
@@ -20,6 +20,7 @@ export interface TimeListProps {
20
20
  boundRange?: boolean;
21
21
  disabled?: boolean;
22
22
  show?: boolean;
23
+ mobileMode?: boolean;
23
24
  }
24
25
  /**
25
26
  * @hidden
@@ -27,6 +27,7 @@ var SCROLL_THRESHOLD = 2; // < 2px threshold
27
27
  var SNAP_THRESHOLD = 0.05; // % of the item height
28
28
  var SCROLL_THROTTLE = 100; // ms
29
29
  var SKIP = 0;
30
+ var MOBILE_MODE_OFFSET = 9;
30
31
  var getters = (_a = {},
31
32
  _a[Keys.end] = function (data, _) { return data[data.length - 1]; },
32
33
  _a[Keys.home] = function (data, _) { return data[0]; },
@@ -88,6 +89,10 @@ var TimeList = /** @class */ (function (_super) {
88
89
  _this.listHeight = _this.dom.timeListHeight;
89
90
  _this.topOffset = (_this.listHeight - _this.itemHeight) / 2;
90
91
  _this.bottomOffset = _this.listHeight - _this.itemHeight;
92
+ if (_this.props.mobileMode) {
93
+ _this.topOffset += MOBILE_MODE_OFFSET;
94
+ _this.bottomOffset += MOBILE_MODE_OFFSET * 2;
95
+ }
91
96
  _this.topThreshold = _this.itemHeight * SNAP_THRESHOLD;
92
97
  _this.bottomThreshold = _this.itemHeight * (1 - SNAP_THRESHOLD);
93
98
  };
@@ -37,6 +37,7 @@ export interface TimePartProps {
37
37
  className?: string;
38
38
  onMount?: (value: Date) => void;
39
39
  show?: boolean;
40
+ mobileMode?: boolean;
40
41
  }
41
42
  /**
42
43
  * @hidden
@@ -207,7 +207,7 @@ var TimePart = /** @class */ (function (_super) {
207
207
  */
208
208
  TimePart.prototype.render = function () {
209
209
  var _this = this;
210
- var _a = this.props, format = _a.format, smoothScroll = _a.smoothScroll, onNowClick = _a.onNowClick, className = _a.className, disabled = _a.disabled;
210
+ var _a = this.props, format = _a.format, smoothScroll = _a.smoothScroll, onNowClick = _a.onNowClick, className = _a.className, disabled = _a.disabled, mobileMode = _a.mobileMode, show = _a.show;
211
211
  this.snapTime = snapTime(generateSnappers(this.steps, this.min));
212
212
  this.dateFormatParts = this.intl
213
213
  .splitDateFormat(format || TimePart.defaultProps.format)
@@ -233,7 +233,7 @@ var TimePart = /** @class */ (function (_super) {
233
233
  React.createElement("span", { className: "k-title", onMouseDown: function (e) { e.preventDefault(); } }, _this.intl.dateFieldName(part)),
234
234
  React.createElement(TimeList, { min: _this.min, max: _this.max, boundRange: _this.boundRange, part: part, step: part.type ? _this.steps[part.type] : 1, smoothScroll: smoothScroll, ref: function (el) { if (!el) {
235
235
  return;
236
- } _this.timeLists.push(el); }, id: idx, onFocus: function () { _this.handleListFocus(idx); }, onBlur: _this.handleListBlur, onChange: _this.handleChange, value: _this.value, disabled: disabled, show: _this.props.show }))
236
+ } _this.timeLists.push(el); }, id: idx, onFocus: function () { _this.handleListFocus(idx); }, onBlur: _this.handleListBlur, onChange: _this.handleChange, value: _this.value, disabled: disabled, show: show, mobileMode: mobileMode }))
237
237
  : React.createElement("div", { key: idx, className: "k-time-separator" }, part.pattern));
238
238
  }))));
239
239
  };
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import * as PropTypes from 'prop-types';
3
3
  import { FormComponent, FormComponentProps, FormComponentValidity } from '@progress/kendo-react-common';
4
+ import { LocalizationService } from '@progress/kendo-react-intl';
4
5
  import { DateInput, DateInputProps } from '../dateinput/DateInput';
5
6
  import { TimeSelector } from './TimeSelector';
6
7
  import { TimePickerSettings } from './models';
@@ -69,6 +70,14 @@ export interface TimePickerProps extends TimePickerSettings, FormComponentProps
69
70
  * @default `solid`
70
71
  */
71
72
  fillMode?: null | 'solid' | 'flat' | 'outline';
73
+ /**
74
+ * Providing different rendering of the popup element based on the screen dimensions.
75
+ */
76
+ adaptive?: boolean;
77
+ /**
78
+ * Specifies the text that is rendered as title in the adaptive popup.
79
+ */
80
+ adaptiveTitle?: string;
72
81
  }
73
82
  /**
74
83
  * @hidden
@@ -77,6 +86,8 @@ export interface TimePickerState {
77
86
  value: Date | null;
78
87
  show: boolean;
79
88
  focused: boolean;
89
+ windowWidth?: number;
90
+ candidate: Date | null;
80
91
  }
81
92
  /** @hidden */
82
93
  export declare class TimePickerWithoutContext extends React.Component<TimePickerProps, TimePickerState> implements FormComponent {
@@ -181,6 +192,8 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
181
192
  private showDuringOnChange?;
182
193
  private shouldFocusDateInput;
183
194
  private prevShow;
195
+ private observerResize?;
196
+ private get document();
184
197
  constructor(props: TimePickerProps);
185
198
  /**
186
199
  * Gets the wrapping element of the TimePicker.
@@ -210,6 +223,10 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
210
223
  * Represents the validity state into which the TimePicker is set.
211
224
  */
212
225
  get validity(): FormComponentValidity;
226
+ /**
227
+ * The mobile mode of the ComboBox.
228
+ */
229
+ get mobileMode(): boolean;
213
230
  /**
214
231
  * @hidden
215
232
  */
@@ -222,6 +239,7 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
222
239
  private get min();
223
240
  private get max();
224
241
  protected get dateInputComp(): React.ComponentType<DateInputProps<any>>;
242
+ protected get localizationService(): LocalizationService;
225
243
  /**
226
244
  * @hidden
227
245
  */
@@ -230,6 +248,10 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
230
248
  * @hidden
231
249
  */
232
250
  componentDidUpdate(): void;
251
+ /**
252
+ * @hidden
253
+ */
254
+ componentWillUnmount(): void;
233
255
  /**
234
256
  * @hidden
235
257
  */
@@ -238,6 +260,9 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
238
260
  * @hidden
239
261
  */
240
262
  render(): JSX.Element;
263
+ private renderTimeSelector;
264
+ private renderPopup;
265
+ private renderAdaptivePopup;
241
266
  protected setTimeSelectorRef: (timeSelector: TimeSelector | null) => void;
242
267
  protected nextValue: (nextProps: TimePickerProps, nextState: TimePickerState) => Date | null;
243
268
  protected nextShow: (nextProps: TimePickerProps, nextState: TimePickerState) => boolean;
@@ -245,6 +270,7 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
245
270
  protected setShow(show: boolean): void;
246
271
  protected mergeTime(value: Date | null): Date | null;
247
272
  private handleInputValueChange;
273
+ private handleTimeChange;
248
274
  private handleValueChange;
249
275
  private handleFocus;
250
276
  private handleBlur;
@@ -252,6 +278,7 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
252
278
  private handleIconClick;
253
279
  private handleIconMouseDown;
254
280
  private handleKeyDown;
281
+ private calculateMedia;
255
282
  }
256
283
  /**
257
284
  * Represents the PropsContext of the `TimePicker` component.
@@ -39,18 +39,21 @@ 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 { cloneDate } from '@progress/kendo-date-math';
42
- import { classNames, guid, Keys, AsyncFocusBlur, createPropsContext, withPropsContext, kendoThemeMaps } from '@progress/kendo-react-common';
42
+ import { classNames, guid, Keys, AsyncFocusBlur, createPropsContext, withPropsContext, kendoThemeMaps, canUseDOM } from '@progress/kendo-react-common';
43
43
  import { clockIcon } from '@progress/kendo-svg-icons';
44
44
  import { registerForLocalization, provideLocalizationService } from '@progress/kendo-react-intl';
45
45
  import { validatePackage } from '@progress/kendo-react-common';
46
46
  import { packageMetadata } from '../package-metadata';
47
- import { messages, toggleTimeSelector, toggleClock } from '../messages';
47
+ import { messages, toggleTimeSelector, toggleClock, timePickerSet, timePickerCancel } from '../messages';
48
48
  import { DateInput } from '../dateinput/DateInput';
49
49
  import { TimeSelector } from './TimeSelector';
50
50
  import { MIDNIGHT_DATE, MIN_TIME, MAX_TIME, setTime } from '../utils';
51
51
  import { isInRange, isSmallerThanMin, isBiggerThanMax } from './utils';
52
52
  import { PickerFloatingLabel } from '../hooks/usePickerFloatingLabel';
53
53
  import { Button } from '@progress/kendo-react-buttons';
54
+ import { MOBILE_MEDIUM_DEVISE } from '../common/constants';
55
+ import { AdaptiveMode } from '../common/AdaptiveMode';
56
+ import { ActionSheetContent } from '@progress/kendo-react-layout';
54
57
  /** @hidden */
55
58
  var TimePickerWithoutContext = /** @class */ (function (_super) {
56
59
  __extends(TimePickerWithoutContext, _super);
@@ -70,6 +73,41 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
70
73
  _this.dateInput.focus();
71
74
  }
72
75
  };
76
+ _this.renderTimeSelector = function () {
77
+ var _a = _this.props, smoothScroll = _a.smoothScroll, cancelButton = _a.cancelButton, nowButton = _a.nowButton, disabled = _a.disabled, format = _a.format, steps = _a.steps;
78
+ return (React.createElement(TimeSelector, { ref: _this.setTimeSelectorRef, className: _this.mobileMode ? 'k-reset k-timeselector-lg' : '', mobileMode: _this.mobileMode, show: _this.show, cancelButton: cancelButton, disabled: disabled, nowButton: nowButton, format: format, min: _this.min, max: _this.max, steps: steps, smoothScroll: smoothScroll, value: _this.value, footer: _this.mobileMode ? false : true, handleTimeChange: _this.mobileMode && _this.handleTimeChange, onChange: _this.handleValueChange, onReject: _this.handleValueReject }));
79
+ };
80
+ _this.renderPopup = function () {
81
+ var _a = _this.popupSettings, popupClass = _a.popupClass, otherPopupSettings = __rest(_a, ["popupClass"]);
82
+ var popupClassNames = classNames('k-group k-reset', popupClass);
83
+ var popupProps = __assign({ popupClass: 'k-timepicker-popup', show: _this.show, animate: _this.element !== null, anchor: _this.element, className: popupClassNames, id: _this._popupId, anchorAlign: {
84
+ horizontal: 'left',
85
+ vertical: 'bottom'
86
+ }, popupAlign: {
87
+ horizontal: 'left',
88
+ vertical: 'top'
89
+ } }, otherPopupSettings);
90
+ return (_this.props.popup
91
+ ? React.createElement(_this.props.popup, __assign({}, popupProps), _this.renderTimeSelector())
92
+ : React.createElement(Popup, __assign({}, popupProps), _this.renderTimeSelector()));
93
+ };
94
+ _this.renderAdaptivePopup = function () {
95
+ var _a = _this.state.windowWidth, windowWidth = _a === void 0 ? 0 : _a;
96
+ var actionSheetProps = {
97
+ expand: _this.show,
98
+ onClose: _this.handleBlur,
99
+ adaptiveTitle: _this.props.adaptiveTitle,
100
+ windowWidth: windowWidth,
101
+ footer: {
102
+ cancelText: _this.localizationService.toLanguageString(toggleClock, messages[timePickerCancel]),
103
+ onCancel: function (event) { return _this.handleValueReject(event); },
104
+ applyText: _this.localizationService.toLanguageString(timePickerSet, messages[timePickerSet]),
105
+ onApply: function (event) { return _this.handleValueChange(event); }
106
+ }
107
+ };
108
+ return (React.createElement(AdaptiveMode, __assign({}, actionSheetProps),
109
+ React.createElement(ActionSheetContent, { className: '!k-overflow-hidden' }, _this.renderTimeSelector())));
110
+ };
73
111
  _this.setTimeSelectorRef = function (timeSelector) {
74
112
  _this._timeSelector = timeSelector;
75
113
  };
@@ -87,20 +125,24 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
87
125
  var value = _this.mergeTime(event.value);
88
126
  _this.handleValueChange(__assign(__assign({}, event), { value: value }));
89
127
  };
128
+ _this.handleTimeChange = function (date) {
129
+ _this.setState({ candidate: date.time });
130
+ };
90
131
  _this.handleValueChange = function (event) {
91
132
  _this.setState({
92
- value: cloneDate(event.value),
133
+ value: cloneDate(event.value || _this.state.candidate),
93
134
  show: false
94
135
  });
95
136
  _this.valueDuringOnChange = event.value;
96
137
  _this.showDuringOnChange = false;
97
138
  _this.shouldFocusDateInput = true;
98
139
  var onChange = _this.props.onChange;
140
+ var value = _this.value || _this.state.candidate;
99
141
  if (onChange) {
100
142
  onChange.call(undefined, {
101
143
  syntheticEvent: event.syntheticEvent,
102
144
  nativeEvent: event.nativeEvent,
103
- value: _this.value,
145
+ value: value,
104
146
  show: _this.show,
105
147
  target: _this
106
148
  });
@@ -146,13 +188,25 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
146
188
  _this.state = {
147
189
  value: _this.props.defaultValue || TimePickerWithoutContext.defaultProps.defaultValue,
148
190
  show: _this.props.defaultShow || TimePickerWithoutContext.defaultProps.defaultShow,
149
- focused: false
191
+ focused: false,
192
+ candidate: null
150
193
  };
151
194
  _this.normalizeTime = _this.normalizeTime.bind(_this);
152
195
  _this.setShow = _this.setShow.bind(_this);
153
196
  _this.mergeTime = _this.mergeTime.bind(_this);
154
197
  return _this;
155
198
  }
199
+ Object.defineProperty(TimePickerWithoutContext.prototype, "document", {
200
+ get: function () {
201
+ if (!canUseDOM) {
202
+ return;
203
+ }
204
+ // useful only for user actions
205
+ return (this.element && this.element.ownerDocument) || document;
206
+ },
207
+ enumerable: false,
208
+ configurable: true
209
+ });
156
210
  Object.defineProperty(TimePickerWithoutContext.prototype, "element", {
157
211
  /**
158
212
  * Gets the wrapping element of the TimePicker.
@@ -245,6 +299,17 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
245
299
  enumerable: false,
246
300
  configurable: true
247
301
  });
302
+ Object.defineProperty(TimePickerWithoutContext.prototype, "mobileMode", {
303
+ /**
304
+ * The mobile mode of the ComboBox.
305
+ */
306
+ get: function () {
307
+ var isAdaptive = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE && this.props.adaptive;
308
+ return !!isAdaptive;
309
+ },
310
+ enumerable: false,
311
+ configurable: true
312
+ });
248
313
  Object.defineProperty(TimePickerWithoutContext.prototype, "validityStyles", {
249
314
  /**
250
315
  * @hidden
@@ -297,14 +362,26 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
297
362
  enumerable: false,
298
363
  configurable: true
299
364
  });
365
+ Object.defineProperty(TimePickerWithoutContext.prototype, "localizationService", {
366
+ get: function () {
367
+ return provideLocalizationService(this);
368
+ },
369
+ enumerable: false,
370
+ configurable: true
371
+ });
300
372
  /**
301
373
  * @hidden
302
374
  */
303
375
  TimePickerWithoutContext.prototype.componentDidMount = function () {
376
+ var _a;
377
+ this.observerResize = canUseDOM && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this));
304
378
  if (this.show) {
305
379
  // If defaultShow is true during the initial render, the popup is not aligned.
306
380
  this.forceUpdate();
307
381
  }
382
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
383
+ this.observerResize.observe(this.document.body);
384
+ }
308
385
  };
309
386
  /**
310
387
  * @hidden
@@ -322,15 +399,23 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
322
399
  this.prevShow = this.show;
323
400
  this.shouldFocusDateInput = false;
324
401
  };
402
+ /**
403
+ * @hidden
404
+ */
405
+ TimePickerWithoutContext.prototype.componentWillUnmount = function () {
406
+ var _a;
407
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
408
+ this.observerResize.disconnect();
409
+ }
410
+ };
411
+ ;
325
412
  /**
326
413
  * @hidden
327
414
  */
328
415
  TimePickerWithoutContext.prototype.render = function () {
329
416
  var _this = this;
330
- var _a = this.props, _b = _a.size, size = _b === void 0 ? TimePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? TimePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? TimePickerWithoutContext.defaultProps.fillMode : _d, disabled = _a.disabled, tabIndex = _a.tabIndex, title = _a.title, id = _a.id, className = _a.className, format = _a.format, formatPlaceholder = _a.formatPlaceholder, smoothScroll = _a.smoothScroll, width = _a.width, name = _a.name, steps = _a.steps, cancelButton = _a.cancelButton, nowButton = _a.nowButton, validationMessage = _a.validationMessage, required = _a.required, validityStyles = _a.validityStyles, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy;
331
- var _e = this.popupSettings, popupClass = _e.popupClass, otherPopupSettings = __rest(_e, ["popupClass"]);
417
+ var _a = this.props, _b = _a.size, size = _b === void 0 ? TimePickerWithoutContext.defaultProps.size : _b, _c = _a.rounded, rounded = _c === void 0 ? TimePickerWithoutContext.defaultProps.rounded : _c, _d = _a.fillMode, fillMode = _d === void 0 ? TimePickerWithoutContext.defaultProps.fillMode : _d, disabled = _a.disabled, tabIndex = _a.tabIndex, title = _a.title, id = _a.id, className = _a.className, format = _a.format, formatPlaceholder = _a.formatPlaceholder, width = _a.width, name = _a.name, steps = _a.steps, validationMessage = _a.validationMessage, required = _a.required, validityStyles = _a.validityStyles, ariaLabelledBy = _a.ariaLabelledBy, ariaDescribedBy = _a.ariaDescribedBy;
332
418
  var isValid = !this.validityStyles || this.validity.valid;
333
- var popupClassNames = classNames('k-group k-reset', popupClass);
334
419
  var dateInputProps = {
335
420
  disabled: disabled,
336
421
  format: format,
@@ -356,38 +441,30 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
356
441
  ariaExpanded: this.show,
357
442
  size: null,
358
443
  fillMode: null,
359
- rounded: null
444
+ rounded: null,
445
+ readonly: this.mobileMode
360
446
  };
361
- var popupProps = __assign({ popupClass: 'k-timepicker-popup', show: this.show, animate: this.element !== null, anchor: this.element, className: popupClassNames, id: this._popupId, anchorAlign: {
362
- horizontal: 'left',
363
- vertical: 'bottom'
364
- }, popupAlign: {
365
- horizontal: 'left',
366
- vertical: 'top'
367
- } }, otherPopupSettings);
368
- var timeSelector = (React.createElement(TimeSelector, { ref: this.setTimeSelectorRef, show: this.show, cancelButton: cancelButton, disabled: disabled, nowButton: nowButton, format: format, min: this.min, max: this.max, steps: steps, smoothScroll: smoothScroll, value: this.value, onChange: this.handleValueChange, onReject: this.handleValueReject }));
369
- var localizationService = provideLocalizationService(this);
370
- var toggleClockMessage = localizationService.toLanguageString(toggleClock, messages[toggleClock]);
371
- var toggleTimeMessage = localizationService
447
+ var toggleClockMessage = this.localizationService.toLanguageString(toggleClock, messages[toggleClock]);
448
+ var toggleTimeMessage = this.localizationService
372
449
  .toLanguageString(toggleTimeSelector, messages[toggleTimeSelector]);
373
- var timepicker = (React.createElement(AsyncFocusBlur, { onFocus: this.handleFocus, onBlur: this.handleBlur, onSyncBlur: this.props.onBlur, onSyncFocus: this.props.onFocus }, function (_a) {
450
+ var timepicker = (React.createElement(AsyncFocusBlur, { onFocus: this.handleFocus, onBlur: !this.mobileMode ? this.handleBlur : undefined, onSyncBlur: this.props.onBlur, onSyncFocus: this.props.onFocus }, function (_a) {
374
451
  var _b;
375
452
  var onFocus = _a.onFocus, onBlur = _a.onBlur;
376
- return (React.createElement("div", { ref: function (span) { _this._element = span; }, className: classNames('k-input', 'k-timepicker', (_b = {},
377
- _b["k-input-".concat(kendoThemeMaps.sizeMap[size] || size)] = size,
378
- _b["k-rounded-".concat(kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
379
- _b["k-input-".concat(fillMode)] = fillMode,
380
- _b['k-invalid'] = !isValid,
381
- _b['k-required'] = _this.required,
382
- _b['k-disabled'] = _this.props.disabled,
383
- _b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: onFocus, onBlur: onBlur },
384
- React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: "combobox", ariaControls: _this._popupId }, dateInputProps)),
385
- React.createElement(Button, __assign({ tabIndex: -1, type: "button", icon: 'clock', svgIcon: clockIcon, onMouseDown: _this.handleIconMouseDown, onClick: _this.handleIconClick, title: toggleTimeMessage, className: "k-input-button", rounded: null }, {
386
- 'aria-label': toggleClockMessage
387
- })),
388
- _this.props.popup
389
- ? React.createElement(_this.props.popup, __assign({}, popupProps), timeSelector)
390
- : React.createElement(Popup, __assign({}, popupProps), timeSelector)));
453
+ return (React.createElement(React.Fragment, null,
454
+ React.createElement("div", { ref: function (span) { _this._element = span; }, className: classNames('k-input', 'k-timepicker', (_b = {},
455
+ _b["k-input-".concat(kendoThemeMaps.sizeMap[size] || size)] = size,
456
+ _b["k-rounded-".concat(kendoThemeMaps.roundedMap[rounded] || rounded)] = rounded,
457
+ _b["k-input-".concat(fillMode)] = fillMode,
458
+ _b['k-invalid'] = !isValid,
459
+ _b['k-required'] = _this.required,
460
+ _b['k-disabled'] = _this.props.disabled,
461
+ _b), className), onKeyDown: _this.handleKeyDown, style: { width: width }, onFocus: onFocus, onBlur: onBlur, onClick: _this.mobileMode ? _this.handleIconClick : undefined },
462
+ React.createElement(_this.dateInputComp, __assign({ _ref: _this._dateInput, ariaRole: "combobox", ariaControls: _this._popupId }, dateInputProps)),
463
+ React.createElement(Button, __assign({ tabIndex: -1, type: "button", icon: 'clock', svgIcon: clockIcon, onMouseDown: _this.handleIconMouseDown, onClick: _this.handleIconClick, title: toggleTimeMessage, className: "k-input-button", rounded: null }, {
464
+ 'aria-label': toggleClockMessage
465
+ })),
466
+ !_this.mobileMode && _this.renderPopup()),
467
+ _this.mobileMode && _this.renderAdaptivePopup()));
391
468
  }));
392
469
  return this.props.label
393
470
  ? (React.createElement(PickerFloatingLabel, { dateInput: this._dateInput, label: this.props.label, editorId: id, editorValid: isValid, editorDisabled: this.props.disabled, children: timepicker, style: { width: this.props.width } }))
@@ -405,6 +482,14 @@ var TimePickerWithoutContext = /** @class */ (function (_super) {
405
482
  TimePickerWithoutContext.prototype.mergeTime = function (value) {
406
483
  return this.value && value ? setTime(this.value, value) : value;
407
484
  };
485
+ TimePickerWithoutContext.prototype.calculateMedia = function (entries) {
486
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
487
+ var entry = entries_1[_i];
488
+ this.setState({ windowWidth: entry.target.clientWidth });
489
+ }
490
+ ;
491
+ };
492
+ ;
408
493
  /**
409
494
  * @hidden
410
495
  */
@@ -18,6 +18,12 @@ export interface TimeSelectorChangeEvent {
18
18
  value: Date;
19
19
  target: TimeSelector;
20
20
  }
21
+ /**
22
+ * @hidden
23
+ */
24
+ export interface TimeSelectorTimeChangeEvent {
25
+ time: Date;
26
+ }
21
27
  /**
22
28
  * @hidden
23
29
  */
@@ -30,6 +36,7 @@ export interface TimeSelectorProps {
30
36
  min?: Date;
31
37
  nowButton?: boolean;
32
38
  onChange?: any;
39
+ handleTimeChange?: any;
33
40
  onReject?: any;
34
41
  steps?: TimePickerIncrementalSteps;
35
42
  smoothScroll?: boolean;
@@ -37,6 +44,8 @@ export interface TimeSelectorProps {
37
44
  value?: Date | null;
38
45
  boundRange?: boolean;
39
46
  show?: boolean;
47
+ footer?: boolean;
48
+ mobileMode?: boolean;
40
49
  }
41
50
  /**
42
51
  * @hidden
@@ -91,6 +100,7 @@ export declare class TimeSelector extends React.Component<TimeSelectorProps, Tim
91
100
  min: Date;
92
101
  max: Date;
93
102
  boundRange: boolean;
103
+ footer: boolean;
94
104
  };
95
105
  readonly state: TimeSelectorState;
96
106
  private _element;
@@ -113,6 +113,12 @@ var TimeSelector = /** @class */ (function (_super) {
113
113
  };
114
114
  _this.handleChange = function (candidate) {
115
115
  _this.setState({ current: candidate });
116
+ var handleTimeChange = _this.props.handleTimeChange;
117
+ if (handleTimeChange) {
118
+ handleTimeChange.call(undefined, {
119
+ time: candidate
120
+ });
121
+ }
116
122
  };
117
123
  _this.dateFormatParts = _this.intl.splitDateFormat(_this.props.format || TimeSelector.defaultProps.format);
118
124
  _this.mergeValue = valueMerger(generateGetters(_this.dateFormatParts));
@@ -174,15 +180,15 @@ var TimeSelector = /** @class */ (function (_super) {
174
180
  */
175
181
  TimeSelector.prototype.render = function () {
176
182
  var _this = this;
177
- var _a = this.props, format = _a.format, cancelButton = _a.cancelButton, disabled = _a.disabled, tabIndex = _a.tabIndex, className = _a.className, smoothScroll = _a.smoothScroll, min = _a.min, max = _a.max, boundRange = _a.boundRange, nowButton = _a.nowButton, steps = _a.steps;
183
+ var _a = this.props, format = _a.format, cancelButton = _a.cancelButton, disabled = _a.disabled, tabIndex = _a.tabIndex, className = _a.className, smoothScroll = _a.smoothScroll, min = _a.min, max = _a.max, boundRange = _a.boundRange, nowButton = _a.nowButton, steps = _a.steps, show = _a.show, mobileMode = _a.mobileMode;
178
184
  var localizationService = provideLocalizationService(this);
179
185
  var cancelMessage = localizationService.toLanguageString(timePickerCancel, messages[timePickerCancel]);
180
186
  var setMessage = localizationService.toLanguageString(timePickerSet, messages[timePickerSet]);
181
187
  return (React.createElement("div", { ref: function (el) { _this._element = el; }, tabIndex: !disabled ? tabIndex || 0 : undefined, className: classNames('k-timeselector', className, {
182
188
  'k-disabled': disabled
183
189
  }), onKeyDown: this.handleKeyDown },
184
- React.createElement(TimePart, { ref: function (el) { _this.timePart = el; }, value: this.current, onChange: this.handleChange, onNowClick: this.handleNowClick, format: format, smoothScroll: smoothScroll, min: min, max: max, boundRange: boundRange, disabled: disabled, nowButton: nowButton, steps: steps, show: this.props.show }),
185
- React.createElement("div", { className: "k-time-footer k-actions k-actions-stretched" },
190
+ React.createElement(TimePart, { ref: function (el) { _this.timePart = el; }, value: this.current, onChange: this.handleChange, onNowClick: this.handleNowClick, format: format, smoothScroll: smoothScroll, min: min, max: max, boundRange: boundRange, disabled: disabled, nowButton: nowButton, steps: steps, show: show, mobileMode: mobileMode }),
191
+ this.props.footer && React.createElement("div", { className: "k-time-footer k-actions k-actions-stretched" },
186
192
  cancelButton &&
187
193
  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),
188
194
  React.createElement(Button, __assign({ type: "button", ref: function (btn) { _this._acceptButton = btn; }, className: "k-time-accept", themeColor: 'primary', onClick: this.handleAccept, title: setMessage }, { 'aria-label': setMessage }), setMessage))));
@@ -244,7 +250,8 @@ var TimeSelector = /** @class */ (function (_super) {
244
250
  format: 't',
245
251
  min: MIN_TIME,
246
252
  max: MAX_TIME,
247
- boundRange: false
253
+ boundRange: false,
254
+ footer: true
248
255
  };
249
256
  return TimeSelector;
250
257
  }(React.Component));
@@ -8,7 +8,14 @@ export interface AdaptiveModeProps {
8
8
  adaptiveTitle?: string | React.ReactNode;
9
9
  onClose?: (event: React.SyntheticEvent) => void;
10
10
  windowWidth?: number;
11
+ mobileFilter?: React.ReactNode;
11
12
  children: React.ReactNode;
13
+ footer?: {
14
+ cancelText: string;
15
+ onCancel: (event: React.SyntheticEvent) => void;
16
+ applyText: string;
17
+ onApply: (event: React.SyntheticEvent) => void;
18
+ };
12
19
  }
13
20
  /** @hidden */
14
21
  export declare const AdaptiveMode: (props: AdaptiveModeProps) => JSX.Element;
@@ -16,17 +16,19 @@ var React = require("react");
16
16
  var kendo_react_layout_1 = require("@progress/kendo-react-layout");
17
17
  var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
18
18
  var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
19
- var constants_1 = require("../common/constants");
19
+ /** @hidden */
20
+ var MOBILE_SMALL_DEVISE = 500;
20
21
  /** @hidden */
21
22
  var AdaptiveMode = function (props) {
23
+ var footer = props.footer, children = props.children, _a = props.windowWidth, windowWidth = _a === void 0 ? 0 : _a, navigatable = props.navigatable, navigatableElements = props.navigatableElements, expand = props.expand, animation = props.animation, onClose = props.onClose, adaptiveTitle = props.adaptiveTitle, mobileFilter = props.mobileFilter;
22
24
  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
25
+ navigatable: navigatable || false,
26
+ navigatableElements: navigatableElements || [],
27
+ expand: expand,
28
+ animation: animation === false ? false : true,
29
+ onClose: onClose,
30
+ animationStyles: windowWidth <= MOBILE_SMALL_DEVISE ? { top: 0, width: '100%', height: '100%' } : undefined,
31
+ className: windowWidth <= MOBILE_SMALL_DEVISE
30
32
  ? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
31
33
  : 'k-adaptive-actionsheet k-actionsheet-bottom'
32
34
  };
@@ -34,9 +36,14 @@ var AdaptiveMode = function (props) {
34
36
  React.createElement(kendo_react_layout_1.ActionSheetHeader, { className: 'k-text-center' },
35
37
  React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
36
38
  React.createElement("div", { className: "k-actionsheet-title" },
37
- React.createElement("div", null, props.adaptiveTitle)),
39
+ React.createElement("div", null, adaptiveTitle)),
38
40
  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
+ 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: onClose }))),
42
+ mobileFilter &&
43
+ React.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, mobileFilter)),
44
+ children,
45
+ footer && React.createElement(kendo_react_layout_1.ActionSheetFooter, { className: 'k-actions k-actions-stretched' },
46
+ React.createElement(kendo_react_buttons_1.Button, { size: "large", tabIndex: 0, "aria-label": footer.cancelText, "aria-disabled": "false", type: "button", onClick: function (event) { return footer.onCancel(event); } }, footer.cancelText),
47
+ React.createElement(kendo_react_buttons_1.Button, { tabIndex: 0, themeColor: "primary", size: "large", "aria-label": footer.applyText, "aria-disabled": "false", type: "button", onClick: function (event) { return footer.onApply(event); } }, footer.applyText))));
41
48
  };
42
49
  exports.AdaptiveMode = AdaptiveMode;