@progress/kendo-react-dateinputs 8.3.0-develop.8 → 8.3.0

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.
@@ -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 O=require("react"),r=require("prop-types"),v=require("@progress/kendo-date-math"),T=require("./CalendarNavigationItem.js"),k=require("../../utils.js"),w=require("../../virtualization/Virtualization.js"),h=require("@progress/kendo-react-common");function V(p){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const e in p)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(p,e);Object.defineProperty(a,e,n.get?n:{enumerable:!0,get:()=>p[e]})}}return a.default=p,Object.freeze(a)}const l=V(O),C=30,u=class u extends l.Component{constructor(a){super(a),this.virtualization=null,this.list=null,this.itemHeight=0,this.topOffset=0,this.maxViewHeight=0,this.bottomOffset=0,this.handleVirtualizationMount=t=>{if(this.virtualization=t,this.virtualization&&this.list){this.list.style.transform=`translateY(${this.topOffset}px)`;const i=k.dateInRange(this.props.focusedDate,this.props.min,this.props.max),s=this.props.service.skip(i,this.props.min);this.virtualization.scrollToIndex(s)}},this.buildNavigationItem=t=>{const i=this.props.service.navigationTitle(t),s=this.props.service.isRangeStart(t),o=`kendo-react-calendar-nav-item-${t.getTime()}`,c={text:i,value:t,isRangeStart:s,view:this.props.activeView,onClick:this.handleDateChange};return this.props.navigationItem?l.createElement(this.props.navigationItem,{...c,key:o},i):l.createElement(T.CalendarNavigationItem,{...c,key:o},i)},this.calculateHeights=()=>{const t=this.props.dom.calendarHeight;this.itemHeight=this.props.dom.navigationItemHeight||1,this.maxViewHeight=this.props.dom.monthViewHeight,this.topOffset=(t-this.itemHeight)/2,this.bottomOffset=t-this.itemHeight},this.handleDateChange=(t,i)=>{const{onChange:s}=this.props;if(s&&i){const o={value:v.cloneDate(t),target:this,nativeEvent:i&&i.nativeEvent,syntheticEvent:i};s.call(void 0,o)}},this.handleScrollAction=({scrollAction:t,pageAction:i})=>{const s=i?i.skip:this.state.skip;if(this.state.skip!==s&&this.setState({skip:s}),this.list&&t){const o=`translateY(${t.offset}px)`;this.list.style.transform=o}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate;const e=this.props.service.skip(this.props.focusedDate,this.props.min),n=this.props.service.total(this.props.min,this.props.max);this.state={skip:e-this.getTake(e,n)>0?e:0}}get take(){return this.props.take!==void 0?this.props.take:u.defaultProps.take}componentDidUpdate(a,e){this.indexToScroll!==void 0&&this.virtualization&&this.virtualization.scrollToIndex(this.indexToScroll),this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.indexToScroll=void 0}render(){const{activeView:a,min:e,max:n,service:t,unstyled:i}=this.props;this.calculateHeights();const s=i&&i.uCalendar,o=this.lastView!==a,c=k.dateInRange(this.props.focusedDate,e,n),d=o?t.skip(c,e):this.state.skip,g=t.total(e,n),x=this.getTake(d,g),D=t.addToDate(e,d),b=t.datesList(D,x);(a!==this.lastView||!v.isEqual(c,this.lastFocus))&&(this.indexToScroll=t.skip(c,e));const S=l.createElement(w.Virtualization,{skip:d,take:this.take,total:g,itemHeight:this.itemHeight,topOffset:this.topOffset,bottomOffset:this.bottomOffset,onScroll:this.props.onScroll,maxScrollDifference:this.maxViewHeight,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,tabIndex:this.props.tabIndex,unstyled:i},l.createElement("ul",{ref:m=>{this.list=m},className:h.classNames(h.uCalendar.ul({c:s}))},b.map(m=>this.buildNavigationItem(m))));return l.createElement("div",{className:h.classNames(h.uCalendar.navigation({c:s}))},l.createElement("span",{className:h.classNames(h.uCalendar.navigationHighlight({c:s}))}),this.props.dom.didCalculate?S:null)}getTake(a,e){return Math.min(e-a,this.take)}};u.propTypes={activeView:r.number.isRequired,focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,take:r.number,tabIndex:r.number},u.defaultProps={take:C};let f=u;exports.Navigation=f;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react"),r=require("prop-types"),v=require("@progress/kendo-date-math"),T=require("./CalendarNavigationItem.js"),k=require("../../utils.js"),w=require("../../virtualization/Virtualization.js"),h=require("@progress/kendo-react-common");function V(p){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const e in p)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(p,e);Object.defineProperty(a,e,n.get?n:{enumerable:!0,get:()=>p[e]})}}return a.default=p,Object.freeze(a)}const l=V(O),C=30,d=class d extends l.Component{constructor(a){super(a),this.virtualization=null,this.list=null,this.itemHeight=0,this.topOffset=0,this.maxViewHeight=0,this.bottomOffset=0,this.handleVirtualizationMount=t=>{if(this.virtualization=t,this.virtualization&&this.list){this.list.style.transform=`translateY(${this.topOffset}px)`;const i=k.dateInRange(this.props.focusedDate,this.props.min,this.props.max),s=this.props.service.skip(i,this.props.min);this.virtualization.scrollToIndex(s)}},this.buildNavigationItem=t=>{const i=this.props.service.navigationTitle(t),s=this.props.service.isRangeStart(t),o=`kendo-react-calendar-nav-item-${t.getTime()}`,c={text:i,value:t,isRangeStart:s,view:this.props.activeView,onClick:this.handleDateChange};return this.props.navigationItem?l.createElement(this.props.navigationItem,{...c,key:o},i):l.createElement(T.CalendarNavigationItem,{...c,key:o},i)},this.calculateHeights=()=>{const t=this.props.dom.calendarHeight;this.itemHeight=this.props.dom.navigationItemHeight||1,this.maxViewHeight=this.props.dom.monthViewHeight,this.topOffset=(t-this.itemHeight)/2,this.bottomOffset=t-this.itemHeight},this.handleDateChange=(t,i)=>{const{onChange:s}=this.props;if(s&&i){const o={value:v.cloneDate(t),target:this,nativeEvent:i&&i.nativeEvent,syntheticEvent:i};s.call(void 0,o)}},this.handleScrollAction=({scrollAction:t,pageAction:i})=>{const s=i?i.skip:this.state.skip;if(this.state.skip!==s&&this.setState({skip:s}),this.list&&t){const o=`translateY(${t.offset}px)`;this.list.style.transform=o}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate;const e=this.props.service.skip(this.props.focusedDate,this.props.min),n=this.props.service.total(this.props.min,this.props.max);this.state={skip:e-this.getTake(e,n)>0?e:0}}get take(){return this.props.take!==void 0?this.props.take:d.defaultProps.take}componentDidUpdate(a,e){this.indexToScroll!==void 0&&this.virtualization&&this.virtualization.scrollToIndex(this.indexToScroll),this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.indexToScroll=void 0}render(){const{activeView:a,min:e,max:n,service:t,unstyled:i}=this.props;this.calculateHeights();const s=i&&i.uCalendar,o=this.lastView!==a,c=k.dateInRange(this.props.focusedDate,e,n),m=o?t.skip(c,e):this.state.skip,g=t.total(e,n),x=this.getTake(m,g),D=t.addToDate(e,m),b=t.datesList(D,x);(a!==this.lastView||!v.isEqual(c,this.lastFocus))&&(this.indexToScroll=t.skip(c,e));const S=l.createElement(w.Virtualization,{skip:m,take:this.take,total:g,itemHeight:this.itemHeight,topOffset:this.topOffset,bottomOffset:this.bottomOffset,onScroll:this.props.onScroll,maxScrollDifference:this.maxViewHeight,onScrollAction:this.handleScrollAction,onMount:u=>!this.virtualization&&this.handleVirtualizationMount(u),tabIndex:this.props.tabIndex,unstyled:i},l.createElement("ul",{ref:u=>{this.list=u},className:h.classNames(h.uCalendar.ul({c:s}))},b.map(u=>this.buildNavigationItem(u))));return l.createElement("div",{className:h.classNames(h.uCalendar.navigation({c:s}))},l.createElement("span",{className:h.classNames(h.uCalendar.navigationHighlight({c:s}))}),this.props.dom.didCalculate?S:null)}getTake(a,e){return Math.min(e-a,this.take)}};d.propTypes={activeView:r.number.isRequired,focusedDate:r.instanceOf(Date).isRequired,max:r.instanceOf(Date).isRequired,min:r.instanceOf(Date).isRequired,onChange:r.func,take:r.number,tabIndex:r.number},d.defaultProps={take:C};let f=d;exports.Navigation=f;
@@ -13,7 +13,7 @@ import { CalendarNavigationItem as H } from "./CalendarNavigationItem.mjs";
13
13
  import { dateInRange as v } from "../../utils.mjs";
14
14
  import { Virtualization as S } from "../../virtualization/Virtualization.mjs";
15
15
  import { classNames as d, uCalendar as u } from "@progress/kendo-react-common";
16
- const I = 30, l = class l extends n.Component {
16
+ const I = 30, p = class p extends n.Component {
17
17
  constructor(o) {
18
18
  super(o), this.virtualization = null, this.list = null, this.itemHeight = 0, this.topOffset = 0, this.maxViewHeight = 0, this.bottomOffset = 0, this.handleVirtualizationMount = (t) => {
19
19
  if (this.virtualization = t, this.virtualization && this.list) {
@@ -51,13 +51,13 @@ const I = 30, l = class l extends n.Component {
51
51
  this.list.style.transform = a;
52
52
  }
53
53
  }, this.lastView = this.props.activeView, this.lastFocus = this.props.focusedDate;
54
- const e = this.props.service.skip(this.props.focusedDate, this.props.min), p = this.props.service.total(this.props.min, this.props.max);
54
+ const e = this.props.service.skip(this.props.focusedDate, this.props.min), c = this.props.service.total(this.props.min, this.props.max);
55
55
  this.state = {
56
- skip: e - this.getTake(e, p) > 0 ? e : 0
56
+ skip: e - this.getTake(e, c) > 0 ? e : 0
57
57
  };
58
58
  }
59
59
  get take() {
60
- return this.props.take !== void 0 ? this.props.take : l.defaultProps.take;
60
+ return this.props.take !== void 0 ? this.props.take : p.defaultProps.take;
61
61
  }
62
62
  /**
63
63
  * @hidden
@@ -66,14 +66,14 @@ const I = 30, l = class l extends n.Component {
66
66
  this.indexToScroll !== void 0 && this.virtualization && this.virtualization.scrollToIndex(this.indexToScroll), this.lastView = this.props.activeView, this.lastFocus = this.props.focusedDate, this.indexToScroll = void 0;
67
67
  }
68
68
  render() {
69
- const { activeView: o, min: e, max: p, service: t, unstyled: i } = this.props;
69
+ const { activeView: o, min: e, max: c, service: t, unstyled: i } = this.props;
70
70
  this.calculateHeights();
71
- const s = i && i.uCalendar, a = this.lastView !== o, h = v(this.props.focusedDate, e, p), c = a ? t.skip(h, e) : this.state.skip, f = t.total(e, p), k = this.getTake(c, f), x = t.addToDate(e, c), D = t.datesList(x, k);
71
+ const s = i && i.uCalendar, a = this.lastView !== o, h = v(this.props.focusedDate, e, c), m = a ? t.skip(h, e) : this.state.skip, f = t.total(e, c), k = this.getTake(m, f), x = t.addToDate(e, m), D = t.datesList(x, k);
72
72
  (o !== this.lastView || !V(h, this.lastFocus)) && (this.indexToScroll = t.skip(h, e));
73
73
  const w = /* @__PURE__ */ n.createElement(
74
74
  S,
75
75
  {
76
- skip: c,
76
+ skip: m,
77
77
  take: this.take,
78
78
  total: f,
79
79
  itemHeight: this.itemHeight,
@@ -82,13 +82,13 @@ const I = 30, l = class l extends n.Component {
82
82
  onScroll: this.props.onScroll,
83
83
  maxScrollDifference: this.maxViewHeight,
84
84
  onScrollAction: this.handleScrollAction,
85
- onMount: this.handleVirtualizationMount,
85
+ onMount: (l) => !this.virtualization && this.handleVirtualizationMount(l),
86
86
  tabIndex: this.props.tabIndex,
87
87
  unstyled: i
88
88
  },
89
- /* @__PURE__ */ n.createElement("ul", { ref: (m) => {
90
- this.list = m;
91
- }, className: d(u.ul({ c: s })) }, D.map((m) => this.buildNavigationItem(m)))
89
+ /* @__PURE__ */ n.createElement("ul", { ref: (l) => {
90
+ this.list = l;
91
+ }, className: d(u.ul({ c: s })) }, D.map((l) => this.buildNavigationItem(l)))
92
92
  );
93
93
  return /* @__PURE__ */ n.createElement(
94
94
  "div",
@@ -103,7 +103,7 @@ const I = 30, l = class l extends n.Component {
103
103
  return Math.min(e - o, this.take);
104
104
  }
105
105
  };
106
- l.propTypes = {
106
+ p.propTypes = {
107
107
  activeView: r.number.isRequired,
108
108
  focusedDate: r.instanceOf(Date).isRequired,
109
109
  max: r.instanceOf(Date).isRequired,
@@ -111,10 +111,10 @@ l.propTypes = {
111
111
  onChange: r.func,
112
112
  take: r.number,
113
113
  tabIndex: r.number
114
- }, l.defaultProps = {
114
+ }, p.defaultProps = {
115
115
  take: I
116
116
  };
117
- let g = l;
117
+ let g = p;
118
118
  export {
119
119
  g as Navigation
120
120
  };
@@ -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"),o=require("prop-types"),n=require("@progress/kendo-react-common"),m=require("@progress/kendo-date-math"),D=require("@progress/kendo-react-intl"),N=require("../../virtualization/Virtualization.js"),O=require("./View.js"),q=require("./Header.js"),H=require("../services/WeekNamesService.js"),f=require("../../utils.js"),p=require("../models/CalendarViewEnum.js"),R=require("./TodayCommand.js");function _(d){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(r,e,t.get?t:{enumerable:!0,get:()=>d[e]})}}return r.default=d,Object.freeze(r)}const a=_(T),z=5,u=class u extends a.Component{constructor(r){super(r),this.virtualization=null,this.calendarView=null,this.table=null,this.intl=null,this.bottomOffset=0,this.viewOffset=0,this.viewHeight=0,this._element=null,this.isActive=!1,this.animateToIndex=!0,this.shouldScroll=!1,this.weekService=null,this.focusActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus"),t=this._element.querySelector(".k-state-pending-focus");e&&e[0]&&e[0].classList.remove("k-focus"),t&&t.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus");e&&e.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=e=>{if(this.virtualization=e,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const t=f.dateInRange(this.props.focusedDate,this.props.min,this.props.max),s=this.props.service.skip(t,this.props.min);this.virtualization.scrollToIndex(s)}},this.buildMonthView=(e,t)=>{const{unstyled:s}=this.props,i=s&&s.uCalendar;return a.createElement("table",{key:"calendar-view-list-weekdays",className:n.classNames(n.uCalendar.table({c:i,weekdays:!0})),role:"grid",tabIndex:this.props.tabIndex},a.createElement("colgroup",null,e.map((h,l)=>a.createElement("col",{key:l}))),a.createElement("thead",{className:n.classNames(n.uCalendar.thead({c:i}))},a.createElement("tr",{className:n.classNames(n.uCalendar.tr({c:i}))},t.map((h,l)=>a.createElement("th",{key:l,className:n.classNames(n.uCalendar.th({c:i}))},h)))))},this.buildDates=(e,t)=>{const s=this.props.cellUID,{unstyled:i}=this.props,h=i&&i.uCalendar;return a.createElement("table",{className:n.classNames(n.uCalendar.table({c:h})),ref:l=>this.table=l,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":s+this.props.focusedDate.getTime()},a.createElement("colgroup",null,e.map((l,c)=>a.createElement("col",{key:c}))),t.map(l=>a.createElement(O.View,{ref:c=>{this.calendarView||(this.calendarView=c)},key:l.getTime(),activeView:this.props.activeView,viewDate:l,min:this.props.min,max:this.props.max,cellUID:s,focusedDate:this.props.focusedDate,cell:this.props.cell,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,bus:this.props.bus,service:this.props.service,weekCell:this.props.weekCell,showOtherMonthDays:this.props.showOtherMonthDays,unstyled:i})))},this.calculateHeights=()=>{if(!this.props.dom)return;const e=this.props.activeView===p.CalendarViewEnum.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=e-this.props.dom.viewHeight(this.props.activeView),this.viewOffset=-1*this.props.dom.headerHeight,this.viewHeight=this.props.dom.viewHeight(this.props.activeView)||1},this.getTake=(e,t)=>Math.min(t-e,this.take),this.handleScrollAction=({index:e,scrollAction:t,pageAction:s})=>{const i=s?s.skip:this.state.skip;if((this.state.index!==e||this.state.skip!==i)&&this.setState({index:e,skip:i}),this.table&&t){const h=`translateY(${t.offset}px)`;this.table.style.transform=h}},this.handleTodayClick=e=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,e,!0)},this.handleDateChange=(e,t=!1)=>{const{onChange:s}=this.props;if(s){const i={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:m.cloneDate(e.value),target:this,isTodayClick:t};s.call(void 0,i)}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.state={skip:this.props.service.skip(this.props.focusedDate,this.props.min),index:this.props.service.skip(this.props.focusedDate,this.props.min)}}get element(){return this._element}get weekNames(){return this.intl=D.provideIntlService(this),this.weekService=new H.WeekNamesService(this.intl),this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat)}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===p.CalendarViewEnum.month)}get take(){return this.props.take!==void 0?this.props.take:u.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return f.isInRange(f.getToday(),m.getDate(this.props.min),m.getDate(this.props.max))}componentDidUpdate(r,e){this.shouldScroll=!1,this.indexToScroll!==void 0&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){const{activeView:r,min:e,max:t,service:s,unstyled:i}=this.props,h=i&&i.uCalendar;this.calculateHeights();const l=this.lastView!==r,c=f.dateInRange(this.props.focusedDate,e,t),w=l?s.skip(c,e):this.state.skip,k=s.total(e,t),C=this.getTake(w,k),y=s.addToDate(e,w),x=s.addToDate(e,this.state.index),b=new Array(s.rowLength(this.weekNumber)).fill(""),g=r!==this.lastView;this.animateToIndex=!g,(g||!m.isEqualDate(this.lastFocus,c)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(c,this.props.min)),this.lastFocus=c;const S=n.classNames(n.uCalendar.view({c:h,month:r===p.CalendarViewEnum.month,year:r===p.CalendarViewEnum.year,decade:r===p.CalendarViewEnum.decade,century:r===p.CalendarViewEnum.century})),V=this.buildDates(b,s.datesList(y,C)),E=a.createElement(a.Fragment,null,a.createElement(q.Header,{key:"calendar-view-list-header",currentDate:x,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,header:this.props.header,unstyled:i,commands:a.createElement(R.TodayCommand,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex,unstyled:i})}),this.props.activeView===p.CalendarViewEnum.month&&this.buildMonthView(b,this.weekNames),a.createElement(N.Virtualization,{key:"calendar-view-list-content",skip:w,take:this.take,total:k,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:this.handleVirtualizationMount,children:V,tabIndex:this.props.tabIndex}));return a.createElement("div",{ref:I=>{this._element=I},className:S},this.props.dom.didCalculate?E:null)}};u.propTypes={activeView:o.number.isRequired,bottomOffset:o.number,cellUID:o.string.isRequired,focusedDate:o.instanceOf(Date).isRequired,max:o.instanceOf(Date).isRequired,min:o.instanceOf(Date).isRequired,onChange:o.func,showWeekNumbers:o.bool,smoothScroll:o.bool,take:o.number,value:o.instanceOf(Date),viewHeight:o.number,viewOffset:o.number,weekDaysFormat:o.oneOf(["short","abbreviated","narrow"]),tabIndex:o.number},u.defaultProps={take:z,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0};let v=u;D.registerForIntl(v);exports.ViewList=v;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),o=require("prop-types"),n=require("@progress/kendo-react-common"),m=require("@progress/kendo-date-math"),C=require("@progress/kendo-react-intl"),N=require("../../virtualization/Virtualization.js"),O=require("./View.js"),q=require("./Header.js"),H=require("../services/WeekNamesService.js"),f=require("../../utils.js"),p=require("../models/CalendarViewEnum.js"),R=require("./TodayCommand.js");function z(d){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(r,e,t.get?t:{enumerable:!0,get:()=>d[e]})}}return r.default=d,Object.freeze(r)}const a=z(T),_=5,u=class u extends a.Component{constructor(r){super(r),this.virtualization=null,this.calendarView=null,this.table=null,this.intl=null,this.bottomOffset=0,this.viewOffset=0,this.viewHeight=0,this._element=null,this.isActive=!1,this.animateToIndex=!0,this.shouldScroll=!1,this.weekService=null,this.focusActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus"),t=this._element.querySelector(".k-state-pending-focus");e&&e[0]&&e[0].classList.remove("k-focus"),t&&t.classList.add("k-focus"),this.isActive=!0},this.blurActiveDate=()=>{if(!this._element)return;const e=this._element.querySelector("td.k-focus");e&&e.classList.remove("k-focus"),this.isActive=!1},this.handleVirtualizationMount=e=>{if(this.virtualization=e,this.virtualization&&this.table){this.table.style.transform=`translateY(${this.viewOffset}px)`;const t=f.dateInRange(this.props.focusedDate,this.props.min,this.props.max),s=this.props.service.skip(t,this.props.min);this.virtualization.scrollToIndex(s)}},this.buildMonthView=(e,t)=>{const{unstyled:s}=this.props,i=s&&s.uCalendar;return a.createElement("table",{key:"calendar-view-list-weekdays",className:n.classNames(n.uCalendar.table({c:i,weekdays:!0})),role:"grid",tabIndex:this.props.tabIndex},a.createElement("colgroup",null,e.map((h,l)=>a.createElement("col",{key:l}))),a.createElement("thead",{className:n.classNames(n.uCalendar.thead({c:i}))},a.createElement("tr",{className:n.classNames(n.uCalendar.tr({c:i}))},t.map((h,l)=>a.createElement("th",{key:l,className:n.classNames(n.uCalendar.th({c:i}))},h)))))},this.buildDates=(e,t)=>{const s=this.props.cellUID,{unstyled:i}=this.props,h=i&&i.uCalendar;return a.createElement("table",{className:n.classNames(n.uCalendar.table({c:h})),ref:l=>this.table=l,role:"grid",tabIndex:this.props.tabIndex,"aria-activedescendant":s+this.props.focusedDate.getTime()},a.createElement("colgroup",null,e.map((l,c)=>a.createElement("col",{key:c}))),t.map(l=>a.createElement(O.View,{ref:c=>{this.calendarView||(this.calendarView=c)},key:l.getTime(),activeView:this.props.activeView,viewDate:l,min:this.props.min,max:this.props.max,cellUID:s,focusedDate:this.props.focusedDate,cell:this.props.cell,selectedDate:this.props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,bus:this.props.bus,service:this.props.service,weekCell:this.props.weekCell,showOtherMonthDays:this.props.showOtherMonthDays,unstyled:i})))},this.calculateHeights=()=>{if(!this.props.dom)return;const e=this.props.activeView===p.CalendarViewEnum.month?this.props.dom.scrollableContentHeight:this.props.dom.scrollableYearContentHeight;this.bottomOffset=e-this.props.dom.viewHeight(this.props.activeView),this.viewOffset=-1*this.props.dom.headerHeight,this.viewHeight=this.props.dom.viewHeight(this.props.activeView)||1},this.getTake=(e,t)=>Math.min(t-e,this.take),this.handleScrollAction=({index:e,scrollAction:t,pageAction:s})=>{const i=s?s.skip:this.state.skip;if((this.state.index!==e||this.state.skip!==i)&&this.setState({index:e,skip:i}),this.table&&t){const h=`translateY(${t.offset}px)`;this.table.style.transform=h}},this.handleTodayClick=e=>{this.shouldScroll=!0,this.handleDateChange.call(void 0,e,!0)},this.handleDateChange=(e,t=!1)=>{const{onChange:s}=this.props;if(s){const i={syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,value:m.cloneDate(e.value),target:this,isTodayClick:t};s.call(void 0,i)}},this.lastView=this.props.activeView,this.lastFocus=this.props.focusedDate,this.state={skip:this.props.service.skip(this.props.focusedDate,this.props.min),index:this.props.service.skip(this.props.focusedDate,this.props.min)}}get element(){return this._element}get weekNames(){return this.intl=C.provideIntlService(this),this.weekService=new H.WeekNamesService(this.intl),this.weekService.getWeekNames(this.weekNumber,this.props.weekDaysFormat)}get weekNumber(){return!!(this.props.showWeekNumbers&&this.props.activeView===p.CalendarViewEnum.month)}get take(){return this.props.take!==void 0?this.props.take:u.defaultProps.take}get animate(){return!!(this.props.smoothScroll&&this.animateToIndex)}get todayIsInRange(){return f.isInRange(f.getToday(),m.getDate(this.props.min),m.getDate(this.props.max))}componentDidUpdate(r,e){this.shouldScroll=!1,this.indexToScroll!==void 0&&this.virtualization&&this.virtualization[this.animate?"animateToIndex":"scrollToIndex"](this.indexToScroll),this.isActive&&this.focusActiveDate(),this.lastView=this.props.activeView,this.indexToScroll=void 0}render(){const{activeView:r,min:e,max:t,service:s,unstyled:i}=this.props,h=i&&i.uCalendar;this.calculateHeights();const l=this.lastView!==r,c=f.dateInRange(this.props.focusedDate,e,t),w=l?s.skip(c,e):this.state.skip,b=s.total(e,t),y=this.getTake(w,b),x=s.addToDate(e,w),S=s.addToDate(e,this.state.index),g=new Array(s.rowLength(this.weekNumber)).fill(""),D=r!==this.lastView;this.animateToIndex=!D,(D||!m.isEqualDate(this.lastFocus,c)||this.shouldScroll||!this.props.shouldScroll||this.props.shouldScroll())&&(this.indexToScroll=this.props.service.skip(c,this.props.min)),this.lastFocus=c;const V=n.classNames(n.uCalendar.view({c:h,month:r===p.CalendarViewEnum.month,year:r===p.CalendarViewEnum.year,decade:r===p.CalendarViewEnum.decade,century:r===p.CalendarViewEnum.century})),E=this.buildDates(g,s.datesList(x,y)),I=a.createElement(a.Fragment,null,a.createElement(q.Header,{key:"calendar-view-list-header",currentDate:S,min:this.props.min,max:this.props.max,activeView:this.props.activeView,bus:this.props.bus,service:this.props.service,headerTitle:this.props.headerTitle,header:this.props.header,unstyled:i,commands:a.createElement(R.TodayCommand,{min:this.props.min,max:this.props.max,onClick:this.handleTodayClick,disabled:!this.todayIsInRange,tabIndex:this.props.tabIndex,unstyled:i})}),this.props.activeView===p.CalendarViewEnum.month&&this.buildMonthView(g,this.weekNames),a.createElement(N.Virtualization,{key:"calendar-view-list-content",skip:w,take:this.take,total:b,itemHeight:this.viewHeight,topOffset:this.viewOffset,bottomOffset:this.bottomOffset,scrollOffsetSize:this.viewOffset,maxScrollDifference:this.viewHeight,onScroll:this.props.onScroll,onScrollAction:this.handleScrollAction,onMount:k=>!this.virtualization&&this.handleVirtualizationMount(k),children:E,tabIndex:this.props.tabIndex}));return a.createElement("div",{ref:k=>{this._element=k},className:V},this.props.dom.didCalculate?I:null)}};u.propTypes={activeView:o.number.isRequired,bottomOffset:o.number,cellUID:o.string.isRequired,focusedDate:o.instanceOf(Date).isRequired,max:o.instanceOf(Date).isRequired,min:o.instanceOf(Date).isRequired,onChange:o.func,showWeekNumbers:o.bool,smoothScroll:o.bool,take:o.number,value:o.instanceOf(Date),viewHeight:o.number,viewOffset:o.number,weekDaysFormat:o.oneOf(["short","abbreviated","narrow"]),tabIndex:o.number},u.defaultProps={take:_,showWeekNumbers:!1,weekDaysFormat:"short",smoothScroll:!0};let v=u;C.registerForIntl(v);exports.ViewList=v;
@@ -9,13 +9,13 @@
9
9
  import * as a from "react";
10
10
  import o from "prop-types";
11
11
  import { classNames as p, uCalendar as m } from "@progress/kendo-react-common";
12
- import { cloneDate as T, getDate as b, isEqualDate as E } from "@progress/kendo-date-math";
12
+ import { cloneDate as T, getDate as g, isEqualDate as E } from "@progress/kendo-date-math";
13
13
  import { provideIntlService as N, registerForIntl as O } from "@progress/kendo-react-intl";
14
14
  import { Virtualization as H } from "../../virtualization/Virtualization.mjs";
15
15
  import { View as z } from "./View.mjs";
16
16
  import { Header as A } from "./Header.mjs";
17
17
  import { WeekNamesService as R } from "../services/WeekNamesService.mjs";
18
- import { dateInRange as g, isInRange as _, getToday as q } from "../../utils.mjs";
18
+ import { dateInRange as D, isInRange as _, getToday as q } from "../../utils.mjs";
19
19
  import { CalendarViewEnum as c } from "../models/CalendarViewEnum.mjs";
20
20
  import { TodayCommand as F } from "./TodayCommand.mjs";
21
21
  const M = 5, d = class d extends a.Component {
@@ -33,7 +33,7 @@ const M = 5, d = class d extends a.Component {
33
33
  }, this.handleVirtualizationMount = (e) => {
34
34
  if (this.virtualization = e, this.virtualization && this.table) {
35
35
  this.table.style.transform = `translateY(${this.viewOffset}px)`;
36
- const s = g(this.props.focusedDate, this.props.min, this.props.max), t = this.props.service.skip(s, this.props.min);
36
+ const s = D(this.props.focusedDate, this.props.min, this.props.max), t = this.props.service.skip(s, this.props.min);
37
37
  this.virtualization.scrollToIndex(t);
38
38
  }
39
39
  }, this.buildMonthView = (e, s) => {
@@ -132,7 +132,7 @@ const M = 5, d = class d extends a.Component {
132
132
  return !!(this.props.smoothScroll && this.animateToIndex);
133
133
  }
134
134
  get todayIsInRange() {
135
- return _(q(), b(this.props.min), b(this.props.max));
135
+ return _(q(), g(this.props.min), g(this.props.max));
136
136
  }
137
137
  componentDidUpdate(n, e) {
138
138
  this.shouldScroll = !1, this.indexToScroll !== void 0 && this.virtualization && this.virtualization[this.animate ? "animateToIndex" : "scrollToIndex"](this.indexToScroll), this.isActive && this.focusActiveDate(), this.lastView = this.props.activeView, this.indexToScroll = void 0;
@@ -140,19 +140,21 @@ const M = 5, d = class d extends a.Component {
140
140
  render() {
141
141
  const { activeView: n, min: e, max: s, service: t, unstyled: i } = this.props, l = i && i.uCalendar;
142
142
  this.calculateHeights();
143
- const r = this.lastView !== n, h = g(this.props.focusedDate, e, s), u = r ? t.skip(h, e) : this.state.skip, v = t.total(e, s), D = this.getTake(u, v), x = t.addToDate(e, u), y = t.addToDate(e, this.state.index), w = new Array(t.rowLength(this.weekNumber)).fill(""), k = n !== this.lastView;
144
- this.animateToIndex = !k, (k || !E(this.lastFocus, h) || this.shouldScroll || !this.props.shouldScroll || this.props.shouldScroll()) && (this.indexToScroll = this.props.service.skip(h, this.props.min)), this.lastFocus = h;
145
- const S = p(m.view({
146
- c: l,
147
- month: n === c.month,
148
- year: n === c.year,
149
- decade: n === c.decade,
150
- century: n === c.century
151
- })), C = this.buildDates(w, t.datesList(x, D)), I = /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
143
+ const r = this.lastView !== n, h = D(this.props.focusedDate, e, s), u = r ? t.skip(h, e) : this.state.skip, w = t.total(e, s), x = this.getTake(u, w), y = t.addToDate(e, u), S = t.addToDate(e, this.state.index), k = new Array(t.rowLength(this.weekNumber)).fill(""), b = n !== this.lastView;
144
+ this.animateToIndex = !b, (b || !E(this.lastFocus, h) || this.shouldScroll || !this.props.shouldScroll || this.props.shouldScroll()) && (this.indexToScroll = this.props.service.skip(h, this.props.min)), this.lastFocus = h;
145
+ const C = p(
146
+ m.view({
147
+ c: l,
148
+ month: n === c.month,
149
+ year: n === c.year,
150
+ decade: n === c.decade,
151
+ century: n === c.century
152
+ })
153
+ ), I = this.buildDates(k, t.datesList(y, x)), V = /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
152
154
  A,
153
155
  {
154
156
  key: "calendar-view-list-header",
155
- currentDate: y,
157
+ currentDate: S,
156
158
  min: this.props.min,
157
159
  max: this.props.max,
158
160
  activeView: this.props.activeView,
@@ -173,13 +175,13 @@ const M = 5, d = class d extends a.Component {
173
175
  }
174
176
  )
175
177
  }
176
- ), this.props.activeView === c.month && this.buildMonthView(w, this.weekNames), /* @__PURE__ */ a.createElement(
178
+ ), this.props.activeView === c.month && this.buildMonthView(k, this.weekNames), /* @__PURE__ */ a.createElement(
177
179
  H,
178
180
  {
179
181
  key: "calendar-view-list-content",
180
182
  skip: u,
181
183
  take: this.take,
182
- total: v,
184
+ total: w,
183
185
  itemHeight: this.viewHeight,
184
186
  topOffset: this.viewOffset,
185
187
  bottomOffset: this.bottomOffset,
@@ -187,20 +189,20 @@ const M = 5, d = class d extends a.Component {
187
189
  maxScrollDifference: this.viewHeight,
188
190
  onScroll: this.props.onScroll,
189
191
  onScrollAction: this.handleScrollAction,
190
- onMount: this.handleVirtualizationMount,
191
- children: C,
192
+ onMount: (f) => !this.virtualization && this.handleVirtualizationMount(f),
193
+ children: I,
192
194
  tabIndex: this.props.tabIndex
193
195
  }
194
196
  ));
195
197
  return /* @__PURE__ */ a.createElement(
196
198
  "div",
197
199
  {
198
- ref: (V) => {
199
- this._element = V;
200
+ ref: (f) => {
201
+ this._element = f;
200
202
  },
201
- className: S
203
+ className: C
202
204
  },
203
- this.props.dom.didCalculate ? I : null
205
+ this.props.dom.didCalculate ? V : null
204
206
  );
205
207
  }
206
208
  };
@@ -226,8 +228,8 @@ d.propTypes = {
226
228
  weekDaysFormat: "short",
227
229
  smoothScroll: !0
228
230
  };
229
- let f = d;
230
- O(f);
231
+ let v = d;
232
+ O(v);
231
233
  export {
232
- f as ViewList
234
+ v as ViewList
233
235
  };
@@ -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 _=require("react"),t=require("prop-types"),g=require("@progress/kendo-date-math"),F=require("@progress/kendo-react-buttons"),I=require("@progress/kendo-svg-icons"),v=require("@progress/kendo-react-intl"),N=require("./models/kendo-date.js"),o=require("@progress/kendo-react-common"),A=require("@progress/kendo-react-labels"),L=require("../package-metadata.js"),y=require("./utils.js"),b=require("../utils.js"),h=require("../messages/index.js"),R=require("../timepicker/utils.js"),z=require("../common/ClearButton.js");function j(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 c=j(_),K="Please enter a valid value!",l=class l extends c.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||l.defaultProps.validationMessage)},this.updateOnPaste=e=>{if(!this.element||!this.kendoDate)return;const i=v.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=o.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=y.approximateStringMatching(i,this.currentFormat,this.element.value,this.selection.start),u=n.length===1&&n[0][1]==="_";if(!u)for(let d=0;d<n.length;d++)this.kendoDate.parsePart(n[d][0],n[d][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=>{o.getActiveElement(document)===this.element&&e.preventDefault()},this.wheel=e=>{o.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})},o.validatePackage(L.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=l.defaultProps.size,fillMode:e=l.defaultProps.fillMode,rounded:i=l.defaultProps.rounded,autoFocus:a=l.defaultProps.autoFocus,unstyled:r}=this.props,n=r&&r.uDateInput;this.props._ref&&(this.props._ref.current=this);const u=v.provideLocalizationService(this),d={...l.defaultProps,...this.props},{name:E,label:D,id:x,disabled:V}=d,p=this.text,M=p===this.props.placeholder?"":p,T=p===this.props.placeholder?p:void 0,w=x||this._inputId,O=!this.validityStyles||this.validity.valid,P=c.createElement(o.AsyncFocusBlur,{onFocus:this.elementOnFocus,onBlur:this.elementOnBlur},({onFocus:q,onBlur:B})=>c.createElement("span",{ref:S=>{this._wrapper=S},style:D?void 0:{width:this.props.width},dir:this.props.dir,className:o.classNames(o.uDateInput.wrapper({c:n,size:s,fillMode:e,rounded:i,disabled:V,required:this.required,invalid:!O}),this.props.className),onFocus:q,onBlur:B},c.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",autoFocus:a,className:o.classNames(o.uDateInput.input({c:n})),id:w,"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:o.noop,value:M,placeholder:T,name:E,ref:S=>this._element=S}),this.props.children,this.props.clearButton&&this.props.value&&c.createElement(z,{onClick:this.handleClick,key:"clearbutton"}),this.props.spinners&&c.createElement("span",{className:o.classNames(o.uDateInput.inputSpinner({c:n})),onMouseDown:this.spinnersMouseDown},c.createElement(F.Button,{tabIndex:-1,type:"button",rounded:null,className:o.classNames(o.uDateInput.spinnerIncrease({c:n})),icon:"caret-alt-up",svgIcon:I.caretAltUpIcon,"aria-label":u.toLanguageString(h.increaseValue,h.messages[h.increaseValue]),title:u.toLanguageString(h.increaseValue,h.messages[h.increaseValue]),onClick:this.increasePart}),c.createElement(F.Button,{tabIndex:-1,type:"button",rounded:null,className:o.classNames(o.uDateInput.spinnerDecrease({c:n})),icon:"caret-alt-down",svgIcon:I.caretAltDownIcon,"aria-label":u.toLanguageString(h.decreaseValue,h.messages[h.decreaseValue]),title:u.toLanguageString(h.decreaseValue,h.messages[h.decreaseValue]),onClick:this.decreasePart}))));return D?c.createElement(A.FloatingLabel,{label:D,editorId:w,editorValue:p,editorValid:O,editorDisabled:this.props.disabled,children:P,style:{width:this.props.width}}):P}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:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get text(){const s={...k.defaultProps,...this.props},{formatPlaceholder:e=l.defaultProps.formatPlaceholder,format:i=l.defaultProps.format,value:a,defaultValue:r}=s;this.kendoDate===null?(this.kendoDate=new N.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=y.isInRange(this.value,this.min,this.max)&&R.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:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:l.defaultProps.required}get wrapper(){return this._wrapper}intl(){return v.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=o.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)}};l.displayName="DateInput",l.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"]),autoFocus:t.bool},l.defaultProps={format:y.defaultFormat,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:y.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:K,placeholder:null,ariaHasPopup:"grid",autoFocus:!1};let m=l;const C=o.createPropsContext(),k=o.withIdHOC(o.withPropsContext(C,o.withUnstyledHOC(m)));k.displayName="KendoReactDateInput";v.registerForIntl(m);v.registerForLocalization(m);exports.DateInput=k;exports.DateInputPropsContext=C;exports.DateInputWithoutContext=m;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),t=require("prop-types"),g=require("@progress/kendo-date-math"),F=require("@progress/kendo-react-buttons"),I=require("@progress/kendo-svg-icons"),v=require("@progress/kendo-react-intl"),N=require("./models/kendo-date.js"),o=require("@progress/kendo-react-common"),A=require("@progress/kendo-react-labels"),L=require("../package-metadata.js"),y=require("./utils.js"),b=require("../utils.js"),h=require("../messages/index.js"),R=require("../timepicker/utils.js"),z=require("../common/ClearButton.js");function j(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 c=j(_),K="Please enter a valid value!",l=class l extends c.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||l.defaultProps.validationMessage)},this.updateOnPaste=e=>{if(!this.element||!this.kendoDate)return;const i=v.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=o.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=y.approximateStringMatching(i,this.currentFormat,this.element.value,this.selection.start),u=n.length===1&&n[0][1]==="_";if(!u)for(let d=0;d<n.length;d++)this.kendoDate.parsePart(n[d][0],n[d][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=>{o.getActiveElement(document)===this.element&&e.preventDefault()},this.wheel=e=>{o.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})},o.validatePackage(L.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=l.defaultProps.size,fillMode:e=l.defaultProps.fillMode,rounded:i=l.defaultProps.rounded,autoFocus:a=l.defaultProps.autoFocus,unstyled:r}=this.props,n=r&&r.uDateInput;this.props._ref&&(this.props._ref.current=this);const u=v.provideLocalizationService(this),d={...l.defaultProps,...this.props},{name:E,label:D,id:x,disabled:V}=d,p=this.text,M=p===this.props.placeholder?"":p,T=p===this.props.placeholder?p:void 0,O=x||this._inputId,S=!this.validityStyles||this.validity.valid,P=c.createElement(o.AsyncFocusBlur,{onFocus:this.elementOnFocus,onBlur:this.elementOnBlur},({onFocus:q,onBlur:B})=>c.createElement("span",{ref:k=>{this._wrapper=k},style:D?void 0:{width:this.props.width},dir:this.props.dir,className:o.classNames(o.uDateInput.wrapper({c:n,size:s,fillMode:e,rounded:i,disabled:V,required:this.required,invalid:!S}),this.props.className),onFocus:q,onBlur:B},c.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",autoFocus:a,className:o.classNames(o.uDateInput.input({c:n})),id:O,"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,"aria-required":this.props.required,"aria-invalid":!S,onWheel:this.wheel,onClick:this.elementClick,onInput:this.elementChange,onPaste:this.handlePaste,onKeyDown:this.elementKeyDown,onChange:o.noop,value:M,placeholder:T,name:E,ref:k=>this._element=k}),this.props.children,this.props.clearButton&&this.props.value&&c.createElement(z,{onClick:this.handleClick,key:"clearbutton"}),this.props.spinners&&c.createElement("span",{className:o.classNames(o.uDateInput.inputSpinner({c:n})),onMouseDown:this.spinnersMouseDown},c.createElement(F.Button,{tabIndex:-1,type:"button",rounded:null,className:o.classNames(o.uDateInput.spinnerIncrease({c:n})),icon:"caret-alt-up",svgIcon:I.caretAltUpIcon,"aria-label":u.toLanguageString(h.increaseValue,h.messages[h.increaseValue]),title:u.toLanguageString(h.increaseValue,h.messages[h.increaseValue]),onClick:this.increasePart}),c.createElement(F.Button,{tabIndex:-1,type:"button",rounded:null,className:o.classNames(o.uDateInput.spinnerDecrease({c:n})),icon:"caret-alt-down",svgIcon:I.caretAltDownIcon,"aria-label":u.toLanguageString(h.decreaseValue,h.messages[h.decreaseValue]),title:u.toLanguageString(h.decreaseValue,h.messages[h.decreaseValue]),onClick:this.decreasePart}))));return D?c.createElement(A.FloatingLabel,{label:D,editorId:O,editorValue:p,editorValid:S,editorDisabled:this.props.disabled,children:P,style:{width:this.props.width}}):P}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:l.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:l.defaultProps.max}get text(){const s={...w.defaultProps,...this.props},{formatPlaceholder:e=l.defaultProps.formatPlaceholder,format:i=l.defaultProps.format,value:a,defaultValue:r}=s;this.kendoDate===null?(this.kendoDate=new N.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=y.isInRange(this.value,this.min,this.max)&&R.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:l.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get wrapper(){return this._wrapper}intl(){return v.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=o.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)}};l.displayName="DateInput",l.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"]),autoFocus:t.bool},l.defaultProps={format:y.defaultFormat,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:y.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),validityStyles:!0,validationMessage:K,placeholder:null,ariaHasPopup:"grid",autoFocus:!1};let m=l;const C=o.createPropsContext(),w=o.withIdHOC(o.withPropsContext(C,o.withUnstyledHOC(m)));w.displayName="KendoReactDateInput";v.registerForIntl(m);v.registerForLocalization(m);exports.DateInput=w;exports.DateInputPropsContext=C;exports.DateInputWithoutContext=m;
@@ -8,9 +8,9 @@
8
8
  "use client";
9
9
  import * as h from "react";
10
10
  import e from "prop-types";
11
- import { cloneDate as f, isEqual as L } from "@progress/kendo-date-math";
11
+ import { cloneDate as f, isEqual as _ } from "@progress/kendo-date-math";
12
12
  import { Button as P } from "@progress/kendo-react-buttons";
13
- import { caretAltUpIcon as _, caretAltDownIcon as A } from "@progress/kendo-svg-icons";
13
+ import { caretAltUpIcon as L, caretAltDownIcon as A } from "@progress/kendo-svg-icons";
14
14
  import { provideIntlService as O, provideLocalizationService as N, registerForIntl as q, registerForLocalization as R } from "@progress/kendo-react-intl";
15
15
  import { KendoDate as z } from "./models/kendo-date.mjs";
16
16
  import { getActiveElement as g, validatePackage as K, AsyncFocusBlur as U, classNames as p, uDateInput as c, noop as H, createPropsContext as j, withIdHOC as X, withPropsContext as Y, withUnstyledHOC as G } from "@progress/kendo-react-common";
@@ -132,11 +132,11 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
132
132
  unstyled: n
133
133
  } = this.props, a = n && n.uDateInput;
134
134
  this.props._ref && (this.props._ref.current = this);
135
- const l = N(this), d = { ...o.defaultProps, ...this.props }, { name: E, label: D, id: x, disabled: I } = d, u = this.text, T = u === this.props.placeholder ? "" : u, V = u === this.props.placeholder ? u : void 0, w = x || this._inputId, k = !this.validityStyles || this.validity.valid, F = /* @__PURE__ */ h.createElement(U, { onFocus: this.elementOnFocus, onBlur: this.elementOnBlur }, ({ onFocus: M, onBlur: B }) => /* @__PURE__ */ h.createElement(
135
+ const l = N(this), d = { ...o.defaultProps, ...this.props }, { name: E, label: D, id: x, disabled: I } = d, u = this.text, T = u === this.props.placeholder ? "" : u, V = u === this.props.placeholder ? u : void 0, k = x || this._inputId, S = !this.validityStyles || this.validity.valid, F = /* @__PURE__ */ h.createElement(U, { onFocus: this.elementOnFocus, onBlur: this.elementOnBlur }, ({ onFocus: M, onBlur: B }) => /* @__PURE__ */ h.createElement(
136
136
  "span",
137
137
  {
138
- ref: (S) => {
139
- this._wrapper = S;
138
+ ref: (w) => {
139
+ this._wrapper = w;
140
140
  },
141
141
  style: D ? void 0 : { width: this.props.width },
142
142
  dir: this.props.dir,
@@ -148,7 +148,7 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
148
148
  rounded: s,
149
149
  disabled: I,
150
150
  required: this.required,
151
- invalid: !k
151
+ invalid: !S
152
152
  }),
153
153
  this.props.className
154
154
  ),
@@ -169,7 +169,7 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
169
169
  autoCorrect: "off",
170
170
  autoFocus: r,
171
171
  className: p(c.input({ c: a })),
172
- id: w,
172
+ id: k,
173
173
  "aria-label": this.props.ariaLabel,
174
174
  "aria-labelledby": this.props.ariaLabelledBy,
175
175
  "aria-describedby": this.props.ariaDescribedBy,
@@ -177,6 +177,8 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
177
177
  "aria-disabled": this.props.disabled,
178
178
  "aria-expanded": this.props.ariaExpanded,
179
179
  "aria-controls": this.props.ariaControls,
180
+ "aria-required": this.props.required,
181
+ "aria-invalid": !S,
180
182
  onWheel: this.wheel,
181
183
  onClick: this.elementClick,
182
184
  onInput: this.elementChange,
@@ -186,46 +188,60 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
186
188
  value: T,
187
189
  placeholder: V,
188
190
  name: E,
189
- ref: (S) => this._element = S
191
+ ref: (w) => this._element = w
190
192
  }
191
193
  ),
192
194
  this.props.children,
193
195
  this.props.clearButton && this.props.value && /* @__PURE__ */ h.createElement(ne, { onClick: this.handleClick, key: "clearbutton" }),
194
- this.props.spinners && /* @__PURE__ */ h.createElement("span", { className: p(c.inputSpinner({ c: a })), onMouseDown: this.spinnersMouseDown }, /* @__PURE__ */ h.createElement(
195
- P,
196
+ this.props.spinners && /* @__PURE__ */ h.createElement(
197
+ "span",
196
198
  {
197
- tabIndex: -1,
198
- type: "button",
199
- rounded: null,
200
- className: p(c.spinnerIncrease({ c: a })),
201
- icon: "caret-alt-up",
202
- svgIcon: _,
203
- "aria-label": l.toLanguageString(v, y[v]),
204
- title: l.toLanguageString(v, y[v]),
205
- onClick: this.increasePart
206
- }
207
- ), /* @__PURE__ */ h.createElement(
208
- P,
209
- {
210
- tabIndex: -1,
211
- type: "button",
212
- rounded: null,
213
- className: p(c.spinnerDecrease({ c: a })),
214
- icon: "caret-alt-down",
215
- svgIcon: A,
216
- "aria-label": l.toLanguageString(b, y[b]),
217
- title: l.toLanguageString(b, y[b]),
218
- onClick: this.decreasePart
219
- }
220
- ))
199
+ className: p(c.inputSpinner({ c: a })),
200
+ onMouseDown: this.spinnersMouseDown
201
+ },
202
+ /* @__PURE__ */ h.createElement(
203
+ P,
204
+ {
205
+ tabIndex: -1,
206
+ type: "button",
207
+ rounded: null,
208
+ className: p(c.spinnerIncrease({ c: a })),
209
+ icon: "caret-alt-up",
210
+ svgIcon: L,
211
+ "aria-label": l.toLanguageString(
212
+ v,
213
+ y[v]
214
+ ),
215
+ title: l.toLanguageString(v, y[v]),
216
+ onClick: this.increasePart
217
+ }
218
+ ),
219
+ /* @__PURE__ */ h.createElement(
220
+ P,
221
+ {
222
+ tabIndex: -1,
223
+ type: "button",
224
+ rounded: null,
225
+ className: p(c.spinnerDecrease({ c: a })),
226
+ icon: "caret-alt-down",
227
+ svgIcon: A,
228
+ "aria-label": l.toLanguageString(
229
+ b,
230
+ y[b]
231
+ ),
232
+ title: l.toLanguageString(b, y[b]),
233
+ onClick: this.decreasePart
234
+ }
235
+ )
236
+ )
221
237
  ));
222
238
  return D ? /* @__PURE__ */ h.createElement(
223
239
  W,
224
240
  {
225
241
  label: D,
226
- editorId: w,
242
+ editorId: k,
227
243
  editorValue: u,
228
- editorValid: k,
244
+ editorValid: S,
229
245
  editorDisabled: this.props.disabled,
230
246
  children: F,
231
247
  style: { width: this.props.width }
@@ -322,7 +338,7 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
322
338
  * @hidden
323
339
  */
324
340
  get required() {
325
- return this.props.required !== void 0 ? this.props.required : o.defaultProps.required;
341
+ return this.props.required !== void 0 ? this.props.required : !1;
326
342
  }
327
343
  /**
328
344
  * @hidden
@@ -348,7 +364,7 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
348
364
  });
349
365
  }
350
366
  triggerChange(i, t) {
351
- this.valueDuringOnChange = this.value, this.forceUpdate(), this.props.onChange && !L(t, this.value) && this.props.onChange.call(void 0, {
367
+ this.valueDuringOnChange = this.value, this.forceUpdate(), this.props.onChange && !_(t, this.value) && this.props.onChange.call(void 0, {
352
368
  syntheticEvent: i,
353
369
  nativeEvent: i.nativeEvent,
354
370
  value: this.value,
@@ -423,7 +439,12 @@ o.displayName = "DateInput", o.propTypes = {
423
439
  })
424
440
  ]),
425
441
  formatPlaceholder: e.oneOfType([
426
- e.oneOf(["wide", "narrow", "short", "formatPattern"]),
442
+ e.oneOf([
443
+ "wide",
444
+ "narrow",
445
+ "short",
446
+ "formatPattern"
447
+ ]),
427
448
  e.shape({
428
449
  year: e.string,
429
450
  month: e.string,
@@ -433,10 +454,7 @@ o.displayName = "DateInput", o.propTypes = {
433
454
  second: e.string
434
455
  })
435
456
  ]),
436
- width: e.oneOfType([
437
- e.string,
438
- e.number
439
- ]),
457
+ width: e.oneOfType([e.string, e.number]),
440
458
  tabIndex: e.number,
441
459
  title: e.string,
442
460
  steps: e.shape({
@@ -459,13 +477,8 @@ o.displayName = "DateInput", o.propTypes = {
459
477
  ariaDescribedBy: e.string,
460
478
  ariaLabel: e.string,
461
479
  ariaRole: e.string,
462
- ariaHasPopup: e.oneOfType([
463
- e.bool,
464
- e.string
465
- ]),
466
- ariaExpanded: e.oneOfType([
467
- e.bool
468
- ]),
480
+ ariaHasPopup: e.oneOfType([e.bool, e.string]),
481
+ ariaExpanded: e.oneOfType([e.bool]),
469
482
  onChange: e.func,
470
483
  validationMessage: e.string,
471
484
  required: e.bool,
@@ -488,7 +501,6 @@ o.displayName = "DateInput", o.propTypes = {
488
501
  min: f(ie),
489
502
  minTime: f(se),
490
503
  maxTime: f(re),
491
- required: !1,
492
504
  validityStyles: !0,
493
505
  validationMessage: oe,
494
506
  placeholder: null,
@@ -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 _=require("react"),e=require("prop-types"),U=require("@progress/kendo-react-popup"),k=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),j=require("@progress/kendo-svg-icons"),$=require("../package-metadata.js"),H=require("../dateinput/DateInput.js"),X=require("../calendar/components/Calendar.js"),m=require("../utils.js"),D=require("../messages/index.js"),q=require("@progress/kendo-react-intl"),Z=require("./ToggleButton.js"),G=require("../common/PickerWrap.js"),J=require("../hooks/usePickerFloatingLabel.js"),Q=require("@progress/kendo-react-layout"),Y=require("../common/AdaptiveMode.js"),ee=require("../common/constants.js");function te(l){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return i.default=l,Object.freeze(i)}const r=te(_),o=class o extends r.Component{constructor(i){super(i),this._element=null,this._dateInput=r.createRef(),this._calendar=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.nextValue=(t,s)=>t.value!==void 0?t.value:s.value,this.nextShow=(t,s)=>t.show!==void 0?t.show:s.show,this.renderPopup=()=>{const{disabled:t,min:s,max:a,weekNumber:g,focusedDate:f,popupSettings:d}=this.props,{popupClass:v,...w}=d,b=this.show,h=this.value,y=h&&k.getDate(h),p=n.classNames(v),C={popupClass:"k-datepicker-popup",show:b,anchor:this._element,className:p,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...w},c={disabled:t,value:y,min:s,max:a,weekNumber:g,focusedDate:f,className:this.mobileMode?"k-calendar-lg":"",navigation:!this.mobileMode,onChange:this.handleCalendarValueChange};return this.mobileMode?r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}):r.createElement(this.popupComp,{...C},r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}))},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t};return r.createElement(Y.AdaptiveMode,{...s},r.createElement(Q.ActionSheetContent,{overflowHidden:!0},this.renderPopup()))},this.handleInputValueChange=t=>{this.handleValueChange(t.value,t)},this.handleCalendarValueChange=t=>{const s=this.mergeTime(t.value);this.handleValueChange(s,t)},this.handleValueChange=(t,s)=>{this.setState({value:k.cloneDate(t||void 0)}),this.valueDuringOnChange=t,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:a}=this.props;a&&a.call(void 0,{syntheticEvent:s.syntheticEvent,nativeEvent:s.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.handleIconClick=()=>{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===n.Keys.esc&&this.show){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===n.Keys.up||a===n.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=a===n.Keys.up,this.setShow(a===n.Keys.down))},n.validatePackage($.packageMetadata),this.state={value:this.props.defaultValue||o.defaultProps.defaultValue,show:this.props.defaultShow||o.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ee.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get dateInput(){return this._dateInput.current}get calendar(){return this._calendar}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?k.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 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 dateInputComp(){return this.props.dateInput||o.defaultProps.dateInput}get toggleButtonComp(){return this.props.toggleButton||o.defaultProps.toggleButton}get calendarComp(){return this.props.calendar||o.defaultProps.calendar}get popupComp(){return this.props.popup||o.defaultProps.popup}get pickerWrapComp(){return this.props.pickerWrap||o.defaultProps.pickerWrap}get validity(){const i=m.isInDateRange(this.value,this.min,this.max),t=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&i,a=this.props.valid!==void 0?this.props.valid:s;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:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}componentDidMount(){var i;this.observerResize=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._calendar&&this._calendar.element&&this.show&&!this.prevShow&&this._calendar.element.focus({preventScroll:!0}),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;clearTimeout(this.nextTickId),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=o.defaultProps.size,rounded:t=o.defaultProps.rounded,fillMode:s=o.defaultProps.fillMode,disabled:a,tabIndex:g,title:f,id:d,format:v,formatPlaceholder:w,min:b,max:h,className:y,width:p,name:C,validationMessage:c,required:E,validityStyles:F,ariaLabelledBy:R,ariaDescribedBy:z,ariaLabel:V,placeholder:N,label:I,popupSettings:ie,defaultValue:se,defaultShow:oe,value:ae,popup:ne,weekNumber:re,dateInput:le,calendar:ue,toggleButton:de,onChange:he,onBlur:pe,onFocus:ce,show:me,onOpen:ge,pickerWrap:fe,adaptive:ve,adaptiveTitle:we,valid:be,autoFocus:A,visited:ye,touched:Ce,modified:Ie,...O}=this.props,L=this.value,S=!this.validityStyles||this.validity.valid,K={disabled:a,format:v,formatPlaceholder:w,id:d,ariaLabelledBy:R,ariaDescribedBy:z,ariaLabel:V,max:h,min:b,name:C,onChange:this.handleInputValueChange,required:E,tabIndex:this.show?-1:g,title:f,valid:this.validity.valid,validationMessage:c,validityStyles:F,value:L,label:void 0,placeholder:this.state.focused?null:N,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},M=q.provideLocalizationService(this).toLanguageString(D.toggleCalendar,D.messages[D.toggleCalendar]),P=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},T=>r.createElement(r.Fragment,null,r.createElement("span",{...I?{}:O,ref:W=>{this._element=W},className:n.classNames("k-input","k-datepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-rounded-${n.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${s}`]:s,"k-invalid":!S,"k-required":this.required,"k-disabled":a},y),onKeyDown:this.handleKeyDown,style:{width:p},onFocus:T.onFocus,onBlur:T.onBlur,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",readonly:this.mobileMode,ariaExpanded:this.show,ariaControls:this._popupId,autoFocus:A,...K}),r.createElement(this.toggleButtonComp,{type:"button",icon:"calendar",svgIcon:j.calendarIcon,title:M,className:"k-input-button",rounded:null,onClick:this.mobileMode?void 0:this.handleIconClick,"aria-label":M,fillMode:s,onMouseDown:this.handleIconMouseDown}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return I?r.createElement(J.PickerFloatingLabel,{dateInput:this._dateInput,label:I,editorId:d,editorValid:S,editorDisabled:a,children:P,style:{width:p},...O}):P}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}))}mergeTime(i){return this.value&&i?m.setTime(i,this.value):i}nextTick(i){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>i())}calculateMedia(i){for(let t of i)this.setState({windowWidth:t.target.clientWidth})}};o.displayName="DatePicker",o.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,ariaLabel:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),adaptive:e.bool,adaptiveTitle:e.string,autoFocus:e.bool},o.defaultProps={defaultShow:!1,defaultValue:null,dateInput:H.DateInput,calendar:X.Calendar,toggleButton:Z.ToggleButton,popup:U.Popup,pickerWrap:G.PickerWrap,disabled:!1,format:"d",max:m.MAX_DATE,min:m.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let u=o;const x=n.createPropsContext(),B=n.withIdHOC(n.withPropsContext(x,u));B.displayName="KendoReactDatePicker";q.registerForLocalization(u);exports.DatePicker=B;exports.DatePickerPropsContext=x;exports.DatePickerWithoutContext=u;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),e=require("prop-types"),U=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),a=require("@progress/kendo-react-common"),j=require("@progress/kendo-svg-icons"),$=require("../package-metadata.js"),H=require("../dateinput/DateInput.js"),X=require("../calendar/components/Calendar.js"),m=require("../utils.js"),k=require("../messages/index.js"),q=require("@progress/kendo-react-intl"),Z=require("./ToggleButton.js"),G=require("../common/PickerWrap.js"),J=require("../hooks/usePickerFloatingLabel.js"),Q=require("@progress/kendo-react-layout"),Y=require("../common/AdaptiveMode.js"),ee=require("../common/constants.js");function te(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(s,t,i.get?i:{enumerable:!0,get:()=>l[t]})}}return s.default=l,Object.freeze(s)}const r=te(W),o=class o extends r.Component{constructor(s){super(s),this._element=null,this._dateInput=r.createRef(),this._calendar=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.setCalendarRef=t=>{this._calendar=t},this.nextValue=(t,i)=>t.value!==void 0?t.value:i.value,this.nextShow=(t,i)=>t.show!==void 0?t.show:i.show,this.renderPopup=()=>{const{disabled:t,min:i,max:n,weekNumber:g,focusedDate:f,popupSettings:d}=this.props,{popupClass:v,...w}=d,b=this.show,h=this.value,y=h&&I.getDate(h),p=a.classNames(v),D={popupClass:"k-datepicker-popup",show:b,anchor:this._element,className:p,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...w,onMouseDownOutside:this.handleMouseDownOutside},c={disabled:t,value:y,min:i,max:n,weekNumber:g,focusedDate:f,className:this.mobileMode?"k-calendar-lg":"",navigation:!this.mobileMode,onChange:this.handleCalendarValueChange};return this.mobileMode?r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}):r.createElement(this.popupComp,{...D},r.createElement(this.calendarComp,{_ref:this.setCalendarRef,...c}))},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,i={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:t};return r.createElement(Y.AdaptiveMode,{...i},r.createElement(Q.ActionSheetContent,{overflowHidden:!0},this.renderPopup()))},this.handleInputValueChange=t=>{this.handleValueChange(t.value,t)},this.handleCalendarValueChange=t=>{const i=this.mergeTime(t.value);this.handleValueChange(i,t)},this.handleValueChange=(t,i)=>{this.setState({value:I.cloneDate(t||void 0)}),this.valueDuringOnChange=t,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:n}=this.props;n&&n.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.togglePopup=()=>{this.setShow(!this.show)},this.handleMouseDownOutside=t=>{var i;(i=this.props.popupSettings)!=null&&i.onMouseDownOutside&&this.props.popupSettings.onMouseDownOutside.call(void 0,t)},this.handleIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:i,keyCode:n}=t;if(n===a.Keys.esc&&this.show){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(n===a.Keys.up||n===a.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=n===a.Keys.up,this.setShow(n===a.Keys.down))},a.validatePackage($.packageMetadata),this.state={value:this.props.defaultValue||o.defaultProps.defaultValue,show:this.props.defaultShow||o.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(a.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=ee.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get dateInput(){return this._dateInput.current}get calendar(){return this._calendar}get value(){const s=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return s!==null?I.cloneDate(s):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 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 dateInputComp(){return this.props.dateInput||o.defaultProps.dateInput}get toggleButtonComp(){return this.props.toggleButton||o.defaultProps.toggleButton}get calendarComp(){return this.props.calendar||o.defaultProps.calendar}get popupComp(){return this.props.popup||o.defaultProps.popup}get pickerWrapComp(){return this.props.pickerWrap||o.defaultProps.pickerWrap}get validity(){const s=m.isInDateRange(this.value,this.min,this.max),t=this.props.validationMessage!==void 0,i=(!this.required||this.value!==null)&&s,n=this.props.valid!==void 0?this.props.valid:i;return{customError:t,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:n,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}componentDidMount(){var s;this.observerResize=a.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){this._calendar&&this._calendar.element&&this.show&&!this.prevShow&&this._calendar.element.focus({preventScroll:!0}),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var s;clearTimeout(this.nextTickId),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:s=o.defaultProps.size,rounded:t=o.defaultProps.rounded,fillMode:i=o.defaultProps.fillMode,disabled:n,tabIndex:g,title:f,id:d,format:v,formatPlaceholder:w,min:b,max:h,className:y,width:p,name:D,validationMessage:c,required:E,validityStyles:F,ariaLabelledBy:R,ariaDescribedBy:z,ariaLabel:V,placeholder:N,label:C,popupSettings:se,defaultValue:ie,defaultShow:oe,value:ne,popup:ae,weekNumber:re,dateInput:le,calendar:ue,toggleButton:de,onChange:he,onBlur:pe,onFocus:ce,show:me,onOpen:ge,pickerWrap:fe,adaptive:ve,adaptiveTitle:we,valid:be,autoFocus:A,visited:ye,touched:De,modified:Ce,...O}=this.props,L=this.value,M=!this.validityStyles||this.validity.valid,_={disabled:n,format:v,formatPlaceholder:w,id:d,ariaLabelledBy:R,ariaDescribedBy:z,ariaLabel:V,max:h,min:b,name:D,onChange:this.handleInputValueChange,required:E,tabIndex:this.show?-1:g,title:f,valid:this.validity.valid,validationMessage:c,validityStyles:F,value:L,label:void 0,placeholder:this.state.focused?null:N,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},S=q.provideLocalizationService(this).toLanguageString(k.toggleCalendar,k.messages[k.toggleCalendar]),P=r.createElement(a.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},T=>r.createElement(r.Fragment,null,r.createElement("span",{...C?{}:O,ref:K=>{this._element=K},className:a.classNames("k-input","k-datepicker",{[`k-input-${a.kendoThemeMaps.sizeMap[s]||s}`]:s,[`k-rounded-${a.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${i}`]:i,"k-invalid":!M,"k-required":this.required,"k-disabled":n},y),onKeyDown:this.handleKeyDown,style:{width:p},onFocus:T.onFocus,onBlur:T.onBlur,onClick:this.mobileMode?this.handleIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",readonly:this.mobileMode,ariaExpanded:this.show,ariaControls:this._popupId,autoFocus:A,..._}),r.createElement(this.toggleButtonComp,{type:"button",icon:"calendar",svgIcon:j.calendarIcon,title:S,className:"k-input-button",rounded:null,onClick:this.mobileMode?void 0:this.handleIconClick,"aria-label":S,fillMode:i,onMouseDown:this.handleIconMouseDown}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup()));return C?r.createElement(J.PickerFloatingLabel,{dateInput:this._dateInput,label:C,editorId:d,editorValid:M,editorDisabled:n,children:P,style:{width:p},...O}):P}setShow(s){const{onOpen:t,onClose:i}=this.props;this.show!==s&&(this.setState({show:s}),s&&t&&t.call(void 0,{target:this}),!s&&i&&i.call(void 0,{target:this}))}mergeTime(s){return this.value&&s?m.setTime(s,this.value):s}nextTick(s){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>s())}calculateMedia(s){for(const t of s)this.setState({windowWidth:t.target.clientWidth})}};o.displayName="DatePicker",o.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,ariaLabel:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),adaptive:e.bool,adaptiveTitle:e.string,autoFocus:e.bool},o.defaultProps={defaultShow:!1,defaultValue:null,dateInput:H.DateInput,calendar:X.Calendar,toggleButton:Z.ToggleButton,popup:U.Popup,pickerWrap:G.PickerWrap,disabled:!1,format:"d",max:m.MAX_DATE,min:m.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};let u=o;const x=a.createPropsContext(),B=a.withIdHOC(a.withPropsContext(x,u));B.displayName="KendoReactDatePicker";q.registerForLocalization(u);exports.DatePicker=B;exports.DatePickerPropsContext=x;exports.DatePickerWithoutContext=u;