@progress/kendo-react-dateinputs 9.4.1-develop.2 → 9.4.1-develop.4

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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ve=require("react"),e=require("prop-types"),I=require("@progress/kendo-date-math"),$=require("@progress/kendo-react-buttons"),G=require("@progress/kendo-svg-icons"),Z=require("@progress/kendo-react-intl"),u=require("@progress/kendo-react-common"),pe=require("@progress/kendo-react-labels"),Le=require("@progress/kendo-dateinputs-common"),q=require("./utils.js"),Ne=require("../package-metadata.js"),i=require("../utils.js"),c=require("../messages/index.js"),Ae=require("../timepicker/utils.js"),_e=require("../common/ClearButton.js"),Be=require("./dateInputIntl.js");function je(t){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const m in t)if(m!=="default"){const O=Object.getOwnPropertyDescriptor(t,m);Object.defineProperty(b,m,O.get?O:{enumerable:!0,get:()=>t[m]})}}return b.default=t,Object.freeze(b)}const a=je(Ve),Fe="Please enter a valid value!",p=a.forwardRef((t,b)=>{var J;u.validatePackage(Ne.packageMetadata);const m=u.useId(t.id),O=Z.useInternationalization(),E=Z.useLocalization(),Q=u.useUnstyled(),L=u.usePropsContext(V,t).unstyled||Q,{format:P=r.format,size:ee=r.size,rounded:te=r.rounded,fillMode:ne=r.fillMode,formatPlaceholder:ae=r.formatPlaceholder,spinners:re=r.spinners,disabled:C=r.disabled,min:le=r.min,max:ue=r.max,minTime:ie=r.minTime,maxTime:oe=r.maxTime,validityStyles:se=r.validityStyles,validationMessage:N=r.validationMessage,placeholder:y=r.placeholder,enableMouseWheel:ce=r.enableMouseWheel,autoCorrectParts:de=r.autoCorrectParts,autoSwitchParts:fe=r.autoSwitchParts,allowCaretMode:me=r.allowCaretMode,twoDigitYearMax:ge=r.twoDigitYearMax,ariaHasPopup:ve=r.ariaHasPopup,autoFocus:be=r.autoFocus}=u.usePropsContext(V,t),g=()=>w.current!==void 0?w.current:o.current&&o.current.value,A=()=>{const n=o.current&&o.current.currentText||"",l=g();return y!=null&&!Pe.focused&&!l?y:n},_=()=>t.required!==void 0?t.required:!1,R=()=>{const n=g()||t.value,l=le,X=ue,Te=q.isInRange(n,l,X)&&Ae.isInTimeRange(n,ie,oe),Se=N!==void 0,ke=(!_()||n!=null)&&Te,qe=t.valid!==void 0?t.valid:ke;return{customError:Se,rangeOverflow:n&&X.getTime()<n.getTime()||!1,rangeUnderflow:n&&n.getTime()<l.getTime()||!1,valid:qe,valueMissing:n===null}},ye=()=>{s.current&&s.current.focus()},B=()=>new Be.DateInputIntl(O),x=()=>{const n=g();return{format:P,steps:t.steps,formatPlaceholder:ae,placeholder:y,selectPreviousSegmentOnBackspace:!0,value:t.value||n,intlService:B(),autoFill:t.autoFill!==void 0?t.autoFill:!1,enableMouseWheel:ce,autoCorrectParts:de,autoSwitchParts:fe,autoSwitchKeys:t.autoSwitchKeys||[],twoDigitYearMax:ge,allowCaretMode:me}},he=n=>{d.current&&d.current.classList.add("k-focus"),U({focused:!0})},De=n=>{d.current&&d.current.classList.remove("k-focus"),U({focused:!1})},Ie=(n,l)=>typeof n!=typeof l?!0:typeof n=="string"&&typeof l=="string"?n!==l:typeof n=="object"&&typeof l=="object"?JSON.stringify(n)!==JSON.stringify(l):!1,Oe=n=>typeof n=="string"?n:{inputFormat:n,displayFormat:n},j=n=>{w.current=g(),Re(),v.current=n,w.current=void 0},F=n=>{t.onChange&&t.onChange(n)},H=n=>{u.getActiveElement(document)===s.current&&n.preventDefault()},Ee=()=>new Le.DateInput(s.current,{...x(),format:Oe(x().format),events:{focus:he,blur:De,valueChange:j,click:F}}),z=()=>{s.current&&s.current.setCustomValidity&&s.current.setCustomValidity(R().valid?"":N||r.validationMessage)},Ce=n=>{!s.current||!o.current||j(n)},xe=n=>{n.preventDefault();const l=u.getActiveElement(document);s.current&&l!==s.current&&s.current.focus({preventScroll:!0})},f=n=>{const l=g();v.current&&t.onChange&&!I.isEqual(v.current.oldValue,l)&&t.onChange.call(void 0,{syntheticEvent:n,nativeEvent:v.current.event,value:v.current.value,target:M.current}),v.current=null},Me=n=>{var l;(l=o.current)==null||l.modifyDateSegmentValue(1),f(n)},we=n=>{var l;(l=o.current)==null||l.modifyDateSegmentValue(-1),f(n)},M=a.useRef(null),s=a.useRef(null),d=a.useRef(null);a.useImperativeHandle(M,()=>({props:t,get options(){return x()},get text(){return A()},get element(){return s.current},get name(){return t.name},get value(){return g()},get validity(){return R()},focus:ye,updateOnPaste:Ce})),a.useImperativeHandle(b,()=>M.current);const o=a.useRef(null),T=a.useRef(null),S=a.useRef(!1),w=a.useRef(null),v=a.useRef(null),h=a.useRef(t),[Pe,U]=a.useState({focused:!1}),[,Re]=a.useReducer(n=>n+1,0);a.useLayoutEffect(()=>{S.current||(o.current=Ee(),T.current=o.current.dateObject,S.current=!0)},[]),a.useEffect(()=>(z(),S.current||d.current&&d.current.addEventListener("wheel",H,{passive:!1}),()=>{d.current&&d.current.removeEventListener("wheel",H)}),[]),a.useEffect(()=>{z(),o.current&&((Ie(h.current.format,P)||h.current.readonly!==t.readonly||h.current.steps!==t.steps||B().locale!==o.current.options.intlService.locale)&&o.current.setOptions(x(),!0),h.current.value!==t.value&&(T.current.getValue()!==null||t.value!==null)&&T.current.setValue(t.value),t.ariaExpanded!==void 0&&t.ariaExpanded&&(o.current.options.placeholder=null),t.ariaExpanded!==void 0&&!t.ariaExpanded&&(o.current.options.placeholder=y),o.current.refreshElementValue(),h.current={format:P,readonly:t.readonly,ariaExpanded:t.ariaExpanded,steps:t.steps,value:t.value})});const W=t.id||m+"-accessibility-id",D=L&&L.uDateInput,K=A(),k=!se||R().valid;a.useImperativeHandle(t._ref,()=>M.current);const Y=a.createElement("span",{ref:n=>d.current=n,style:t.label?void 0:{width:t.width},dir:t.dir,className:u.classNames(u.uDateInput.wrapper({c:D,size:ee,fillMode:ne,rounded:te,disabled:C,required:_(),invalid:!k}),t.className)},a.createElement("input",{ref:n=>s.current=n,role:t.ariaRole||"textbox",readOnly:t.readonly,tabIndex:t.tabIndex||0,disabled:C,title:t.title!==void 0?t.title:K,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:be,className:u.classNames(u.uDateInput.inputInner({c:D})),id:W,value:K,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledBy,"aria-describedby":t.ariaDescribedBy,"aria-haspopup":ve,"aria-disabled":C,"aria-expanded":t.ariaExpanded,"aria-controls":t.ariaControls,"aria-required":t.required,"aria-invalid":!k,onKeyDown:f,onChange:f,onWheel:f,onInput:f,onClick:f,name:t.name,...t.inputAttributes}),t.children,t.clearButton&&t.value&&a.createElement(_e,{onClick:F,key:"clearbutton"}),re&&a.createElement("span",{className:u.classNames(u.uDateInput.inputSpinner({c:D})),onMouseDown:xe},a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:u.classNames(u.uDateInput.spinnerIncrease({c:D})),icon:"caret-alt-up",svgIcon:G.caretAltUpIcon,"aria-label":E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),title:E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),onClick:Me}),a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:u.classNames(u.uDateInput.spinnerDecrease({c:D})),icon:"caret-alt-down",svgIcon:G.caretAltDownIcon,"aria-label":E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),title:E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),onClick:we})));return t.label?a.createElement(pe.FloatingLabel,{label:t.label,editorId:W,editorValue:(J=s.current)==null?void 0:J.value,editorValid:k,editorDisabled:C,children:Y,style:{width:t.width}}):Y});p.propTypes={value:e.instanceOf(Date),format:e.oneOfType([i.nullable(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([i.nullable(e.oneOf(["wide","narrow","short","formatPattern"])),e.shape({year:i.nullable(e.string),month:i.nullable(e.string),day:i.nullable(e.string),hour:i.nullable(e.string),minute:i.nullable(e.string),second:i.nullable(e.string)})]),width:e.oneOfType([e.string,e.number]),tabIndex:e.number,title:e.string,steps:e.shape({year:i.nullable(e.number),month:i.nullable(e.number),day:i.nullable(e.number),hour:i.nullable(e.number),minute:i.nullable(e.number),second:i.nullable(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.oneOf(["grid","dialog"])]),ariaExpanded:e.oneOfType([e.bool]),onChange:e.func,validationMessage:e.string,required: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};const r={format:q.DEFAULT_FORMAT,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:q.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:I.cloneDate(i.MAX_DATE),min:I.cloneDate(i.MIN_DATE),minTime:I.cloneDate(i.MIN_TIME),maxTime:I.cloneDate(i.MAX_TIME),validityStyles:!0,validationMessage:Fe,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1},V=u.createPropsContext();p.displayName="KendoReactDateInput";exports.DateInput=p;exports.DateInputPropsContext=V;exports.dateInputDefaultProps=r;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ve=require("react"),e=require("prop-types"),I=require("@progress/kendo-date-math"),$=require("@progress/kendo-react-buttons"),G=require("@progress/kendo-svg-icons"),Z=require("@progress/kendo-react-intl"),i=require("@progress/kendo-react-common"),pe=require("@progress/kendo-react-labels"),Le=require("@progress/kendo-dateinputs-common"),q=require("./utils.js"),Ne=require("../package-metadata.js"),u=require("../utils.js"),c=require("../messages/index.js"),Ae=require("../timepicker/utils.js"),_e=require("../common/ClearButton.js"),Be=require("./dateInputIntl.js");function je(t){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const m in t)if(m!=="default"){const O=Object.getOwnPropertyDescriptor(t,m);Object.defineProperty(b,m,O.get?O:{enumerable:!0,get:()=>t[m]})}}return b.default=t,Object.freeze(b)}const a=je(Ve),Fe="Please enter a valid value!",p=a.forwardRef((t,b)=>{var Y;i.validatePackage(Ne.packageMetadata);const m=i.useId(t.id),O=Z.useInternationalization(),E=Z.useLocalization(),Q=i.useUnstyled(),L=i.usePropsContext(V,t).unstyled||Q,{format:P=r.format,size:ee=r.size,rounded:te=r.rounded,fillMode:ne=r.fillMode,formatPlaceholder:ae=r.formatPlaceholder,spinners:re=r.spinners,disabled:C=r.disabled,min:le=r.min,max:ie=r.max,minTime:ue=r.minTime,maxTime:oe=r.maxTime,validityStyles:se=r.validityStyles,validationMessage:N=r.validationMessage,placeholder:y=r.placeholder,enableMouseWheel:ce=r.enableMouseWheel,autoCorrectParts:de=r.autoCorrectParts,autoSwitchParts:fe=r.autoSwitchParts,allowCaretMode:me=r.allowCaretMode,twoDigitYearMax:ge=r.twoDigitYearMax,ariaHasPopup:ve=r.ariaHasPopup,autoFocus:be=r.autoFocus}=i.usePropsContext(V,t),g=()=>w.current!==void 0?w.current:o.current&&o.current.value,A=()=>{const n=o.current&&o.current.currentText||"",l=g();return y!=null&&!Pe.focused&&!l?y:n},_=()=>t.required!==void 0?t.required:!1,R=()=>{const n=g()||t.value,l=le,X=ie,Te=q.isInRange(n,l,X)&&Ae.isInTimeRange(n,ue,oe),Se=N!==void 0,ke=(!_()||n!=null)&&Te,qe=t.valid!==void 0?t.valid:ke;return{customError:Se,rangeOverflow:n&&X.getTime()<n.getTime()||!1,rangeUnderflow:n&&n.getTime()<l.getTime()||!1,valid:qe,valueMissing:n===null}},ye=()=>{s.current&&s.current.focus()},B=()=>new Be.DateInputIntl(O),x=()=>{const n=g();return{format:P,steps:t.steps,formatPlaceholder:ae,placeholder:y,selectPreviousSegmentOnBackspace:!0,value:t.value||n,intlService:B(),autoFill:t.autoFill!==void 0?t.autoFill:!1,enableMouseWheel:ce,autoCorrectParts:de,autoSwitchParts:fe,autoSwitchKeys:t.autoSwitchKeys||[],twoDigitYearMax:ge,allowCaretMode:me}},he=n=>{d.current&&d.current.classList.add("k-focus"),U({focused:!0})},De=n=>{d.current&&d.current.classList.remove("k-focus"),U({focused:!1})},Ie=(n,l)=>typeof n!=typeof l?!0:typeof n=="string"&&typeof l=="string"?n!==l:typeof n=="object"&&typeof l=="object"?JSON.stringify(n)!==JSON.stringify(l):!1,Oe=n=>typeof n=="string"?n:{inputFormat:n,displayFormat:n},j=n=>{w.current=g(),Re(),v.current=n,w.current=void 0},F=n=>{t.onChange&&t.onChange(n)},H=n=>{i.getActiveElement(document)===s.current&&n.preventDefault()},Ee=()=>new Le.DateInput(s.current,{...x(),format:Oe(x().format),events:{focus:he,blur:De,valueChange:j,click:F}}),z=()=>{s.current&&s.current.setCustomValidity&&s.current.setCustomValidity(R().valid?"":N||r.validationMessage)},Ce=n=>{!s.current||!o.current||j(n)},xe=n=>{n.preventDefault();const l=i.getActiveElement(document);s.current&&l!==s.current&&s.current.focus({preventScroll:!0})},f=n=>{const l=g();v.current&&t.onChange&&!I.isEqual(v.current.oldValue,l)&&t.onChange.call(void 0,{syntheticEvent:n,nativeEvent:v.current.event,value:v.current.value,target:M.current}),v.current=null},Me=n=>{var l;(l=o.current)==null||l.modifyDateSegmentValue(1),f(n)},we=n=>{var l;(l=o.current)==null||l.modifyDateSegmentValue(-1),f(n)},M=a.useRef(null),s=a.useRef(null),d=a.useRef(null);a.useImperativeHandle(M,()=>({props:t,get options(){return x()},get text(){return A()},get element(){return s.current},get name(){return t.name},get value(){return g()},get validity(){return R()},focus:ye,updateOnPaste:Ce})),a.useImperativeHandle(b,()=>M.current);const o=a.useRef(null),T=a.useRef(null),S=a.useRef(!1),w=a.useRef(null),v=a.useRef(null),h=a.useRef(t),[Pe,U]=a.useState({focused:!1}),[,Re]=a.useReducer(n=>n+1,0);a.useLayoutEffect(()=>{S.current||(o.current=Ee(),T.current=o.current.dateObject,S.current=!0)},[]),a.useEffect(()=>(z(),S.current||d.current&&d.current.addEventListener("wheel",H,{passive:!1}),()=>{d.current&&d.current.removeEventListener("wheel",H)}),[]),a.useEffect(()=>{z(),o.current&&((Ie(h.current.format,P)||h.current.readonly!==t.readonly||JSON.stringify(h.current.steps)!==JSON.stringify(t.steps)||B().locale!==o.current.options.intlService.locale)&&o.current.setOptions(x(),!0),h.current.value!==t.value&&(T.current.getValue()!==null||t.value!==null)&&T.current.setValue(t.value),t.ariaExpanded!==void 0&&t.ariaExpanded&&(o.current.options.placeholder=null),t.ariaExpanded!==void 0&&!t.ariaExpanded&&(o.current.options.placeholder=y),o.current.refreshElementValue(),h.current={format:P,readonly:t.readonly,ariaExpanded:t.ariaExpanded,steps:t.steps,value:t.value})});const W=t.id||m+"-accessibility-id",D=L&&L.uDateInput,K=A(),k=!se||R().valid;a.useImperativeHandle(t._ref,()=>M.current);const J=a.createElement("span",{ref:n=>d.current=n,style:t.label?void 0:{width:t.width},dir:t.dir,className:i.classNames(i.uDateInput.wrapper({c:D,size:ee,fillMode:ne,rounded:te,disabled:C,required:_(),invalid:!k}),t.className)},a.createElement("input",{ref:n=>s.current=n,role:t.ariaRole||"textbox",readOnly:t.readonly,tabIndex:t.tabIndex||0,disabled:C,title:t.title!==void 0?t.title:K,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:be,className:i.classNames(i.uDateInput.inputInner({c:D})),id:W,value:K,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledBy,"aria-describedby":t.ariaDescribedBy,"aria-haspopup":ve,"aria-disabled":C,"aria-expanded":t.ariaExpanded,"aria-controls":t.ariaControls,"aria-required":t.required,"aria-invalid":!k,onKeyDown:f,onChange:f,onWheel:f,onInput:f,onClick:f,name:t.name,...t.inputAttributes}),t.children,t.clearButton&&t.value&&a.createElement(_e,{onClick:F,key:"clearbutton"}),re&&a.createElement("span",{className:i.classNames(i.uDateInput.inputSpinner({c:D})),onMouseDown:xe},a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:i.classNames(i.uDateInput.spinnerIncrease({c:D})),icon:"caret-alt-up",svgIcon:G.caretAltUpIcon,"aria-label":E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),title:E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),onClick:Me}),a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:i.classNames(i.uDateInput.spinnerDecrease({c:D})),icon:"caret-alt-down",svgIcon:G.caretAltDownIcon,"aria-label":E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),title:E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),onClick:we})));return t.label?a.createElement(pe.FloatingLabel,{label:t.label,editorId:W,editorValue:(Y=s.current)==null?void 0:Y.value,editorValid:k,editorDisabled:C,children:J,style:{width:t.width}}):J});p.propTypes={value:e.instanceOf(Date),format:e.oneOfType([u.nullable(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([u.nullable(e.oneOf(["wide","narrow","short","formatPattern"])),e.shape({year:u.nullable(e.string),month:u.nullable(e.string),day:u.nullable(e.string),hour:u.nullable(e.string),minute:u.nullable(e.string),second:u.nullable(e.string)})]),width:e.oneOfType([e.string,e.number]),tabIndex:e.number,title:e.string,steps:e.shape({year:u.nullable(e.number),month:u.nullable(e.number),day:u.nullable(e.number),hour:u.nullable(e.number),minute:u.nullable(e.number),second:u.nullable(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.oneOf(["grid","dialog"])]),ariaExpanded:e.oneOfType([e.bool]),onChange:e.func,validationMessage:e.string,required: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};const r={format:q.DEFAULT_FORMAT,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:q.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:I.cloneDate(u.MAX_DATE),min:I.cloneDate(u.MIN_DATE),minTime:I.cloneDate(u.MIN_TIME),maxTime:I.cloneDate(u.MAX_TIME),validityStyles:!0,validationMessage:Fe,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1},V=i.createPropsContext();p.displayName="KendoReactDateInput";exports.DateInput=p;exports.DateInputPropsContext=V;exports.dateInputDefaultProps=r;
@@ -8,13 +8,13 @@
8
8
  import * as a from "react";
9
9
  import e from "prop-types";
10
10
  import { cloneDate as x, isEqual as Ve } from "@progress/kendo-date-math";
11
- import { Button as Y } from "@progress/kendo-react-buttons";
11
+ import { Button as J } from "@progress/kendo-react-buttons";
12
12
  import { caretAltUpIcon as Ne, caretAltDownIcon as _e } from "@progress/kendo-svg-icons";
13
13
  import { useInternationalization as Fe, useLocalization as He } from "@progress/kendo-react-intl";
14
- import { validatePackage as Be, useId as qe, useUnstyled as ze, usePropsContext as J, classNames as y, uDateInput as b, createPropsContext as Ue, getActiveElement as X } from "@progress/kendo-react-common";
14
+ import { validatePackage as Be, useId as qe, useUnstyled as ze, usePropsContext as Y, classNames as y, uDateInput as b, createPropsContext as Ue, getActiveElement as X } from "@progress/kendo-react-common";
15
15
  import { FloatingLabel as We } from "@progress/kendo-react-labels";
16
16
  import { DateInput as je } from "@progress/kendo-dateinputs-common";
17
- import { DEFAULT_FORMAT as Ke, DEFAULT_FORMAT_PLACEHOLDER as Ye, isInRange as Je } from "./utils.mjs";
17
+ import { DEFAULT_FORMAT as Ke, DEFAULT_FORMAT_PLACEHOLDER as Je, isInRange as Ye } from "./utils.mjs";
18
18
  import { packageMetadata as Xe } from "../package-metadata.mjs";
19
19
  import { nullable as u, MAX_DATE as Ge, MIN_DATE as Ze, MIN_TIME as $e, MAX_TIME as Qe } from "../utils.mjs";
20
20
  import { increaseValue as C, messages as w, decreaseValue as M } from "../messages/index.mjs";
@@ -24,14 +24,14 @@ import { DateInputIntl as nt } from "./dateInputIntl.mjs";
24
24
  const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
25
25
  var j;
26
26
  Be(Xe);
27
- const Q = qe(t.id), ee = Fe(), h = He(), te = ze(), p = J(G, t).unstyled || te, {
27
+ const Q = qe(t.id), ee = Fe(), h = He(), te = ze(), p = Y(G, t).unstyled || te, {
28
28
  format: T = r.format,
29
29
  size: ne = r.size,
30
30
  rounded: ae = r.rounded,
31
31
  fillMode: re = r.fillMode,
32
32
  formatPlaceholder: ie = r.formatPlaceholder,
33
33
  spinners: le = r.spinners,
34
- disabled: E = r.disabled,
34
+ disabled: O = r.disabled,
35
35
  min: oe = r.min,
36
36
  max: ue = r.max,
37
37
  minTime: se = r.minTime,
@@ -46,11 +46,11 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
46
46
  twoDigitYearMax: ye = r.twoDigitYearMax,
47
47
  ariaHasPopup: be = r.ariaHasPopup,
48
48
  autoFocus: he = r.autoFocus
49
- } = J(G, t), d = () => D.current !== void 0 ? D.current : l.current && l.current.value, A = () => {
49
+ } = Y(G, t), d = () => D.current !== void 0 ? D.current : l.current && l.current.value, A = () => {
50
50
  const n = l.current && l.current.currentText || "", i = d();
51
51
  return f != null && !Pe.focused && !i ? f : n;
52
52
  }, V = () => t.required !== void 0 ? t.required : !1, R = () => {
53
- const n = d() || t.value, i = oe, K = ue, ke = Je(n, i, K) && et(n, se, ce), pe = L !== void 0, Le = (!V() || n != null) && ke, Ae = t.valid !== void 0 ? t.valid : Le;
53
+ const n = d() || t.value, i = oe, K = ue, ke = Ye(n, i, K) && et(n, se, ce), pe = L !== void 0, Le = (!V() || n != null) && ke, Ae = t.valid !== void 0 ? t.valid : Le;
54
54
  return {
55
55
  customError: pe,
56
56
  rangeOverflow: n && K.getTime() < n.getTime() || !1,
@@ -58,9 +58,9 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
58
58
  valid: Ae,
59
59
  valueMissing: n === null
60
60
  };
61
- }, Ee = () => {
61
+ }, Oe = () => {
62
62
  o.current && o.current.focus();
63
- }, N = () => new nt(ee), I = () => {
63
+ }, N = () => new nt(ee), E = () => {
64
64
  const n = d();
65
65
  return {
66
66
  format: T,
@@ -78,9 +78,9 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
78
78
  twoDigitYearMax: ye,
79
79
  allowCaretMode: ve
80
80
  };
81
- }, Ie = (n) => {
81
+ }, Ee = (n) => {
82
82
  s.current && s.current.classList.add("k-focus"), q({ focused: !0 });
83
- }, Oe = (n) => {
83
+ }, Ie = (n) => {
84
84
  s.current && s.current.classList.remove("k-focus"), q({ focused: !1 });
85
85
  }, De = (n, i) => typeof n != typeof i ? !0 : typeof n == "string" && typeof i == "string" ? n !== i : typeof n == "object" && typeof i == "object" ? JSON.stringify(n) !== JSON.stringify(i) : !1, xe = (n) => typeof n == "string" ? n : {
86
86
  inputFormat: n,
@@ -92,11 +92,11 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
92
92
  }, H = (n) => {
93
93
  X(document) === o.current && n.preventDefault();
94
94
  }, Ce = () => new je(o.current, {
95
- ...I(),
96
- format: xe(I().format),
95
+ ...E(),
96
+ format: xe(E().format),
97
97
  events: {
98
- focus: Ie,
99
- blur: Oe,
98
+ focus: Ee,
99
+ blur: Ie,
100
100
  valueChange: _,
101
101
  click: F
102
102
  }
@@ -116,7 +116,7 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
116
116
  syntheticEvent: n,
117
117
  nativeEvent: m.current.event,
118
118
  value: m.current.value,
119
- target: O.current
119
+ target: I.current
120
120
  }), m.current = null;
121
121
  }, Te = (n) => {
122
122
  var i;
@@ -124,13 +124,13 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
124
124
  }, Re = (n) => {
125
125
  var i;
126
126
  (i = l.current) == null || i.modifyDateSegmentValue(-1), c(n);
127
- }, O = a.useRef(null), o = a.useRef(null), s = a.useRef(null);
127
+ }, I = a.useRef(null), o = a.useRef(null), s = a.useRef(null);
128
128
  a.useImperativeHandle(
129
- O,
129
+ I,
130
130
  () => ({
131
131
  props: t,
132
132
  get options() {
133
- return I();
133
+ return E();
134
134
  },
135
135
  get text() {
136
136
  return A();
@@ -148,17 +148,17 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
148
148
  return R();
149
149
  },
150
150
  // hidden methods
151
- focus: Ee,
151
+ focus: Oe,
152
152
  updateOnPaste: we
153
153
  })
154
- ), a.useImperativeHandle($, () => O.current);
154
+ ), a.useImperativeHandle($, () => I.current);
155
155
  const l = a.useRef(null), P = a.useRef(null), S = a.useRef(!1), D = a.useRef(null), m = a.useRef(null), g = a.useRef(t), [Pe, q] = a.useState({ focused: !1 }), [, Se] = a.useReducer((n) => n + 1, 0);
156
156
  a.useLayoutEffect(() => {
157
157
  S.current || (l.current = Ce(), P.current = l.current.dateObject, S.current = !0);
158
158
  }, []), a.useEffect(() => (B(), S.current || s.current && s.current.addEventListener("wheel", H, { passive: !1 }), () => {
159
159
  s.current && s.current.removeEventListener("wheel", H);
160
160
  }), []), a.useEffect(() => {
161
- B(), l.current && ((De(g.current.format, T) || g.current.readonly !== t.readonly || g.current.steps !== t.steps || N().locale !== l.current.options.intlService.locale) && l.current.setOptions(I(), !0), g.current.value !== t.value && (P.current.getValue() !== null || t.value !== null) && P.current.setValue(t.value), t.ariaExpanded !== void 0 && t.ariaExpanded && (l.current.options.placeholder = null), t.ariaExpanded !== void 0 && !t.ariaExpanded && (l.current.options.placeholder = f), l.current.refreshElementValue(), g.current = {
161
+ B(), l.current && ((De(g.current.format, T) || g.current.readonly !== t.readonly || JSON.stringify(g.current.steps) !== JSON.stringify(t.steps) || N().locale !== l.current.options.intlService.locale) && l.current.setOptions(E(), !0), g.current.value !== t.value && (P.current.getValue() !== null || t.value !== null) && P.current.setValue(t.value), t.ariaExpanded !== void 0 && t.ariaExpanded && (l.current.options.placeholder = null), t.ariaExpanded !== void 0 && !t.ariaExpanded && (l.current.options.placeholder = f), l.current.refreshElementValue(), g.current = {
162
162
  format: T,
163
163
  readonly: t.readonly,
164
164
  ariaExpanded: t.ariaExpanded,
@@ -167,7 +167,7 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
167
167
  });
168
168
  });
169
169
  const z = t.id || Q + "-accessibility-id", v = p && p.uDateInput, U = A(), k = !de || R().valid;
170
- a.useImperativeHandle(t._ref, () => O.current);
170
+ a.useImperativeHandle(t._ref, () => I.current);
171
171
  const W = /* @__PURE__ */ a.createElement(
172
172
  "span",
173
173
  {
@@ -180,7 +180,7 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
180
180
  size: ne,
181
181
  fillMode: re,
182
182
  rounded: ae,
183
- disabled: E,
183
+ disabled: O,
184
184
  required: V(),
185
185
  invalid: !k
186
186
  }),
@@ -194,7 +194,7 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
194
194
  role: t.ariaRole || "textbox",
195
195
  readOnly: t.readonly,
196
196
  tabIndex: t.tabIndex || 0,
197
- disabled: E,
197
+ disabled: O,
198
198
  title: t.title !== void 0 ? t.title : U,
199
199
  type: "text",
200
200
  spellCheck: !1,
@@ -208,7 +208,7 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
208
208
  "aria-labelledby": t.ariaLabelledBy,
209
209
  "aria-describedby": t.ariaDescribedBy,
210
210
  "aria-haspopup": be,
211
- "aria-disabled": E,
211
+ "aria-disabled": O,
212
212
  "aria-expanded": t.ariaExpanded,
213
213
  "aria-controls": t.ariaControls,
214
214
  "aria-required": t.required,
@@ -225,7 +225,7 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
225
225
  t.children,
226
226
  t.clearButton && t.value && /* @__PURE__ */ a.createElement(tt, { onClick: F, key: "clearbutton" }),
227
227
  le && /* @__PURE__ */ a.createElement("span", { className: y(b.inputSpinner({ c: v })), onMouseDown: Me }, /* @__PURE__ */ a.createElement(
228
- Y,
228
+ J,
229
229
  {
230
230
  tabIndex: -1,
231
231
  type: "button",
@@ -238,7 +238,7 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
238
238
  onClick: Te
239
239
  }
240
240
  ), /* @__PURE__ */ a.createElement(
241
- Y,
241
+ J,
242
242
  {
243
243
  tabIndex: -1,
244
244
  type: "button",
@@ -259,7 +259,7 @@ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
259
259
  editorId: z,
260
260
  editorValue: (j = o.current) == null ? void 0 : j.value,
261
261
  editorValid: k,
262
- editorDisabled: E,
262
+ editorDisabled: O,
263
263
  children: W,
264
264
  style: { width: t.width }
265
265
  }
@@ -343,7 +343,7 @@ const r = {
343
343
  size: "medium",
344
344
  rounded: "medium",
345
345
  fillMode: "solid",
346
- formatPlaceholder: Ye,
346
+ formatPlaceholder: Je,
347
347
  spinners: !1,
348
348
  disabled: !1,
349
349
  max: x(Ge),
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qe=require("react"),e=require("prop-types"),et=require("@progress/kendo-react-popup"),K=require("@progress/kendo-date-math"),u=require("@progress/kendo-react-common"),tt=require("@progress/kendo-svg-icons"),nt=require("../package-metadata.js"),at=require("../dateinput/DateInput.js"),ot=require("../calendar/components/Calendar.js"),o=require("../utils.js"),L=require("../messages/index.js"),rt=require("@progress/kendo-react-intl"),lt=require("./ToggleButton.js"),ut=require("../common/PickerWrap.js"),it=require("../hooks/usePickerFloatingLabel.js"),st=require("@progress/kendo-react-layout"),ct=require("../common/AdaptiveMode.js");function dt(n){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const f in n)if(f!=="default"){const R=Object.getOwnPropertyDescriptor(n,f);Object.defineProperty(h,f,R.get?R:{enumerable:!0,get:()=>n[f]})}}return h.default=n,Object.freeze(h)}const a=dt(Qe),W=a.forwardRef((n,h)=>{u.validatePackage(nt.packageMetadata);const f=u.useId(n.id),R=rt.useLocalization(),v=u.useAdaptiveModeContext(),{defaultShow:se=l.defaultShow,defaultValue:ce=l.defaultValue,dateInput:de=l.dateInput,calendar:fe=l.calendar,toggleButton:me=l.toggleButton,popup:ge=l.popup,pickerWrap:ft=l.pickerWrap,disabled:w=l.disabled,format:pe=l.format,max:_=l.max,min:E=l.min,popupSettings:y=l.popupSettings,tabIndex:be=l.tabIndex,weekNumber:he=l.weekNumber,validityStyles:j=l.validityStyles,size:T=l.size,rounded:q=l.rounded,fillMode:x=l.fillMode,autoFocus:ve=l.autoFocus,show:H,autoSwitchParts:we,autoSwitchKeys:ye,twoDigitYearMax:ke,ariaLabel:De,adaptive:mt,formatPlaceholder:Pe,adaptiveTitle:Ce,inputAttributes:Oe,validationMessage:U,visited:gt,value:B,touched:pt,modified:bt,_adaptiveMode:ht=v,valid:Y,focusedDate:Me,id:Re,...$}=u.usePropsContext(ie,n),A=()=>{if(u.canUseDOM)return D.current&&D.current.ownerDocument||window.document},c=()=>!!(b.windowWidth&&v&&b.windowWidth<=(v==null?void 0:v.medium)&&n.adaptive),m=()=>{const t=C.current!==void 0&&C.current!==null?C.current:B!==void 0?B:b.value;return t!==null?K.cloneDate(t):null},i=()=>I.current!==void 0?I.current:H!==void 0?H:b.show,Ie=()=>de||l.dateInput,Se=()=>me||l.toggleButton,_e=()=>fe||l.calendar,Ee=()=>ge||l.popup,X=()=>n.required!==void 0?n.required:!1,N=()=>{const t=m()||B||null,r=E,s=_,S=o.isInDateRange(t,r,s),F=U!==void 0,V=(!X()||t!=null)&&S,z=Y!==void 0?Y:V;return{customError:F,rangeOverflow:t&&s.getTime()<t.getTime()||!1,rangeUnderflow:t&&t.getTime()<r.getTime()||!1,valid:z,valueMissing:t===null}},Te=t=>{for(const r of t)M({windowWidth:r.target.clientWidth})},qe=()=>{d.current&&d.current.focus()},Z=t=>{P.current=t},g=t=>{i()!==t&&(M({show:t}),t&&n.onOpen&&n.onOpen.call(void 0,{target:k.current}),!t&&n.onClose&&n.onClose.call(void 0,{target:k.current}))},xe=t=>{const r=m();return r&&t?o.setTime(t,r):t},Be=t=>{y!=null&&y.onMouseDownOutside&&y.onMouseDownOutside.call(void 0,t)},G=(t,r)=>{M({value:K.cloneDate(t||void 0)}),C.current=t,I.current=!1,c()||(p.current=!0),n.onChange&&n.onChange.call(void 0,{syntheticEvent:r.syntheticEvent,nativeEvent:r.nativeEvent,value:m(),show:i(),target:k.current}),C.current=void 0,I.current=void 0,g(!1)},Ae=t=>{const r=xe(t.value);G(r,t)},J=()=>{const{popupClass:t,...r}=y,s=i(),S=m(),F=S&&K.getDate(S),V=u.classNames(t),z={popupClass:"k-datepicker-popup",show:s,anchor:D.current,className:V,id:ne,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...r,onMouseDownOutside:Be},le={disabled:w,value:F,min:E,max:_,weekNumber:he,focusedDate:Me,className:c()?"k-calendar-lg":"",navigation:!c(),onChange:Ae},ue=_e(),Je=Ee();return c()?a.createElement(ue,{_ref:Z,...le}):a.createElement(Je,{...z},a.createElement(ue,{_ref:Z,...le}))},Q=()=>{M({focused:!1}),g(!1)},Ne=()=>{const{windowWidth:t=0}=b,r={expand:i(),onClose:Q,adaptiveTitle:Ce,windowWidth:t},s=J();return a.createElement(ct.AdaptiveMode,{...r},a.createElement(st.ActionSheetContent,{overflowHidden:!0},s))},Fe=t=>{G(t.value,t)},Ve=()=>{M({focused:!0})},ze=()=>{g(!i())},ee=()=>{w||(p.current=!0,g(!i()))},Ke=t=>{t.preventDefault()},Le=t=>{const{altKey:r,keyCode:s}=t;if(s===u.Keys.esc&&i()){p.current=!0,g(!1);return}r&&(s===u.Keys.up||s===u.Keys.down)&&(t.preventDefault(),t.stopPropagation(),p.current=s===u.Keys.up,g(s===u.Keys.down))},k=a.useRef(null),D=a.useRef(null),d=a.useRef(null),P=a.useRef(null);a.useImperativeHandle(k,()=>({props:n,get element(){return D.current},get calendar(){return P.current},get dateInput(){return d.current},get name(){return n.name},get show(){return i()},get validity(){return N()},get value(){return m()},get mobileMode(){return c()},togglePopup:ze,focus:qe})),a.useImperativeHandle(h,()=>k.current);const C=a.useRef(null),I=a.useRef(void 0),We=a.useRef(null),p=a.useRef(!1),te=a.useRef(!1),O=a.useRef(null),[b,je]=a.useState({value:ce,show:se,focused:!1}),[,He]=a.useReducer(t=>t,!0),M=t=>{je(r=>({...r,...t}))};a.useEffect(()=>{P.current&&P.current.element&&i()&&!te.current&&P.current.element.focus({preventScroll:!0}),d.current&&d.current.element&&!i()&&p.current&&d.current.element.focus({preventScroll:!0}),te.current=i(),p.current=!1}),a.useEffect(()=>{var t;return O.current=u.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(r=>Te(r)),i()&&He(),(t=A())!=null&&t.body&&O.current&&O.current.observe(A().body),()=>{var r;clearTimeout(We.current),(r=A())!=null&&r.body&&O.current&&O.current.disconnect()}},[]);const ne=f+"-popup-id",Ue=J(),Ye=Ie(),$e=m(),Xe=Se(),Ze=Ne(),ae=!j||N().valid,oe=R.toLanguageString(L.toggleCalendar,L.messages[L.toggleCalendar]),Ge={disabled:w,format:pe,formatPlaceholder:Pe,id:Re,ariaLabelledBy:n.ariaLabelledBy,ariaDescribedBy:n.ariaDescribedBy,ariaLabel:De,max:_,min:E,name:n.name,onChange:Fe,required:n.required,_ref:d,tabIndex:i()?-1:be,title:n.title,valid:N().valid,validationMessage:U,validityStyles:j,value:$e,label:void 0,placeholder:b.focused?null:n.placeholder,ariaExpanded:i(),size:null,fillMode:null,rounded:null,autoFill:n.autoFill,twoDigitYearMax:ke,enableMouseWheel:n.enableMouseWheel,autoCorrectParts:n.autoCorrectParts,autoSwitchParts:we,autoSwitchKeys:ye,allowCaretMode:n.allowCaretMode,inputAttributes:Oe},re=a.createElement(u.AsyncFocusBlur,{onFocus:Ve,onBlur:c()?void 0:Q,onSyncBlur:n.onBlur,onSyncFocus:n.onFocus},t=>a.createElement(a.Fragment,null,a.createElement("span",{...n.label?{}:$,ref:D,className:u.classNames("k-input","k-datepicker",{[`k-input-${u.kendoThemeMaps.sizeMap[T]||T}`]:T,[`k-rounded-${u.kendoThemeMaps.roundedMap[q]||q}`]:q,[`k-input-${x}`]:x,"k-invalid":!ae,"k-required":X(),"k-disabled":w},n.className),onKeyDown:Le,style:{width:n.width},onFocus:t.onFocus,onBlur:t.onBlur,onClick:c()?ee:void 0},a.createElement(Ye,{_ref:d,ariaRole:"combobox",ariaExpanded:i(),ariaControls:ne,autoFocus:ve,...Ge}),a.createElement(Xe,{type:"button",icon:"calendar",svgIcon:tt.calendarIcon,title:oe,className:"k-input-button",rounded:null,onClick:c()?void 0:ee,"aria-label":oe,fillMode:x,onMouseDown:Ke}),!c()&&Ue),c()&&Ze));return n.label?a.createElement(it.PickerFloatingLabel,{dateInput:d,label:n.label,editorId:f,editorValid:ae,editorDisabled:w,children:re,style:{width:n.width},...$}):re});W.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:o.nullable(e.string),pattern:o.nullable(e.string),date:o.nullable(e.oneOf(["short","medium","long","full"])),time:o.nullable(e.oneOf(["short","medium","long","full"])),datetime:o.nullable(e.oneOf(["short","medium","long","full"])),era:o.nullable(e.oneOf(["narrow","short","long"])),year:o.nullable(e.oneOf(["numeric","2-digit"])),month:o.nullable(e.oneOf(["numeric","2-digit","narrow","short","long"])),day:o.nullable(e.oneOf(["numeric","2-digit"])),weekday:o.nullable(e.oneOf(["narrow","short","long"])),hour:o.nullable(e.oneOf(["numeric","2-digit"])),hour12:o.nullable(e.bool),minute:o.nullable(e.oneOf(["numeric","2-digit"])),second:o.nullable(e.oneOf(["numeric","2-digit"])),timeZoneName:o.nullable(e.oneOf(["short","long"]))})]),formatPlaceholder:e.oneOfType([o.nullable(e.oneOf(["wide","narrow","short","formatPattern"])),e.shape({year:o.nullable(e.string),month:o.nullable(e.string),day:o.nullable(e.string),hour:o.nullable(e.string),minute:o.nullable(e.string),second:o.nullable(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:o.nullable(e.bool),appendTo:o.nullable(e.any),popupClass:o.nullable(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,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};const l={defaultShow:!1,defaultValue:null,dateInput:at.DateInput,calendar:ot.Calendar,toggleButton:lt.ToggleButton,popup:et.Popup,pickerWrap:ut.PickerWrap,disabled:!1,format:"d",max:o.MAX_DATE,min:o.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1},ie=u.createPropsContext();W.displayName="KendoReactDatePicker";exports.DatePicker=W;exports.DatePickerPropsContext=ie;exports.datePickerDefaultProps=l;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qe=require("react"),e=require("prop-types"),et=require("@progress/kendo-react-popup"),K=require("@progress/kendo-date-math"),u=require("@progress/kendo-react-common"),tt=require("@progress/kendo-svg-icons"),nt=require("../package-metadata.js"),at=require("../dateinput/DateInput.js"),ot=require("../calendar/components/Calendar.js"),o=require("../utils.js"),L=require("../messages/index.js"),rt=require("@progress/kendo-react-intl"),lt=require("./ToggleButton.js"),ut=require("../common/PickerWrap.js"),it=require("../hooks/usePickerFloatingLabel.js"),st=require("@progress/kendo-react-layout"),ct=require("../common/AdaptiveMode.js");function dt(n){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const f in n)if(f!=="default"){const M=Object.getOwnPropertyDescriptor(n,f);Object.defineProperty(h,f,M.get?M:{enumerable:!0,get:()=>n[f]})}}return h.default=n,Object.freeze(h)}const a=dt(Qe),W=a.forwardRef((n,h)=>{u.validatePackage(nt.packageMetadata);const f=u.useId(n.id),M=rt.useLocalization(),v=u.useAdaptiveModeContext(),{defaultShow:se=l.defaultShow,defaultValue:ce=l.defaultValue,dateInput:de=l.dateInput,calendar:fe=l.calendar,toggleButton:me=l.toggleButton,popup:ge=l.popup,pickerWrap:ft=l.pickerWrap,disabled:w=l.disabled,format:pe=l.format,max:_=l.max,min:E=l.min,popupSettings:y=l.popupSettings,tabIndex:be=l.tabIndex,weekNumber:he=l.weekNumber,validityStyles:j=l.validityStyles,size:T=l.size,rounded:q=l.rounded,fillMode:x=l.fillMode,autoFocus:ve=l.autoFocus,show:H,autoSwitchParts:we,autoSwitchKeys:ye,twoDigitYearMax:ke,ariaLabel:De,adaptive:mt,formatPlaceholder:Pe,adaptiveTitle:Ce,inputAttributes:Oe,validationMessage:U,visited:gt,value:B,touched:pt,modified:bt,_adaptiveMode:ht=v,valid:Y,focusedDate:Me,id:Re,...$}=u.usePropsContext(ie,n),A=()=>{if(u.canUseDOM)return D.current&&D.current.ownerDocument||window.document},c=()=>!!(b.windowWidth&&v&&b.windowWidth<=(v==null?void 0:v.medium)&&n.adaptive),m=()=>{const t=R.current!==void 0?R.current:B!==void 0?B:b.value;return t!==null?K.cloneDate(t):null},i=()=>I.current!==void 0?I.current:H!==void 0?H:b.show,Ie=()=>de||l.dateInput,Se=()=>me||l.toggleButton,_e=()=>fe||l.calendar,Ee=()=>ge||l.popup,X=()=>n.required!==void 0?n.required:!1,N=()=>{const t=m()||B||null,r=E,s=_,S=o.isInDateRange(t,r,s),F=U!==void 0,V=(!X()||t!=null)&&S,z=Y!==void 0?Y:V;return{customError:F,rangeOverflow:t&&s.getTime()<t.getTime()||!1,rangeUnderflow:t&&t.getTime()<r.getTime()||!1,valid:z,valueMissing:t===null}},Te=t=>{for(const r of t)O({windowWidth:r.target.clientWidth})},qe=()=>{d.current&&d.current.focus()},Z=t=>{P.current=t},g=t=>{i()!==t&&(O({show:t}),t&&n.onOpen&&n.onOpen.call(void 0,{target:k.current}),!t&&n.onClose&&n.onClose.call(void 0,{target:k.current}))},xe=t=>{const r=m();return r&&t?o.setTime(t,r):t},Be=t=>{y!=null&&y.onMouseDownOutside&&y.onMouseDownOutside.call(void 0,t)},G=(t,r)=>{O({value:K.cloneDate(t||void 0)}),R.current=t,I.current=!1,c()||(p.current=!0),n.onChange&&n.onChange.call(void 0,{syntheticEvent:r.syntheticEvent,nativeEvent:r.nativeEvent,value:m(),show:i(),target:k.current}),R.current=void 0,I.current=void 0,g(!1)},Ae=t=>{const r=xe(t.value);G(r,t)},J=()=>{const{popupClass:t,...r}=y,s=i(),S=m(),F=S&&K.getDate(S),V=u.classNames(t),z={popupClass:"k-datepicker-popup",show:s,anchor:D.current,className:V,id:ne,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...r,onMouseDownOutside:Be},le={disabled:w,value:F,min:E,max:_,weekNumber:he,focusedDate:Me,className:c()?"k-calendar-lg":"",navigation:!c(),onChange:Ae},ue=_e(),Je=Ee();return c()?a.createElement(ue,{_ref:Z,...le}):a.createElement(Je,{...z},a.createElement(ue,{_ref:Z,...le}))},Q=()=>{O({focused:!1}),g(!1)},Ne=()=>{const{windowWidth:t=0}=b,r={expand:i(),onClose:Q,adaptiveTitle:Ce,windowWidth:t},s=J();return a.createElement(ct.AdaptiveMode,{...r},a.createElement(st.ActionSheetContent,{overflowHidden:!0},s))},Fe=t=>{G(t.value,t)},Ve=()=>{O({focused:!0})},ze=()=>{g(!i())},ee=()=>{w||(p.current=!0,g(!i()))},Ke=t=>{t.preventDefault()},Le=t=>{const{altKey:r,keyCode:s}=t;if(s===u.Keys.esc&&i()){p.current=!0,g(!1);return}r&&(s===u.Keys.up||s===u.Keys.down)&&(t.preventDefault(),t.stopPropagation(),p.current=s===u.Keys.up,g(s===u.Keys.down))},k=a.useRef(null),D=a.useRef(null),d=a.useRef(null),P=a.useRef(null);a.useImperativeHandle(k,()=>({props:n,get element(){return D.current},get calendar(){return P.current},get dateInput(){return d.current},get name(){return n.name},get show(){return i()},get validity(){return N()},get value(){return m()},get mobileMode(){return c()},togglePopup:ze,focus:qe})),a.useImperativeHandle(h,()=>k.current);const R=a.useRef(void 0),I=a.useRef(void 0),We=a.useRef(null),p=a.useRef(!1),te=a.useRef(!1),C=a.useRef(null),[b,je]=a.useState({value:ce,show:se,focused:!1}),[,He]=a.useReducer(t=>t,!0),O=t=>{je(r=>({...r,...t}))};a.useEffect(()=>{P.current&&P.current.element&&i()&&!te.current&&P.current.element.focus({preventScroll:!0}),d.current&&d.current.element&&!i()&&p.current&&d.current.element.focus({preventScroll:!0}),te.current=i(),p.current=!1}),a.useEffect(()=>{var t;return C.current=u.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(r=>Te(r)),i()&&He(),(t=A())!=null&&t.body&&C.current&&C.current.observe(A().body),()=>{var r;clearTimeout(We.current),(r=A())!=null&&r.body&&C.current&&C.current.disconnect()}},[]);const ne=f+"-popup-id",Ue=J(),Ye=Ie(),$e=m(),Xe=Se(),Ze=Ne(),ae=!j||N().valid,oe=M.toLanguageString(L.toggleCalendar,L.messages[L.toggleCalendar]),Ge={disabled:w,format:pe,formatPlaceholder:Pe,id:Re,ariaLabelledBy:n.ariaLabelledBy,ariaDescribedBy:n.ariaDescribedBy,ariaLabel:De,max:_,min:E,name:n.name,onChange:Fe,required:n.required,_ref:d,tabIndex:i()?-1:be,title:n.title,valid:N().valid,validationMessage:U,validityStyles:j,value:$e,label:void 0,placeholder:b.focused?null:n.placeholder,ariaExpanded:i(),size:null,fillMode:null,rounded:null,autoFill:n.autoFill,twoDigitYearMax:ke,enableMouseWheel:n.enableMouseWheel,autoCorrectParts:n.autoCorrectParts,autoSwitchParts:we,autoSwitchKeys:ye,allowCaretMode:n.allowCaretMode,inputAttributes:Oe},re=a.createElement(u.AsyncFocusBlur,{onFocus:Ve,onBlur:c()?void 0:Q,onSyncBlur:n.onBlur,onSyncFocus:n.onFocus},t=>a.createElement(a.Fragment,null,a.createElement("span",{...n.label?{}:$,ref:D,className:u.classNames("k-input","k-datepicker",{[`k-input-${u.kendoThemeMaps.sizeMap[T]||T}`]:T,[`k-rounded-${u.kendoThemeMaps.roundedMap[q]||q}`]:q,[`k-input-${x}`]:x,"k-invalid":!ae,"k-required":X(),"k-disabled":w},n.className),onKeyDown:Le,style:{width:n.width},onFocus:t.onFocus,onBlur:t.onBlur,onClick:c()?ee:void 0},a.createElement(Ye,{_ref:d,ariaRole:"combobox",ariaExpanded:i(),ariaControls:ne,autoFocus:ve,...Ge}),a.createElement(Xe,{type:"button",icon:"calendar",svgIcon:tt.calendarIcon,title:oe,className:"k-input-button",rounded:null,onClick:c()?void 0:ee,"aria-label":oe,fillMode:x,onMouseDown:Ke}),!c()&&Ue),c()&&Ze));return n.label?a.createElement(it.PickerFloatingLabel,{dateInput:d,label:n.label,editorId:f,editorValid:ae,editorDisabled:w,children:re,style:{width:n.width},...$}):re});W.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:o.nullable(e.string),pattern:o.nullable(e.string),date:o.nullable(e.oneOf(["short","medium","long","full"])),time:o.nullable(e.oneOf(["short","medium","long","full"])),datetime:o.nullable(e.oneOf(["short","medium","long","full"])),era:o.nullable(e.oneOf(["narrow","short","long"])),year:o.nullable(e.oneOf(["numeric","2-digit"])),month:o.nullable(e.oneOf(["numeric","2-digit","narrow","short","long"])),day:o.nullable(e.oneOf(["numeric","2-digit"])),weekday:o.nullable(e.oneOf(["narrow","short","long"])),hour:o.nullable(e.oneOf(["numeric","2-digit"])),hour12:o.nullable(e.bool),minute:o.nullable(e.oneOf(["numeric","2-digit"])),second:o.nullable(e.oneOf(["numeric","2-digit"])),timeZoneName:o.nullable(e.oneOf(["short","long"]))})]),formatPlaceholder:e.oneOfType([o.nullable(e.oneOf(["wide","narrow","short","formatPattern"])),e.shape({year:o.nullable(e.string),month:o.nullable(e.string),day:o.nullable(e.string),hour:o.nullable(e.string),minute:o.nullable(e.string),second:o.nullable(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:o.nullable(e.bool),appendTo:o.nullable(e.any),popupClass:o.nullable(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,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};const l={defaultShow:!1,defaultValue:null,dateInput:at.DateInput,calendar:ot.Calendar,toggleButton:lt.ToggleButton,popup:et.Popup,pickerWrap:ut.PickerWrap,disabled:!1,format:"d",max:o.MAX_DATE,min:o.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1},ie=u.createPropsContext();W.displayName="KendoReactDatePicker";exports.DatePicker=W;exports.DatePickerPropsContext=ie;exports.datePickerDefaultProps=l;
@@ -9,7 +9,7 @@ import * as o from "react";
9
9
  import e from "prop-types";
10
10
  import { Popup as tt } from "@progress/kendo-react-popup";
11
11
  import { cloneDate as oe, getDate as nt } from "@progress/kendo-date-math";
12
- import { validatePackage as ot, useId as rt, useAdaptiveModeContext as at, usePropsContext as lt, canUseDOM as re, AsyncFocusBlur as it, classNames as ae, kendoThemeMaps as le, createPropsContext as ut, Keys as O } from "@progress/kendo-react-common";
12
+ import { validatePackage as ot, useId as rt, useAdaptiveModeContext as at, usePropsContext as lt, canUseDOM as re, AsyncFocusBlur as it, classNames as ae, kendoThemeMaps as le, createPropsContext as ut, Keys as D } from "@progress/kendo-react-common";
13
13
  import { calendarIcon as st } from "@progress/kendo-svg-icons";
14
14
  import { packageMetadata as ct } from "../package-metadata.mjs";
15
15
  import { DateInput as dt } from "../dateinput/DateInput.mjs";
@@ -67,7 +67,7 @@ const ue = o.forwardRef((n, se) => {
67
67
  if (re)
68
68
  return b.current && b.current.ownerDocument || window.document;
69
69
  }, s = () => !!(p.windowWidth && g && p.windowWidth <= (g == null ? void 0 : g.medium) && n.adaptive), d = () => {
70
- const t = C.current !== void 0 && C.current !== null ? C.current : x !== void 0 ? x : p.value;
70
+ const t = O.current !== void 0 ? O.current : x !== void 0 ? x : p.value;
71
71
  return t !== null ? oe(t) : null;
72
72
  }, i = () => P.current !== void 0 ? P.current : W !== void 0 ? W : p.show, Ee = () => me || l.dateInput, _e = () => ge || l.toggleButton, xe = () => pe || l.calendar, Be = () => he || l.popup, H = () => n.required !== void 0 ? n.required : !1, T = () => {
73
73
  const t = d() || x || null, r = I, u = R, M = gt(t, r, u), A = L !== void 0, V = (!H() || t != null) && M, F = K !== void 0 ? K : V;
@@ -80,26 +80,26 @@ const ue = o.forwardRef((n, se) => {
80
80
  };
81
81
  }, Te = (t) => {
82
82
  for (const r of t)
83
- D({ windowWidth: r.target.clientWidth });
83
+ k({ windowWidth: r.target.clientWidth });
84
84
  }, Ae = () => {
85
85
  c.current && c.current.focus();
86
86
  }, U = (t) => {
87
87
  y.current = t;
88
88
  }, f = (t) => {
89
- i() !== t && (D({ show: t }), t && n.onOpen && n.onOpen.call(void 0, { target: w.current }), !t && n.onClose && n.onClose.call(void 0, { target: w.current }));
89
+ i() !== t && (k({ show: t }), t && n.onOpen && n.onOpen.call(void 0, { target: w.current }), !t && n.onClose && n.onClose.call(void 0, { target: w.current }));
90
90
  }, Ve = (t) => {
91
91
  const r = d();
92
92
  return r && t ? ht(t, r) : t;
93
93
  }, Fe = (t) => {
94
94
  v != null && v.onMouseDownOutside && v.onMouseDownOutside.call(void 0, t);
95
95
  }, Y = (t, r) => {
96
- D({ value: oe(t || void 0) }), C.current = t, P.current = !1, s() || (m.current = !0), n.onChange && n.onChange.call(void 0, {
96
+ k({ value: oe(t || void 0) }), O.current = t, P.current = !1, s() || (m.current = !0), n.onChange && n.onChange.call(void 0, {
97
97
  syntheticEvent: r.syntheticEvent,
98
98
  nativeEvent: r.nativeEvent,
99
99
  value: d(),
100
100
  show: i(),
101
101
  target: w.current
102
- }), C.current = void 0, P.current = void 0, f(!1);
102
+ }), O.current = void 0, P.current = void 0, f(!1);
103
103
  }, Ne = (t) => {
104
104
  const r = Ve(t.value);
105
105
  Y(r, t);
@@ -133,7 +133,7 @@ const ue = o.forwardRef((n, se) => {
133
133
  }, ne = xe(), et = Be();
134
134
  return s() ? /* @__PURE__ */ o.createElement(ne, { _ref: U, ...te }) : /* @__PURE__ */ o.createElement(et, { ...F }, /* @__PURE__ */ o.createElement(ne, { _ref: U, ...te }));
135
135
  }, j = () => {
136
- D({ focused: !1 }), f(!1);
136
+ k({ focused: !1 }), f(!1);
137
137
  }, ze = () => {
138
138
  const { windowWidth: t = 0 } = p, r = {
139
139
  expand: i(),
@@ -145,7 +145,7 @@ const ue = o.forwardRef((n, se) => {
145
145
  }, We = (t) => {
146
146
  Y(t.value, t);
147
147
  }, Le = () => {
148
- D({ focused: !0 });
148
+ k({ focused: !0 });
149
149
  }, Ke = () => {
150
150
  f(!i());
151
151
  }, X = () => {
@@ -154,11 +154,11 @@ const ue = o.forwardRef((n, se) => {
154
154
  t.preventDefault();
155
155
  }, He = (t) => {
156
156
  const { altKey: r, keyCode: u } = t;
157
- if (u === O.esc && i()) {
157
+ if (u === D.esc && i()) {
158
158
  m.current = !0, f(!1);
159
159
  return;
160
160
  }
161
- r && (u === O.up || u === O.down) && (t.preventDefault(), t.stopPropagation(), m.current = u === O.up, f(u === O.down));
161
+ r && (u === D.up || u === D.down) && (t.preventDefault(), t.stopPropagation(), m.current = u === D.up, f(u === D.down));
162
162
  }, w = o.useRef(null), b = o.useRef(null), c = o.useRef(null), y = o.useRef(null);
163
163
  o.useImperativeHandle(
164
164
  w,
@@ -193,20 +193,20 @@ const ue = o.forwardRef((n, se) => {
193
193
  focus: Ae
194
194
  })
195
195
  ), o.useImperativeHandle(se, () => w.current);
196
- const C = o.useRef(null), P = o.useRef(void 0), Ue = o.useRef(null), m = o.useRef(!1), Z = o.useRef(!1), k = o.useRef(null), [p, Ye] = o.useState({
196
+ const O = o.useRef(void 0), P = o.useRef(void 0), Ue = o.useRef(null), m = o.useRef(!1), Z = o.useRef(!1), C = o.useRef(null), [p, Ye] = o.useState({
197
197
  value: fe,
198
198
  show: de,
199
199
  focused: !1
200
- }), [, $e] = o.useReducer((t) => t, !0), D = (t) => {
200
+ }), [, $e] = o.useReducer((t) => t, !0), k = (t) => {
201
201
  Ye((r) => ({ ...r, ...t }));
202
202
  };
203
203
  o.useEffect(() => {
204
204
  y.current && y.current.element && i() && !Z.current && y.current.element.focus({ preventScroll: !0 }), c.current && c.current.element && !i() && m.current && c.current.element.focus({ preventScroll: !0 }), Z.current = i(), m.current = !1;
205
205
  }), o.useEffect(() => {
206
206
  var t;
207
- return k.current = re && window.ResizeObserver && new window.ResizeObserver((r) => Te(r)), i() && $e(), (t = B()) != null && t.body && k.current && k.current.observe(B().body), () => {
207
+ return C.current = re && window.ResizeObserver && new window.ResizeObserver((r) => Te(r)), i() && $e(), (t = B()) != null && t.body && C.current && C.current.observe(B().body), () => {
208
208
  var r;
209
- clearTimeout(Ue.current), (r = B()) != null && r.body && k.current && k.current.disconnect();
209
+ clearTimeout(Ue.current), (r = B()) != null && r.body && C.current && C.current.disconnect();
210
210
  };
211
211
  }, []);
212
212
  const G = N + "-popup-id", je = $(), Xe = Ee(), Ze = d(), Ge = _e(), Je = ze(), J = !z || T().valid, Q = ce.toLanguageString(ie, vt[ie]), Qe = {