@progress/kendo-react-dateinputs 9.0.0-develop.9 → 9.0.1-develop.1

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.
@@ -8,22 +8,22 @@
8
8
  "use client";
9
9
  import * as n from "react";
10
10
  import e from "prop-types";
11
- import { Popup as W } from "@progress/kendo-react-popup";
12
- import { getDate as _, cloneDate as M } from "@progress/kendo-date-math";
13
- import { classNames as k, Keys as r, validatePackage as K, canUseDOM as P, AsyncFocusBlur as U, kendoThemeMaps as T, createPropsContext as $, withIdHOC as H, withPropsContext as X } from "@progress/kendo-react-common";
14
- import { calendarIcon as Z } from "@progress/kendo-svg-icons";
15
- import { packageMetadata as j } from "../package-metadata.mjs";
16
- import { DateInput as G } from "../dateinput/DateInput.mjs";
17
- import { Calendar as J } from "../calendar/components/Calendar.mjs";
18
- import { MAX_DATE as Q, MIN_DATE as Y, isInDateRange as ee, setTime as te } from "../utils.mjs";
19
- import { toggleCalendar as E, messages as ie } from "../messages/index.mjs";
20
- import { provideLocalizationService as se, registerForLocalization as oe } from "@progress/kendo-react-intl";
21
- import { ToggleButton as ae } from "./ToggleButton.mjs";
22
- import { PickerWrap as ne } from "../common/PickerWrap.mjs";
23
- import { PickerFloatingLabel as re } from "../hooks/usePickerFloatingLabel.mjs";
24
- import { ActionSheetContent as le } from "@progress/kendo-react-layout";
25
- import { AdaptiveMode as de } from "../common/AdaptiveMode.mjs";
26
- import { MOBILE_MEDIUM_DEVISE as ue } from "../common/constants.mjs";
11
+ import { Popup as Y } from "@progress/kendo-react-popup";
12
+ import { getDate as Z, cloneDate as O } from "@progress/kendo-date-math";
13
+ import { classNames as k, Keys as r, validatePackage as j, canUseDOM as P, AsyncFocusBlur as G, kendoThemeMaps as T, createPropsContext as J, withIdHOC as Q, withPropsContext as ee } from "@progress/kendo-react-common";
14
+ import { calendarIcon as te } from "@progress/kendo-svg-icons";
15
+ import { packageMetadata as ie } from "../package-metadata.mjs";
16
+ import { DateInput as se } from "../dateinput/DateInput.mjs";
17
+ import { Calendar as oe } from "../calendar/components/Calendar.mjs";
18
+ import { MAX_DATE as ae, MIN_DATE as ne, isInDateRange as re, setTime as le } from "../utils.mjs";
19
+ import { toggleCalendar as x, messages as de } from "../messages/index.mjs";
20
+ import { provideLocalizationService as ue, registerForLocalization as he } from "@progress/kendo-react-intl";
21
+ import { ToggleButton as pe } from "./ToggleButton.mjs";
22
+ import { PickerWrap as ce } from "../common/PickerWrap.mjs";
23
+ import { PickerFloatingLabel as me } from "../hooks/usePickerFloatingLabel.mjs";
24
+ import { ActionSheetContent as fe } from "@progress/kendo-react-layout";
25
+ import { AdaptiveMode as ge } from "../common/AdaptiveMode.mjs";
26
+ import { MOBILE_MEDIUM_DEVISE as ve } from "../common/constants.mjs";
27
27
  const o = class o extends n.Component {
28
28
  constructor(i) {
29
29
  super(i), this._element = null, this._dateInput = n.createRef(), this._calendar = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
@@ -31,7 +31,7 @@ const o = class o extends n.Component {
31
31
  }, this.setCalendarRef = (t) => {
32
32
  this._calendar = t;
33
33
  }, 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.renderPopup = () => {
34
- const { disabled: t, min: s, max: a, weekNumber: c, focusedDate: m, popupSettings: l } = this.props, { popupClass: f, ...g } = l, v = this.show, d = this.value, w = d && _(d), u = k(f), b = {
34
+ const { disabled: t, min: s, max: a, weekNumber: c, focusedDate: m, popupSettings: l } = this.props, { popupClass: f, ...g } = l, v = this.show, d = this.value, w = d && Z(d), u = k(f), b = {
35
35
  popupClass: "k-datepicker-popup",
36
36
  show: v,
37
37
  anchor: this._element,
@@ -66,7 +66,7 @@ const o = class o extends n.Component {
66
66
  adaptiveTitle: this.props.adaptiveTitle,
67
67
  windowWidth: t
68
68
  };
69
- return /* @__PURE__ */ n.createElement(de, { ...s }, /* @__PURE__ */ n.createElement(le, { overflowHidden: !0 }, this.renderPopup()));
69
+ return /* @__PURE__ */ n.createElement(ge, { ...s }, /* @__PURE__ */ n.createElement(fe, { overflowHidden: !0 }, this.renderPopup()));
70
70
  }, this.handleInputValueChange = (t) => {
71
71
  this.handleValueChange(t.value, t);
72
72
  }, this.handleCalendarValueChange = (t) => {
@@ -74,7 +74,7 @@ const o = class o extends n.Component {
74
74
  this.handleValueChange(s, t);
75
75
  }, this.handleValueChange = (t, s) => {
76
76
  this.setState({
77
- value: M(t || void 0)
77
+ value: O(t || void 0)
78
78
  }), this.valueDuringOnChange = t, this.showDuringOnChange = !1, this.mobileMode || (this.shouldFocusDateInput = !0);
79
79
  const { onChange: a } = this.props;
80
80
  a && a.call(void 0, {
@@ -104,7 +104,7 @@ const o = class o extends n.Component {
104
104
  return;
105
105
  }
106
106
  s && (a === r.up || a === r.down) && (t.preventDefault(), t.stopPropagation(), this.shouldFocusDateInput = a === r.up, this.setShow(a === r.down));
107
- }, K(j), this.state = {
107
+ }, j(ie), this.state = {
108
108
  value: this.props.defaultValue || o.defaultProps.defaultValue,
109
109
  show: this.props.defaultShow || o.defaultProps.defaultShow,
110
110
  focused: !1
@@ -127,7 +127,7 @@ const o = class o extends n.Component {
127
127
  * The mobile mode of the DatePicker.
128
128
  */
129
129
  get mobileMode() {
130
- return !!(this.state.windowWidth && this.state.windowWidth <= ue && this.props.adaptive);
130
+ return !!(this.state.windowWidth && this.state.windowWidth <= ve && this.props.adaptive);
131
131
  }
132
132
  /**
133
133
  * Gets the DateInput component inside the DatePicker component.
@@ -146,7 +146,7 @@ const o = class o extends n.Component {
146
146
  */
147
147
  get value() {
148
148
  const i = this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
149
- return i !== null ? M(i) : null;
149
+ return i !== null ? O(i) : null;
150
150
  }
151
151
  /**
152
152
  * Gets the popup state of the DatePickerWithoutContext.
@@ -185,7 +185,7 @@ const o = class o extends n.Component {
185
185
  * Represents the validity state into which the DatePicker is set.
186
186
  */
187
187
  get validity() {
188
- const i = ee(this.value, this.min, this.max), t = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && i, a = this.props.valid !== void 0 ? this.props.valid : s;
188
+ const i = re(this.value, this.min, this.max), t = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && i, a = this.props.valid !== void 0 ? this.props.valid : s;
189
189
  return {
190
190
  customError: t,
191
191
  rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
@@ -246,38 +246,45 @@ const o = class o extends n.Component {
246
246
  width: u,
247
247
  name: b,
248
248
  validationMessage: h,
249
- required: x,
249
+ required: E,
250
250
  validityStyles: B,
251
251
  ariaLabelledBy: F,
252
252
  ariaDescribedBy: V,
253
253
  ariaLabel: z,
254
254
  placeholder: N,
255
255
  label: y,
256
- popupSettings: ce,
257
- defaultValue: me,
258
- defaultShow: fe,
259
- value: ge,
260
- popup: ve,
261
- weekNumber: we,
262
- dateInput: be,
263
- calendar: ye,
264
- toggleButton: Ie,
265
- onChange: Ce,
266
- onBlur: De,
267
- onFocus: Oe,
268
- show: Se,
269
- onOpen: Me,
270
- pickerWrap: ke,
271
- adaptive: Pe,
272
- adaptiveTitle: Te,
273
- valid: Ee,
256
+ popupSettings: ye,
257
+ defaultValue: Ce,
258
+ defaultShow: Ie,
259
+ value: De,
260
+ popup: Se,
261
+ weekNumber: Me,
262
+ dateInput: Oe,
263
+ calendar: ke,
264
+ toggleButton: Pe,
265
+ onChange: Te,
266
+ onBlur: xe,
267
+ onFocus: Ee,
268
+ show: Be,
269
+ onOpen: Fe,
270
+ pickerWrap: Ve,
271
+ adaptive: ze,
272
+ adaptiveTitle: Ne,
273
+ valid: Re,
274
274
  autoFocus: R,
275
275
  // Removed to support direct use in Form Field component
276
- visited: xe,
277
- touched: Be,
278
- modified: Fe,
279
- ...I
280
- } = this.props, A = this.value, C = !this.validityStyles || this.validity.valid, L = {
276
+ visited: Ae,
277
+ touched: Le,
278
+ modified: We,
279
+ autoFill: A,
280
+ twoDigitYearMax: L,
281
+ enableMouseWheel: W,
282
+ autoCorrectParts: q,
283
+ autoSwitchParts: _,
284
+ autoSwitchKeys: K,
285
+ allowCaretMode: U,
286
+ ...C
287
+ } = this.props, $ = this.value, I = !this.validityStyles || this.validity.valid, H = {
281
288
  disabled: a,
282
289
  format: f,
283
290
  formatPlaceholder: g,
@@ -289,36 +296,43 @@ const o = class o extends n.Component {
289
296
  min: v,
290
297
  name: b,
291
298
  onChange: this.handleInputValueChange,
292
- required: x,
299
+ required: E,
293
300
  tabIndex: this.show ? -1 : c,
294
301
  title: m,
295
302
  valid: this.validity.valid,
296
303
  validationMessage: h,
297
304
  validityStyles: B,
298
- value: A,
305
+ value: $,
299
306
  label: void 0,
300
307
  placeholder: this.state.focused ? null : N,
301
308
  ariaExpanded: this.show,
302
309
  size: null,
303
310
  fillMode: null,
304
- rounded: null
305
- }, D = se(this).toLanguageString(
306
- E,
307
- ie[E]
308
- ), O = /* @__PURE__ */ n.createElement(
309
- U,
311
+ rounded: null,
312
+ autoFill: A,
313
+ twoDigitYearMax: L,
314
+ enableMouseWheel: W,
315
+ autoCorrectParts: q,
316
+ autoSwitchParts: _,
317
+ autoSwitchKeys: K,
318
+ allowCaretMode: U
319
+ }, D = ue(this).toLanguageString(
320
+ x,
321
+ de[x]
322
+ ), S = /* @__PURE__ */ n.createElement(
323
+ G,
310
324
  {
311
325
  onFocus: this.handleFocus,
312
326
  onBlur: this.mobileMode ? void 0 : this.handleBlur,
313
327
  onSyncBlur: this.props.onBlur,
314
328
  onSyncFocus: this.props.onFocus
315
329
  },
316
- (S) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
330
+ (M) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
317
331
  "span",
318
332
  {
319
- ...y ? {} : I,
320
- ref: (q) => {
321
- this._element = q;
333
+ ...y ? {} : C,
334
+ ref: (X) => {
335
+ this._element = X;
322
336
  },
323
337
  className: k(
324
338
  "k-input",
@@ -327,7 +341,7 @@ const o = class o extends n.Component {
327
341
  [`k-input-${T.sizeMap[i] || i}`]: i,
328
342
  [`k-rounded-${T.roundedMap[t] || t}`]: t,
329
343
  [`k-input-${s}`]: s,
330
- "k-invalid": !C,
344
+ "k-invalid": !I,
331
345
  "k-required": this.required,
332
346
  "k-disabled": a
333
347
  },
@@ -335,8 +349,8 @@ const o = class o extends n.Component {
335
349
  ),
336
350
  onKeyDown: this.handleKeyDown,
337
351
  style: { width: u },
338
- onFocus: S.onFocus,
339
- onBlur: S.onBlur,
352
+ onFocus: M.onFocus,
353
+ onBlur: M.onBlur,
340
354
  onClick: this.mobileMode ? this.handleIconClick : void 0
341
355
  },
342
356
  /* @__PURE__ */ n.createElement(
@@ -348,7 +362,7 @@ const o = class o extends n.Component {
348
362
  ariaExpanded: this.show,
349
363
  ariaControls: this._popupId,
350
364
  autoFocus: R,
351
- ...L
365
+ ...H
352
366
  }
353
367
  ),
354
368
  /* @__PURE__ */ n.createElement(
@@ -356,7 +370,7 @@ const o = class o extends n.Component {
356
370
  {
357
371
  type: "button",
358
372
  icon: "calendar",
359
- svgIcon: Z,
373
+ svgIcon: te,
360
374
  title: D,
361
375
  className: "k-input-button",
362
376
  rounded: null,
@@ -370,18 +384,18 @@ const o = class o extends n.Component {
370
384
  ), this.mobileMode && this.renderAdaptivePopup())
371
385
  );
372
386
  return y ? /* @__PURE__ */ n.createElement(
373
- re,
387
+ me,
374
388
  {
375
389
  dateInput: this._dateInput,
376
390
  label: y,
377
391
  editorId: l,
378
- editorValid: C,
392
+ editorValid: I,
379
393
  editorDisabled: a,
380
- children: O,
394
+ children: S,
381
395
  style: { width: u },
382
- ...I
396
+ ...C
383
397
  }
384
- ) : O;
398
+ ) : S;
385
399
  }
386
400
  setShow(i) {
387
401
  const { onOpen: t, onClose: s } = this.props;
@@ -392,7 +406,7 @@ const o = class o extends n.Component {
392
406
  }));
393
407
  }
394
408
  mergeTime(i) {
395
- return this.value && i ? te(i, this.value) : i;
409
+ return this.value && i ? le(i, this.value) : i;
396
410
  }
397
411
  nextTick(i) {
398
412
  clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
@@ -475,15 +489,15 @@ o.displayName = "DatePicker", o.propTypes = {
475
489
  }, o.defaultProps = {
476
490
  defaultShow: !1,
477
491
  defaultValue: null,
478
- dateInput: G,
479
- calendar: J,
480
- toggleButton: ae,
481
- popup: W,
482
- pickerWrap: ne,
492
+ dateInput: se,
493
+ calendar: oe,
494
+ toggleButton: pe,
495
+ popup: Y,
496
+ pickerWrap: ce,
483
497
  disabled: !1,
484
498
  format: "d",
485
- max: Q,
486
- min: Y,
499
+ max: ae,
500
+ min: ne,
487
501
  popupSettings: {},
488
502
  tabIndex: 0,
489
503
  weekNumber: !1,
@@ -494,13 +508,13 @@ o.displayName = "DatePicker", o.propTypes = {
494
508
  autoFocus: !1
495
509
  };
496
510
  let p = o;
497
- const he = $(), pe = H(
498
- X(he, p)
511
+ const we = J(), be = Q(
512
+ ee(we, p)
499
513
  );
500
- pe.displayName = "KendoReactDatePicker";
501
- oe(p);
514
+ be.displayName = "KendoReactDatePicker";
515
+ he(p);
502
516
  export {
503
- pe as DatePicker,
504
- he as DatePickerPropsContext,
517
+ be as DatePicker,
518
+ we as DatePickerPropsContext,
505
519
  p as DatePickerWithoutContext
506
520
  };
@@ -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 j=require("react"),e=require("prop-types"),U=require("@progress/kendo-react-popup"),T=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),H=require("@progress/kendo-svg-icons"),W=require("../dateinput/DateInput.js"),X=require("@progress/kendo-react-buttons"),Z=require("../package-metadata.js"),p=require("../utils.js"),$=require("../common/constants.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),G=require("./DateTimeSelector.js"),J=require("../timepicker/utils.js"),Q=require("../hooks/usePickerFloatingLabel.js"),Y=require("../common/AdaptiveMode.js"),ee=require("@progress/kendo-react-layout");function te(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const i in c)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(c,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>c[i]})}}return t.default=c,Object.freeze(t)}const r=te(j),n=class n extends r.Component{constructor(t){super(t),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const i=this.dateInputElement();i&&i.focus()},this.renderPicker=()=>{const{disabled:i,minTime:s,maxTime:a,format:h,calendar:d,cancelButton:u,weekNumber:f,focusedDate:v,unstyled:w}=this.props;return r.createElement(G.DateTimeSelector,{ref:b=>{this._dateTimeSelector=b},cancelButton:u,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:f,min:this.min,max:this.max,minTime:s,maxTime:a,focusedDate:v,format:h,calendar:d,mobileMode:this.mobileMode,footerActions:!this.mobileMode,unstyled:w})},this.renderAdaptivePopup=()=>{const{windowWidth:i=0}=this.state,s=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),a=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),h={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:i,footer:{cancelText:s,onCancel:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleReject(d)},applyText:a,onApply:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleAccept(d)}}};return r.createElement(Y.AdaptiveMode,{...h},r.createElement(ee.ActionSheetContent,{overflowHidden:!0},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=i=>{this.setState({value:T.cloneDate(i.value||void 0)}),this.valueDuringOnChange=i.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,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.handleDateIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=i=>{i.preventDefault()},this.handleKeyDown=i=>{const{altKey:s,keyCode:a}=i;if(a===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===o.Keys.up||a===o.Keys.down)&&(i.preventDefault(),i.stopPropagation(),this.shouldFocusDateInput=a===o.Keys.up,this.setShow(a===o.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),o.validatePackage(Z.packageMetadata),this.state={value:this.props.defaultValue||n.defaultProps.defaultValue,show:this.props.defaultShow||n.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const t=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return t!==null?T.cloneDate(t):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 mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=$.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}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 validity(){const t=p.isInDateRange(this.value,this.min,this.max)&&J.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),i=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&t,a=this.props.valid!==void 0?this.props.valid:s;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}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:!1}get dateInputComp(){return this.props.dateInput||n.defaultProps.dateInput}componentDidMount(){var t;this.observerResize=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){const t=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),t&&!this.show&&this.shouldFocusDateInput&&t.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var t;clearTimeout(this.nextTickId),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:t=n.defaultProps.size,rounded:i=n.defaultProps.rounded,fillMode:s=n.defaultProps.fillMode,autoFocus:a=n.defaultProps.autoFocus,disabled:h,tabIndex:d,title:u,id:f,format:v,formatPlaceholder:w,min:b,max:k,className:M,width:C,name:x,validationMessage:E,required:q,validityStyles:R,minTime:F,maxTime:z,ariaLabelledBy:B,ariaDescribedBy:A,popup:N=U.Popup,unstyled:y}=this.props,D=y&&y.uDateTimePicker,S=!this.validityStyles||this.validity.valid,L={id:f,ariaLabelledBy:B,ariaDescribedBy:A,format:v,formatPlaceholder:w,disabled:h,title:u,validityStyles:R,validationMessage:E,required:q,min:b,max:k,minTime:F,maxTime:z,name:x,tabIndex:this.show?-1:d,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null,unstyled:y},I=r.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:_,onBlur:V})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:K=>{this._element=K},className:o.classNames(o.uDateTimePicker.wrapper({c:D,size:t,fillMode:s,rounded:i,disabled:h,required:this.required,invalid:!S}),M),onKeyDown:this.handleKeyDown,style:{width:C},onFocus:this.mobileMode?void 0:_,onBlur:V,onClick:this.mobileMode?this.handleDateIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,ariaHasPopup:"dialog",readonly:this.mobileMode,autoFocus:a,...L}),r.createElement(X.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:H.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:o.classNames(o.uDateTimePicker.inputButton({c:D})),rounded:null,fillMode:s,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(N,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:o.classNames(o.uDateTimePicker.popup({c:D})),id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(Q.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:S,editorDisabled:this.props.disabled,children:I,style:{width:this.props.width}}):I}setShow(t){const{onOpen:i,onClose:s}=this.props;this.show!==t&&(this.setState({show:t}),t&&i&&i.call(void 0,{target:this}),!t&&s&&s.call(void 0,{target:this}))}nextTick(t){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>t())}calculateMedia(t){for(const i of t)this.setState({windowWidth:i.target.clientWidth})}};n.displayName="DateTimePicker",n.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),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,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,cancelButton:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool},n.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,cancelButton:!0,dateInput:W.DateInput,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let g=n;const P=o.createPropsContext(),O=o.withIdHOC(o.withPropsContext(P,o.withUnstyledHOC(g)));O.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=O;exports.DateTimePickerPropsContext=P;exports.DateTimePickerWithoutContext=g;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("react"),e=require("prop-types"),G=require("@progress/kendo-react-popup"),T=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),J=require("@progress/kendo-svg-icons"),Q=require("../dateinput/DateInput.js"),ee=require("@progress/kendo-react-buttons"),te=require("../package-metadata.js"),p=require("../utils.js"),ie=require("../common/constants.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),se=require("./DateTimeSelector.js"),oe=require("../timepicker/utils.js"),ae=require("../hooks/usePickerFloatingLabel.js"),ne=require("../common/AdaptiveMode.js"),re=require("@progress/kendo-react-layout");function le(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const i in c)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(c,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>c[i]})}}return t.default=c,Object.freeze(t)}const r=le($),a=class a extends r.Component{constructor(t){super(t),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const i=this.dateInputElement();i&&i.focus()},this.renderPicker=()=>{const{disabled:i,minTime:s,maxTime:n,format:h,calendar:d,cancelButton:u,weekNumber:f,focusedDate:v,unstyled:w}=this.props;return r.createElement(se.DateTimeSelector,{ref:b=>{this._dateTimeSelector=b},cancelButton:u,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:f,min:this.min,max:this.max,minTime:s,maxTime:n,focusedDate:v,format:h,calendar:d,mobileMode:this.mobileMode,footerActions:!this.mobileMode,unstyled:w})},this.renderAdaptivePopup=()=>{const{windowWidth:i=0}=this.state,s=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),n=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),h={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:i,footer:{cancelText:s,onCancel:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleReject(d)},applyText:n,onApply:d=>{var u;return(u=this._dateTimeSelector)==null?void 0:u.handleAccept(d)}}};return r.createElement(ne.AdaptiveMode,{...h},r.createElement(re.ActionSheetContent,{overflowHidden:!0},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=i=>{this.setState({value:T.cloneDate(i.value||void 0)}),this.valueDuringOnChange=i.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,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.handleDateIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=i=>{i.preventDefault()},this.handleKeyDown=i=>{const{altKey:s,keyCode:n}=i;if(n===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(n===o.Keys.up||n===o.Keys.down)&&(i.preventDefault(),i.stopPropagation(),this.shouldFocusDateInput=n===o.Keys.up,this.setShow(n===o.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),o.validatePackage(te.packageMetadata),this.state={value:this.props.defaultValue||a.defaultProps.defaultValue,show:this.props.defaultShow||a.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const t=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return t!==null?T.cloneDate(t):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 mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ie.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}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 validity(){const t=p.isInDateRange(this.value,this.min,this.max)&&oe.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),i=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&t,n=this.props.valid!==void 0?this.props.valid:s;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:n,valueMissing:this.value===null}}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:!1}get dateInputComp(){return this.props.dateInput||a.defaultProps.dateInput}componentDidMount(){var t;this.observerResize=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){const t=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),t&&!this.show&&this.shouldFocusDateInput&&t.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var t;clearTimeout(this.nextTickId),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:t=a.defaultProps.size,rounded:i=a.defaultProps.rounded,fillMode:s=a.defaultProps.fillMode,autoFocus:n=a.defaultProps.autoFocus,disabled:h,tabIndex:d,title:u,id:f,format:v,formatPlaceholder:w,min:b,max:O,className:k,width:C,name:x,validationMessage:E,required:q,validityStyles:F,minTime:R,maxTime:z,ariaLabelledBy:B,ariaDescribedBy:A,popup:N=G.Popup,unstyled:y,autoFill:L,twoDigitYearMax:_,enableMouseWheel:K,autoCorrectParts:V,autoSwitchParts:j,autoSwitchKeys:U,allowCaretMode:H}=this.props,D=y&&y.uDateTimePicker,S=!this.validityStyles||this.validity.valid,W={id:f,ariaLabelledBy:B,ariaDescribedBy:A,format:v,formatPlaceholder:w,disabled:h,title:u,validityStyles:F,validationMessage:E,required:q,min:b,max:O,minTime:R,maxTime:z,name:x,tabIndex:this.show?-1:d,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null,unstyled:y,autoFill:L,twoDigitYearMax:_,enableMouseWheel:K,autoCorrectParts:V,autoSwitchParts:j,autoSwitchKeys:U,allowCaretMode:H},I=r.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:X,onBlur:Y})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:Z=>{this._element=Z},className:o.classNames(o.uDateTimePicker.wrapper({c:D,size:t,fillMode:s,rounded:i,disabled:h,required:this.required,invalid:!S}),k),onKeyDown:this.handleKeyDown,style:{width:C},onFocus:this.mobileMode?void 0:X,onBlur:Y,onClick:this.mobileMode?this.handleDateIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,ariaHasPopup:"dialog",readonly:this.mobileMode,autoFocus:n,...W}),r.createElement(ee.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:J.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:o.classNames(o.uDateTimePicker.inputButton({c:D})),rounded:null,fillMode:s,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(N,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:o.classNames(o.uDateTimePicker.popup({c:D})),id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(ae.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:S,editorDisabled:this.props.disabled,children:I,style:{width:this.props.width}}):I}setShow(t){const{onOpen:i,onClose:s}=this.props;this.show!==t&&(this.setState({show:t}),t&&i&&i.call(void 0,{target:this}),!t&&s&&s.call(void 0,{target:this}))}nextTick(t){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>t())}calculateMedia(t){for(const i of t)this.setState({windowWidth:i.target.clientWidth})}};a.displayName="DateTimePicker",a.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),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,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,cancelButton:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),autoFocus:e.bool},a.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,cancelButton:!0,dateInput:Q.DateInput,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let g=a;const P=o.createPropsContext(),M=o.withIdHOC(o.withPropsContext(P,o.withUnstyledHOC(g)));M.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=M;exports.DateTimePickerPropsContext=P;exports.DateTimePickerWithoutContext=g;