@progress/kendo-react-dateinputs 8.3.0-develop.6 → 8.3.0-develop.7

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 (49) hide show
  1. package/calendar/components/Calendar.js +2 -2
  2. package/calendar/components/Calendar.mjs +123 -115
  3. package/calendar/components/CalendarCell.js +1 -1
  4. package/calendar/components/CalendarCell.mjs +37 -39
  5. package/calendar/components/CalendarHeaderTitle.js +1 -1
  6. package/calendar/components/CalendarHeaderTitle.mjs +6 -12
  7. package/calendar/components/CalendarNavigationItem.js +1 -1
  8. package/calendar/components/CalendarNavigationItem.mjs +15 -19
  9. package/calendar/components/CalendarWeekCell.js +1 -1
  10. package/calendar/components/CalendarWeekCell.mjs +10 -15
  11. package/calendar/components/Header.js +1 -1
  12. package/calendar/components/Header.mjs +30 -40
  13. package/calendar/components/Navigation.js +1 -1
  14. package/calendar/components/Navigation.mjs +52 -49
  15. package/calendar/components/TodayCommand.js +1 -1
  16. package/calendar/components/TodayCommand.mjs +21 -25
  17. package/calendar/components/View.js +1 -1
  18. package/calendar/components/View.mjs +48 -42
  19. package/calendar/components/ViewList.js +1 -1
  20. package/calendar/components/ViewList.mjs +99 -94
  21. package/common/ClearButton.js +1 -1
  22. package/common/ClearButton.mjs +25 -31
  23. package/dateinput/DateInput.js +1 -1
  24. package/dateinput/DateInput.mjs +113 -110
  25. package/dateinput/utils.js +1 -1
  26. package/dateinput/utils.mjs +22 -23
  27. package/datepicker/DatePicker.js +1 -1
  28. package/datepicker/DatePicker.mjs +9 -9
  29. package/daterangepicker/DateRangePicker.js +1 -1
  30. package/daterangepicker/DateRangePicker.mjs +5 -5
  31. package/datetimepicker/DateTimePicker.js +1 -1
  32. package/datetimepicker/DateTimePicker.mjs +95 -90
  33. package/datetimepicker/DateTimeSelector.js +1 -1
  34. package/datetimepicker/DateTimeSelector.mjs +83 -81
  35. package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
  36. package/index.d.mts +38 -28
  37. package/index.d.ts +38 -28
  38. package/package-metadata.mjs +1 -1
  39. package/package.json +7 -7
  40. package/timepicker/TimeList.js +3 -3
  41. package/timepicker/TimeList.mjs +83 -81
  42. package/timepicker/TimePart.js +1 -1
  43. package/timepicker/TimePart.mjs +74 -68
  44. package/timepicker/TimePicker.js +1 -1
  45. package/timepicker/TimePicker.mjs +112 -107
  46. package/timepicker/TimeSelector.js +1 -1
  47. package/timepicker/TimeSelector.mjs +66 -59
  48. package/virtualization/Virtualization.js +1 -1
  49. package/virtualization/Virtualization.mjs +49 -48
@@ -7,55 +7,55 @@
7
7
  */
8
8
  "use client";
9
9
  import * as n from "react";
10
- import c from "prop-types";
11
- import { cloneDate as f } from "@progress/kendo-date-math";
12
- import { Keys as a, getActiveElement as x, noop as O } from "@progress/kendo-react-common";
13
- import { provideIntlService as b, registerForIntl as S } from "@progress/kendo-react-intl";
14
- import { Virtualization as T } from "../virtualization/Virtualization.mjs";
15
- import { TIME_PART as p } from "./models/TimePart.mjs";
16
- import { DayPeriodService as I } from "./services/DayPeriodService.mjs";
17
- import { DOMService as H } from "./services/DOMService.mjs";
18
- import { HoursService as E } from "./services/HoursService.mjs";
19
- import { MinutesService as y } from "./services/MinutesService.mjs";
20
- import { SecondsService as M } from "./services/SecondsService.mjs";
21
- import { debounce as D, MAX_TIME as w, MIDNIGHT_DATE as R } from "../utils.mjs";
22
- const k = 2, v = 0.05, C = 100, P = 0, g = 9, z = {
23
- [a.end]: (h, o) => h[h.length - 1],
24
- [a.home]: (h, o) => h[0],
25
- [a.up]: (h, o) => h[o - 1],
26
- [a.down]: (h, o) => h[o + 1]
27
- }, m = {
28
- [p.dayperiod]: I,
29
- [p.hour]: E,
30
- [p.minute]: y,
31
- [p.second]: M
10
+ import p from "prop-types";
11
+ import { cloneDate as O } from "@progress/kendo-date-math";
12
+ import { Keys as l, getActiveElement as I, noop as H, classNames as m, uTime as u } from "@progress/kendo-react-common";
13
+ import { provideIntlService as y, registerForIntl as E } from "@progress/kendo-react-intl";
14
+ import { Virtualization as M } from "../virtualization/Virtualization.mjs";
15
+ import { TIME_PART as f } from "./models/TimePart.mjs";
16
+ import { DayPeriodService as D } from "./services/DayPeriodService.mjs";
17
+ import { DOMService as w } from "./services/DOMService.mjs";
18
+ import { HoursService as R } from "./services/HoursService.mjs";
19
+ import { MinutesService as C } from "./services/MinutesService.mjs";
20
+ import { SecondsService as P } from "./services/SecondsService.mjs";
21
+ import { debounce as z, MAX_TIME as _, MIDNIGHT_DATE as A } from "../utils.mjs";
22
+ const F = 2, T = 0.05, N = 100, k = 0, b = 9, B = {
23
+ [l.end]: (h, s) => h[h.length - 1],
24
+ [l.home]: (h, s) => h[0],
25
+ [l.up]: (h, s) => h[s - 1],
26
+ [l.down]: (h, s) => h[s + 1]
27
+ }, g = {
28
+ [f.dayperiod]: D,
29
+ [f.hour]: R,
30
+ [f.minute]: C,
31
+ [f.second]: P
32
32
  }, r = class r extends n.Component {
33
- constructor(o) {
34
- super(o), this.intl = null, this._element = null, this.service = null, this.virtualization = null, this.topOffset = 0, this.bottomOffset = 0, this.itemHeight = 0, this.listHeight = 0, this.topThreshold = 0, this.bottomThreshold = 0, this.animateToIndex = !1, this.focus = (t) => {
33
+ constructor(s) {
34
+ super(s), this.intl = null, this._element = null, this.service = null, this.virtualization = null, this.topOffset = 0, this.bottomOffset = 0, this.itemHeight = 0, this.listHeight = 0, this.topThreshold = 0, this.bottomThreshold = 0, this.animateToIndex = !1, this.focus = (t) => {
35
35
  Promise.resolve().then(() => {
36
36
  this.element && this.element.focus(t);
37
37
  });
38
38
  }, this.itemOffset = (t) => {
39
39
  if (!this.virtualization || !this.service)
40
40
  return -1;
41
- const e = this.service.selectedIndex(this.props.value), i = this.virtualization.activeIndex(), s = this.virtualization.itemOffset(i), l = Math.abs(Math.ceil(t) - s);
42
- if (e === i && l < k)
43
- return s;
44
- const u = e > i;
45
- return u && l >= this.bottomThreshold || !u && l > this.topThreshold ? this.virtualization.itemOffset(i + 1) : s;
41
+ const e = this.service.selectedIndex(this.props.value), i = this.virtualization.activeIndex(), o = this.virtualization.itemOffset(i), a = Math.abs(Math.ceil(t) - o);
42
+ if (e === i && a < F)
43
+ return o;
44
+ const d = e > i;
45
+ return d && a >= this.bottomThreshold || !d && a > this.topThreshold ? this.virtualization.itemOffset(i + 1) : o;
46
46
  }, this.calculateHeights = () => {
47
- this.dom.didCalculate && (this.itemHeight = this.dom.itemHeight, this.listHeight = this.dom.timeListHeight, this.topOffset = (this.listHeight - this.itemHeight) / 2, this.bottomOffset = this.listHeight - this.itemHeight, this.props.mobileMode && (this.topOffset += g, this.bottomOffset += g * 2), this.topThreshold = this.itemHeight * v, this.bottomThreshold = this.itemHeight * (1 - v));
47
+ this.dom.didCalculate && (this.itemHeight = this.dom.itemHeight, this.listHeight = this.dom.timeListHeight, this.topOffset = (this.listHeight - this.itemHeight) / 2, this.bottomOffset = this.listHeight - this.itemHeight, this.props.mobileMode && (this.topOffset += b, this.bottomOffset += b * 2), this.topThreshold = this.itemHeight * T, this.bottomThreshold = this.itemHeight * (1 - T));
48
48
  }, this.configureServices = ({ min: t, max: e, value: i } = this.props) => {
49
49
  if (this.service) {
50
- const [s, l] = this.service.limitRange(t || this.min, e || this.max, i || this.props.value);
51
- this.service.configure(this.serviceSettings({ min: s, max: l }));
50
+ const [o, a] = this.service.limitRange(t || this.min, e || this.max, i || this.props.value);
51
+ this.service.configure(this.serviceSettings({ min: o, max: a }));
52
52
  }
53
53
  }, this.serviceSettings = (t) => {
54
54
  const e = {
55
55
  boundRange: this.props.boundRange || r.defaultProps.boundRange,
56
56
  insertUndividedMax: !1,
57
- min: f(this.min),
58
- max: f(this.max),
57
+ min: O(this.min),
58
+ max: O(this.max),
59
59
  part: this.props.part,
60
60
  step: this.step
61
61
  }, i = Object.assign({}, e, t);
@@ -63,8 +63,8 @@ const k = 2, v = 0.05, C = 100, P = 0, g = 9, z = {
63
63
  }, this.handleScrollAction = ({ target: t, animationInProgress: e }) => {
64
64
  if (!(!this.virtualization || !this.service) && t && !e) {
65
65
  this.animateToIndex = !1;
66
- const i = this.virtualization.itemIndex(this.itemOffset(t.scrollTop)), s = this.service.data(this.props.value)[i];
67
- this.handleChange(s);
66
+ const i = this.virtualization.itemIndex(this.itemOffset(t.scrollTop)), o = this.service.data(this.props.value)[i];
67
+ this.handleChange(o);
68
68
  }
69
69
  }, this.handleFocus = (t) => {
70
70
  const { onFocus: e } = this.props;
@@ -75,19 +75,19 @@ const k = 2, v = 0.05, C = 100, P = 0, g = 9, z = {
75
75
  }, this.handleMouseOver = () => {
76
76
  if (!this._element)
77
77
  return;
78
- const t = x(document);
78
+ const t = I(document);
79
79
  document && t !== this._element && this.props.show && this._element.focus({ preventScroll: !0 });
80
80
  }, this.handleKeyDown = (t) => {
81
81
  if (!this.service)
82
82
  return;
83
83
  const { keyCode: e } = t;
84
- (e === a.down || e === a.up || e === a.end || e === a.home) && t.preventDefault();
85
- const s = (z[t.keyCode] || O)(
84
+ (e === l.down || e === l.up || e === l.end || e === l.home) && t.preventDefault();
85
+ const o = (B[t.keyCode] || H)(
86
86
  this.service.data(this.props.value),
87
87
  this.service.selectedIndex(this.props.value)
88
88
  );
89
- s && this.handleChange(s);
90
- }, this.handleChange = D((t) => {
89
+ o && this.handleChange(o);
90
+ }, this.handleChange = z((t) => {
91
91
  if (!this.service)
92
92
  return;
93
93
  const e = this.service.apply(this.props.value, t.value);
@@ -95,7 +95,7 @@ const k = 2, v = 0.05, C = 100, P = 0, g = 9, z = {
95
95
  return;
96
96
  const { onChange: i } = this.props;
97
97
  i && i.call(void 0, e);
98
- }, C), this.dom = new H();
98
+ }, N), this.dom = new w();
99
99
  }
100
100
  get element() {
101
101
  return this._element;
@@ -126,34 +126,36 @@ const k = 2, v = 0.05, C = 100, P = 0, g = 9, z = {
126
126
  componentDidUpdate() {
127
127
  if (!this.virtualization || !this.service)
128
128
  return;
129
- const o = this.service.selectedIndex(this.props.value);
130
- this.virtualization[this.animate ? "animateToIndex" : "scrollToIndex"](o), this.animateToIndex = !0;
129
+ const s = this.service.selectedIndex(this.props.value);
130
+ this.virtualization[this.animate ? "animateToIndex" : "scrollToIndex"](s), this.animateToIndex = !0;
131
131
  }
132
132
  /**
133
133
  * @hidden
134
134
  */
135
135
  render() {
136
- if (!this.props.part.type || !m[this.props.part.type])
136
+ const { part: s, value: t, unstyled: e } = this.props;
137
+ if (!s.type || !g[s.type])
137
138
  return;
138
- this.calculateHeights(), this.intl = b(this), this.service = new m[this.props.part.type](this.intl), this.configureServices();
139
- const o = this.service.data(this.props.value), t = "translateY(" + this.topOffset + "px)", e = this.service.total(this.props.value), i = /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
139
+ const i = e && e.uTime;
140
+ this.calculateHeights(), this.intl = y(this), this.service = new g[s.type](this.intl), this.configureServices();
141
+ const o = this.service.data(t), a = "translateY(" + this.topOffset + "px)", d = this.service.total(t), v = /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
140
142
  "ul",
141
143
  {
142
- style: { transform: t, msTransform: t },
143
- className: "k-reset"
144
+ style: { transform: a, msTransform: a },
145
+ className: m(u.ul({ c: i }))
144
146
  },
145
- o.map((s, l) => /* @__PURE__ */ n.createElement("li", { key: l, className: "k-item", onClick: () => {
146
- this.handleChange(s);
147
- } }, /* @__PURE__ */ n.createElement("span", null, s.text)))
148
- ), /* @__PURE__ */ n.createElement("div", { className: "k-scrollable-placeholder" }));
147
+ o.map((c, S) => /* @__PURE__ */ n.createElement("li", { key: S, className: m(u.li({ c: i })), onClick: () => {
148
+ this.handleChange(c);
149
+ } }, /* @__PURE__ */ n.createElement("span", null, c.text)))
150
+ ), /* @__PURE__ */ n.createElement("div", { className: m(u.scrollablePlaceholder({ c: i })) }));
149
151
  return /* @__PURE__ */ n.createElement(
150
152
  "div",
151
153
  {
152
- className: "k-time-list",
154
+ className: m(u.list({ c: i })),
153
155
  id: String(this.props.id || ""),
154
156
  tabIndex: this.props.disabled ? -1 : 0,
155
- ref: (s) => {
156
- this._element = s;
157
+ ref: (c) => {
158
+ this._element = c;
157
159
  },
158
160
  onKeyDown: this.handleKeyDown,
159
161
  onFocus: this.handleFocus,
@@ -161,43 +163,43 @@ const k = 2, v = 0.05, C = 100, P = 0, g = 9, z = {
161
163
  onMouseOver: this.handleMouseOver
162
164
  },
163
165
  this.dom.didCalculate ? /* @__PURE__ */ n.createElement(
164
- T,
166
+ M,
165
167
  {
166
168
  bottomOffset: this.bottomOffset,
167
- children: i,
168
- className: "k-time-container",
169
+ children: v,
170
+ className: m(u.container({ c: i })),
169
171
  itemHeight: this.itemHeight,
170
172
  maxScrollDifference: this.listHeight,
171
173
  onScrollAction: this.handleScrollAction,
172
- ref: (s) => {
173
- this.virtualization = s;
174
+ ref: (c) => {
175
+ this.virtualization = c;
174
176
  },
175
177
  role: "presentation",
176
- skip: P,
178
+ skip: k,
177
179
  tabIndex: -1,
178
- take: e,
180
+ take: d,
179
181
  topOffset: this.topOffset,
180
- total: e
182
+ total: d
181
183
  }
182
- ) : /* @__PURE__ */ n.createElement("div", { className: "k-time-container k-content k-scrollable" }, i)
184
+ ) : /* @__PURE__ */ n.createElement("div", { className: m(u.container({ c: i, content: !0, scrollable: !0 })) }, v)
183
185
  );
184
186
  }
185
187
  };
186
188
  r.propTypes = {
187
- id: c.number,
188
- max: c.instanceOf(Date),
189
- min: c.instanceOf(Date),
190
- part: function(o, t, e) {
191
- const i = o[t];
192
- if (!i || !m[i.type])
189
+ id: p.number,
190
+ max: p.instanceOf(Date),
191
+ min: p.instanceOf(Date),
192
+ part: function(s, t, e) {
193
+ const i = s[t];
194
+ if (!i || !g[i.type])
193
195
  throw new Error(`
194
196
  Invalid prop '${t}' supplied to ${e}.
195
197
  Supported part types are hour|minute|second|dayperiod.
196
198
  `);
197
199
  return null;
198
200
  },
199
- step: function(o, t, e) {
200
- const i = o[t];
201
+ step: function(s, t, e) {
202
+ const i = s[t];
201
203
  if (i !== void 0 && i <= 0)
202
204
  throw new Error(`
203
205
  Invalid prop '${t}' supplied to ${e}.
@@ -205,18 +207,18 @@ r.propTypes = {
205
207
  `);
206
208
  return null;
207
209
  },
208
- value: c.instanceOf(Date),
209
- smoothScroll: c.bool,
210
- show: c.bool
210
+ value: p.instanceOf(Date),
211
+ smoothScroll: p.bool,
212
+ show: p.bool
211
213
  }, r.defaultProps = {
212
214
  boundRange: !1,
213
- max: w,
214
- min: R,
215
+ max: _,
216
+ min: A,
215
217
  step: 1,
216
218
  smoothScroll: !0
217
219
  };
218
- let d = r;
219
- S(d);
220
+ let x = r;
221
+ E(x);
220
222
  export {
221
- d as TimeList
223
+ x as TimeList
222
224
  };
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),e=require("prop-types"),R=require("@progress/kendo-date-math"),p=require("@progress/kendo-react-common"),v=require("@progress/kendo-react-intl"),m=require("../messages/index.js"),O=require("./TimeList.js"),w=require("../utils.js"),g=require("./models/TimePart.js"),u=require("./utils.js"),B=require("@progress/kendo-react-buttons");function D(c){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const s in c)if(s!=="default"){const t=Object.getOwnPropertyDescriptor(c,s);Object.defineProperty(n,s,t.get?t:{enumerable:!0,get:()=>c[s]})}}return n.default=c,Object.freeze(n)}const i=D(x),b=new RegExp(`${g.TIME_PART.hour}|${g.TIME_PART.minute}|${g.TIME_PART.second}|${g.TIME_PART.dayperiod}|literal`),a=class a extends i.Component{constructor(n){super(n),this._element=null,this._nowButton=null,this.dateFormatParts=[],this.timeLists=[],this.focus=(s,t)=>{Promise.resolve().then(()=>{t&&this._nowButton&&this._nowButton.element&&this._nowButton.element.focus();const o=this.timeLists[0];!t&&this.state.activeListIndex===-1&&!this.hasActiveButton()&&o&&o.element&&o.focus(s)})},this.timeFormatReducer=(s,t)=>s+t.pattern,this.timeFormatFilter=(s,t,o)=>{const r=t>=1&&o[t-1];return r&&r&&s.type==="literal"?b.test(r.type||""):b.test(s.type||"")},this.focusList=s=>{this.timeLists.length&&this.timeLists.reduce(this.listReducer,[]).map(t=>s===1?t.next:t.prev).map(t=>t&&t.element&&t.element.focus({preventScroll:!0}))},this.listReducer=(s,t,o,r)=>s.length||t.props.id!==this.state.activeListIndex?s:[{next:r[o+1]||t,prev:r[o-1]||t}],this.showNowButton=()=>!this.hasSteps()&&this.props.nowButton&&u.isInTimeRange(u.getNow(),this.min,this.max),this.handleKeyDown=s=>{const{keyCode:t}=s;switch(t){case p.Keys.left:s.preventDefault(),this.focusList(0);return;case p.Keys.right:s.preventDefault(),this.focusList(1);return;default:return}},this.handleListBlur=()=>{this.nextTick(()=>{this.setState({activeListIndex:-1})})},this.handleListFocus=s=>{clearTimeout(this.nextTickId),this.setState({activeListIndex:s})},this.handleChange=s=>{const{onChange:t}=this.props;t&&t.call(void 0,s)},this.snapTime=u.snapTime(u.generateSnappers(this.props.steps,this.props.min||a.defaultProps.min)),this.state={activeListIndex:-1},this.hasActiveButton=this.hasActiveButton.bind(this)}get element(){return this._element}get value(){return u.timeInRange(this.snapTime(R.cloneDate(this.props.value||w.MIDNIGHT_DATE)),this.min,this.max)}get intl(){return v.provideIntlService(this)}get min(){return this.snapTime(this.props.min||a.defaultProps.min)}get max(){return this.snapTime(this.props.max||a.defaultProps.max)}get steps(){return this.props.steps||a.defaultProps.steps}get boundRange(){return this.props.boundRange!==void 0?this.props.boundRange:a.defaultProps.boundRange}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidMount(){const{onMount:n}=this.props;n&&n.call(void 0,this.value)}render(){const{format:n,smoothScroll:s,onNowClick:t,className:o,disabled:r,mobileMode:T,show:I,onNowKeyDown:L}=this.props;this.snapTime=u.snapTime(u.generateSnappers(this.steps,this.min)),this.dateFormatParts=this.intl.splitDateFormat(n||a.defaultProps.format).filter(this.timeFormatFilter);const N=p.classNames({"k-disabled":r,"k-time-part":T},o);this.timeLists=[];const y=v.provideLocalizationService(this),k=y.toLanguageString(m.selectNow,m.messages[m.selectNow]);return i.createElement("div",{className:N},i.createElement("div",{className:"k-time-header"},i.createElement("span",{className:"k-title"},this.intl.formatDate(this.value,this.dateFormatParts.reduce(this.timeFormatReducer,""))),this.showNowButton()&&i.createElement(B.Button,{type:"button",ref:l=>{this._nowButton=l},className:"k-time-now",fillMode:"flat",themeColor:"base",title:k,onKeyDown:L,"aria-label":k,onClick:t,tabIndex:r?-1:0},y.toLanguageString(m.now,m.messages[m.now]))),i.createElement("div",{className:"k-time-list-container",onKeyDown:this.handleKeyDown},i.createElement("span",{className:"k-time-highlight"}),this.dateFormatParts.map((l,h)=>l.type!=="literal"?i.createElement("div",{key:h,className:p.classNames("k-time-list-wrapper",{"k-focus":h===this.state.activeListIndex}),role:"presentation",tabIndex:-1},i.createElement("span",{className:"k-title",onMouseDown:f=>{f.preventDefault()}},this.intl.dateFieldName(l)),i.createElement(O.TimeList,{min:this.min,max:this.max,boundRange:this.boundRange,part:l,step:l.type?this.steps[l.type]:1,smoothScroll:s,ref:f=>{f&&this.timeLists.push(f)},id:h,onFocus:()=>{this.handleListFocus(h)},onBlur:this.handleListBlur,onChange:this.handleChange,value:this.value,disabled:r,show:I,mobileMode:T})):i.createElement("div",{key:h,className:"k-time-separator"},l.pattern))))}nextTick(n){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>n())}hasActiveButton(){const n=p.getActiveElement(document);return this._nowButton&&n===this._nowButton.element}hasSteps(){const n=Object.keys(this.steps);return n.length!==n.reduce((s,t)=>s+this.steps[t],0)}};a.propTypes={cancelButton:e.bool,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"])})]),max:e.instanceOf(Date),min:e.instanceOf(Date),nowButton:e.bool,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,value:e.instanceOf(Date),show:e.bool},a.defaultProps={value:null,disabled:!1,nowButton:!0,cancelButton:!0,format:"hh:mm a",min:w.MIN_TIME,max:w.MAX_TIME,steps:{},boundRange:!1};let d=a;v.registerForIntl(d);v.registerForLocalization(d);exports.TimePart=d;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),e=require("prop-types"),D=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),v=require("@progress/kendo-react-intl"),h=require("../messages/index.js"),E=require("./TimeList.js"),b=require("../utils.js"),T=require("./models/TimePart.js"),m=require("./utils.js"),k=require("@progress/kendo-react-buttons");function P(p){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const s in p)if(s!=="default"){const t=Object.getOwnPropertyDescriptor(p,s);Object.defineProperty(i,s,t.get?t:{enumerable:!0,get:()=>p[s]})}}return i.default=p,Object.freeze(i)}const o=P(B),y=new RegExp(`${T.TIME_PART.hour}|${T.TIME_PART.minute}|${T.TIME_PART.second}|${T.TIME_PART.dayperiod}|literal`),l=class l extends o.Component{constructor(i){super(i),this._element=null,this._nowButton=null,this.dateFormatParts=[],this.timeLists=[],this.focus=(s,t)=>{Promise.resolve().then(()=>{t&&this._nowButton&&this._nowButton.element&&this._nowButton.element.focus();const a=this.timeLists[0];!t&&this.state.activeListIndex===-1&&!this.hasActiveButton()&&a&&a.element&&a.focus(s)})},this.timeFormatReducer=(s,t)=>s+t.pattern,this.timeFormatFilter=(s,t,a)=>{const r=t>=1&&a[t-1];return r&&r&&s.type==="literal"?y.test(r.type||""):y.test(s.type||"")},this.focusList=s=>{this.timeLists.length&&this.timeLists.reduce(this.listReducer,[]).map(t=>s===1?t.next:t.prev).map(t=>t&&t.element&&t.element.focus({preventScroll:!0}))},this.listReducer=(s,t,a,r)=>s.length||t.props.id!==this.state.activeListIndex?s:[{next:r[a+1]||t,prev:r[a-1]||t}],this.showNowButton=()=>!this.hasSteps()&&this.props.nowButton&&m.isInTimeRange(m.getNow(),this.min,this.max),this.handleKeyDown=s=>{const{keyCode:t}=s;switch(t){case n.Keys.left:s.preventDefault(),this.focusList(0);return;case n.Keys.right:s.preventDefault(),this.focusList(1);return;default:return}},this.handleListBlur=()=>{this.nextTick(()=>{this.setState({activeListIndex:-1})})},this.handleListFocus=s=>{clearTimeout(this.nextTickId),this.setState({activeListIndex:s})},this.handleChange=s=>{const{onChange:t}=this.props;t&&t.call(void 0,s)},this.snapTime=m.snapTime(m.generateSnappers(this.props.steps,this.props.min||l.defaultProps.min)),this.state={activeListIndex:-1},this.hasActiveButton=this.hasActiveButton.bind(this)}get element(){return this._element}get value(){return m.timeInRange(this.snapTime(D.cloneDate(this.props.value||b.MIDNIGHT_DATE)),this.min,this.max)}get intl(){return v.provideIntlService(this)}get min(){return this.snapTime(this.props.min||l.defaultProps.min)}get max(){return this.snapTime(this.props.max||l.defaultProps.max)}get steps(){return this.props.steps||l.defaultProps.steps}get boundRange(){return this.props.boundRange!==void 0?this.props.boundRange:l.defaultProps.boundRange}componentWillUnmount(){clearTimeout(this.nextTickId)}componentDidMount(){const{onMount:i}=this.props;i&&i.call(void 0,this.value)}render(){const{format:i,smoothScroll:s,onNowClick:t,className:a,disabled:r,mobileMode:N,show:x,onNowKeyDown:R,unstyled:w}=this.props,u=w&&w.uTime;this.snapTime=m.snapTime(m.generateSnappers(this.steps,this.min)),this.dateFormatParts=this.intl.splitDateFormat(i||l.defaultProps.format).filter(this.timeFormatFilter);const O=n.classNames(n.uTime.part({c:u,mobileMode:N,disabled:r}),a);this.timeLists=[];const I=v.provideLocalizationService(this),L=I.toLanguageString(h.selectNow,h.messages[h.selectNow]);return o.createElement("div",{className:O},o.createElement("div",{className:n.classNames(n.uTime.header({c:u}))},o.createElement("span",{className:n.classNames(n.uTime.title({c:u}))},this.intl.formatDate(this.value,this.dateFormatParts.reduce(this.timeFormatReducer,""))),this.showNowButton()&&o.createElement(k.Button,{type:"button",ref:c=>{this._nowButton=c},className:n.classNames(n.uTime.now({c:u})),fillMode:"flat",themeColor:"base",title:L,onKeyDown:R,"aria-label":L,onClick:t,tabIndex:r?-1:0},I.toLanguageString(h.now,h.messages[h.now]))),o.createElement("div",{className:n.classNames(n.uTime.listContainer({c:u})),onKeyDown:this.handleKeyDown},o.createElement("span",{className:n.classNames(n.uTime.highlight({c:u}))}),this.dateFormatParts.map((c,d)=>c.type!=="literal"?o.createElement("div",{key:d,className:n.classNames(n.uTime.listWrapper({c:u,focused:d===this.state.activeListIndex})),role:"presentation",tabIndex:-1},o.createElement("span",{className:n.classNames(n.uTime.title({c:u})),onMouseDown:g=>{g.preventDefault()}},this.intl.dateFieldName(c)),o.createElement(E.TimeList,{min:this.min,max:this.max,boundRange:this.boundRange,part:c,step:c.type?this.steps[c.type]:1,smoothScroll:s,ref:g=>{g&&this.timeLists.push(g)},id:d,onFocus:()=>{this.handleListFocus(d)},onBlur:this.handleListBlur,onChange:this.handleChange,value:this.value,disabled:r,show:x,mobileMode:N,unstyled:w})):o.createElement("div",{key:d,className:n.classNames(n.uTime.separator({c:u}))},c.pattern))))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}hasActiveButton(){const i=n.getActiveElement(document);return this._nowButton&&i===this._nowButton.element}hasSteps(){const i=Object.keys(this.steps);return i.length!==i.reduce((s,t)=>s+this.steps[t],0)}};l.propTypes={cancelButton:e.bool,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"])})]),max:e.instanceOf(Date),min:e.instanceOf(Date),nowButton:e.bool,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,value:e.instanceOf(Date),show:e.bool},l.defaultProps={value:null,disabled:!1,nowButton:!0,cancelButton:!0,format:"hh:mm a",min:b.MIN_TIME,max:b.MAX_TIME,steps:{},boundRange:!1};let f=l;v.registerForIntl(f);v.registerForLocalization(f);exports.TimePart=f;
@@ -8,16 +8,16 @@
8
8
  "use client";
9
9
  import * as n from "react";
10
10
  import t from "prop-types";
11
- import { cloneDate as B } from "@progress/kendo-date-math";
12
- import { Keys as v, classNames as w, getActiveElement as D } from "@progress/kendo-react-common";
13
- import { provideIntlService as E, provideLocalizationService as F, registerForIntl as O, registerForLocalization as R } from "@progress/kendo-react-intl";
14
- import { selectNow as b, messages as k, now as y } from "../messages/index.mjs";
15
- import { TimeList as S } from "./TimeList.mjs";
16
- import { MIN_TIME as M, MAX_TIME as P, MIDNIGHT_DATE as C } from "../utils.mjs";
17
- import { TIME_PART as u } from "./models/TimePart.mjs";
18
- import { isInTimeRange as A, getNow as K, snapTime as L, generateSnappers as x, timeInRange as _ } from "./utils.mjs";
19
- import { Button as $ } from "@progress/kendo-react-buttons";
20
- const p = new RegExp(`${u.hour}|${u.minute}|${u.second}|${u.dayperiod}|literal`), a = class a extends n.Component {
11
+ import { cloneDate as O } from "@progress/kendo-date-math";
12
+ import { Keys as T, classNames as l, uTime as h, getActiveElement as R } from "@progress/kendo-react-common";
13
+ import { provideIntlService as k, provideLocalizationService as S, registerForIntl as C, registerForLocalization as M } from "@progress/kendo-react-intl";
14
+ import { selectNow as L, messages as x, now as I } from "../messages/index.mjs";
15
+ import { TimeList as P } from "./TimeList.mjs";
16
+ import { MIN_TIME as A, MAX_TIME as K, MIDNIGHT_DATE as _ } from "../utils.mjs";
17
+ import { TIME_PART as d } from "./models/TimePart.mjs";
18
+ import { isInTimeRange as $, getNow as z, snapTime as N, generateSnappers as B, timeInRange as W } from "./utils.mjs";
19
+ import { Button as j } from "@progress/kendo-react-buttons";
20
+ const v = new RegExp(`${d.hour}|${d.minute}|${d.second}|${d.dayperiod}|literal`), a = class a extends n.Component {
21
21
  constructor(i) {
22
22
  super(i), this._element = null, this._nowButton = null, this.dateFormatParts = [], this.timeLists = [], this.focus = (s, e) => {
23
23
  Promise.resolve().then(() => {
@@ -27,22 +27,22 @@ const p = new RegExp(`${u.hour}|${u.minute}|${u.second}|${u.dayperiod}|literal`)
27
27
  });
28
28
  }, this.timeFormatReducer = (s, e) => s + e.pattern, this.timeFormatFilter = (s, e, o) => {
29
29
  const r = e >= 1 && o[e - 1];
30
- return r && r && s.type === "literal" ? p.test(r.type || "") : p.test(s.type || "");
30
+ return r && r && s.type === "literal" ? v.test(r.type || "") : v.test(s.type || "");
31
31
  }, this.focusList = (s) => {
32
32
  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 }));
33
33
  }, this.listReducer = (s, e, o, r) => s.length || e.props.id !== this.state.activeListIndex ? s : [{
34
34
  next: r[o + 1] || e,
35
35
  prev: r[o - 1] || e
36
- }], this.showNowButton = () => !this.hasSteps() && this.props.nowButton && A(K(), this.min, this.max), this.handleKeyDown = (s) => {
36
+ }], this.showNowButton = () => !this.hasSteps() && this.props.nowButton && $(z(), this.min, this.max), this.handleKeyDown = (s) => {
37
37
  const { keyCode: e } = s;
38
38
  switch (e) {
39
- case v.left:
39
+ case T.left:
40
40
  s.preventDefault(), this.focusList(
41
41
  0
42
42
  /* Left */
43
43
  );
44
44
  return;
45
- case v.right:
45
+ case T.right:
46
46
  s.preventDefault(), this.focusList(
47
47
  1
48
48
  /* Right */
@@ -62,8 +62,8 @@ const p = new RegExp(`${u.hour}|${u.minute}|${u.second}|${u.dayperiod}|literal`)
62
62
  }, this.handleChange = (s) => {
63
63
  const { onChange: e } = this.props;
64
64
  e && e.call(void 0, s);
65
- }, this.snapTime = L(
66
- x(this.props.steps, this.props.min || a.defaultProps.min)
65
+ }, this.snapTime = N(
66
+ B(this.props.steps, this.props.min || a.defaultProps.min)
67
67
  ), this.state = {
68
68
  activeListIndex: -1
69
69
  }, this.hasActiveButton = this.hasActiveButton.bind(this);
@@ -75,14 +75,14 @@ const p = new RegExp(`${u.hour}|${u.minute}|${u.second}|${u.dayperiod}|literal`)
75
75
  return this._element;
76
76
  }
77
77
  get value() {
78
- return _(
79
- this.snapTime(B(this.props.value || C)),
78
+ return W(
79
+ this.snapTime(O(this.props.value || _)),
80
80
  this.min,
81
81
  this.max
82
82
  );
83
83
  }
84
84
  get intl() {
85
- return E(this);
85
+ return k(this);
86
86
  }
87
87
  get min() {
88
88
  return this.snapTime(this.props.min || a.defaultProps.min);
@@ -116,88 +116,94 @@ const p = new RegExp(`${u.hour}|${u.minute}|${u.second}|${u.dayperiod}|literal`)
116
116
  onNowClick: e,
117
117
  className: o,
118
118
  disabled: r,
119
- mobileMode: d,
120
- show: I,
121
- onNowKeyDown: T
122
- } = this.props;
123
- this.snapTime = L(x(this.steps, this.min)), this.dateFormatParts = this.intl.splitDateFormat(i || a.defaultProps.format).filter(this.timeFormatFilter);
124
- const N = w(
125
- {
126
- "k-disabled": r,
127
- "k-time-part": d
128
- },
119
+ mobileMode: w,
120
+ show: D,
121
+ onNowKeyDown: E,
122
+ unstyled: g
123
+ } = this.props, m = g && g.uTime;
124
+ this.snapTime = N(B(this.steps, this.min)), this.dateFormatParts = this.intl.splitDateFormat(i || a.defaultProps.format).filter(this.timeFormatFilter);
125
+ const F = l(
126
+ h.part({
127
+ c: m,
128
+ mobileMode: w,
129
+ disabled: r
130
+ }),
129
131
  o
130
132
  );
131
133
  this.timeLists = [];
132
- const f = F(this), g = f.toLanguageString(b, k[b]);
133
- return /* @__PURE__ */ n.createElement("div", { className: N }, /* @__PURE__ */ n.createElement("div", { className: "k-time-header" }, /* @__PURE__ */ n.createElement("span", { className: "k-title" }, this.intl.formatDate(this.value, this.dateFormatParts.reduce(this.timeFormatReducer, ""))), this.showNowButton() && /* @__PURE__ */ n.createElement(
134
- $,
134
+ const b = S(this), y = b.toLanguageString(L, x[L]);
135
+ 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(
136
+ j,
135
137
  {
136
138
  type: "button",
137
- ref: (m) => {
138
- this._nowButton = m;
139
+ ref: (u) => {
140
+ this._nowButton = u;
139
141
  },
140
- className: "k-time-now",
142
+ className: l(h.now({ c: m })),
141
143
  fillMode: "flat",
142
144
  themeColor: "base",
143
- title: g,
144
- onKeyDown: T,
145
- "aria-label": g,
145
+ title: y,
146
+ onKeyDown: E,
147
+ "aria-label": y,
146
148
  onClick: e,
147
149
  tabIndex: r ? -1 : 0
148
150
  },
149
- f.toLanguageString(y, k[y])
151
+ b.toLanguageString(I, x[I])
150
152
  )), /* @__PURE__ */ n.createElement(
151
153
  "div",
152
154
  {
153
- className: "k-time-list-container",
155
+ className: l(h.listContainer({ c: m })),
154
156
  onKeyDown: this.handleKeyDown
155
157
  },
156
- /* @__PURE__ */ n.createElement("span", { className: "k-time-highlight" }),
157
- this.dateFormatParts.map((m, l) => m.type !== "literal" ? /* @__PURE__ */ n.createElement(
158
+ /* @__PURE__ */ n.createElement("span", { className: l(h.highlight({ c: m })) }),
159
+ this.dateFormatParts.map((u, c) => u.type !== "literal" ? /* @__PURE__ */ n.createElement(
158
160
  "div",
159
161
  {
160
- key: l,
161
- className: w("k-time-list-wrapper", {
162
- "k-focus": l === this.state.activeListIndex
163
- }),
162
+ key: c,
163
+ className: l(
164
+ h.listWrapper({
165
+ c: m,
166
+ focused: c === this.state.activeListIndex
167
+ })
168
+ ),
164
169
  role: "presentation",
165
170
  tabIndex: -1
166
171
  },
167
- /* @__PURE__ */ n.createElement("span", { className: "k-title", onMouseDown: (h) => {
168
- h.preventDefault();
169
- } }, this.intl.dateFieldName(m)),
172
+ /* @__PURE__ */ n.createElement("span", { className: l(h.title({ c: m })), onMouseDown: (p) => {
173
+ p.preventDefault();
174
+ } }, this.intl.dateFieldName(u)),
170
175
  /* @__PURE__ */ n.createElement(
171
- S,
176
+ P,
172
177
  {
173
178
  min: this.min,
174
179
  max: this.max,
175
180
  boundRange: this.boundRange,
176
- part: m,
177
- step: m.type ? this.steps[m.type] : 1,
181
+ part: u,
182
+ step: u.type ? this.steps[u.type] : 1,
178
183
  smoothScroll: s,
179
- ref: (h) => {
180
- h && this.timeLists.push(h);
184
+ ref: (p) => {
185
+ p && this.timeLists.push(p);
181
186
  },
182
- id: l,
187
+ id: c,
183
188
  onFocus: () => {
184
- this.handleListFocus(l);
189
+ this.handleListFocus(c);
185
190
  },
186
191
  onBlur: this.handleListBlur,
187
192
  onChange: this.handleChange,
188
193
  value: this.value,
189
194
  disabled: r,
190
- show: I,
191
- mobileMode: d
195
+ show: D,
196
+ mobileMode: w,
197
+ unstyled: g
192
198
  }
193
199
  )
194
200
  ) : /* @__PURE__ */ n.createElement(
195
201
  "div",
196
202
  {
197
- key: l,
198
- className: "k-time-separator"
203
+ key: c,
204
+ className: l(h.separator({ c: m }))
199
205
  },
200
- m.pattern
206
+ u.pattern
201
207
  ))
202
208
  ));
203
209
  }
@@ -205,7 +211,7 @@ const p = new RegExp(`${u.hour}|${u.minute}|${u.second}|${u.dayperiod}|literal`)
205
211
  clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
206
212
  }
207
213
  hasActiveButton() {
208
- const i = D(document);
214
+ const i = R(document);
209
215
  return this._nowButton && i === this._nowButton.element;
210
216
  }
211
217
  hasSteps() {
@@ -254,14 +260,14 @@ a.propTypes = {
254
260
  nowButton: !0,
255
261
  cancelButton: !0,
256
262
  format: "hh:mm a",
257
- min: M,
258
- max: P,
263
+ min: A,
264
+ max: K,
259
265
  steps: {},
260
266
  boundRange: !1
261
267
  };
262
- let c = a;
263
- O(c);
264
- R(c);
268
+ let f = a;
269
+ C(f);
270
+ M(f);
265
271
  export {
266
- c as TimePart
272
+ f as TimePart
267
273
  };
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react"),e=require("prop-types"),L=require("@progress/kendo-react-popup"),w=require("@progress/kendo-date-math"),a=require("@progress/kendo-react-common"),_=require("@progress/kendo-svg-icons"),b=require("@progress/kendo-react-intl"),K=require("../package-metadata.js"),l=require("../messages/index.js"),j=require("../dateinput/DateInput.js"),U=require("./TimeSelector.js"),c=require("../utils.js"),g=require("./utils.js"),$=require("../hooks/usePickerFloatingLabel.js"),H=require("@progress/kendo-react-buttons"),W=require("../common/constants.js"),G=require("../common/AdaptiveMode.js"),X=require("@progress/kendo-react-layout");function Z(d){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const t in d)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(d,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>d[t]})}}return i.default=d,Object.freeze(i)}const r=Z(A),n=class n extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:s,nowButton:o,disabled:h,format:p,steps:u}=this.props;return r.createElement(U.TimeSelector,{ref:this.setTimeSelectorRef,className:this.mobileMode?"k-reset k-timeselector-lg":"",mobileMode:this.mobileMode,show:this.show,cancelButton:s,disabled:h,nowButton:o,format:p,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})},this.renderPopup=()=>{const{popupClass:t,...s}=this.popupSettings,o=a.classNames(t),h={popupClass:"k-timepicker-popup k-list-container",show:this.show,animate:this.element!==null,anchor:this.element,className:o,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...s};return this.props.popup?r.createElement(this.props.popup,{...h},this.renderTimeSelector()):r.createElement(L.Popup,{...h},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,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 r.createElement(G.AdaptiveMode,{...s},r.createElement(X.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,s)=>t.value!==void 0?t.value:s.value,this.nextShow=(t,s)=>t.show!==void 0?t.show:s.show,this.handleInputValueChange=t=>{const s=this.mergeTime(t.value);this.handleValueChange({...t,value:s})},this.handleTimeChange=t=>{this.setState({candidate:t.time})},this.handleValueChange=t=>{this.setState({value:w.cloneDate(t.value||this.state.candidate)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.shouldFocusDateInput=!0;const{onChange:s}=this.props,o=this.state.candidate||this.value;s&&s.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.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.setShow(!1)},this.handleIconClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:o}=t;if(o===a.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(o===a.Keys.up||o===a.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=o===a.Keys.up,this.setShow(o===a.Keys.down))},a.validatePackage(K.packageMetadata),this.state={value:this.props.defaultValue||n.defaultProps.defaultValue,show:this.props.defaultShow||n.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(a.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 i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?w.cloneDate(i):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 i=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),s=this.normalizeTime(this.max),o=g.isInRange(i,t,s),h=this.props.validationMessage!==void 0,p=(!this.required||this.value!==null)&&o,u=this.props.valid!==void 0?this.props.valid:p;return{customError:h,rangeOverflow:g.isBiggerThanMax(i,s),rangeUnderflow:g.isSmallerThanMin(i,t),valid:u,valueMissing:this.value===null}}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=W.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:n.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:n.defaultProps.required}get popupSettings(){return this.props.popupSettings||n.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:n.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:n.defaultProps.max}get dateInputComp(){return this.props.dateInput||n.defaultProps.dateInput}get localizationService(){return b.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=a.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow?this._timeSelector.focusActiveList():this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=n.defaultProps.size,rounded:t=n.defaultProps.rounded,fillMode:s=n.defaultProps.fillMode,disabled:o,tabIndex:h,title:p,id:u,className:I,format:k,formatPlaceholder:M,width:T,name:C,steps:D,validationMessage:O,required:P,validityStyles:z,ariaLabelledBy:q,ariaDescribedBy:x}=this.props,f=!this.validityStyles||this.validity.valid,R={disabled:o,format:k,formatPlaceholder:M,id:u,ariaLabelledBy:q,ariaDescribedBy:x,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:C,onChange:this.handleInputValueChange,required:P,steps:D,tabIndex:this.show?-1:h,title:p,valid:this.validity.valid,validationMessage:O,validityStyles:z,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,size:null,fillMode:null,rounded:null,readonly:this.mobileMode},E=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),B=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),v=r.createElement(a.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:V,onBlur:F})=>r.createElement(r.Fragment,null,r.createElement("span",{id:this.props.id,ref:N=>{this._element=N},className:a.classNames("k-input","k-timepicker",{[`k-input-${a.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-rounded-${a.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${s}`]:s,"k-invalid":!f,"k-required":this.required,"k-disabled":this.props.disabled},I),onKeyDown:this.handleKeyDown,style:{width:T},onFocus:V,onBlur:F,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,...R}),r.createElement(H.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:_.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleIconClick,title:B,className:"k-input-button",rounded:null,fillMode:s,"aria-label":E}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement($.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:u,editorValid:f,editorDisabled:this.props.disabled,children:v,style:{width:this.props.width}}):v}normalizeTime(i){return c.setTime(c.MIDNIGHT_DATE,i)}setShow(i){const{onOpen:t,onClose:s}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&s&&s.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?c.setTime(this.value,i):i}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};n.displayName="TimePicker",n.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}),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([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"])},n.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:c.MAX_TIME,min:c.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},required:!1,validityStyles:!0,dateInput:j.DateInput,size:"medium",rounded:"medium",fillMode:"solid"};let m=n;const S=a.createPropsContext(),y=a.withIdHOC(a.withPropsContext(S,m));y.displayName="KendoReactTimePicker";b.registerForLocalization(m);exports.TimePicker=y;exports.TimePickerPropsContext=S;exports.TimePickerWithoutContext=m;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),e=require("prop-types"),K=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),j=require("@progress/kendo-svg-icons"),I=require("@progress/kendo-react-intl"),U=require("../package-metadata.js"),l=require("../messages/index.js"),H=require("../dateinput/DateInput.js"),W=require("./TimeSelector.js"),c=require("../utils.js"),f=require("./utils.js"),G=require("../hooks/usePickerFloatingLabel.js"),X=require("@progress/kendo-react-buttons"),Z=require("../common/constants.js"),$=require("../common/AdaptiveMode.js"),J=require("@progress/kendo-react-layout");function Q(p){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const t in p)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(p,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>p[t]})}}return i.default=p,Object.freeze(i)}const r=Q(_),a=class a extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:s,nowButton:o,disabled:u,format:d,steps:h,unstyled:g}=this.props;return r.createElement(W.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:s,disabled:u,nowButton:o,format:d,min:this.min,max:this.max,steps:h,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject,unstyled:g})},this.renderPopup=()=>{const{popupClass:t,...s}=this.popupSettings,{unstyled:o}=this.props,u=o&&o.uTimePicker,d=n.classNames(t),h={popupClass:n.uTimePicker.popup({c:u}),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"},...s};return this.props.popup?r.createElement(this.props.popup,{...h},this.renderTimeSelector()):r.createElement(K.Popup,{...h},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,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 r.createElement($.AdaptiveMode,{...s},r.createElement(J.ActionSheetContent,{overflowHidden:!0},this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},this.nextValue=(t,s)=>t.value!==void 0?t.value:s.value,this.nextShow=(t,s)=>t.show!==void 0?t.show:s.show,this.handleInputValueChange=t=>{const s=this.mergeTime(t.value);this.handleValueChange({...t,value:s})},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.shouldFocusDateInput=!0;const{onChange:s}=this.props,o=this.state.candidate||this.value;s&&s.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.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleValueReject=t=>{this.setShow(!1)},this.handleIconClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:o}=t;if(o===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(o===n.Keys.up||o===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=o===n.Keys.up,this.setShow(o===n.Keys.down))},n.validatePackage(U.packageMetadata),this.state={value:this.props.defaultValue||a.defaultProps.defaultValue,show:this.props.defaultShow||a.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 i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?y.cloneDate(i):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 i=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),s=this.normalizeTime(this.max),o=f.isInRange(i,t,s),u=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&o,h=this.props.valid!==void 0?this.props.valid:d;return{customError:u,rangeOverflow:f.isBiggerThanMax(i,s),rangeUnderflow:f.isSmallerThanMin(i,t),valid:h,valueMissing:this.value===null}}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=Z.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:a.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:a.defaultProps.required}get popupSettings(){return this.props.popupSettings||a.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:a.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:a.defaultProps.max}get dateInputComp(){return this.props.dateInput||a.defaultProps.dateInput}get localizationService(){return I.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow?this._timeSelector.focusActiveList():this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=a.defaultProps.size,rounded:t=a.defaultProps.rounded,fillMode:s=a.defaultProps.fillMode,disabled:o,tabIndex:u,title:d,id:h,className:g,format:M,formatPlaceholder:P,width:D,name:O,steps:k,validationMessage:z,required:q,validityStyles:x,ariaLabelledBy:R,ariaDescribedBy:E,unstyled:v}=this.props,w=v&&v.uTimePicker,S=!this.validityStyles||this.validity.valid,B={disabled:o,format:M,formatPlaceholder:P,id:h,ariaLabelledBy:R,ariaDescribedBy:E,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:O,onChange:this.handleInputValueChange,required:q,steps:k,tabIndex:this.show?-1:u,title:d,valid:this.validity.valid,validationMessage:z,validityStyles:x,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,size:null,fillMode:null,rounded:null,readonly:this.mobileMode},V=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),F=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),b=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:N,onBlur:A})=>r.createElement(r.Fragment,null,r.createElement("span",{id:this.props.id,ref:L=>{this._element=L},className:n.classNames(n.uTimePicker.wrapper({c:w,size:i,rounded:t,fillMode:s,invalid:!S,required:this.required,disabled:o}),g),onKeyDown:this.handleKeyDown,style:{width:D},onFocus:N,onBlur:A,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,...B}),r.createElement(X.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:j.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleIconClick,title:F,className:n.classNames(n.uTimePicker.inputButton({c:w})),rounded:null,fillMode:s,"aria-label":V}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(G.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:S,editorDisabled:this.props.disabled,children:b,style:{width:this.props.width}}):b}normalizeTime(i){return c.setTime(c.MIDNIGHT_DATE,i)}setShow(i){const{onOpen:t,onClose:s}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&s&&s.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?c.setTime(this.value,i):i}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};a.displayName="TimePicker",a.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}),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([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"])},a.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:c.MAX_TIME,min:c.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},required:!1,validityStyles:!0,dateInput:H.DateInput,size:"medium",rounded:"medium",fillMode:"solid"};let m=a;const T=n.createPropsContext(),C=n.withIdHOC(n.withPropsContext(T,n.withUnstyledHOC(m)));C.displayName="KendoReactTimePicker";I.registerForLocalization(m);exports.TimePicker=C;exports.TimePickerPropsContext=T;exports.TimePickerWithoutContext=m;