@progress/kendo-react-dateinputs 15.1.1-develop.3 → 15.2.0-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.
@@ -7,21 +7,21 @@
7
7
  */
8
8
  import * as i from "react";
9
9
  import e from "prop-types";
10
- import { Popup as z } from "@progress/kendo-react-popup";
11
- import { cloneDate as b } from "@progress/kendo-date-math";
12
- import { createPropsContext as B, classNames as w, Keys as c, validatePackage as N, getLicenseMessage as V, canUseDOM as D, IconWrap as W, WatermarkOverlay as K, getActiveElement as U, withIdHOC as H, withPropsContext as q, withAdaptiveModeContext as j } from "@progress/kendo-react-common";
13
- import { provideLocalizationService as m, registerForLocalization as G } from "@progress/kendo-react-intl";
14
- import { arrowsSwapIcon as X } from "@progress/kendo-svg-icons";
10
+ import { Popup as _ } from "@progress/kendo-react-popup";
11
+ import { cloneDate as w } from "@progress/kendo-date-math";
12
+ import { createPropsContext as A, classNames as b, Keys as c, validatePackage as F, getLicenseMessage as z, canUseDOM as D, IconWrap as B, WatermarkOverlay as L, getActiveElement as N, withIdHOC as V, withPropsContext as W, withAdaptiveModeContext as K } from "@progress/kendo-react-common";
13
+ import { provideLocalizationService as m, registerForLocalization as U } from "@progress/kendo-react-intl";
14
+ import { arrowsSwapIcon as H } from "@progress/kendo-svg-icons";
15
15
  import { packageMetadata as I } from "../package-metadata.mjs";
16
16
  import { DateInput as f } from "../dateinput/DateInput.mjs";
17
- import { MultiViewCalendar as Y } from "../calendar/components/MultiViewCalendar.mjs";
18
- import { EMPTY_SELECTIONRANGE as l } from "../calendar/models/SelectionRange.mjs";
19
- import { nullable as h, MIN_DATE as Z, MAX_DATE as J } from "../utils.mjs";
20
- import { dateRangePickerSet as C, messages as o, dateRangePickerCancel as S, start as E, end as y, separator as x, selectStartDate as k, selectEndDate as M, swapStartEnd as p } from "../messages/index.mjs";
21
- import { Button as Q } from "@progress/kendo-react-buttons";
22
- import { AdaptiveMode as $ } from "../common/AdaptiveMode.mjs";
23
- import { ActionSheetContent as tt } from "@progress/kendo-react-layout";
24
- const r = class r extends i.Component {
17
+ import { MultiViewCalendar as q } from "../calendar/components/MultiViewCalendar.mjs";
18
+ import { EMPTY_SELECTIONRANGE as r } from "../calendar/models/SelectionRange.mjs";
19
+ import { nullable as h, MIN_DATE as j, MAX_DATE as G } from "../utils.mjs";
20
+ import { dateRangePickerSet as C, messages as l, dateRangePickerCancel as S, start as E, end as y, separator as x, swapStartEnd as p } from "../messages/index.mjs";
21
+ import { Button as X } from "@progress/kendo-react-buttons";
22
+ import { AdaptiveMode as Y } from "../common/AdaptiveMode.mjs";
23
+ import { ActionSheetContent as Z } from "@progress/kendo-react-layout";
24
+ const o = class o extends i.Component {
25
25
  constructor(a) {
26
26
  super(a), this._element = null, this._calendar = null, this._startDateInput = i.createRef(), this._endDateInput = i.createRef(), this.shouldFocusDateInput = !1, this.shouldFocusCalendar = !1, this.showLicenseWatermark = !1, this.focus = () => {
27
27
  this.startDateInput && this.startDateInput.focus();
@@ -29,8 +29,8 @@ const r = class r extends i.Component {
29
29
  this._calendar = t;
30
30
  }, this.focusCalendarElement = () => {
31
31
  this._calendar && this._calendar.element && this._calendar.element.focus({ preventScroll: !0 });
32
- }, this.calculateValue = (t, s) => (t.value !== void 0 ? t.value : s.value) || l, this.calculateShow = (t, s) => t.show !== void 0 ? t.show : s.show, this.renderCalendar = () => {
33
- const t = this.value || l, s = {
32
+ }, this.calculateValue = (t, s) => (t.value !== void 0 ? t.value : s.value) || r, this.calculateShow = (t, s) => t.show !== void 0 ? t.show : s.show, this.renderCalendar = () => {
33
+ const t = this.value || r, s = {
34
34
  min: this.min,
35
35
  max: this.max,
36
36
  allowReverse: this.props.allowReverse,
@@ -44,10 +44,10 @@ const r = class r extends i.Component {
44
44
  dir: this.props.dir,
45
45
  onChange: this.handleCalendarChange
46
46
  };
47
- return this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { ...s }) : /* @__PURE__ */ i.createElement(Y, { ...s, ref: this.setCalendarRef });
47
+ return this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { ...s }) : /* @__PURE__ */ i.createElement(q, { ...s, ref: this.setCalendarRef });
48
48
  }, this.renderPopup = () => {
49
49
  const t = {
50
- popupClass: w("k-calendar-container", "k-daterangepicker-popup"),
50
+ popupClass: b("k-calendar-container", "k-daterangepicker-popup"),
51
51
  animate: this._element !== null,
52
52
  anchor: this._element,
53
53
  id: this._popupId,
@@ -62,7 +62,7 @@ const r = class r extends i.Component {
62
62
  ...this.props.popupSettings,
63
63
  show: this.show
64
64
  };
65
- return this.props.popup ? /* @__PURE__ */ i.createElement(this.props.popup, { ...t }, this.renderCalendar()) : /* @__PURE__ */ i.createElement(z, { ...t }, this.renderCalendar());
65
+ return this.props.popup ? /* @__PURE__ */ i.createElement(this.props.popup, { ...t }, this.renderCalendar()) : /* @__PURE__ */ i.createElement(_, { ...t }, this.renderCalendar());
66
66
  }, this.renderAdaptivePopup = () => {
67
67
  const { windowWidth: t = 0 } = this.state, s = {
68
68
  expand: this.show,
@@ -73,14 +73,14 @@ const r = class r extends i.Component {
73
73
  footer: {
74
74
  cancelText: this.localizationService.toLanguageString(
75
75
  S,
76
- o[S]
76
+ l[S]
77
77
  ),
78
78
  onCancel: this.handleCancel,
79
- applyText: this.localizationService.toLanguageString(C, o[C]),
79
+ applyText: this.localizationService.toLanguageString(C, l[C]),
80
80
  onApply: this.handleBlur
81
81
  }
82
82
  };
83
- return /* @__PURE__ */ i.createElement($, { ...s }, /* @__PURE__ */ i.createElement(tt, null, /* @__PURE__ */ i.createElement("div", { className: "k-scrollable-wrap" }, this.renderCalendar())));
83
+ return /* @__PURE__ */ i.createElement(Y, { ...s }, /* @__PURE__ */ i.createElement(Z, null, /* @__PURE__ */ i.createElement("div", { className: "k-scrollable-wrap" }, this.renderCalendar())));
84
84
  }, this.handleReverseClick = (t) => {
85
85
  const s = {
86
86
  start: this.value.end,
@@ -106,25 +106,25 @@ const r = class r extends i.Component {
106
106
  s && s.call(void 0, t);
107
107
  }, this.handleCancel = (t) => {
108
108
  this.nextTick(() => {
109
- this.setShow(!1), this.setState({ currentValue: l });
109
+ this.setShow(!1), this.setState({ currentValue: r });
110
110
  });
111
111
  const { onCancel: s } = this.props;
112
112
  s && s.call(void 0, t);
113
113
  }, this.handleEndChange = (t) => {
114
114
  const s = {
115
115
  start: this.value.start,
116
- end: b(t.value || void 0)
116
+ end: w(t.value || void 0)
117
117
  };
118
118
  this.handleChange(s, t);
119
119
  }, this.handleStartChange = (t) => {
120
120
  const s = {
121
- start: b(t.value || void 0),
121
+ start: w(t.value || void 0),
122
122
  end: this.value.end
123
123
  };
124
124
  this.handleChange(s, t);
125
125
  }, this.extractRangeFromValue = (t) => {
126
126
  if (!Array.isArray(t.value) && !(t.value instanceof Date))
127
- return t.value || l;
127
+ return t.value || r;
128
128
  const s = Array.isArray(t.value) ? t.value[0] : t.value;
129
129
  return {
130
130
  start: this.value.end !== null ? s : this.value.start,
@@ -150,10 +150,10 @@ const r = class r extends i.Component {
150
150
  n.call(void 0, u);
151
151
  }
152
152
  this.valueDuringOnChange = void 0;
153
- }, this.showLicenseWatermark = !N(I, { component: "DateRangePicker" }), this.licenseMessage = V(I), this.state = {
154
- show: this.props.show || this.props.defaultShow || r.defaultProps.defaultShow,
155
- value: this.props.value || this.props.defaultValue || r.defaultProps.defaultValue,
156
- currentValue: l
153
+ }, this.showLicenseWatermark = !F(I, { component: "DateRangePicker" }), this.licenseMessage = z(I), this.state = {
154
+ show: this.props.show || this.props.defaultShow || o.defaultProps.defaultShow,
155
+ value: this.props.value || this.props.defaultValue || o.defaultProps.defaultValue,
156
+ currentValue: r
157
157
  }, this.nextTick = this.nextTick.bind(this), this.setShow = this.setShow.bind(this), this.focusCalendarElement = this.focusCalendarElement.bind(this), this.focusDateInputElement = this.focusDateInputElement.bind(this);
158
158
  }
159
159
  get _popupId() {
@@ -193,7 +193,7 @@ const r = class r extends i.Component {
193
193
  * Gets the value of the DateRangePicker.
194
194
  */
195
195
  get value() {
196
- return (this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value) || l;
196
+ return (this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value) || r;
197
197
  }
198
198
  /**
199
199
  * Gets the popup state of the DateRangePicker.
@@ -205,10 +205,10 @@ const r = class r extends i.Component {
205
205
  return this.showDuringOnChange !== void 0 ? this.showDuringOnChange : this.props.show !== void 0 ? this.props.show : this.state.show;
206
206
  }
207
207
  get min() {
208
- return this.props.min !== void 0 ? this.props.min : r.defaultProps.min;
208
+ return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
209
209
  }
210
210
  get max() {
211
- return this.props.max !== void 0 ? this.props.max : r.defaultProps.max;
211
+ return this.props.max !== void 0 ? this.props.max : o.defaultProps.max;
212
212
  }
213
213
  get document() {
214
214
  if (D)
@@ -250,16 +250,15 @@ const r = class r extends i.Component {
250
250
  * @hidden
251
251
  */
252
252
  render() {
253
- const { autoFocus: a } = this.props, t = this.value || l, s = this.mobileMode && this.show ? this.state.currentValue : t, n = (this.props.startDateInputSettings || {}).id || this._startInputId, u = (this.props.endDateInputSettings || {}).id || this._endInputId, O = w(
253
+ const { autoFocus: a } = this.props, t = this.value || r, s = this.mobileMode && this.show ? this.state.currentValue : t, n = (this.props.startDateInputSettings || {}).id || this._startInputId, u = (this.props.endDateInputSettings || {}).id || this._endInputId, k = b(
254
254
  "k-daterangepicker",
255
255
  {
256
256
  "k-disabled": this.props.disabled
257
257
  },
258
258
  this.props.className
259
- ), R = this.localizationService.toLanguageString(E, o[E]), T = this.localizationService.toLanguageString(y, o[y]), P = this.localizationService.toLanguageString(x, o[x]), _ = this.localizationService.toLanguageString(k, o[k]), A = this.localizationService.toLanguageString(M, o[M]), g = {
259
+ ), M = this.localizationService.toLanguageString(E, l[E]), O = this.localizationService.toLanguageString(y, l[y]), R = this.localizationService.toLanguageString(x, l[x]), g = {
260
260
  disableSelection: this.mobileMode && !0,
261
- label: R,
262
- ariaLabel: _,
261
+ label: M,
263
262
  ariaHasPopup: "grid",
264
263
  format: this.props.format,
265
264
  min: this.min,
@@ -276,8 +275,7 @@ const r = class r extends i.Component {
276
275
  inputAttributes: this.props.inputAttributes
277
276
  }, v = {
278
277
  disableSelection: this.mobileMode && !0,
279
- label: T,
280
- ariaLabel: A,
278
+ label: O,
281
279
  ariaHasPopup: "grid",
282
280
  format: this.props.format,
283
281
  min: this.min,
@@ -292,30 +290,30 @@ const r = class r extends i.Component {
292
290
  value: s.end,
293
291
  onChange: this.handleEndChange,
294
292
  inputAttributes: this.props.inputAttributes
295
- }, F = /* @__PURE__ */ i.createElement(
296
- Q,
293
+ }, T = /* @__PURE__ */ i.createElement(
294
+ X,
297
295
  {
298
296
  type: "button",
299
297
  className: "k-select",
300
298
  fillMode: "flat",
301
- title: m(this).toLanguageString(p, o[p]),
299
+ title: m(this).toLanguageString(p, l[p]),
302
300
  onMouseDown: this.handleReverseMouseDown,
303
301
  onClick: this.handleReverseClick,
304
302
  "aria-controls": n + " " + u,
305
303
  "aria-label": m(this).toLanguageString(
306
304
  p,
307
- o[p]
305
+ l[p]
308
306
  )
309
307
  },
310
- /* @__PURE__ */ i.createElement(W, { style: { transform: "rotate(90deg)" }, name: "arrows-swap", icon: X })
308
+ /* @__PURE__ */ i.createElement(B, { style: { transform: "rotate(90deg)" }, name: "arrows-swap", icon: H })
311
309
  );
312
310
  return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
313
311
  "span",
314
312
  {
315
- ref: (L) => {
316
- this._element = L;
313
+ ref: (P) => {
314
+ this._element = P;
317
315
  },
318
- className: O,
316
+ className: k,
319
317
  style: this.props.style,
320
318
  id: this.props.id,
321
319
  "aria-labelledby": this.props.ariaLabelledBy,
@@ -337,7 +335,7 @@ const r = class r extends i.Component {
337
335
  ariaControls: this.show ? this._popupId : void 0
338
336
  }
339
337
  ),
340
- (this.props.allowReverse || this.props.calendarSettings && this.props.calendarSettings.allowReverse) && this.props.swapButton ? F : P,
338
+ (this.props.allowReverse || this.props.calendarSettings && this.props.calendarSettings.allowReverse) && this.props.swapButton ? T : R,
341
339
  this.props.endDateInput ? /* @__PURE__ */ i.createElement(this.props.endDateInput, { ...v }) : /* @__PURE__ */ i.createElement(
342
340
  f,
343
341
  {
@@ -348,12 +346,12 @@ const r = class r extends i.Component {
348
346
  }
349
347
  ),
350
348
  !this.mobileMode && this.renderPopup()
351
- ), this.mobileMode && this.renderAdaptivePopup(), this.showLicenseWatermark && /* @__PURE__ */ i.createElement(K, { message: this.licenseMessage }));
349
+ ), this.mobileMode && this.renderAdaptivePopup(), this.showLicenseWatermark && /* @__PURE__ */ i.createElement(L, { message: this.licenseMessage }));
352
350
  }
353
351
  focusDateInputElement() {
354
352
  if (!document || !this.startDateInput || !this.startDateInput.element || !this.endDateInput || !this.endDateInput.element)
355
353
  return;
356
- const a = U(document);
354
+ const a = N(document);
357
355
  (this.value.start === null || this.value.end !== null) && a !== this.endDateInput.element ? this.startDateInput.element.focus({ preventScroll: !0 }) : a !== this.startDateInput.element && this.endDateInput.element.focus({ preventScroll: !0 });
358
356
  }
359
357
  nextTick(a) {
@@ -372,7 +370,7 @@ const r = class r extends i.Component {
372
370
  this.setState({ windowWidth: t.target.clientWidth });
373
371
  }
374
372
  };
375
- r.displayName = "DateRangePicker", r.propTypes = {
373
+ o.displayName = "DateRangePicker", o.propTypes = {
376
374
  allowReverse: e.bool,
377
375
  calendarSettings: e.any,
378
376
  className: e.string,
@@ -425,28 +423,28 @@ r.displayName = "DateRangePicker", r.propTypes = {
425
423
  }),
426
424
  autoFocus: e.bool,
427
425
  inputAttributes: e.object
428
- }, r.defaultProps = {
426
+ }, o.defaultProps = {
429
427
  allowReverse: !1,
430
428
  defaultShow: !1,
431
- defaultValue: l,
429
+ defaultValue: r,
432
430
  disabled: !1,
433
431
  format: "d",
434
- max: J,
435
- min: Z,
432
+ max: G,
433
+ min: j,
436
434
  swapButton: !1,
437
435
  autoFocus: !1
438
436
  };
439
- let d = r;
440
- const et = B(), st = H(
441
- q(
442
- et,
443
- j(d)
437
+ let d = o;
438
+ const J = A(), Q = V(
439
+ W(
440
+ J,
441
+ K(d)
444
442
  )
445
443
  );
446
- st.displayName = "KendoReactDateRangePicker";
447
- G(d);
444
+ Q.displayName = "KendoReactDateRangePicker";
445
+ U(d);
448
446
  export {
449
- st as DateRangePicker,
450
- et as DateRangePickerPropsContext,
447
+ Q as DateRangePicker,
448
+ J as DateRangePickerPropsContext,
451
449
  d as DateRangePickerWithoutContext
452
450
  };
@@ -233,6 +233,7 @@ export declare class DateTimePickerWithoutContext extends React.Component<DateTi
233
233
  }> | null | undefined>>;
234
234
  id: PropTypes.Requireable<string>;
235
235
  ariaLabelledBy: PropTypes.Requireable<string>;
236
+ ariaLabel: PropTypes.Requireable<string>;
236
237
  ariaDescribedBy: PropTypes.Requireable<string>;
237
238
  min: PropTypes.Requireable<Date>;
238
239
  max: PropTypes.Requireable<Date>;
@@ -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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),e=require("prop-types"),Q=require("@progress/kendo-react-popup"),P=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),ee=require("@progress/kendo-svg-icons"),te=require("../dateinput/DateInput.js"),ie=require("@progress/kendo-react-buttons"),d=require("../utils.js"),n=require("../messages/index.js"),c=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(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 l=le(J),r=class r extends l.Component{constructor(i){super(i),this._element=null,this._dateInput=l.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.handleSmartPasteValue=t=>{if(t instanceof Date&&!isNaN(t.getTime())){this.applyKendoPasteDate(t);return}const s=t!=null?String(t):"";if(!s)return;const a=new Date(s);isNaN(a.getTime())||this.applyKendoPasteDate(a)},this.applyKendoPasteDate=t=>{if(!d.isInDateRange(t,this.min,this.max))return;const s=new Event("change",{bubbles:!0}),a={target:this._element,currentTarget:this._element,nativeEvent:s};this.handleValueChange({syntheticEvent:a,nativeEvent:s,value:t})},this.focus=()=>{const t=this.dateInputElement();t&&t.focus()},this.renderPicker=()=>{const{disabled:t,minTime:s,maxTime:a,format:m,calendar:u,cancelButton:h,weekNumber:v,focusedDate:f,unstyled:b}=this.props;return l.createElement(se.DateTimeSelector,{ref:w=>{this._dateTimeSelector=w},cancelButton:h,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:t,weekNumber:v,min:this.min,max:this.max,minTime:s,maxTime:a,focusedDate:f,format:m,calendar:u,mobileMode:this.mobileMode,footerActions:!this.mobileMode,unstyled:b})},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s=c.provideLocalizationService(this).toLanguageString(n.dateTimePickerCancel,n.messages[n.dateTimePickerCancel]),a=c.provideLocalizationService(this).toLanguageString(n.dateTimePickerSet,n.messages[n.dateTimePickerSet]),m={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,windowWidth:t,footer:{cancelText:s,onCancel:u=>{var h;return(h=this._dateTimeSelector)==null?void 0:h.handleReject(u)},applyText:a,onApply:u=>{var h;return(h=this._dateTimeSelector)==null?void 0:h.handleAccept(u)}}};return l.createElement(ne.AdaptiveMode,{...m},l.createElement(re.ActionSheetContent,null,this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=t=>{this.setState({value:P.cloneDate(t.value||void 0)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.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.handleClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:a}=t;if(a===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===o.Keys.up||a===o.Keys.down)&&(t.preventDefault(),t.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"),this.state={value:this.props.defaultValue||r.defaultProps.defaultValue,show:this.props.defaultShow||r.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 i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?P.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 mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:r.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:r.defaultProps.max}get validity(){const i=d.isInDateRange(this.value,this.min,this.max)&&oe.isInTimeRange(this.value,this.props.minTime||d.MIN_TIME,this.props.maxTime||d.MAX_TIME),t=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&i,a=this.props.valid!==void 0?this.props.valid:s;return{customError:t,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:r.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get dateInputComp(){return this.props.dateInput||r.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);const i=this.props.name||this.props.id;this.KendoPasteSubscription=o.subscribeToKendoPaste(this._element,{fieldName:i,onValueChange:s=>{this.handleSmartPasteValue(s)}})}componentDidUpdate(){const i=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._dateTimeSelector&&this._dateTimeSelector.focus({preventScroll:!0})},300),i&&!this.show&&this.shouldFocusDateInput&&i.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i,t;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect(),(t=this.KendoPasteSubscription)==null||t.unsubscribe()}render(){const{size:i=r.defaultProps.size,rounded:t=r.defaultProps.rounded,fillMode:s=r.defaultProps.fillMode,autoFocus:a=r.defaultProps.autoFocus,inputAttributes:m,disabled:u,tabIndex:h,title:v,id:f,format:b,formatPlaceholder:w,min:k,max:C,className:M,width:x,name:E,validationMessage:q,required:R,validityStyles:F,minTime:A,maxTime:N,ariaLabelledBy:z,ariaDescribedBy:L,popup:_=Q.Popup,unstyled:S,autoFill:B,twoDigitYearMax:K,enableMouseWheel:V,autoCorrectParts:j,autoSwitchParts:U,autoSwitchKeys:W,allowCaretMode:H}=this.props,y=S&&S.uDateTimePicker,D=!this.validityStyles||this.validity.valid,X=c.provideLocalizationService(this).toLanguageString(n.selectDateAndTime,n.messages[n.selectDateAndTime]),Y={id:f,ariaLabelledBy:z,ariaDescribedBy:L,ariaLabel:X,format:b,formatPlaceholder:w,disabled:u,title:v,validityStyles:F,validationMessage:q,required:R,min:k,max:C,minTime:A,maxTime:N,name:E,tabIndex:this.show?-1:h,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,unstyled:S,autoFill:B,twoDigitYearMax:K,enableMouseWheel:V,autoCorrectParts:j,autoSwitchParts:U,autoSwitchKeys:W,allowCaretMode:H},T=l.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:Z,onBlur:$})=>l.createElement(l.Fragment,null,l.createElement("div",{ref:G=>{this._element=G},className:o.classNames(o.uDateTimePicker.wrapper({c:y,size:i,fillMode:s,rounded:t,disabled:u,required:this.required,invalid:!D}),{"k-focus":this.state.focused},M),onKeyDown:this.handleKeyDown,style:{width:x},onFocus:this.mobileMode?this.handleClick:Z,onBlur:$,onClick:this.mobileMode?this.handleClick:void 0},l.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0,ariaHasPopup:"dialog",autoFocus:a,inputAttributes:m,...Y}),l.createElement(ie.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:ee.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:c.provideLocalizationService(this).toLanguageString(n.toggleDateTimeSelector,n.messages[n.toggleDateTimeSelector]),className:o.classNames(o.uDateTimePicker.inputButton({c:y})),fillMode:s,"aria-label":c.provideLocalizationService(this).toLanguageString(n.toggleDateTimeSelector,n.messages[n.toggleDateTimeSelector])}),l.createElement(_,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:o.classNames(o.uDateTimePicker.popup({c:y})),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?l.createElement(ae.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:D,editorDisabled:this.props.disabled,children:T,style:{width:this.props.width}}):T}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}))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.target.clientWidth})}};r.displayName="DateTimePicker",r.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}),dateInput:e.elementType,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(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full","none"]),fillMode:e.oneOf(["solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object},r.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:d.MAX_DATE,min:d.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,cancelButton:!0,dateInput:te.DateInputInner,size:void 0,rounded:void 0,fillMode:void 0,autoFocus:!1};let g=r;const I=o.createPropsContext(),O=o.withIdHOC(o.withPropsContext(I,o.withUnstyledHOC(o.withAdaptiveModeContext(g))));O.displayName="KendoReactDateTimePicker";c.registerForLocalization(g);exports.DateTimePicker=O;exports.DateTimePickerPropsContext=I;exports.DateTimePickerWithoutContext=g;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react"),e=require("prop-types"),J=require("@progress/kendo-react-popup"),P=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),Q=require("@progress/kendo-svg-icons"),ee=require("../dateinput/DateInput.js"),te=require("@progress/kendo-react-buttons"),d=require("../utils.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),ie=require("./DateTimeSelector.js"),se=require("../timepicker/utils.js"),oe=require("../hooks/usePickerFloatingLabel.js"),ae=require("../common/AdaptiveMode.js"),ne=require("@progress/kendo-react-layout");function re(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return i.default=c,Object.freeze(i)}const r=re(G),n=class n extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.handleSmartPasteValue=t=>{if(t instanceof Date&&!isNaN(t.getTime())){this.applyKendoPasteDate(t);return}const s=t!=null?String(t):"";if(!s)return;const a=new Date(s);isNaN(a.getTime())||this.applyKendoPasteDate(a)},this.applyKendoPasteDate=t=>{if(!d.isInDateRange(t,this.min,this.max))return;const s=new Event("change",{bubbles:!0}),a={target:this._element,currentTarget:this._element,nativeEvent:s};this.handleValueChange({syntheticEvent:a,nativeEvent:s,value:t})},this.focus=()=>{const t=this.dateInputElement();t&&t.focus()},this.renderPicker=()=>{const{disabled:t,minTime:s,maxTime:a,format:p,calendar:u,cancelButton:h,weekNumber:v,focusedDate:f,unstyled:b}=this.props;return r.createElement(ie.DateTimeSelector,{ref:w=>{this._dateTimeSelector=w},cancelButton:h,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:t,weekNumber:v,min:this.min,max:this.max,minTime:s,maxTime:a,focusedDate:f,format:p,calendar:u,mobileMode:this.mobileMode,footerActions:!this.mobileMode,unstyled:b})},this.renderAdaptivePopup=()=>{const{windowWidth:t=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]),p={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,windowWidth:t,footer:{cancelText:s,onCancel:u=>{var h;return(h=this._dateTimeSelector)==null?void 0:h.handleReject(u)},applyText:a,onApply:u=>{var h;return(h=this._dateTimeSelector)==null?void 0:h.handleAccept(u)}}};return r.createElement(ae.AdaptiveMode,{...p},r.createElement(ne.ActionSheetContent,null,this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=t=>{this.setState({value:P.cloneDate(t.value||void 0)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.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.handleClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:a}=t;if(a===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===o.Keys.up||a===o.Keys.down)&&(t.preventDefault(),t.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"),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 i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?P.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 mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&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 i=d.isInDateRange(this.value,this.min,this.max)&&se.isInTimeRange(this.value,this.props.minTime||d.MIN_TIME,this.props.maxTime||d.MAX_TIME),t=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&i,a=this.props.valid!==void 0?this.props.valid:s;return{customError:t,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);const i=this.props.name||this.props.id;this.KendoPasteSubscription=o.subscribeToKendoPaste(this._element,{fieldName:i,onValueChange:s=>{this.handleSmartPasteValue(s)}})}componentDidUpdate(){const i=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._dateTimeSelector&&this._dateTimeSelector.focus({preventScroll:!0})},300),i&&!this.show&&this.shouldFocusDateInput&&i.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i,t;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect(),(t=this.KendoPasteSubscription)==null||t.unsubscribe()}render(){const{size:i=n.defaultProps.size,rounded:t=n.defaultProps.rounded,fillMode:s=n.defaultProps.fillMode,autoFocus:a=n.defaultProps.autoFocus,inputAttributes:p,disabled:u,tabIndex:h,title:v,id:f,format:b,formatPlaceholder:w,min:k,max:C,className:M,width:x,name:E,validationMessage:q,required:R,validityStyles:F,minTime:N,maxTime:A,ariaLabelledBy:z,ariaDescribedBy:_,popup:B=J.Popup,unstyled:y,autoFill:K,twoDigitYearMax:L,enableMouseWheel:V,autoCorrectParts:j,autoSwitchParts:U,autoSwitchKeys:W,allowCaretMode:H}=this.props,S=y&&y.uDateTimePicker,D=!this.validityStyles||this.validity.valid,X={id:f,ariaLabelledBy:z,ariaDescribedBy:_,ariaLabel:this.props.ariaLabel,format:b,formatPlaceholder:w,disabled:u,title:v,validityStyles:F,validationMessage:q,required:R,min:k,max:C,minTime:N,maxTime:A,name:E,tabIndex:this.show?-1:h,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,unstyled:y,autoFill:K,twoDigitYearMax:L,enableMouseWheel:V,autoCorrectParts:j,autoSwitchParts:U,autoSwitchKeys:W,allowCaretMode:H},T=r.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:Y,onBlur:Z})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:$=>{this._element=$},className:o.classNames(o.uDateTimePicker.wrapper({c:S,size:i,fillMode:s,rounded:t,disabled:u,required:this.required,invalid:!D}),{"k-focus":this.state.focused},M),onKeyDown:this.handleKeyDown,style:{width:x},onFocus:this.mobileMode?this.handleClick:Y,onBlur:Z,onClick:this.mobileMode?this.handleClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this.show?this._popupId:void 0,ariaHasPopup:"dialog",autoFocus:a,inputAttributes:p,...X}),r.createElement(te.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:Q.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:o.classNames(o.uDateTimePicker.inputButton({c:S})),fillMode:s,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(B,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:o.classNames(o.uDateTimePicker.popup({c:S})),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(oe.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:f,editorValid:D,editorDisabled:this.props.disabled,children:T,style:{width:this.props.width}}):T}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}))}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.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,ariaLabel: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}),dateInput:e.elementType,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(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full","none"]),fillMode:e.oneOf(["solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object},n.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:d.MAX_DATE,min:d.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,cancelButton:!0,dateInput:ee.DateInputInner,size:void 0,rounded:void 0,fillMode:void 0,autoFocus:!1};let g=n;const I=o.createPropsContext(),O=o.withIdHOC(o.withPropsContext(I,o.withUnstyledHOC(o.withAdaptiveModeContext(g))));O.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=O;exports.DateTimePickerPropsContext=I;exports.DateTimePickerWithoutContext=g;