@progress/kendo-react-dateinputs 7.5.0-develop.20 → 7.5.0-develop.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,61 +6,67 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as r from "react";
9
+ import * as i from "react";
10
10
  import s from "prop-types";
11
- import { cloneDate as p, weekInYear as D } from "@progress/kendo-date-math";
12
- import { provideIntlService as w, registerForIntl as v } from "@progress/kendo-react-intl";
11
+ import { cloneDate as p, weekInYear as w } from "@progress/kendo-date-math";
12
+ import { provideIntlService as D, registerForIntl as v } from "@progress/kendo-react-intl";
13
13
  import { CalendarCell as g } from "./CalendarCell.mjs";
14
- import { CalendarWeekCell as N } from "./CalendarWeekCell.mjs";
14
+ import { CalendarWeekCell as y } from "./CalendarWeekCell.mjs";
15
15
  import { CalendarViewEnum as u } from "../models/CalendarViewEnum.mjs";
16
- import { getToday as d, setTime as b } from "../../utils.mjs";
17
- import { WeekNamesService as y } from "../services/WeekNamesService.mjs";
18
- const k = (f) => /* @__PURE__ */ r.createElement("td", { key: f, className: "k-calendar-td k-empty" }, " "), c = class c extends r.Component {
16
+ import { getToday as d, setTime as N } from "../../utils.mjs";
17
+ import { WeekNamesService as b } from "../services/WeekNamesService.mjs";
18
+ const k = (f) => /* @__PURE__ */ i.createElement("td", { key: f, className: "k-calendar-td k-empty" }, " "), c = class c extends i.Component {
19
19
  constructor() {
20
20
  super(...arguments), this.intl = null, this.weekService = null, this.buildWeekNumber = (t, e) => {
21
21
  if (!this.firstDate(t))
22
22
  return k(`week-cell-${e}`);
23
- const n = this.firstDate(t), a = this.getWeekNumber(n), o = `kendo-react-calendar-week-cell-${a}`, l = {
23
+ const a = this.firstDate(t), n = this.getWeekNumber(a), o = `kendo-react-calendar-week-cell-${n}`, l = {
24
24
  className: "k-alt",
25
- value: a,
26
- firstDate: n
25
+ value: n,
26
+ firstDate: a,
27
+ weekDays: t,
28
+ onClick: this.handleWeekCellClick
27
29
  };
28
- return this.props.weekCell ? /* @__PURE__ */ r.createElement(this.props.weekCell, { ...l, key: o }, a) : /* @__PURE__ */ r.createElement(N, { ...l, key: o }, a);
29
- }, this.buildRow = (t) => t.map((e, i) => {
30
+ return this.props.weekCell ? /* @__PURE__ */ i.createElement(this.props.weekCell, { ...l, key: o }, n) : /* @__PURE__ */ i.createElement(y, { ...l, key: o }, n);
31
+ }, this.buildRow = (t) => t.map((e, r) => {
30
32
  if (!e)
31
- return k(i);
32
- const n = { "aria-selected": e.isSelected }, a = `kendo-react-calendar-cell-${e.value.getTime()}`, o = {
33
- ...n,
33
+ return k(r);
34
+ const a = { "aria-selected": e.isSelected }, n = `kendo-react-calendar-cell-${e.value.getTime()}`, o = {
35
+ ...a,
34
36
  ...e,
35
37
  isDisabled: !e.isInRange,
36
38
  view: this.props.activeView,
37
39
  showOtherMonthDays: this.props.showOtherMonthDays,
40
+ allowReverse: this.props.allowReverse,
38
41
  onClick: this.handleClick,
39
42
  onMouseEnter: this.handleMouseEnter,
40
43
  onMouseLeave: this.handleMouseLeave
41
44
  };
42
- return this.props.cell ? /* @__PURE__ */ r.createElement(this.props.cell, { ...o, key: a }, e.formattedValue) : /* @__PURE__ */ r.createElement(g, { ...o, key: a }, e.formattedValue);
45
+ return this.props.cell ? /* @__PURE__ */ i.createElement(this.props.cell, { ...o, key: n }, e.formattedValue) : /* @__PURE__ */ i.createElement(g, { ...o, key: n }, e.formattedValue);
43
46
  }), this.firstDate = (t) => {
44
47
  const e = this.firstWeekDateContext(t);
45
48
  return e ? e.value : null;
46
49
  }, this.firstWeekDateContext = (t) => {
47
50
  if (!this.weekNumber)
48
51
  return null;
49
- let e = 0, i = t[e];
50
- for (; !i && e < t.length; )
51
- i = t[++e];
52
- return i;
52
+ let e = 0, r = t[e];
53
+ for (; !r && e < t.length; )
54
+ r = t[++e];
55
+ return r;
53
56
  }, this.handleClick = (t, e) => {
54
- const { onChange: i } = this.props;
55
- if (i && e) {
56
- const n = {
57
+ const { onChange: r } = this.props;
58
+ if (r && e) {
59
+ const a = {
57
60
  value: p(t),
58
61
  target: this,
59
62
  nativeEvent: e && e.nativeEvent,
60
63
  syntheticEvent: e
61
64
  };
62
- i.call(void 0, n);
65
+ r.call(void 0, a);
63
66
  }
67
+ }, this.handleWeekCellClick = (t, e, r) => {
68
+ const { onWeekSelect: a } = this.props, n = e.findIndex((o) => o && o.value === t);
69
+ a && r && a.call(void 0, t, n, r);
64
70
  }, this.handleMouseEnter = (t) => {
65
71
  const { onCellEnter: e } = this.props;
66
72
  e && e.call(void 0, p(t));
@@ -88,8 +94,8 @@ const k = (f) => /* @__PURE__ */ r.createElement("td", { key: f, className: "k-c
88
94
  return this.props.selectedDate !== void 0 ? this.props.selectedDate : c.defaultProps.selectedDate;
89
95
  }
90
96
  render() {
91
- this.intl = w(this), this.weekService = new y(this.intl);
92
- const t = this.weekService.getWeekNames(this.weekNumber, this.props.weekDaysFormat), e = this.props.service.rowLength(this.weekNumber), i = this.props.service.title(this.props.viewDate), n = d(), a = b(this.props.viewDate, n), o = this.props.service.data({
97
+ this.intl = D(this), this.weekService = new b(this.intl);
98
+ const t = this.weekService.getWeekNames(this.weekNumber, this.props.weekDaysFormat), e = this.props.service.rowLength(this.weekNumber), r = this.props.service.title(this.props.viewDate), a = d(), n = N(this.props.viewDate, a), o = this.props.service.data({
93
99
  cellUID: this.props.cellUID,
94
100
  min: this.min,
95
101
  max: this.max,
@@ -97,35 +103,35 @@ const k = (f) => /* @__PURE__ */ r.createElement("td", { key: f, className: "k-c
97
103
  isActiveView: !this.props.bus.canMoveDown(this.props.activeView),
98
104
  selectedDate: this.selectedDate,
99
105
  selectionRange: this.props.selectionRange,
100
- viewDate: a
106
+ viewDate: n
101
107
  });
102
- return /* @__PURE__ */ r.createElement(r.Fragment, null, this.isMonthView && this.isHorizontal && /* @__PURE__ */ r.createElement(
108
+ return /* @__PURE__ */ i.createElement(i.Fragment, null, this.isMonthView && this.isHorizontal && /* @__PURE__ */ i.createElement(
103
109
  "thead",
104
110
  {
105
111
  role: "rowgroup",
106
112
  className: "k-calendar-thead"
107
113
  },
108
- /* @__PURE__ */ r.createElement("tr", { role: "row", className: "k-calendar-tr" }, t.map((l, h) => /* @__PURE__ */ r.createElement("th", { key: h, className: "k-calendar-th" }, l)))
109
- ), /* @__PURE__ */ r.createElement(
114
+ /* @__PURE__ */ i.createElement("tr", { role: "row", className: "k-calendar-tr" }, t.map((l, h) => /* @__PURE__ */ i.createElement("th", { key: h, className: "k-calendar-th" }, l)))
115
+ ), /* @__PURE__ */ i.createElement(
110
116
  "tbody",
111
117
  {
112
118
  role: "rowgroup",
113
119
  className: "k-calendar-tbody"
114
120
  },
115
- !this.isHorizontal && /* @__PURE__ */ r.createElement("tr", { role: "presentation", className: "k-calendar-tr" }, /* @__PURE__ */ r.createElement(
121
+ !this.isHorizontal && /* @__PURE__ */ i.createElement("tr", { role: "presentation", className: "k-calendar-tr" }, /* @__PURE__ */ i.createElement(
116
122
  "th",
117
123
  {
118
124
  scope: "col",
119
125
  colSpan: e,
120
126
  className: "k-calendar-caption"
121
127
  },
122
- i
128
+ r
123
129
  )),
124
- o.map((l, h) => /* @__PURE__ */ r.createElement("tr", { role: "row", className: "k-calendar-tr", key: h }, this.weekNumber && this.buildWeekNumber(l, h), this.buildRow(l)))
130
+ o.map((l, h) => /* @__PURE__ */ i.createElement("tr", { role: "row", className: "k-calendar-tr", key: h }, this.weekNumber && this.buildWeekNumber(l, h), this.buildRow(l)))
125
131
  ));
126
132
  }
127
133
  getWeekNumber(t) {
128
- return !this.weekNumber || !this.intl ? null : D(t, this.intl.firstDay());
134
+ return !this.weekNumber || !this.intl ? null : w(t, this.intl.firstDay());
129
135
  }
130
136
  };
131
137
  c.propTypes = {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";const i=require("react"),a=require("@progress/kendo-react-intl"),o=require("../messages/index.js"),l=require("@progress/kendo-react-common"),u=require("@progress/kendo-svg-icons");function p(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,c.get?c:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const r=p(i);class s extends r.Component{constructor(){super(...arguments),this.handelClick=e=>{e.stopPropagation();const{onClick:t}=this.props;t&&t.call(void 0,e)}}render(){const e=a.provideLocalizationService(this).toLanguageString(o.clear,o.messages[o.clear]);return r.createElement("span",{className:"k-clear-value",role:"button",onClick:this.handelClick,tabIndex:this.props.tabindex||-1,title:e,key:"clearbutton"},r.createElement(l.IconWrap,{name:"x",icon:u.xIcon}))}}a.registerForLocalization(s);module.exports=s;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as e from "react";
10
+ import { provideLocalizationService as a, registerForLocalization as n } from "@progress/kendo-react-intl";
11
+ import { clear as r, messages as i } from "../messages/index.mjs";
12
+ import { IconWrap as s } from "@progress/kendo-react-common";
13
+ import { xIcon as c } from "@progress/kendo-svg-icons";
14
+ class l extends e.Component {
15
+ constructor() {
16
+ super(...arguments), this.handelClick = (t) => {
17
+ t.stopPropagation();
18
+ const { onClick: o } = this.props;
19
+ o && o.call(void 0, t);
20
+ };
21
+ }
22
+ render() {
23
+ const t = a(this).toLanguageString(r, i[r]);
24
+ return /* @__PURE__ */ e.createElement(
25
+ "span",
26
+ {
27
+ className: "k-clear-value",
28
+ role: "button",
29
+ onClick: this.handelClick,
30
+ tabIndex: this.props.tabindex || -1,
31
+ title: t,
32
+ key: "clearbutton"
33
+ },
34
+ /* @__PURE__ */ e.createElement(s, { name: "x", icon: c })
35
+ );
36
+ }
37
+ }
38
+ n(l);
39
+ export {
40
+ l as default
41
+ };
@@ -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 T=require("react"),t=require("prop-types"),g=require("@progress/kendo-date-math"),P=require("@progress/kendo-react-buttons"),F=require("@progress/kendo-svg-icons"),y=require("@progress/kendo-react-intl"),q=require("./models/kendo-date.js"),l=require("@progress/kendo-react-common"),B=require("@progress/kendo-react-labels"),_=require("../package-metadata.js"),v=require("./utils.js"),b=require("../utils.js"),h=require("../messages/index.js"),A=require("../timepicker/utils.js");function L(f){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const e in f)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(f,e);Object.defineProperty(i,e,s.get?s:{enumerable:!0,get:()=>f[e]})}}return i.default=f,Object.freeze(i)}const u=L(T),N="Please enter a valid value!",o=class o extends u.Component{constructor(i){super(i),this.kendoDate=null,this.currentFormat="",this.paste=!1,this._element=null,this._wrapper=null,this._lastSelectedSymbol="",this.focus=()=>{this._element&&this._element.focus()},this.setValidity=()=>{this.element&&this.element.setCustomValidity&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||o.defaultProps.validationMessage)},this.updateOnPaste=e=>{if(!this.element||!this.kendoDate)return;const s=y.provideIntlService(this).parseDate(this.element.value,this.props.format)||this.value,a=this.value;this.kendoDate.setValue(s),this.triggerChange(e,a)},this.spinnersMouseDown=e=>{e.preventDefault();const s=l.getActiveElement(document);this.element&&s!==this.element&&this.element.focus({preventScroll:!0})},this.handlePaste=()=>{this.paste=!0},this.elementChange=e=>{if(!this.element||!this.kendoDate)return;if(this.paste){this.updateOnPaste(e),this.paste=!1;return}const{text:s,format:a}=this.kendoDate.getTextAndFormat();this.currentFormat=a;const r=this.value,n=v.approximateStringMatching(s,this.currentFormat,this.element.value,this.selection.start),d=n.length===1&&n[0][1]==="_";if(!d)for(let c=0;c<n.length;c++)this.kendoDate.parsePart(n[c][0],n[c][1]);n.length&&n[0][0]!=="_"&&this.setSelection(this.selectionBySymbol(n[0][0])),d&&this.switchDateSegment(1),this.triggerChange(e,r)},this.elementClick=e=>{this.setSelection(this.selectionByIndex(this.selection.start))},this.nativeWheel=e=>{l.getActiveElement(document)===this.element&&e.preventDefault()},this.wheel=e=>{l.getActiveElement(document)===this.element&&(e.nativeEvent.deltaY<0&&this.increasePart(e),e.nativeEvent.deltaY>0&&this.decreasePart(e))},this.increasePart=e=>{this.modifyDateSegmentValue(1,e)},this.decreasePart=e=>{this.modifyDateSegmentValue(-1,e)},this.elementKeyDown=e=>{if(!e.altKey){switch(e.keyCode){case 37:this.switchDateSegment(-1);break;case 38:this.modifyDateSegmentValue(1,e);break;case 39:this.switchDateSegment(1);break;case 40:this.modifyDateSegmentValue(-1,e);break;default:return}e.preventDefault()}},this.elementOnFocus=e=>{this.wrapper&&this.wrapper.classList.add("k-focus"),this.setState({focused:!0})},this.elementOnBlur=e=>{this.wrapper&&this.wrapper.classList.remove("k-focus"),this.setState({focused:!1})},l.validatePackage(_.packageMetadata),this.state={focused:!1}}get _inputId(){return this.props.id+"-accessibility-id"}componentDidMount(){this.setValidity(),this.wrapper&&this.wrapper.addEventListener("wheel",this.nativeWheel,{passive:!1})}componentDidUpdate(i,e){this._lastSelectedSymbol&&e.focused===this.state.focused?this.setSelection(this.selectionBySymbol(this._lastSelectedSymbol)):this.props.placeholder!==void 0&&this.selection.start===this.selection.end&&this.setSelection({start:0,end:this.currentFormat.length}),this.setValidity()}componentWillUnmount(){this.wrapper&&this.wrapper.removeEventListener("wheel",this.nativeWheel)}render(){const{size:i=o.defaultProps.size,fillMode:e=o.defaultProps.fillMode,rounded:s=o.defaultProps.rounded}=this.props;this.props._ref&&(this.props._ref.current=this);const a=y.provideLocalizationService(this),r={...o.defaultProps,...this.props},{name:n,label:d,id:c}=r,p=this.text,I=p===this.props.placeholder?"":p,x=p===this.props.placeholder?p:void 0,S=c||this._inputId,w=!this.validityStyles||this.validity.valid;let C=[...v.wrapperClasses];this.props.className&&C.push(this.props.className);const O=u.createElement(l.AsyncFocusBlur,{onFocus:this.elementOnFocus,onBlur:this.elementOnBlur},({onFocus:M,onBlur:V})=>u.createElement("span",{ref:D=>{this._wrapper=D},style:d?void 0:{width:this.props.width},dir:this.props.dir,className:l.classNames("k-dateinput","k-input",{[`k-input-${l.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-input-${e}`]:e,[`k-rounded-${l.kendoThemeMaps.roundedMap[s]||s}`]:s,"k-invalid":!w,"k-required":this.required,"k-disabled":this.props.disabled},this.props.className),onFocus:M,onBlur:V},u.createElement("input",{role:this.props.ariaRole||"textbox",readOnly:this.props.readonly,tabIndex:this.props.tabIndex,disabled:this.props.disabled,title:this.props.title!==void 0?this.props.title:p,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",className:"k-input-inner",id:S,"aria-label":this.props.ariaLabel,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-haspopup":this.props.ariaHasPopup,"aria-disabled":this.props.disabled,"aria-expanded":this.props.ariaExpanded,"aria-controls":this.props.ariaControls,onWheel:this.wheel,onClick:this.elementClick,onInput:this.elementChange,onPaste:this.handlePaste,onKeyDown:this.elementKeyDown,onChange:l.noop,value:I,placeholder:x,name:n,ref:D=>this._element=D}),this.props.children,this.props.spinners&&u.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:this.spinnersMouseDown},u.createElement(P.Button,{tabIndex:-1,type:"button",rounded:null,className:"k-spinner-increase",icon:"caret-alt-up",svgIcon:F.caretAltUpIcon,"aria-label":a.toLanguageString(h.increaseValue,h.messages[h.increaseValue]),title:a.toLanguageString(h.increaseValue,h.messages[h.increaseValue]),onClick:this.increasePart}),u.createElement(P.Button,{tabIndex:-1,type:"button",rounded:null,className:"k-spinner-decrease",icon:"caret-alt-down",svgIcon:F.caretAltDownIcon,"aria-label":a.toLanguageString(h.decreaseValue,h.messages[h.decreaseValue]),title:a.toLanguageString(h.decreaseValue,h.messages[h.decreaseValue]),onClick:this.decreasePart}))));return d?u.createElement(B.FloatingLabel,{label:d,editorId:S,editorValue:p,editorValid:w,editorDisabled:this.props.disabled,children:O,style:{width:this.props.width}}):O}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.kendoDate&&this.kendoDate.getDateObject()}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:o.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:o.defaultProps.max}get text(){const i={...k.defaultProps,...this.props},{formatPlaceholder:e=o.defaultProps.formatPlaceholder,format:s=o.defaultProps.format,value:a,defaultValue:r}=i;this.kendoDate===null?(this.kendoDate=new q.KendoDate(this.intl.bind(this),e,s),this.kendoDate.setValue(a||r||null)):(this.kendoDate.format=s,this.kendoDate.formatPlaceholder=e),a!==void 0&&this.value!==a&&this.kendoDate.setValue(a);const{text:n,format:d}=this.kendoDate.getTextAndFormat();return this.currentFormat=d,i.placeholder!==null&&i.placeholder!==void 0&&!this.state.focused&&!this.kendoDate.hasValue()?i.placeholder:n}get validity(){const i=v.isInRange(this.value,this.min,this.max)&&A.isInTimeRange(this.value,this.props.minTime,this.props.maxTime),e=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&i,a=this.props.valid!==void 0?this.props.valid:s;return{customError:e,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 element(){return this._element}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}get wrapper(){return this._wrapper}intl(){return y.provideIntlService(this)}get selection(){let i={start:0,end:0};return this.element!==null&&this.element.selectionStart!==void 0&&(i={start:this.element.selectionStart,end:this.element.selectionEnd}),i}setSelection(i){this._lastSelectedSymbol=this.currentFormat[i.start],window.requestAnimationFrame(()=>{const e=l.getActiveElement(document);this.element&&e===this.element&&!this.props.disableSelection&&this.element.setSelectionRange(i.start,i.end)})}triggerChange(i,e){this.valueDuringOnChange=this.value,this.forceUpdate(),this.props.onChange&&!g.isEqual(e,this.value)&&this.props.onChange.call(void 0,{syntheticEvent:i,nativeEvent:i.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0}selectionBySymbol(i){let e=-1,s=0;for(let a=0;a<this.currentFormat.length;a++)this.currentFormat[a]===i&&(s=a+1,e===-1&&(e=a));return e<0&&(e=0),{start:e,end:s}}selectionByIndex(i){let e={start:i,end:i};for(let s=i,a=i-1;s<this.currentFormat.length||a>=0;s++,a--){if(s<this.currentFormat.length&&this.currentFormat[s]!=="_"){e=this.selectionBySymbol(this.currentFormat[s]);break}if(a>=0&&this.currentFormat[a]!=="_"){e=this.selectionBySymbol(this.currentFormat[a]);break}}return e}switchDateSegment(i){const{start:e,end:s}=this.selection;if(e<s&&this.currentFormat[e]!==this.currentFormat[s-1]){this.setSelection(this.selectionByIndex(i>0?e:s-1));return}const a=this.currentFormat[e];let r=e+i;for(;r>0&&r<this.currentFormat.length&&!(this.currentFormat[r]!==a&&this.currentFormat[r]!=="_");)r+=i;if(this.currentFormat[r]==="_")return;let n=r;for(;n>=0&&n<this.currentFormat.length&&this.currentFormat[n]===this.currentFormat[r];)n+=i;r>n&&(n+1!==e||r+1!==s)?this.setSelection({start:n+1,end:r+1}):r<n&&(r!==e||n!==s)&&this.setSelection({start:r,end:n})}modifyDateSegmentValue(i,e){if(!this.kendoDate)return;const s=this.value,a=this.currentFormat[this.selection.start],r=this.kendoDate.symbolMap(a),n=((this.props.steps||{})[r]||1)*i;this.kendoDate.modifyPart(a,n),this.triggerChange(e,s)}};o.displayName="DateInput",o.propTypes={value:t.instanceOf(Date),format:t.oneOfType([t.string,t.shape({skeleton:t.string,pattern:t.string,date:t.oneOf(["short","medium","long","full"]),time:t.oneOf(["short","medium","long","full"]),datetime:t.oneOf(["short","medium","long","full"]),era:t.oneOf(["narrow","short","long"]),year:t.oneOf(["numeric","2-digit"]),month:t.oneOf(["numeric","2-digit","narrow","short","long"]),day:t.oneOf(["numeric","2-digit"]),weekday:t.oneOf(["narrow","short","long"]),hour:t.oneOf(["numeric","2-digit"]),hour12:t.bool,minute:t.oneOf(["numeric","2-digit"]),second:t.oneOf(["numeric","2-digit"]),timeZoneName:t.oneOf(["short","long"])})]),formatPlaceholder:t.oneOfType([t.oneOf(["wide","narrow","short","formatPattern"]),t.shape({year:t.string,month:t.string,day:t.string,hour:t.string,minute:t.string,second:t.string})]),width:t.oneOfType([t.string,t.number]),tabIndex:t.number,title:t.string,steps:t.shape({year:t.number,month:t.number,day:t.number,hour:t.number,minute:t.number,second:t.number}),min:t.instanceOf(Date),max:t.instanceOf(Date),disabled:t.bool,spinners:t.bool,name:t.string,dir:t.string,label:t.string,id:t.string,ariaLabelledBy:t.string,ariaDescribedBy:t.string,ariaLabel:t.string,ariaRole:t.string,ariaHasPopup:t.oneOfType([t.bool,t.string]),ariaExpanded:t.oneOfType([t.bool]),onChange:t.func,validationMessage:t.string,required:t.bool,validate:t.bool,valid:t.bool,size:t.oneOf([null,"small","medium","large"]),rounded:t.oneOf([null,"small","medium","large","full"]),fillMode:t.oneOf([null,"solid","flat","outline"])},o.defaultProps={format:v.defaultFormat,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:v.defaultFormatPlaceholder,spinners:!1,disabled:!1,max:g.cloneDate(b.MAX_DATE),min:g.cloneDate(b.MIN_DATE),minTime:g.cloneDate(b.MIN_TIME),maxTime:g.cloneDate(b.MAX_TIME),required:!1,validityStyles:!0,validationMessage:N,placeholder:null,ariaHasPopup:"grid"};let m=o;const E=l.createPropsContext(),k=l.withIdHOC(l.withPropsContext(E,m));k.displayName="KendoReactDateInput";y.registerForIntl(m);y.registerForLocalization(m);exports.DateInput=k;exports.DateInputPropsContext=E;exports.DateInputWithoutContext=m;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),t=require("prop-types"),g=require("@progress/kendo-date-math"),P=require("@progress/kendo-react-buttons"),F=require("@progress/kendo-svg-icons"),y=require("@progress/kendo-react-intl"),q=require("./models/kendo-date.js"),l=require("@progress/kendo-react-common"),B=require("@progress/kendo-react-labels"),_=require("../package-metadata.js"),v=require("./utils.js"),b=require("../utils.js"),h=require("../messages/index.js"),A=require("../timepicker/utils.js"),L=require("../common/ClearButton.js");function N(f){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(f){for(const e in f)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(f,e);Object.defineProperty(s,e,i.get?i:{enumerable:!0,get:()=>f[e]})}}return s.default=f,Object.freeze(s)}const d=N(T),R="Please enter a valid value!",o=class o extends d.Component{constructor(s){super(s),this.kendoDate=null,this.currentFormat="",this.paste=!1,this._element=null,this._wrapper=null,this._lastSelectedSymbol="",this.focus=()=>{this._element&&this._element.focus()},this.setValidity=()=>{this.element&&this.element.setCustomValidity&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||o.defaultProps.validationMessage)},this.updateOnPaste=e=>{if(!this.element||!this.kendoDate)return;const i=y.provideIntlService(this).parseDate(this.element.value,this.props.format)||this.value,a=this.value;this.kendoDate.setValue(i),this.triggerChange(e,a)},this.spinnersMouseDown=e=>{e.preventDefault();const i=l.getActiveElement(document);this.element&&i!==this.element&&this.element.focus({preventScroll:!0})},this.handlePaste=()=>{this.paste=!0},this.handleClick=e=>{this.props.onChange&&this.props.onChange(e)},this.elementChange=e=>{if(!this.element||!this.kendoDate)return;if(this.paste){this.updateOnPaste(e),this.paste=!1;return}const{text:i,format:a}=this.kendoDate.getTextAndFormat();this.currentFormat=a;const r=this.value,n=v.approximateStringMatching(i,this.currentFormat,this.element.value,this.selection.start),u=n.length===1&&n[0][1]==="_";if(!u)for(let c=0;c<n.length;c++)this.kendoDate.parsePart(n[c][0],n[c][1]);n.length&&n[0][0]!=="_"&&this.setSelection(this.selectionBySymbol(n[0][0])),u&&this.switchDateSegment(1),this.triggerChange(e,r)},this.elementClick=e=>{this.setSelection(this.selectionByIndex(this.selection.start))},this.nativeWheel=e=>{l.getActiveElement(document)===this.element&&e.preventDefault()},this.wheel=e=>{l.getActiveElement(document)===this.element&&(e.nativeEvent.deltaY<0&&this.increasePart(e),e.nativeEvent.deltaY>0&&this.decreasePart(e))},this.increasePart=e=>{this.modifyDateSegmentValue(1,e)},this.decreasePart=e=>{this.modifyDateSegmentValue(-1,e)},this.elementKeyDown=e=>{if(!e.altKey){switch(e.keyCode){case 37:this.switchDateSegment(-1);break;case 38:this.modifyDateSegmentValue(1,e);break;case 39:this.switchDateSegment(1);break;case 40:this.modifyDateSegmentValue(-1,e);break;default:return}e.preventDefault()}},this.elementOnFocus=e=>{this.wrapper&&this.wrapper.classList.add("k-focus"),this.setState({focused:!0})},this.elementOnBlur=e=>{this.wrapper&&this.wrapper.classList.remove("k-focus"),this.setState({focused:!1})},l.validatePackage(_.packageMetadata),this.state={focused:!1}}get _inputId(){return this.props.id+"-accessibility-id"}componentDidMount(){this.setValidity(),this.wrapper&&this.wrapper.addEventListener("wheel",this.nativeWheel,{passive:!1})}componentDidUpdate(s,e){this._lastSelectedSymbol&&e.focused===this.state.focused?this.setSelection(this.selectionBySymbol(this._lastSelectedSymbol)):this.props.placeholder!==void 0&&this.selection.start===this.selection.end&&this.setSelection({start:0,end:this.currentFormat.length}),this.setValidity()}componentWillUnmount(){this.wrapper&&this.wrapper.removeEventListener("wheel",this.nativeWheel)}render(){const{size:s=o.defaultProps.size,fillMode:e=o.defaultProps.fillMode,rounded:i=o.defaultProps.rounded}=this.props;this.props._ref&&(this.props._ref.current=this);const a=y.provideLocalizationService(this),r={...o.defaultProps,...this.props},{name:n,label:u,id:c}=r,p=this.text,E=p===this.props.placeholder?"":p,I=p===this.props.placeholder?p:void 0,S=c||this._inputId,w=!this.validityStyles||this.validity.valid,x=[...v.wrapperClasses];this.props.className&&x.push(this.props.className);const O=d.createElement(l.AsyncFocusBlur,{onFocus:this.elementOnFocus,onBlur:this.elementOnBlur},({onFocus:M,onBlur:V})=>d.createElement("span",{ref:k=>{this._wrapper=k},style:u?void 0:{width:this.props.width},dir:this.props.dir,className:l.classNames("k-dateinput","k-input",{[`k-input-${l.kendoThemeMaps.sizeMap[s]||s}`]:s,[`k-input-${e}`]:e,[`k-rounded-${l.kendoThemeMaps.roundedMap[i]||i}`]:i,"k-invalid":!w,"k-required":this.required,"k-disabled":this.props.disabled},this.props.className),onFocus:M,onBlur:V},d.createElement("input",{role:this.props.ariaRole||"textbox",readOnly:this.props.readonly,tabIndex:this.props.tabIndex,disabled:this.props.disabled,title:this.props.title!==void 0?this.props.title:p,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",className:"k-input-inner",id:S,"aria-label":this.props.ariaLabel,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-haspopup":this.props.ariaHasPopup,"aria-disabled":this.props.disabled,"aria-expanded":this.props.ariaExpanded,"aria-controls":this.props.ariaControls,onWheel:this.wheel,onClick:this.elementClick,onInput:this.elementChange,onPaste:this.handlePaste,onKeyDown:this.elementKeyDown,onChange:l.noop,value:E,placeholder:I,name:n,ref:k=>this._element=k}),this.props.children,this.props.clearButton&&this.props.value&&d.createElement(L,{onClick:this.handleClick,key:"clearbutton"}),this.props.spinners&&d.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:this.spinnersMouseDown},d.createElement(P.Button,{tabIndex:-1,type:"button",rounded:null,className:"k-spinner-increase",icon:"caret-alt-up",svgIcon:F.caretAltUpIcon,"aria-label":a.toLanguageString(h.increaseValue,h.messages[h.increaseValue]),title:a.toLanguageString(h.increaseValue,h.messages[h.increaseValue]),onClick:this.increasePart}),d.createElement(P.Button,{tabIndex:-1,type:"button",rounded:null,className:"k-spinner-decrease",icon:"caret-alt-down",svgIcon:F.caretAltDownIcon,"aria-label":a.toLanguageString(h.decreaseValue,h.messages[h.decreaseValue]),title:a.toLanguageString(h.decreaseValue,h.messages[h.decreaseValue]),onClick:this.decreasePart}))));return u?d.createElement(B.FloatingLabel,{label:u,editorId:S,editorValue:p,editorValid:w,editorDisabled:this.props.disabled,children:O,style:{width:this.props.width}}):O}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.kendoDate&&this.kendoDate.getDateObject()}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:o.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:o.defaultProps.max}get text(){const s={...D.defaultProps,...this.props},{formatPlaceholder:e=o.defaultProps.formatPlaceholder,format:i=o.defaultProps.format,value:a,defaultValue:r}=s;this.kendoDate===null?(this.kendoDate=new q.KendoDate(this.intl.bind(this),e,i),this.kendoDate.setValue(a||r||null)):(this.kendoDate.format=i,this.kendoDate.formatPlaceholder=e),a!==void 0&&this.value!==a&&this.kendoDate.setValue(a);const{text:n,format:u}=this.kendoDate.getTextAndFormat();return this.currentFormat=u,s.placeholder!==null&&s.placeholder!==void 0&&!this.state.focused&&!this.kendoDate.hasValue()?s.placeholder:n}get validity(){const s=v.isInRange(this.value,this.min,this.max)&&A.isInTimeRange(this.value,this.props.minTime,this.props.maxTime),e=this.props.validationMessage!==void 0,i=(!this.required||this.value!==null)&&s,a=this.props.valid!==void 0?this.props.valid:i;return{customError:e,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 element(){return this._element}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}get wrapper(){return this._wrapper}intl(){return y.provideIntlService(this)}get selection(){let s={start:0,end:0};return this.element!==null&&this.element.selectionStart!==void 0&&(s={start:this.element.selectionStart,end:this.element.selectionEnd}),s}setSelection(s){this._lastSelectedSymbol=this.currentFormat[s.start],window.requestAnimationFrame(()=>{const e=l.getActiveElement(document);this.element&&e===this.element&&!this.props.disableSelection&&this.element.setSelectionRange(s.start,s.end)})}triggerChange(s,e){this.valueDuringOnChange=this.value,this.forceUpdate(),this.props.onChange&&!g.isEqual(e,this.value)&&this.props.onChange.call(void 0,{syntheticEvent:s,nativeEvent:s.nativeEvent,value:this.value,target:this}),this.valueDuringOnChange=void 0}selectionBySymbol(s){let e=-1,i=0;for(let a=0;a<this.currentFormat.length;a++)this.currentFormat[a]===s&&(i=a+1,e===-1&&(e=a));return e<0&&(e=0),{start:e,end:i}}selectionByIndex(s){let e={start:s,end:s};for(let i=s,a=s-1;i<this.currentFormat.length||a>=0;i++,a--){if(i<this.currentFormat.length&&this.currentFormat[i]!=="_"){e=this.selectionBySymbol(this.currentFormat[i]);break}if(a>=0&&this.currentFormat[a]!=="_"){e=this.selectionBySymbol(this.currentFormat[a]);break}}return e}switchDateSegment(s){const{start:e,end:i}=this.selection;if(e<i&&this.currentFormat[e]!==this.currentFormat[i-1]){this.setSelection(this.selectionByIndex(s>0?e:i-1));return}const a=this.currentFormat[e];let r=e+s;for(;r>0&&r<this.currentFormat.length&&!(this.currentFormat[r]!==a&&this.currentFormat[r]!=="_");)r+=s;if(this.currentFormat[r]==="_")return;let n=r;for(;n>=0&&n<this.currentFormat.length&&this.currentFormat[n]===this.currentFormat[r];)n+=s;r>n&&(n+1!==e||r+1!==i)?this.setSelection({start:n+1,end:r+1}):r<n&&(r!==e||n!==i)&&this.setSelection({start:r,end:n})}modifyDateSegmentValue(s,e){if(!this.kendoDate)return;const i=this.value,a=this.currentFormat[this.selection.start],r=this.kendoDate.symbolMap(a),n=((this.props.steps||{})[r]||1)*s;this.kendoDate.modifyPart(a,n),this.triggerChange(e,i)}};o.displayName="DateInput",o.propTypes={value:t.instanceOf(Date),format:t.oneOfType([t.string,t.shape({skeleton:t.string,pattern:t.string,date:t.oneOf(["short","medium","long","full"]),time:t.oneOf(["short","medium","long","full"]),datetime:t.oneOf(["short","medium","long","full"]),era:t.oneOf(["narrow","short","long"]),year:t.oneOf(["numeric","2-digit"]),month:t.oneOf(["numeric","2-digit","narrow","short","long"]),day:t.oneOf(["numeric","2-digit"]),weekday:t.oneOf(["narrow","short","long"]),hour:t.oneOf(["numeric","2-digit"]),hour12:t.bool,minute:t.oneOf(["numeric","2-digit"]),second:t.oneOf(["numeric","2-digit"]),timeZoneName:t.oneOf(["short","long"])})]),formatPlaceholder:t.oneOfType([t.oneOf(["wide","narrow","short","formatPattern"]),t.shape({year:t.string,month:t.string,day:t.string,hour:t.string,minute:t.string,second:t.string})]),width:t.oneOfType([t.string,t.number]),tabIndex:t.number,title:t.string,steps:t.shape({year:t.number,month:t.number,day:t.number,hour:t.number,minute:t.number,second:t.number}),min:t.instanceOf(Date),max:t.instanceOf(Date),disabled:t.bool,spinners:t.bool,name:t.string,dir:t.string,label:t.string,id:t.string,ariaLabelledBy:t.string,ariaDescribedBy:t.string,ariaLabel:t.string,ariaRole:t.string,ariaHasPopup:t.oneOfType([t.bool,t.string]),ariaExpanded:t.oneOfType([t.bool]),onChange:t.func,validationMessage:t.string,required:t.bool,validate:t.bool,valid:t.bool,size:t.oneOf([null,"small","medium","large"]),rounded:t.oneOf([null,"small","medium","large","full"]),fillMode:t.oneOf([null,"solid","flat","outline"])},o.defaultProps={format:v.defaultFormat,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:v.defaultFormatPlaceholder,spinners:!1,disabled:!1,max:g.cloneDate(b.MAX_DATE),min:g.cloneDate(b.MIN_DATE),minTime:g.cloneDate(b.MIN_TIME),maxTime:g.cloneDate(b.MAX_TIME),required:!1,validityStyles:!0,validationMessage:R,placeholder:null,ariaHasPopup:"grid"};let m=o;const C=l.createPropsContext(),D=l.withIdHOC(l.withPropsContext(C,m));D.displayName="KendoReactDateInput";y.registerForIntl(m);y.registerForLocalization(m);exports.DateInput=D;exports.DateInputPropsContext=C;exports.DateInputWithoutContext=m;
@@ -6,10 +6,10 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as h from "react";
9
+ import * as l from "react";
10
10
  import e from "prop-types";
11
11
  import { cloneDate as m, isEqual as M } from "@progress/kendo-date-math";
12
- import { Button as k } from "@progress/kendo-react-buttons";
12
+ import { Button as S } from "@progress/kendo-react-buttons";
13
13
  import { caretAltUpIcon as T, caretAltDownIcon as V } from "@progress/kendo-svg-icons";
14
14
  import { provideIntlService as w, provideLocalizationService as B, registerForIntl as _, registerForLocalization as L } from "@progress/kendo-react-intl";
15
15
  import { KendoDate as N } from "./models/kendo-date.mjs";
@@ -20,7 +20,8 @@ import { approximateStringMatching as X, defaultFormat as Y, defaultFormatPlaceh
20
20
  import { MAX_DATE as J, MIN_DATE as Q, MIN_TIME as ee, MAX_TIME as te } from "../utils.mjs";
21
21
  import { increaseValue as f, messages as g, decreaseValue as v } from "../messages/index.mjs";
22
22
  import { isInTimeRange as ie } from "../timepicker/utils.mjs";
23
- const se = "Please enter a valid value!", o = class o extends h.Component {
23
+ import se from "../common/ClearButton.mjs";
24
+ const re = "Please enter a valid value!", o = class o extends l.Component {
24
25
  constructor(i) {
25
26
  super(i), this.kendoDate = null, this.currentFormat = "", this.paste = !1, this._element = null, this._wrapper = null, this._lastSelectedSymbol = "", this.focus = () => {
26
27
  this._element && this._element.focus();
@@ -39,6 +40,8 @@ const se = "Please enter a valid value!", o = class o extends h.Component {
39
40
  this.element && s !== this.element && this.element.focus({ preventScroll: !0 });
40
41
  }, this.handlePaste = () => {
41
42
  this.paste = !0;
43
+ }, this.handleClick = (t) => {
44
+ this.props.onChange && this.props.onChange(t);
42
45
  }, this.elementChange = (t) => {
43
46
  if (!this.element || !this.kendoDate)
44
47
  return;
@@ -53,11 +56,11 @@ const se = "Please enter a valid value!", o = class o extends h.Component {
53
56
  this.currentFormat,
54
57
  this.element.value,
55
58
  this.selection.start
56
- ), l = a.length === 1 && a[0][1] === "_";
57
- if (!l)
59
+ ), h = a.length === 1 && a[0][1] === "_";
60
+ if (!h)
58
61
  for (let d = 0; d < a.length; d++)
59
62
  this.kendoDate.parsePart(a[d][0], a[d][1]);
60
- a.length && a[0][0] !== "_" && this.setSelection(this.selectionBySymbol(a[0][0])), l && this.switchDateSegment(1), this.triggerChange(t, n);
63
+ a.length && a[0][0] !== "_" && this.setSelection(this.selectionBySymbol(a[0][0])), h && this.switchDateSegment(1), this.triggerChange(t, n);
61
64
  }, this.elementClick = (t) => {
62
65
  this.setSelection(this.selectionByIndex(this.selection.start));
63
66
  }, this.nativeWheel = (t) => {
@@ -127,16 +130,15 @@ const se = "Please enter a valid value!", o = class o extends h.Component {
127
130
  rounded: s = o.defaultProps.rounded
128
131
  } = this.props;
129
132
  this.props._ref && (this.props._ref.current = this);
130
- const r = B(this), n = { ...o.defaultProps, ...this.props }, { name: a, label: l, id: d } = n, p = this.text, O = p === this.props.placeholder ? "" : p, E = p === this.props.placeholder ? p : void 0, b = d || this._inputId, D = !this.validityStyles || this.validity.valid;
131
- let x = [...Z];
132
- this.props.className && x.push(this.props.className);
133
- const S = /* @__PURE__ */ h.createElement(q, { onFocus: this.elementOnFocus, onBlur: this.elementOnBlur }, ({ onFocus: C, onBlur: I }) => /* @__PURE__ */ h.createElement(
133
+ const r = B(this), n = { ...o.defaultProps, ...this.props }, { name: a, label: h, id: d } = n, p = this.text, O = p === this.props.placeholder ? "" : p, C = p === this.props.placeholder ? p : void 0, b = d || this._inputId, k = !this.validityStyles || this.validity.valid, E = [...Z];
134
+ this.props.className && E.push(this.props.className);
135
+ const D = /* @__PURE__ */ l.createElement(q, { onFocus: this.elementOnFocus, onBlur: this.elementOnBlur }, ({ onFocus: x, onBlur: I }) => /* @__PURE__ */ l.createElement(
134
136
  "span",
135
137
  {
136
138
  ref: (y) => {
137
139
  this._wrapper = y;
138
140
  },
139
- style: l ? void 0 : { width: this.props.width },
141
+ style: h ? void 0 : { width: this.props.width },
140
142
  dir: this.props.dir,
141
143
  className: z(
142
144
  "k-dateinput",
@@ -145,16 +147,16 @@ const se = "Please enter a valid value!", o = class o extends h.Component {
145
147
  [`k-input-${P.sizeMap[i] || i}`]: i,
146
148
  [`k-input-${t}`]: t,
147
149
  [`k-rounded-${P.roundedMap[s] || s}`]: s,
148
- "k-invalid": !D,
150
+ "k-invalid": !k,
149
151
  "k-required": this.required,
150
152
  "k-disabled": this.props.disabled
151
153
  },
152
154
  this.props.className
153
155
  ),
154
- onFocus: C,
156
+ onFocus: x,
155
157
  onBlur: I
156
158
  },
157
- /* @__PURE__ */ h.createElement(
159
+ /* @__PURE__ */ l.createElement(
158
160
  "input",
159
161
  {
160
162
  role: this.props.ariaRole || "textbox",
@@ -182,14 +184,15 @@ const se = "Please enter a valid value!", o = class o extends h.Component {
182
184
  onKeyDown: this.elementKeyDown,
183
185
  onChange: R,
184
186
  value: O,
185
- placeholder: E,
187
+ placeholder: C,
186
188
  name: a,
187
189
  ref: (y) => this._element = y
188
190
  }
189
191
  ),
190
192
  this.props.children,
191
- this.props.spinners && /* @__PURE__ */ h.createElement("span", { className: "k-input-spinner k-spin-button", onMouseDown: this.spinnersMouseDown }, /* @__PURE__ */ h.createElement(
192
- k,
193
+ this.props.clearButton && this.props.value && /* @__PURE__ */ l.createElement(se, { onClick: this.handleClick, key: "clearbutton" }),
194
+ this.props.spinners && /* @__PURE__ */ l.createElement("span", { className: "k-input-spinner k-spin-button", onMouseDown: this.spinnersMouseDown }, /* @__PURE__ */ l.createElement(
195
+ S,
193
196
  {
194
197
  tabIndex: -1,
195
198
  type: "button",
@@ -201,8 +204,8 @@ const se = "Please enter a valid value!", o = class o extends h.Component {
201
204
  title: r.toLanguageString(f, g[f]),
202
205
  onClick: this.increasePart
203
206
  }
204
- ), /* @__PURE__ */ h.createElement(
205
- k,
207
+ ), /* @__PURE__ */ l.createElement(
208
+ S,
206
209
  {
207
210
  tabIndex: -1,
208
211
  type: "button",
@@ -216,18 +219,18 @@ const se = "Please enter a valid value!", o = class o extends h.Component {
216
219
  }
217
220
  ))
218
221
  ));
219
- return l ? /* @__PURE__ */ h.createElement(
222
+ return h ? /* @__PURE__ */ l.createElement(
220
223
  $,
221
224
  {
222
- label: l,
225
+ label: h,
223
226
  editorId: b,
224
227
  editorValue: p,
225
- editorValid: D,
228
+ editorValid: k,
226
229
  editorDisabled: this.props.disabled,
227
- children: S,
230
+ children: D,
228
231
  style: { width: this.props.width }
229
232
  }
230
- ) : S;
233
+ ) : D;
231
234
  }
232
235
  /* Public Getters */
233
236
  /**
@@ -259,8 +262,8 @@ const se = "Please enter a valid value!", o = class o extends h.Component {
259
262
  defaultValue: n
260
263
  } = i;
261
264
  this.kendoDate === null ? (this.kendoDate = new N(this.intl.bind(this), t, s), this.kendoDate.setValue(r || n || null)) : (this.kendoDate.format = s, this.kendoDate.formatPlaceholder = t), r !== void 0 && this.value !== r && this.kendoDate.setValue(r);
262
- const { text: a, format: l } = this.kendoDate.getTextAndFormat();
263
- return this.currentFormat = l, i.placeholder !== null && i.placeholder !== void 0 && !this.state.focused && !this.kendoDate.hasValue() ? i.placeholder : a;
265
+ const { text: a, format: h } = this.kendoDate.getTextAndFormat();
266
+ return this.currentFormat = h, i.placeholder !== null && i.placeholder !== void 0 && !this.state.focused && !this.kendoDate.hasValue() ? i.placeholder : a;
264
267
  }
265
268
  /**
266
269
  * Represents the validity state into which the DateInput is set.
@@ -486,18 +489,18 @@ o.displayName = "DateInput", o.propTypes = {
486
489
  maxTime: m(te),
487
490
  required: !1,
488
491
  validityStyles: !0,
489
- validationMessage: se,
492
+ validationMessage: re,
490
493
  placeholder: null,
491
494
  // the rest of the properties are undefined by default
492
495
  ariaHasPopup: "grid"
493
496
  };
494
497
  let u = o;
495
- const re = K(), F = U(H(re, u));
498
+ const ae = K(), F = U(H(ae, u));
496
499
  F.displayName = "KendoReactDateInput";
497
500
  _(u);
498
501
  L(u);
499
502
  export {
500
503
  F as DateInput,
501
- re as DateInputPropsContext,
504
+ ae as DateInputPropsContext,
502
505
  u as DateInputWithoutContext
503
506
  };
@@ -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 R=require("react"),t=require("prop-types"),M=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),c=require("@progress/kendo-react-intl"),O=require("@progress/kendo-svg-icons"),k=require("../package-metadata.js"),g=require("../dateinput/DateInput.js"),T=require("../calendar/components/MultiViewCalendar.js"),h=require("../calendar/models/SelectionRange.js"),d=require("../utils.js"),x=require("../common/constants.js"),n=require("../messages/index.js"),P=require("@progress/kendo-react-buttons"),_=require("../common/AdaptiveMode.js"),N=require("@progress/kendo-react-layout");function A(u){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const e in u)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(u,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>u[e]})}}return a.default=u,Object.freeze(a)}const i=A(R),l=class l extends i.Component{constructor(a){super(a),this._element=null,this._calendar=null,this._startDateInput=i.createRef(),this._endDateInput=i.createRef(),this.shouldFocusDateInput=!1,this.shouldFocusCalendar=!1,this.focus=()=>{this.startDateInput&&this.startDateInput.focus()},this.setCalendarRef=e=>{this._calendar=e},this.focusCalendarElement=()=>{this._calendar&&this._calendar.element&&this._calendar.element.focus({preventScroll:!0})},this.calculateValue=(e,s)=>(e.value!==void 0?e.value:s.value)||h.EMPTY_SELECTIONRANGE,this.calculateShow=(e,s)=>e.show!==void 0?e.show:s.show,this.renderCalendar=()=>{const e=this.value||h.EMPTY_SELECTIONRANGE,s={min:this.min,max:this.max,allowReverse:this.props.allowReverse,mode:"range",focusedDate:this.props.focusedDate,disabled:this.props.disabled,className:this.mobileMode?"k-calendar-lg":"",mobileMode:this.mobileMode,...this.props.calendarSettings,value:e,dir:this.props.dir,onChange:this.handleCalendarChange};return this.props.calendar?i.createElement(this.props.calendar,{...s}):i.createElement(T.MultiViewCalendar,{...s,ref:this.setCalendarRef})},this.renderPopup=()=>{const e={popupClass:o.classNames("k-calendar-container","k-daterangepicker-popup"),animate:this._element!==null,anchor:this._element,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...this.props.popupSettings,show:this.show};return this.props.popup?i.createElement(this.props.popup,{...e},this.renderCalendar()):i.createElement(M.Popup,{...e},this.renderCalendar())},this.renderAdaptivePopup=()=>{const{windowWidth:e=0}=this.state,s={expand:this.show,onClose:r=>this.handleCancel(r),adaptiveTitle:this.props.adaptiveTitle,windowWidth:e,footer:{cancelText:this.localizationService.toLanguageString(n.dateRangePickerCancel,n.messages[n.dateRangePickerCancel]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(n.dateRangePickerSet,n.messages[n.dateRangePickerSet]),onApply:this.handleBlur}};return i.createElement(_.AdaptiveMode,{...s},i.createElement(N.ActionSheetContent,{className:"!k-overflow-hidden"},i.createElement("div",{className:"k-scrollable-wrap"},this.renderCalendar())))},this.handleReverseClick=e=>{const s={start:this.value.end,end:this.value.start},r={syntheticEvent:e,nativeEvent:e.nativeEvent};this.handleChange(s,r)},this.handleReverseMouseDown=e=>{e.preventDefault()},this.handleFocus=e=>{clearTimeout(this.nextTickId),this.shouldFocusDateInput||this.mobileMode&&this.setState({currentValue:this.value});const{onFocus:s}=this.props;s&&s.call(void 0,e)},this.handleClick=()=>{this.shouldFocusDateInput||this.setShow(!0)},this.handleBlur=e=>{this.nextTick(()=>{this.setShow(!1)});const{onBlur:s}=this.props;s&&s.call(void 0,e)},this.handleCancel=e=>{this.nextTick(()=>{this.setShow(!1),this.setState({currentValue:h.EMPTY_SELECTIONRANGE})});const{onCancel:s}=this.props;s&&s.call(void 0,e)},this.handleEndChange=e=>{const s={start:this.value.start,end:D.cloneDate(e.value||void 0)};this.handleChange(s,e)},this.handleStartChange=e=>{const s={start:D.cloneDate(e.value||void 0),end:this.value.end};this.handleChange(s,e)},this.extractRangeFromValue=e=>{if(!Array.isArray(e.value)&&!(e.value instanceof Date))return e.value||h.EMPTY_SELECTIONRANGE;const s=Array.isArray(e.value)?e.value[0]:e.value;return{start:this.value.end!==null?s:this.value.start,end:this.value.start!==null?s:this.value.end}},this.handleCalendarChange=e=>{const s=this.extractRangeFromValue(e);this.handleChange(s,e)},this.handleKeyDown=e=>{const{keyCode:s,altKey:r}=e;s===o.Keys.esc?(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):r&&s===o.Keys.down?(e.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0),this.focusCalendarElement()):r&&s===o.Keys.up&&(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1))},this.handleChange=(e,s)=>{this.setState({value:e}),this.valueDuringOnChange=e;const{onChange:r}=this.props;if(r){const m={syntheticEvent:s.syntheticEvent,nativeEvent:s.nativeEvent,value:this.value,show:this.show,target:this};r.call(void 0,m)}this.valueDuringOnChange=void 0},o.validatePackage(k.packageMetadata),this.state={show:this.props.show||this.props.defaultShow||l.defaultProps.defaultShow,value:this.props.value||this.props.defaultValue||l.defaultProps.defaultValue,currentValue:h.EMPTY_SELECTIONRANGE},this.nextTick=this.nextTick.bind(this),this.setShow=this.setShow.bind(this),this.focusCalendarElement=this.focusCalendarElement.bind(this),this.focusDateInputElement=this.focusDateInputElement.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get _startInputId(){return this.props.id+"-start-input-id"}get _endInputId(){return this.props.id+"-end-input-id"}get element(){return this._element}get startDateInput(){return this._startDateInput.current}get endDateInput(){return this._endDateInput.current}get calendar(){return this._calendar}get value(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value)||h.EMPTY_SELECTIONRANGE}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get min(){return this.props.min!==void 0?this.props.min:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get localizationService(){return c.provideLocalizationService(this)}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=x.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}componentDidMount(){var a;this.observerResize=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1}componentWillUnmount(){var a;clearTimeout(this.nextTickId),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.disconnect()}render(){const a=this.value||h.EMPTY_SELECTIONRANGE,e=this.mobileMode&&this.show?this.state.currentValue:a,s=(this.props.startDateInputSettings||{}).id||this._startInputId,r=(this.props.endDateInputSettings||{}).id||this._endInputId,m=o.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),b=this.localizationService.toLanguageString(n.start,n.messages[n.start]),E=this.localizationService.toLanguageString(n.end,n.messages[n.end]),S=this.localizationService.toLanguageString(n.separator,n.messages[n.separator]),f={disableSelection:this.mobileMode&&!0,label:b,format:this.props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.startDateInputSettings,value:e.start,onChange:this.handleStartChange},v={disableSelection:this.mobileMode&&!0,label:E,format:this.props.format,min:this.min,max:this.max,id:this._endInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,...this.props.endDateInputSettings,value:e.end,onChange:this.handleEndChange},C=i.createElement(P.Button,{type:"button",className:"k-select",fillMode:"flat",title:c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":s+" "+r,"aria-label":c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd])},i.createElement(o.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:O.arrowsSwapIcon}));return i.createElement(i.Fragment,null,i.createElement("span",{ref:y=>{this._element=y},className:m,style:this.props.style,id:this.props.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.tabIndex,onFocus:this.handleFocus,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onBlur:this.mobileMode?void 0:this.handleBlur,dir:this.props.dir},this.props.startDateInput?i.createElement(this.props.startDateInput,{...f}):i.createElement(g.DateInput,{...f,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?C:S,this.props.endDateInput?i.createElement(this.props.endDateInput,{...v}):i.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup())}focusDateInputElement(){if(!document||!this.startDateInput||!this.startDateInput.element||!this.endDateInput||!this.endDateInput.element)return;const a=o.getActiveElement(document);(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})}nextTick(a){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>a())}setShow(a){const{onOpen:e,onClose:s}=this.props;this.show!==a&&(this.setState({show:a}),a&&e&&e.call(void 0,{target:this}),!a&&s&&s.call(void 0,{target:this}))}calculateMedia(a){for(let e of a)this.setState({windowWidth:e.target.clientWidth})}};l.displayName="DateRangePicker",l.propTypes={allowReverse:t.bool,calendarSettings:t.any,className:t.string,defaultShow:t.bool,defaultValue:t.shape({start:d.nullable(t.instanceOf(Date).isRequired),end:d.nullable(t.instanceOf(Date).isRequired)}),disabled:t.bool,endDateInputSettings:t.shape(g.DateInputWithoutContext.propTypes),focusedDate:t.instanceOf(Date),format:t.oneOfType([t.string,t.shape({skeleton:t.string,pattern:t.string,date:t.oneOf(["short","medium","long","full"]),time:t.oneOf(["short","medium","long","full"]),datetime:t.oneOf(["short","medium","long","full"]),era:t.oneOf(["narrow","short","long"]),year:t.oneOf(["numeric","2-digit"]),month:t.oneOf(["numeric","2-digit","narrow","short","long"]),day:t.oneOf(["numeric","2-digit"]),weekday:t.oneOf(["narrow","short","long"]),hour:t.oneOf(["numeric","2-digit"]),hour12:t.bool,minute:t.oneOf(["numeric","2-digit"]),second:t.oneOf(["numeric","2-digit"]),timeZoneName:t.oneOf(["short","long"])})]),id:t.string,ariaLabelledBy:t.string,ariaDescribedBy:t.string,max:t.instanceOf(Date),min:t.instanceOf(Date),onBlur:t.func,onChange:t.func,onFocus:t.func,popupSettings:t.any,show:t.bool,startDateInputSettings:t.any,style:t.any,swapButton:t.any,tabIndex:t.number,dir:t.string,value:t.shape({start:d.nullable(t.instanceOf(Date).isRequired),end:d.nullable(t.instanceOf(Date).isRequired)})},l.defaultProps={allowReverse:!1,defaultShow:!1,defaultValue:h.EMPTY_SELECTIONRANGE,disabled:!1,format:"d",max:d.MAX_DATE,min:d.MIN_DATE,swapButton:!1};let p=l;const I=o.createPropsContext(),w=o.withIdHOC(o.withPropsContext(I,p));w.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=w;exports.DateRangePickerPropsContext=I;exports.DateRangePickerWithoutContext=p;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),t=require("prop-types"),M=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),c=require("@progress/kendo-react-intl"),O=require("@progress/kendo-svg-icons"),k=require("../package-metadata.js"),g=require("../dateinput/DateInput.js"),T=require("../calendar/components/MultiViewCalendar.js"),h=require("../calendar/models/SelectionRange.js"),u=require("../utils.js"),x=require("../common/constants.js"),n=require("../messages/index.js"),P=require("@progress/kendo-react-buttons"),_=require("../common/AdaptiveMode.js"),N=require("@progress/kendo-react-layout");function A(d){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>d[e]})}}return a.default=d,Object.freeze(a)}const i=A(R),l=class l extends i.Component{constructor(a){super(a),this._element=null,this._calendar=null,this._startDateInput=i.createRef(),this._endDateInput=i.createRef(),this.shouldFocusDateInput=!1,this.shouldFocusCalendar=!1,this.focus=()=>{this.startDateInput&&this.startDateInput.focus()},this.setCalendarRef=e=>{this._calendar=e},this.focusCalendarElement=()=>{this._calendar&&this._calendar.element&&this._calendar.element.focus({preventScroll:!0})},this.calculateValue=(e,s)=>(e.value!==void 0?e.value:s.value)||h.EMPTY_SELECTIONRANGE,this.calculateShow=(e,s)=>e.show!==void 0?e.show:s.show,this.renderCalendar=()=>{const e=this.value||h.EMPTY_SELECTIONRANGE,s={min:this.min,max:this.max,allowReverse:this.props.allowReverse,mode:"range",focusedDate:this.props.focusedDate,disabled:this.props.disabled,className:this.mobileMode?"k-calendar-lg":"",mobileMode:this.mobileMode,...this.props.calendarSettings,value:e,dir:this.props.dir,onChange:this.handleCalendarChange};return this.props.calendar?i.createElement(this.props.calendar,{...s}):i.createElement(T.MultiViewCalendar,{...s,ref:this.setCalendarRef})},this.renderPopup=()=>{const e={popupClass:o.classNames("k-calendar-container","k-daterangepicker-popup"),animate:this._element!==null,anchor:this._element,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...this.props.popupSettings,show:this.show};return this.props.popup?i.createElement(this.props.popup,{...e},this.renderCalendar()):i.createElement(M.Popup,{...e},this.renderCalendar())},this.renderAdaptivePopup=()=>{const{windowWidth:e=0}=this.state,s={expand:this.show,onClose:r=>this.handleCancel(r),adaptiveTitle:this.props.adaptiveTitle,windowWidth:e,footer:{cancelText:this.localizationService.toLanguageString(n.dateRangePickerCancel,n.messages[n.dateRangePickerCancel]),onCancel:this.handleCancel,applyText:this.localizationService.toLanguageString(n.dateRangePickerSet,n.messages[n.dateRangePickerSet]),onApply:this.handleBlur}};return i.createElement(_.AdaptiveMode,{...s},i.createElement(N.ActionSheetContent,{className:"!k-overflow-hidden"},i.createElement("div",{className:"k-scrollable-wrap"},this.renderCalendar())))},this.handleReverseClick=e=>{const s={start:this.value.end,end:this.value.start},r={syntheticEvent:e,nativeEvent:e.nativeEvent};this.handleChange(s,r)},this.handleReverseMouseDown=e=>{e.preventDefault()},this.handleFocus=e=>{clearTimeout(this.nextTickId),this.shouldFocusDateInput||this.mobileMode&&this.setState({currentValue:this.value});const{onFocus:s}=this.props;s&&s.call(void 0,e)},this.handleClick=()=>{this.shouldFocusDateInput||this.setShow(!0)},this.handleBlur=e=>{this.nextTick(()=>{this.setShow(!1)});const{onBlur:s}=this.props;s&&s.call(void 0,e)},this.handleCancel=e=>{this.nextTick(()=>{this.setShow(!1),this.setState({currentValue:h.EMPTY_SELECTIONRANGE})});const{onCancel:s}=this.props;s&&s.call(void 0,e)},this.handleEndChange=e=>{const s={start:this.value.start,end:D.cloneDate(e.value||void 0)};this.handleChange(s,e)},this.handleStartChange=e=>{const s={start:D.cloneDate(e.value||void 0),end:this.value.end};this.handleChange(s,e)},this.extractRangeFromValue=e=>{if(!Array.isArray(e.value)&&!(e.value instanceof Date))return e.value||h.EMPTY_SELECTIONRANGE;const s=Array.isArray(e.value)?e.value[0]:e.value;return{start:this.value.end!==null?s:this.value.start,end:this.value.start!==null?s:this.value.end}},this.handleCalendarChange=e=>{const s=this.extractRangeFromValue(e);this.handleChange(s,e)},this.handleKeyDown=e=>{const{keyCode:s,altKey:r}=e;s===o.Keys.esc?(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1)):r&&s===o.Keys.down?(e.preventDefault(),this.shouldFocusCalendar=!0,this.setShow(!0),this.focusCalendarElement()):r&&s===o.Keys.up&&(e.preventDefault(),this.shouldFocusDateInput=!0,this.setShow(!1))},this.handleChange=(e,s)=>{this.setState({value:e}),this.valueDuringOnChange=e;const{onChange:r}=this.props;if(r){const m={syntheticEvent:s.syntheticEvent,nativeEvent:s.nativeEvent,value:this.value,show:this.show,target:this};r.call(void 0,m)}this.valueDuringOnChange=void 0},o.validatePackage(k.packageMetadata),this.state={show:this.props.show||this.props.defaultShow||l.defaultProps.defaultShow,value:this.props.value||this.props.defaultValue||l.defaultProps.defaultValue,currentValue:h.EMPTY_SELECTIONRANGE},this.nextTick=this.nextTick.bind(this),this.setShow=this.setShow.bind(this),this.focusCalendarElement=this.focusCalendarElement.bind(this),this.focusDateInputElement=this.focusDateInputElement.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get _startInputId(){return this.props.id+"-start-input-id"}get _endInputId(){return this.props.id+"-end-input-id"}get element(){return this._element}get startDateInput(){return this._startDateInput.current}get endDateInput(){return this._endDateInput.current}get calendar(){return this._calendar}get value(){return(this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value)||h.EMPTY_SELECTIONRANGE}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get min(){return this.props.min!==void 0?this.props.min:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get localizationService(){return c.provideLocalizationService(this)}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=x.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}componentDidMount(){var a;this.observerResize=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this.shouldFocusCalendar&&this.focusCalendarElement(),this.shouldFocusDateInput&&this.focusDateInputElement(),this.shouldFocusCalendar=!1,this.shouldFocusDateInput=!1}componentWillUnmount(){var a;clearTimeout(this.nextTickId),(a=this.document)!=null&&a.body&&this.observerResize&&this.observerResize.disconnect()}render(){const a=this.value||h.EMPTY_SELECTIONRANGE,e=this.mobileMode&&this.show?this.state.currentValue:a,s=(this.props.startDateInputSettings||{}).id||this._startInputId,r=(this.props.endDateInputSettings||{}).id||this._endInputId,m=o.classNames("k-daterangepicker",{"k-disabled":this.props.disabled},this.props.className),b=this.localizationService.toLanguageString(n.start,n.messages[n.start]),E=this.localizationService.toLanguageString(n.end,n.messages[n.end]),S=this.localizationService.toLanguageString(n.separator,n.messages[n.separator]),f={disableSelection:this.mobileMode&&!0,label:b,format:this.props.format,min:this.min,max:this.max,id:this._startInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,clearButton:this.props.clearButton,...this.props.startDateInputSettings,value:e.start,onChange:this.handleStartChange},v={disableSelection:this.mobileMode&&!0,label:E,format:this.props.format,min:this.min,max:this.max,id:this._endInputId,disabled:this.props.disabled,valid:this.props.valid,tabIndex:this.props.tabIndex,ariaExpanded:this.show,clearButton:this.props.clearButton,...this.props.endDateInputSettings,value:e.end,onChange:this.handleEndChange},C=i.createElement(P.Button,{type:"button",className:"k-select",fillMode:"flat",title:c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd]),onMouseDown:this.handleReverseMouseDown,onClick:this.handleReverseClick,"aria-controls":s+" "+r,"aria-label":c.provideLocalizationService(this).toLanguageString(n.swapStartEnd,n.messages[n.swapStartEnd])},i.createElement(o.IconWrap,{style:{transform:"rotate(90deg)"},name:"arrows-swap",icon:O.arrowsSwapIcon}));return i.createElement(i.Fragment,null,i.createElement("span",{ref:y=>{this._element=y},className:m,style:this.props.style,id:this.props.id,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,tabIndex:this.props.tabIndex,onFocus:this.handleFocus,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onBlur:this.mobileMode?void 0:this.handleBlur,dir:this.props.dir},this.props.startDateInput?i.createElement(this.props.startDateInput,{...f}):i.createElement(g.DateInput,{...f,ref:this._startDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),(this.props.allowReverse||this.props.calendarSettings&&this.props.calendarSettings.allowReverse)&&this.props.swapButton?C:S,this.props.endDateInput?i.createElement(this.props.endDateInput,{...v}):i.createElement(g.DateInput,{...v,ref:this._endDateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup())}focusDateInputElement(){if(!document||!this.startDateInput||!this.startDateInput.element||!this.endDateInput||!this.endDateInput.element)return;const a=o.getActiveElement(document);(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})}nextTick(a){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>a())}setShow(a){const{onOpen:e,onClose:s}=this.props;this.show!==a&&(this.setState({show:a}),a&&e&&e.call(void 0,{target:this}),!a&&s&&s.call(void 0,{target:this}))}calculateMedia(a){for(const e of a)this.setState({windowWidth:e.target.clientWidth})}};l.displayName="DateRangePicker",l.propTypes={allowReverse:t.bool,calendarSettings:t.any,className:t.string,defaultShow:t.bool,defaultValue:t.shape({start:u.nullable(t.instanceOf(Date).isRequired),end:u.nullable(t.instanceOf(Date).isRequired)}),disabled:t.bool,endDateInputSettings:t.shape(g.DateInputWithoutContext.propTypes),focusedDate:t.instanceOf(Date),format:t.oneOfType([t.string,t.shape({skeleton:t.string,pattern:t.string,date:t.oneOf(["short","medium","long","full"]),time:t.oneOf(["short","medium","long","full"]),datetime:t.oneOf(["short","medium","long","full"]),era:t.oneOf(["narrow","short","long"]),year:t.oneOf(["numeric","2-digit"]),month:t.oneOf(["numeric","2-digit","narrow","short","long"]),day:t.oneOf(["numeric","2-digit"]),weekday:t.oneOf(["narrow","short","long"]),hour:t.oneOf(["numeric","2-digit"]),hour12:t.bool,minute:t.oneOf(["numeric","2-digit"]),second:t.oneOf(["numeric","2-digit"]),timeZoneName:t.oneOf(["short","long"])})]),id:t.string,ariaLabelledBy:t.string,ariaDescribedBy:t.string,max:t.instanceOf(Date),min:t.instanceOf(Date),onBlur:t.func,onChange:t.func,onFocus:t.func,popupSettings:t.any,show:t.bool,startDateInputSettings:t.any,style:t.any,swapButton:t.any,tabIndex:t.number,dir:t.string,value:t.shape({start:u.nullable(t.instanceOf(Date).isRequired),end:u.nullable(t.instanceOf(Date).isRequired)})},l.defaultProps={allowReverse:!1,defaultShow:!1,defaultValue:h.EMPTY_SELECTIONRANGE,disabled:!1,format:"d",max:u.MAX_DATE,min:u.MIN_DATE,swapButton:!1};let p=l;const I=o.createPropsContext(),w=o.withIdHOC(o.withPropsContext(I,p));w.displayName="KendoReactDateRangePicker";c.registerForLocalization(p);exports.DateRangePicker=w;exports.DateRangePickerPropsContext=I;exports.DateRangePickerWithoutContext=p;
@@ -10,7 +10,7 @@ import * as i from "react";
10
10
  import e from "prop-types";
11
11
  import { Popup as T } from "@progress/kendo-react-popup";
12
12
  import { cloneDate as v } from "@progress/kendo-date-math";
13
- import { classNames as D, Keys as c, validatePackage as _, canUseDOM as I, IconWrap as P, getActiveElement as F, createPropsContext as z, withIdHOC as A, withPropsContext as B } from "@progress/kendo-react-common";
13
+ import { classNames as D, Keys as c, validatePackage as _, canUseDOM as I, IconWrap as P, getActiveElement as B, createPropsContext as F, withIdHOC as z, withPropsContext as A } from "@progress/kendo-react-common";
14
14
  import { provideLocalizationService as m, registerForLocalization as N } from "@progress/kendo-react-intl";
15
15
  import { arrowsSwapIcon as L } from "@progress/kendo-svg-icons";
16
16
  import { packageMetadata as V } from "../package-metadata.mjs";
@@ -259,6 +259,7 @@ const o = class o extends i.Component {
259
259
  valid: this.props.valid,
260
260
  tabIndex: this.props.tabIndex,
261
261
  ariaExpanded: this.show,
262
+ clearButton: this.props.clearButton,
262
263
  ...this.props.startDateInputSettings,
263
264
  value: t.start,
264
265
  onChange: this.handleStartChange
@@ -273,6 +274,7 @@ const o = class o extends i.Component {
273
274
  valid: this.props.valid,
274
275
  tabIndex: this.props.tabIndex,
275
276
  ariaExpanded: this.show,
277
+ clearButton: this.props.clearButton,
276
278
  ...this.props.endDateInputSettings,
277
279
  value: t.end,
278
280
  onChange: this.handleEndChange
@@ -335,7 +337,7 @@ const o = class o extends i.Component {
335
337
  focusDateInputElement() {
336
338
  if (!document || !this.startDateInput || !this.startDateInput.element || !this.endDateInput || !this.endDateInput.element)
337
339
  return;
338
- const a = F(document);
340
+ const a = B(document);
339
341
  (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 });
340
342
  }
341
343
  nextTick(a) {
@@ -350,7 +352,7 @@ const o = class o extends i.Component {
350
352
  }));
351
353
  }
352
354
  calculateMedia(a) {
353
- for (let t of a)
355
+ for (const t of a)
354
356
  this.setState({ windowWidth: t.target.clientWidth });
355
357
  }
356
358
  };
@@ -416,7 +418,7 @@ o.displayName = "DateRangePicker", o.propTypes = {
416
418
  swapButton: !1
417
419
  };
418
420
  let p = o;
419
- const Z = z(), j = A(B(Z, p));
421
+ const Z = F(), j = z(A(Z, p));
420
422
  j.displayName = "KendoReactDateRangePicker";
421
423
  N(p);
422
424
  export {