@progress/kendo-react-dateinputs 9.0.0-develop.2 → 9.0.0-develop.21

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 (40) hide show
  1. package/README.md +47 -46
  2. package/calendar/components/Calendar.mjs +57 -60
  3. package/calendar/components/CalendarNavigationItem.mjs +10 -12
  4. package/calendar/components/CalendarWeekCell.mjs +9 -1
  5. package/calendar/components/HorizontalViewList.mjs +8 -11
  6. package/calendar/components/MultiViewCalendar.mjs +13 -8
  7. package/calendar/components/Navigation.mjs +11 -11
  8. package/calendar/components/View.mjs +8 -25
  9. package/common/PickerWrap.mjs +2 -15
  10. package/dateinput/DateInput.js +1 -1
  11. package/dateinput/DateInput.mjs +264 -321
  12. package/dateinput/dateInputIntl.js +8 -0
  13. package/dateinput/dateInputIntl.mjs +20 -0
  14. package/dateinput/utils.js +1 -1
  15. package/dateinput/utils.mjs +4 -27
  16. package/datepicker/DatePicker.js +1 -1
  17. package/datepicker/DatePicker.mjs +104 -82
  18. package/daterangepicker/DateRangePicker.mjs +14 -3
  19. package/datetimepicker/DateTimePicker.js +1 -1
  20. package/datetimepicker/DateTimePicker.mjs +102 -81
  21. package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
  22. package/hooks/usePickerFloatingLabel.js +1 -1
  23. package/hooks/usePickerFloatingLabel.mjs +6 -11
  24. package/index.d.mts +177 -36
  25. package/index.d.ts +177 -36
  26. package/package-metadata.mjs +1 -1
  27. package/package.json +8 -7
  28. package/timepicker/TimeList.mjs +27 -12
  29. package/timepicker/TimePart.mjs +55 -75
  30. package/timepicker/TimePicker.js +1 -1
  31. package/timepicker/TimePicker.mjs +85 -69
  32. package/timepicker/services/DOMService.mjs +7 -4
  33. package/timepicker/services/DayPeriodService.mjs +1 -4
  34. package/timepicker/utils.mjs +3 -15
  35. package/virtualization/Virtualization.js +1 -1
  36. package/virtualization/Virtualization.mjs +3 -13
  37. package/dateinput/models/kendo-date.js +0 -8
  38. package/dateinput/models/kendo-date.mjs +0 -233
  39. package/dateinput/models/mask.js +0 -8
  40. package/dateinput/models/mask.mjs +0 -16
@@ -6,43 +6,33 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as a from "react";
9
+ import * as n from "react";
10
10
  import e from "prop-types";
11
- import { Popup as H } from "@progress/kendo-react-popup";
12
- import { cloneDate as O } from "@progress/kendo-date-math";
13
- import { Keys as d, validatePackage as W, canUseDOM as M, AsyncFocusBlur as X, classNames as I, uDateTimePicker as D, createPropsContext as Z, withIdHOC as G, withPropsContext as J, withUnstyledHOC as Q } from "@progress/kendo-react-common";
14
- import { calendarIcon as Y } from "@progress/kendo-svg-icons";
15
- import { DateInput as $ } from "../dateinput/DateInput.mjs";
16
- import { Button as ee } from "@progress/kendo-react-buttons";
17
- import { packageMetadata as te } from "../package-metadata.mjs";
18
- import { MAX_DATE as ie, MIN_DATE as se, isInDateRange as oe, MAX_TIME as ne, MIN_TIME as ae } from "../utils.mjs";
19
- import { MOBILE_MEDIUM_DEVISE as re } from "../common/constants.mjs";
11
+ import { Popup as Q } from "@progress/kendo-react-popup";
12
+ import { cloneDate as M } from "@progress/kendo-date-math";
13
+ import { Keys as d, validatePackage as $, canUseDOM as O, AsyncFocusBlur as ee, classNames as I, uDateTimePicker as D, createPropsContext as te, withIdHOC as ie, withPropsContext as se, withUnstyledHOC as oe } from "@progress/kendo-react-common";
14
+ import { calendarIcon as ae } from "@progress/kendo-svg-icons";
15
+ import { DateInput as ne } from "../dateinput/DateInput.mjs";
16
+ import { Button as re } from "@progress/kendo-react-buttons";
17
+ import { packageMetadata as le } from "../package-metadata.mjs";
18
+ import { MAX_DATE as he, MIN_DATE as de, isInDateRange as ue, MAX_TIME as pe, MIN_TIME as ce } from "../utils.mjs";
19
+ import { MOBILE_MEDIUM_DEVISE as me } from "../common/constants.mjs";
20
20
  import { dateTimePickerCancel as P, messages as p, dateTimePickerSet as C, toggleDateTimeSelector as c } from "../messages/index.mjs";
21
- import { provideLocalizationService as m, registerForLocalization as le } from "@progress/kendo-react-intl";
22
- import { DateTimeSelector as he } from "./DateTimeSelector.mjs";
23
- import { isInTimeRange as de } from "../timepicker/utils.mjs";
24
- import { PickerFloatingLabel as ue } from "../hooks/usePickerFloatingLabel.mjs";
25
- import { AdaptiveMode as pe } from "../common/AdaptiveMode.mjs";
26
- import { ActionSheetContent as ce } from "@progress/kendo-react-layout";
27
- const o = class o extends a.Component {
21
+ import { provideLocalizationService as m, registerForLocalization as fe } from "@progress/kendo-react-intl";
22
+ import { DateTimeSelector as ge } from "./DateTimeSelector.mjs";
23
+ import { isInTimeRange as ve } from "../timepicker/utils.mjs";
24
+ import { PickerFloatingLabel as we } from "../hooks/usePickerFloatingLabel.mjs";
25
+ import { AdaptiveMode as be } from "../common/AdaptiveMode.mjs";
26
+ import { ActionSheetContent as ye } from "@progress/kendo-react-layout";
27
+ const o = class o extends n.Component {
28
28
  constructor(t) {
29
- super(t), this._element = null, this._dateInput = a.createRef(), this._dateTimeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
29
+ super(t), this._element = null, this._dateInput = n.createRef(), this._dateTimeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
30
30
  const i = this.dateInputElement();
31
31
  i && i.focus();
32
32
  }, this.renderPicker = () => {
33
- const {
34
- disabled: i,
35
- minTime: s,
36
- maxTime: n,
37
- format: h,
38
- calendar: l,
39
- cancelButton: r,
40
- weekNumber: u,
41
- focusedDate: g,
42
- unstyled: v
43
- } = this.props;
44
- return /* @__PURE__ */ a.createElement(
45
- he,
33
+ const { disabled: i, minTime: s, maxTime: a, format: h, calendar: l, cancelButton: r, weekNumber: u, focusedDate: g, unstyled: v } = this.props;
34
+ return /* @__PURE__ */ n.createElement(
35
+ ge,
46
36
  {
47
37
  ref: (w) => {
48
38
  this._dateTimeSelector = w;
@@ -57,7 +47,7 @@ const o = class o extends a.Component {
57
47
  min: this.min,
58
48
  max: this.max,
59
49
  minTime: s,
60
- maxTime: n,
50
+ maxTime: a,
61
51
  focusedDate: g,
62
52
  format: h,
63
53
  calendar: l,
@@ -67,7 +57,13 @@ const o = class o extends a.Component {
67
57
  }
68
58
  );
69
59
  }, this.renderAdaptivePopup = () => {
70
- const { windowWidth: i = 0 } = this.state, s = m(this).toLanguageString(P, p[P]), n = m(this).toLanguageString(C, p[C]), h = {
60
+ const { windowWidth: i = 0 } = this.state, s = m(this).toLanguageString(
61
+ P,
62
+ p[P]
63
+ ), a = m(this).toLanguageString(
64
+ C,
65
+ p[C]
66
+ ), h = {
71
67
  expand: this.show,
72
68
  onClose: this.handleBlur,
73
69
  adaptiveTitle: this.props.adaptiveTitle,
@@ -78,19 +74,19 @@ const o = class o extends a.Component {
78
74
  var r;
79
75
  return (r = this._dateTimeSelector) == null ? void 0 : r.handleReject(l);
80
76
  },
81
- applyText: n,
77
+ applyText: a,
82
78
  onApply: (l) => {
83
79
  var r;
84
80
  return (r = this._dateTimeSelector) == null ? void 0 : r.handleAccept(l);
85
81
  }
86
82
  }
87
83
  };
88
- return /* @__PURE__ */ a.createElement(pe, { ...h }, /* @__PURE__ */ a.createElement(ce, { overflowHidden: !0 }, this.renderPicker()));
84
+ return /* @__PURE__ */ n.createElement(be, { ...h }, /* @__PURE__ */ n.createElement(ye, { overflowHidden: !0 }, this.renderPicker()));
89
85
  }, this.handleReject = () => {
90
86
  this.shouldFocusDateInput = !0, this.setShow(!1);
91
87
  }, this.handleValueChange = (i) => {
92
88
  this.setState({
93
- value: O(i.value || void 0)
89
+ value: M(i.value || void 0)
94
90
  }), this.valueDuringOnChange = i.value, this.showDuringOnChange = !1, this.mobileMode || (this.shouldFocusDateInput = !0);
95
91
  const { onChange: s } = this.props;
96
92
  s && s.call(void 0, {
@@ -109,13 +105,13 @@ const o = class o extends a.Component {
109
105
  }, this.handleIconMouseDown = (i) => {
110
106
  i.preventDefault();
111
107
  }, this.handleKeyDown = (i) => {
112
- const { altKey: s, keyCode: n } = i;
113
- if (n === d.esc) {
108
+ const { altKey: s, keyCode: a } = i;
109
+ if (a === d.esc) {
114
110
  this.shouldFocusDateInput = !0, this.setShow(!1);
115
111
  return;
116
112
  }
117
- s && (n === d.up || n === d.down) && (i.preventDefault(), i.stopPropagation(), this.shouldFocusDateInput = n === d.up, this.setShow(n === d.down));
118
- }, this.dateInputElement = () => this.dateInput && this.dateInput.element || this.element && this.element.querySelector(".k-dateinput > input.k-input-inner"), W(te), this.state = {
113
+ s && (a === d.up || a === d.down) && (i.preventDefault(), i.stopPropagation(), this.shouldFocusDateInput = a === d.up, this.setShow(a === d.down));
114
+ }, this.dateInputElement = () => this.dateInput && this.dateInput.element || this.element && this.element.querySelector(".k-dateinput > input.k-input-inner"), $(le), this.state = {
119
115
  value: this.props.defaultValue || o.defaultProps.defaultValue,
120
116
  show: this.props.defaultShow || o.defaultProps.defaultShow,
121
117
  focused: !1
@@ -125,7 +121,7 @@ const o = class o extends a.Component {
125
121
  return this.props.id + "-popup-id";
126
122
  }
127
123
  get document() {
128
- if (M)
124
+ if (O)
129
125
  return this.element && this.element.ownerDocument || document;
130
126
  }
131
127
  /**
@@ -145,7 +141,7 @@ const o = class o extends a.Component {
145
141
  */
146
142
  get value() {
147
143
  const t = this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
148
- return t !== null ? O(t) : null;
144
+ return t !== null ? M(t) : null;
149
145
  }
150
146
  /**
151
147
  * Gets the popup state of the DateTimePicker.
@@ -163,7 +159,7 @@ const o = class o extends a.Component {
163
159
  * The mobile mode of the ComboBox.
164
160
  */
165
161
  get mobileMode() {
166
- return !!(this.state.windowWidth && this.state.windowWidth <= re && this.props.adaptive);
162
+ return !!(this.state.windowWidth && this.state.windowWidth <= me && this.props.adaptive);
167
163
  }
168
164
  get min() {
169
165
  return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
@@ -175,12 +171,12 @@ const o = class o extends a.Component {
175
171
  * Represents the validity state into which the DateTimePicker is set.
176
172
  */
177
173
  get validity() {
178
- const t = oe(this.value, this.min, this.max) && de(this.value, this.props.minTime || ae, this.props.maxTime || ne), i = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && t, n = this.props.valid !== void 0 ? this.props.valid : s;
174
+ const t = ue(this.value, this.min, this.max) && ve(this.value, this.props.minTime || ce, this.props.maxTime || pe), i = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && t, a = this.props.valid !== void 0 ? this.props.valid : s;
179
175
  return {
180
176
  customError: i,
181
177
  rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
182
178
  rangeUnderflow: this.value && this.value.getTime() < this.min.getTime() || !1,
183
- valid: n,
179
+ valid: a,
184
180
  valueMissing: this.value === null
185
181
  };
186
182
  }
@@ -207,7 +203,7 @@ const o = class o extends a.Component {
207
203
  */
208
204
  componentDidMount() {
209
205
  var t;
210
- this.observerResize = M && 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);
206
+ this.observerResize = O && 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);
211
207
  }
212
208
  /**
213
209
  * @hidden
@@ -231,7 +227,7 @@ const o = class o extends a.Component {
231
227
  size: t = o.defaultProps.size,
232
228
  rounded: i = o.defaultProps.rounded,
233
229
  fillMode: s = o.defaultProps.fillMode,
234
- autoFocus: n = o.defaultProps.autoFocus,
230
+ autoFocus: a = o.defaultProps.autoFocus,
235
231
  disabled: h,
236
232
  tabIndex: l,
237
233
  title: r,
@@ -250,9 +246,16 @@ const o = class o extends a.Component {
250
246
  maxTime: N,
251
247
  ariaLabelledBy: V,
252
248
  ariaDescribedBy: L,
253
- popup: _ = H,
254
- unstyled: b
255
- } = this.props, y = b && b.uDateTimePicker, S = !this.validityStyles || this.validity.valid, q = {
249
+ popup: _ = Q,
250
+ unstyled: b,
251
+ autoFill: q,
252
+ twoDigitYearMax: K,
253
+ enableMouseWheel: U,
254
+ autoCorrectParts: j,
255
+ autoSwitchParts: H,
256
+ autoSwitchKeys: W,
257
+ allowCaretMode: X
258
+ } = this.props, y = b && b.uDateTimePicker, S = !this.validityStyles || this.validity.valid, Y = {
256
259
  id: u,
257
260
  ariaLabelledBy: V,
258
261
  ariaDescribedBy: L,
@@ -279,20 +282,27 @@ const o = class o extends a.Component {
279
282
  size: null,
280
283
  fillMode: null,
281
284
  rounded: null,
282
- unstyled: b
283
- }, T = /* @__PURE__ */ a.createElement(
284
- X,
285
+ unstyled: b,
286
+ autoFill: q,
287
+ twoDigitYearMax: K,
288
+ enableMouseWheel: U,
289
+ autoCorrectParts: j,
290
+ autoSwitchParts: H,
291
+ autoSwitchKeys: W,
292
+ allowCaretMode: X
293
+ }, T = /* @__PURE__ */ n.createElement(
294
+ ee,
285
295
  {
286
296
  onFocus: this.handleFocus,
287
297
  onBlur: this.handleBlur,
288
298
  onSyncFocus: this.props.onFocus,
289
299
  onSyncBlur: this.props.onBlur
290
300
  },
291
- ({ onFocus: U, onBlur: K }) => /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
301
+ ({ onFocus: Z, onBlur: G }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
292
302
  "div",
293
303
  {
294
- ref: (j) => {
295
- this._element = j;
304
+ ref: (J) => {
305
+ this._element = J;
296
306
  },
297
307
  className: I(
298
308
  D.wrapper({
@@ -308,11 +318,11 @@ const o = class o extends a.Component {
308
318
  ),
309
319
  onKeyDown: this.handleKeyDown,
310
320
  style: { width: k },
311
- onFocus: this.mobileMode ? void 0 : U,
312
- onBlur: K,
321
+ onFocus: this.mobileMode ? void 0 : Z,
322
+ onBlur: G,
313
323
  onClick: this.mobileMode ? this.handleDateIconClick : void 0
314
324
  },
315
- /* @__PURE__ */ a.createElement(
325
+ /* @__PURE__ */ n.createElement(
316
326
  this.dateInputComp,
317
327
  {
318
328
  _ref: this._dateInput,
@@ -320,27 +330,33 @@ const o = class o extends a.Component {
320
330
  ariaControls: this._popupId,
321
331
  ariaHasPopup: "dialog",
322
332
  readonly: this.mobileMode,
323
- autoFocus: n,
324
- ...q
333
+ autoFocus: a,
334
+ ...Y
325
335
  }
326
336
  ),
327
- /* @__PURE__ */ a.createElement(
328
- ee,
337
+ /* @__PURE__ */ n.createElement(
338
+ re,
329
339
  {
330
340
  tabIndex: -1,
331
341
  type: "button",
332
342
  icon: "calendar",
333
- svgIcon: Y,
343
+ svgIcon: ae,
334
344
  onMouseDown: this.handleIconMouseDown,
335
345
  onClick: this.mobileMode ? void 0 : this.handleDateIconClick,
336
- title: m(this).toLanguageString(c, p[c]),
346
+ title: m(this).toLanguageString(
347
+ c,
348
+ p[c]
349
+ ),
337
350
  className: I(D.inputButton({ c: y })),
338
351
  rounded: null,
339
352
  fillMode: s,
340
- "aria-label": m(this).toLanguageString(c, p[c])
353
+ "aria-label": m(this).toLanguageString(
354
+ c,
355
+ p[c]
356
+ )
341
357
  }
342
358
  ),
343
- /* @__PURE__ */ a.createElement(
359
+ /* @__PURE__ */ n.createElement(
344
360
  _,
345
361
  {
346
362
  show: this.show,
@@ -361,8 +377,8 @@ const o = class o extends a.Component {
361
377
  )
362
378
  ), this.mobileMode && this.renderAdaptivePopup())
363
379
  );
364
- return this.props.label ? /* @__PURE__ */ a.createElement(
365
- ue,
380
+ return this.props.label ? /* @__PURE__ */ n.createElement(
381
+ we,
366
382
  {
367
383
  dateInput: this._dateInput,
368
384
  label: this.props.label,
@@ -417,7 +433,12 @@ o.displayName = "DateTimePicker", o.propTypes = {
417
433
  })
418
434
  ]),
419
435
  formatPlaceholder: e.oneOfType([
420
- e.oneOf(["wide", "narrow", "short", "formatPattern"]),
436
+ e.oneOf([
437
+ "wide",
438
+ "narrow",
439
+ "short",
440
+ "formatPattern"
441
+ ]),
421
442
  e.shape({
422
443
  year: e.string,
423
444
  month: e.string,
@@ -459,30 +480,30 @@ o.displayName = "DateTimePicker", o.propTypes = {
459
480
  disabled: !1,
460
481
  format: "g",
461
482
  // general date and time pattern (short time): "M/d/y h:mm a" for en.
462
- max: ie,
463
- min: se,
483
+ max: he,
484
+ min: de,
464
485
  popupSettings: {},
465
486
  tabIndex: 0,
466
487
  weekNumber: !1,
467
488
  validityStyles: !0,
468
489
  cancelButton: !0,
469
- dateInput: $,
490
+ dateInput: ne,
470
491
  size: "medium",
471
492
  rounded: "medium",
472
493
  fillMode: "solid",
473
494
  autoFocus: !1
474
495
  };
475
496
  let f = o;
476
- const me = Z(), fe = G(
477
- J(
478
- me,
479
- Q(f)
497
+ const Ie = te(), De = ie(
498
+ se(
499
+ Ie,
500
+ oe(f)
480
501
  )
481
502
  );
482
- fe.displayName = "KendoReactDateTimePicker";
483
- le(f);
503
+ De.displayName = "KendoReactDateTimePicker";
504
+ fe(f);
484
505
  export {
485
- fe as DateTimePicker,
486
- me as DateTimePickerPropsContext,
506
+ De as DateTimePicker,
507
+ Ie as DateTimePickerPropsContext,
487
508
  f as DateTimePickerWithoutContext
488
509
  };