@progress/kendo-react-dateinputs 9.2.0-develop.9 → 9.3.0-develop.1

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.
@@ -6,419 +6,313 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as n from "react";
9
+ import * as o from "react";
10
10
  import e from "prop-types";
11
- import { Popup as Y } from "@progress/kendo-react-popup";
12
- import { getDate as Z, cloneDate as O } from "@progress/kendo-date-math";
13
- import { classNames as k, Keys as r, validatePackage as G, canUseDOM as P, AsyncFocusBlur as J, kendoThemeMaps as T, createPropsContext as Q, withIdHOC as ee, withPropsContext as te, withAdaptiveModeContext as ie } from "@progress/kendo-react-common";
14
- import { calendarIcon as se } from "@progress/kendo-svg-icons";
15
- import { packageMetadata as oe } from "../package-metadata.mjs";
16
- import { DateInput as ae } from "../dateinput/DateInput.mjs";
17
- import { Calendar as ne } from "../calendar/components/Calendar.mjs";
18
- import { MAX_DATE as re, MIN_DATE as le, isInDateRange as de, setTime as ue } from "../utils.mjs";
19
- import { toggleCalendar as x, messages as he } from "../messages/index.mjs";
20
- import { provideLocalizationService as pe, registerForLocalization as ce } from "@progress/kendo-react-intl";
21
- import { ToggleButton as me } from "./ToggleButton.mjs";
22
- import { PickerWrap as fe } from "../common/PickerWrap.mjs";
23
- import { PickerFloatingLabel as ge } from "../hooks/usePickerFloatingLabel.mjs";
24
- import { ActionSheetContent as ve } from "@progress/kendo-react-layout";
25
- import { AdaptiveMode as we } from "../common/AdaptiveMode.mjs";
26
- const o = class o extends n.Component {
27
- constructor(i) {
28
- super(i), this._element = null, this._dateInput = n.createRef(), this._calendar = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
29
- this.dateInput && this.dateInput.focus();
30
- }, this.setCalendarRef = (t) => {
31
- this._calendar = t;
32
- }, this.nextValue = (t, s) => t.value !== void 0 ? t.value : s.value, this.nextShow = (t, s) => t.show !== void 0 ? t.show : s.show, this.renderPopup = () => {
33
- const { disabled: t, min: s, max: a, weekNumber: c, focusedDate: m, popupSettings: l } = this.props, { popupClass: f, ...g } = l, v = this.show, d = this.value, w = d && Z(d), u = k(f), b = {
34
- popupClass: "k-datepicker-popup",
35
- show: v,
36
- anchor: this._element,
37
- className: u,
38
- id: this._popupId,
39
- anchorAlign: {
40
- horizontal: "left",
41
- vertical: "bottom"
42
- },
43
- popupAlign: {
44
- horizontal: "left",
45
- vertical: "top"
46
- },
47
- ...g,
48
- onMouseDownOutside: this.handleMouseDownOutside
49
- }, h = {
50
- disabled: t,
51
- value: w,
52
- min: s,
53
- max: a,
54
- weekNumber: c,
55
- focusedDate: m,
56
- className: this.mobileMode ? "k-calendar-lg" : "",
57
- navigation: !this.mobileMode,
58
- onChange: this.handleCalendarValueChange
59
- };
60
- return this.mobileMode ? /* @__PURE__ */ n.createElement(this.calendarComp, { _ref: this.setCalendarRef, ...h }) : /* @__PURE__ */ n.createElement(this.popupComp, { ...b }, /* @__PURE__ */ n.createElement(this.calendarComp, { _ref: this.setCalendarRef, ...h }));
61
- }, this.renderAdaptivePopup = () => {
62
- const { windowWidth: t = 0 } = this.state, s = {
63
- expand: this.show,
64
- onClose: this.handleBlur,
65
- title: this.props.adaptiveTitle,
66
- windowWidth: t
67
- };
68
- return /* @__PURE__ */ n.createElement(we, { ...s }, /* @__PURE__ */ n.createElement(ve, { overflowHidden: !0 }, this.renderPopup()));
69
- }, this.handleInputValueChange = (t) => {
70
- this.handleValueChange(t.value, t);
71
- }, this.handleCalendarValueChange = (t) => {
72
- const s = this.mergeTime(t.value);
73
- this.handleValueChange(s, t);
74
- }, this.handleValueChange = (t, s) => {
75
- this.setState({
76
- value: O(t || void 0)
77
- }), this.valueDuringOnChange = t, this.showDuringOnChange = !1, this.mobileMode || (this.shouldFocusDateInput = !0);
78
- const { onChange: a } = this.props;
79
- a && a.call(void 0, {
80
- syntheticEvent: s.syntheticEvent,
81
- nativeEvent: s.nativeEvent,
82
- value: this.value,
83
- show: this.show,
84
- target: this
85
- }), this.valueDuringOnChange = void 0, this.showDuringOnChange = void 0, this.setShow(!1);
86
- }, this.handleFocus = () => {
87
- this.setState({ focused: !0 });
88
- }, this.handleBlur = () => {
89
- this.setState({ focused: !1 }), this.setShow(!1);
90
- }, this.togglePopup = () => {
91
- this.setShow(!this.show);
92
- }, this.handleMouseDownOutside = (t) => {
93
- var s;
94
- (s = this.props.popupSettings) != null && s.onMouseDownOutside && this.props.popupSettings.onMouseDownOutside.call(void 0, t);
95
- }, this.handleIconClick = () => {
96
- this.props.disabled || (this.shouldFocusDateInput = !0, this.setShow(!this.show));
97
- }, this.handleIconMouseDown = (t) => {
98
- t.preventDefault();
99
- }, this.handleKeyDown = (t) => {
100
- const { altKey: s, keyCode: a } = t;
101
- if (a === r.esc && this.show) {
102
- this.shouldFocusDateInput = !0, this.setShow(!1);
103
- return;
104
- }
105
- s && (a === r.up || a === r.down) && (t.preventDefault(), t.stopPropagation(), this.shouldFocusDateInput = a === r.up, this.setShow(a === r.down));
106
- }, G(oe), this.state = {
107
- value: this.props.defaultValue || o.defaultProps.defaultValue,
108
- show: this.props.defaultShow || o.defaultProps.defaultShow,
109
- focused: !1
11
+ import { Popup as Je } from "@progress/kendo-react-popup";
12
+ import { cloneDate as ne, getDate as Qe } from "@progress/kendo-date-math";
13
+ import { validatePackage as et, useId as tt, useAdaptiveModeContext as nt, usePropsContext as ot, canUseDOM as oe, AsyncFocusBlur as rt, classNames as re, kendoThemeMaps as ae, createPropsContext as at, Keys as D } from "@progress/kendo-react-common";
14
+ import { calendarIcon as it } from "@progress/kendo-svg-icons";
15
+ import { packageMetadata as lt } from "../package-metadata.mjs";
16
+ import { DateInput as ut } from "../dateinput/DateInput.mjs";
17
+ import { Calendar as st } from "../calendar/components/Calendar.mjs";
18
+ import { nullable as l, MAX_DATE as ct, MIN_DATE as dt, isInDateRange as ft, setTime as mt } from "../utils.mjs";
19
+ import { toggleCalendar as ie, messages as pt } from "../messages/index.mjs";
20
+ import { useLocalization as gt } from "@progress/kendo-react-intl";
21
+ import { ToggleButton as ht } from "./ToggleButton.mjs";
22
+ import { PickerWrap as vt } from "../common/PickerWrap.mjs";
23
+ import { PickerFloatingLabel as wt } from "../hooks/usePickerFloatingLabel.mjs";
24
+ import { ActionSheetContent as bt } from "@progress/kendo-react-layout";
25
+ import { AdaptiveMode as yt } from "../common/AdaptiveMode.mjs";
26
+ const le = o.forwardRef((n, ue) => {
27
+ et(lt);
28
+ const V = tt(n.id), se = gt(), g = nt(), {
29
+ defaultShow: ce = a.defaultShow,
30
+ defaultValue: de = a.defaultValue,
31
+ dateInput: fe = a.dateInput,
32
+ calendar: me = a.calendar,
33
+ toggleButton: pe = a.toggleButton,
34
+ popup: ge = a.popup,
35
+ pickerWrap: Rt = a.pickerWrap,
36
+ disabled: h = a.disabled,
37
+ format: he = a.format,
38
+ max: P = a.max,
39
+ min: I = a.min,
40
+ popupSettings: v = a.popupSettings,
41
+ tabIndex: ve = a.tabIndex,
42
+ weekNumber: we = a.weekNumber,
43
+ validityStyles: F = a.validityStyles,
44
+ size: S = a.size,
45
+ rounded: E = a.rounded,
46
+ fillMode: x = a.fillMode,
47
+ autoFocus: be = a.autoFocus,
48
+ show: N,
49
+ autoSwitchParts: ye,
50
+ autoSwitchKeys: Ce,
51
+ twoDigitYearMax: Re,
52
+ ariaLabel: ke,
53
+ adaptive: kt,
54
+ adaptiveTitle: De,
55
+ inputAttributes: Oe,
56
+ validationMessage: z,
57
+ _adaptiveMode: Dt = g,
58
+ valid: W,
59
+ focusedDate: Me,
60
+ ...L
61
+ } = ot(Ct, n), B = () => {
62
+ if (oe)
63
+ return b.current && b.current.ownerDocument || window.document;
64
+ }, s = () => !!(p.windowWidth && g && p.windowWidth <= (g == null ? void 0 : g.medium) && n.adaptive), d = () => {
65
+ const t = C.current !== void 0 && C.current !== null ? C.current : n.value !== void 0 ? n.value : p.value;
66
+ return t !== null ? ne(t) : null;
67
+ }, i = () => O.current !== void 0 ? O.current : N !== void 0 ? N : p.show, Pe = () => fe || a.dateInput, Ie = () => pe || a.toggleButton, Se = () => me || a.calendar, Ee = () => ge || a.popup, K = () => n.required !== void 0 ? n.required : !1, T = () => {
68
+ const t = d() || n.value || null, r = I, u = P, M = ft(t, r, u), _ = z !== void 0, q = (!K() || t != null) && M, A = W !== void 0 ? W : q;
69
+ return {
70
+ customError: _,
71
+ rangeOverflow: t && u.getTime() < t.getTime() || !1,
72
+ rangeUnderflow: t && t.getTime() < r.getTime() || !1,
73
+ valid: A,
74
+ valueMissing: t === null
110
75
  };
111
- }
112
- get _popupId() {
113
- return this.props.id + "-popup-id";
114
- }
115
- get document() {
116
- if (P)
117
- return this.element && this.element.ownerDocument || document;
118
- }
119
- /**
120
- * Gets the wrapping element of the DatePickerWithoutContext.
121
- */
122
- get element() {
123
- return this._element;
124
- }
125
- /**
126
- * The mobile mode of the DatePicker.
127
- */
128
- get mobileMode() {
76
+ }, xe = (t) => {
77
+ for (const r of t)
78
+ k({ windowWidth: r.target.clientWidth });
79
+ }, Be = () => {
80
+ c.current && c.current.focus();
81
+ }, H = (t) => {
82
+ y.current = t;
83
+ }, f = (t) => {
84
+ i() !== t && (k({ show: t }), t && n.onOpen && n.onOpen.call(void 0, { target: w.current }), !t && n.onClose && n.onClose.call(void 0, { target: w.current }));
85
+ }, Te = (t) => {
86
+ const r = d();
87
+ return r && t ? mt(t, r) : t;
88
+ }, _e = (t) => {
89
+ v != null && v.onMouseDownOutside && v.onMouseDownOutside.call(void 0, t);
90
+ }, U = (t, r) => {
91
+ k({ value: ne(t || void 0) }), C.current = t, O.current = !1, s() || (m.current = !0), n.onChange && n.onChange.call(void 0, {
92
+ syntheticEvent: r.syntheticEvent,
93
+ nativeEvent: r.nativeEvent,
94
+ value: d(),
95
+ show: i(),
96
+ target: w.current
97
+ }), C.current = void 0, O.current = void 0, f(!1);
98
+ }, qe = (t) => {
99
+ const r = Te(t.value);
100
+ U(r, t);
101
+ }, Y = () => {
102
+ const { popupClass: t, ...r } = v, u = i(), M = d(), _ = M && Qe(M), q = re(t), A = {
103
+ popupClass: "k-datepicker-popup",
104
+ show: u,
105
+ anchor: b.current,
106
+ className: q,
107
+ id: Z,
108
+ anchorAlign: {
109
+ horizontal: "left",
110
+ vertical: "bottom"
111
+ },
112
+ popupAlign: {
113
+ horizontal: "left",
114
+ vertical: "top"
115
+ },
116
+ ...r,
117
+ onMouseDownOutside: _e
118
+ }, ee = {
119
+ disabled: h,
120
+ value: _,
121
+ min: I,
122
+ max: P,
123
+ weekNumber: we,
124
+ focusedDate: Me,
125
+ className: s() ? "k-calendar-lg" : "",
126
+ navigation: !s(),
127
+ onChange: qe
128
+ }, te = Se(), Ge = Ee();
129
+ return s() ? /* @__PURE__ */ o.createElement(te, { _ref: H, ...ee }) : /* @__PURE__ */ o.createElement(Ge, { ...A }, /* @__PURE__ */ o.createElement(te, { _ref: H, ...ee }));
130
+ }, $ = () => {
131
+ k({ focused: !1 }), f(!1);
132
+ }, Ae = () => {
133
+ const { windowWidth: t = 0 } = p, r = {
134
+ expand: i(),
135
+ onClose: $,
136
+ adaptiveTitle: De,
137
+ windowWidth: t
138
+ }, u = Y();
139
+ return /* @__PURE__ */ o.createElement(yt, { ...r }, /* @__PURE__ */ o.createElement(bt, { overflowHidden: !0 }, u));
140
+ }, Ve = (t) => {
141
+ U(t.value, t);
142
+ }, Fe = () => {
143
+ k({ focused: !0 });
144
+ }, Ne = () => {
145
+ f(!i());
146
+ }, j = () => {
147
+ h || (m.current = !0, f(!i()));
148
+ }, ze = (t) => {
149
+ t.preventDefault();
150
+ }, We = (t) => {
151
+ const { altKey: r, keyCode: u } = t;
152
+ if (u === D.esc && i()) {
153
+ m.current = !0, f(!1);
154
+ return;
155
+ }
156
+ r && (u === D.up || u === D.down) && (t.preventDefault(), t.stopPropagation(), m.current = u === D.up, f(u === D.down));
157
+ }, w = o.useRef(null), b = o.useRef(null), c = o.useRef(null), y = o.useRef(null);
158
+ o.useImperativeHandle(
159
+ w,
160
+ () => ({
161
+ props: n,
162
+ get element() {
163
+ return b.current;
164
+ },
165
+ get calendar() {
166
+ return y.current;
167
+ },
168
+ get dateInput() {
169
+ return c.current;
170
+ },
171
+ get name() {
172
+ return n.name;
173
+ },
174
+ get show() {
175
+ return i();
176
+ },
177
+ get validity() {
178
+ return T();
179
+ },
180
+ get value() {
181
+ return d();
182
+ },
183
+ get mobileMode() {
184
+ return s();
185
+ },
186
+ togglePopup: Ne,
187
+ // Hidden Methods but still accessible
188
+ focus: Be
189
+ })
190
+ ), o.useImperativeHandle(ue, () => w.current);
191
+ const C = o.useRef(null), O = o.useRef(void 0), Le = o.useRef(null), m = o.useRef(!1), X = o.useRef(!1), R = o.useRef(null), [p, Ke] = o.useState({
192
+ value: de,
193
+ show: ce,
194
+ focused: !1
195
+ }), [, He] = o.useReducer((t) => t, !0), k = (t) => {
196
+ Ke((r) => ({ ...r, ...t }));
197
+ };
198
+ o.useEffect(() => {
199
+ y.current && y.current.element && i() && !X.current && y.current.element.focus({ preventScroll: !0 }), c.current && c.current.element && !i() && m.current && c.current.element.focus({ preventScroll: !0 }), X.current = i(), m.current = !1;
200
+ }), o.useEffect(() => {
129
201
  var t;
130
- return !!(this.state.windowWidth && this.props._adaptiveMode && this.state.windowWidth <= ((t = this.props._adaptiveMode) == null ? void 0 : t.medium) && this.props.adaptive);
131
- }
132
- /**
133
- * Gets the DateInput component inside the DatePicker component.
134
- */
135
- get dateInput() {
136
- return this._dateInput.current;
137
- }
138
- /**
139
- * Gets the Calendar component inside the DatePicker component.
140
- */
141
- get calendar() {
142
- return this._calendar;
143
- }
144
- /**
145
- * Gets the value of the DatePickerWithoutContext.
146
- */
147
- get value() {
148
- const i = this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value;
149
- return i !== null ? O(i) : null;
150
- }
151
- /**
152
- * Gets the popup state of the DatePickerWithoutContext.
153
- */
154
- get show() {
155
- return this.showDuringOnChange !== void 0 ? this.showDuringOnChange : this.props.show !== void 0 ? this.props.show : this.state.show;
156
- }
157
- /**
158
- * Gets the `name` property of the DatePickerWithoutContext.
159
- */
160
- get name() {
161
- return this.props.name;
162
- }
163
- get min() {
164
- return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
165
- }
166
- get max() {
167
- return this.props.max !== void 0 ? this.props.max : o.defaultProps.max;
168
- }
169
- get dateInputComp() {
170
- return this.props.dateInput || o.defaultProps.dateInput;
171
- }
172
- get toggleButtonComp() {
173
- return this.props.toggleButton || o.defaultProps.toggleButton;
174
- }
175
- get calendarComp() {
176
- return this.props.calendar || o.defaultProps.calendar;
177
- }
178
- get popupComp() {
179
- return this.props.popup || o.defaultProps.popup;
180
- }
181
- get pickerWrapComp() {
182
- return this.props.pickerWrap || o.defaultProps.pickerWrap;
183
- }
184
- /**
185
- * Represents the validity state into which the DatePicker is set.
186
- */
187
- get validity() {
188
- const i = de(this.value, this.min, this.max), t = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && i, a = this.props.valid !== void 0 ? this.props.valid : s;
189
- return {
190
- customError: t,
191
- rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
192
- rangeUnderflow: this.value && this.value.getTime() < this.min.getTime() || !1,
193
- valid: a,
194
- valueMissing: this.value === null
202
+ return R.current = oe && window.ResizeObserver && new window.ResizeObserver((r) => xe(r)), i() && He(), (t = B()) != null && t.body && R.current && R.current.observe(B().body), () => {
203
+ var r;
204
+ clearTimeout(Le.current), (r = B()) != null && r.body && R.current && R.current.disconnect();
195
205
  };
196
- }
197
- /**
198
- * @hidden
199
- */
200
- get validityStyles() {
201
- return this.props.validityStyles !== void 0 ? this.props.validityStyles : o.defaultProps.validityStyles;
202
- }
203
- /**
204
- * @hidden
205
- */
206
- get required() {
207
- return this.props.required !== void 0 ? this.props.required : !1;
208
- }
209
- /**
210
- * @hidden
211
- */
212
- componentDidMount() {
213
- var i;
214
- this.observerResize = P && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.show && this.forceUpdate(), (i = this.document) != null && i.body && this.observerResize && this.observerResize.observe(this.document.body);
215
- }
216
- /**
217
- * @hidden
218
- */
219
- componentDidUpdate() {
220
- this._calendar && this._calendar.element && this.show && !this.prevShow && this._calendar.element.focus({ preventScroll: !0 }), this.dateInput && this.dateInput.element && !this.show && this.shouldFocusDateInput && this.dateInput.element.focus({ preventScroll: !0 }), this.prevShow = this.show, this.shouldFocusDateInput = !1;
221
- }
222
- /**
223
- * @hidden
224
- */
225
- componentWillUnmount() {
226
- var i;
227
- clearTimeout(this.nextTickId), (i = this.document) != null && i.body && this.observerResize && this.observerResize.disconnect();
228
- }
229
- /**
230
- * @hidden
231
- */
232
- render() {
233
- const {
234
- size: i = o.defaultProps.size,
235
- rounded: t = o.defaultProps.rounded,
236
- fillMode: s = o.defaultProps.fillMode,
237
- disabled: a,
238
- tabIndex: c,
239
- title: m,
240
- id: l,
241
- format: f,
242
- formatPlaceholder: g,
243
- min: v,
244
- max: d,
245
- className: w,
246
- width: u,
247
- name: b,
248
- validationMessage: h,
249
- required: B,
250
- validityStyles: F,
251
- ariaLabelledBy: E,
252
- ariaDescribedBy: z,
253
- ariaLabel: V,
254
- placeholder: N,
255
- label: C,
256
- popupSettings: ye,
257
- defaultValue: De,
258
- defaultShow: Ie,
259
- value: Me,
260
- popup: Se,
261
- weekNumber: Oe,
262
- dateInput: ke,
263
- calendar: Pe,
264
- toggleButton: Te,
265
- onChange: xe,
266
- onBlur: Be,
206
+ }, []);
207
+ const Z = V + "-popup-id", Ue = Y(), Ye = Pe(), $e = d(), je = Ie(), Xe = Ae(), G = !F || T().valid, J = se.toLanguageString(ie, pt[ie]), Ze = {
208
+ disabled: h,
209
+ format: he,
210
+ formatPlaceholder: n.formatPlaceholder,
211
+ id: n.id,
212
+ ariaLabelledBy: n.ariaLabelledBy,
213
+ ariaDescribedBy: n.ariaDescribedBy,
214
+ ariaLabel: ke,
215
+ max: P,
216
+ min: I,
217
+ name: n.name,
218
+ onChange: Ve,
219
+ required: n.required,
220
+ tabIndex: i() ? -1 : ve,
221
+ title: n.title,
222
+ valid: T().valid,
223
+ validationMessage: z,
224
+ validityStyles: F,
225
+ value: $e,
226
+ label: void 0,
227
+ placeholder: p.focused ? null : n.placeholder,
228
+ ariaExpanded: i(),
229
+ size: null,
230
+ fillMode: null,
231
+ rounded: null,
232
+ autoFill: n.autoFill,
233
+ twoDigitYearMax: Re,
234
+ enableMouseWheel: n.enableMouseWheel,
235
+ autoCorrectParts: n.autoCorrectParts,
236
+ autoSwitchParts: ye,
237
+ autoSwitchKeys: Ce,
238
+ allowCaretMode: n.allowCaretMode,
239
+ inputAttributes: Oe
240
+ }, Q = /* @__PURE__ */ o.createElement(
241
+ rt,
242
+ {
267
243
  onFocus: Fe,
268
- show: Ee,
269
- onOpen: ze,
270
- pickerWrap: Ve,
271
- adaptive: Ne,
272
- adaptiveTitle: Re,
273
- valid: Ae,
274
- autoFocus: R,
275
- inputAttributes: A,
276
- // Removed to support direct use in Form Field component
277
- visited: We,
278
- touched: _e,
279
- modified: qe,
280
- autoFill: W,
281
- twoDigitYearMax: _,
282
- enableMouseWheel: q,
283
- autoCorrectParts: L,
284
- autoSwitchParts: K,
285
- autoSwitchKeys: U,
286
- allowCaretMode: $,
287
- _adaptiveMode: Le,
288
- ...y
289
- } = this.props, H = this.value, D = !this.validityStyles || this.validity.valid, j = {
290
- disabled: a,
291
- format: f,
292
- formatPlaceholder: g,
293
- id: l,
294
- ariaLabelledBy: E,
295
- ariaDescribedBy: z,
296
- ariaLabel: V,
297
- max: d,
298
- min: v,
299
- name: b,
300
- onChange: this.handleInputValueChange,
301
- required: B,
302
- tabIndex: this.show ? -1 : c,
303
- title: m,
304
- valid: this.validity.valid,
305
- validationMessage: h,
306
- validityStyles: F,
307
- value: H,
308
- label: void 0,
309
- placeholder: this.state.focused ? null : N,
310
- ariaExpanded: this.show,
311
- size: null,
312
- fillMode: null,
313
- rounded: null,
314
- autoFill: W,
315
- twoDigitYearMax: _,
316
- enableMouseWheel: q,
317
- autoCorrectParts: L,
318
- autoSwitchParts: K,
319
- autoSwitchKeys: U,
320
- allowCaretMode: $,
321
- inputAttributes: A
322
- }, I = pe(this).toLanguageString(
323
- x,
324
- he[x]
325
- ), M = /* @__PURE__ */ n.createElement(
326
- J,
244
+ onBlur: s() ? void 0 : $,
245
+ onSyncBlur: n.onBlur,
246
+ onSyncFocus: n.onFocus
247
+ },
248
+ (t) => /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
249
+ "span",
327
250
  {
328
- onFocus: this.handleFocus,
329
- onBlur: this.mobileMode ? void 0 : this.handleBlur,
330
- onSyncBlur: this.props.onBlur,
331
- onSyncFocus: this.props.onFocus
332
- },
333
- (S) => /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
334
- "span",
335
- {
336
- ...C ? {} : y,
337
- ref: (X) => {
338
- this._element = X;
339
- },
340
- className: k(
341
- "k-input",
342
- "k-datepicker",
343
- {
344
- [`k-input-${T.sizeMap[i] || i}`]: i,
345
- [`k-rounded-${T.roundedMap[t] || t}`]: t,
346
- [`k-input-${s}`]: s,
347
- "k-invalid": !D,
348
- "k-required": this.required,
349
- "k-disabled": a
350
- },
351
- w
352
- ),
353
- onKeyDown: this.handleKeyDown,
354
- style: { width: u },
355
- onFocus: S.onFocus,
356
- onBlur: S.onBlur,
357
- onClick: this.mobileMode ? this.handleIconClick : void 0
358
- },
359
- /* @__PURE__ */ n.createElement(
360
- this.dateInputComp,
251
+ ...n.label ? {} : L,
252
+ ref: b,
253
+ className: re(
254
+ "k-input",
255
+ "k-datepicker",
361
256
  {
362
- _ref: this._dateInput,
363
- ariaRole: "combobox",
364
- ariaExpanded: this.show,
365
- ariaControls: this._popupId,
366
- autoFocus: R,
367
- ...j
368
- }
369
- ),
370
- /* @__PURE__ */ n.createElement(
371
- this.toggleButtonComp,
372
- {
373
- type: "button",
374
- icon: "calendar",
375
- svgIcon: se,
376
- title: I,
377
- className: "k-input-button",
378
- rounded: null,
379
- onClick: this.mobileMode ? void 0 : this.handleIconClick,
380
- "aria-label": I,
381
- fillMode: s,
382
- onMouseDown: this.handleIconMouseDown
383
- }
257
+ [`k-input-${ae.sizeMap[S] || S}`]: S,
258
+ [`k-rounded-${ae.roundedMap[E] || E}`]: E,
259
+ [`k-input-${x}`]: x,
260
+ "k-invalid": !G,
261
+ "k-required": K(),
262
+ "k-disabled": h
263
+ },
264
+ n.className
384
265
  ),
385
- !this.mobileMode && this.renderPopup()
386
- ), this.mobileMode && this.renderAdaptivePopup())
387
- );
388
- return C ? /* @__PURE__ */ n.createElement(
389
- ge,
390
- {
391
- dateInput: this._dateInput,
392
- label: C,
393
- editorId: l,
394
- editorValid: D,
395
- editorDisabled: a,
396
- children: M,
397
- style: { width: u },
398
- ...y
399
- }
400
- ) : M;
401
- }
402
- setShow(i) {
403
- const { onOpen: t, onClose: s } = this.props;
404
- this.show !== i && (this.setState({ show: i }), i && t && t.call(void 0, {
405
- target: this
406
- }), !i && s && s.call(void 0, {
407
- target: this
408
- }));
409
- }
410
- mergeTime(i) {
411
- return this.value && i ? ue(i, this.value) : i;
412
- }
413
- nextTick(i) {
414
- clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => i());
415
- }
416
- calculateMedia(i) {
417
- for (const t of i)
418
- this.setState({ windowWidth: t.target.clientWidth });
419
- }
420
- };
421
- o.displayName = "DatePicker", o.propTypes = {
266
+ onKeyDown: We,
267
+ style: { width: n.width },
268
+ onFocus: t.onFocus,
269
+ onBlur: t.onBlur,
270
+ onClick: s() ? j : void 0
271
+ },
272
+ /* @__PURE__ */ o.createElement(
273
+ Ye,
274
+ {
275
+ _ref: c,
276
+ ariaRole: "combobox",
277
+ ariaExpanded: i(),
278
+ ariaControls: Z,
279
+ autoFocus: be,
280
+ ...Ze
281
+ }
282
+ ),
283
+ /* @__PURE__ */ o.createElement(
284
+ je,
285
+ {
286
+ type: "button",
287
+ icon: "calendar",
288
+ svgIcon: it,
289
+ title: J,
290
+ className: "k-input-button",
291
+ rounded: null,
292
+ onClick: s() ? void 0 : j,
293
+ "aria-label": J,
294
+ fillMode: x,
295
+ onMouseDown: ze
296
+ }
297
+ ),
298
+ !s() && Ue
299
+ ), s() && Xe)
300
+ );
301
+ return n.label ? /* @__PURE__ */ o.createElement(
302
+ wt,
303
+ {
304
+ dateInput: c,
305
+ label: n.label,
306
+ editorId: V,
307
+ editorValid: G,
308
+ editorDisabled: h,
309
+ children: Q,
310
+ style: { width: n.width },
311
+ ...L
312
+ }
313
+ ) : Q;
314
+ });
315
+ le.propTypes = {
422
316
  className: e.string,
423
317
  defaultShow: e.bool,
424
318
  defaultValue: e.instanceOf(Date),
@@ -427,37 +321,32 @@ o.displayName = "DatePicker", o.propTypes = {
427
321
  format: e.oneOfType([
428
322
  e.string,
429
323
  e.shape({
430
- skeleton: e.string,
431
- pattern: e.string,
432
- date: e.oneOf(["short", "medium", "long", "full"]),
433
- time: e.oneOf(["short", "medium", "long", "full"]),
434
- datetime: e.oneOf(["short", "medium", "long", "full"]),
435
- era: e.oneOf(["narrow", "short", "long"]),
436
- year: e.oneOf(["numeric", "2-digit"]),
437
- month: e.oneOf(["numeric", "2-digit", "narrow", "short", "long"]),
438
- day: e.oneOf(["numeric", "2-digit"]),
439
- weekday: e.oneOf(["narrow", "short", "long"]),
440
- hour: e.oneOf(["numeric", "2-digit"]),
441
- hour12: e.bool,
442
- minute: e.oneOf(["numeric", "2-digit"]),
443
- second: e.oneOf(["numeric", "2-digit"]),
444
- timeZoneName: e.oneOf(["short", "long"])
324
+ skeleton: l(e.string),
325
+ pattern: l(e.string),
326
+ date: l(e.oneOf(["short", "medium", "long", "full"])),
327
+ time: l(e.oneOf(["short", "medium", "long", "full"])),
328
+ datetime: l(e.oneOf(["short", "medium", "long", "full"])),
329
+ era: l(e.oneOf(["narrow", "short", "long"])),
330
+ year: l(e.oneOf(["numeric", "2-digit"])),
331
+ month: l(e.oneOf(["numeric", "2-digit", "narrow", "short", "long"])),
332
+ day: l(e.oneOf(["numeric", "2-digit"])),
333
+ weekday: l(e.oneOf(["narrow", "short", "long"])),
334
+ hour: l(e.oneOf(["numeric", "2-digit"])),
335
+ hour12: l(e.bool),
336
+ minute: l(e.oneOf(["numeric", "2-digit"])),
337
+ second: l(e.oneOf(["numeric", "2-digit"])),
338
+ timeZoneName: l(e.oneOf(["short", "long"]))
445
339
  })
446
340
  ]),
447
341
  formatPlaceholder: e.oneOfType([
448
- e.oneOf([
449
- "wide",
450
- "narrow",
451
- "short",
452
- "formatPattern"
453
- ]),
342
+ e.oneOf(["wide", "narrow", "short", "formatPattern"]).isRequired,
454
343
  e.shape({
455
- year: e.string,
456
- month: e.string,
457
- day: e.string,
458
- hour: e.string,
459
- minute: e.string,
460
- second: e.string
344
+ year: e.string.isRequired,
345
+ month: e.string.isRequired,
346
+ day: e.string.isRequired,
347
+ hour: e.string.isRequired,
348
+ minute: e.string.isRequired,
349
+ second: e.string.isRequired
461
350
  })
462
351
  ]),
463
352
  id: e.string,
@@ -468,9 +357,9 @@ o.displayName = "DatePicker", o.propTypes = {
468
357
  max: e.instanceOf(Date),
469
358
  name: e.string,
470
359
  popupSettings: e.shape({
471
- animate: e.bool,
472
- appendTo: e.any,
473
- popupClass: e.string
360
+ animate: e.bool.isRequired,
361
+ appendTo: e.any.isRequired,
362
+ popupClass: e.string.isRequired
474
363
  }),
475
364
  show: e.bool,
476
365
  tabIndex: e.number,
@@ -480,7 +369,6 @@ o.displayName = "DatePicker", o.propTypes = {
480
369
  width: e.oneOfType([e.number, e.string]),
481
370
  validationMessage: e.string,
482
371
  required: e.bool,
483
- validate: e.bool,
484
372
  valid: e.bool,
485
373
  size: e.oneOf([null, "small", "medium", "large"]),
486
374
  rounded: e.oneOf([null, "small", "medium", "large", "full"]),
@@ -489,18 +377,19 @@ o.displayName = "DatePicker", o.propTypes = {
489
377
  adaptiveTitle: e.string,
490
378
  autoFocus: e.bool,
491
379
  inputAttributes: e.object
492
- }, o.defaultProps = {
380
+ };
381
+ const a = {
493
382
  defaultShow: !1,
494
383
  defaultValue: null,
495
- dateInput: ae,
496
- calendar: ne,
497
- toggleButton: me,
498
- popup: Y,
499
- pickerWrap: fe,
384
+ dateInput: ut,
385
+ calendar: st,
386
+ toggleButton: ht,
387
+ popup: Je,
388
+ pickerWrap: vt,
500
389
  disabled: !1,
501
390
  format: "d",
502
- max: re,
503
- min: le,
391
+ max: ct,
392
+ min: dt,
504
393
  popupSettings: {},
505
394
  tabIndex: 0,
506
395
  weekNumber: !1,
@@ -509,18 +398,10 @@ o.displayName = "DatePicker", o.propTypes = {
509
398
  rounded: "medium",
510
399
  fillMode: "solid",
511
400
  autoFocus: !1
512
- };
513
- let p = o;
514
- const be = Q(), Ce = ee(
515
- te(
516
- be,
517
- ie(p)
518
- )
519
- );
520
- Ce.displayName = "KendoReactDatePicker";
521
- ce(p);
401
+ }, Ct = at();
402
+ le.displayName = "KendoReactDatePicker";
522
403
  export {
523
- Ce as DatePicker,
524
- be as DatePickerPropsContext,
525
- p as DatePickerWithoutContext
404
+ le as DatePicker,
405
+ Ct as DatePickerPropsContext,
406
+ a as datePickerDefaultProps
526
407
  };