@progress/kendo-react-dateinputs 14.5.0-develop.7 → 14.5.0-develop.9

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.
@@ -5,19 +5,19 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as i from "react";
9
- import { provideLocalizationService as R, registerForLocalization as M } from "@progress/kendo-react-intl";
10
- import { dateTimePickerCancel as C, messages as p, dateTimePickerSet as _, date as D, time as T } from "../messages/index.mjs";
11
- import { Button as f, ButtonGroup as x } from "@progress/kendo-react-buttons";
8
+ import * as n from "react";
9
+ import { provideLocalizationService as x, registerForLocalization as M } from "@progress/kendo-react-intl";
10
+ import { dateTimePickerCancel as y, messages as d, dateTimePickerSet as C, date as _, time as D } from "../messages/index.mjs";
11
+ import { Button as T, SegmentedControl as R } from "@progress/kendo-react-buttons";
12
12
  import { Calendar as z } from "../calendar/components/Calendar.mjs";
13
13
  import { TimePart as A } from "../timepicker/TimePart.mjs";
14
- import { MIDNIGHT_DATE as g, MAX_TIME as F, MIN_TIME as L, getToday as E, setTime as P } from "../utils.mjs";
14
+ import { MIDNIGHT_DATE as p, MAX_TIME as F, MIN_TIME as L, getToday as E, setTime as P } from "../utils.mjs";
15
15
  import { isEqualDate as V } from "@progress/kendo-date-math";
16
- import { classNames as l, uDateTimePicker as m, uTime as k, Keys as h, getActiveElement as I } from "@progress/kendo-react-common";
17
- import { getNow as B } from "../timepicker/utils.mjs";
18
- const b = class b extends i.Component {
16
+ import { classNames as r, uDateTimePicker as u, uTime as S, Keys as h, getActiveElement as I } from "@progress/kendo-react-common";
17
+ import { getNow as k } from "../timepicker/utils.mjs";
18
+ const v = class v extends n.Component {
19
19
  constructor(s) {
20
- super(s), this._calendar = null, this._timePart = null, this._cancelButton = null, this._acceptButton = null, this._dateButtonRef = null, this._calendarWrap = null, this.shouldFocusPart = !1, this.focus = (t) => {
20
+ super(s), this._calendar = null, this._timePart = null, this._cancelButton = null, this._acceptButton = null, this._buttonGroupRef = null, this._calendarWrap = null, this.shouldFocusPart = !1, this.focus = (t) => {
21
21
  Promise.resolve().then(() => {
22
22
  this.state.tab === "time" && this._timePart && this._timePart.focus(t);
23
23
  const e = this.calendarElement();
@@ -29,41 +29,41 @@ const b = class b extends i.Component {
29
29
  const e = t === "left" ? "date" : "time";
30
30
  this.shouldFocusPart = !0, this.setState({ tab: e });
31
31
  }, this.dateTimeFooter = () => {
32
- const { cancelButton: t, unstyled: e } = this.props, a = e && e.uDateTimePicker, n = this.localizationService.toLanguageString(C, p[C]), r = this.localizationService.toLanguageString(_, p[_]);
33
- return /* @__PURE__ */ i.createElement("div", { className: l(m.timeFooter({ c: a })) }, /* @__PURE__ */ i.createElement(
34
- f,
32
+ const { cancelButton: t, unstyled: e } = this.props, a = e && e.uDateTimePicker, i = this.localizationService.toLanguageString(y, d[y]), l = this.localizationService.toLanguageString(C, d[C]);
33
+ return /* @__PURE__ */ n.createElement("div", { className: r(u.timeFooter({ c: a })) }, /* @__PURE__ */ n.createElement(
34
+ T,
35
35
  {
36
36
  type: "button",
37
37
  themeColor: "primary",
38
38
  ref: (o) => {
39
39
  this._acceptButton = o;
40
40
  },
41
- className: l(k.accept({ c: a })),
41
+ className: r(S.accept({ c: a })),
42
42
  disabled: !this.hasDateValue,
43
43
  onClick: this.handleAccept,
44
44
  onKeyDown: this.handleSetKeyDown,
45
- title: r,
46
- "aria-label": r
45
+ title: l,
46
+ "aria-label": l
47
47
  },
48
- r
49
- ), t && /* @__PURE__ */ i.createElement(
50
- f,
48
+ l
49
+ ), t && /* @__PURE__ */ n.createElement(
50
+ T,
51
51
  {
52
52
  type: "button",
53
53
  ref: (o) => {
54
54
  this._cancelButton = o;
55
55
  },
56
- className: l(k.cancel({ c: a })),
56
+ className: r(S.cancel({ c: a })),
57
57
  onClick: this.handleReject,
58
58
  onKeyDown: this.handleCancelKeyDown,
59
- title: n,
60
- "aria-label": n
59
+ title: i,
60
+ "aria-label": i
61
61
  },
62
- n
62
+ i
63
63
  ));
64
64
  }, this.handleReject = (t) => {
65
- this.setState({ dateValue: this.props.value, timeValue: this.props.value || g });
66
- const e = this.mergeDate(this.props.value, this.props.value || g);
65
+ this.setState({ dateValue: this.props.value, timeValue: this.props.value || p });
66
+ const e = this.mergeDate(this.props.value, this.props.value || p);
67
67
  if (this.props.onReject) {
68
68
  const a = {
69
69
  nativeEvent: t.nativeEvent,
@@ -76,23 +76,22 @@ const b = class b extends i.Component {
76
76
  }, this.handleAccept = (t, e) => {
77
77
  if (!this.state.dateValue || !this.state.timeValue || !this.hasDateValue)
78
78
  return;
79
- const a = e || (this._timePart ? this._timePart.value : this.state.timeValue), n = this.mergeDate(this.state.dateValue, a);
79
+ const a = e || (this._timePart ? this._timePart.value : this.state.timeValue), i = this.mergeDate(this.state.dateValue, a);
80
80
  this.props.onChange.call(void 0, {
81
81
  syntheticEvent: t,
82
82
  nativeEvent: t.nativeEvent,
83
- value: n,
83
+ value: i,
84
84
  target: this
85
85
  });
86
86
  }, this.handleNowClick = (t) => {
87
- this.setState({ timeValue: B() }), this.handleAccept(t, B());
87
+ this.setState({ timeValue: k() }), this.handleAccept(t, k());
88
88
  }, this.handleCalendarValueChange = (t) => {
89
89
  t.syntheticEvent.stopPropagation(), this.setState({ dateValue: t.value, tab: "time" }), this.shouldFocusPart = !0;
90
90
  }, this.handleTimeListContainerChange = (t) => {
91
91
  this.setState({ timeValue: t });
92
- }, this.handleDateClick = (t) => {
93
- t.stopPropagation(), this.move("left");
94
- }, this.handleTimeClick = (t) => {
95
- t.stopPropagation(), this.move("right");
92
+ }, this.handleTabChange = (t) => {
93
+ const e = t === "date" ? "left" : "right";
94
+ this.move(e);
96
95
  }, this.handleKeyDown = (t) => {
97
96
  const { keyCode: e, altKey: a } = t;
98
97
  if (!this.props.disabled)
@@ -114,26 +113,26 @@ const b = class b extends i.Component {
114
113
  return;
115
114
  }
116
115
  }, this.handleCancelKeyDown = (t) => {
117
- var a;
118
- const { keyCode: e } = t;
119
- e === h.tab && ((a = this._dateButtonRef) != null && a.element) && (t.preventDefault(), this._dateButtonRef.element.focus());
116
+ var i;
117
+ const { keyCode: e } = t, a = (i = this._buttonGroupRef) == null ? void 0 : i.querySelector(".k-segmented-control-button");
118
+ e === h.tab && a && (t.preventDefault(), a.focus());
120
119
  }, this.handleSetKeyDown = (t) => {
121
- var a;
122
- const { keyCode: e } = t;
123
- e === h.tab && !this.props.cancelButton && ((a = this._dateButtonRef) != null && a.element) && (t.preventDefault(), this._dateButtonRef.element.focus());
120
+ var i;
121
+ const { keyCode: e } = t, a = (i = this._buttonGroupRef) == null ? void 0 : i.querySelector(".k-segmented-control-button");
122
+ e === h.tab && !this.props.cancelButton && a && (t.preventDefault(), a.focus());
124
123
  }, this.handleDateKeyDown = (t) => {
125
- var n, r, o;
124
+ var i, l, o;
126
125
  const { keyCode: e, shiftKey: a } = t;
127
- a && e === h.tab && (t.stopPropagation(), (n = this._cancelButton) != null && n.element ? this._cancelButton.element.focus() : (o = (r = this._acceptButton) == null ? void 0 : r.element) == null || o.focus()), e === h.enter && (t.stopPropagation(), this.move("left"));
126
+ a && e === h.tab && (t.stopPropagation(), (i = this._cancelButton) != null && i.element ? this._cancelButton.element.focus() : (o = (l = this._acceptButton) == null ? void 0 : l.element) == null || o.focus()), e === h.enter && t.stopPropagation();
128
127
  }, this.handleTimeKeyDown = (t) => {
129
128
  const { keyCode: e } = t;
130
- e === h.enter && (t.stopPropagation(), this.move("right"));
129
+ e === h.enter && t.stopPropagation();
131
130
  }, this.handleTimePartMount = (t) => {
132
131
  this.setState({ timeValue: t });
133
132
  }, this.state = {
134
133
  tab: "date",
135
134
  dateValue: this.props.value,
136
- timeValue: this.props.value || g
135
+ timeValue: this.props.value || p
137
136
  };
138
137
  }
139
138
  get calendar() {
@@ -146,28 +145,28 @@ const b = class b extends i.Component {
146
145
  return this.state.dateValue !== null;
147
146
  }
148
147
  get localizationService() {
149
- return R(this);
148
+ return x(this);
150
149
  }
151
150
  componentDidUpdate(s, t) {
152
151
  var e, a;
153
- this.shouldFocusPart && this.focus({ preventScroll: !0 }), (((e = s.value) == null ? void 0 : e.getTime()) !== ((a = this.props.value) == null ? void 0 : a.getTime()) || this.state.tab !== t.tab && this.props.value) && this.setState((n) => ({
154
- dateValue: s.value && this.props.value && V(s.value, this.props.value) ? n.dateValue : this.props.value,
155
- timeValue: this.props.value || g
152
+ this.shouldFocusPart && this.focus({ preventScroll: !0 }), (((e = s.value) == null ? void 0 : e.getTime()) !== ((a = this.props.value) == null ? void 0 : a.getTime()) || this.state.tab !== t.tab && this.props.value) && this.setState((i) => ({
153
+ dateValue: s.value && this.props.value && V(s.value, this.props.value) ? i.dateValue : this.props.value,
154
+ timeValue: this.props.value || p
156
155
  })), this.shouldFocusPart = !1;
157
156
  }
158
157
  render() {
159
- const { disabled: s, min: t, max: e, weekNumber: a, focusedDate: n, format: r, mobileMode: o, footerActions: w, unstyled: d } = this.props, u = d && d.uDateTimePicker, S = l(
160
- m.wrap({
161
- c: u,
158
+ const { disabled: s, min: t, max: e, weekNumber: a, focusedDate: i, format: l, mobileMode: o, footerActions: w, unstyled: f } = this.props, m = f && f.uDateTimePicker, B = r(
159
+ u.wrap({
160
+ c: m,
162
161
  date: this.state.tab === "date",
163
162
  time: this.state.tab === "time",
164
163
  disabled: s
165
164
  })
166
- ), K = this.localizationService.toLanguageString(D, p[D]), N = this.localizationService.toLanguageString(T, p[T]), y = {
165
+ ), K = this.localizationService.toLanguageString(_, d[_]), N = this.localizationService.toLanguageString(D, d[D]), b = {
167
166
  min: t,
168
167
  max: e,
169
168
  weekNumber: a,
170
- focusedDate: n,
169
+ focusedDate: i,
171
170
  disabled: s || this.state.tab !== "date",
172
171
  value: this.state.dateValue,
173
172
  onChange: this.handleCalendarValueChange,
@@ -175,50 +174,54 @@ const b = class b extends i.Component {
175
174
  tabIndex: s || this.state.tab !== "date" ? -1 : void 0,
176
175
  mobileMode: o
177
176
  };
178
- return /* @__PURE__ */ i.createElement("div", { onKeyDown: this.handleKeyDown, className: S, tabIndex: -1 }, /* @__PURE__ */ i.createElement("div", { className: l(m.buttonGroup({ c: u })) }, /* @__PURE__ */ i.createElement(x, { width: "100%", unstyled: d }, /* @__PURE__ */ i.createElement(
179
- f,
177
+ return /* @__PURE__ */ n.createElement("div", { onKeyDown: this.handleKeyDown, className: B, tabIndex: -1 }, /* @__PURE__ */ n.createElement(
178
+ "div",
180
179
  {
180
+ className: r(u.buttonGroup({ c: m })),
181
181
  ref: (c) => {
182
- this._dateButtonRef = c;
183
- },
184
- type: "button",
185
- selected: this.state.tab === "date",
186
- togglable: !0,
187
- size: o ? "large" : void 0,
188
- onClick: this.handleDateClick,
189
- onKeyDown: this.handleDateKeyDown
190
- },
191
- K
192
- ), /* @__PURE__ */ i.createElement(
193
- f,
194
- {
195
- type: "button",
196
- selected: this.state.tab === "time",
197
- togglable: !0,
198
- size: o ? "large" : void 0,
199
- onClick: this.handleTimeClick,
200
- onKeyDown: this.handleTimeKeyDown
182
+ this._buttonGroupRef = c;
183
+ }
201
184
  },
202
- N
203
- ))), /* @__PURE__ */ i.createElement("div", { className: l(m.selector({ c: u })) }, /* @__PURE__ */ i.createElement(
185
+ /* @__PURE__ */ n.createElement(
186
+ R,
187
+ {
188
+ layoutMode: "stretch",
189
+ size: o ? "large" : void 0,
190
+ value: this.state.tab,
191
+ onChange: this.handleTabChange,
192
+ items: [
193
+ {
194
+ value: "date",
195
+ text: K,
196
+ onKeyDown: this.handleDateKeyDown
197
+ },
198
+ {
199
+ value: "time",
200
+ text: N,
201
+ onKeyDown: this.handleTimeKeyDown
202
+ }
203
+ ]
204
+ }
205
+ )
206
+ ), /* @__PURE__ */ n.createElement("div", { className: r(u.selector({ c: m })) }, /* @__PURE__ */ n.createElement(
204
207
  "div",
205
208
  {
206
- className: l(m.calendarWrap({ c: u })),
209
+ className: r(u.calendarWrap({ c: m })),
207
210
  ref: (c) => {
208
211
  this._calendarWrap = c;
209
212
  }
210
213
  },
211
- this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { key: this.state.tab, ...y }) : /* @__PURE__ */ i.createElement(
214
+ this.props.calendar ? /* @__PURE__ */ n.createElement(this.props.calendar, { key: this.state.tab, ...b }) : /* @__PURE__ */ n.createElement(
212
215
  z,
213
216
  {
214
217
  key: this.state.tab,
215
218
  ref: (c) => {
216
219
  this._calendar = c;
217
220
  },
218
- ...y
221
+ ...b
219
222
  }
220
223
  )
221
- ), /* @__PURE__ */ i.createElement("div", { className: l(m.timeWrap({ c: u })) }, /* @__PURE__ */ i.createElement("div", { className: l(m.timeSelector({ c: u, mobileMode: o })) }, /* @__PURE__ */ i.createElement(
224
+ ), /* @__PURE__ */ n.createElement("div", { className: r(u.timeWrap({ c: m })) }, /* @__PURE__ */ n.createElement("div", { className: r(u.timeSelector({ c: m, mobileMode: o })) }, /* @__PURE__ */ n.createElement(
222
225
  A,
223
226
  {
224
227
  key: 1,
@@ -231,11 +234,11 @@ const b = class b extends i.Component {
231
234
  max: this.maxTime || F,
232
235
  steps: this.props.steps,
233
236
  value: this.state.timeValue,
234
- format: r,
237
+ format: l,
235
238
  onChange: this.handleTimeListContainerChange,
236
239
  onMount: this.handleTimePartMount,
237
240
  mobileMode: o,
238
- unstyled: d
241
+ unstyled: f
239
242
  }
240
243
  )))), w && this.dateTimeFooter());
241
244
  }
@@ -261,11 +264,11 @@ const b = class b extends i.Component {
261
264
  return s ? P(s || E(), t) : t;
262
265
  }
263
266
  };
264
- b.defaultProps = {
267
+ v.defaultProps = {
265
268
  footerActions: !0
266
269
  };
267
- let v = b;
268
- M(v);
270
+ let g = v;
271
+ M(g);
269
272
  export {
270
- v as DateTimeSelector
273
+ g as DateTimeSelector
271
274
  };