@progress/kendo-react-dateinputs 9.1.1-develop.3 → 9.2.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 V=require("react"),e=require("prop-types"),g=require("@progress/kendo-date-math"),P=require("@progress/kendo-react-buttons"),M=require("@progress/kendo-svg-icons"),f=require("@progress/kendo-react-intl"),n=require("@progress/kendo-react-common"),_=require("@progress/kendo-react-labels"),L=require("@progress/kendo-dateinputs-common"),w=require("./utils.js"),N=require("../package-metadata.js"),v=require("../utils.js"),o=require("../messages/index.js"),A=require("../timepicker/utils.js"),F=require("../common/ClearButton.js"),R=require("./dateInputIntl.js");function j(c){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const i in c)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(c,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>c[i]})}}return t.default=c,Object.freeze(t)}const d=j(V),B="Please enter a valid value!",a=class a extends d.Component{constructor(t){super(t),this.kendoDate=null,this.kendoDateObject=null,this.mounted=!1,this._element=null,this._wrapper=null,this._nativeEvent=null,this.focus=()=>{this._element&&this._element.focus()},this.setValidity=()=>{this.element&&this.element.setCustomValidity&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||a.defaultProps.validationMessage)},this.updateOnPaste=i=>{!this.element||!this.kendoDate||this.triggerChange(i)},this.spinnersMouseDown=i=>{i.preventDefault();const s=n.getActiveElement(document);this.element&&s!==this.element&&this.element.focus({preventScroll:!0})},this.handleClick=i=>{this.props.onChange&&this.props.onChange(i)},this.nativeWheel=i=>{n.getActiveElement(document)===this.element&&i.preventDefault()},this.increasePart=i=>{var s;(s=this.kendoDate)==null||s.modifyDateSegmentValue(1),this.onChange(i)},this.decreasePart=i=>{var s;(s=this.kendoDate)==null||s.modifyDateSegmentValue(-1),this.onChange(i)},this.elementOnFocus=i=>{this.wrapper&&this.wrapper.classList.add("k-focus"),this.setState({focused:!0})},this.elementOnBlur=i=>{this.wrapper&&this.wrapper.classList.remove("k-focus"),this.setState({focused:!1})},n.validatePackage(N.packageMetadata),this.state={focused:!1}}get _inputId(){return this.props.id+"-accessibility-id"}isFormatChanged(t,i){return typeof t!=typeof i?!0:typeof t=="string"&&typeof i=="string"?t!==i:typeof t=="object"&&typeof i=="object"?JSON.stringify(t)!==JSON.stringify(i):!1}mapFormatToCommonFormat(t){return typeof t=="string"?t:{inputFormat:t,displayFormat:t}}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.kendoDate&&this.kendoDate.value}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:a.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:a.defaultProps.max}get isInSegmentSelection(){const{year:t,month:i,day:s,hours:l,minutes:u,seconds:r}=this.kendoDateObject;return(!t||!i||!s||!l||!u||!r)&&(t||i||s||l||u||r)}get text(){const{placeholder:t}=this.props,i=this.kendoDate&&this.kendoDate.currentText||"";return t!=null&&!this.state.focused&&!this.value?t:i}get validity(){const t=w.isInRange(this.value,this.min,this.max)&&A.isInTimeRange(this.value,this.props.minTime,this.props.maxTime),i=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&t,l=this.props.valid!==void 0?this.props.valid:s;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:l,valueMissing:this.value===null}}get element(){return this._element}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:a.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get wrapper(){return this._wrapper}get options(){const{format:t,steps:i,placeholder:s,value:l,autoFill:u,enableMouseWheel:r,autoCorrectParts:h,autoSwitchParts:b,autoSwitchKeys:y,twoDigitYearMax:m,allowCaretMode:D,formatPlaceholder:C}=this.props;return{format:t,steps:i,formatPlaceholder:C,placeholder:s,selectPreviousSegmentOnBackspace:!0,value:l||this.value,intlService:this.intlCommon,autoFill:u!==void 0?u:!1,enableMouseWheel:r,autoCorrectParts:h,autoSwitchParts:b,autoSwitchKeys:y||[],twoDigitYearMax:m,allowCaretMode:D}}componentDidMount(){this.setValidity(),this.mounted||(this.wrapper&&this.wrapper.addEventListener("wheel",this.nativeWheel,{passive:!1}),this.kendoDate=this.initKendoDate(),this.kendoDateObject=this.kendoDate.dateObject,this.mounted=!0)}componentDidUpdate(t){this.setValidity(),this.kendoDate&&((this.isFormatChanged(t.format,this.props.format)||t.readonly!==this.props.readonly||t.steps!==this.props.steps||this.intlCommon.locale!==this.kendoDate.options.intlService.locale)&&this.kendoDate.setOptions(this.options,!0),t.value!==this.props.value&&(this.kendoDateObject.getValue()!==null||this.isInSegmentSelection&&this.props.value!==null)&&this.kendoDateObject.setValue(this.props.value),this.props.ariaExpanded!==void 0&&this.props.ariaExpanded&&(this.kendoDate.options.placeholder=null),this.props.ariaExpanded!==void 0&&!this.props.ariaExpanded&&(this.kendoDate.options.placeholder=this.props.placeholder),this.kendoDate.refreshElementValue())}componentWillUnmount(){this.wrapper&&this.wrapper.removeEventListener("wheel",this.nativeWheel)}render(){var x;const{size:t=a.defaultProps.size,fillMode:i=a.defaultProps.fillMode,rounded:s=a.defaultProps.rounded,autoFocus:l=a.defaultProps.autoFocus,unstyled:u}=this.props,r=u&&u.uDateInput;this.props._ref&&(this.props._ref.current=this);const h=f.provideLocalizationService(this),b={...a.defaultProps,...this.props},{name:y,label:m,id:D,disabled:C}=b,I=this.text,E=D||this._inputId,O=!this.validityStyles||this.validity.valid,S=d.createElement("span",{ref:k=>{this._wrapper=k},style:m?void 0:{width:this.props.width},dir:this.props.dir,className:n.classNames(n.uDateInput.wrapper({c:r,size:t,fillMode:i,rounded:s,disabled:C,required:this.required,invalid:!O}),this.props.className)},d.createElement("input",{role:this.props.ariaRole||"textbox",readOnly:this.props.readonly,tabIndex:this.props.tabIndex||0,disabled:this.props.disabled,title:this.props.title!==void 0?this.props.title:I,value:I,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:l,className:n.classNames(n.uDateInput.inputInner({c:r})),id:E,"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":!O,onKeyDown:this.onChange.bind(this),onChange:this.onChange.bind(this),onWheel:this.onChange.bind(this),onInput:this.onChange.bind(this),onClick:this.onChange.bind(this),name:y,ref:k=>this._element=k}),this.props.children,this.props.clearButton&&this.props.value&&d.createElement(F,{onClick:this.handleClick,key:"clearbutton"}),this.props.spinners&&d.createElement("span",{className:n.classNames(n.uDateInput.inputSpinner({c:r})),onMouseDown:this.spinnersMouseDown},d.createElement(P.Button,{tabIndex:-1,type:"button",rounded:null,className:n.classNames(n.uDateInput.spinnerIncrease({c:r})),icon:"caret-alt-up",svgIcon:M.caretAltUpIcon,"aria-label":h.toLanguageString(o.increaseValue,o.messages[o.increaseValue]),title:h.toLanguageString(o.increaseValue,o.messages[o.increaseValue]),onClick:this.increasePart}),d.createElement(P.Button,{tabIndex:-1,type:"button",rounded:null,className:n.classNames(n.uDateInput.spinnerDecrease({c:r})),icon:"caret-alt-down",svgIcon:M.caretAltDownIcon,"aria-label":h.toLanguageString(o.decreaseValue,o.messages[o.decreaseValue]),title:h.toLanguageString(o.decreaseValue,o.messages[o.decreaseValue]),onClick:this.decreasePart})));return m?d.createElement(_.FloatingLabel,{label:m,editorId:E,editorValue:(x=this._element)==null?void 0:x.value,editorValid:O,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}intl(){return f.provideIntlService(this)}get intlCommon(){return new R.DateInputIntl(f.provideIntlService(this))}triggerChange(t){this.valueDuringOnChange=this.value,this.forceUpdate(),this._nativeEvent=t,this.valueDuringOnChange=void 0}onChange(t){this._nativeEvent&&this.props.onChange&&!g.isEqual(this._nativeEvent.oldValue,this.value)&&this.props.onChange.call(void 0,{syntheticEvent:t,nativeEvent:this._nativeEvent.event,value:this._nativeEvent.value,target:this}),this._nativeEvent=null}initKendoDate(){return new L.DateInput(this._element,{...this.options,format:this.mapFormatToCommonFormat(this.options.format),events:{focus:this.elementOnFocus.bind(this),blur:this.elementOnBlur.bind(this),valueChange:this.triggerChange.bind(this),click:this.handleClick.bind(this)}})}};a.displayName="DateInput",a.propTypes={value: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})]),width:e.oneOfType([e.string,e.number]),tabIndex:e.number,title:e.string,steps:e.shape({year:e.number,month:e.number,day:e.number,hour:e.number,minute:e.number,second:e.number}),min:e.instanceOf(Date),max:e.instanceOf(Date),disabled:e.bool,spinners:e.bool,name:e.string,dir:e.string,label:e.string,id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,ariaLabel:e.string,ariaRole:e.string,ariaHasPopup:e.oneOfType([e.bool,e.string]),ariaExpanded:e.oneOfType([e.bool]),onChange:e.func,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"]),autoFocus:e.bool},a.defaultProps={format:w.DEFAULT_FORMAT,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:w.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:g.cloneDate(v.MAX_DATE),min:g.cloneDate(v.MIN_DATE),minTime:g.cloneDate(v.MIN_TIME),maxTime:g.cloneDate(v.MAX_TIME),validityStyles:!0,validationMessage:B,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1};let p=a;const T=n.createPropsContext(),q=n.withIdHOC(n.withPropsContext(T,n.withUnstyledHOC(p)));q.displayName="KendoReactDateInput";f.registerForIntl(p);f.registerForLocalization(p);exports.DateInput=q;exports.DateInputPropsContext=T;exports.DateInputWithoutContext=p;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),e=require("prop-types"),f=require("@progress/kendo-date-math"),P=require("@progress/kendo-react-buttons"),M=require("@progress/kendo-svg-icons"),v=require("@progress/kendo-react-intl"),n=require("@progress/kendo-react-common"),L=require("@progress/kendo-react-labels"),N=require("@progress/kendo-dateinputs-common"),w=require("./utils.js"),A=require("../package-metadata.js"),b=require("../utils.js"),o=require("../messages/index.js"),F=require("../timepicker/utils.js"),R=require("../common/ClearButton.js"),j=require("./dateInputIntl.js");function B(m){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const i in m)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(m,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>m[i]})}}return t.default=m,Object.freeze(t)}const l=B(_),z="Please enter a valid value!",a=class a extends l.Component{constructor(t){super(t),this.kendoDate=null,this.kendoDateObject=null,this.mounted=!1,this._element=null,this._wrapper=null,this._nativeEvent=null,this.focus=()=>{this._element&&this._element.focus()},this.setValidity=()=>{this.element&&this.element.setCustomValidity&&this.element.setCustomValidity(this.validity.valid?"":this.props.validationMessage||a.defaultProps.validationMessage)},this.updateOnPaste=i=>{!this.element||!this.kendoDate||this.triggerChange(i)},this.spinnersMouseDown=i=>{i.preventDefault();const s=n.getActiveElement(document);this.element&&s!==this.element&&this.element.focus({preventScroll:!0})},this.handleClick=i=>{this.props.onChange&&this.props.onChange(i)},this.nativeWheel=i=>{n.getActiveElement(document)===this.element&&i.preventDefault()},this.increasePart=i=>{var s;(s=this.kendoDate)==null||s.modifyDateSegmentValue(1),this.onChange(i)},this.decreasePart=i=>{var s;(s=this.kendoDate)==null||s.modifyDateSegmentValue(-1),this.onChange(i)},this.elementOnFocus=i=>{this.wrapper&&this.wrapper.classList.add("k-focus"),this.setState({focused:!0})},this.elementOnBlur=i=>{this.wrapper&&this.wrapper.classList.remove("k-focus"),this.setState({focused:!1})},n.validatePackage(A.packageMetadata),this.state={focused:!1}}get _inputId(){return this.props.id+"-accessibility-id"}isFormatChanged(t,i){return typeof t!=typeof i?!0:typeof t=="string"&&typeof i=="string"?t!==i:typeof t=="object"&&typeof i=="object"?JSON.stringify(t)!==JSON.stringify(i):!1}mapFormatToCommonFormat(t){return typeof t=="string"?t:{inputFormat:t,displayFormat:t}}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.kendoDate&&this.kendoDate.value}get name(){return this.props.name}get min(){return this.props.min!==void 0?this.props.min:a.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:a.defaultProps.max}get isInSegmentSelection(){const{year:t,month:i,day:s,hours:r,minutes:u,seconds:d}=this.kendoDateObject;return(!t||!i||!s||!r||!u||!d)&&(t||i||s||r||u||d)}get text(){const{placeholder:t}=this.props,i=this.kendoDate&&this.kendoDate.currentText||"";return t!=null&&!this.state.focused&&!this.value?t:i}get validity(){const t=w.isInRange(this.value,this.min,this.max)&&F.isInTimeRange(this.value,this.props.minTime,this.props.maxTime),i=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&t,r=this.props.valid!==void 0?this.props.valid:s;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:r,valueMissing:this.value===null}}get element(){return this._element}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:a.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get wrapper(){return this._wrapper}get options(){const{format:t,steps:i,placeholder:s,value:r,autoFill:u,enableMouseWheel:d,autoCorrectParts:h,autoSwitchParts:p,autoSwitchKeys:y,twoDigitYearMax:D,allowCaretMode:g,formatPlaceholder:C}=this.props;return{format:t,steps:i,formatPlaceholder:C,placeholder:s,selectPreviousSegmentOnBackspace:!0,value:r||this.value,intlService:this.intlCommon,autoFill:u!==void 0?u:!1,enableMouseWheel:d,autoCorrectParts:h,autoSwitchParts:p,autoSwitchKeys:y||[],twoDigitYearMax:D,allowCaretMode:g}}componentDidMount(){this.setValidity(),this.mounted||(this.wrapper&&this.wrapper.addEventListener("wheel",this.nativeWheel,{passive:!1}),this.kendoDate=this.initKendoDate(),this.kendoDateObject=this.kendoDate.dateObject,this.mounted=!0)}componentDidUpdate(t){this.setValidity(),this.kendoDate&&((this.isFormatChanged(t.format,this.props.format)||t.readonly!==this.props.readonly||t.steps!==this.props.steps||this.intlCommon.locale!==this.kendoDate.options.intlService.locale)&&this.kendoDate.setOptions(this.options,!0),t.value!==this.props.value&&(this.kendoDateObject.getValue()!==null||this.isInSegmentSelection&&this.props.value!==null)&&this.kendoDateObject.setValue(this.props.value),this.props.ariaExpanded!==void 0&&this.props.ariaExpanded&&(this.kendoDate.options.placeholder=null),this.props.ariaExpanded!==void 0&&!this.props.ariaExpanded&&(this.kendoDate.options.placeholder=this.props.placeholder),this.kendoDate.refreshElementValue())}componentWillUnmount(){this.wrapper&&this.wrapper.removeEventListener("wheel",this.nativeWheel)}render(){var x;const{size:t=a.defaultProps.size,fillMode:i=a.defaultProps.fillMode,rounded:s=a.defaultProps.rounded,autoFocus:r=a.defaultProps.autoFocus,inputAttributes:u,unstyled:d}=this.props,h=d&&d.uDateInput;this.props._ref&&(this.props._ref.current=this);const p=v.provideLocalizationService(this),y={...a.defaultProps,...this.props},{name:D,label:g,id:C,disabled:V}=y,I=this.text,E=C||this._inputId,O=!this.validityStyles||this.validity.valid,S=l.createElement("span",{ref:k=>{this._wrapper=k},style:g?void 0:{width:this.props.width},dir:this.props.dir,className:n.classNames(n.uDateInput.wrapper({c:h,size:t,fillMode:i,rounded:s,disabled:V,required:this.required,invalid:!O}),this.props.className)},l.createElement("input",{role:this.props.ariaRole||"textbox",readOnly:this.props.readonly,tabIndex:this.props.tabIndex||0,disabled:this.props.disabled,title:this.props.title!==void 0?this.props.title:I,value:I,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:r,className:n.classNames(n.uDateInput.inputInner({c:h})),id:E,"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":!O,onKeyDown:this.onChange.bind(this),onChange:this.onChange.bind(this),onWheel:this.onChange.bind(this),onInput:this.onChange.bind(this),onClick:this.onChange.bind(this),name:D,ref:k=>this._element=k,...u}),this.props.children,this.props.clearButton&&this.props.value&&l.createElement(R,{onClick:this.handleClick,key:"clearbutton"}),this.props.spinners&&l.createElement("span",{className:n.classNames(n.uDateInput.inputSpinner({c:h})),onMouseDown:this.spinnersMouseDown},l.createElement(P.Button,{tabIndex:-1,type:"button",rounded:null,className:n.classNames(n.uDateInput.spinnerIncrease({c:h})),icon:"caret-alt-up",svgIcon:M.caretAltUpIcon,"aria-label":p.toLanguageString(o.increaseValue,o.messages[o.increaseValue]),title:p.toLanguageString(o.increaseValue,o.messages[o.increaseValue]),onClick:this.increasePart}),l.createElement(P.Button,{tabIndex:-1,type:"button",rounded:null,className:n.classNames(n.uDateInput.spinnerDecrease({c:h})),icon:"caret-alt-down",svgIcon:M.caretAltDownIcon,"aria-label":p.toLanguageString(o.decreaseValue,o.messages[o.decreaseValue]),title:p.toLanguageString(o.decreaseValue,o.messages[o.decreaseValue]),onClick:this.decreasePart})));return g?l.createElement(L.FloatingLabel,{label:g,editorId:E,editorValue:(x=this._element)==null?void 0:x.value,editorValid:O,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}intl(){return v.provideIntlService(this)}get intlCommon(){return new j.DateInputIntl(v.provideIntlService(this))}triggerChange(t){this.valueDuringOnChange=this.value,this.forceUpdate(),this._nativeEvent=t,this.valueDuringOnChange=void 0}onChange(t){this._nativeEvent&&this.props.onChange&&!f.isEqual(this._nativeEvent.oldValue,this.value)&&this.props.onChange.call(void 0,{syntheticEvent:t,nativeEvent:this._nativeEvent.event,value:this._nativeEvent.value,target:this}),this._nativeEvent=null}initKendoDate(){return new N.DateInput(this._element,{...this.options,format:this.mapFormatToCommonFormat(this.options.format),events:{focus:this.elementOnFocus.bind(this),blur:this.elementOnBlur.bind(this),valueChange:this.triggerChange.bind(this),click:this.handleClick.bind(this)}})}};a.displayName="DateInput",a.propTypes={value: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})]),width:e.oneOfType([e.string,e.number]),tabIndex:e.number,title:e.string,steps:e.shape({year:e.number,month:e.number,day:e.number,hour:e.number,minute:e.number,second:e.number}),min:e.instanceOf(Date),max:e.instanceOf(Date),disabled:e.bool,spinners:e.bool,name:e.string,dir:e.string,label:e.string,id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,ariaLabel:e.string,ariaRole:e.string,ariaHasPopup:e.oneOfType([e.bool,e.string]),ariaExpanded:e.oneOfType([e.bool]),onChange:e.func,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"]),autoFocus:e.bool,inputAttributes:e.object},a.defaultProps={format:w.DEFAULT_FORMAT,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:w.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:f.cloneDate(b.MAX_DATE),min:f.cloneDate(b.MIN_DATE),minTime:f.cloneDate(b.MIN_TIME),maxTime:f.cloneDate(b.MAX_TIME),validityStyles:!0,validationMessage:z,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1};let c=a;const T=n.createPropsContext(),q=n.withIdHOC(n.withPropsContext(T,n.withUnstyledHOC(c)));q.displayName="KendoReactDateInput";v.registerForIntl(c);v.registerForLocalization(c);exports.DateInput=q;exports.DateInputPropsContext=T;exports.DateInputWithoutContext=c;
@@ -6,23 +6,23 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as l from "react";
9
+ import * as o from "react";
10
10
  import e from "prop-types";
11
- import { cloneDate as c, isEqual as T } from "@progress/kendo-date-math";
11
+ import { cloneDate as f, isEqual as L } from "@progress/kendo-date-math";
12
12
  import { Button as x } from "@progress/kendo-react-buttons";
13
- import { caretAltUpIcon as L, caretAltDownIcon as _ } from "@progress/kendo-svg-icons";
14
- import { provideLocalizationService as V, provideIntlService as P, registerForIntl as A, registerForLocalization as F } from "@progress/kendo-react-intl";
15
- import { getActiveElement as M, validatePackage as N, classNames as d, uDateInput as u, createPropsContext as q, withIdHOC as B, withPropsContext as R, withUnstyledHOC as j } from "@progress/kendo-react-common";
16
- import { FloatingLabel as U } from "@progress/kendo-react-labels";
17
- import { DateInput as z } from "@progress/kendo-dateinputs-common";
18
- import { DEFAULT_FORMAT as H, DEFAULT_FORMAT_PLACEHOLDER as K, isInRange as W } from "./utils.mjs";
19
- import { packageMetadata as J } from "../package-metadata.mjs";
20
- import { MAX_DATE as X, MIN_DATE as Y, MIN_TIME as G, MAX_TIME as Z } from "../utils.mjs";
21
- import { increaseValue as f, messages as g, decreaseValue as v } from "../messages/index.mjs";
22
- import { isInTimeRange as $ } from "../timepicker/utils.mjs";
23
- import Q from "../common/ClearButton.mjs";
24
- import { DateInputIntl as ee } from "./dateInputIntl.mjs";
25
- const te = "Please enter a valid value!", n = class n extends l.Component {
13
+ import { caretAltUpIcon as _, caretAltDownIcon as V } from "@progress/kendo-svg-icons";
14
+ import { provideLocalizationService as A, provideIntlService as P, registerForIntl as F, registerForLocalization as N } from "@progress/kendo-react-intl";
15
+ import { getActiveElement as M, validatePackage as q, classNames as u, uDateInput as m, createPropsContext as B, withIdHOC as R, withPropsContext as j, withUnstyledHOC as U } from "@progress/kendo-react-common";
16
+ import { FloatingLabel as z } from "@progress/kendo-react-labels";
17
+ import { DateInput as H } from "@progress/kendo-dateinputs-common";
18
+ import { DEFAULT_FORMAT as K, DEFAULT_FORMAT_PLACEHOLDER as W, isInRange as J } from "./utils.mjs";
19
+ import { packageMetadata as X } from "../package-metadata.mjs";
20
+ import { MAX_DATE as Y, MIN_DATE as G, MIN_TIME as Z, MAX_TIME as $ } from "../utils.mjs";
21
+ import { increaseValue as g, messages as v, decreaseValue as b } from "../messages/index.mjs";
22
+ import { isInTimeRange as Q } from "../timepicker/utils.mjs";
23
+ import ee from "../common/ClearButton.mjs";
24
+ import { DateInputIntl as te } from "./dateInputIntl.mjs";
25
+ const ie = "Please enter a valid value!", n = class n extends o.Component {
26
26
  constructor(t) {
27
27
  super(t), this.kendoDate = null, this.kendoDateObject = null, this.mounted = !1, this._element = null, this._wrapper = null, this._nativeEvent = null, this.focus = () => {
28
28
  this._element && this._element.focus();
@@ -50,7 +50,7 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
50
50
  this.wrapper && this.wrapper.classList.add("k-focus"), this.setState({ focused: !0 });
51
51
  }, this.elementOnBlur = (i) => {
52
52
  this.wrapper && this.wrapper.classList.remove("k-focus"), this.setState({ focused: !1 });
53
- }, N(J), this.state = {
53
+ }, q(X), this.state = {
54
54
  focused: !1
55
55
  };
56
56
  }
@@ -86,8 +86,8 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
86
86
  return this.props.max !== void 0 ? this.props.max : n.defaultProps.max;
87
87
  }
88
88
  get isInSegmentSelection() {
89
- const { year: t, month: i, day: s, hours: o, minutes: r, seconds: a } = this.kendoDateObject;
90
- return (!t || !i || !s || !o || !r || !a) && (t || i || s || o || r || a);
89
+ const { year: t, month: i, day: s, hours: a, minutes: r, seconds: l } = this.kendoDateObject;
90
+ return (!t || !i || !s || !a || !r || !l) && (t || i || s || a || r || l);
91
91
  }
92
92
  /**
93
93
  * @hidden
@@ -100,12 +100,12 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
100
100
  * Represents the validity state into which the DateInput is set.
101
101
  */
102
102
  get validity() {
103
- const t = W(this.value, this.min, this.max) && $(this.value, this.props.minTime, this.props.maxTime), i = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && t, o = this.props.valid !== void 0 ? this.props.valid : s;
103
+ const t = J(this.value, this.min, this.max) && Q(this.value, this.props.minTime, this.props.maxTime), i = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && t, a = this.props.valid !== void 0 ? this.props.valid : s;
104
104
  return {
105
105
  customError: i,
106
106
  rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
107
107
  rangeUnderflow: this.value && this.value.getTime() < this.min.getTime() || !1,
108
- valid: o,
108
+ valid: a,
109
109
  valueMissing: this.value === null
110
110
  };
111
111
  }
@@ -169,14 +169,14 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
169
169
  format: t,
170
170
  steps: i,
171
171
  placeholder: s,
172
- value: o,
172
+ value: a,
173
173
  autoFill: r,
174
- enableMouseWheel: a,
174
+ enableMouseWheel: l,
175
175
  autoCorrectParts: h,
176
- autoSwitchParts: y,
177
- autoSwitchKeys: b,
178
- twoDigitYearMax: p,
179
- allowCaretMode: D,
176
+ autoSwitchParts: p,
177
+ autoSwitchKeys: y,
178
+ twoDigitYearMax: D,
179
+ allowCaretMode: d,
180
180
  formatPlaceholder: C
181
181
  } = this.props;
182
182
  return {
@@ -185,15 +185,15 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
185
185
  formatPlaceholder: C,
186
186
  placeholder: s,
187
187
  selectPreviousSegmentOnBackspace: !0,
188
- value: o || this.value,
188
+ value: a || this.value,
189
189
  intlService: this.intlCommon,
190
190
  autoFill: r !== void 0 ? r : !1,
191
- enableMouseWheel: a,
191
+ enableMouseWheel: l,
192
192
  autoCorrectParts: h,
193
- autoSwitchParts: y,
194
- autoSwitchKeys: b || [],
195
- twoDigitYearMax: p,
196
- allowCaretMode: D
193
+ autoSwitchParts: p,
194
+ autoSwitchKeys: y || [],
195
+ twoDigitYearMax: D,
196
+ allowCaretMode: d
197
197
  };
198
198
  }
199
199
  /**
@@ -223,32 +223,33 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
223
223
  size: t = n.defaultProps.size,
224
224
  fillMode: i = n.defaultProps.fillMode,
225
225
  rounded: s = n.defaultProps.rounded,
226
- autoFocus: o = n.defaultProps.autoFocus,
227
- unstyled: r
228
- } = this.props, a = r && r.uDateInput;
226
+ autoFocus: a = n.defaultProps.autoFocus,
227
+ inputAttributes: r,
228
+ unstyled: l
229
+ } = this.props, h = l && l.uDateInput;
229
230
  this.props._ref && (this.props._ref.current = this);
230
- const h = V(this), y = { ...n.defaultProps, ...this.props }, { name: b, label: p, id: D, disabled: C } = y, E = this.text, k = D || this._inputId, O = !this.validityStyles || this.validity.valid, I = /* @__PURE__ */ l.createElement(
231
+ const p = A(this), y = { ...n.defaultProps, ...this.props }, { name: D, label: d, id: C, disabled: T } = y, E = this.text, k = C || this._inputId, O = !this.validityStyles || this.validity.valid, I = /* @__PURE__ */ o.createElement(
231
232
  "span",
232
233
  {
233
234
  ref: (w) => {
234
235
  this._wrapper = w;
235
236
  },
236
- style: p ? void 0 : { width: this.props.width },
237
+ style: d ? void 0 : { width: this.props.width },
237
238
  dir: this.props.dir,
238
- className: d(
239
- u.wrapper({
240
- c: a,
239
+ className: u(
240
+ m.wrapper({
241
+ c: h,
241
242
  size: t,
242
243
  fillMode: i,
243
244
  rounded: s,
244
- disabled: C,
245
+ disabled: T,
245
246
  required: this.required,
246
247
  invalid: !O
247
248
  }),
248
249
  this.props.className
249
250
  )
250
251
  },
251
- /* @__PURE__ */ l.createElement(
252
+ /* @__PURE__ */ o.createElement(
252
253
  "input",
253
254
  {
254
255
  role: this.props.ariaRole || "textbox",
@@ -261,8 +262,8 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
261
262
  spellCheck: !1,
262
263
  autoComplete: "off",
263
264
  autoCorrect: "off",
264
- autoFocus: o,
265
- className: d(u.inputInner({ c: a })),
265
+ autoFocus: a,
266
+ className: u(m.inputInner({ c: h })),
266
267
  id: k,
267
268
  "aria-label": this.props.ariaLabel,
268
269
  "aria-labelledby": this.props.ariaLabelledBy,
@@ -278,52 +279,53 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
278
279
  onWheel: this.onChange.bind(this),
279
280
  onInput: this.onChange.bind(this),
280
281
  onClick: this.onChange.bind(this),
281
- name: b,
282
- ref: (w) => this._element = w
282
+ name: D,
283
+ ref: (w) => this._element = w,
284
+ ...r
283
285
  }
284
286
  ),
285
287
  this.props.children,
286
- this.props.clearButton && this.props.value && /* @__PURE__ */ l.createElement(Q, { onClick: this.handleClick, key: "clearbutton" }),
287
- this.props.spinners && /* @__PURE__ */ l.createElement(
288
+ this.props.clearButton && this.props.value && /* @__PURE__ */ o.createElement(ee, { onClick: this.handleClick, key: "clearbutton" }),
289
+ this.props.spinners && /* @__PURE__ */ o.createElement(
288
290
  "span",
289
291
  {
290
- className: d(u.inputSpinner({ c: a })),
292
+ className: u(m.inputSpinner({ c: h })),
291
293
  onMouseDown: this.spinnersMouseDown
292
294
  },
293
- /* @__PURE__ */ l.createElement(
295
+ /* @__PURE__ */ o.createElement(
294
296
  x,
295
297
  {
296
298
  tabIndex: -1,
297
299
  type: "button",
298
300
  rounded: null,
299
- className: d(u.spinnerIncrease({ c: a })),
301
+ className: u(m.spinnerIncrease({ c: h })),
300
302
  icon: "caret-alt-up",
301
- svgIcon: L,
302
- "aria-label": h.toLanguageString(f, g[f]),
303
- title: h.toLanguageString(f, g[f]),
303
+ svgIcon: _,
304
+ "aria-label": p.toLanguageString(g, v[g]),
305
+ title: p.toLanguageString(g, v[g]),
304
306
  onClick: this.increasePart
305
307
  }
306
308
  ),
307
- /* @__PURE__ */ l.createElement(
309
+ /* @__PURE__ */ o.createElement(
308
310
  x,
309
311
  {
310
312
  tabIndex: -1,
311
313
  type: "button",
312
314
  rounded: null,
313
- className: d(u.spinnerDecrease({ c: a })),
315
+ className: u(m.spinnerDecrease({ c: h })),
314
316
  icon: "caret-alt-down",
315
- svgIcon: _,
316
- "aria-label": h.toLanguageString(v, g[v]),
317
- title: h.toLanguageString(v, g[v]),
317
+ svgIcon: V,
318
+ "aria-label": p.toLanguageString(b, v[b]),
319
+ title: p.toLanguageString(b, v[b]),
318
320
  onClick: this.decreasePart
319
321
  }
320
322
  )
321
323
  )
322
324
  );
323
- return p ? /* @__PURE__ */ l.createElement(
324
- U,
325
+ return d ? /* @__PURE__ */ o.createElement(
326
+ z,
325
327
  {
326
- label: p,
328
+ label: d,
327
329
  editorId: k,
328
330
  editorValue: (S = this._element) == null ? void 0 : S.value,
329
331
  editorValid: O,
@@ -343,14 +345,14 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
343
345
  * @hidden
344
346
  */
345
347
  get intlCommon() {
346
- return new ee(P(this));
348
+ return new te(P(this));
347
349
  }
348
350
  /* end handlers */
349
351
  triggerChange(t) {
350
352
  this.valueDuringOnChange = this.value, this.forceUpdate(), this._nativeEvent = t, this.valueDuringOnChange = void 0;
351
353
  }
352
354
  onChange(t) {
353
- this._nativeEvent && this.props.onChange && !T(this._nativeEvent.oldValue, this.value) && this.props.onChange.call(void 0, {
355
+ this._nativeEvent && this.props.onChange && !L(this._nativeEvent.oldValue, this.value) && this.props.onChange.call(void 0, {
354
356
  syntheticEvent: t,
355
357
  nativeEvent: this._nativeEvent.event,
356
358
  value: this._nativeEvent.value,
@@ -358,7 +360,7 @@ const te = "Please enter a valid value!", n = class n extends l.Component {
358
360
  }), this._nativeEvent = null;
359
361
  }
360
362
  initKendoDate() {
361
- return new z(this._element, {
363
+ return new H(this._element, {
362
364
  ...this.options,
363
365
  format: this.mapFormatToCommonFormat(this.options.format),
364
366
  events: {
@@ -441,21 +443,22 @@ n.displayName = "DateInput", n.propTypes = {
441
443
  size: e.oneOf([null, "small", "medium", "large"]),
442
444
  rounded: e.oneOf([null, "small", "medium", "large", "full"]),
443
445
  fillMode: e.oneOf([null, "solid", "flat", "outline"]),
444
- autoFocus: e.bool
446
+ autoFocus: e.bool,
447
+ inputAttributes: e.object
445
448
  }, n.defaultProps = {
446
- format: H,
449
+ format: K,
447
450
  size: "medium",
448
451
  rounded: "medium",
449
452
  fillMode: "solid",
450
- formatPlaceholder: K,
453
+ formatPlaceholder: W,
451
454
  spinners: !1,
452
455
  disabled: !1,
453
- max: c(X),
454
- min: c(Y),
455
- minTime: c(G),
456
- maxTime: c(Z),
456
+ max: f(Y),
457
+ min: f(G),
458
+ minTime: f(Z),
459
+ maxTime: f($),
457
460
  validityStyles: !0,
458
- validationMessage: te,
461
+ validationMessage: ie,
459
462
  placeholder: null,
460
463
  enableMouseWheel: !0,
461
464
  autoCorrectParts: !0,
@@ -466,18 +469,18 @@ n.displayName = "DateInput", n.propTypes = {
466
469
  ariaHasPopup: "grid",
467
470
  autoFocus: !1
468
471
  };
469
- let m = n;
470
- const ie = q(), se = B(
471
- R(
472
- ie,
473
- j(m)
472
+ let c = n;
473
+ const se = B(), ne = R(
474
+ j(
475
+ se,
476
+ U(c)
474
477
  )
475
478
  );
476
- se.displayName = "KendoReactDateInput";
477
- A(m);
478
- F(m);
479
+ ne.displayName = "KendoReactDateInput";
480
+ F(c);
481
+ N(c);
479
482
  export {
480
- se as DateInput,
481
- ie as DateInputPropsContext,
482
- m as DateInputWithoutContext
483
+ ne as DateInput,
484
+ se as DateInputPropsContext,
485
+ c as DateInputWithoutContext
483
486
  };
@@ -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 Z=require("react"),e=require("prop-types"),G=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),J=require("@progress/kendo-svg-icons"),Q=require("../package-metadata.js"),ee=require("../dateinput/DateInput.js"),te=require("../calendar/components/Calendar.js"),m=require("../utils.js"),k=require("../messages/index.js"),q=require("@progress/kendo-react-intl"),se=require("./ToggleButton.js"),ie=require("../common/PickerWrap.js"),oe=require("../hooks/usePickerFloatingLabel.js"),ae=require("@progress/kendo-react-layout"),ne=require("../common/AdaptiveMode.js"),re=require("../common/constants.js");function le(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=le(Z),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:a,weekNumber:g,focusedDate:f,popupSettings:d}=this.props,{popupClass:v,...w}=d,b=this.show,h=this.value,y=h&&I.getDate(h),p=n.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: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,{...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(ne.AdaptiveMode,{...i},r.createElement(ae.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:a}=this.props;a&&a.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:a}=t;if(a===n.Keys.esc&&this.show){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(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(Q.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<=re.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,a=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: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:!1}componentDidMount(){var s;this.observerResize=n.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:a,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:ue,defaultValue:de,defaultShow:he,value:pe,popup:ce,weekNumber:me,dateInput:ge,calendar:fe,toggleButton:ve,onChange:we,onBlur:be,onFocus:ye,show:De,onOpen:Ce,pickerWrap:Ie,adaptive:ke,adaptiveTitle:Oe,valid:Me,autoFocus:A,visited:Se,touched:Pe,modified:Te,autoFill:K,twoDigitYearMax:L,enableMouseWheel:W,autoCorrectParts:_,autoSwitchParts:U,autoSwitchKeys:j,allowCaretMode:$,...O}=this.props,H=this.value,M=!this.validityStyles||this.validity.valid,X={disabled:a,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:H,label:void 0,placeholder:this.state.focused?null:N,ariaExpanded:this.show,size:null,fillMode:null,rounded:null,autoFill:K,twoDigitYearMax:L,enableMouseWheel:W,autoCorrectParts:_,autoSwitchParts:U,autoSwitchKeys:j,allowCaretMode:$},S=q.provideLocalizationService(this).toLanguageString(k.toggleCalendar,k.messages[k.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",{...C?{}:O,ref:Y=>{this._element=Y},className:n.classNames("k-input","k-datepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[s]||s}`]:s,[`k-rounded-${n.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${i}`]:i,"k-invalid":!M,"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",ariaExpanded:this.show,ariaControls:this._popupId,autoFocus:A,...X}),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(oe.PickerFloatingLabel,{dateInput:this._dateInput,label:C,editorId:d,editorValid:M,editorDisabled:a,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:ee.DateInput,calendar:te.Calendar,toggleButton:se.ToggleButton,popup:G.Popup,pickerWrap:ie.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=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 G=require("react"),e=require("prop-types"),J=require("@progress/kendo-react-popup"),I=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),Q=require("@progress/kendo-svg-icons"),ee=require("../package-metadata.js"),te=require("../dateinput/DateInput.js"),se=require("../calendar/components/Calendar.js"),m=require("../utils.js"),k=require("../messages/index.js"),q=require("@progress/kendo-react-intl"),ie=require("./ToggleButton.js"),oe=require("../common/PickerWrap.js"),ae=require("../hooks/usePickerFloatingLabel.js"),ne=require("@progress/kendo-react-layout"),re=require("../common/AdaptiveMode.js"),le=require("../common/constants.js");function ue(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=ue(G),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:a,weekNumber:g,focusedDate:f,popupSettings:d}=this.props,{popupClass:v,...w}=d,b=this.show,h=this.value,y=h&&I.getDate(h),p=n.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: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,{...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(re.AdaptiveMode,{...i},r.createElement(ne.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:a}=this.props;a&&a.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:a}=t;if(a===n.Keys.esc&&this.show){this.shouldFocusDateInput=!0,this.setShow(!1);return}i&&(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(ee.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<=le.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,a=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: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:!1}componentDidMount(){var s;this.observerResize=n.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:a,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:de,defaultValue:he,defaultShow:pe,value:ce,popup:me,weekNumber:ge,dateInput:fe,calendar:ve,toggleButton:we,onChange:be,onBlur:ye,onFocus:De,show:Ce,onOpen:Ie,pickerWrap:ke,adaptive:Oe,adaptiveTitle:Me,valid:Se,autoFocus:A,inputAttributes:K,visited:Pe,touched:Te,modified:qe,autoFill:L,twoDigitYearMax:W,enableMouseWheel:_,autoCorrectParts:U,autoSwitchParts:j,autoSwitchKeys:$,allowCaretMode:H,...O}=this.props,X=this.value,M=!this.validityStyles||this.validity.valid,Y={disabled:a,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:X,label:void 0,placeholder:this.state.focused?null:N,ariaExpanded:this.show,size:null,fillMode:null,rounded:null,autoFill:L,twoDigitYearMax:W,enableMouseWheel:_,autoCorrectParts:U,autoSwitchParts:j,autoSwitchKeys:$,allowCaretMode:H,inputAttributes:K},S=q.provideLocalizationService(this).toLanguageString(k.toggleCalendar,k.messages[k.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",{...C?{}:O,ref:Z=>{this._element=Z},className:n.classNames("k-input","k-datepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[s]||s}`]:s,[`k-rounded-${n.kendoThemeMaps.roundedMap[t]||t}`]:t,[`k-input-${i}`]:i,"k-invalid":!M,"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",ariaExpanded:this.show,ariaControls:this._popupId,autoFocus:A,...Y}),r.createElement(this.toggleButtonComp,{type:"button",icon:"calendar",svgIcon:Q.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(ae.PickerFloatingLabel,{dateInput:this._dateInput,label:C,editorId:d,editorValid:M,editorDisabled:a,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,inputAttributes:e.object},o.defaultProps={defaultShow:!1,defaultValue:null,dateInput:te.DateInput,calendar:se.Calendar,toggleButton:ie.ToggleButton,popup:J.Popup,pickerWrap:oe.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=n.createPropsContext(),B=n.withIdHOC(n.withPropsContext(x,u));B.displayName="KendoReactDatePicker";q.registerForLocalization(u);exports.DatePicker=B;exports.DatePickerPropsContext=x;exports.DatePickerWithoutContext=u;