@progress/kendo-react-dateinputs 9.4.0-develop.26 → 9.4.0-develop.28
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/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 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;
|
|
@@ -7,31 +7,31 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as o from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
|
-
import { Popup as
|
|
11
|
-
import { cloneDate as oe, getDate as
|
|
12
|
-
import { validatePackage as
|
|
13
|
-
import { calendarIcon as
|
|
14
|
-
import { packageMetadata as
|
|
15
|
-
import { DateInput as
|
|
16
|
-
import { Calendar as
|
|
17
|
-
import { nullable as a, MAX_DATE as
|
|
18
|
-
import { toggleCalendar as ie, messages as
|
|
19
|
-
import { useLocalization as
|
|
20
|
-
import { ToggleButton as
|
|
21
|
-
import { PickerWrap as
|
|
22
|
-
import { PickerFloatingLabel as
|
|
23
|
-
import { ActionSheetContent as
|
|
24
|
-
import { AdaptiveMode as
|
|
10
|
+
import { Popup as tt } from "@progress/kendo-react-popup";
|
|
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";
|
|
13
|
+
import { calendarIcon as st } from "@progress/kendo-svg-icons";
|
|
14
|
+
import { packageMetadata as ct } from "../package-metadata.mjs";
|
|
15
|
+
import { DateInput as dt } from "../dateinput/DateInput.mjs";
|
|
16
|
+
import { Calendar as ft } from "../calendar/components/Calendar.mjs";
|
|
17
|
+
import { nullable as a, MAX_DATE as mt, MIN_DATE as pt, isInDateRange as gt, setTime as ht } from "../utils.mjs";
|
|
18
|
+
import { toggleCalendar as ie, messages as vt } from "../messages/index.mjs";
|
|
19
|
+
import { useLocalization as wt } from "@progress/kendo-react-intl";
|
|
20
|
+
import { ToggleButton as bt } from "./ToggleButton.mjs";
|
|
21
|
+
import { PickerWrap as yt } from "../common/PickerWrap.mjs";
|
|
22
|
+
import { PickerFloatingLabel as Ct } from "../hooks/usePickerFloatingLabel.mjs";
|
|
23
|
+
import { ActionSheetContent as kt } from "@progress/kendo-react-layout";
|
|
24
|
+
import { AdaptiveMode as Dt } from "../common/AdaptiveMode.mjs";
|
|
25
25
|
const ue = o.forwardRef((n, se) => {
|
|
26
|
-
|
|
27
|
-
const N =
|
|
26
|
+
ot(ct);
|
|
27
|
+
const N = rt(n.id), ce = wt(), g = at(), {
|
|
28
28
|
defaultShow: de = l.defaultShow,
|
|
29
29
|
defaultValue: fe = l.defaultValue,
|
|
30
30
|
dateInput: me = l.dateInput,
|
|
31
31
|
calendar: pe = l.calendar,
|
|
32
32
|
toggleButton: ge = l.toggleButton,
|
|
33
33
|
popup: he = l.popup,
|
|
34
|
-
pickerWrap:
|
|
34
|
+
pickerWrap: Pt = l.pickerWrap,
|
|
35
35
|
disabled: h = l.disabled,
|
|
36
36
|
format: ve = l.format,
|
|
37
37
|
max: R = l.max,
|
|
@@ -42,7 +42,7 @@ const ue = o.forwardRef((n, se) => {
|
|
|
42
42
|
validityStyles: z = l.validityStyles,
|
|
43
43
|
size: S = l.size,
|
|
44
44
|
rounded: E = l.rounded,
|
|
45
|
-
fillMode:
|
|
45
|
+
fillMode: _ = l.fillMode,
|
|
46
46
|
autoFocus: ye = l.autoFocus,
|
|
47
47
|
show: W,
|
|
48
48
|
autoSwitchParts: Ce,
|
|
@@ -50,26 +50,27 @@ const ue = o.forwardRef((n, se) => {
|
|
|
50
50
|
twoDigitYearMax: De,
|
|
51
51
|
ariaLabel: Oe,
|
|
52
52
|
adaptive: Mt,
|
|
53
|
+
formatPlaceholder: Pe,
|
|
53
54
|
adaptiveTitle: Me,
|
|
54
|
-
inputAttributes:
|
|
55
|
+
inputAttributes: Re,
|
|
55
56
|
validationMessage: L,
|
|
56
|
-
visited:
|
|
57
|
-
value:
|
|
58
|
-
touched:
|
|
59
|
-
modified:
|
|
60
|
-
_adaptiveMode:
|
|
57
|
+
visited: Rt,
|
|
58
|
+
value: x,
|
|
59
|
+
touched: It,
|
|
60
|
+
modified: St,
|
|
61
|
+
_adaptiveMode: Et = g,
|
|
61
62
|
valid: K,
|
|
62
|
-
focusedDate:
|
|
63
|
-
id:
|
|
63
|
+
focusedDate: Ie,
|
|
64
|
+
id: Se,
|
|
64
65
|
...q
|
|
65
|
-
} =
|
|
66
|
+
} = lt(Ot, n), B = () => {
|
|
66
67
|
if (re)
|
|
67
68
|
return b.current && b.current.ownerDocument || window.document;
|
|
68
69
|
}, s = () => !!(p.windowWidth && g && p.windowWidth <= (g == null ? void 0 : g.medium) && n.adaptive), d = () => {
|
|
69
|
-
const t = C.current !== void 0 && C.current !== null ? C.current :
|
|
70
|
+
const t = C.current !== void 0 && C.current !== null ? C.current : x !== void 0 ? x : p.value;
|
|
70
71
|
return t !== null ? oe(t) : null;
|
|
71
|
-
}, i = () =>
|
|
72
|
-
const t = d() ||
|
|
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
|
+
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;
|
|
73
74
|
return {
|
|
74
75
|
customError: A,
|
|
75
76
|
rangeOverflow: t && u.getTime() < t.getTime() || !1,
|
|
@@ -77,33 +78,33 @@ const ue = o.forwardRef((n, se) => {
|
|
|
77
78
|
valid: F,
|
|
78
79
|
valueMissing: t === null
|
|
79
80
|
};
|
|
80
|
-
},
|
|
81
|
+
}, Te = (t) => {
|
|
81
82
|
for (const r of t)
|
|
82
83
|
D({ windowWidth: r.target.clientWidth });
|
|
83
|
-
},
|
|
84
|
+
}, Ae = () => {
|
|
84
85
|
c.current && c.current.focus();
|
|
85
86
|
}, U = (t) => {
|
|
86
87
|
y.current = t;
|
|
87
88
|
}, f = (t) => {
|
|
88
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
|
-
}, Ae = (t) => {
|
|
90
|
-
const r = d();
|
|
91
|
-
return r && t ? gt(t, r) : t;
|
|
92
90
|
}, Ve = (t) => {
|
|
91
|
+
const r = d();
|
|
92
|
+
return r && t ? ht(t, r) : t;
|
|
93
|
+
}, Fe = (t) => {
|
|
93
94
|
v != null && v.onMouseDownOutside && v.onMouseDownOutside.call(void 0, t);
|
|
94
95
|
}, Y = (t, r) => {
|
|
95
|
-
D({ value: oe(t || void 0) }), C.current = t,
|
|
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
97
|
syntheticEvent: r.syntheticEvent,
|
|
97
98
|
nativeEvent: r.nativeEvent,
|
|
98
99
|
value: d(),
|
|
99
100
|
show: i(),
|
|
100
101
|
target: w.current
|
|
101
|
-
}), C.current = void 0,
|
|
102
|
-
},
|
|
103
|
-
const r =
|
|
102
|
+
}), C.current = void 0, P.current = void 0, f(!1);
|
|
103
|
+
}, Ne = (t) => {
|
|
104
|
+
const r = Ve(t.value);
|
|
104
105
|
Y(r, t);
|
|
105
106
|
}, $ = () => {
|
|
106
|
-
const { popupClass: t, ...r } = v, u = i(),
|
|
107
|
+
const { popupClass: t, ...r } = v, u = i(), M = d(), A = M && nt(M), V = ae(t), F = {
|
|
107
108
|
popupClass: "k-datepicker-popup",
|
|
108
109
|
show: u,
|
|
109
110
|
anchor: b.current,
|
|
@@ -118,40 +119,40 @@ const ue = o.forwardRef((n, se) => {
|
|
|
118
119
|
vertical: "top"
|
|
119
120
|
},
|
|
120
121
|
...r,
|
|
121
|
-
onMouseDownOutside:
|
|
122
|
+
onMouseDownOutside: Fe
|
|
122
123
|
}, te = {
|
|
123
124
|
disabled: h,
|
|
124
125
|
value: A,
|
|
125
126
|
min: I,
|
|
126
127
|
max: R,
|
|
127
128
|
weekNumber: be,
|
|
128
|
-
focusedDate:
|
|
129
|
+
focusedDate: Ie,
|
|
129
130
|
className: s() ? "k-calendar-lg" : "",
|
|
130
131
|
navigation: !s(),
|
|
131
|
-
onChange:
|
|
132
|
-
}, ne = xe(),
|
|
133
|
-
return s() ? /* @__PURE__ */ o.createElement(ne, { _ref: U, ...te }) : /* @__PURE__ */ o.createElement(
|
|
132
|
+
onChange: Ne
|
|
133
|
+
}, ne = xe(), et = Be();
|
|
134
|
+
return s() ? /* @__PURE__ */ o.createElement(ne, { _ref: U, ...te }) : /* @__PURE__ */ o.createElement(et, { ...F }, /* @__PURE__ */ o.createElement(ne, { _ref: U, ...te }));
|
|
134
135
|
}, j = () => {
|
|
135
136
|
D({ focused: !1 }), f(!1);
|
|
136
|
-
},
|
|
137
|
+
}, ze = () => {
|
|
137
138
|
const { windowWidth: t = 0 } = p, r = {
|
|
138
139
|
expand: i(),
|
|
139
140
|
onClose: j,
|
|
140
141
|
adaptiveTitle: Me,
|
|
141
142
|
windowWidth: t
|
|
142
143
|
}, u = $();
|
|
143
|
-
return /* @__PURE__ */ o.createElement(
|
|
144
|
-
},
|
|
144
|
+
return /* @__PURE__ */ o.createElement(Dt, { ...r }, /* @__PURE__ */ o.createElement(kt, { overflowHidden: !0 }, u));
|
|
145
|
+
}, We = (t) => {
|
|
145
146
|
Y(t.value, t);
|
|
146
|
-
}, We = () => {
|
|
147
|
-
D({ focused: !0 });
|
|
148
147
|
}, Le = () => {
|
|
148
|
+
D({ focused: !0 });
|
|
149
|
+
}, Ke = () => {
|
|
149
150
|
f(!i());
|
|
150
151
|
}, X = () => {
|
|
151
152
|
h || (m.current = !0, f(!i()));
|
|
152
|
-
}, Ke = (t) => {
|
|
153
|
-
t.preventDefault();
|
|
154
153
|
}, qe = (t) => {
|
|
154
|
+
t.preventDefault();
|
|
155
|
+
}, He = (t) => {
|
|
155
156
|
const { altKey: r, keyCode: u } = t;
|
|
156
157
|
if (u === O.esc && i()) {
|
|
157
158
|
m.current = !0, f(!1);
|
|
@@ -187,39 +188,39 @@ const ue = o.forwardRef((n, se) => {
|
|
|
187
188
|
get mobileMode() {
|
|
188
189
|
return s();
|
|
189
190
|
},
|
|
190
|
-
togglePopup:
|
|
191
|
+
togglePopup: Ke,
|
|
191
192
|
// Hidden Methods but still accessible
|
|
192
|
-
focus:
|
|
193
|
+
focus: Ae
|
|
193
194
|
})
|
|
194
195
|
), o.useImperativeHandle(se, () => w.current);
|
|
195
|
-
const C = o.useRef(null),
|
|
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
197
|
value: fe,
|
|
197
198
|
show: de,
|
|
198
199
|
focused: !1
|
|
199
|
-
}), [,
|
|
200
|
-
|
|
200
|
+
}), [, $e] = o.useReducer((t) => t, !0), D = (t) => {
|
|
201
|
+
Ye((r) => ({ ...r, ...t }));
|
|
201
202
|
};
|
|
202
203
|
o.useEffect(() => {
|
|
203
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;
|
|
204
205
|
}), o.useEffect(() => {
|
|
205
206
|
var t;
|
|
206
|
-
return k.current = re && window.ResizeObserver && new window.ResizeObserver((r) =>
|
|
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
208
|
var r;
|
|
208
|
-
clearTimeout(
|
|
209
|
+
clearTimeout(Ue.current), (r = B()) != null && r.body && k.current && k.current.disconnect();
|
|
209
210
|
};
|
|
210
211
|
}, []);
|
|
211
|
-
const G = N + "-popup-id",
|
|
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 = {
|
|
212
213
|
disabled: h,
|
|
213
214
|
format: ve,
|
|
214
|
-
formatPlaceholder:
|
|
215
|
-
id:
|
|
215
|
+
formatPlaceholder: Pe,
|
|
216
|
+
id: Se,
|
|
216
217
|
ariaLabelledBy: n.ariaLabelledBy,
|
|
217
218
|
ariaDescribedBy: n.ariaDescribedBy,
|
|
218
219
|
ariaLabel: Oe,
|
|
219
220
|
max: R,
|
|
220
221
|
min: I,
|
|
221
222
|
name: n.name,
|
|
222
|
-
onChange:
|
|
223
|
+
onChange: We,
|
|
223
224
|
required: n.required,
|
|
224
225
|
_ref: c,
|
|
225
226
|
tabIndex: i() ? -1 : we,
|
|
@@ -227,7 +228,7 @@ const ue = o.forwardRef((n, se) => {
|
|
|
227
228
|
valid: T().valid,
|
|
228
229
|
validationMessage: L,
|
|
229
230
|
validityStyles: z,
|
|
230
|
-
value:
|
|
231
|
+
value: Ze,
|
|
231
232
|
label: void 0,
|
|
232
233
|
placeholder: p.focused ? null : n.placeholder,
|
|
233
234
|
ariaExpanded: i(),
|
|
@@ -241,11 +242,11 @@ const ue = o.forwardRef((n, se) => {
|
|
|
241
242
|
autoSwitchParts: Ce,
|
|
242
243
|
autoSwitchKeys: ke,
|
|
243
244
|
allowCaretMode: n.allowCaretMode,
|
|
244
|
-
inputAttributes:
|
|
245
|
+
inputAttributes: Re
|
|
245
246
|
}, ee = /* @__PURE__ */ o.createElement(
|
|
246
|
-
|
|
247
|
+
it,
|
|
247
248
|
{
|
|
248
|
-
onFocus:
|
|
249
|
+
onFocus: Le,
|
|
249
250
|
onBlur: s() ? void 0 : j,
|
|
250
251
|
onSyncBlur: n.onBlur,
|
|
251
252
|
onSyncFocus: n.onFocus
|
|
@@ -261,50 +262,50 @@ const ue = o.forwardRef((n, se) => {
|
|
|
261
262
|
{
|
|
262
263
|
[`k-input-${le.sizeMap[S] || S}`]: S,
|
|
263
264
|
[`k-rounded-${le.roundedMap[E] || E}`]: E,
|
|
264
|
-
[`k-input-${
|
|
265
|
+
[`k-input-${_}`]: _,
|
|
265
266
|
"k-invalid": !J,
|
|
266
267
|
"k-required": H(),
|
|
267
268
|
"k-disabled": h
|
|
268
269
|
},
|
|
269
270
|
n.className
|
|
270
271
|
),
|
|
271
|
-
onKeyDown:
|
|
272
|
+
onKeyDown: He,
|
|
272
273
|
style: { width: n.width },
|
|
273
274
|
onFocus: t.onFocus,
|
|
274
275
|
onBlur: t.onBlur,
|
|
275
276
|
onClick: s() ? X : void 0
|
|
276
277
|
},
|
|
277
278
|
/* @__PURE__ */ o.createElement(
|
|
278
|
-
|
|
279
|
+
Xe,
|
|
279
280
|
{
|
|
280
281
|
_ref: c,
|
|
281
282
|
ariaRole: "combobox",
|
|
282
283
|
ariaExpanded: i(),
|
|
283
284
|
ariaControls: G,
|
|
284
285
|
autoFocus: ye,
|
|
285
|
-
...
|
|
286
|
+
...Qe
|
|
286
287
|
}
|
|
287
288
|
),
|
|
288
289
|
/* @__PURE__ */ o.createElement(
|
|
289
|
-
|
|
290
|
+
Ge,
|
|
290
291
|
{
|
|
291
292
|
type: "button",
|
|
292
293
|
icon: "calendar",
|
|
293
|
-
svgIcon:
|
|
294
|
+
svgIcon: st,
|
|
294
295
|
title: Q,
|
|
295
296
|
className: "k-input-button",
|
|
296
297
|
rounded: null,
|
|
297
298
|
onClick: s() ? void 0 : X,
|
|
298
299
|
"aria-label": Q,
|
|
299
|
-
fillMode:
|
|
300
|
-
onMouseDown:
|
|
300
|
+
fillMode: _,
|
|
301
|
+
onMouseDown: qe
|
|
301
302
|
}
|
|
302
303
|
),
|
|
303
|
-
!s() &&
|
|
304
|
-
), s() &&
|
|
304
|
+
!s() && je
|
|
305
|
+
), s() && Je)
|
|
305
306
|
);
|
|
306
307
|
return n.label ? /* @__PURE__ */ o.createElement(
|
|
307
|
-
|
|
308
|
+
Ct,
|
|
308
309
|
{
|
|
309
310
|
dateInput: c,
|
|
310
311
|
label: n.label,
|
|
@@ -388,15 +389,15 @@ ue.propTypes = {
|
|
|
388
389
|
const l = {
|
|
389
390
|
defaultShow: !1,
|
|
390
391
|
defaultValue: null,
|
|
391
|
-
dateInput:
|
|
392
|
-
calendar:
|
|
393
|
-
toggleButton:
|
|
394
|
-
popup:
|
|
395
|
-
pickerWrap:
|
|
392
|
+
dateInput: dt,
|
|
393
|
+
calendar: ft,
|
|
394
|
+
toggleButton: bt,
|
|
395
|
+
popup: tt,
|
|
396
|
+
pickerWrap: yt,
|
|
396
397
|
disabled: !1,
|
|
397
398
|
format: "d",
|
|
398
|
-
max:
|
|
399
|
-
min:
|
|
399
|
+
max: mt,
|
|
400
|
+
min: pt,
|
|
400
401
|
popupSettings: {},
|
|
401
402
|
tabIndex: 0,
|
|
402
403
|
weekNumber: !1,
|
|
@@ -405,10 +406,10 @@ const l = {
|
|
|
405
406
|
rounded: "medium",
|
|
406
407
|
fillMode: "solid",
|
|
407
408
|
autoFocus: !1
|
|
408
|
-
},
|
|
409
|
+
}, Ot = ut();
|
|
409
410
|
ue.displayName = "KendoReactDatePicker";
|
|
410
411
|
export {
|
|
411
412
|
ue as DatePicker,
|
|
412
|
-
|
|
413
|
+
Ot as DatePickerPropsContext,
|
|
413
414
|
l as datePickerDefaultProps
|
|
414
415
|
};
|