@progress/kendo-react-dateinputs 9.0.0-develop.9 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +107 -93
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +97 -83
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +82 -68
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/index.d.mts +111 -10
- package/index.d.ts +111 -10
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +78 -68
|
@@ -8,41 +8,41 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as a from "react";
|
|
10
10
|
import e from "prop-types";
|
|
11
|
-
import { Popup as
|
|
11
|
+
import { Popup as G } from "@progress/kendo-react-popup";
|
|
12
12
|
import { cloneDate as y } from "@progress/kendo-date-math";
|
|
13
|
-
import { classNames as c, uTimePicker as g, Keys as d, validatePackage as
|
|
14
|
-
import { clockIcon as
|
|
15
|
-
import { provideLocalizationService as
|
|
16
|
-
import { packageMetadata as
|
|
17
|
-
import { toggleClock as f, messages as u, timePickerCancel as
|
|
18
|
-
import { DateInput as
|
|
19
|
-
import { TimeSelector as
|
|
20
|
-
import { MAX_TIME as
|
|
21
|
-
import { isInRange as
|
|
22
|
-
import { PickerFloatingLabel as
|
|
23
|
-
import { Button as
|
|
24
|
-
import { MOBILE_MEDIUM_DEVISE as
|
|
25
|
-
import { AdaptiveMode as
|
|
26
|
-
import { ActionSheetContent as
|
|
13
|
+
import { classNames as c, uTimePicker as g, Keys as d, validatePackage as X, canUseDOM as I, AsyncFocusBlur as Z, createPropsContext as J, withIdHOC as Q, withPropsContext as Y, withUnstyledHOC as $ } from "@progress/kendo-react-common";
|
|
14
|
+
import { clockIcon as ee } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { provideLocalizationService as te, registerForLocalization as ie } from "@progress/kendo-react-intl";
|
|
16
|
+
import { packageMetadata as se } from "../package-metadata.mjs";
|
|
17
|
+
import { toggleClock as f, messages as u, timePickerCancel as oe, timePickerSet as C, toggleTimeSelector as T } from "../messages/index.mjs";
|
|
18
|
+
import { DateInput as ne } from "../dateinput/DateInput.mjs";
|
|
19
|
+
import { TimeSelector as ae } from "./TimeSelector.mjs";
|
|
20
|
+
import { MAX_TIME as re, MIN_TIME as le, setTime as M, MIDNIGHT_DATE as he } from "../utils.mjs";
|
|
21
|
+
import { isInRange as de, isBiggerThanMax as ue, isSmallerThanMin as pe } from "./utils.mjs";
|
|
22
|
+
import { PickerFloatingLabel as me } from "../hooks/usePickerFloatingLabel.mjs";
|
|
23
|
+
import { Button as ce } from "@progress/kendo-react-buttons";
|
|
24
|
+
import { MOBILE_MEDIUM_DEVISE as ge } from "../common/constants.mjs";
|
|
25
|
+
import { AdaptiveMode as fe } from "../common/AdaptiveMode.mjs";
|
|
26
|
+
import { ActionSheetContent as ve } from "@progress/kendo-react-layout";
|
|
27
27
|
const n = class n extends a.Component {
|
|
28
28
|
constructor(i) {
|
|
29
29
|
super(i), this._element = null, this._dateInput = a.createRef(), this._timeSelector = null, this.shouldFocusDateInput = !1, this.prevShow = !1, this.focus = () => {
|
|
30
30
|
this.dateInput && this.dateInput.focus();
|
|
31
31
|
}, this.renderTimeSelector = () => {
|
|
32
|
-
const { smoothScroll: t, cancelButton: s, nowButton: o, disabled:
|
|
32
|
+
const { smoothScroll: t, cancelButton: s, nowButton: o, disabled: l, format: h, steps: r, unstyled: m } = this.props;
|
|
33
33
|
return /* @__PURE__ */ a.createElement(
|
|
34
|
-
|
|
34
|
+
ae,
|
|
35
35
|
{
|
|
36
36
|
ref: this.setTimeSelectorRef,
|
|
37
37
|
mobileMode: this.mobileMode,
|
|
38
38
|
show: this.show,
|
|
39
39
|
cancelButton: s,
|
|
40
|
-
disabled:
|
|
40
|
+
disabled: l,
|
|
41
41
|
nowButton: o,
|
|
42
42
|
format: h,
|
|
43
43
|
min: this.min,
|
|
44
44
|
max: this.max,
|
|
45
|
-
steps:
|
|
45
|
+
steps: r,
|
|
46
46
|
smoothScroll: t,
|
|
47
47
|
value: this.value,
|
|
48
48
|
footer: !this.mobileMode,
|
|
@@ -53,8 +53,8 @@ const n = class n extends a.Component {
|
|
|
53
53
|
}
|
|
54
54
|
);
|
|
55
55
|
}, this.renderPopup = () => {
|
|
56
|
-
const { popupClass: t, ...s } = this.popupSettings, { unstyled: o } = this.props,
|
|
57
|
-
popupClass: g.popup({ c:
|
|
56
|
+
const { popupClass: t, ...s } = this.popupSettings, { unstyled: o } = this.props, l = o && o.uTimePicker, h = c(t), r = {
|
|
57
|
+
popupClass: g.popup({ c: l }),
|
|
58
58
|
show: this.show,
|
|
59
59
|
animate: this.element !== null,
|
|
60
60
|
anchor: this.element,
|
|
@@ -70,7 +70,7 @@ const n = class n extends a.Component {
|
|
|
70
70
|
},
|
|
71
71
|
...s
|
|
72
72
|
};
|
|
73
|
-
return this.props.popup ? /* @__PURE__ */ a.createElement(this.props.popup, { ...
|
|
73
|
+
return this.props.popup ? /* @__PURE__ */ a.createElement(this.props.popup, { ...r }, this.renderTimeSelector()) : /* @__PURE__ */ a.createElement(G, { ...r }, this.renderTimeSelector());
|
|
74
74
|
}, this.renderAdaptivePopup = () => {
|
|
75
75
|
const { windowWidth: t = 0 } = this.state, s = {
|
|
76
76
|
expand: this.show,
|
|
@@ -78,13 +78,13 @@ const n = class n extends a.Component {
|
|
|
78
78
|
adaptiveTitle: this.props.adaptiveTitle,
|
|
79
79
|
windowWidth: t,
|
|
80
80
|
footer: {
|
|
81
|
-
cancelText: this.localizationService.toLanguageString(f, u[
|
|
81
|
+
cancelText: this.localizationService.toLanguageString(f, u[oe]),
|
|
82
82
|
onCancel: this.handleValueReject,
|
|
83
|
-
applyText: this.localizationService.toLanguageString(
|
|
83
|
+
applyText: this.localizationService.toLanguageString(C, u[C]),
|
|
84
84
|
onApply: (o) => this.handleValueChange(o)
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
return /* @__PURE__ */ a.createElement(
|
|
87
|
+
return /* @__PURE__ */ a.createElement(fe, { ...s }, /* @__PURE__ */ a.createElement(ve, { overflowHidden: !0 }, this.renderTimeSelector()));
|
|
88
88
|
}, this.setTimeSelectorRef = (t) => {
|
|
89
89
|
this._timeSelector = t;
|
|
90
90
|
}, 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.handleInputValueChange = (t) => {
|
|
@@ -121,7 +121,7 @@ const n = class n extends a.Component {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
s && (o === d.up || o === d.down) && (t.preventDefault(), t.stopPropagation(), this.shouldFocusDateInput = o === d.up, this.setShow(o === d.down));
|
|
124
|
-
},
|
|
124
|
+
}, X(se), this.state = {
|
|
125
125
|
value: this.props.defaultValue || n.defaultProps.defaultValue,
|
|
126
126
|
show: this.props.defaultShow || n.defaultProps.defaultShow,
|
|
127
127
|
focused: !1,
|
|
@@ -176,12 +176,12 @@ const n = class n extends a.Component {
|
|
|
176
176
|
* Represents the validity state into which the TimePicker is set.
|
|
177
177
|
*/
|
|
178
178
|
get validity() {
|
|
179
|
-
const i = this.value && this.normalizeTime(this.value), t = this.normalizeTime(this.min), s = this.normalizeTime(this.max), o =
|
|
179
|
+
const i = this.value && this.normalizeTime(this.value), t = this.normalizeTime(this.min), s = this.normalizeTime(this.max), o = de(i, t, s), l = this.props.validationMessage !== void 0, h = (!this.required || this.value !== null) && o, r = this.props.valid !== void 0 ? this.props.valid : h;
|
|
180
180
|
return {
|
|
181
|
-
customError:
|
|
182
|
-
rangeOverflow:
|
|
183
|
-
rangeUnderflow:
|
|
184
|
-
valid:
|
|
181
|
+
customError: l,
|
|
182
|
+
rangeOverflow: ue(i, s),
|
|
183
|
+
rangeUnderflow: pe(i, t),
|
|
184
|
+
valid: r,
|
|
185
185
|
valueMissing: this.value === null
|
|
186
186
|
};
|
|
187
187
|
}
|
|
@@ -189,7 +189,7 @@ const n = class n extends a.Component {
|
|
|
189
189
|
* The mobile mode of the ComboBox.
|
|
190
190
|
*/
|
|
191
191
|
get mobileMode() {
|
|
192
|
-
return !!(this.state.windowWidth && this.state.windowWidth <=
|
|
192
|
+
return !!(this.state.windowWidth && this.state.windowWidth <= ge && this.props.adaptive);
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* @hidden
|
|
@@ -216,7 +216,7 @@ const n = class n extends a.Component {
|
|
|
216
216
|
return this.props.dateInput || n.defaultProps.dateInput;
|
|
217
217
|
}
|
|
218
218
|
get localizationService() {
|
|
219
|
-
return
|
|
219
|
+
return te(this);
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* @hidden
|
|
@@ -247,9 +247,9 @@ const n = class n extends a.Component {
|
|
|
247
247
|
rounded: t = n.defaultProps.rounded,
|
|
248
248
|
fillMode: s = n.defaultProps.fillMode,
|
|
249
249
|
disabled: o,
|
|
250
|
-
tabIndex:
|
|
250
|
+
tabIndex: l,
|
|
251
251
|
title: h,
|
|
252
|
-
id:
|
|
252
|
+
id: r,
|
|
253
253
|
className: m,
|
|
254
254
|
format: D,
|
|
255
255
|
formatPlaceholder: O,
|
|
@@ -261,12 +261,17 @@ const n = class n extends a.Component {
|
|
|
261
261
|
validityStyles: B,
|
|
262
262
|
ariaLabelledBy: R,
|
|
263
263
|
ariaDescribedBy: V,
|
|
264
|
-
unstyled: v
|
|
265
|
-
|
|
264
|
+
unstyled: v,
|
|
265
|
+
enableMouseWheel: F,
|
|
266
|
+
autoCorrectParts: A,
|
|
267
|
+
autoSwitchParts: N,
|
|
268
|
+
autoSwitchKeys: L,
|
|
269
|
+
allowCaretMode: _
|
|
270
|
+
} = this.props, w = v && v.uTimePicker, S = !this.validityStyles || this.validity.valid, q = {
|
|
266
271
|
disabled: o,
|
|
267
272
|
format: D,
|
|
268
273
|
formatPlaceholder: O,
|
|
269
|
-
id:
|
|
274
|
+
id: r,
|
|
270
275
|
ariaLabelledBy: R,
|
|
271
276
|
ariaDescribedBy: V,
|
|
272
277
|
max: this.normalizeTime(this.max),
|
|
@@ -275,7 +280,7 @@ const n = class n extends a.Component {
|
|
|
275
280
|
onChange: this.handleInputValueChange,
|
|
276
281
|
required: k,
|
|
277
282
|
steps: x,
|
|
278
|
-
tabIndex: this.show ? -1 :
|
|
283
|
+
tabIndex: this.show ? -1 : l,
|
|
279
284
|
title: h,
|
|
280
285
|
valid: this.validity.valid,
|
|
281
286
|
validationMessage: E,
|
|
@@ -288,24 +293,29 @@ const n = class n extends a.Component {
|
|
|
288
293
|
size: null,
|
|
289
294
|
fillMode: null,
|
|
290
295
|
rounded: null,
|
|
291
|
-
readonly: this.mobileMode
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
296
|
+
readonly: this.mobileMode,
|
|
297
|
+
enableMouseWheel: F,
|
|
298
|
+
autoCorrectParts: A,
|
|
299
|
+
autoSwitchParts: N,
|
|
300
|
+
autoSwitchKeys: L,
|
|
301
|
+
allowCaretMode: _
|
|
302
|
+
}, K = this.localizationService.toLanguageString(f, u[f]), U = this.localizationService.toLanguageString(
|
|
303
|
+
T,
|
|
304
|
+
u[T]
|
|
295
305
|
), b = /* @__PURE__ */ a.createElement(
|
|
296
|
-
|
|
306
|
+
Z,
|
|
297
307
|
{
|
|
298
308
|
onFocus: this.handleFocus,
|
|
299
309
|
onBlur: this.mobileMode ? void 0 : this.handleBlur,
|
|
300
310
|
onSyncBlur: this.props.onBlur,
|
|
301
311
|
onSyncFocus: this.props.onFocus
|
|
302
312
|
},
|
|
303
|
-
({ onFocus:
|
|
313
|
+
({ onFocus: H, onBlur: j }) => /* @__PURE__ */ a.createElement(a.Fragment, null, /* @__PURE__ */ a.createElement(
|
|
304
314
|
"span",
|
|
305
315
|
{
|
|
306
316
|
id: this.props.id,
|
|
307
|
-
ref: (
|
|
308
|
-
this._element =
|
|
317
|
+
ref: (W) => {
|
|
318
|
+
this._element = W;
|
|
309
319
|
},
|
|
310
320
|
className: c(
|
|
311
321
|
g.wrapper({
|
|
@@ -321,8 +331,8 @@ const n = class n extends a.Component {
|
|
|
321
331
|
),
|
|
322
332
|
onKeyDown: this.handleKeyDown,
|
|
323
333
|
style: { width: P },
|
|
324
|
-
onFocus:
|
|
325
|
-
onBlur:
|
|
334
|
+
onFocus: H,
|
|
335
|
+
onBlur: j,
|
|
326
336
|
onClick: this.mobileMode ? this.handleIconClick : void 0
|
|
327
337
|
},
|
|
328
338
|
/* @__PURE__ */ a.createElement(
|
|
@@ -331,34 +341,34 @@ const n = class n extends a.Component {
|
|
|
331
341
|
_ref: this._dateInput,
|
|
332
342
|
ariaRole: "combobox",
|
|
333
343
|
ariaControls: this._popupId,
|
|
334
|
-
...
|
|
344
|
+
...q
|
|
335
345
|
}
|
|
336
346
|
),
|
|
337
347
|
/* @__PURE__ */ a.createElement(
|
|
338
|
-
|
|
348
|
+
ce,
|
|
339
349
|
{
|
|
340
350
|
tabIndex: -1,
|
|
341
351
|
type: "button",
|
|
342
352
|
icon: "clock",
|
|
343
|
-
svgIcon:
|
|
353
|
+
svgIcon: ee,
|
|
344
354
|
onMouseDown: this.handleIconMouseDown,
|
|
345
355
|
onClick: this.mobileMode ? void 0 : this.handleIconClick,
|
|
346
|
-
title:
|
|
356
|
+
title: U,
|
|
347
357
|
className: c(g.inputButton({ c: w })),
|
|
348
358
|
rounded: null,
|
|
349
359
|
fillMode: s,
|
|
350
|
-
"aria-label":
|
|
360
|
+
"aria-label": K
|
|
351
361
|
}
|
|
352
362
|
),
|
|
353
363
|
!this.mobileMode && this.renderPopup()
|
|
354
364
|
), this.mobileMode && this.renderAdaptivePopup())
|
|
355
365
|
);
|
|
356
366
|
return this.props.label ? /* @__PURE__ */ a.createElement(
|
|
357
|
-
|
|
367
|
+
me,
|
|
358
368
|
{
|
|
359
369
|
dateInput: this._dateInput,
|
|
360
370
|
label: this.props.label,
|
|
361
|
-
editorId:
|
|
371
|
+
editorId: r,
|
|
362
372
|
editorValid: S,
|
|
363
373
|
editorDisabled: this.props.disabled,
|
|
364
374
|
children: b,
|
|
@@ -367,7 +377,7 @@ const n = class n extends a.Component {
|
|
|
367
377
|
) : b;
|
|
368
378
|
}
|
|
369
379
|
normalizeTime(i) {
|
|
370
|
-
return M(
|
|
380
|
+
return M(he, i);
|
|
371
381
|
}
|
|
372
382
|
setShow(i) {
|
|
373
383
|
const { onOpen: t, onClose: s } = this.props;
|
|
@@ -462,28 +472,28 @@ n.displayName = "TimePicker", n.propTypes = {
|
|
|
462
472
|
defaultValue: null,
|
|
463
473
|
disabled: !1,
|
|
464
474
|
format: "t",
|
|
465
|
-
max:
|
|
466
|
-
min:
|
|
475
|
+
max: re,
|
|
476
|
+
min: le,
|
|
467
477
|
popupSettings: {},
|
|
468
478
|
tabIndex: 0,
|
|
469
479
|
steps: {},
|
|
470
480
|
validityStyles: !0,
|
|
471
|
-
dateInput:
|
|
481
|
+
dateInput: ne,
|
|
472
482
|
size: "medium",
|
|
473
483
|
rounded: "medium",
|
|
474
484
|
fillMode: "solid"
|
|
475
485
|
};
|
|
476
486
|
let p = n;
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
487
|
+
const we = J(), Se = Q(
|
|
488
|
+
Y(
|
|
489
|
+
we,
|
|
490
|
+
$(p)
|
|
481
491
|
)
|
|
482
492
|
);
|
|
483
|
-
|
|
484
|
-
|
|
493
|
+
Se.displayName = "KendoReactTimePicker";
|
|
494
|
+
ie(p);
|
|
485
495
|
export {
|
|
486
|
-
|
|
487
|
-
|
|
496
|
+
Se as TimePicker,
|
|
497
|
+
we as TimePickerPropsContext,
|
|
488
498
|
p as TimePickerWithoutContext
|
|
489
499
|
};
|