@progress/kendo-react-dateinputs 14.5.0-develop.9 → 15.0.0-develop.2
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/CalendarMcpWrapper.d.ts +16 -0
- package/CalendarMcpWrapper.js +8 -0
- package/CalendarMcpWrapper.mjs +18 -0
- package/DateRangePickerMcpWrapper.d.ts +16 -0
- package/DateRangePickerMcpWrapper.js +8 -0
- package/DateRangePickerMcpWrapper.mjs +18 -0
- package/DateTimePickerMcpWrapper.d.ts +16 -0
- package/DateTimePickerMcpWrapper.js +8 -0
- package/DateTimePickerMcpWrapper.mjs +18 -0
- package/README.md +4 -4
- package/TimePickerMcpWrapper.d.ts +16 -0
- package/TimePickerMcpWrapper.js +8 -0
- package/TimePickerMcpWrapper.mjs +18 -0
- package/calendar/components/Calendar.d.ts +6 -1
- package/calendar/components/Calendar.mjs +5 -5
- package/dateinput/DateInput.d.ts +11 -1
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +202 -194
- package/datepicker/DatePicker.d.ts +6 -1
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +233 -231
- package/daterangepicker/DateRangePicker.d.ts +6 -1
- package/daterangepicker/DateRangePicker.js +1 -1
- package/daterangepicker/DateRangePicker.mjs +65 -61
- package/datetimepicker/DateTimePicker.d.ts +7 -1
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +106 -100
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +12 -4
- package/index.d.ts +12 -4
- package/index.js +1 -1
- package/index.mjs +110 -105
- package/messages/index.d.ts +25 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +46 -36
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
- package/timepicker/TimePicker.d.ts +7 -1
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +90 -87
package/dateinput/DateInput.mjs
CHANGED
|
@@ -5,145 +5,146 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as a from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
|
-
import { cloneDate as
|
|
11
|
-
import { Button as
|
|
12
|
-
import { chevronUpIcon as
|
|
13
|
-
import { useInternationalization as
|
|
14
|
-
import { useId as
|
|
15
|
-
import { FloatingLabel as
|
|
16
|
-
import { DateInput as
|
|
17
|
-
import { DEFAULT_FORMAT_PLACEHOLDER as
|
|
18
|
-
import { MAX_TIME as
|
|
19
|
-
import { increaseValue as
|
|
20
|
-
import { isInTimeRange as
|
|
21
|
-
import
|
|
22
|
-
import { DateInputIntl as
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
import { cloneDate as S, isEqual as ze } from "@progress/kendo-date-math";
|
|
11
|
+
import { Button as ne } from "@progress/kendo-react-buttons";
|
|
12
|
+
import { chevronUpIcon as je, chevronDownIcon as Ke } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { useInternationalization as Ue, useLocalization as We } from "@progress/kendo-react-intl";
|
|
14
|
+
import { createPropsContext as Je, useId as Ye, useUnstyled as Xe, usePropsContext as ae, classNames as I, uDateInput as E, getActiveElement as re } from "@progress/kendo-react-common";
|
|
15
|
+
import { FloatingLabel as Ze } from "@progress/kendo-react-labels";
|
|
16
|
+
import { DateInput as Ge } from "@progress/kendo-dateinputs-common";
|
|
17
|
+
import { DEFAULT_FORMAT_PLACEHOLDER as $e, DEFAULT_FORMAT as Qe, isInRange as et } from "./utils.mjs";
|
|
18
|
+
import { MAX_TIME as tt, MIN_TIME as nt, MIN_DATE as at, MAX_DATE as rt, nullable as u } from "../utils.mjs";
|
|
19
|
+
import { increaseValue as p, messages as P, decreaseValue as R } from "../messages/index.mjs";
|
|
20
|
+
import { isInTimeRange as it } from "../timepicker/utils.mjs";
|
|
21
|
+
import lt from "../common/ClearButton.mjs";
|
|
22
|
+
import { DateInputIntl as ot } from "./dateInputIntl.mjs";
|
|
23
|
+
const ut = "Please enter a valid value!";
|
|
24
|
+
function le(t, m) {
|
|
25
|
+
var ee, te;
|
|
26
|
+
const ue = Ye(t.id), se = Ue(), O = We(), ce = Xe(), H = ae(ie, t).unstyled || ce, {
|
|
26
27
|
format: L = l.format,
|
|
27
|
-
defaultValue:
|
|
28
|
-
size:
|
|
29
|
-
rounded:
|
|
30
|
-
fillMode:
|
|
31
|
-
formatPlaceholder:
|
|
32
|
-
spinners:
|
|
33
|
-
disabled:
|
|
34
|
-
min:
|
|
35
|
-
max:
|
|
36
|
-
minTime:
|
|
37
|
-
maxTime:
|
|
38
|
-
validityStyles:
|
|
39
|
-
validationMessage:
|
|
40
|
-
placeholder:
|
|
41
|
-
enableMouseWheel:
|
|
42
|
-
autoCorrectParts:
|
|
43
|
-
autoSwitchParts:
|
|
44
|
-
allowCaretMode:
|
|
45
|
-
twoDigitYearMax:
|
|
46
|
-
ariaHasPopup:
|
|
47
|
-
autoFocus:
|
|
48
|
-
} =
|
|
49
|
-
|
|
50
|
-
}, d = () => A.value ? A.value :
|
|
51
|
-
const n = i.current && i.current.currentText || "",
|
|
52
|
-
return
|
|
53
|
-
},
|
|
54
|
-
const n = d() || t.value,
|
|
28
|
+
defaultValue: de = l.defaultValue,
|
|
29
|
+
size: fe = l.size,
|
|
30
|
+
rounded: me = l.rounded,
|
|
31
|
+
fillMode: ge = l.fillMode,
|
|
32
|
+
formatPlaceholder: ve = l.formatPlaceholder,
|
|
33
|
+
spinners: he = l.spinners,
|
|
34
|
+
disabled: w = l.disabled,
|
|
35
|
+
min: ye = l.min,
|
|
36
|
+
max: be = l.max,
|
|
37
|
+
minTime: Ie = l.minTime,
|
|
38
|
+
maxTime: Ee = l.maxTime,
|
|
39
|
+
validityStyles: Oe = l.validityStyles,
|
|
40
|
+
validationMessage: q = l.validationMessage,
|
|
41
|
+
placeholder: g = l.placeholder,
|
|
42
|
+
enableMouseWheel: we = l.enableMouseWheel,
|
|
43
|
+
autoCorrectParts: xe = l.autoCorrectParts,
|
|
44
|
+
autoSwitchParts: Ce = l.autoSwitchParts,
|
|
45
|
+
allowCaretMode: De = l.allowCaretMode,
|
|
46
|
+
twoDigitYearMax: Te = l.twoDigitYearMax,
|
|
47
|
+
ariaHasPopup: Me = l.ariaHasPopup,
|
|
48
|
+
autoFocus: v = l.autoFocus
|
|
49
|
+
} = ae(ie, t), x = (n) => {
|
|
50
|
+
Fe((r) => ({ ...r, ...n }));
|
|
51
|
+
}, d = () => A.value ? A.value : M.current !== void 0 ? M.current : i.current && i.current.value, z = () => {
|
|
52
|
+
const n = i.current && i.current.currentText || "", r = d();
|
|
53
|
+
return g != null && !A.focused && !r ? g : n;
|
|
54
|
+
}, j = () => t.required !== void 0 ? t.required : !1, V = () => {
|
|
55
|
+
const n = d() || t.value, r = ye, b = be, _ = et(n, r, b) && it(n, Ie, Ee), F = q !== void 0, B = (!j() || n != null) && _, qe = t.valid !== void 0 ? t.valid : B;
|
|
55
56
|
return {
|
|
56
|
-
customError:
|
|
57
|
-
rangeOverflow: n &&
|
|
58
|
-
rangeUnderflow: n && n.getTime() <
|
|
59
|
-
valid:
|
|
57
|
+
customError: F,
|
|
58
|
+
rangeOverflow: n && b.getTime() < n.getTime() || !1,
|
|
59
|
+
rangeUnderflow: n && n.getTime() < r.getTime() || !1,
|
|
60
|
+
valid: qe,
|
|
60
61
|
valueMissing: n === null
|
|
61
62
|
};
|
|
62
|
-
},
|
|
63
|
+
}, Se = () => {
|
|
63
64
|
o.current && o.current.focus();
|
|
64
|
-
},
|
|
65
|
+
}, K = () => new ot(se), C = () => {
|
|
65
66
|
const n = d();
|
|
66
67
|
return {
|
|
67
68
|
format: L,
|
|
68
69
|
steps: t.steps,
|
|
69
|
-
formatPlaceholder:
|
|
70
|
-
placeholder:
|
|
70
|
+
formatPlaceholder: ve,
|
|
71
|
+
placeholder: g,
|
|
71
72
|
selectPreviousSegmentOnBackspace: !0,
|
|
72
73
|
value: t.value !== void 0 ? t.value : n,
|
|
73
|
-
intlService:
|
|
74
|
+
intlService: K(),
|
|
74
75
|
autoFill: t.autoFill !== void 0 ? t.autoFill : !1,
|
|
75
|
-
enableMouseWheel:
|
|
76
|
-
autoCorrectParts:
|
|
77
|
-
autoSwitchParts:
|
|
76
|
+
enableMouseWheel: we,
|
|
77
|
+
autoCorrectParts: xe,
|
|
78
|
+
autoSwitchParts: Ce,
|
|
78
79
|
autoSwitchKeys: t.autoSwitchKeys || [],
|
|
79
|
-
twoDigitYearMax:
|
|
80
|
-
allowCaretMode:
|
|
80
|
+
twoDigitYearMax: Te,
|
|
81
|
+
allowCaretMode: De
|
|
81
82
|
};
|
|
82
|
-
},
|
|
83
|
-
s.current && s.current.classList.add("k-focus"), x({ focused: !0 }),
|
|
84
|
-
},
|
|
83
|
+
}, pe = (n) => {
|
|
84
|
+
s.current && s.current.classList.add("k-focus"), x({ focused: !0 }), v && X(!0);
|
|
85
|
+
}, Pe = (n) => {
|
|
85
86
|
s.current && s.current.classList.remove("k-focus"), x({ focused: !1 });
|
|
86
|
-
},
|
|
87
|
+
}, Re = (n, r) => typeof n != typeof r ? !0 : typeof n == "string" && typeof r == "string" ? n !== r : typeof n == "object" && typeof r == "object" ? JSON.stringify(n) !== JSON.stringify(r) : !1, Le = (n) => typeof n == "string" ? n : {
|
|
87
88
|
inputFormat: n,
|
|
88
89
|
displayFormat: n
|
|
89
90
|
}, U = (n) => {
|
|
90
|
-
|
|
91
|
+
M.current = d(), t.value === void 0 && x({ value: n.value !== void 0 ? n.value : null }), Be(), f.current = n, M.current = void 0;
|
|
91
92
|
}, W = (n) => {
|
|
92
93
|
t.onChange && t.onChange(n);
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
},
|
|
94
|
+
}, J = (n) => {
|
|
95
|
+
re(document) === o.current && n.preventDefault();
|
|
96
|
+
}, Ve = () => new Ge(o.current, {
|
|
96
97
|
...C(),
|
|
97
|
-
format:
|
|
98
|
+
format: Le(C().format),
|
|
98
99
|
events: {
|
|
99
|
-
focus:
|
|
100
|
-
blur:
|
|
100
|
+
focus: pe,
|
|
101
|
+
blur: Pe,
|
|
101
102
|
valueChange: U,
|
|
102
103
|
click: W
|
|
103
104
|
}
|
|
104
|
-
}),
|
|
105
|
+
}), Y = () => {
|
|
105
106
|
o.current && o.current.setCustomValidity && o.current.setCustomValidity(
|
|
106
|
-
V().valid ? "" :
|
|
107
|
+
V().valid ? "" : q || l.validationMessage
|
|
107
108
|
);
|
|
108
|
-
},
|
|
109
|
+
}, X = a.useCallback(
|
|
109
110
|
(n) => {
|
|
110
|
-
var
|
|
111
|
-
if (o.current &&
|
|
112
|
-
const
|
|
113
|
-
s.current && s.current.classList.add("k-focus"), (
|
|
111
|
+
var r;
|
|
112
|
+
if (o.current && v && n) {
|
|
113
|
+
const b = (i == null ? void 0 : i.current).currentText, _ = (i == null ? void 0 : i.current).currentText.search(/[^a-zA-Z]/), F = b[_], B = b.split(F)[0].length;
|
|
114
|
+
s.current && s.current.classList.add("k-focus"), (r = i == null ? void 0 : i.current) == null || r.selectNearestSegment(B);
|
|
114
115
|
}
|
|
115
116
|
},
|
|
116
|
-
[
|
|
117
|
-
),
|
|
117
|
+
[v]
|
|
118
|
+
), Ne = (n) => {
|
|
118
119
|
!o.current || !i.current || U(n);
|
|
119
|
-
},
|
|
120
|
+
}, Ae = (n) => {
|
|
120
121
|
n.preventDefault();
|
|
121
|
-
const
|
|
122
|
-
o.current &&
|
|
122
|
+
const r = re(document);
|
|
123
|
+
o.current && r !== o.current && o.current.focus({ preventScroll: !0 });
|
|
123
124
|
}, c = (n) => {
|
|
124
|
-
const
|
|
125
|
-
f.current && t.onChange && !
|
|
125
|
+
const r = d();
|
|
126
|
+
f.current && t.onChange && !ze(f.current.oldValue, r) && t.onChange.call(void 0, {
|
|
126
127
|
syntheticEvent: n,
|
|
127
128
|
nativeEvent: f.current.event,
|
|
128
129
|
value: f.current.value,
|
|
129
|
-
target:
|
|
130
|
+
target: D.current
|
|
130
131
|
}), f.current = null;
|
|
131
|
-
},
|
|
132
|
-
var
|
|
133
|
-
(
|
|
134
|
-
},
|
|
135
|
-
var
|
|
136
|
-
(
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
|
|
132
|
+
}, ke = (n) => {
|
|
133
|
+
var r;
|
|
134
|
+
(r = i.current) == null || r.modifyDateSegmentValue(1), c(n);
|
|
135
|
+
}, _e = (n) => {
|
|
136
|
+
var r;
|
|
137
|
+
(r = i.current) == null || r.modifyDateSegmentValue(-1), c(n);
|
|
138
|
+
}, D = a.useRef(null), o = a.useRef(null), s = a.useRef(null);
|
|
139
|
+
a.useImperativeHandle(
|
|
140
|
+
D,
|
|
140
141
|
() => ({
|
|
141
142
|
props: t,
|
|
142
143
|
get options() {
|
|
143
144
|
return C();
|
|
144
145
|
},
|
|
145
146
|
get text() {
|
|
146
|
-
return
|
|
147
|
+
return z();
|
|
147
148
|
},
|
|
148
149
|
get element() {
|
|
149
150
|
return o.current;
|
|
@@ -158,20 +159,24 @@ const rt = "Please enter a valid value!", ae = r.forwardRef((t, re) => {
|
|
|
158
159
|
return V();
|
|
159
160
|
},
|
|
160
161
|
// hidden methods
|
|
161
|
-
focus:
|
|
162
|
-
updateOnPaste:
|
|
162
|
+
focus: Se,
|
|
163
|
+
updateOnPaste: Ne
|
|
163
164
|
})
|
|
164
|
-
),
|
|
165
|
-
const i =
|
|
166
|
-
value: t.value === void 0 ?
|
|
165
|
+
), a.useImperativeHandle(m, () => D.current);
|
|
166
|
+
const i = a.useRef(null), T = a.useRef(null), N = a.useRef(!1), M = a.useRef(null), f = a.useRef(null), h = a.useRef(t), [A, Fe] = a.useState({
|
|
167
|
+
value: t.value === void 0 ? de : null,
|
|
167
168
|
focused: !1
|
|
168
|
-
}), [,
|
|
169
|
-
|
|
170
|
-
N.current || (i.current =
|
|
171
|
-
}, []),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
}), [, Be] = a.useReducer((n) => n + 1, 0);
|
|
170
|
+
a.useLayoutEffect(() => {
|
|
171
|
+
N.current || (i.current = Ve(), T.current = i.current.dateObject, N.current = !0);
|
|
172
|
+
}, []), a.useEffect(() => {
|
|
173
|
+
Y();
|
|
174
|
+
const n = s.current || o.current;
|
|
175
|
+
return N.current || n && n.addEventListener("wheel", J, { passive: !1 }), v && (x({ focused: !0 }), X(!0)), () => {
|
|
176
|
+
n && n.removeEventListener("wheel", J);
|
|
177
|
+
};
|
|
178
|
+
}, []), a.useEffect(() => {
|
|
179
|
+
Y(), i.current && (T.current = i.current.dateObject, (Re(h.current.format, L) || h.current.readonly !== t.readonly || JSON.stringify(h.current.steps) !== JSON.stringify(t.steps) || K().locale !== i.current.options.intlService.locale) && i.current.setOptions(C(), !0), h.current.value !== t.value && (T.current.getValue() !== null || t.value !== null) && T.current.setValue(t.value), t.ariaExpanded !== void 0 && t.ariaExpanded && (i.current.options.placeholder = null), t.ariaExpanded !== void 0 && !t.ariaExpanded && (i.current.options.placeholder = g), i.current.refreshElementValue(), h.current = {
|
|
175
180
|
format: L,
|
|
176
181
|
readonly: t.readonly,
|
|
177
182
|
ariaExpanded: t.ariaExpanded,
|
|
@@ -179,9 +184,45 @@ const rt = "Please enter a valid value!", ae = r.forwardRef((t, re) => {
|
|
|
179
184
|
value: t.value
|
|
180
185
|
});
|
|
181
186
|
});
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
const
|
|
187
|
+
const Z = t.id || ue + "-accessibility-id", y = H && H.uDateInput, G = z(), k = !Oe || V().valid;
|
|
188
|
+
a.useImperativeHandle(t._ref, () => D.current);
|
|
189
|
+
const $ = /* @__PURE__ */ a.createElement(
|
|
190
|
+
"input",
|
|
191
|
+
{
|
|
192
|
+
ref: (n) => {
|
|
193
|
+
o.current = n;
|
|
194
|
+
},
|
|
195
|
+
role: t.ariaRole || void 0,
|
|
196
|
+
readOnly: t.readonly,
|
|
197
|
+
tabIndex: t.tabIndex || 0,
|
|
198
|
+
disabled: w,
|
|
199
|
+
title: (ee = t.title) != null ? ee : G,
|
|
200
|
+
type: "text",
|
|
201
|
+
spellCheck: !1,
|
|
202
|
+
autoComplete: "off",
|
|
203
|
+
autoCorrect: "off",
|
|
204
|
+
autoFocus: v,
|
|
205
|
+
className: I(E.inputInner({ c: y })),
|
|
206
|
+
id: Z,
|
|
207
|
+
value: G,
|
|
208
|
+
"aria-label": t.ariaLabel,
|
|
209
|
+
"aria-labelledby": t.ariaLabelledBy,
|
|
210
|
+
"aria-describedby": t.ariaDescribedBy,
|
|
211
|
+
"aria-haspopup": Me,
|
|
212
|
+
"aria-disabled": w || void 0,
|
|
213
|
+
"aria-expanded": t.ariaExpanded,
|
|
214
|
+
"aria-controls": t.ariaControls,
|
|
215
|
+
"aria-required": t.required,
|
|
216
|
+
"aria-invalid": !k || void 0,
|
|
217
|
+
onKeyDown: c,
|
|
218
|
+
onChange: c,
|
|
219
|
+
onWheel: c,
|
|
220
|
+
onInput: c,
|
|
221
|
+
onClick: c,
|
|
222
|
+
name: t.name,
|
|
223
|
+
...t.inputAttributes
|
|
224
|
+
}
|
|
225
|
+
), Q = /* @__PURE__ */ a.createElement(
|
|
185
226
|
"span",
|
|
186
227
|
{
|
|
187
228
|
ref: (n) => {
|
|
@@ -189,98 +230,64 @@ const rt = "Please enter a valid value!", ae = r.forwardRef((t, re) => {
|
|
|
189
230
|
},
|
|
190
231
|
style: t.label ? void 0 : { width: t.width },
|
|
191
232
|
dir: t.dir,
|
|
192
|
-
className:
|
|
193
|
-
|
|
194
|
-
c:
|
|
195
|
-
size:
|
|
196
|
-
fillMode:
|
|
197
|
-
rounded:
|
|
198
|
-
disabled:
|
|
199
|
-
required:
|
|
200
|
-
invalid: !
|
|
233
|
+
className: I(
|
|
234
|
+
E.wrapper({
|
|
235
|
+
c: y,
|
|
236
|
+
size: fe,
|
|
237
|
+
fillMode: ge,
|
|
238
|
+
rounded: me,
|
|
239
|
+
disabled: w,
|
|
240
|
+
required: j(),
|
|
241
|
+
invalid: !k
|
|
201
242
|
}),
|
|
202
243
|
t.className
|
|
203
244
|
)
|
|
204
245
|
},
|
|
205
|
-
|
|
206
|
-
"input",
|
|
207
|
-
{
|
|
208
|
-
ref: (n) => {
|
|
209
|
-
o.current = n;
|
|
210
|
-
},
|
|
211
|
-
role: t.ariaRole || "textbox",
|
|
212
|
-
readOnly: t.readonly,
|
|
213
|
-
tabIndex: t.tabIndex || 0,
|
|
214
|
-
disabled: I,
|
|
215
|
-
title: t.title !== void 0 ? t.title : Z,
|
|
216
|
-
type: "text",
|
|
217
|
-
spellCheck: !1,
|
|
218
|
-
autoComplete: "off",
|
|
219
|
-
autoCorrect: "off",
|
|
220
|
-
autoFocus: g,
|
|
221
|
-
className: b(O.inputInner({ c: h })),
|
|
222
|
-
id: X,
|
|
223
|
-
value: Z,
|
|
224
|
-
"aria-label": t.ariaLabel,
|
|
225
|
-
"aria-labelledby": t.ariaLabelledBy,
|
|
226
|
-
"aria-describedby": t.ariaDescribedBy,
|
|
227
|
-
"aria-haspopup": we,
|
|
228
|
-
"aria-disabled": I,
|
|
229
|
-
"aria-expanded": t.ariaExpanded,
|
|
230
|
-
"aria-controls": t.ariaControls,
|
|
231
|
-
"aria-required": t.required,
|
|
232
|
-
"aria-invalid": !p,
|
|
233
|
-
onKeyDown: c,
|
|
234
|
-
onChange: c,
|
|
235
|
-
onWheel: c,
|
|
236
|
-
onInput: c,
|
|
237
|
-
onClick: c,
|
|
238
|
-
name: t.name,
|
|
239
|
-
...t.inputAttributes
|
|
240
|
-
}
|
|
241
|
-
),
|
|
246
|
+
$,
|
|
242
247
|
t.children,
|
|
243
|
-
t.clearButton && t.value && /* @__PURE__ */
|
|
244
|
-
|
|
245
|
-
|
|
248
|
+
t.clearButton && t.value && /* @__PURE__ */ a.createElement(lt, { onClick: W, key: "clearbutton" }),
|
|
249
|
+
he && /* @__PURE__ */ a.createElement("span", { className: I(E.inputSpinner({ c: y })), onMouseDown: Ae }, /* @__PURE__ */ a.createElement(
|
|
250
|
+
ne,
|
|
246
251
|
{
|
|
247
252
|
tabIndex: -1,
|
|
248
253
|
type: "button",
|
|
249
|
-
className:
|
|
254
|
+
className: I(E.spinnerIncrease({ c: y })),
|
|
250
255
|
icon: "chevron-up",
|
|
251
|
-
svgIcon:
|
|
252
|
-
"aria-label":
|
|
253
|
-
title:
|
|
254
|
-
onClick:
|
|
256
|
+
svgIcon: je,
|
|
257
|
+
"aria-label": O.toLanguageString(p, P[p]),
|
|
258
|
+
title: O.toLanguageString(p, P[p]),
|
|
259
|
+
onClick: ke
|
|
255
260
|
}
|
|
256
|
-
), /* @__PURE__ */
|
|
257
|
-
|
|
261
|
+
), /* @__PURE__ */ a.createElement(
|
|
262
|
+
ne,
|
|
258
263
|
{
|
|
259
264
|
tabIndex: -1,
|
|
260
265
|
type: "button",
|
|
261
|
-
className:
|
|
266
|
+
className: I(E.spinnerDecrease({ c: y })),
|
|
262
267
|
icon: "chevron-down",
|
|
263
|
-
svgIcon:
|
|
264
|
-
"aria-label":
|
|
265
|
-
title:
|
|
266
|
-
onClick:
|
|
268
|
+
svgIcon: Ke,
|
|
269
|
+
"aria-label": O.toLanguageString(R, P[R]),
|
|
270
|
+
title: O.toLanguageString(R, P[R]),
|
|
271
|
+
onClick: _e
|
|
267
272
|
}
|
|
268
273
|
))
|
|
269
|
-
)
|
|
270
|
-
|
|
271
|
-
Ke,
|
|
274
|
+
), He = t.label ? /* @__PURE__ */ a.createElement(
|
|
275
|
+
Ze,
|
|
272
276
|
{
|
|
273
277
|
label: t.label,
|
|
274
|
-
editorId:
|
|
275
|
-
editorValue: (
|
|
276
|
-
editorValid:
|
|
277
|
-
editorDisabled:
|
|
278
|
-
children:
|
|
278
|
+
editorId: Z,
|
|
279
|
+
editorValue: (te = o.current) == null ? void 0 : te.value,
|
|
280
|
+
editorValid: k,
|
|
281
|
+
editorDisabled: w,
|
|
282
|
+
children: Q,
|
|
279
283
|
style: { width: t.width }
|
|
280
284
|
}
|
|
281
|
-
) :
|
|
282
|
-
}
|
|
283
|
-
|
|
285
|
+
) : Q;
|
|
286
|
+
return { inputElement: $, wrappedElement: He };
|
|
287
|
+
}
|
|
288
|
+
const oe = a.forwardRef((t, m) => le(t, m).wrappedElement), st = a.forwardRef((t, m) => le(t, m).inputElement);
|
|
289
|
+
st.displayName = "KendoReactDateInputInner";
|
|
290
|
+
oe.propTypes = {
|
|
284
291
|
value: e.instanceOf(Date),
|
|
285
292
|
format: e.oneOfType([
|
|
286
293
|
u(e.string),
|
|
@@ -354,32 +361,33 @@ ae.propTypes = {
|
|
|
354
361
|
inputAttributes: e.object
|
|
355
362
|
};
|
|
356
363
|
const l = {
|
|
357
|
-
format:
|
|
364
|
+
format: Qe,
|
|
358
365
|
defaultValue: null,
|
|
359
366
|
size: void 0,
|
|
360
367
|
rounded: void 0,
|
|
361
368
|
fillMode: void 0,
|
|
362
|
-
formatPlaceholder:
|
|
369
|
+
formatPlaceholder: $e,
|
|
363
370
|
spinners: !1,
|
|
364
371
|
disabled: !1,
|
|
365
|
-
max:
|
|
366
|
-
min:
|
|
367
|
-
minTime:
|
|
368
|
-
maxTime:
|
|
372
|
+
max: S(rt),
|
|
373
|
+
min: S(at),
|
|
374
|
+
minTime: S(nt),
|
|
375
|
+
maxTime: S(tt),
|
|
369
376
|
validityStyles: !0,
|
|
370
|
-
validationMessage:
|
|
377
|
+
validationMessage: ut,
|
|
371
378
|
placeholder: null,
|
|
372
379
|
enableMouseWheel: !0,
|
|
373
380
|
autoCorrectParts: !0,
|
|
374
381
|
autoSwitchParts: !0,
|
|
375
382
|
allowCaretMode: !1,
|
|
376
383
|
twoDigitYearMax: 68,
|
|
377
|
-
ariaHasPopup:
|
|
384
|
+
ariaHasPopup: void 0,
|
|
378
385
|
autoFocus: !1
|
|
379
|
-
},
|
|
380
|
-
|
|
386
|
+
}, ie = Je();
|
|
387
|
+
oe.displayName = "KendoReactDateInput";
|
|
381
388
|
export {
|
|
382
|
-
|
|
383
|
-
|
|
389
|
+
oe as DateInput,
|
|
390
|
+
st as DateInputInner,
|
|
391
|
+
ie as DateInputPropsContext,
|
|
384
392
|
l as dateInputDefaultProps
|
|
385
393
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import { PopupProps } from '@progress/kendo-react-popup';
|
|
9
|
-
import { FormComponentProps, FormComponentValidity, AdaptiveModeContextType } from '@progress/kendo-react-common';
|
|
9
|
+
import { FormComponentProps, FormComponentValidity, AdaptiveModeContextType, WebMcpProps } from '@progress/kendo-react-common';
|
|
10
10
|
import { DateInputHandle, DateInputProps } from '../dateinput/DateInput.js';
|
|
11
11
|
import { Calendar, CalendarProps } from '../calendar/components/Calendar.js';
|
|
12
12
|
import { DatePickerSettings } from './models/index.js';
|
|
@@ -179,6 +179,11 @@ export interface DatePickerProps extends DatePickerSettings, FormComponentProps,
|
|
|
179
179
|
* Attributes required for core logic are ignored.
|
|
180
180
|
*/
|
|
181
181
|
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
182
|
+
/**
|
|
183
|
+
* Enables Web MCP tool registration for this component.
|
|
184
|
+
* Requires a parent `WebMcpProvider` from `@progress/kendo-react-webmcp`.
|
|
185
|
+
*/
|
|
186
|
+
webMcp?: boolean | WebMcpProps;
|
|
182
187
|
/**
|
|
183
188
|
* @hidden
|
|
184
189
|
* This prop is provided by the withAdaptiveModeContext HOC to subscribe to AdaptiveModeContext.
|
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 it=require("react"),t=require("prop-types"),st=require("@progress/kendo-react-popup"),j=require("@progress/kendo-date-math"),i=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=i.useId(a.id),S=mt.useLocalization(),D=i.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}=i.usePropsContext(fe,a),N=()=>{if(i.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},u=()=>_.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=>{u()!==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:u(),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=u(),T=b(),L=T&&j.getDate(T),V=i.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:u(),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(!u())},z=()=>{g||(v.current=!0,h(!u()))},Xe=e=>{e.preventDefault()},Ze=e=>{const{altKey:n,keyCode:s}=e;if(s===i.Keys.esc&&u()){v.current=!0,h(!1);return}n&&(s===i.Keys.up||s===i.Keys.down)&&(e.preventDefault(),e.stopPropagation(),v.current=s===i.Keys.up,h(s===i.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 u()},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]);i.useKendoPaste(m,{fieldName:re,onValueChange:et,enabled:!!re});const R=e=>{Je(n=>({...n,...e}))};o.useEffect(()=>{p.current&&p.current.element&&u()&&!K.current&&p.current.element.focus({preventScroll:!0}),c()&&u()&&!K.current&&setTimeout(()=>{p.current&&p.current.element&&p.current.element.focus({preventScroll:!0})},300),d.current&&d.current.element&&!u()&&v.current&&d.current.element.focus({preventScroll:!0}),K.current=u(),v.current=!1}),o.useEffect(()=>{var e;return M.current=i.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(n=>Ke(n)),u()&&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:u()?-1:ye,title:a.title,valid:A().valid,validationMessage:X,validityStyles:Y,value:at,label:void 0,placeholder:w.focused?null:qe,ariaExpanded:u(),autoFill:a.autoFill,twoDigitYearMax:Oe,enableMouseWheel:a.enableMouseWheel,autoCorrectParts:a.autoCorrectParts,autoSwitchParts:ke,autoSwitchKeys:Pe,allowCaretMode:a.allowCaretMode,inputAttributes:_e},se=o.createElement(i.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:i.classNames("k-input","k-datepicker",{[`k-input-${i.kendoThemeMaps.sizeMap[B]||B}`]:B,[`k-rounded-${i.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:u(),ariaControls:u()?le:void 0,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=i.createPropsContext();H.displayName="KendoReactDatePicker";exports.DatePicker=H;exports.DatePickerPropsContext=fe;exports.datePickerDefaultProps=l;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const st=require("react"),t=require("prop-types"),ct=require("@progress/kendo-react-popup"),H=require("@progress/kendo-date-math"),u=require("@progress/kendo-react-common"),dt=require("@progress/kendo-svg-icons"),ft=require("../dateinput/DateInput.js"),mt=require("../calendar/components/Calendar.js"),r=require("../utils.js"),D=require("../messages/index.js"),gt=require("@progress/kendo-react-intl"),pt=require("./ToggleButton.js"),bt=require("../hooks/usePickerFloatingLabel.js"),ht=require("@progress/kendo-react-layout"),vt=require("../common/AdaptiveMode.js");function wt(n){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const f in n)if(f!=="default"){const C=Object.getOwnPropertyDescriptor(n,f);Object.defineProperty(k,f,C.get?C:{enumerable:!0,get:()=>n[f]})}}return k.default=n,Object.freeze(k)}const o=wt(st),U=o.forwardRef((n,k)=>{const f=u.useId(n.id),C=gt.useLocalization(),P=u.useAdaptiveModeContext(),{defaultShow:me=l.defaultShow,defaultValue:ge=l.defaultValue,dateInput:pe=l.dateInput,calendar:be=l.calendar,toggleButton:he=l.toggleButton,popup:ve=l.popup,disabled:p=l.disabled,format:we=l.format,max:O=l.max,min:M=l.min,popupSettings:R=l.popupSettings,tabIndex:ye=l.tabIndex,weekNumber:De=l.weekNumber,validityStyles:Y=l.validityStyles,size:E=l.size,rounded:x=l.rounded,fillMode:q=l.fillMode,autoFocus:ke=l.autoFocus,show:$,autoSwitchParts:Ce,autoSwitchKeys:Pe,twoDigitYearMax:Oe,ariaLabel:Me,adaptive:yt,adaptiveTitle:Re=n.label||void 0,adaptiveSubtitle:Se,formatPlaceholder:Ie,inputAttributes:_e,validationMessage:X,visited:Dt,value:N,touched:kt,modified:Ct,_adaptiveMode:Pt=P,valid:Z,focusedDate:Te,id:Be,ariaLabelledBy:Ee,ariaDescribedBy:xe,placeholder:qe,onChange:G,onOpen:J,onClose:Q,...ee}=u.usePropsContext(fe,n),A=()=>{if(u.canUseDOM)return m.current&&m.current.ownerDocument||window.document},c=()=>!!(b.windowWidth&&P&&b.windowWidth<=(P==null?void 0:P.medium)&&n.adaptive),h=()=>{const e=_.current!==void 0?_.current:N!==void 0?N:b.value;return e!==null?H.cloneDate(e):null},i=()=>T.current!==void 0?T.current:$!==void 0?$:b.show,Ne=()=>pe||l.dateInput,Ae=()=>he||l.toggleButton,Fe=()=>be||l.calendar,Le=()=>ve||l.popup,te=()=>n.required!==void 0?n.required:!1,F=()=>{const e=h()||N||null,a=M,s=O,B=r.isInDateRange(e,a,s),V=X!==void 0,W=(!te()||e!=null)&&B,j=Z!==void 0?Z:W;return{customError:V,rangeOverflow:e&&s.getTime()<e.getTime()||!1,rangeUnderflow:e&&e.getTime()<a.getTime()||!1,valid:j,valueMissing:e===null}},ze=e=>{for(const a of e)I({windowWidth:a.target.clientWidth})},Ke=()=>{d.current&&d.current.focus()},ne=e=>{g.current=e},v=e=>{i()!==e&&(I({show:e}),e&&J&&J({target:w.current}),!e&&Q&&Q({target:w.current}))},Ve=e=>{const a=h();return a&&e?r.setTime(e,a):e},We=e=>{R!=null&&R.onMouseDownOutside&&R.onMouseDownOutside(e)},L=(e,a)=>{I({value:H.cloneDate(e||void 0)}),_.current=e,T.current=!1,c()||(y.current=!0),G&&G({syntheticEvent:a.syntheticEvent,nativeEvent:a.nativeEvent,value:h(),show:i(),target:w.current}),_.current=void 0,T.current=void 0,v(!1)},je=e=>{const a=Ve(e.value);L(a,e)},ae=()=>{const{popupClass:e,...a}=R,s=i(),B=h(),V=B&&H.getDate(B),W=u.classNames(e),j={popupClass:"k-datepicker-popup",show:s,anchor:m.current,className:W,id:le,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...a,onMouseDownOutside:We},ce={disabled:p,value:V,min:M,max:O,weekNumber:De,focusedDate:Te,className:c()?"k-calendar-lg":"",navigation:!c(),onChange:je},de=Fe(),it=Le();return c()?o.createElement(de,{_ref:ne,...ce}):o.createElement(it,{...j},o.createElement(de,{_ref:ne,...ce}))},oe=()=>{I({focused:!1}),v(!1)},He=()=>{const{windowWidth:e=0}=b,a={expand:i(),onClose:oe,title:Re,subTitle:Se,windowWidth:e};return o.createElement(vt.AdaptiveMode,{...a},o.createElement(ht.ActionSheetContent,null,ae()))},Ue=e=>{L(e.value,e)},Ye=()=>{I({focused:!0})},$e=()=>{v(!i())},z=()=>{p||(y.current=!0,v(!i()))},Xe=e=>{e.preventDefault()},Ze=e=>{const{altKey:a,keyCode:s}=e;if(s===u.Keys.esc&&i()){y.current=!0,v(!1);return}a&&(s===u.Keys.up||s===u.Keys.down)&&(e.preventDefault(),e.stopPropagation(),y.current=s===u.Keys.up,v(s===u.Keys.down))},w=o.useRef(null),m=o.useRef(null),d=o.useRef(null),g=o.useRef(null);o.useImperativeHandle(w,()=>({props:n,get element(){return m.current},get calendar(){return g.current},get dateInput(){return d.current},get name(){return n.name},get show(){return i()},get validity(){return F()},get value(){return h()},get mobileMode(){return c()},togglePopup:$e,focus:Ke})),o.useImperativeHandle(k,()=>w.current),u.useWebMcpRegister("datepicker",w,n,n.webMcp);const _=o.useRef(void 0),T=o.useRef(void 0),Ge=o.useRef(null),y=o.useRef(!1),K=o.useRef(!1),S=o.useRef(null),[b,Je]=o.useState({value:ge,show:me,focused:!1}),[,Qe]=o.useReducer(e=>e,!0),re=n.name||f||void 0,et=o.useCallback(e=>{if(p)return;let a=null;if(e!=null){if(e instanceof Date)a=e;else if(typeof e=="string"||typeof e=="number"){const s=new Date(e);isNaN(s.getTime())||(a=s)}}if(a&&r.isInDateRange(a,M,O)){const s={target:m.current,currentTarget:m.current};L(a,{syntheticEvent:s})}},[p,M,O]);u.useKendoPaste(m,{fieldName:re,onValueChange:et,enabled:!!re});const I=e=>{Je(a=>({...a,...e}))};o.useEffect(()=>{g.current&&g.current.element&&i()&&!K.current&&g.current.element.focus({preventScroll:!0}),c()&&i()&&!K.current&&setTimeout(()=>{g.current&&g.current.element&&g.current.element.focus({preventScroll:!0})},300),d.current&&d.current.element&&!i()&&y.current&&d.current.element.focus({preventScroll:!0}),K.current=i(),y.current=!1}),o.useEffect(()=>{var e;return S.current=u.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(a=>ze(a)),i()&&Qe(),(e=A())!=null&&e.body&&S.current&&S.current.observe(A().body),()=>{var a;clearTimeout(Ge.current),(a=A())!=null&&a.body&&S.current&&S.current.disconnect()}},[]);const le=f+"-popup-id",tt=ae(),nt=Ne(),at=h(),ot=Ae(),rt=He(),ue=!Y||F().valid,ie=C.toLanguageString(D.toggleCalendar,D.messages[D.toggleCalendar]),lt=Me||C.toLanguageString(D.selectDate,D.messages[D.selectDate]),ut={disabled:p,format:we,formatPlaceholder:Ie,id:Be,ariaLabelledBy:Ee,ariaDescribedBy:xe,ariaLabel:lt,max:O,min:M,name:n.name,onChange:Ue,required:n.required,_ref:d,tabIndex:i()?-1:ye,title:n.title,valid:F().valid,validationMessage:X,validityStyles:Y,value:at,label:void 0,placeholder:b.focused?null:qe,ariaExpanded:i(),autoFill:n.autoFill,twoDigitYearMax:Oe,enableMouseWheel:n.enableMouseWheel,autoCorrectParts:n.autoCorrectParts,autoSwitchParts:Ce,autoSwitchKeys:Pe,allowCaretMode:n.allowCaretMode,inputAttributes:_e},se=o.createElement(u.AsyncFocusBlur,{onFocus:Ye,onBlur:c()?void 0:oe,onSyncBlur:n.onBlur,onSyncFocus:n.onFocus},e=>o.createElement(o.Fragment,null,o.createElement("span",{...n.label?{}:ee,ref:m,className:u.classNames("k-input","k-datepicker",{[`k-input-${u.kendoThemeMaps.sizeMap[E]||E}`]:E,[`k-rounded-${u.kendoThemeMaps.roundedMap[x]||x}`]:x,[`k-input-${q}`]:q,"k-invalid":!ue,"k-required":te(),"k-disabled":p,"k-focus":b.focused},n.className),onKeyDown:Ze,style:{width:n.width},onFocus:c()?z:e.onFocus,onBlur:e.onBlur,onClick:c()?z:void 0},o.createElement(nt,{_ref:d,ariaRole:"combobox",ariaHasPopup:"grid",ariaExpanded:i(),ariaControls:i()?le:void 0,autoFocus:ke,...ut}),o.createElement(ot,{type:"button",icon:"calendar",svgIcon:dt.calendarIcon,title:ie,className:"k-input-button",onClick:c()?void 0:z,"aria-label":ie,fillMode:q,onMouseDown:Xe}),!c()&&tt),c()&&rt));return n.label?o.createElement(bt.PickerFloatingLabel,{dateInput:d,label:n.label,editorId:f,editorValid:ue,editorDisabled:p,children:se,style:{width:n.width},...ee}):se});U.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:ft.DateInputInner,calendar:mt.Calendar,toggleButton:pt.ToggleButton,popup:ct.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();U.displayName="KendoReactDatePicker";exports.DatePicker=U;exports.DatePickerPropsContext=fe;exports.datePickerDefaultProps=l;
|