@progress/kendo-react-dateinputs 13.4.0-develop.3 → 13.4.0-develop.5
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.
- package/dateinput/DateInput.d.ts +3 -2
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +1 -1
- package/datepicker/DatePicker.d.ts +3 -2
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +322 -294
- package/datetimepicker/DateTimePicker.d.ts +7 -3
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +141 -111
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/timepicker/TimePicker.d.ts +7 -3
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +171 -140
package/dateinput/DateInput.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export interface DateInputProps<T extends DateInputHandle = any> extends FormCom
|
|
|
96
96
|
* - medium
|
|
97
97
|
* - large
|
|
98
98
|
* - full
|
|
99
|
+
* - none
|
|
99
100
|
*
|
|
100
101
|
* @default undefined (theme-controlled)
|
|
101
102
|
*
|
|
@@ -104,7 +105,7 @@ export interface DateInputProps<T extends DateInputHandle = any> extends FormCom
|
|
|
104
105
|
* <DateInput rounded="full" />
|
|
105
106
|
* ```
|
|
106
107
|
*/
|
|
107
|
-
rounded?: 'small' | 'medium' | 'large' | 'full';
|
|
108
|
+
rounded?: 'small' | 'medium' | 'large' | 'full' | 'none';
|
|
108
109
|
/**
|
|
109
110
|
* Control the `fillMode` (background) of the DateInput.
|
|
110
111
|
*
|
|
@@ -177,7 +178,7 @@ export declare const DateInput: React.ForwardRefExoticComponent<DateInputProps<a
|
|
|
177
178
|
export declare const dateInputDefaultProps: {
|
|
178
179
|
format: string;
|
|
179
180
|
size: "small" | "medium" | "large" | undefined;
|
|
180
|
-
rounded: "small" | "medium" | "large" | "full" | undefined;
|
|
181
|
+
rounded: "small" | "none" | "medium" | "large" | "full" | undefined;
|
|
181
182
|
fillMode: "flat" | "solid" | "outline" | undefined;
|
|
182
183
|
formatPlaceholder: DateInputFormatPlaceholder;
|
|
183
184
|
spinners: boolean;
|
package/dateinput/DateInput.js
CHANGED
|
@@ -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"),x=require("@progress/kendo-date-math"),te=require("@progress/kendo-react-buttons"),ne=require("@progress/kendo-svg-icons"),ae=require("@progress/kendo-react-intl"),o=require("@progress/kendo-react-common"),ke=require("@progress/kendo-react-labels"),pe=require("@progress/kendo-dateinputs-common"),_=require("./utils.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 Fe(t){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const m in t)if(m!=="default"){const C=Object.getOwnPropertyDescriptor(t,m);Object.defineProperty(b,m,C.get?C:{enumerable:!0,get:()=>t[m]})}}return b.default=t,Object.freeze(b)}const a=Fe(Ve),je="Please enter a valid value!",F=a.forwardRef((t,b)=>{var ee;const m=o.useId(t.id),C=ae.useInternationalization(),E=ae.useLocalization(),re=o.useUnstyled(),j=o.usePropsContext(B,t).unstyled||re,{format:P=i.format,size:le=i.size,rounded:ie=i.rounded,fillMode:ue=i.fillMode,formatPlaceholder:oe=i.formatPlaceholder,spinners:se=i.spinners,disabled:w=i.disabled,min:ce=i.min,max:de=i.max,minTime:fe=i.minTime,maxTime:me=i.maxTime,validityStyles:ge=i.validityStyles,validationMessage:H=i.validationMessage,placeholder:y=i.placeholder,enableMouseWheel:ve=i.enableMouseWheel,autoCorrectParts:be=i.autoCorrectParts,autoSwitchParts:ye=i.autoSwitchParts,allowCaretMode:he=i.allowCaretMode,twoDigitYearMax:Ie=i.twoDigitYearMax,ariaHasPopup:Oe=i.ariaHasPopup,autoFocus:h=i.autoFocus}=o.usePropsContext(B,t),g=()=>S.current!==void 0?S.current:r.current&&r.current.value,z=()=>{const n=r.current&&r.current.currentText||"",l=g();return y!=null&&!qe.focused&&!l?y:n},U=()=>t.required!==void 0?t.required:!1,R=()=>{const n=g()||t.value,l=ce,D=de,k=_.isInRange(n,l,D)&&Ae.isInTimeRange(n,fe,me),p=H!==void 0,A=(!U()||n!=null)&&k,Ne=t.valid!==void 0?t.valid:A;return{customError:p,rangeOverflow:n&&D.getTime()<n.getTime()||!1,rangeUnderflow:n&&n.getTime()<l.getTime()||!1,valid:Ne,valueMissing:n===null}},De=()=>{s.current&&s.current.focus()},W=()=>new Be.DateInputIntl(C),T=()=>{const n=g();return{format:P,steps:t.steps,formatPlaceholder:oe,placeholder:y,selectPreviousSegmentOnBackspace:!0,value:t.value||n,intlService:W(),autoFill:t.autoFill!==void 0?t.autoFill:!1,enableMouseWheel:ve,autoCorrectParts:be,autoSwitchParts:ye,autoSwitchKeys:t.autoSwitchKeys||[],twoDigitYearMax:Ie,allowCaretMode:he}},xe=n=>{d.current&&d.current.classList.add("k-focus"),N({focused:!0}),h&&Z(!0)},Ce=n=>{d.current&&d.current.classList.remove("k-focus"),N({focused:!1})},Ee=(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,we=n=>typeof n=="string"?n:{inputFormat:n,displayFormat:n},K=n=>{S.current=g(),Le(),v.current=n,S.current=void 0},J=n=>{t.onChange&&t.onChange(n)},Y=n=>{o.getActiveElement(document)===s.current&&n.preventDefault()},Te=()=>new pe.DateInput(s.current,{...T(),format:we(T().format),events:{focus:xe,blur:Ce,valueChange:K,click:J}}),X=()=>{s.current&&s.current.setCustomValidity&&s.current.setCustomValidity(R().valid?"":H||i.validationMessage)},Z=a.useCallback(n=>{var l;if(s.current&&h&&n){const D=(r==null?void 0:r.current).currentText,k=(r==null?void 0:r.current).currentText.search(/[^a-zA-Z]/),p=D[k],A=D.split(p)[0].length;d.current&&d.current.classList.add("k-focus"),(l=r==null?void 0:r.current)==null||l.selectNearestSegment(A)}},[h]),Me=n=>{!s.current||!r.current||K(n)},Se=n=>{n.preventDefault();const l=o.getActiveElement(document);s.current&&l!==s.current&&s.current.focus({preventScroll:!0})},f=n=>{const l=g();v.current&&t.onChange&&!x.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},Pe=n=>{var l;(l=r.current)==null||l.modifyDateSegmentValue(1),f(n)},Re=n=>{var l;(l=r.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 T()},get text(){return z()},get element(){return s.current},get name(){return t.name},get value(){return g()},get validity(){return R()},focus:De,updateOnPaste:Me})),a.useImperativeHandle(b,()=>M.current);const r=a.useRef(null),q=a.useRef(null),L=a.useRef(!1),S=a.useRef(null),v=a.useRef(null),I=a.useRef(t),[qe,N]=a.useState({focused:!1}),[,Le]=a.useReducer(n=>n+1,0);a.useLayoutEffect(()=>{L.current||(r.current=Te(),q.current=r.current.dateObject,L.current=!0)},[]),a.useEffect(()=>(X(),L.current||d.current&&d.current.addEventListener("wheel",Y,{passive:!1}),h&&(N({focused:!0}),Z(!0)),()=>{d.current&&d.current.removeEventListener("wheel",Y)}),[]),a.useEffect(()=>{X(),r.current&&((Ee(I.current.format,P)||I.current.readonly!==t.readonly||JSON.stringify(I.current.steps)!==JSON.stringify(t.steps)||W().locale!==r.current.options.intlService.locale)&&r.current.setOptions(T(),!0),I.current.value!==t.value&&(q.current.getValue()!==null||t.value!==null)&&q.current.setValue(t.value),t.ariaExpanded!==void 0&&t.ariaExpanded&&(r.current.options.placeholder=null),t.ariaExpanded!==void 0&&!t.ariaExpanded&&(r.current.options.placeholder=y),r.current.refreshElementValue(),I.current={format:P,readonly:t.readonly,ariaExpanded:t.ariaExpanded,steps:t.steps,value:t.value})});const $=t.id||m+"-accessibility-id",O=j&&j.uDateInput,G=z(),V=!ge||R().valid;a.useImperativeHandle(t._ref,()=>M.current);const Q=a.createElement("span",{ref:n=>{d.current=n},style:t.label?void 0:{width:t.width},dir:t.dir,className:o.classNames(o.uDateInput.wrapper({c:O,size:le,fillMode:ue,rounded:ie,disabled:w,required:U(),invalid:!V}),t.className)},a.createElement("input",{ref:n=>{s.current=n},role:t.ariaRole||"textbox",readOnly:t.readonly,tabIndex:t.tabIndex||0,disabled:w,title:t.title!==void 0?t.title:G,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:h,className:o.classNames(o.uDateInput.inputInner({c:O})),id:$,value:G,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledBy,"aria-describedby":t.ariaDescribedBy,"aria-haspopup":Oe,"aria-disabled":w,"aria-expanded":t.ariaExpanded,"aria-controls":t.ariaControls,"aria-required":t.required,"aria-invalid":!V,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:J,key:"clearbutton"}),se&&a.createElement("span",{className:o.classNames(o.uDateInput.inputSpinner({c:O})),onMouseDown:Se},a.createElement(te.Button,{tabIndex:-1,type:"button",className:o.classNames(o.uDateInput.spinnerIncrease({c:O})),icon:"caret-alt-up",svgIcon:ne.caretAltUpIcon,"aria-label":E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),title:E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),onClick:Pe}),a.createElement(te.Button,{tabIndex:-1,type:"button",className:o.classNames(o.uDateInput.spinnerDecrease({c:O})),icon:"caret-alt-down",svgIcon:ne.caretAltDownIcon,"aria-label":E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),title:E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),onClick:Re})));return t.label?a.createElement(ke.FloatingLabel,{label:t.label,editorId:$,editorValue:(ee=s.current)==null?void 0:ee.value,editorValid:V,editorDisabled:w,children:Q,style:{width:t.width}}):Q});F.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.node,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(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full"]),fillMode:e.oneOf(["solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object};const i={format:_.DEFAULT_FORMAT,size:void 0,rounded:void 0,fillMode:void 0,formatPlaceholder:_.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:x.cloneDate(u.MAX_DATE),min:x.cloneDate(u.MIN_DATE),minTime:x.cloneDate(u.MIN_TIME),maxTime:x.cloneDate(u.MAX_TIME),validityStyles:!0,validationMessage:je,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1},B=o.createPropsContext();F.displayName="KendoReactDateInput";exports.DateInput=F;exports.DateInputPropsContext=B;exports.dateInputDefaultProps=i;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ve=require("react"),e=require("prop-types"),x=require("@progress/kendo-date-math"),te=require("@progress/kendo-react-buttons"),ne=require("@progress/kendo-svg-icons"),ae=require("@progress/kendo-react-intl"),o=require("@progress/kendo-react-common"),ke=require("@progress/kendo-react-labels"),pe=require("@progress/kendo-dateinputs-common"),_=require("./utils.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 Fe(t){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const m in t)if(m!=="default"){const C=Object.getOwnPropertyDescriptor(t,m);Object.defineProperty(b,m,C.get?C:{enumerable:!0,get:()=>t[m]})}}return b.default=t,Object.freeze(b)}const a=Fe(Ve),je="Please enter a valid value!",F=a.forwardRef((t,b)=>{var ee;const m=o.useId(t.id),C=ae.useInternationalization(),E=ae.useLocalization(),re=o.useUnstyled(),j=o.usePropsContext(B,t).unstyled||re,{format:P=i.format,size:le=i.size,rounded:ie=i.rounded,fillMode:ue=i.fillMode,formatPlaceholder:oe=i.formatPlaceholder,spinners:se=i.spinners,disabled:w=i.disabled,min:ce=i.min,max:de=i.max,minTime:fe=i.minTime,maxTime:me=i.maxTime,validityStyles:ge=i.validityStyles,validationMessage:H=i.validationMessage,placeholder:y=i.placeholder,enableMouseWheel:ve=i.enableMouseWheel,autoCorrectParts:be=i.autoCorrectParts,autoSwitchParts:ye=i.autoSwitchParts,allowCaretMode:he=i.allowCaretMode,twoDigitYearMax:Ie=i.twoDigitYearMax,ariaHasPopup:Oe=i.ariaHasPopup,autoFocus:h=i.autoFocus}=o.usePropsContext(B,t),g=()=>S.current!==void 0?S.current:r.current&&r.current.value,z=()=>{const n=r.current&&r.current.currentText||"",l=g();return y!=null&&!qe.focused&&!l?y:n},U=()=>t.required!==void 0?t.required:!1,R=()=>{const n=g()||t.value,l=ce,D=de,k=_.isInRange(n,l,D)&&Ae.isInTimeRange(n,fe,me),p=H!==void 0,A=(!U()||n!=null)&&k,Ne=t.valid!==void 0?t.valid:A;return{customError:p,rangeOverflow:n&&D.getTime()<n.getTime()||!1,rangeUnderflow:n&&n.getTime()<l.getTime()||!1,valid:Ne,valueMissing:n===null}},De=()=>{s.current&&s.current.focus()},W=()=>new Be.DateInputIntl(C),T=()=>{const n=g();return{format:P,steps:t.steps,formatPlaceholder:oe,placeholder:y,selectPreviousSegmentOnBackspace:!0,value:t.value||n,intlService:W(),autoFill:t.autoFill!==void 0?t.autoFill:!1,enableMouseWheel:ve,autoCorrectParts:be,autoSwitchParts:ye,autoSwitchKeys:t.autoSwitchKeys||[],twoDigitYearMax:Ie,allowCaretMode:he}},xe=n=>{d.current&&d.current.classList.add("k-focus"),N({focused:!0}),h&&Z(!0)},Ce=n=>{d.current&&d.current.classList.remove("k-focus"),N({focused:!1})},Ee=(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,we=n=>typeof n=="string"?n:{inputFormat:n,displayFormat:n},K=n=>{S.current=g(),Le(),v.current=n,S.current=void 0},J=n=>{t.onChange&&t.onChange(n)},Y=n=>{o.getActiveElement(document)===s.current&&n.preventDefault()},Te=()=>new pe.DateInput(s.current,{...T(),format:we(T().format),events:{focus:xe,blur:Ce,valueChange:K,click:J}}),X=()=>{s.current&&s.current.setCustomValidity&&s.current.setCustomValidity(R().valid?"":H||i.validationMessage)},Z=a.useCallback(n=>{var l;if(s.current&&h&&n){const D=(r==null?void 0:r.current).currentText,k=(r==null?void 0:r.current).currentText.search(/[^a-zA-Z]/),p=D[k],A=D.split(p)[0].length;d.current&&d.current.classList.add("k-focus"),(l=r==null?void 0:r.current)==null||l.selectNearestSegment(A)}},[h]),Me=n=>{!s.current||!r.current||K(n)},Se=n=>{n.preventDefault();const l=o.getActiveElement(document);s.current&&l!==s.current&&s.current.focus({preventScroll:!0})},f=n=>{const l=g();v.current&&t.onChange&&!x.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},Pe=n=>{var l;(l=r.current)==null||l.modifyDateSegmentValue(1),f(n)},Re=n=>{var l;(l=r.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 T()},get text(){return z()},get element(){return s.current},get name(){return t.name},get value(){return g()},get validity(){return R()},focus:De,updateOnPaste:Me})),a.useImperativeHandle(b,()=>M.current);const r=a.useRef(null),q=a.useRef(null),L=a.useRef(!1),S=a.useRef(null),v=a.useRef(null),I=a.useRef(t),[qe,N]=a.useState({focused:!1}),[,Le]=a.useReducer(n=>n+1,0);a.useLayoutEffect(()=>{L.current||(r.current=Te(),q.current=r.current.dateObject,L.current=!0)},[]),a.useEffect(()=>(X(),L.current||d.current&&d.current.addEventListener("wheel",Y,{passive:!1}),h&&(N({focused:!0}),Z(!0)),()=>{d.current&&d.current.removeEventListener("wheel",Y)}),[]),a.useEffect(()=>{X(),r.current&&((Ee(I.current.format,P)||I.current.readonly!==t.readonly||JSON.stringify(I.current.steps)!==JSON.stringify(t.steps)||W().locale!==r.current.options.intlService.locale)&&r.current.setOptions(T(),!0),I.current.value!==t.value&&(q.current.getValue()!==null||t.value!==null)&&q.current.setValue(t.value),t.ariaExpanded!==void 0&&t.ariaExpanded&&(r.current.options.placeholder=null),t.ariaExpanded!==void 0&&!t.ariaExpanded&&(r.current.options.placeholder=y),r.current.refreshElementValue(),I.current={format:P,readonly:t.readonly,ariaExpanded:t.ariaExpanded,steps:t.steps,value:t.value})});const $=t.id||m+"-accessibility-id",O=j&&j.uDateInput,G=z(),V=!ge||R().valid;a.useImperativeHandle(t._ref,()=>M.current);const Q=a.createElement("span",{ref:n=>{d.current=n},style:t.label?void 0:{width:t.width},dir:t.dir,className:o.classNames(o.uDateInput.wrapper({c:O,size:le,fillMode:ue,rounded:ie,disabled:w,required:U(),invalid:!V}),t.className)},a.createElement("input",{ref:n=>{s.current=n},role:t.ariaRole||"textbox",readOnly:t.readonly,tabIndex:t.tabIndex||0,disabled:w,title:t.title!==void 0?t.title:G,type:"text",spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:h,className:o.classNames(o.uDateInput.inputInner({c:O})),id:$,value:G,"aria-label":t.ariaLabel,"aria-labelledby":t.ariaLabelledBy,"aria-describedby":t.ariaDescribedBy,"aria-haspopup":Oe,"aria-disabled":w,"aria-expanded":t.ariaExpanded,"aria-controls":t.ariaControls,"aria-required":t.required,"aria-invalid":!V,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:J,key:"clearbutton"}),se&&a.createElement("span",{className:o.classNames(o.uDateInput.inputSpinner({c:O})),onMouseDown:Se},a.createElement(te.Button,{tabIndex:-1,type:"button",className:o.classNames(o.uDateInput.spinnerIncrease({c:O})),icon:"caret-alt-up",svgIcon:ne.caretAltUpIcon,"aria-label":E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),title:E.toLanguageString(c.increaseValue,c.messages[c.increaseValue]),onClick:Pe}),a.createElement(te.Button,{tabIndex:-1,type:"button",className:o.classNames(o.uDateInput.spinnerDecrease({c:O})),icon:"caret-alt-down",svgIcon:ne.caretAltDownIcon,"aria-label":E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),title:E.toLanguageString(c.decreaseValue,c.messages[c.decreaseValue]),onClick:Re})));return t.label?a.createElement(ke.FloatingLabel,{label:t.label,editorId:$,editorValue:(ee=s.current)==null?void 0:ee.value,editorValid:V,editorDisabled:w,children:Q,style:{width:t.width}}):Q});F.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.node,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(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full","none"]),fillMode:e.oneOf(["solid","flat","outline"]),autoFocus:e.bool,inputAttributes:e.object};const i={format:_.DEFAULT_FORMAT,size:void 0,rounded:void 0,fillMode:void 0,formatPlaceholder:_.DEFAULT_FORMAT_PLACEHOLDER,spinners:!1,disabled:!1,max:x.cloneDate(u.MAX_DATE),min:x.cloneDate(u.MIN_DATE),minTime:x.cloneDate(u.MIN_TIME),maxTime:x.cloneDate(u.MAX_TIME),validityStyles:!0,validationMessage:je,placeholder:null,enableMouseWheel:!0,autoCorrectParts:!0,autoSwitchParts:!0,allowCaretMode:!1,twoDigitYearMax:68,ariaHasPopup:"grid",autoFocus:!1},B=o.createPropsContext();F.displayName="KendoReactDateInput";exports.DateInput=F;exports.DateInputPropsContext=B;exports.dateInputDefaultProps=i;
|
package/dateinput/DateInput.mjs
CHANGED
|
@@ -342,7 +342,7 @@ ne.propTypes = {
|
|
|
342
342
|
required: e.bool,
|
|
343
343
|
valid: e.bool,
|
|
344
344
|
size: e.oneOf(["small", "medium", "large"]),
|
|
345
|
-
rounded: e.oneOf(["small", "medium", "large", "full"]),
|
|
345
|
+
rounded: e.oneOf(["small", "medium", "large", "full", "none"]),
|
|
346
346
|
fillMode: e.oneOf(["solid", "flat", "outline"]),
|
|
347
347
|
autoFocus: e.bool,
|
|
348
348
|
inputAttributes: e.object
|
|
@@ -91,6 +91,7 @@ export interface DatePickerProps extends DatePickerSettings, FormComponentProps,
|
|
|
91
91
|
* - medium
|
|
92
92
|
* - large
|
|
93
93
|
* - full
|
|
94
|
+
* - none
|
|
94
95
|
*
|
|
95
96
|
* @default undefined (theme-controlled)
|
|
96
97
|
*
|
|
@@ -99,7 +100,7 @@ export interface DatePickerProps extends DatePickerSettings, FormComponentProps,
|
|
|
99
100
|
* <DatePicker rounded="full" />
|
|
100
101
|
* ```
|
|
101
102
|
*/
|
|
102
|
-
rounded?: 'small' | 'medium' | 'large' | 'full';
|
|
103
|
+
rounded?: 'small' | 'medium' | 'large' | 'full' | 'none';
|
|
103
104
|
/**
|
|
104
105
|
* Control the `fillMode` (background) of the DatePicker.
|
|
105
106
|
*
|
|
@@ -216,7 +217,7 @@ export declare const datePickerDefaultProps: {
|
|
|
216
217
|
weekNumber: boolean;
|
|
217
218
|
validityStyles: boolean;
|
|
218
219
|
size: "small" | "medium" | "large" | undefined;
|
|
219
|
-
rounded: "small" | "medium" | "large" | "full" | undefined;
|
|
220
|
+
rounded: "small" | "none" | "medium" | "large" | "full" | undefined;
|
|
220
221
|
fillMode: "flat" | "solid" | "outline" | undefined;
|
|
221
222
|
autoFocus: boolean;
|
|
222
223
|
};
|
package/datepicker/DatePicker.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const it=require("react"),t=require("prop-types"),st=require("@progress/kendo-react-popup"),j=require("@progress/kendo-date-math"),u=require("@progress/kendo-react-common"),ct=require("@progress/kendo-svg-icons"),dt=require("../dateinput/DateInput.js"),ft=require("../calendar/components/Calendar.js"),r=require("../utils.js"),U=require("../messages/index.js"),mt=require("@progress/kendo-react-intl"),pt=require("./ToggleButton.js"),gt=require("../hooks/usePickerFloatingLabel.js"),bt=require("@progress/kendo-react-layout"),ht=require("../common/AdaptiveMode.js");function vt(a){const y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const f in a)if(f!=="default"){const S=Object.getOwnPropertyDescriptor(a,f);Object.defineProperty(y,f,S.get?S:{enumerable:!0,get:()=>a[f]})}}return y.default=a,Object.freeze(y)}const o=vt(it),H=o.forwardRef((a,y)=>{const f=u.useId(a.id),S=mt.useLocalization(),D=u.useAdaptiveModeContext(),{defaultShow:me=l.defaultShow,defaultValue:pe=l.defaultValue,dateInput:ge=l.dateInput,calendar:be=l.calendar,toggleButton:he=l.toggleButton,popup:ve=l.popup,disabled:g=l.disabled,format:we=l.format,max:C=l.max,min:k=l.min,popupSettings:P=l.popupSettings,tabIndex:ye=l.tabIndex,weekNumber:De=l.weekNumber,validityStyles:Y=l.validityStyles,size:B=l.size,rounded:E=l.rounded,fillMode:x=l.fillMode,autoFocus:Ce=l.autoFocus,show:$,autoSwitchParts:ke,autoSwitchKeys:Pe,twoDigitYearMax:Oe,ariaLabel:Me,adaptive:wt,adaptiveTitle:Re=a.label||void 0,adaptiveSubtitle:Se,formatPlaceholder:Ie,inputAttributes:_e,validationMessage:X,visited:yt,value:q,touched:Dt,modified:Ct,_adaptiveMode:kt=D,valid:Z,focusedDate:Te,id:Be,ariaLabelledBy:Ee,ariaDescribedBy:xe,placeholder:qe,onChange:G,onOpen:J,onClose:Q,...ee}=u.usePropsContext(fe,a),N=()=>{if(u.canUseDOM)return m.current&&m.current.ownerDocument||window.document},c=()=>!!(w.windowWidth&&D&&w.windowWidth<=(D==null?void 0:D.medium)&&a.adaptive),b=()=>{const e=I.current!==void 0?I.current:q!==void 0?q:w.value;return e!==null?j.cloneDate(e):null},i=()=>_.current!==void 0?_.current:$!==void 0?$:w.show,Ne=()=>ge||l.dateInput,Ae=()=>he||l.toggleButton,Fe=()=>be||l.calendar,ze=()=>ve||l.popup,te=()=>a.required!==void 0?a.required:!1,A=()=>{const e=b()||q||null,n=k,s=C,T=r.isInDateRange(e,n,s),L=X!==void 0,V=(!te()||e!=null)&&T,W=Z!==void 0?Z:V;return{customError:L,rangeOverflow:e&&s.getTime()<e.getTime()||!1,rangeUnderflow:e&&e.getTime()<n.getTime()||!1,valid:W,valueMissing:e===null}},Ke=e=>{for(const n of e)R({windowWidth:n.target.clientWidth})},Le=()=>{d.current&&d.current.focus()},ne=e=>{p.current=e},h=e=>{i()!==e&&(R({show:e}),e&&J&&J({target:O.current}),!e&&Q&&Q({target:O.current}))},Ve=e=>{const n=b();return n&&e?r.setTime(e,n):e},We=e=>{P!=null&&P.onMouseDownOutside&&P.onMouseDownOutside(e)},F=(e,n)=>{R({value:j.cloneDate(e||void 0)}),I.current=e,_.current=!1,c()||(v.current=!0),G&&G({syntheticEvent:n.syntheticEvent,nativeEvent:n.nativeEvent,value:b(),show:i(),target:O.current}),I.current=void 0,_.current=void 0,h(!1)},je=e=>{const n=Ve(e.value);F(n,e)},ae=()=>{const{popupClass:e,...n}=P,s=i(),T=b(),L=T&&j.getDate(T),V=u.classNames(e),W={popupClass:"k-datepicker-popup",show:s,anchor:m.current,className:V,id:le,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...n,onMouseDownOutside:We},ce={disabled:g,value:L,min:k,max:C,weekNumber:De,focusedDate:Te,className:c()?"k-calendar-lg":"",navigation:!c(),onChange:je},de=Fe(),ut=ze();return c()?o.createElement(de,{_ref:ne,...ce}):o.createElement(ut,{...W},o.createElement(de,{_ref:ne,...ce}))},oe=()=>{R({focused:!1}),h(!1)},Ue=()=>{const{windowWidth:e=0}=w,n={expand:i(),onClose:oe,title:Re,subTitle:Se,windowWidth:e};return o.createElement(ht.AdaptiveMode,{...n},o.createElement(bt.ActionSheetContent,null,ae()))},He=e=>{F(e.value,e)},Ye=()=>{R({focused:!0})},$e=()=>{h(!i())},z=()=>{g||(v.current=!0,h(!i()))},Xe=e=>{e.preventDefault()},Ze=e=>{const{altKey:n,keyCode:s}=e;if(s===u.Keys.esc&&i()){v.current=!0,h(!1);return}n&&(s===u.Keys.up||s===u.Keys.down)&&(e.preventDefault(),e.stopPropagation(),v.current=s===u.Keys.up,h(s===u.Keys.down))},O=o.useRef(null),m=o.useRef(null),d=o.useRef(null),p=o.useRef(null);o.useImperativeHandle(O,()=>({props:a,get element(){return m.current},get calendar(){return p.current},get dateInput(){return d.current},get name(){return a.name},get show(){return i()},get validity(){return A()},get value(){return b()},get mobileMode(){return c()},togglePopup:$e,focus:Le})),o.useImperativeHandle(y,()=>O.current);const I=o.useRef(void 0),_=o.useRef(void 0),Ge=o.useRef(null),v=o.useRef(!1),K=o.useRef(!1),M=o.useRef(null),[w,Je]=o.useState({value:pe,show:me,focused:!1}),[,Qe]=o.useReducer(e=>e,!0),re=a.name||f||void 0,et=o.useCallback(e=>{if(g)return;let n=null;if(e!=null){if(e instanceof Date)n=e;else if(typeof e=="string"||typeof e=="number"){const s=new Date(e);isNaN(s.getTime())||(n=s)}}if(n&&r.isInDateRange(n,k,C)){const s={target:m.current,currentTarget:m.current};F(n,{syntheticEvent:s})}},[g,k,C]);u.useKendoPaste(m,{fieldName:re,onValueChange:et,enabled:!!re});const R=e=>{Je(n=>({...n,...e}))};o.useEffect(()=>{p.current&&p.current.element&&i()&&!K.current&&p.current.element.focus({preventScroll:!0}),c()&&i()&&!K.current&&setTimeout(()=>{p.current&&p.current.element&&p.current.element.focus({preventScroll:!0})},300),d.current&&d.current.element&&!i()&&v.current&&d.current.element.focus({preventScroll:!0}),K.current=i(),v.current=!1}),o.useEffect(()=>{var e;return M.current=u.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(n=>Ke(n)),i()&&Qe(),(e=N())!=null&&e.body&&M.current&&M.current.observe(N().body),()=>{var n;clearTimeout(Ge.current),(n=N())!=null&&n.body&&M.current&&M.current.disconnect()}},[]);const le=f+"-popup-id",tt=ae(),nt=Ne(),at=b(),ot=Ae(),rt=Ue(),ue=!Y||A().valid,ie=S.toLanguageString(U.toggleCalendar,U.messages[U.toggleCalendar]),lt={disabled:g,format:we,formatPlaceholder:Ie,id:Be,ariaLabelledBy:Ee,ariaDescribedBy:xe,ariaLabel:Me,max:C,min:k,name:a.name,onChange:He,required:a.required,_ref:d,tabIndex:i()?-1:ye,title:a.title,valid:A().valid,validationMessage:X,validityStyles:Y,value:at,label:void 0,placeholder:w.focused?null:qe,ariaExpanded:i(),autoFill:a.autoFill,twoDigitYearMax:Oe,enableMouseWheel:a.enableMouseWheel,autoCorrectParts:a.autoCorrectParts,autoSwitchParts:ke,autoSwitchKeys:Pe,allowCaretMode:a.allowCaretMode,inputAttributes:_e},se=o.createElement(u.AsyncFocusBlur,{onFocus:Ye,onBlur:c()?void 0:oe,onSyncBlur:a.onBlur,onSyncFocus:a.onFocus},e=>o.createElement(o.Fragment,null,o.createElement("span",{...a.label?{}:ee,ref:m,className:u.classNames("k-input","k-datepicker",{[`k-input-${u.kendoThemeMaps.sizeMap[B]||B}`]:B,[`k-rounded-${u.kendoThemeMaps.roundedMap[E]||E}`]:E,[`k-input-${x}`]:x,"k-invalid":!ue,"k-required":te(),"k-disabled":g},a.className),onKeyDown:Ze,style:{width:a.width},onFocus:c()?z:e.onFocus,onBlur:e.onBlur,onClick:c()?z:void 0},o.createElement(nt,{_ref:d,ariaRole:"combobox",ariaExpanded:i(),ariaControls:le,autoFocus:Ce,...lt}),o.createElement(ot,{type:"button",icon:"calendar",svgIcon:ct.calendarIcon,title:ie,className:"k-input-button",onClick:c()?void 0:z,"aria-label":ie,fillMode:x,onMouseDown:Xe}),!c()&&tt),c()&&rt));return a.label?o.createElement(gt.PickerFloatingLabel,{dateInput:d,label:a.label,editorId:f,editorValid:ue,editorDisabled:g,children:se,style:{width:a.width},...ee}):se});H.propTypes={className:t.string,defaultShow:t.bool,defaultValue:t.instanceOf(Date),disabled:t.bool,focusedDate:t.instanceOf(Date),format:t.oneOfType([t.string,t.shape({skeleton:r.nullable(t.string),pattern:r.nullable(t.string),date:r.nullable(t.oneOf(["short","medium","long","full"])),time:r.nullable(t.oneOf(["short","medium","long","full"])),datetime:r.nullable(t.oneOf(["short","medium","long","full"])),era:r.nullable(t.oneOf(["narrow","short","long"])),year:r.nullable(t.oneOf(["numeric","2-digit"])),month:r.nullable(t.oneOf(["numeric","2-digit","narrow","short","long"])),day:r.nullable(t.oneOf(["numeric","2-digit"])),weekday:r.nullable(t.oneOf(["narrow","short","long"])),hour:r.nullable(t.oneOf(["numeric","2-digit"])),hour12:r.nullable(t.bool),minute:r.nullable(t.oneOf(["numeric","2-digit"])),second:r.nullable(t.oneOf(["numeric","2-digit"])),timeZoneName:r.nullable(t.oneOf(["short","long"]))})]),formatPlaceholder:t.oneOfType([r.nullable(t.oneOf(["wide","narrow","short","formatPattern"])),t.shape({year:r.nullable(t.string),month:r.nullable(t.string),day:r.nullable(t.string),hour:r.nullable(t.string),minute:r.nullable(t.string),second:r.nullable(t.string)})]),id:t.string,ariaLabelledBy:t.string,ariaDescribedBy:t.string,ariaLabel:t.string,min:t.instanceOf(Date),max:t.instanceOf(Date),name:t.string,popupSettings:t.shape({animate:r.nullable(t.bool),appendTo:r.nullable(t.any),popupClass:r.nullable(t.string)}),show:t.bool,tabIndex:t.number,title:t.string,value:t.instanceOf(Date),weekNumber:t.bool,width:t.oneOfType([t.number,t.string]),validationMessage:t.string,required:t.bool,valid:t.bool,size:t.oneOf(["small","medium","large"]),rounded:t.oneOf(["small","medium","large","full","none"]),fillMode:t.oneOf(["solid","flat","outline"]),adaptive:t.bool,adaptiveTitle:t.string,adaptiveSubtitle:t.string,autoFocus:t.bool,inputAttributes:t.object};const l={defaultShow:!1,defaultValue:null,dateInput:dt.DateInput,calendar:ft.Calendar,toggleButton:pt.ToggleButton,popup:st.Popup,disabled:!1,format:"d",max:r.MAX_DATE,min:r.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,validityStyles:!0,size:void 0,rounded:void 0,fillMode:void 0,autoFocus:!1},fe=u.createPropsContext();H.displayName="KendoReactDatePicker";exports.DatePicker=H;exports.DatePickerPropsContext=fe;exports.datePickerDefaultProps=l;
|