@progress/kendo-react-dateinputs 9.0.0-develop.5 → 9.0.0-develop.6

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,254 +6,63 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as h from "react";
9
+ import * as r from "react";
10
10
  import e from "prop-types";
11
- import { cloneDate as f, isEqual as _ } from "@progress/kendo-date-math";
12
- import { Button as P } from "@progress/kendo-react-buttons";
13
- import { caretAltUpIcon as L, caretAltDownIcon as A } from "@progress/kendo-svg-icons";
14
- import { provideIntlService as O, provideLocalizationService as N, registerForIntl as q, registerForLocalization as R } from "@progress/kendo-react-intl";
15
- import { KendoDate as z } from "./models/kendo-date.mjs";
16
- import { getActiveElement as g, validatePackage as K, AsyncFocusBlur as U, classNames as p, uDateInput as c, noop as H, createPropsContext as j, withIdHOC as X, withPropsContext as Y, withUnstyledHOC as G } from "@progress/kendo-react-common";
17
- import { FloatingLabel as W } from "@progress/kendo-react-labels";
18
- import { packageMetadata as Z } from "../package-metadata.mjs";
19
- import { approximateStringMatching as J, defaultFormat as Q, defaultFormatPlaceholder as $, isInRange as ee } from "./utils.mjs";
20
- import { MAX_DATE as te, MIN_DATE as ie, MIN_TIME as se, MAX_TIME as re } from "../utils.mjs";
21
- import { increaseValue as v, messages as y, decreaseValue as b } from "../messages/index.mjs";
22
- import { isInTimeRange as ae } from "../timepicker/utils.mjs";
23
- import ne from "../common/ClearButton.mjs";
24
- const oe = "Please enter a valid value!", o = class o extends h.Component {
25
- constructor(i) {
26
- super(i), this.kendoDate = null, this.currentFormat = "", this.paste = !1, this._element = null, this._wrapper = null, this._lastSelectedSymbol = "", this.focus = () => {
11
+ import { cloneDate as m, isEqual as L } from "@progress/kendo-date-math";
12
+ import { Button as w } from "@progress/kendo-react-buttons";
13
+ import { caretAltUpIcon as _, caretAltDownIcon as V } from "@progress/kendo-svg-icons";
14
+ import { provideIntlService as E, provideLocalizationService as A, registerForIntl as F, registerForLocalization as N } from "@progress/kendo-react-intl";
15
+ import { getActiveElement as k, validatePackage as q, classNames as h, uDateInput as p, createPropsContext as B, withIdHOC as R, withPropsContext as U, withUnstyledHOC as z } from "@progress/kendo-react-common";
16
+ import { FloatingLabel as j } from "@progress/kendo-react-labels";
17
+ import { DateInput as H } from "@progress/kendo-dateinputs-common";
18
+ import { DEFAULT_FORMAT as K, DEFAULT_FORMAT_PLACEHOLDER as I, isInRange as W } from "./utils.mjs";
19
+ import { packageMetadata as X } from "../package-metadata.mjs";
20
+ import { MAX_DATE as G, MIN_DATE as Y, MIN_TIME as Z, MAX_TIME as $ } from "../utils.mjs";
21
+ import { increaseValue as c, messages as g, decreaseValue as f } from "../messages/index.mjs";
22
+ import { isInTimeRange as J } from "../timepicker/utils.mjs";
23
+ import Q from "../common/ClearButton.mjs";
24
+ import { DateInputIntl as ee } from "./dateInputIntl.mjs";
25
+ const te = "Please enter a valid value!", n = class n extends r.Component {
26
+ constructor(t) {
27
+ super(t), this.kendoDate = null, this.kendoDateObject = null, this.mounted = !1, this._element = null, this._wrapper = null, this._nativeEvent = null, this.focus = () => {
27
28
  this._element && this._element.focus();
28
29
  }, this.setValidity = () => {
29
30
  this.element && this.element.setCustomValidity && this.element.setCustomValidity(
30
- this.validity.valid ? "" : this.props.validationMessage || o.defaultProps.validationMessage
31
+ this.validity.valid ? "" : this.props.validationMessage || n.defaultProps.validationMessage
31
32
  );
32
- }, this.updateOnPaste = (t) => {
33
- if (!this.element || !this.kendoDate)
34
- return;
35
- const s = O(this).parseDate(this.element.value, this.props.format) || this.value, r = this.value;
36
- this.kendoDate.setValue(s), this.triggerChange(t, r);
37
- }, this.spinnersMouseDown = (t) => {
38
- t.preventDefault();
39
- const s = g(document);
33
+ }, this.updateOnPaste = (i) => {
34
+ !this.element || !this.kendoDate || this.triggerChange(i);
35
+ }, this.spinnersMouseDown = (i) => {
36
+ i.preventDefault();
37
+ const s = k(document);
40
38
  this.element && s !== this.element && this.element.focus({ preventScroll: !0 });
41
- }, this.handlePaste = () => {
42
- this.paste = !0;
43
- }, this.handleClick = (t) => {
44
- this.props.onChange && this.props.onChange(t);
45
- }, this.elementChange = (t) => {
46
- if (!this.element || !this.kendoDate)
47
- return;
48
- if (this.paste) {
49
- this.updateOnPaste(t), this.paste = !1;
50
- return;
51
- }
52
- const { text: s, format: r } = this.kendoDate.getTextAndFormat();
53
- this.currentFormat = r;
54
- const n = this.value, a = J(
55
- s,
56
- this.currentFormat,
57
- this.element.value,
58
- this.selection.start
59
- ), l = a.length === 1 && a[0][1] === "_";
60
- if (!l)
61
- for (let d = 0; d < a.length; d++)
62
- this.kendoDate.parsePart(a[d][0], a[d][1]);
63
- a.length && a[0][0] !== "_" && this.setSelection(this.selectionBySymbol(a[0][0])), l && this.switchDateSegment(1), this.triggerChange(t, n);
64
- }, this.elementClick = (t) => {
65
- this.setSelection(this.selectionByIndex(this.selection.start));
66
- }, this.nativeWheel = (t) => {
67
- g(document) === this.element && t.preventDefault();
68
- }, this.wheel = (t) => {
69
- g(document) === this.element && (t.nativeEvent.deltaY < 0 && this.increasePart(t), t.nativeEvent.deltaY > 0 && this.decreasePart(t));
70
- }, this.increasePart = (t) => {
71
- this.modifyDateSegmentValue(1, t);
72
- }, this.decreasePart = (t) => {
73
- this.modifyDateSegmentValue(-1, t);
74
- }, this.elementKeyDown = (t) => {
75
- if (!t.altKey) {
76
- switch (t.keyCode) {
77
- case 37:
78
- this.switchDateSegment(-1);
79
- break;
80
- case 38:
81
- this.modifyDateSegmentValue(1, t);
82
- break;
83
- case 39:
84
- this.switchDateSegment(1);
85
- break;
86
- case 40:
87
- this.modifyDateSegmentValue(-1, t);
88
- break;
89
- default:
90
- return;
91
- }
92
- t.preventDefault();
93
- }
94
- }, this.elementOnFocus = (t) => {
39
+ }, this.handleClick = (i) => {
40
+ this.props.onChange && this.props.onChange(i);
41
+ }, this.nativeWheel = (i) => {
42
+ k(document) === this.element && i.preventDefault();
43
+ }, this.increasePart = (i) => {
44
+ var s;
45
+ (s = this.kendoDate) == null || s.modifyDateSegmentValue(1), this.onChange(i);
46
+ }, this.decreasePart = (i) => {
47
+ var s;
48
+ (s = this.kendoDate) == null || s.modifyDateSegmentValue(-1), this.onChange(i);
49
+ }, this.elementOnFocus = (i) => {
95
50
  this.wrapper && this.wrapper.classList.add("k-focus"), this.setState({ focused: !0 });
96
- }, this.elementOnBlur = (t) => {
51
+ }, this.elementOnBlur = (i) => {
97
52
  this.wrapper && this.wrapper.classList.remove("k-focus"), this.setState({ focused: !1 });
98
- }, K(Z), this.state = {
53
+ }, q(X), this.state = {
99
54
  focused: !1
100
55
  };
101
56
  }
102
57
  get _inputId() {
103
58
  return this.props.id + "-accessibility-id";
104
59
  }
105
- /**
106
- * @hidden
107
- */
108
- componentDidMount() {
109
- this.setValidity(), this.wrapper && this.wrapper.addEventListener("wheel", this.nativeWheel, { passive: !1 });
110
- }
111
- /**
112
- * @hidden
113
- */
114
- componentDidUpdate(i, t) {
115
- this._lastSelectedSymbol && t.focused === this.state.focused ? this.setSelection(this.selectionBySymbol(this._lastSelectedSymbol)) : this.props.placeholder !== void 0 && this.selection.start === this.selection.end && this.setSelection({ start: 0, end: this.currentFormat.length }), this.setValidity();
116
- }
117
- /**
118
- * @hidden
119
- */
120
- componentWillUnmount() {
121
- this.wrapper && this.wrapper.removeEventListener("wheel", this.nativeWheel);
122
- }
123
- /**
124
- * @hidden
125
- */
126
- render() {
127
- const {
128
- size: i = o.defaultProps.size,
129
- fillMode: t = o.defaultProps.fillMode,
130
- rounded: s = o.defaultProps.rounded,
131
- autoFocus: r = o.defaultProps.autoFocus,
132
- unstyled: n
133
- } = this.props, a = n && n.uDateInput;
134
- this.props._ref && (this.props._ref.current = this);
135
- const l = N(this), d = { ...o.defaultProps, ...this.props }, { name: E, label: D, id: x, disabled: I } = d, u = this.text, T = u === this.props.placeholder ? "" : u, V = u === this.props.placeholder ? u : void 0, k = x || this._inputId, S = !this.validityStyles || this.validity.valid, F = /* @__PURE__ */ h.createElement(U, { onFocus: this.elementOnFocus, onBlur: this.elementOnBlur }, ({ onFocus: M, onBlur: B }) => /* @__PURE__ */ h.createElement(
136
- "span",
137
- {
138
- ref: (w) => {
139
- this._wrapper = w;
140
- },
141
- style: D ? void 0 : { width: this.props.width },
142
- dir: this.props.dir,
143
- className: p(
144
- c.wrapper({
145
- c: a,
146
- size: i,
147
- fillMode: t,
148
- rounded: s,
149
- disabled: I,
150
- required: this.required,
151
- invalid: !S
152
- }),
153
- this.props.className
154
- ),
155
- onFocus: M,
156
- onBlur: B
157
- },
158
- /* @__PURE__ */ h.createElement(
159
- "input",
160
- {
161
- role: this.props.ariaRole || "textbox",
162
- readOnly: this.props.readonly,
163
- tabIndex: this.props.tabIndex,
164
- disabled: this.props.disabled,
165
- title: this.props.title !== void 0 ? this.props.title : u,
166
- type: "text",
167
- spellCheck: !1,
168
- autoComplete: "off",
169
- autoCorrect: "off",
170
- autoFocus: r,
171
- className: p(c.inputInner({ c: a })),
172
- id: k,
173
- "aria-label": this.props.ariaLabel,
174
- "aria-labelledby": this.props.ariaLabelledBy,
175
- "aria-describedby": this.props.ariaDescribedBy,
176
- "aria-haspopup": this.props.ariaHasPopup,
177
- "aria-disabled": this.props.disabled,
178
- "aria-expanded": this.props.ariaExpanded,
179
- "aria-controls": this.props.ariaControls,
180
- "aria-required": this.props.required,
181
- "aria-invalid": !S,
182
- onWheel: this.wheel,
183
- onClick: this.elementClick,
184
- onInput: this.elementChange,
185
- onPaste: this.handlePaste,
186
- onKeyDown: this.elementKeyDown,
187
- onChange: H,
188
- value: T,
189
- placeholder: V,
190
- name: E,
191
- ref: (w) => this._element = w
192
- }
193
- ),
194
- this.props.children,
195
- this.props.clearButton && this.props.value && /* @__PURE__ */ h.createElement(ne, { onClick: this.handleClick, key: "clearbutton" }),
196
- this.props.spinners && /* @__PURE__ */ h.createElement(
197
- "span",
198
- {
199
- className: p(c.inputSpinner({ c: a })),
200
- onMouseDown: this.spinnersMouseDown
201
- },
202
- /* @__PURE__ */ h.createElement(
203
- P,
204
- {
205
- tabIndex: -1,
206
- type: "button",
207
- rounded: null,
208
- className: p(c.spinnerIncrease({ c: a })),
209
- icon: "caret-alt-up",
210
- svgIcon: L,
211
- "aria-label": l.toLanguageString(
212
- v,
213
- y[v]
214
- ),
215
- title: l.toLanguageString(v, y[v]),
216
- onClick: this.increasePart
217
- }
218
- ),
219
- /* @__PURE__ */ h.createElement(
220
- P,
221
- {
222
- tabIndex: -1,
223
- type: "button",
224
- rounded: null,
225
- className: p(c.spinnerDecrease({ c: a })),
226
- icon: "caret-alt-down",
227
- svgIcon: A,
228
- "aria-label": l.toLanguageString(
229
- b,
230
- y[b]
231
- ),
232
- title: l.toLanguageString(b, y[b]),
233
- onClick: this.decreasePart
234
- }
235
- )
236
- )
237
- ));
238
- return D ? /* @__PURE__ */ h.createElement(
239
- W,
240
- {
241
- label: D,
242
- editorId: k,
243
- editorValue: u,
244
- editorValid: S,
245
- editorDisabled: this.props.disabled,
246
- children: F,
247
- style: { width: this.props.width }
248
- }
249
- ) : F;
250
- }
251
60
  /* Public Getters */
252
61
  /**
253
62
  * Gets the value of the DateInput.
254
63
  */
255
64
  get value() {
256
- return this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.kendoDate && this.kendoDate.getDateObject();
65
+ return this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.kendoDate && this.kendoDate.value;
257
66
  }
258
67
  /**
259
68
  * Gets the `name` property of the DateInput.
@@ -262,35 +71,32 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
262
71
  return this.props.name;
263
72
  }
264
73
  get min() {
265
- return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
74
+ return this.props.min !== void 0 ? this.props.min : n.defaultProps.min;
266
75
  }
267
76
  get max() {
268
- return this.props.max !== void 0 ? this.props.max : o.defaultProps.max;
77
+ return this.props.max !== void 0 ? this.props.max : n.defaultProps.max;
78
+ }
79
+ get isInSegmentSelection() {
80
+ const { year: t, month: i, day: s, hours: o, minutes: l, seconds: a } = this.kendoDateObject;
81
+ return (!t || !i || !s || !o || !l || !a) && (t || i || s || o || l || a);
269
82
  }
270
83
  /**
271
84
  * @hidden
272
85
  */
273
86
  get text() {
274
- const i = { ...C.defaultProps, ...this.props }, {
275
- formatPlaceholder: t = o.defaultProps.formatPlaceholder,
276
- format: s = o.defaultProps.format,
277
- value: r,
278
- defaultValue: n
279
- } = i;
280
- this.kendoDate === null ? (this.kendoDate = new z(this.intl.bind(this), t, s), this.kendoDate.setValue(r || n || null)) : (this.kendoDate.format = s, this.kendoDate.formatPlaceholder = t), r !== void 0 && this.value !== r && this.kendoDate.setValue(r);
281
- const { text: a, format: l } = this.kendoDate.getTextAndFormat();
282
- return this.currentFormat = l, i.placeholder !== null && i.placeholder !== void 0 && !this.state.focused && !this.kendoDate.hasValue() ? i.placeholder : a;
87
+ const { placeholder: t } = this.props, i = this.kendoDate && this.kendoDate.currentText || "";
88
+ return t != null && !this.state.focused && !this.value ? t : i;
283
89
  }
284
90
  /**
285
91
  * Represents the validity state into which the DateInput is set.
286
92
  */
287
93
  get validity() {
288
- const i = ee(this.value, this.min, this.max) && ae(this.value, this.props.minTime, this.props.maxTime), t = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && i, r = this.props.valid !== void 0 ? this.props.valid : s;
94
+ const t = W(this.value, this.min, this.max) && J(this.value, this.props.minTime, this.props.maxTime), i = this.props.validationMessage !== void 0, s = (!this.required || this.value !== null) && t, o = this.props.valid !== void 0 ? this.props.valid : s;
289
95
  return {
290
- customError: t,
96
+ customError: i,
291
97
  rangeOverflow: this.value && this.max.getTime() < this.value.getTime() || !1,
292
98
  rangeUnderflow: this.value && this.value.getTime() < this.min.getTime() || !1,
293
- valid: r,
99
+ valid: o,
294
100
  valueMissing: this.value === null
295
101
  };
296
102
  }
@@ -332,7 +138,7 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
332
138
  * @hidden
333
139
  */
334
140
  get validityStyles() {
335
- return this.props.validityStyles !== void 0 ? this.props.validityStyles : o.defaultProps.validityStyles;
141
+ return this.props.validityStyles !== void 0 ? this.props.validityStyles : n.defaultProps.validityStyles;
336
142
  }
337
143
  /**
338
144
  * @hidden
@@ -349,74 +155,198 @@ const oe = "Please enter a valid value!", o = class o extends h.Component {
349
155
  /**
350
156
  * @hidden
351
157
  */
352
- intl() {
353
- return O(this);
354
- }
355
- /* end handlers */
356
- get selection() {
357
- let i = { start: 0, end: 0 };
358
- return this.element !== null && this.element.selectionStart !== void 0 && (i = { start: this.element.selectionStart, end: this.element.selectionEnd }), i;
158
+ get options() {
159
+ return {
160
+ format: this.props.format,
161
+ steps: this.props.steps,
162
+ formatPlaceholder: I,
163
+ placeholder: this.props.placeholder,
164
+ selectPreviousSegmentOnBackspace: !0,
165
+ allowCaretMode: !1,
166
+ value: this.props.value || this.value,
167
+ intlService: new ee(E(this)),
168
+ enableMouseWheel: !0,
169
+ // TODO: extract as an option
170
+ autoCorrectParts: !0,
171
+ // TODO: extract as an option
172
+ autoSwitchParts: !0,
173
+ // TODO: extract as an option
174
+ autoSwitchKeys: [],
175
+ // TODO: extract as an option
176
+ twoDigitYearMax: 68
177
+ // TODO: extract as an option
178
+ };
359
179
  }
360
- setSelection(i) {
361
- this._lastSelectedSymbol = this.currentFormat[i.start], window.requestAnimationFrame(() => {
362
- const t = g(document);
363
- this.element && t === this.element && !this.props.disableSelection && this.element.setSelectionRange(i.start, i.end);
364
- });
180
+ /**
181
+ * @hidden
182
+ */
183
+ componentDidMount() {
184
+ this.setValidity(), this.mounted || (this.wrapper && this.wrapper.addEventListener("wheel", this.nativeWheel, { passive: !1 }), this.kendoDate = this.initKendoDate(), this.kendoDateObject = this.kendoDate.dateObject, this.mounted = !0);
365
185
  }
366
- triggerChange(i, t) {
367
- this.valueDuringOnChange = this.value, this.forceUpdate(), this.props.onChange && !_(t, this.value) && this.props.onChange.call(void 0, {
368
- syntheticEvent: i,
369
- nativeEvent: i.nativeEvent,
370
- value: this.value,
371
- target: this
372
- // inRange: this.props.min && this.props.max ? isInRange(value, this.props.min, this.props.max) : true
373
- }), this.valueDuringOnChange = void 0;
186
+ /**
187
+ * @hidden
188
+ */
189
+ componentDidUpdate(t) {
190
+ this.setValidity(), this.kendoDate && ((t.format !== this.props.format || t.readonly !== this.props.readonly || t.steps !== this.props.steps) && this.kendoDate.setOptions(this.options, !0), t.value !== this.props.value && (this.kendoDateObject.getValue() !== null || this.isInSegmentSelection && this.props.value !== null) && this.kendoDateObject.setValue(this.props.value), this.props.ariaExpanded !== void 0 && this.props.ariaExpanded && (this.kendoDate.options.placeholder = null), this.props.ariaExpanded !== void 0 && !this.props.ariaExpanded && (this.kendoDate.options.placeholder = this.props.placeholder), this.kendoDate.refreshElementValue());
374
191
  }
375
- selectionBySymbol(i) {
376
- let t = -1, s = 0;
377
- for (let r = 0; r < this.currentFormat.length; r++)
378
- this.currentFormat[r] === i && (s = r + 1, t === -1 && (t = r));
379
- return t < 0 && (t = 0), { start: t, end: s };
192
+ /**
193
+ * @hidden
194
+ */
195
+ componentWillUnmount() {
196
+ this.wrapper && this.wrapper.removeEventListener("wheel", this.nativeWheel);
380
197
  }
381
- selectionByIndex(i) {
382
- let t = { start: i, end: i };
383
- for (let s = i, r = i - 1; s < this.currentFormat.length || r >= 0; s++, r--) {
384
- if (s < this.currentFormat.length && this.currentFormat[s] !== "_") {
385
- t = this.selectionBySymbol(this.currentFormat[s]);
386
- break;
387
- }
388
- if (r >= 0 && this.currentFormat[r] !== "_") {
389
- t = this.selectionBySymbol(this.currentFormat[r]);
390
- break;
198
+ /**
199
+ * @hidden
200
+ */
201
+ render() {
202
+ var C;
203
+ const {
204
+ size: t = n.defaultProps.size,
205
+ fillMode: i = n.defaultProps.fillMode,
206
+ rounded: s = n.defaultProps.rounded,
207
+ autoFocus: o = n.defaultProps.autoFocus,
208
+ unstyled: l
209
+ } = this.props, a = l && l.uDateInput;
210
+ this.props._ref && (this.props._ref.current = this);
211
+ const u = A(this), x = { ...n.defaultProps, ...this.props }, { name: P, label: v, id: S, disabled: T } = x, M = this.text, D = S || this._inputId, b = !this.validityStyles || this.validity.valid, O = /* @__PURE__ */ r.createElement(
212
+ "span",
213
+ {
214
+ ref: (y) => {
215
+ this._wrapper = y;
216
+ },
217
+ style: v ? void 0 : { width: this.props.width },
218
+ dir: this.props.dir,
219
+ className: h(
220
+ p.wrapper({
221
+ c: a,
222
+ size: t,
223
+ fillMode: i,
224
+ rounded: s,
225
+ disabled: T,
226
+ required: this.required,
227
+ invalid: !b
228
+ }),
229
+ this.props.className
230
+ )
231
+ },
232
+ /* @__PURE__ */ r.createElement(
233
+ "input",
234
+ {
235
+ role: this.props.ariaRole || "textbox",
236
+ readOnly: this.props.readonly,
237
+ tabIndex: this.props.tabIndex || 0,
238
+ disabled: this.props.disabled,
239
+ title: this.props.title !== void 0 ? this.props.title : M,
240
+ type: "text",
241
+ spellCheck: !1,
242
+ autoComplete: "off",
243
+ autoCorrect: "off",
244
+ autoFocus: o,
245
+ className: h(p.inputInner({ c: a })),
246
+ id: D,
247
+ "aria-label": this.props.ariaLabel,
248
+ "aria-labelledby": this.props.ariaLabelledBy,
249
+ "aria-describedby": this.props.ariaDescribedBy,
250
+ "aria-haspopup": this.props.ariaHasPopup,
251
+ "aria-disabled": this.props.disabled,
252
+ "aria-expanded": this.props.ariaExpanded,
253
+ "aria-controls": this.props.ariaControls,
254
+ "aria-required": this.props.required,
255
+ "aria-invalid": !b,
256
+ onKeyDown: this.onChange.bind(this),
257
+ onChange: this.onChange.bind(this),
258
+ onWheel: this.onChange.bind(this),
259
+ onInput: this.onChange.bind(this),
260
+ onClick: this.onChange.bind(this),
261
+ name: P,
262
+ ref: (y) => this._element = y
263
+ }
264
+ ),
265
+ this.props.children,
266
+ this.props.clearButton && this.props.value && /* @__PURE__ */ r.createElement(Q, { onClick: this.handleClick, key: "clearbutton" }),
267
+ this.props.spinners && /* @__PURE__ */ r.createElement(
268
+ "span",
269
+ {
270
+ className: h(p.inputSpinner({ c: a })),
271
+ onMouseDown: this.spinnersMouseDown
272
+ },
273
+ /* @__PURE__ */ r.createElement(
274
+ w,
275
+ {
276
+ tabIndex: -1,
277
+ type: "button",
278
+ rounded: null,
279
+ className: h(p.spinnerIncrease({ c: a })),
280
+ icon: "caret-alt-up",
281
+ svgIcon: _,
282
+ "aria-label": u.toLanguageString(c, g[c]),
283
+ title: u.toLanguageString(c, g[c]),
284
+ onClick: this.increasePart
285
+ }
286
+ ),
287
+ /* @__PURE__ */ r.createElement(
288
+ w,
289
+ {
290
+ tabIndex: -1,
291
+ type: "button",
292
+ rounded: null,
293
+ className: h(p.spinnerDecrease({ c: a })),
294
+ icon: "caret-alt-down",
295
+ svgIcon: V,
296
+ "aria-label": u.toLanguageString(f, g[f]),
297
+ title: u.toLanguageString(f, g[f]),
298
+ onClick: this.decreasePart
299
+ }
300
+ )
301
+ )
302
+ );
303
+ return v ? /* @__PURE__ */ r.createElement(
304
+ j,
305
+ {
306
+ label: v,
307
+ editorId: D,
308
+ editorValue: (C = this._element) == null ? void 0 : C.value,
309
+ editorValid: b,
310
+ editorDisabled: this.props.disabled,
311
+ children: O,
312
+ style: { width: this.props.width }
391
313
  }
392
- }
393
- return t;
314
+ ) : O;
394
315
  }
395
- switchDateSegment(i) {
396
- const { start: t, end: s } = this.selection;
397
- if (t < s && this.currentFormat[t] !== this.currentFormat[s - 1]) {
398
- this.setSelection(this.selectionByIndex(i > 0 ? t : s - 1));
399
- return;
400
- }
401
- const r = this.currentFormat[t];
402
- let n = t + i;
403
- for (; n > 0 && n < this.currentFormat.length && !(this.currentFormat[n] !== r && this.currentFormat[n] !== "_"); )
404
- n += i;
405
- if (this.currentFormat[n] === "_")
406
- return;
407
- let a = n;
408
- for (; a >= 0 && a < this.currentFormat.length && this.currentFormat[a] === this.currentFormat[n]; )
409
- a += i;
410
- n > a && (a + 1 !== t || n + 1 !== s) ? this.setSelection({ start: a + 1, end: n + 1 }) : n < a && (n !== t || a !== s) && this.setSelection({ start: n, end: a });
316
+ /**
317
+ * @hidden
318
+ */
319
+ intl() {
320
+ return E(this);
321
+ }
322
+ get intlCommon() {
323
+ return this.intlProvider();
324
+ }
325
+ /* end handlers */
326
+ triggerChange(t) {
327
+ this.valueDuringOnChange = this.value, this.forceUpdate(), this._nativeEvent = t, this.valueDuringOnChange = void 0;
328
+ }
329
+ onChange(t) {
330
+ this._nativeEvent && this.props.onChange && !L(this._nativeEvent.oldValue, this.value) && this.props.onChange.call(void 0, {
331
+ syntheticEvent: t,
332
+ nativeEvent: this._nativeEvent.event,
333
+ value: this._nativeEvent.value,
334
+ target: this
335
+ }), this._nativeEvent = null;
411
336
  }
412
- modifyDateSegmentValue(i, t) {
413
- if (!this.kendoDate)
414
- return;
415
- const s = this.value, r = this.currentFormat[this.selection.start], n = this.kendoDate.symbolMap(r), a = ((this.props.steps || {})[n] || 1) * i;
416
- this.kendoDate.modifyPart(r, a), this.triggerChange(t, s);
337
+ initKendoDate() {
338
+ return new H(this._element, {
339
+ ...this.options,
340
+ events: {
341
+ focus: this.elementOnFocus.bind(this),
342
+ blur: this.elementOnBlur.bind(this),
343
+ valueChange: this.triggerChange.bind(this),
344
+ click: this.handleClick.bind(this)
345
+ }
346
+ });
417
347
  }
418
348
  };
419
- o.displayName = "DateInput", o.propTypes = {
349
+ n.displayName = "DateInput", n.propTypes = {
420
350
  value: e.instanceOf(Date),
421
351
  format: e.oneOfType([
422
352
  e.string,
@@ -488,38 +418,37 @@ o.displayName = "DateInput", o.propTypes = {
488
418
  rounded: e.oneOf([null, "small", "medium", "large", "full"]),
489
419
  fillMode: e.oneOf([null, "solid", "flat", "outline"]),
490
420
  autoFocus: e.bool
491
- }, o.defaultProps = {
492
- format: Q,
421
+ }, n.defaultProps = {
422
+ format: K,
493
423
  size: "medium",
494
424
  rounded: "medium",
495
425
  fillMode: "solid",
496
- formatPlaceholder: $,
497
- // defaultValue: null as Date | null,
426
+ formatPlaceholder: I,
498
427
  spinners: !1,
499
428
  disabled: !1,
500
- max: f(te),
501
- min: f(ie),
502
- minTime: f(se),
503
- maxTime: f(re),
429
+ max: m(G),
430
+ min: m(Y),
431
+ minTime: m(Z),
432
+ maxTime: m($),
504
433
  validityStyles: !0,
505
- validationMessage: oe,
434
+ validationMessage: te,
506
435
  placeholder: null,
507
436
  // the rest of the properties are undefined by default
508
437
  ariaHasPopup: "grid",
509
438
  autoFocus: !1
510
439
  };
511
- let m = o;
512
- const le = j(), C = X(
513
- Y(
514
- le,
515
- G(m)
440
+ let d = n;
441
+ const ie = B(), se = R(
442
+ U(
443
+ ie,
444
+ z(d)
516
445
  )
517
446
  );
518
- C.displayName = "KendoReactDateInput";
519
- q(m);
520
- R(m);
447
+ se.displayName = "KendoReactDateInput";
448
+ F(d);
449
+ N(d);
521
450
  export {
522
- C as DateInput,
523
- le as DateInputPropsContext,
524
- m as DateInputWithoutContext
451
+ se as DateInput,
452
+ ie as DateInputPropsContext,
453
+ d as DateInputWithoutContext
525
454
  };