@progress/kendo-react-dateinputs 9.3.0-develop.3 → 9.3.0-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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Le=require("react"),e=require("prop-types"),O=require("@progress/kendo-date-math"),Q=require("@progress/kendo-react-buttons"),ee=require("@progress/kendo-svg-icons"),te=require("@progress/kendo-react-intl"),l=require("@progress/kendo-react-common"),pe=require("@progress/kendo-react-labels"),Ne=require("@progress/kendo-dateinputs-common"),N=require("./utils.js"),Ae=require("../package-metadata.js"),c=require("../utils.js"),s=require("../messages/index.js"),_e=require("../timepicker/utils.js"),Be=require("../common/ClearButton.js"),je=require("./dateInputIntl.js");function Fe(t){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const m in t)if(m!=="default"){const E=Object.getOwnPropertyDescriptor(t,m);Object.defineProperty(b,m,E.get?E:{enumerable:!0,get:()=>t[m]})}}return b.default=t,Object.freeze(b)}const r=Fe(Le),He="Please enter a valid value!",_=r.forwardRef((t,b)=>{var Z;l.validatePackage(Ae.packageMetadata);const m=l.useId(t.id),E=te.useInternationalization(),C=te.useLocalization(),ne=l.useUnstyled(),B=l.usePropsContext(A,t).unstyled||ne,{format:k=i.format,size:ae=i.size,rounded:re=i.rounded,fillMode:ie=i.fillMode,formatPlaceholder:le=i.formatPlaceholder,spinners:ue=i.spinners,disabled:R=i.disabled,min:oe=i.min,max:se=i.max,minTime:ce=i.minTime,maxTime:de=i.maxTime,validityStyles:fe=i.validityStyles,validationMessage:j=i.validationMessage,placeholder:y=i.placeholder,enableMouseWheel:me=i.enableMouseWheel,autoCorrectParts:ge=i.autoCorrectParts,autoSwitchParts:ve=i.autoSwitchParts,allowCaretMode:be=i.allowCaretMode,twoDigitYearMax:ye=i.twoDigitYearMax,ariaHasPopup:he=i.ariaHasPopup,autoFocus:De=i.autoFocus}=l.usePropsContext(A,t),g=()=>P.current!==void 0?P.current:u.current&&u.current.value,Ie=()=>{const{year:n,month:a,day:I,hours:T,minutes:S,seconds:q}=w.current;return(!n||!a||!I||!T||!S||!q)&&(n||a||I||T||S||q)},F=()=>{const n=u.current&&u.current.currentText||"",a=g();return y!=null&&!qe.focused&&!a?y:n},H=()=>t.required!==void 0?t.required:!1,V=()=>{const n=g()||t.value,a=oe,I=se,T=N.isInRange(n,a,I)&&_e.isInTimeRange(n,ce,de),S=j!==void 0,q=(!H()||n!=null)&&T,Ve=t.valid!==void 0?t.valid:q;return{customError:S,rangeOverflow:n&&I.getTime()<n.getTime()||!1,rangeUnderflow:n&&n.getTime()<a.getTime()||!1,valid:Ve,valueMissing:n===null}},Oe=()=>{o.current&&o.current.focus()},z=()=>new je.DateInputIntl(E),x=()=>{const n=g();return{format:k,steps:t.steps,formatPlaceholder:le,placeholder:y,selectPreviousSegmentOnBackspace:!0,value:t.value||n,intlService:z(),autoFill:t.autoFill!==void 0?t.autoFill:!1,enableMouseWheel:me,autoCorrectParts:ge,autoSwitchParts:ve,autoSwitchKeys:t.autoSwitchKeys||[],twoDigitYearMax:ye,allowCaretMode:be}},Ee=n=>{d.current&&d.current.classList.add("k-focus"),J({focused:!0})},Ce=n=>{d.current&&d.current.classList.remove("k-focus"),J({focused:!1})},Re=(n,a)=>typeof n!=typeof a?!0:typeof n=="string"&&typeof a=="string"?n!==a:typeof n=="object"&&typeof a=="object"?JSON.stringify(n)!==JSON.stringify(a):!1,xe=n=>typeof n=="string"?n:{inputFormat:n,displayFormat:n},U=n=>{P.current=g(),ke(),v.current=n,P.current=void 0},W=n=>{t.onChange&&t.onChange(n)},K=n=>{l.getActiveElement(document)===o.current&&n.preventDefault()},Me=()=>new Ne.DateInput(o.current,{...x(),format:xe(x().format),events:{focus:Ee,blur:Ce,valueChange:U,click:W}}),Y=()=>{o.current&&o.current.setCustomValidity&&o.current.setCustomValidity(V().valid?"":j||i.validationMessage)},we=n=>{!o.current||!u.current||U(n)},Pe=n=>{n.preventDefault();const a=l.getActiveElement(document);o.current&&a!==o.current&&o.current.focus({preventScroll:!0})},f=n=>{const a=g();v.current&&t.onChange&&!O.isEqual(v.current.oldValue,a)&&t.onChange.call(void 0,{syntheticEvent:n,nativeEvent:v.current.event,value:v.current.value,target:M.current}),v.current=null},Te=n=>{var a;(a=u.current)==null||a.modifyDateSegmentValue(1),f(n)},Se=n=>{var a;(a=u.current)==null||a.modifyDateSegmentValue(-1),f(n)},M=r.useRef(null),o=r.useRef(null),d=r.useRef(null);r.useImperativeHandle(M,()=>({props:t,get options(){return x()},get text(){return F()},get element(){return o.current},get name(){return t.name},get value(){return g()},get validity(){return V()},focus:Oe,updateOnPaste:we})),r.useImperativeHandle(b,()=>M.current);const u=r.useRef(null),w=r.useRef(null),L=r.useRef(!1),P=r.useRef(null),v=r.useRef(null),h=r.useRef(t),[qe,J]=r.useState({focused:!1}),[,ke]=r.useReducer(n=>n+1,0);r.useLayoutEffect(()=>{L.current||(u.current=Me(),w.current=u.current.dateObject,L.current=!0)},[]),r.useEffect(()=>(Y(),L.current||d.current&&d.current.addEventListener("wheel",K,{passive:!1}),()=>{d.current&&d.current.removeEventListener("wheel",K)}),[]),r.useEffect(()=>{Y(),u.current&&((Re(h.current.format,k)||h.current.readonly!==t.readonly||h.current.steps!==t.steps||z().locale!==u.current.options.intlService.locale)&&u.current.setOptions(x(),!0),h.current.value!==t.value&&(w.current.getValue()!==null||Ie()&&t.value!==null)&&w.current.setValue(t.value),t.ariaExpanded!==void 0&&t.ariaExpanded&&(u.current.options.placeholder=null),t.ariaExpanded!==void 0&&!t.ariaExpanded&&(u.current.options.placeholder=y),u.current.refreshElementValue(),h.current={format:k,readonly:t.readonly,ariaExpanded:t.ariaExpanded,steps:t.steps,value:t.value})});const X=t.id||m+"-accessibility-id",D=B&&B.uDateInput,$=F(),p=!fe||V().valid;t._ref&&(t._ref.current=M.current);const G=r.createElement("span",{ref:n=>d.current=n,style:t.label?void 0:{width:t.width},dir:t.dir,className:l.classNames(l.uDateInput.wrapper({c:D,size:ae,fillMode:ie,rounded:re,disabled:R,required:H(),invalid:!p}),t.className)},r.createElement("input",{ref:n=>o.current=n,role:t.ariaRole||"textbox",readOnly:t.readonly,tabIndex:t.tabIndex||0,disabled:R,title:t.title!==void 0?t.title:$,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:De,className:l.classNames(l.uDateInput.inputInner({c:D})),id:X,value:$,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledBy,"aria-describedby":t.ariaDescribedBy,"aria-haspopup":he,"aria-disabled":R,"aria-expanded":t.ariaExpanded,"aria-controls":t.ariaControls,"aria-required":t.required,"aria-invalid":!p,onKeyDown:f,onChange:f,onWheel:f,onInput:f,onClick:f,name:t.name,...t.inputAttributes}),t.children,t.clearButton&&t.value&&r.createElement(Be,{onClick:W,key:"clearbutton"}),ue&&r.createElement("span",{className:l.classNames(l.uDateInput.inputSpinner({c:D})),onMouseDown:Pe},r.createElement(Q.Button,{tabIndex:-1,type:"button",rounded:null,className:l.classNames(l.uDateInput.spinnerIncrease({c:D})),icon:"caret-alt-up",svgIcon:ee.caretAltUpIcon,"aria-label":C.toLanguageString(s.increaseValue,s.messages[s.increaseValue]),title:C.toLanguageString(s.increaseValue,s.messages[s.increaseValue]),onClick:Te}),r.createElement(Q.Button,{tabIndex:-1,type:"button",rounded:null,className:l.classNames(l.uDateInput.spinnerDecrease({c:D})),icon:"caret-alt-down",svgIcon:ee.caretAltDownIcon,"aria-label":C.toLanguageString(s.decreaseValue,s.messages[s.decreaseValue]),title:C.toLanguageString(s.decreaseValue,s.messages[s.decreaseValue]),onClick:Se})));return t.label?r.createElement(pe.FloatingLabel,{label:t.label,editorId:X,editorValue:(Z=o.current)==null?void 0:Z.value,editorValid:p,editorDisabled:R,children:G,style:{width:t.width}}):G});_.propTypes={value:e.instanceOf(Date),format:e.oneOfType([c.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([e.oneOf(["wide","narrow","short","formatPattern"]).isRequired,e.shape({year:e.string.isRequired,month:e.string.isRequired,day:e.string.isRequired,hour:e.string.isRequired,minute:e.string.isRequired,second:e.string.isRequired})]),width:e.oneOfType([e.string,e.number]),tabIndex:e.number,title:e.string,steps:e.shape({year:c.nullable(e.number),month:c.nullable(e.number),day:c.nullable(e.number),hour:c.nullable(e.number),minute:c.nullable(e.number),second:c.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 i={format:N.DEFAULT_FORMAT,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:N.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:O.cloneDate(c.MAX_DATE),min:O.cloneDate(c.MIN_DATE),minTime:O.cloneDate(c.MIN_TIME),maxTime:O.cloneDate(c.MAX_TIME),validityStyles:!0,validationMessage:He,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1},A=l.createPropsContext();_.displayName="KendoReactDateInput";exports.DateInput=_;exports.DateInputPropsContext=A;exports.dateInputDefaultProps=i;
8
+ "use client";"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"),l=require("@progress/kendo-react-common"),Le=require("@progress/kendo-react-labels"),pe=require("@progress/kendo-dateinputs-common"),k=require("./utils.js"),Ne=require("../package-metadata.js"),c=require("../utils.js"),s=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!",L=a.forwardRef((t,b)=>{var J;l.validatePackage(Ne.packageMetadata);const m=l.useId(t.id),O=Z.useInternationalization(),E=Z.useLocalization(),Q=l.useUnstyled(),p=l.usePropsContext(V,t).unstyled||Q,{format:w=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:ie=r.min,max:le=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}=l.usePropsContext(V,t),g=()=>M.current!==void 0?M.current:u.current&&u.current.value,A=()=>{const n=u.current&&u.current.currentText||"",i=g();return y!=null&&!we.focused&&!i?y:n},_=()=>t.required!==void 0?t.required:!1,P=()=>{const n=g()||t.value,i=ie,X=le,Te=k.isInRange(n,i,X)&&Ae.isInTimeRange(n,ue,oe),qe=N!==void 0,Se=(!_()||n!=null)&&Te,ke=t.valid!==void 0?t.valid:Se;return{customError:qe,rangeOverflow:n&&X.getTime()<n.getTime()||!1,rangeUnderflow:n&&n.getTime()<i.getTime()||!1,valid:ke,valueMissing:n===null}},ye=()=>{o.current&&o.current.focus()},B=()=>new Be.DateInputIntl(O),R=()=>{const n=g();return{format:w,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,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,Oe=n=>typeof n=="string"?n:{inputFormat:n,displayFormat:n},j=n=>{M.current=g(),Pe(),v.current=n,M.current=void 0},F=n=>{t.onChange&&t.onChange(n)},H=n=>{l.getActiveElement(document)===o.current&&n.preventDefault()},Ee=()=>new pe.DateInput(o.current,{...R(),format:Oe(R().format),events:{focus:he,blur:De,valueChange:j,click:F}}),z=()=>{o.current&&o.current.setCustomValidity&&o.current.setCustomValidity(P().valid?"":N||r.validationMessage)},Ce=n=>{!o.current||!u.current||j(n)},Re=n=>{n.preventDefault();const i=l.getActiveElement(document);o.current&&i!==o.current&&o.current.focus({preventScroll:!0})},f=n=>{const i=g();v.current&&t.onChange&&!I.isEqual(v.current.oldValue,i)&&t.onChange.call(void 0,{syntheticEvent:n,nativeEvent:v.current.event,value:v.current.value,target:x.current}),v.current=null},xe=n=>{var i;(i=u.current)==null||i.modifyDateSegmentValue(1),f(n)},Me=n=>{var i;(i=u.current)==null||i.modifyDateSegmentValue(-1),f(n)},x=a.useRef(null),o=a.useRef(null),d=a.useRef(null);a.useImperativeHandle(x,()=>({props:t,get options(){return R()},get text(){return A()},get element(){return o.current},get name(){return t.name},get value(){return g()},get validity(){return P()},focus:ye,updateOnPaste:Ce})),a.useImperativeHandle(b,()=>x.current);const u=a.useRef(null),T=a.useRef(null),q=a.useRef(!1),M=a.useRef(null),v=a.useRef(null),h=a.useRef(t),[we,U]=a.useState({focused:!1}),[,Pe]=a.useReducer(n=>n+1,0);a.useLayoutEffect(()=>{q.current||(u.current=Ee(),T.current=u.current.dateObject,q.current=!0)},[]),a.useEffect(()=>(z(),q.current||d.current&&d.current.addEventListener("wheel",H,{passive:!1}),()=>{d.current&&d.current.removeEventListener("wheel",H)}),[]),a.useEffect(()=>{z(),u.current&&((Ie(h.current.format,w)||h.current.readonly!==t.readonly||h.current.steps!==t.steps||B().locale!==u.current.options.intlService.locale)&&u.current.setOptions(R(),!0),h.current.value!==t.value&&(T.current.getValue()!==null||t.value!==null)&&T.current.setValue(t.value),t.ariaExpanded!==void 0&&t.ariaExpanded&&(u.current.options.placeholder=null),t.ariaExpanded!==void 0&&!t.ariaExpanded&&(u.current.options.placeholder=y),u.current.refreshElementValue(),h.current={format:w,readonly:t.readonly,ariaExpanded:t.ariaExpanded,steps:t.steps,value:t.value})});const W=t.id||m+"-accessibility-id",D=p&&p.uDateInput,K=A(),S=!se||P().valid;t._ref&&(t._ref.current=x.current);const Y=a.createElement("span",{ref:n=>d.current=n,style:t.label?void 0:{width:t.width},dir:t.dir,className:l.classNames(l.uDateInput.wrapper({c:D,size:ee,fillMode:ne,rounded:te,disabled:C,required:_(),invalid:!S}),t.className)},a.createElement("input",{ref:n=>o.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:l.classNames(l.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":!S,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:l.classNames(l.uDateInput.inputSpinner({c:D})),onMouseDown:Re},a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:l.classNames(l.uDateInput.spinnerIncrease({c:D})),icon:"caret-alt-up",svgIcon:G.caretAltUpIcon,"aria-label":E.toLanguageString(s.increaseValue,s.messages[s.increaseValue]),title:E.toLanguageString(s.increaseValue,s.messages[s.increaseValue]),onClick:xe}),a.createElement($.Button,{tabIndex:-1,type:"button",rounded:null,className:l.classNames(l.uDateInput.spinnerDecrease({c:D})),icon:"caret-alt-down",svgIcon:G.caretAltDownIcon,"aria-label":E.toLanguageString(s.decreaseValue,s.messages[s.decreaseValue]),title:E.toLanguageString(s.decreaseValue,s.messages[s.decreaseValue]),onClick:Me})));return t.label?a.createElement(Le.FloatingLabel,{label:t.label,editorId:W,editorValue:(J=o.current)==null?void 0:J.value,editorValid:S,editorDisabled:C,children:Y,style:{width:t.width}}):Y});L.propTypes={value:e.instanceOf(Date),format:e.oneOfType([c.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([e.oneOf(["wide","narrow","short","formatPattern"]).isRequired,e.shape({year:e.string.isRequired,month:e.string.isRequired,day:e.string.isRequired,hour:e.string.isRequired,minute:e.string.isRequired,second:e.string.isRequired})]),width:e.oneOfType([e.string,e.number]),tabIndex:e.number,title:e.string,steps:e.shape({year:c.nullable(e.number),month:c.nullable(e.number),day:c.nullable(e.number),hour:c.nullable(e.number),minute:c.nullable(e.number),second:c.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:k.DEFAULT_FORMAT,size:"medium",rounded:"medium",fillMode:"solid",formatPlaceholder:k.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:I.cloneDate(c.MAX_DATE),min:I.cloneDate(c.MIN_DATE),minTime:I.cloneDate(c.MIN_TIME),maxTime:I.cloneDate(c.MAX_TIME),validityStyles:!0,validationMessage:Fe,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1},V=l.createPropsContext();L.displayName="KendoReactDateInput";exports.DateInput=L;exports.DateInputPropsContext=V;exports.dateInputDefaultProps=r;
@@ -6,130 +6,127 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as r from "react";
9
+ import * as a from "react";
10
10
  import e from "prop-types";
11
- import { cloneDate as T, isEqual as qe } from "@progress/kendo-date-math";
12
- import { Button as G } from "@progress/kendo-react-buttons";
13
- import { caretAltUpIcon as Ne, caretAltDownIcon as _e } from "@progress/kendo-svg-icons";
14
- import { useInternationalization as Fe, useLocalization as Be } from "@progress/kendo-react-intl";
15
- import { validatePackage as He, useId as ze, useUnstyled as Ue, usePropsContext as Z, classNames as b, uDateInput as h, createPropsContext as We, getActiveElement as $ } from "@progress/kendo-react-common";
16
- import { FloatingLabel as je } from "@progress/kendo-react-labels";
17
- import { DateInput as Ke } from "@progress/kendo-dateinputs-common";
18
- import { DEFAULT_FORMAT as Ye, DEFAULT_FORMAT_PLACEHOLDER as Je, isInRange as Xe } from "./utils.mjs";
19
- import { packageMetadata as Ge } from "../package-metadata.mjs";
20
- import { nullable as c, MAX_DATE as Ze, MIN_DATE as $e, MIN_TIME as Qe, MAX_TIME as et } from "../utils.mjs";
21
- import { increaseValue as P, messages as S, decreaseValue as k } from "../messages/index.mjs";
22
- import { isInTimeRange as tt } from "../timepicker/utils.mjs";
23
- import nt from "../common/ClearButton.mjs";
24
- import { DateInputIntl as at } from "./dateInputIntl.mjs";
25
- const rt = "Please enter a valid value!", ee = r.forwardRef((t, te) => {
26
- var X;
27
- He(Ge);
28
- const ne = ze(t.id), ae = Fe(), E = Be(), re = Ue(), q = Z(Q, t).unstyled || re, {
29
- format: L = i.format,
30
- size: ie = i.size,
31
- rounded: oe = i.rounded,
32
- fillMode: le = i.fillMode,
33
- formatPlaceholder: ue = i.formatPlaceholder,
34
- spinners: se = i.spinners,
35
- disabled: I = i.disabled,
36
- min: ce = i.min,
37
- max: de = i.max,
38
- minTime: me = i.minTime,
39
- maxTime: fe = i.maxTime,
40
- validityStyles: ge = i.validityStyles,
41
- validationMessage: N = i.validationMessage,
42
- placeholder: f = i.placeholder,
43
- enableMouseWheel: ve = i.enableMouseWheel,
44
- autoCorrectParts: ye = i.autoCorrectParts,
45
- autoSwitchParts: be = i.autoSwitchParts,
46
- allowCaretMode: he = i.allowCaretMode,
47
- twoDigitYearMax: Ee = i.twoDigitYearMax,
48
- ariaHasPopup: Ie = i.ariaHasPopup,
49
- autoFocus: Oe = i.autoFocus
50
- } = Z(Q, t), d = () => C.current !== void 0 ? C.current : o.current && o.current.value, De = () => {
51
- const { year: n, month: a, day: y, hours: R, minutes: w, seconds: M } = x.current;
52
- return (!n || !a || !y || !R || !w || !M) && (n || a || y || R || w || M);
53
- }, _ = () => {
54
- const n = o.current && o.current.currentText || "", a = d();
55
- return f != null && !pe.focused && !a ? f : n;
56
- }, F = () => t.required !== void 0 ? t.required : !1, p = () => {
57
- const n = d() || t.value, a = ce, y = de, R = Xe(n, a, y) && tt(n, me, fe), w = N !== void 0, M = (!F() || n != null) && R, Ve = t.valid !== void 0 ? t.valid : M;
11
+ import { cloneDate as x, isEqual as Ve } from "@progress/kendo-date-math";
12
+ import { Button as Y } from "@progress/kendo-react-buttons";
13
+ import { caretAltUpIcon as qe, caretAltDownIcon as Ne } from "@progress/kendo-svg-icons";
14
+ import { useInternationalization as _e, useLocalization as Fe } from "@progress/kendo-react-intl";
15
+ import { validatePackage as Be, useId as He, useUnstyled as ze, usePropsContext as J, classNames as y, uDateInput as b, createPropsContext as Ue, getActiveElement as X } from "@progress/kendo-react-common";
16
+ import { FloatingLabel as We } from "@progress/kendo-react-labels";
17
+ import { DateInput as je } from "@progress/kendo-dateinputs-common";
18
+ import { DEFAULT_FORMAT as Ke, DEFAULT_FORMAT_PLACEHOLDER as Ye, isInRange as Je } from "./utils.mjs";
19
+ import { packageMetadata as Xe } from "../package-metadata.mjs";
20
+ import { nullable as c, MAX_DATE as Ge, MIN_DATE as Ze, MIN_TIME as $e, MAX_TIME as Qe } from "../utils.mjs";
21
+ import { increaseValue as C, messages as R, decreaseValue as w } from "../messages/index.mjs";
22
+ import { isInTimeRange as et } from "../timepicker/utils.mjs";
23
+ import tt from "../common/ClearButton.mjs";
24
+ import { DateInputIntl as nt } from "./dateInputIntl.mjs";
25
+ const at = "Please enter a valid value!", Z = a.forwardRef((t, $) => {
26
+ var j;
27
+ Be(Xe);
28
+ const Q = He(t.id), ee = _e(), h = Fe(), te = ze(), L = J(G, t).unstyled || te, {
29
+ format: M = r.format,
30
+ size: ne = r.size,
31
+ rounded: ae = r.rounded,
32
+ fillMode: re = r.fillMode,
33
+ formatPlaceholder: ie = r.formatPlaceholder,
34
+ spinners: le = r.spinners,
35
+ disabled: E = r.disabled,
36
+ min: oe = r.min,
37
+ max: ue = r.max,
38
+ minTime: se = r.minTime,
39
+ maxTime: ce = r.maxTime,
40
+ validityStyles: de = r.validityStyles,
41
+ validationMessage: p = r.validationMessage,
42
+ placeholder: f = r.placeholder,
43
+ enableMouseWheel: me = r.enableMouseWheel,
44
+ autoCorrectParts: fe = r.autoCorrectParts,
45
+ autoSwitchParts: ge = r.autoSwitchParts,
46
+ allowCaretMode: ve = r.allowCaretMode,
47
+ twoDigitYearMax: ye = r.twoDigitYearMax,
48
+ ariaHasPopup: be = r.ariaHasPopup,
49
+ autoFocus: he = r.autoFocus
50
+ } = J(G, t), d = () => I.current !== void 0 ? I.current : l.current && l.current.value, A = () => {
51
+ const n = l.current && l.current.currentText || "", i = d();
52
+ return f != null && !Pe.focused && !i ? f : n;
53
+ }, V = () => t.required !== void 0 ? t.required : !1, T = () => {
54
+ const n = d() || t.value, i = oe, K = ue, ke = Je(n, i, K) && et(n, se, ce), Le = p !== void 0, pe = (!V() || n != null) && ke, Ae = t.valid !== void 0 ? t.valid : pe;
58
55
  return {
59
- customError: w,
60
- rangeOverflow: n && y.getTime() < n.getTime() || !1,
61
- rangeUnderflow: n && n.getTime() < a.getTime() || !1,
62
- valid: Ve,
56
+ customError: Le,
57
+ rangeOverflow: n && K.getTime() < n.getTime() || !1,
58
+ rangeUnderflow: n && n.getTime() < i.getTime() || !1,
59
+ valid: Ae,
63
60
  valueMissing: n === null
64
61
  };
65
- }, xe = () => {
66
- l.current && l.current.focus();
67
- }, B = () => new at(ae), O = () => {
62
+ }, Ee = () => {
63
+ o.current && o.current.focus();
64
+ }, q = () => new nt(ee), O = () => {
68
65
  const n = d();
69
66
  return {
70
- format: L,
67
+ format: M,
71
68
  steps: t.steps,
72
- formatPlaceholder: ue,
69
+ formatPlaceholder: ie,
73
70
  placeholder: f,
74
71
  selectPreviousSegmentOnBackspace: !0,
75
72
  value: t.value || n,
76
- intlService: B(),
73
+ intlService: q(),
77
74
  autoFill: t.autoFill !== void 0 ? t.autoFill : !1,
78
- enableMouseWheel: ve,
79
- autoCorrectParts: ye,
80
- autoSwitchParts: be,
75
+ enableMouseWheel: me,
76
+ autoCorrectParts: fe,
77
+ autoSwitchParts: ge,
81
78
  autoSwitchKeys: t.autoSwitchKeys || [],
82
- twoDigitYearMax: Ee,
83
- allowCaretMode: he
79
+ twoDigitYearMax: ye,
80
+ allowCaretMode: ve
84
81
  };
85
- }, Ce = (n) => {
86
- u.current && u.current.classList.add("k-focus"), j({ focused: !0 });
87
- }, Re = (n) => {
88
- u.current && u.current.classList.remove("k-focus"), j({ focused: !1 });
89
- }, we = (n, a) => typeof n != typeof a ? !0 : typeof n == "string" && typeof a == "string" ? n !== a : typeof n == "object" && typeof a == "object" ? JSON.stringify(n) !== JSON.stringify(a) : !1, Me = (n) => typeof n == "string" ? n : {
82
+ }, Oe = (n) => {
83
+ u.current && u.current.classList.add("k-focus"), H({ focused: !0 });
84
+ }, De = (n) => {
85
+ u.current && u.current.classList.remove("k-focus"), H({ focused: !1 });
86
+ }, Ie = (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 : {
90
87
  inputFormat: n,
91
88
  displayFormat: n
92
- }, H = (n) => {
93
- C.current = d(), Ae(), m.current = n, C.current = void 0;
94
- }, z = (n) => {
89
+ }, N = (n) => {
90
+ I.current = d(), Se(), m.current = n, I.current = void 0;
91
+ }, _ = (n) => {
95
92
  t.onChange && t.onChange(n);
96
- }, U = (n) => {
97
- $(document) === l.current && n.preventDefault();
98
- }, Te = () => new Ke(l.current, {
93
+ }, F = (n) => {
94
+ X(document) === o.current && n.preventDefault();
95
+ }, Ce = () => new je(o.current, {
99
96
  ...O(),
100
- format: Me(O().format),
97
+ format: xe(O().format),
101
98
  events: {
102
- focus: Ce,
103
- blur: Re,
104
- valueChange: H,
105
- click: z
99
+ focus: Oe,
100
+ blur: De,
101
+ valueChange: N,
102
+ click: _
106
103
  }
107
- }), W = () => {
108
- l.current && l.current.setCustomValidity && l.current.setCustomValidity(
109
- p().valid ? "" : N || i.validationMessage
104
+ }), B = () => {
105
+ o.current && o.current.setCustomValidity && o.current.setCustomValidity(
106
+ T().valid ? "" : p || r.validationMessage
110
107
  );
111
- }, Pe = (n) => {
112
- !l.current || !o.current || H(n);
113
- }, Se = (n) => {
108
+ }, Re = (n) => {
109
+ !o.current || !l.current || N(n);
110
+ }, we = (n) => {
114
111
  n.preventDefault();
115
- const a = $(document);
116
- l.current && a !== l.current && l.current.focus({ preventScroll: !0 });
112
+ const i = X(document);
113
+ o.current && i !== o.current && o.current.focus({ preventScroll: !0 });
117
114
  }, s = (n) => {
118
- const a = d();
119
- m.current && t.onChange && !qe(m.current.oldValue, a) && t.onChange.call(void 0, {
115
+ const i = d();
116
+ m.current && t.onChange && !Ve(m.current.oldValue, i) && t.onChange.call(void 0, {
120
117
  syntheticEvent: n,
121
118
  nativeEvent: m.current.event,
122
119
  value: m.current.value,
123
120
  target: D.current
124
121
  }), m.current = null;
125
- }, ke = (n) => {
126
- var a;
127
- (a = o.current) == null || a.modifyDateSegmentValue(1), s(n);
128
- }, Le = (n) => {
129
- var a;
130
- (a = o.current) == null || a.modifyDateSegmentValue(-1), s(n);
131
- }, D = r.useRef(null), l = r.useRef(null), u = r.useRef(null);
132
- r.useImperativeHandle(
122
+ }, Me = (n) => {
123
+ var i;
124
+ (i = l.current) == null || i.modifyDateSegmentValue(1), s(n);
125
+ }, Te = (n) => {
126
+ var i;
127
+ (i = l.current) == null || i.modifyDateSegmentValue(-1), s(n);
128
+ }, D = a.useRef(null), o = a.useRef(null), u = a.useRef(null);
129
+ a.useImperativeHandle(
133
130
  D,
134
131
  () => ({
135
132
  props: t,
@@ -137,10 +134,10 @@ const rt = "Please enter a valid value!", ee = r.forwardRef((t, te) => {
137
134
  return O();
138
135
  },
139
136
  get text() {
140
- return _();
137
+ return A();
141
138
  },
142
139
  get element() {
143
- return l.current;
140
+ return o.current;
144
141
  },
145
142
  get name() {
146
143
  return t.name;
@@ -149,74 +146,74 @@ const rt = "Please enter a valid value!", ee = r.forwardRef((t, te) => {
149
146
  return d();
150
147
  },
151
148
  get validity() {
152
- return p();
149
+ return T();
153
150
  },
154
151
  // hidden methods
155
- focus: xe,
156
- updateOnPaste: Pe
152
+ focus: Ee,
153
+ updateOnPaste: Re
157
154
  })
158
- ), r.useImperativeHandle(te, () => D.current);
159
- const o = r.useRef(null), x = r.useRef(null), A = r.useRef(!1), C = r.useRef(null), m = r.useRef(null), g = r.useRef(t), [pe, j] = r.useState({ focused: !1 }), [, Ae] = r.useReducer((n) => n + 1, 0);
160
- r.useLayoutEffect(() => {
161
- A.current || (o.current = Te(), x.current = o.current.dateObject, A.current = !0);
162
- }, []), r.useEffect(() => (W(), A.current || u.current && u.current.addEventListener("wheel", U, { passive: !1 }), () => {
163
- u.current && u.current.removeEventListener("wheel", U);
164
- }), []), r.useEffect(() => {
165
- W(), o.current && ((we(g.current.format, L) || g.current.readonly !== t.readonly || g.current.steps !== t.steps || B().locale !== o.current.options.intlService.locale) && o.current.setOptions(O(), !0), g.current.value !== t.value && (x.current.getValue() !== null || De() && t.value !== null) && x.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 = f), o.current.refreshElementValue(), g.current = {
166
- format: L,
155
+ ), a.useImperativeHandle($, () => D.current);
156
+ const l = a.useRef(null), P = a.useRef(null), S = a.useRef(!1), I = a.useRef(null), m = a.useRef(null), g = a.useRef(t), [Pe, H] = a.useState({ focused: !1 }), [, Se] = a.useReducer((n) => n + 1, 0);
157
+ a.useLayoutEffect(() => {
158
+ S.current || (l.current = Ce(), P.current = l.current.dateObject, S.current = !0);
159
+ }, []), a.useEffect(() => (B(), S.current || u.current && u.current.addEventListener("wheel", F, { passive: !1 }), () => {
160
+ u.current && u.current.removeEventListener("wheel", F);
161
+ }), []), a.useEffect(() => {
162
+ B(), l.current && ((Ie(g.current.format, M) || g.current.readonly !== t.readonly || g.current.steps !== t.steps || q().locale !== l.current.options.intlService.locale) && l.current.setOptions(O(), !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 = {
163
+ format: M,
167
164
  readonly: t.readonly,
168
165
  ariaExpanded: t.ariaExpanded,
169
166
  steps: t.steps,
170
167
  value: t.value
171
168
  });
172
169
  });
173
- const K = t.id || ne + "-accessibility-id", v = q && q.uDateInput, Y = _(), V = !ge || p().valid;
170
+ const z = t.id || Q + "-accessibility-id", v = L && L.uDateInput, U = A(), k = !de || T().valid;
174
171
  t._ref && (t._ref.current = D.current);
175
- const J = /* @__PURE__ */ r.createElement(
172
+ const W = /* @__PURE__ */ a.createElement(
176
173
  "span",
177
174
  {
178
175
  ref: (n) => u.current = n,
179
176
  style: t.label ? void 0 : { width: t.width },
180
177
  dir: t.dir,
181
- className: b(
182
- h.wrapper({
178
+ className: y(
179
+ b.wrapper({
183
180
  c: v,
184
- size: ie,
185
- fillMode: le,
186
- rounded: oe,
187
- disabled: I,
188
- required: F(),
189
- invalid: !V
181
+ size: ne,
182
+ fillMode: re,
183
+ rounded: ae,
184
+ disabled: E,
185
+ required: V(),
186
+ invalid: !k
190
187
  }),
191
188
  t.className
192
189
  )
193
190
  },
194
- /* @__PURE__ */ r.createElement(
191
+ /* @__PURE__ */ a.createElement(
195
192
  "input",
196
193
  {
197
- ref: (n) => l.current = n,
194
+ ref: (n) => o.current = n,
198
195
  role: t.ariaRole || "textbox",
199
196
  readOnly: t.readonly,
200
197
  tabIndex: t.tabIndex || 0,
201
- disabled: I,
202
- title: t.title !== void 0 ? t.title : Y,
198
+ disabled: E,
199
+ title: t.title !== void 0 ? t.title : U,
203
200
  type: "text",
204
201
  spellCheck: !1,
205
202
  autoComplete: "off",
206
203
  autoCorrect: "off",
207
- autoFocus: Oe,
208
- className: b(h.inputInner({ c: v })),
209
- id: K,
210
- value: Y,
204
+ autoFocus: he,
205
+ className: y(b.inputInner({ c: v })),
206
+ id: z,
207
+ value: U,
211
208
  "aria-label": t.ariaLabel,
212
209
  "aria-labelledby": t.ariaLabelledBy,
213
210
  "aria-describedby": t.ariaDescribedBy,
214
- "aria-haspopup": Ie,
215
- "aria-disabled": I,
211
+ "aria-haspopup": be,
212
+ "aria-disabled": E,
216
213
  "aria-expanded": t.ariaExpanded,
217
214
  "aria-controls": t.ariaControls,
218
215
  "aria-required": t.required,
219
- "aria-invalid": !V,
216
+ "aria-invalid": !k,
220
217
  onKeyDown: s,
221
218
  onChange: s,
222
219
  onWheel: s,
@@ -227,49 +224,49 @@ const rt = "Please enter a valid value!", ee = r.forwardRef((t, te) => {
227
224
  }
228
225
  ),
229
226
  t.children,
230
- t.clearButton && t.value && /* @__PURE__ */ r.createElement(nt, { onClick: z, key: "clearbutton" }),
231
- se && /* @__PURE__ */ r.createElement("span", { className: b(h.inputSpinner({ c: v })), onMouseDown: Se }, /* @__PURE__ */ r.createElement(
232
- G,
227
+ t.clearButton && t.value && /* @__PURE__ */ a.createElement(tt, { onClick: _, key: "clearbutton" }),
228
+ le && /* @__PURE__ */ a.createElement("span", { className: y(b.inputSpinner({ c: v })), onMouseDown: we }, /* @__PURE__ */ a.createElement(
229
+ Y,
233
230
  {
234
231
  tabIndex: -1,
235
232
  type: "button",
236
233
  rounded: null,
237
- className: b(h.spinnerIncrease({ c: v })),
234
+ className: y(b.spinnerIncrease({ c: v })),
238
235
  icon: "caret-alt-up",
239
- svgIcon: Ne,
240
- "aria-label": E.toLanguageString(P, S[P]),
241
- title: E.toLanguageString(P, S[P]),
242
- onClick: ke
236
+ svgIcon: qe,
237
+ "aria-label": h.toLanguageString(C, R[C]),
238
+ title: h.toLanguageString(C, R[C]),
239
+ onClick: Me
243
240
  }
244
- ), /* @__PURE__ */ r.createElement(
245
- G,
241
+ ), /* @__PURE__ */ a.createElement(
242
+ Y,
246
243
  {
247
244
  tabIndex: -1,
248
245
  type: "button",
249
246
  rounded: null,
250
- className: b(h.spinnerDecrease({ c: v })),
247
+ className: y(b.spinnerDecrease({ c: v })),
251
248
  icon: "caret-alt-down",
252
- svgIcon: _e,
253
- "aria-label": E.toLanguageString(k, S[k]),
254
- title: E.toLanguageString(k, S[k]),
255
- onClick: Le
249
+ svgIcon: Ne,
250
+ "aria-label": h.toLanguageString(w, R[w]),
251
+ title: h.toLanguageString(w, R[w]),
252
+ onClick: Te
256
253
  }
257
254
  ))
258
255
  );
259
- return t.label ? /* @__PURE__ */ r.createElement(
260
- je,
256
+ return t.label ? /* @__PURE__ */ a.createElement(
257
+ We,
261
258
  {
262
259
  label: t.label,
263
- editorId: K,
264
- editorValue: (X = l.current) == null ? void 0 : X.value,
265
- editorValid: V,
266
- editorDisabled: I,
267
- children: J,
260
+ editorId: z,
261
+ editorValue: (j = o.current) == null ? void 0 : j.value,
262
+ editorValid: k,
263
+ editorDisabled: E,
264
+ children: W,
268
265
  style: { width: t.width }
269
266
  }
270
- ) : J;
267
+ ) : W;
271
268
  });
272
- ee.propTypes = {
269
+ Z.propTypes = {
273
270
  value: e.instanceOf(Date),
274
271
  format: e.oneOfType([
275
272
  c(e.string),
@@ -340,20 +337,20 @@ ee.propTypes = {
340
337
  autoFocus: e.bool,
341
338
  inputAttributes: e.object
342
339
  };
343
- const i = {
344
- format: Ye,
340
+ const r = {
341
+ format: Ke,
345
342
  size: "medium",
346
343
  rounded: "medium",
347
344
  fillMode: "solid",
348
- formatPlaceholder: Je,
345
+ formatPlaceholder: Ye,
349
346
  spinners: !1,
350
347
  disabled: !1,
351
- max: T(Ze),
352
- min: T($e),
353
- minTime: T(Qe),
354
- maxTime: T(et),
348
+ max: x(Ge),
349
+ min: x(Ze),
350
+ minTime: x($e),
351
+ maxTime: x(Qe),
355
352
  validityStyles: !0,
356
- validationMessage: rt,
353
+ validationMessage: at,
357
354
  placeholder: null,
358
355
  enableMouseWheel: !0,
359
356
  autoCorrectParts: !0,
@@ -362,10 +359,10 @@ const i = {
362
359
  twoDigitYearMax: 68,
363
360
  ariaHasPopup: "grid",
364
361
  autoFocus: !1
365
- }, Q = We();
366
- ee.displayName = "KendoReactDateInput";
362
+ }, G = Ue();
363
+ Z.displayName = "KendoReactDateInput";
367
364
  export {
368
- ee as DateInput,
369
- Q as DateInputPropsContext,
370
- i as dateInputDefaultProps
365
+ Z as DateInput,
366
+ G as DateInputPropsContext,
367
+ r as dateInputDefaultProps
371
368
  };