@progress/kendo-react-dateinputs 14.5.0-develop.14 → 14.5.0-develop.16

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.
@@ -7,21 +7,21 @@
7
7
  */
8
8
  import * as n from "react";
9
9
  import e from "prop-types";
10
- import { Popup as J } from "@progress/kendo-react-popup";
10
+ import { Popup as Y } from "@progress/kendo-react-popup";
11
11
  import { cloneDate as y } from "@progress/kendo-date-math";
12
- import { createPropsContext as Q, classNames as c, uTimePicker as g, Keys as d, validatePackage as Y, getLicenseMessage as $, canUseDOM as T, subscribeToKendoPaste as ee, AsyncFocusBlur as te, WatermarkOverlay as ie, withIdHOC as se, withPropsContext as oe, withUnstyledHOC as ne, withAdaptiveModeContext as ae } from "@progress/kendo-react-common";
13
- import { clockIcon as re } from "@progress/kendo-svg-icons";
14
- import { provideLocalizationService as le, registerForLocalization as he } from "@progress/kendo-react-intl";
12
+ import { createPropsContext as $, classNames as m, uTimePicker as g, Keys as d, validatePackage as ee, getLicenseMessage as te, canUseDOM as T, subscribeToKendoPaste as ie, AsyncFocusBlur as se, WatermarkOverlay as oe, withIdHOC as ne, withPropsContext as ae, withUnstyledHOC as re, withAdaptiveModeContext as le } from "@progress/kendo-react-common";
13
+ import { clockIcon as he } from "@progress/kendo-svg-icons";
14
+ import { provideLocalizationService as de, registerForLocalization as ue } from "@progress/kendo-react-intl";
15
15
  import { packageMetadata as C } from "../package-metadata.mjs";
16
- import { timePickerSet as I, messages as u, toggleClock as f, timePickerCancel as de, toggleTimeSelector as M } from "../messages/index.mjs";
17
- import { DateInput as ue } from "../dateinput/DateInput.mjs";
18
- import { TimeSelector as pe } from "./TimeSelector.mjs";
19
- import { MIN_TIME as me, MAX_TIME as ce, setTime as P, MIDNIGHT_DATE as ge } from "../utils.mjs";
20
- import { isInRange as D, isSmallerThanMin as fe, isBiggerThanMax as ve } from "./utils.mjs";
21
- import { PickerFloatingLabel as we } from "../hooks/usePickerFloatingLabel.mjs";
22
- import { Button as be } from "@progress/kendo-react-buttons";
23
- import { AdaptiveMode as Se } from "../common/AdaptiveMode.mjs";
24
- import { ActionSheetContent as ye } from "@progress/kendo-react-layout";
16
+ import { timePickerSet as I, messages as u, toggleClock as f, timePickerCancel as pe, selectTime as M, toggleTimeSelector as P } from "../messages/index.mjs";
17
+ import { DateInputInner as ce } from "../dateinput/DateInput.mjs";
18
+ import { TimeSelector as me } from "./TimeSelector.mjs";
19
+ import { MIN_TIME as ge, MAX_TIME as fe, setTime as D, MIDNIGHT_DATE as ve } from "../utils.mjs";
20
+ import { isInRange as O, isSmallerThanMin as we, isBiggerThanMax as be } from "./utils.mjs";
21
+ import { PickerFloatingLabel as Se } from "../hooks/usePickerFloatingLabel.mjs";
22
+ import { Button as ye } from "@progress/kendo-react-buttons";
23
+ import { AdaptiveMode as Te } from "../common/AdaptiveMode.mjs";
24
+ import { ActionSheetContent as Ce } from "@progress/kendo-react-layout";
25
25
  const a = class a extends n.Component {
26
26
  constructor(s) {
27
27
  super(s), this._element = null, this._dateInput = n.createRef(), this._timeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.showLicenseWatermark = !1, this.handleKendoPasteValue = (t) => {
@@ -36,7 +36,7 @@ const a = class a extends n.Component {
36
36
  isNaN(o.getTime()) || this.applyKendoPasteTime(o);
37
37
  }, this.applyKendoPasteTime = (t) => {
38
38
  const i = this.normalizeTime(t);
39
- if (!D(i, this.min, this.max))
39
+ if (!O(i, this.min, this.max))
40
40
  return;
41
41
  const o = new Event("change", { bubbles: !0 }), r = {
42
42
  target: this._element,
@@ -51,9 +51,9 @@ const a = class a extends n.Component {
51
51
  }, this.focus = () => {
52
52
  this.dateInput && this.dateInput.focus();
53
53
  }, this.renderTimeSelector = () => {
54
- const { smoothScroll: t, cancelButton: i, nowButton: o, disabled: r, format: h, steps: l, unstyled: m } = this.props;
54
+ const { smoothScroll: t, cancelButton: i, nowButton: o, disabled: r, format: h, steps: l, unstyled: c } = this.props;
55
55
  return /* @__PURE__ */ n.createElement(
56
- pe,
56
+ me,
57
57
  {
58
58
  ref: this.setTimeSelectorRef,
59
59
  mobileMode: this.mobileMode,
@@ -71,11 +71,11 @@ const a = class a extends n.Component {
71
71
  handleTimeChange: this.mobileMode && this.handleTimeChange,
72
72
  onChange: this.handleValueChange,
73
73
  onReject: this.handleValueReject,
74
- unstyled: m
74
+ unstyled: c
75
75
  }
76
76
  );
77
77
  }, this.renderPopup = () => {
78
- const { popupClass: t, ...i } = this.popupSettings, { unstyled: o } = this.props, r = o && o.uTimePicker, h = c(t), l = {
78
+ const { popupClass: t, ...i } = this.popupSettings, { unstyled: o } = this.props, r = o && o.uTimePicker, h = m(t), l = {
79
79
  popupClass: g.popup({ c: r }),
80
80
  show: this.show,
81
81
  animate: this.element !== null,
@@ -92,7 +92,7 @@ const a = class a extends n.Component {
92
92
  },
93
93
  ...i
94
94
  };
95
- return this.props.popup ? /* @__PURE__ */ n.createElement(this.props.popup, { ...l }, this.renderTimeSelector()) : /* @__PURE__ */ n.createElement(J, { ...l }, this.renderTimeSelector());
95
+ return this.props.popup ? /* @__PURE__ */ n.createElement(this.props.popup, { ...l }, this.renderTimeSelector()) : /* @__PURE__ */ n.createElement(Y, { ...l }, this.renderTimeSelector());
96
96
  }, this.renderAdaptivePopup = () => {
97
97
  const { windowWidth: t = 0 } = this.state, i = {
98
98
  expand: this.show,
@@ -101,13 +101,13 @@ const a = class a extends n.Component {
101
101
  subTitle: this.props.adaptiveSubtitle,
102
102
  windowWidth: t,
103
103
  footer: {
104
- cancelText: this.localizationService.toLanguageString(f, u[de]),
104
+ cancelText: this.localizationService.toLanguageString(f, u[pe]),
105
105
  onCancel: this.handleValueReject,
106
106
  applyText: this.localizationService.toLanguageString(I, u[I]),
107
107
  onApply: (o) => this.handleValueChange(o)
108
108
  }
109
109
  };
110
- return /* @__PURE__ */ n.createElement(Se, { ...i }, /* @__PURE__ */ n.createElement(ye, null, this.renderTimeSelector()));
110
+ return /* @__PURE__ */ n.createElement(Te, { ...i }, /* @__PURE__ */ n.createElement(Ce, null, this.renderTimeSelector()));
111
111
  }, this.setTimeSelectorRef = (t) => {
112
112
  this._timeSelector = t;
113
113
  }, this.nextValue = (t, i) => t.value !== void 0 ? t.value : i.value, this.nextShow = (t, i) => t.show !== void 0 ? t.show : i.show, this.handleInputValueChange = (t) => {
@@ -144,7 +144,7 @@ const a = class a extends n.Component {
144
144
  return;
145
145
  }
146
146
  i && (o === d.up || o === d.down) && (t.preventDefault(), t.stopPropagation(), this.shouldFocusDateInput = o === d.up, this.setShow(o === d.down));
147
- }, this.showLicenseWatermark = !Y(C, { component: "TimePicker" }), this.licenseMessage = $(C), this.state = {
147
+ }, this.showLicenseWatermark = !ee(C, { component: "TimePicker" }), this.licenseMessage = te(C), this.state = {
148
148
  value: this.props.defaultValue || a.defaultProps.defaultValue,
149
149
  show: this.props.defaultShow || a.defaultProps.defaultShow,
150
150
  focused: !1,
@@ -199,11 +199,11 @@ const a = class a extends n.Component {
199
199
  * Represents the validity state into which the TimePicker is set.
200
200
  */
201
201
  get validity() {
202
- const s = this.value && this.normalizeTime(this.value), t = this.normalizeTime(this.min), i = this.normalizeTime(this.max), o = D(s, t, i), r = this.props.validationMessage !== void 0, h = (!this.required || this.value !== null) && o, l = this.props.valid !== void 0 ? this.props.valid : h;
202
+ const s = this.value && this.normalizeTime(this.value), t = this.normalizeTime(this.min), i = this.normalizeTime(this.max), o = O(s, t, i), r = this.props.validationMessage !== void 0, h = (!this.required || this.value !== null) && o, l = this.props.valid !== void 0 ? this.props.valid : h;
203
203
  return {
204
204
  customError: r,
205
- rangeOverflow: ve(s, i),
206
- rangeUnderflow: fe(s, t),
205
+ rangeOverflow: be(s, i),
206
+ rangeUnderflow: we(s, t),
207
207
  valid: l,
208
208
  valueMissing: this.value === null
209
209
  };
@@ -240,7 +240,7 @@ const a = class a extends n.Component {
240
240
  return this.props.dateInput || a.defaultProps.dateInput;
241
241
  }
242
242
  get localizationService() {
243
- return le(this);
243
+ return de(this);
244
244
  }
245
245
  /**
246
246
  * @hidden
@@ -249,7 +249,7 @@ const a = class a extends n.Component {
249
249
  var t;
250
250
  this.observerResize = T && 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);
251
251
  const s = this.props.name || this.props.id;
252
- this.KendoPasteSubscription = ee(this._element, {
252
+ this.KendoPasteSubscription = ie(this._element, {
253
253
  fieldName: s,
254
254
  onValueChange: (i) => {
255
255
  this.handleKendoPasteValue(i);
@@ -283,42 +283,43 @@ const a = class a extends n.Component {
283
283
  tabIndex: r,
284
284
  title: h,
285
285
  id: l,
286
- className: m,
287
- format: O,
288
- formatPlaceholder: z,
289
- width: k,
290
- name: x,
291
- steps: E,
292
- validationMessage: R,
293
- required: V,
294
- validityStyles: B,
286
+ className: c,
287
+ format: z,
288
+ formatPlaceholder: k,
289
+ width: x,
290
+ name: E,
291
+ steps: R,
292
+ validationMessage: V,
293
+ required: B,
294
+ validityStyles: L,
295
295
  ariaLabelledBy: A,
296
296
  ariaDescribedBy: F,
297
297
  unstyled: v,
298
298
  enableMouseWheel: N,
299
299
  autoCorrectParts: K,
300
- autoSwitchParts: L,
301
- autoSwitchKeys: _,
302
- allowCaretMode: q,
303
- inputAttributes: W
304
- } = this.props, w = v && v.uTimePicker, b = !this.validityStyles || this.validity.valid, U = {
300
+ autoSwitchParts: _,
301
+ autoSwitchKeys: q,
302
+ allowCaretMode: W,
303
+ inputAttributes: U
304
+ } = this.props, w = v && v.uTimePicker, b = !this.validityStyles || this.validity.valid, j = this.localizationService.toLanguageString(M, u[M]), H = {
305
305
  disabled: o,
306
- format: O,
307
- formatPlaceholder: z,
306
+ format: z,
307
+ formatPlaceholder: k,
308
308
  id: l,
309
309
  ariaLabelledBy: A,
310
310
  ariaDescribedBy: F,
311
+ ariaLabel: j,
311
312
  max: this.normalizeTime(this.max),
312
313
  min: this.normalizeTime(this.min),
313
- name: x,
314
+ name: E,
314
315
  onChange: this.handleInputValueChange,
315
- required: V,
316
- steps: E,
316
+ required: B,
317
+ steps: R,
317
318
  tabIndex: this.show ? -1 : r,
318
319
  title: h,
319
320
  valid: this.validity.valid,
320
- validationMessage: R,
321
- validityStyles: B,
321
+ validationMessage: V,
322
+ validityStyles: L,
322
323
  value: this.value && this.normalizeTime(this.value),
323
324
  label: void 0,
324
325
  placeholder: this.state.focused ? null : this.props.placeholder,
@@ -326,28 +327,28 @@ const a = class a extends n.Component {
326
327
  ariaExpanded: this.show,
327
328
  enableMouseWheel: N,
328
329
  autoCorrectParts: K,
329
- autoSwitchParts: L,
330
- autoSwitchKeys: _,
331
- allowCaretMode: q,
332
- inputAttributes: W
333
- }, j = this.localizationService.toLanguageString(f, u[f]), H = this.localizationService.toLanguageString(
334
- M,
335
- u[M]
330
+ autoSwitchParts: _,
331
+ autoSwitchKeys: q,
332
+ allowCaretMode: W,
333
+ inputAttributes: U
334
+ }, G = this.localizationService.toLanguageString(f, u[f]), X = this.localizationService.toLanguageString(
335
+ P,
336
+ u[P]
336
337
  ), S = /* @__PURE__ */ n.createElement(
337
- te,
338
+ se,
338
339
  {
339
340
  onFocus: this.handleFocus,
340
341
  onBlur: this.mobileMode ? void 0 : this.handleBlur,
341
342
  onSyncBlur: this.props.onBlur,
342
343
  onSyncFocus: this.props.onFocus
343
344
  },
344
- ({ onFocus: G, onBlur: X }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
345
+ ({ onFocus: Z, onBlur: J }) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
345
346
  "span",
346
347
  {
347
- ref: (Z) => {
348
- this._element = Z;
348
+ ref: (Q) => {
349
+ this._element = Q;
349
350
  },
350
- className: c(
351
+ className: m(
351
352
  g.wrapper({
352
353
  c: w,
353
354
  size: s,
@@ -357,12 +358,13 @@ const a = class a extends n.Component {
357
358
  required: this.required,
358
359
  disabled: o
359
360
  }),
360
- m
361
+ { "k-focus": this.state.focused },
362
+ c
361
363
  ),
362
364
  onKeyDown: this.handleKeyDown,
363
- style: { width: k },
364
- onFocus: this.mobileMode ? this.handleClick : G,
365
- onBlur: X,
365
+ style: { width: x },
366
+ onFocus: this.mobileMode ? this.handleClick : Z,
367
+ onBlur: J,
366
368
  onClick: this.mobileMode ? this.handleClick : void 0
367
369
  },
368
370
  /* @__PURE__ */ n.createElement(
@@ -371,29 +373,29 @@ const a = class a extends n.Component {
371
373
  _ref: this._dateInput,
372
374
  ariaRole: "combobox",
373
375
  ariaControls: this.show ? this._popupId : void 0,
374
- ...U
376
+ ...H
375
377
  }
376
378
  ),
377
379
  /* @__PURE__ */ n.createElement(
378
- be,
380
+ ye,
379
381
  {
380
382
  tabIndex: -1,
381
383
  type: "button",
382
384
  icon: "clock",
383
- svgIcon: re,
385
+ svgIcon: he,
384
386
  onMouseDown: this.handleIconMouseDown,
385
387
  onClick: this.mobileMode ? void 0 : this.handleClick,
386
- title: H,
387
- className: c(g.inputButton({ c: w })),
388
+ title: X,
389
+ className: m(g.inputButton({ c: w })),
388
390
  fillMode: i,
389
- "aria-label": j
391
+ "aria-label": G
390
392
  }
391
393
  ),
392
394
  !this.mobileMode && this.renderPopup()
393
- ), this.mobileMode && this.renderAdaptivePopup(), this.showLicenseWatermark && /* @__PURE__ */ n.createElement(ie, { message: this.licenseMessage }))
395
+ ), this.mobileMode && this.renderAdaptivePopup(), this.showLicenseWatermark && /* @__PURE__ */ n.createElement(oe, { message: this.licenseMessage }))
394
396
  );
395
397
  return this.props.label ? /* @__PURE__ */ n.createElement(
396
- we,
398
+ Se,
397
399
  {
398
400
  dateInput: this._dateInput,
399
401
  label: this.props.label,
@@ -406,7 +408,7 @@ const a = class a extends n.Component {
406
408
  ) : S;
407
409
  }
408
410
  normalizeTime(s) {
409
- return P(ge, s);
411
+ return D(ve, s);
410
412
  }
411
413
  setShow(s) {
412
414
  const { onOpen: t, onClose: i } = this.props;
@@ -417,7 +419,7 @@ const a = class a extends n.Component {
417
419
  }));
418
420
  }
419
421
  mergeTime(s) {
420
- return this.value && s ? P(this.value, s) : s;
422
+ return this.value && s ? D(this.value, s) : s;
421
423
  }
422
424
  calculateMedia(s) {
423
425
  for (const t of s)
@@ -478,6 +480,7 @@ a.displayName = "TimePicker", a.propTypes = {
478
480
  appendTo: e.any,
479
481
  popupClass: e.string
480
482
  }),
483
+ dateInput: e.elementType,
481
484
  show: e.bool,
482
485
  steps: e.shape({
483
486
  hour: e.number,
@@ -502,28 +505,28 @@ a.displayName = "TimePicker", a.propTypes = {
502
505
  defaultValue: null,
503
506
  disabled: !1,
504
507
  format: "t",
505
- max: ce,
506
- min: me,
508
+ max: fe,
509
+ min: ge,
507
510
  popupSettings: {},
508
511
  tabIndex: 0,
509
512
  steps: {},
510
513
  validityStyles: !0,
511
- dateInput: ue,
514
+ dateInput: ce,
512
515
  size: void 0,
513
516
  rounded: void 0,
514
517
  fillMode: void 0
515
518
  };
516
519
  let p = a;
517
- const Te = Q(), Ce = se(
518
- oe(
519
- Te,
520
- ne(ae(p))
520
+ const Ie = $(), Me = ne(
521
+ ae(
522
+ Ie,
523
+ re(le(p))
521
524
  )
522
525
  );
523
- Ce.displayName = "KendoReactTimePicker";
524
- he(p);
526
+ Me.displayName = "KendoReactTimePicker";
527
+ ue(p);
525
528
  export {
526
- Ce as TimePicker,
527
- Te as TimePickerPropsContext,
529
+ Me as TimePicker,
530
+ Ie as TimePickerPropsContext,
528
531
  p as TimePickerWithoutContext
529
532
  };