@progress/kendo-react-dateinputs 15.1.1-develop.3 → 15.2.0-develop.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/calendar/components/Calendar.js +1 -1
  2. package/calendar/components/Calendar.mjs +1 -1
  3. package/calendar/components/CalendarHeaderTitle.js +1 -1
  4. package/calendar/components/CalendarHeaderTitle.mjs +17 -5
  5. package/calendar/components/HorizontalViewList.js +1 -1
  6. package/calendar/components/HorizontalViewList.mjs +29 -29
  7. package/calendar/components/MultiViewCalendar.js +1 -1
  8. package/calendar/components/MultiViewCalendar.mjs +131 -128
  9. package/calendar/components/TodayCommand.js +1 -1
  10. package/calendar/components/TodayCommand.mjs +21 -32
  11. package/calendar/components/View.js +1 -1
  12. package/calendar/components/View.mjs +66 -66
  13. package/calendar/components/ViewList.js +1 -1
  14. package/calendar/components/ViewList.mjs +135 -125
  15. package/calendar/models/WeekDaysFormat.d.ts +1 -1
  16. package/common/AdaptiveMode.js +1 -1
  17. package/common/AdaptiveMode.mjs +30 -31
  18. package/dateinput/DateInput.js +1 -1
  19. package/dateinput/DateInput.mjs +35 -36
  20. package/datepicker/DatePicker.js +1 -1
  21. package/datepicker/DatePicker.mjs +184 -183
  22. package/daterangepicker/DateRangePicker.js +1 -1
  23. package/daterangepicker/DateRangePicker.mjs +61 -63
  24. package/datetimepicker/DateTimePicker.d.ts +1 -0
  25. package/datetimepicker/DateTimePicker.js +1 -1
  26. package/datetimepicker/DateTimePicker.mjs +117 -118
  27. package/datetimepicker/models/DateTimePickerSettings.d.ts +7 -0
  28. package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
  29. package/messages/index.d.ts +5 -0
  30. package/messages/index.js +1 -1
  31. package/messages/index.mjs +46 -44
  32. package/package-metadata.js +1 -1
  33. package/package-metadata.mjs +2 -2
  34. package/package.json +9 -9
  35. package/timepicker/TimeList.js +2 -2
  36. package/timepicker/TimeList.mjs +51 -47
  37. package/timepicker/TimePart.js +1 -1
  38. package/timepicker/TimePart.mjs +57 -68
  39. package/timepicker/TimePicker.d.ts +8 -0
  40. package/timepicker/TimePicker.js +1 -1
  41. package/timepicker/TimePicker.mjs +122 -118
  42. package/timepicker/TimeSelector.js +1 -1
  43. package/timepicker/TimeSelector.mjs +56 -57
  44. package/timepicker/models/TimePickerSettings.d.ts +7 -0
@@ -7,18 +7,18 @@
7
7
  */
8
8
  import * as n from "react";
9
9
  import t from "prop-types";
10
- import { cloneDate as O } from "@progress/kendo-date-math";
11
- import { Keys as T, classNames as l, uTime as h, getActiveElement as R } from "@progress/kendo-react-common";
12
- import { provideIntlService as k, provideLocalizationService as S, registerForIntl as C, registerForLocalization as M } from "@progress/kendo-react-intl";
13
- import { selectNow as L, messages as x, now as I } from "../messages/index.mjs";
14
- import { TimeList as P } from "./TimeList.mjs";
15
- import { MAX_TIME as A, MIN_TIME as K, MIDNIGHT_DATE as _ } from "../utils.mjs";
10
+ import { cloneDate as E } from "@progress/kendo-date-math";
11
+ import { Keys as b, classNames as h, uTime as u, getActiveElement as F } from "@progress/kendo-react-common";
12
+ import { provideIntlService as O, provideLocalizationService as R, registerForIntl as k, registerForLocalization as S } from "@progress/kendo-react-intl";
13
+ import { selectNow as y, messages as T, now as L } from "../messages/index.mjs";
14
+ import { TimeList as M } from "./TimeList.mjs";
15
+ import { MAX_TIME as P, MIN_TIME as C, MIDNIGHT_DATE as A } from "../utils.mjs";
16
16
  import { TIME_PART as d } from "./models/TimePart.mjs";
17
- import { isInTimeRange as $, getNow as z, snapTime as N, generateSnappers as B, timeInRange as W } from "./utils.mjs";
18
- import { Button as j } from "@progress/kendo-react-buttons";
17
+ import { isInTimeRange as K, getNow as _, snapTime as x, generateSnappers as I, timeInRange as z } from "./utils.mjs";
18
+ import { Button as $ } from "@progress/kendo-react-buttons";
19
19
  const v = new RegExp(
20
20
  `${d.hour}|${d.minute}|${d.second}|${d.dayperiod}|literal`
21
- ), a = class a extends n.Component {
21
+ ), r = class r extends n.Component {
22
22
  constructor(i) {
23
23
  super(i), this._element = null, this._nowButton = null, this.dateFormatParts = [], this.timeLists = [], this.focus = (s, e) => {
24
24
  Promise.resolve().then(() => {
@@ -27,25 +27,25 @@ const v = new RegExp(
27
27
  !e && this.state.activeListIndex === -1 && !this.hasActiveButton() && o && o.element && o.focus(s);
28
28
  });
29
29
  }, this.timeFormatReducer = (s, e) => s + e.pattern, this.timeFormatFilter = (s, e, o) => {
30
- const r = e >= 1 && o[e - 1];
31
- return r && r && s.type === "literal" ? v.test(r.type || "") : v.test(s.type || "");
30
+ const a = e >= 1 && o[e - 1];
31
+ return a && a && s.type === "literal" ? v.test(a.type || "") : v.test(s.type || "");
32
32
  }, this.focusList = (s) => {
33
33
  this.timeLists.length && this.timeLists.reduce(this.listReducer, []).map((e) => s === 1 ? e.next : e.prev).map((e) => e && e.element && e.element.focus({ preventScroll: !0 }));
34
- }, this.listReducer = (s, e, o, r) => s.length || e.props.id !== this.state.activeListIndex ? s : [
34
+ }, this.listReducer = (s, e, o, a) => s.length || e.props.id !== this.state.activeListIndex ? s : [
35
35
  {
36
- next: r[o + 1] || e,
37
- prev: r[o - 1] || e
36
+ next: a[o + 1] || e,
37
+ prev: a[o - 1] || e
38
38
  }
39
- ], this.showNowButton = () => !this.hasSteps() && this.props.nowButton && $(z(), this.min, this.max), this.handleKeyDown = (s) => {
39
+ ], this.showNowButton = () => !this.hasSteps() && this.props.nowButton && K(_(), this.min, this.max), this.handleKeyDown = (s) => {
40
40
  const { keyCode: e } = s;
41
41
  switch (e) {
42
- case T.left:
42
+ case b.left:
43
43
  s.preventDefault(), this.focusList(
44
44
  0
45
45
  /* Left */
46
46
  );
47
47
  return;
48
- case T.right:
48
+ case b.right:
49
49
  s.preventDefault(), this.focusList(
50
50
  1
51
51
  /* Right */
@@ -65,7 +65,7 @@ const v = new RegExp(
65
65
  }, this.handleChange = (s) => {
66
66
  const { onChange: e } = this.props;
67
67
  e && e.call(void 0, s);
68
- }, this.snapTime = N(B(this.props.steps, this.props.min || a.defaultProps.min)), this.state = {
68
+ }, this.snapTime = x(I(this.props.steps, this.props.min || r.defaultProps.min)), this.state = {
69
69
  activeListIndex: -1
70
70
  }, this.hasActiveButton = this.hasActiveButton.bind(this);
71
71
  }
@@ -76,22 +76,22 @@ const v = new RegExp(
76
76
  return this._element;
77
77
  }
78
78
  get value() {
79
- return W(this.snapTime(O(this.props.value || _)), this.min, this.max);
79
+ return z(this.snapTime(E(this.props.value || A)), this.min, this.max);
80
80
  }
81
81
  get intl() {
82
- return k(this);
82
+ return O(this);
83
83
  }
84
84
  get min() {
85
- return this.snapTime(this.props.min || a.defaultProps.min);
85
+ return this.snapTime(this.props.min || r.defaultProps.min);
86
86
  }
87
87
  get max() {
88
- return this.snapTime(this.props.max || a.defaultProps.max);
88
+ return this.snapTime(this.props.max || r.defaultProps.max);
89
89
  }
90
90
  get steps() {
91
- return this.props.steps || a.defaultProps.steps;
91
+ return this.props.steps || r.defaultProps.steps;
92
92
  }
93
93
  get boundRange() {
94
- return this.props.boundRange !== void 0 ? this.props.boundRange : a.defaultProps.boundRange;
94
+ return this.props.boundRange !== void 0 ? this.props.boundRange : r.defaultProps.boundRange;
95
95
  }
96
96
  /**
97
97
  * @hidden
@@ -107,66 +107,55 @@ const v = new RegExp(
107
107
  * @hidden
108
108
  */
109
109
  render() {
110
- const { format: i, smoothScroll: s, onNowClick: e, className: o, disabled: r, mobileMode: w, show: D, onNowKeyDown: E, unstyled: g } = this.props, m = g && g.uTime;
111
- this.snapTime = N(B(this.steps, this.min)), this.dateFormatParts = this.intl.splitDateFormat(i || a.defaultProps.format).filter(this.timeFormatFilter);
112
- const F = l(
113
- h.part({
114
- c: m,
115
- mobileMode: w,
116
- disabled: r
117
- }),
118
- o
119
- );
120
- this.timeLists = [];
121
- const b = S(this), y = b.toLanguageString(L, x[L]);
122
- return /* @__PURE__ */ n.createElement("div", { className: F }, /* @__PURE__ */ n.createElement("div", { className: l(h.header({ c: m })) }, /* @__PURE__ */ n.createElement("span", { className: l(h.title({ c: m })) }, this.intl.formatDate(this.value, this.dateFormatParts.reduce(this.timeFormatReducer, ""))), this.showNowButton() && /* @__PURE__ */ n.createElement(
123
- j,
110
+ const { format: i, smoothScroll: s, onNowClick: e, disabled: o, mobileMode: a, show: B, onNowKeyDown: N, unstyled: g } = this.props, m = g && g.uTime;
111
+ this.snapTime = x(I(this.steps, this.min)), this.dateFormatParts = this.intl.splitDateFormat(i || r.defaultProps.format).filter(this.timeFormatFilter), this.timeLists = [];
112
+ const w = R(this), D = w.toLanguageString(y, T[y]);
113
+ return /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("div", { className: h(u.header({ c: m })) }, /* @__PURE__ */ n.createElement("span", { className: h(u.title({ c: m })) }, this.intl.formatDate(this.value, this.dateFormatParts.reduce(this.timeFormatReducer, ""))), this.showNowButton() && /* @__PURE__ */ n.createElement(
114
+ $,
124
115
  {
125
116
  type: "button",
126
- ref: (u) => {
127
- this._nowButton = u;
117
+ ref: (l) => {
118
+ this._nowButton = l;
128
119
  },
129
- className: l(h.now({ c: m })),
120
+ size: a ? "large" : void 0,
121
+ className: h(u.now({ c: m })),
130
122
  fillMode: "flat",
131
- themeColor: "base",
132
- title: y,
133
- onKeyDown: E,
134
- "aria-label": y,
123
+ title: D,
124
+ onKeyDown: N,
135
125
  onClick: e,
136
- tabIndex: r ? -1 : 0
126
+ tabIndex: o ? -1 : 0
137
127
  },
138
- b.toLanguageString(I, x[I])
139
- )), /* @__PURE__ */ n.createElement("div", { className: l(h.listContainer({ c: m })), onKeyDown: this.handleKeyDown }, /* @__PURE__ */ n.createElement("span", { className: l(h.highlight({ c: m })) }), this.dateFormatParts.map((u, c) => u.type !== "literal" ? /* @__PURE__ */ n.createElement(
128
+ w.toLanguageString(L, T[L])
129
+ )), /* @__PURE__ */ n.createElement("div", { className: h(u.listContainer({ c: m })), onKeyDown: this.handleKeyDown }, /* @__PURE__ */ n.createElement("span", { className: h(u.highlight({ c: m })) }), this.dateFormatParts.map((l, c) => l.type !== "literal" ? /* @__PURE__ */ n.createElement(
140
130
  "div",
141
131
  {
142
132
  key: c,
143
- className: l(
144
- h.listWrapper({
133
+ className: h(
134
+ u.listWrapper({
145
135
  c: m,
146
136
  focused: c === this.state.activeListIndex
147
137
  })
148
138
  ),
149
- role: "presentation",
150
139
  tabIndex: -1
151
140
  },
152
141
  /* @__PURE__ */ n.createElement(
153
142
  "span",
154
143
  {
155
- className: l(h.title({ c: m })),
144
+ className: h(u.title({ c: m })),
156
145
  onMouseDown: (p) => {
157
146
  p.preventDefault();
158
147
  }
159
148
  },
160
- this.intl.dateFieldName(u)
149
+ this.intl.dateFieldName(l)
161
150
  ),
162
151
  /* @__PURE__ */ n.createElement(
163
- P,
152
+ M,
164
153
  {
165
154
  min: this.min,
166
155
  max: this.max,
167
156
  boundRange: this.boundRange,
168
- part: u,
169
- step: u.type ? this.steps[u.type] : 1,
157
+ part: l,
158
+ step: l.type ? this.steps[l.type] : 1,
170
159
  smoothScroll: s,
171
160
  ref: (p) => {
172
161
  p && this.timeLists.push(p);
@@ -178,19 +167,19 @@ const v = new RegExp(
178
167
  onBlur: this.handleListBlur,
179
168
  onChange: this.handleChange,
180
169
  value: this.value,
181
- disabled: r,
182
- show: D,
183
- mobileMode: w,
170
+ disabled: o,
171
+ show: B,
172
+ mobileMode: a,
184
173
  unstyled: g
185
174
  }
186
175
  )
187
- ) : /* @__PURE__ */ n.createElement("div", { key: c, className: l(h.separator({ c: m })) }, u.pattern))));
176
+ ) : /* @__PURE__ */ n.createElement("div", { key: c, className: h(u.separator({ c: m })) }, l.pattern))));
188
177
  }
189
178
  nextTick(i) {
190
179
  clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
191
180
  }
192
181
  hasActiveButton() {
193
- const i = R(document);
182
+ const i = F(document);
194
183
  return this._nowButton && i === this._nowButton.element;
195
184
  }
196
185
  hasSteps() {
@@ -198,7 +187,7 @@ const v = new RegExp(
198
187
  return i.length !== i.reduce((s, e) => s + this.steps[e], 0);
199
188
  }
200
189
  };
201
- a.propTypes = {
190
+ r.propTypes = {
202
191
  cancelButton: t.bool,
203
192
  disabled: t.bool,
204
193
  format: t.oneOfType([
@@ -233,20 +222,20 @@ a.propTypes = {
233
222
  tabIndex: t.number,
234
223
  value: t.instanceOf(Date),
235
224
  show: t.bool
236
- }, a.defaultProps = {
225
+ }, r.defaultProps = {
237
226
  value: null,
238
227
  disabled: !1,
239
228
  nowButton: !0,
240
229
  cancelButton: !0,
241
230
  format: "hh:mm a",
242
- min: K,
243
- max: A,
231
+ min: C,
232
+ max: P,
244
233
  steps: {},
245
234
  boundRange: !1
246
235
  };
247
- let f = a;
248
- C(f);
249
- M(f);
236
+ let f = r;
237
+ k(f);
238
+ S(f);
250
239
  export {
251
240
  f as TimePart
252
241
  };
@@ -135,6 +135,13 @@ export interface TimePickerProps extends TimePickerSettings, FormComponentProps,
135
135
  * Applicable only when `adaptive` is set to `true`.
136
136
  */
137
137
  adaptiveSubtitle?: string;
138
+ /**
139
+ * Controls the Popup animation.
140
+ * Set to `false` to disable animation.
141
+ *
142
+ * @default true
143
+ */
144
+ animation?: boolean;
138
145
  /**
139
146
  * @hidden
140
147
  */
@@ -217,6 +224,7 @@ export declare class TimePickerWithoutContext extends React.Component<TimePicker
217
224
  }> | null | undefined>>;
218
225
  id: PropTypes.Requireable<string>;
219
226
  ariaLabelledBy: PropTypes.Requireable<string>;
227
+ ariaLabel: PropTypes.Requireable<string>;
220
228
  ariaDescribedBy: PropTypes.Requireable<string>;
221
229
  min: PropTypes.Requireable<Date>;
222
230
  max: PropTypes.Requireable<Date>;
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Z=require("react"),e=require("prop-types"),$=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),J=require("@progress/kendo-svg-icons"),P=require("@progress/kendo-react-intl"),T=require("../package-metadata.js"),a=require("../messages/index.js"),Q=require("../dateinput/DateInput.js"),Y=require("./TimeSelector.js"),p=require("../utils.js"),g=require("./utils.js"),ee=require("../hooks/usePickerFloatingLabel.js"),te=require("@progress/kendo-react-buttons"),ie=require("../common/AdaptiveMode.js"),se=require("@progress/kendo-react-layout");function oe(c){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>c[t]})}}return s.default=c,Object.freeze(s)}const r=oe(Z),l=class l extends r.Component{constructor(s){super(s),this._element=null,this._dateInput=r.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.showLicenseWatermark=!1,this.handleKendoPasteValue=t=>{if(t instanceof Date&&!isNaN(t.getTime())){this.applyKendoPasteTime(t);return}const i=t!=null?String(t):"";if(!i)return;const o=new Date(i);isNaN(o.getTime())||this.applyKendoPasteTime(o)},this.applyKendoPasteTime=t=>{const i=this.normalizeTime(t);if(!g.isInRange(i,this.min,this.max))return;const o=new Event("change",{bubbles:!0}),h={target:this._element,currentTarget:this._element,nativeEvent:o};this.handleValueChange({syntheticEvent:h,nativeEvent:o,value:i})},this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:i,nowButton:o,disabled:h,format:d,steps:u,unstyled:f}=this.props;return r.createElement(Y.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:i,disabled:h,nowButton:o,format:d,min:this.min,max:this.max,steps:u,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject,unstyled:f})},this.renderPopup=()=>{const{popupClass:t,...i}=this.popupSettings,{unstyled:o}=this.props,h=o&&o.uTimePicker,d=n.classNames(t),u={popupClass:n.uTimePicker.popup({c:h}),show:this.show,animate:this.element!==null,anchor:this.element,className:d,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...i};return this.props.popup?r.createElement(this.props.popup,{...u},this.renderTimeSelector()):r.createElement($.Popup,{...u},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,i={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(a.toggleClock,a.messages[a.timePickerCancel]),onCancel:this.handleValueReject,applyText:this.localizationService.toLanguageString(a.timePickerSet,a.messages[a.timePickerSet]),onApply:o=>this.handleValueChange(o)}};return r.createElement(ie.AdaptiveMode,{...i},r.createElement(se.ActionSheetContent,null,this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,i)=>t.value!==void 0?t.value:i.value,this.nextShow=(t,i)=>t.show!==void 0?t.show:i.show,this.handleInputValueChange=t=>{const i=this.mergeTime(t.value);this.handleValueChange({...t,value:i})},this.handleTimeChange=t=>{this.setState({candidate:t.time})},this.handleValueChange=t=>{this.setState({value:y.cloneDate(t.value||this.state.candidate)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:i}=this.props,o=this.valueDuringOnChange!==void 0?this.value:this.state.candidate||this.value;i&&i.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:o,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setState({candidate:null}),this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.mobileMode||(this.shouldFocusDateInput=!0),this.setShow(!1)},this.handleClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:i,keyCode:o}=t;if(o===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(o===n.Keys.up||o===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=o===n.Keys.up,this.setShow(o===n.Keys.down))},this.showLicenseWatermark=!n.validatePackage(T.packageMetadata,{component:"TimePicker"}),this.licenseMessage=n.getLicenseMessage(T.packageMetadata),this.state={value:this.props.defaultValue||l.defaultProps.defaultValue,show:this.props.defaultShow||l.defaultProps.defaultShow,focused:!1,candidate:null},this.normalizeTime=this.normalizeTime.bind(this),this.setShow=this.setShow.bind(this),this.mergeTime=this.mergeTime.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get timeSelector(){return this._timeSelector}get value(){const s=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return s!==null?y.cloneDate(s):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get validity(){const s=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),i=this.normalizeTime(this.max),o=g.isInRange(s,t,i),h=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&o,u=this.props.valid!==void 0?this.props.valid:d;return{customError:h,rangeOverflow:g.isBiggerThanMax(s,i),rangeUnderflow:g.isSmallerThanMin(s,t),valid:u,valueMissing:this.value===null}}get mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get popupSettings(){return this.props.popupSettings||l.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get dateInputComp(){return this.props.dateInput||l.defaultProps.dateInput}get localizationService(){return P.provideLocalizationService(this)}componentDidMount(){var t;this.observerResize=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.observe(this.document.body);const s=this.props.name||this.props.id;this.KendoPasteSubscription=n.subscribeToKendoPaste(this._element,{fieldName:s,onValueChange:i=>{this.handleKendoPasteValue(i)}})}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow&&this._timeSelector.focusActiveList(),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._timeSelector&&this._timeSelector.focusActiveList()},300),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var s,t;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect(),(t=this.KendoPasteSubscription)==null||t.unsubscribe()}render(){const{size:s=l.defaultProps.size,rounded:t=l.defaultProps.rounded,fillMode:i=l.defaultProps.fillMode,disabled:o,tabIndex:h,title:d,id:u,className:f,format:I,formatPlaceholder:D,width:k,name:O,steps:z,validationMessage:x,required:R,validityStyles:q,ariaLabelledBy:E,ariaDescribedBy:L,unstyled:v,enableMouseWheel:N,autoCorrectParts:B,autoSwitchParts:F,autoSwitchKeys:K,allowCaretMode:V,inputAttributes:A}=this.props,b=v&&v.uTimePicker,w=!this.validityStyles||this.validity.valid,_=this.localizationService.toLanguageString(a.selectTime,a.messages[a.selectTime]),j={disabled:o,format:I,formatPlaceholder:D,id:u,ariaLabelledBy:E,ariaDescribedBy:L,ariaLabel:_,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:O,onChange:this.handleInputValueChange,required:R,steps:z,tabIndex:this.show?-1:h,title:d,valid:this.validity.valid,validationMessage:x,validityStyles:q,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,enableMouseWheel:N,autoCorrectParts:B,autoSwitchParts:F,autoSwitchKeys:K,allowCaretMode:V,inputAttributes:A},W=this.localizationService.toLanguageString(a.toggleClock,a.messages[a.toggleClock]),U=this.localizationService.toLanguageString(a.toggleTimeSelector,a.messages[a.toggleTimeSelector]),S=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:H,onBlur:G})=>r.createElement(r.Fragment,null,r.createElement("span",{ref:X=>{this._element=X},className:n.classNames(n.uTimePicker.wrapper({c:b,size:s,rounded:t,fillMode:i,invalid:!w,required:this.required,disabled:o}),{"k-focus":this.state.focused},f),onKeyDown:this.handleKeyDown,style:{width:k},onFocus:this.mobileMode?this.handleClick:H,onBlur:G,onClick:this.mobileMode?this.handleClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0,...j}),r.createElement(te.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:J.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:U,className:n.classNames(n.uTimePicker.inputButton({c:b})),fillMode:i,"aria-label":W}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&r.createElement(n.WatermarkOverlay,{message:this.licenseMessage})));return this.props.label?r.createElement(ee.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:u,editorValid:w,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}normalizeTime(s){return p.setTime(p.MIDNIGHT_DATE,s)}setShow(s){const{onOpen:t,onClose:i}=this.props;this.show!==s&&(this.setState({show:s}),s&&t&&t.call(void 0,{target:this}),!s&&i&&i.call(void 0,{target:this}))}mergeTime(s){return this.value&&s?p.setTime(this.value,s):s}calculateMedia(s){for(const t of s)this.setState({windowWidth:t.target.clientWidth})}};l.displayName="TimePicker",l.propTypes={className:e.string,cancelButton:e.bool,nowButton:e.bool,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),dateInput:e.elementType,show:e.bool,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full","none"]),fillMode:e.oneOf(["solid","flat","outline"]),inputAttributes:e.object},l.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:p.MAX_TIME,min:p.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},validityStyles:!0,dateInput:Q.DateInputInner,size:void 0,rounded:void 0,fillMode:void 0};let m=l;const C=n.createPropsContext(),M=n.withIdHOC(n.withPropsContext(C,n.withUnstyledHOC(n.withAdaptiveModeContext(m))));M.displayName="KendoReactTimePicker";P.registerForLocalization(m);exports.TimePicker=M;exports.TimePickerPropsContext=C;exports.TimePickerWithoutContext=m;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),e=require("prop-types"),Z=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),$=require("@progress/kendo-svg-icons"),P=require("@progress/kendo-react-intl"),T=require("../package-metadata.js"),l=require("../messages/index.js"),J=require("../dateinput/DateInput.js"),Q=require("./TimeSelector.js"),c=require("../utils.js"),g=require("./utils.js"),Y=require("../hooks/usePickerFloatingLabel.js"),ee=require("@progress/kendo-react-buttons"),te=require("../common/AdaptiveMode.js"),ie=require("@progress/kendo-react-layout");function se(p){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const t in p)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(p,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>p[t]})}}return s.default=p,Object.freeze(s)}const a=se(X),r=class r extends a.Component{constructor(s){super(s),this._element=null,this._dateInput=a.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.showLicenseWatermark=!1,this.handleKendoPasteValue=t=>{if(t instanceof Date&&!isNaN(t.getTime())){this.applyKendoPasteTime(t);return}const i=t!=null?String(t):"";if(!i)return;const o=new Date(i);isNaN(o.getTime())||this.applyKendoPasteTime(o)},this.applyKendoPasteTime=t=>{const i=this.normalizeTime(t);if(!g.isInRange(i,this.min,this.max))return;const o=new Event("change",{bubbles:!0}),h={target:this._element,currentTarget:this._element,nativeEvent:o};this.handleValueChange({syntheticEvent:h,nativeEvent:o,value:i})},this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:i,nowButton:o,disabled:h,format:d,steps:u,unstyled:f}=this.props;return a.createElement(Q.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:i,disabled:h,nowButton:o,format:d,min:this.min,max:this.max,steps:u,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject,unstyled:f})},this.renderPopup=()=>{const{popupClass:t,...i}=this.popupSettings,{unstyled:o}=this.props,h=o&&o.uTimePicker,d=n.classNames(t),u={popupClass:n.uTimePicker.popup({c:h}),show:this.show,animate:this.props.animation===!1?!1:this.element!==null,anchor:this.element,className:d,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...i};return this.props.popup?a.createElement(this.props.popup,{...u},this.renderTimeSelector()):a.createElement(Z.Popup,{...u},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,i={id:this._popupId,expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,animation:this.props.animation,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(l.toggleClock,l.messages[l.timePickerCancel]),onCancel:this.handleValueReject,applyText:this.localizationService.toLanguageString(l.timePickerSet,l.messages[l.timePickerSet]),onApply:o=>this.handleValueChange(o)}};return a.createElement(te.AdaptiveMode,{...i},a.createElement(ie.ActionSheetContent,null,this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,i)=>t.value!==void 0?t.value:i.value,this.nextShow=(t,i)=>t.show!==void 0?t.show:i.show,this.handleInputValueChange=t=>{const i=this.mergeTime(t.value);this.handleValueChange({...t,value:i})},this.handleTimeChange=t=>{this.setState({candidate:t.time})},this.handleValueChange=t=>{this.setState({value:y.cloneDate(t.value||this.state.candidate)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:i}=this.props,o=this.valueDuringOnChange!==void 0?this.value:this.state.candidate||this.value;i&&i.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:o,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setState({candidate:null}),this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.mobileMode||(this.shouldFocusDateInput=!0),this.setShow(!1)},this.handleClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:i,keyCode:o}=t;if(o===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(o===n.Keys.up||o===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=o===n.Keys.up,this.setShow(o===n.Keys.down))},this.showLicenseWatermark=!n.validatePackage(T.packageMetadata,{component:"TimePicker"}),this.licenseMessage=n.getLicenseMessage(T.packageMetadata),this.state={value:this.props.defaultValue||r.defaultProps.defaultValue,show:this.props.defaultShow||r.defaultProps.defaultShow,focused:!1,candidate:null},this.normalizeTime=this.normalizeTime.bind(this),this.setShow=this.setShow.bind(this),this.mergeTime=this.mergeTime.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get timeSelector(){return this._timeSelector}get value(){const s=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return s!==null?y.cloneDate(s):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get validity(){const s=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),i=this.normalizeTime(this.max),o=g.isInRange(s,t,i),h=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&o,u=this.props.valid!==void 0?this.props.valid:d;return{customError:h,rangeOverflow:g.isBiggerThanMax(s,i),rangeUnderflow:g.isSmallerThanMin(s,t),valid:u,valueMissing:this.value===null}}get mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:r.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get popupSettings(){return this.props.popupSettings||r.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:r.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:r.defaultProps.max}get dateInputComp(){return this.props.dateInput||r.defaultProps.dateInput}get localizationService(){return P.provideLocalizationService(this)}componentDidMount(){var t;this.observerResize=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.observe(this.document.body);const s=this.props.name||this.props.id;this.KendoPasteSubscription=n.subscribeToKendoPaste(this._element,{fieldName:s,onValueChange:i=>{this.handleKendoPasteValue(i)}})}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow&&this._timeSelector.focusActiveList(),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._timeSelector&&this._timeSelector.focusActiveList()},300),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var s,t;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect(),(t=this.KendoPasteSubscription)==null||t.unsubscribe()}render(){const{size:s=r.defaultProps.size,rounded:t=r.defaultProps.rounded,fillMode:i=r.defaultProps.fillMode,disabled:o,tabIndex:h,title:d,id:u,className:f,format:I,formatPlaceholder:D,width:k,name:O,steps:z,validationMessage:x,required:R,validityStyles:q,ariaLabelledBy:E,ariaDescribedBy:L,unstyled:v,enableMouseWheel:N,autoCorrectParts:B,autoSwitchParts:F,autoSwitchKeys:K,allowCaretMode:V,inputAttributes:_}=this.props,b=v&&v.uTimePicker,w=!this.validityStyles||this.validity.valid,A={disabled:o,format:I,formatPlaceholder:D,id:u,ariaLabelledBy:E,ariaDescribedBy:L,ariaLabel:this.props.ariaLabel,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:O,onChange:this.handleInputValueChange,required:R,steps:z,tabIndex:this.show?-1:h,title:d,valid:this.validity.valid,validationMessage:x,validityStyles:q,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.mobileMode?!1:this.show,enableMouseWheel:N,autoCorrectParts:B,autoSwitchParts:F,autoSwitchKeys:K,allowCaretMode:V,inputAttributes:_},j=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),W=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),S=a.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:U,onBlur:H})=>a.createElement(a.Fragment,null,a.createElement("span",{ref:G=>{this._element=G},className:n.classNames(n.uTimePicker.wrapper({c:b,size:s,rounded:t,fillMode:i,invalid:!w,required:this.required,disabled:o}),{"k-focus":this.state.focused},f),onKeyDown:this.handleKeyDown,style:{width:k},onFocus:this.mobileMode?this.handleClick:U,onBlur:H,onClick:this.mobileMode?this.handleClick:void 0},a.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0,...A}),a.createElement(ee.Button,{tabIndex:-1,type:"button",disabled:o,icon:"clock",svgIcon:$.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:W,className:n.classNames(n.uTimePicker.inputButton({c:b})),fillMode:i,"aria-label":j}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&a.createElement(n.WatermarkOverlay,{message:this.licenseMessage})));return this.props.label?a.createElement(Y.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:u,editorValid:w,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}normalizeTime(s){return c.setTime(c.MIDNIGHT_DATE,s)}setShow(s){const{onOpen:t,onClose:i}=this.props;this.show!==s&&(this.setState({show:s}),s&&t&&t.call(void 0,{target:this}),!s&&i&&i.call(void 0,{target:this}))}mergeTime(s){return this.value&&s?c.setTime(this.value,s):s}calculateMedia(s){for(const t of s)this.setState({windowWidth:t.target.clientWidth})}};r.displayName="TimePicker",r.propTypes={className:e.string,cancelButton:e.bool,nowButton:e.bool,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaLabel:e.string,ariaDescribedBy:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),dateInput:e.elementType,show:e.bool,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full","none"]),fillMode:e.oneOf(["solid","flat","outline"]),inputAttributes:e.object},r.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:c.MAX_TIME,min:c.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},validityStyles:!0,dateInput:J.DateInputInner,size:void 0,rounded:void 0,fillMode:void 0};let m=r;const C=n.createPropsContext(),M=n.withIdHOC(n.withPropsContext(C,n.withUnstyledHOC(n.withAdaptiveModeContext(m))));M.displayName="KendoReactTimePicker";P.registerForLocalization(m);exports.TimePicker=M;exports.TimePickerPropsContext=C;exports.TimePickerWithoutContext=m;