@progress/kendo-react-dateinputs 7.2.4-develop.3 → 7.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.
Files changed (200) hide show
  1. package/calendar/components/Calendar.js +12 -0
  2. package/calendar/components/Calendar.mjs +328 -0
  3. package/calendar/components/CalendarCell.js +8 -0
  4. package/calendar/components/CalendarCell.mjs +101 -0
  5. package/calendar/components/CalendarHeaderTitle.js +8 -0
  6. package/calendar/components/CalendarHeaderTitle.mjs +23 -0
  7. package/calendar/components/CalendarNavigationItem.js +8 -0
  8. package/calendar/components/CalendarNavigationItem.mjs +29 -0
  9. package/calendar/components/CalendarWeekCell.js +8 -0
  10. package/calendar/components/CalendarWeekCell.mjs +23 -0
  11. package/calendar/components/Header.js +8 -0
  12. package/calendar/components/Header.mjs +78 -0
  13. package/calendar/components/HorizontalViewList.js +8 -0
  14. package/calendar/components/HorizontalViewList.mjs +120 -0
  15. package/calendar/components/MultiViewCalendar.js +8 -0
  16. package/calendar/components/MultiViewCalendar.mjs +428 -0
  17. package/calendar/components/Navigation.js +8 -0
  18. package/calendar/components/Navigation.mjs +117 -0
  19. package/calendar/components/TodayCommand.js +8 -0
  20. package/calendar/components/TodayCommand.mjs +74 -0
  21. package/calendar/components/View.js +8 -0
  22. package/calendar/components/View.mjs +153 -0
  23. package/calendar/components/ViewList.js +8 -0
  24. package/calendar/components/ViewList.mjs +228 -0
  25. package/calendar/models/CalendarViewEnum.js +8 -0
  26. package/calendar/models/CalendarViewEnum.mjs +12 -0
  27. package/calendar/models/NavigationAction.js +8 -0
  28. package/calendar/models/NavigationAction.mjs +12 -0
  29. package/calendar/models/SelectionRange.js +8 -0
  30. package/calendar/models/SelectionRange.mjs +12 -0
  31. package/calendar/services/BusViewService.js +8 -0
  32. package/calendar/services/BusViewService.mjs +58 -0
  33. package/calendar/services/CenturyViewService.js +8 -0
  34. package/calendar/services/CenturyViewService.mjs +126 -0
  35. package/calendar/services/DOMService.js +14 -0
  36. package/calendar/services/DOMService.mjs +124 -0
  37. package/calendar/services/DecadeViewService.js +8 -0
  38. package/calendar/services/DecadeViewService.mjs +126 -0
  39. package/calendar/services/MonthViewService.js +8 -0
  40. package/calendar/services/MonthViewService.mjs +139 -0
  41. package/calendar/services/NavigationService.js +8 -0
  42. package/calendar/services/NavigationService.mjs +36 -0
  43. package/calendar/services/ScrollSyncService.js +8 -0
  44. package/calendar/services/ScrollSyncService.mjs +50 -0
  45. package/calendar/services/WeekNamesService.js +8 -0
  46. package/calendar/services/WeekNamesService.mjs +24 -0
  47. package/calendar/services/YearViewService.js +8 -0
  48. package/calendar/services/YearViewService.mjs +135 -0
  49. package/common/AdaptiveMode.js +8 -0
  50. package/common/AdaptiveMode.mjs +73 -0
  51. package/common/PickerWrap.js +8 -0
  52. package/common/PickerWrap.mjs +32 -0
  53. package/common/constants.js +8 -0
  54. package/common/constants.mjs +12 -0
  55. package/dateinput/DateInput.js +8 -0
  56. package/dateinput/DateInput.mjs +503 -0
  57. package/dateinput/models/kendo-date.js +8 -0
  58. package/dateinput/models/kendo-date.mjs +233 -0
  59. package/dateinput/models/mask.js +8 -0
  60. package/dateinput/models/mask.mjs +16 -0
  61. package/dateinput/utils.js +8 -0
  62. package/dateinput/utils.mjs +38 -0
  63. package/datepicker/DatePicker.js +8 -0
  64. package/datepicker/DatePicker.mjs +462 -0
  65. package/datepicker/ToggleButton.js +8 -0
  66. package/datepicker/ToggleButton.mjs +13 -0
  67. package/daterangepicker/DateRangePicker.js +8 -0
  68. package/daterangepicker/DateRangePicker.mjs +426 -0
  69. package/datetimepicker/DateTimePicker.js +8 -0
  70. package/datetimepicker/DateTimePicker.mjs +475 -0
  71. package/datetimepicker/DateTimeSelector.js +8 -0
  72. package/datetimepicker/DateTimeSelector.mjs +275 -0
  73. package/dist/cdn/js/kendo-react-dateinputs.js +8 -21
  74. package/hooks/usePickerFloatingLabel.js +8 -0
  75. package/hooks/usePickerFloatingLabel.mjs +31 -0
  76. package/index.d.mts +4528 -5
  77. package/index.d.ts +4528 -39
  78. package/index.js +8 -21
  79. package/index.mjs +114 -6540
  80. package/messages/index.js +8 -0
  81. package/messages/index.mjs +59 -0
  82. package/package-metadata.js +8 -0
  83. package/package-metadata.mjs +19 -0
  84. package/package.json +7 -7
  85. package/timepicker/TimeList.js +14 -0
  86. package/timepicker/TimeList.mjs +230 -0
  87. package/timepicker/TimePart.js +8 -0
  88. package/timepicker/TimePart.mjs +267 -0
  89. package/timepicker/TimePicker.js +8 -0
  90. package/timepicker/TimePicker.mjs +479 -0
  91. package/timepicker/TimeSelector.js +8 -0
  92. package/timepicker/TimeSelector.mjs +250 -0
  93. package/timepicker/models/TimePart.js +8 -0
  94. package/timepicker/models/TimePart.mjs +18 -0
  95. package/timepicker/services/DOMService.js +8 -0
  96. package/timepicker/services/DOMService.mjs +34 -0
  97. package/timepicker/services/DayPeriodService.js +8 -0
  98. package/timepicker/services/DayPeriodService.mjs +89 -0
  99. package/timepicker/services/HoursService.js +8 -0
  100. package/timepicker/services/HoursService.mjs +92 -0
  101. package/timepicker/services/MinutesService.js +8 -0
  102. package/timepicker/services/MinutesService.mjs +91 -0
  103. package/timepicker/services/SecondsService.js +8 -0
  104. package/timepicker/services/SecondsService.mjs +91 -0
  105. package/timepicker/utils.js +8 -0
  106. package/timepicker/utils.mjs +91 -0
  107. package/utils.js +8 -0
  108. package/utils.mjs +111 -0
  109. package/virtualization/Virtualization.js +8 -0
  110. package/virtualization/Virtualization.mjs +204 -0
  111. package/virtualization/services/RowHeightService.js +8 -0
  112. package/virtualization/services/RowHeightService.mjs +50 -0
  113. package/virtualization/services/ScrollerService.js +8 -0
  114. package/virtualization/services/ScrollerService.mjs +52 -0
  115. package/PopupSettings.d.ts +0 -18
  116. package/calendar/components/Calendar.d.ts +0 -191
  117. package/calendar/components/CalendarCell.d.ts +0 -39
  118. package/calendar/components/CalendarHeaderTitle.d.ts +0 -32
  119. package/calendar/components/CalendarNavigationItem.d.ts +0 -31
  120. package/calendar/components/CalendarWeekCell.d.ts +0 -29
  121. package/calendar/components/Header.d.ts +0 -58
  122. package/calendar/components/HorizontalViewList.d.ts +0 -71
  123. package/calendar/components/MultiViewCalendar.d.ts +0 -212
  124. package/calendar/components/Navigation.d.ts +0 -80
  125. package/calendar/components/TodayCommand.d.ts +0 -35
  126. package/calendar/components/View.d.ts +0 -89
  127. package/calendar/components/ViewList.d.ts +0 -115
  128. package/calendar/models/ActiveView.d.ts +0 -8
  129. package/calendar/models/CalendarSettings.d.ts +0 -106
  130. package/calendar/models/CalendarViewEnum.d.ts +0 -13
  131. package/calendar/models/CellContext.d.ts +0 -23
  132. package/calendar/models/MultiViewCalendarMode.d.ts +0 -13
  133. package/calendar/models/MultiViewCalendarSettings.d.ts +0 -115
  134. package/calendar/models/NavigationAction.d.ts +0 -19
  135. package/calendar/models/SelectionRange.d.ts +0 -21
  136. package/calendar/models/SelectionRangeEnd.d.ts +0 -8
  137. package/calendar/models/ViewService.d.ts +0 -29
  138. package/calendar/models/index.d.ts +0 -15
  139. package/calendar/services/BusViewService.d.ts +0 -25
  140. package/calendar/services/CenturyViewService.d.ts +0 -29
  141. package/calendar/services/DOMService.d.ts +0 -33
  142. package/calendar/services/DecadeViewService.d.ts +0 -31
  143. package/calendar/services/MonthViewService.d.ts +0 -37
  144. package/calendar/services/NavigationService.d.ts +0 -18
  145. package/calendar/services/ScrollSyncService.d.ts +0 -25
  146. package/calendar/services/WeekNamesService.d.ts +0 -13
  147. package/calendar/services/YearViewService.d.ts +0 -35
  148. package/calendar/services/index.d.ts +0 -14
  149. package/common/AdaptiveMode.d.ts +0 -25
  150. package/common/PickerWrap.d.ts +0 -22
  151. package/common/constants.d.ts +0 -8
  152. package/dateinput/DateInput.d.ts +0 -355
  153. package/dateinput/models/DateInputSettings.d.ts +0 -103
  154. package/dateinput/models/format-placeholder.d.ts +0 -43
  155. package/dateinput/models/incremental-steps.d.ts +0 -15
  156. package/dateinput/models/index.d.ts +0 -11
  157. package/dateinput/models/kendo-date.d.ts +0 -57
  158. package/dateinput/models/mask.d.ts +0 -11
  159. package/dateinput/models/selection.d.ts +0 -11
  160. package/dateinput/utils.d.ts +0 -34
  161. package/datepicker/DatePicker.d.ts +0 -358
  162. package/datepicker/ToggleButton.d.ts +0 -14
  163. package/datepicker/models/DatePickerSettings.d.ts +0 -141
  164. package/datepicker/models/index.d.ts +0 -6
  165. package/daterangepicker/DateRangePicker.d.ts +0 -354
  166. package/daterangepicker/models/DateRangePickerCalendarSettings.d.ts +0 -10
  167. package/daterangepicker/models/DateRangePickerDateInputSettings.d.ts +0 -10
  168. package/daterangepicker/models/DateRangePickerPopupSettings.d.ts +0 -10
  169. package/daterangepicker/models/DateRangePickerSettings.d.ts +0 -126
  170. package/daterangepicker/models/index.d.ts +0 -9
  171. package/datetimepicker/DateTimePicker.d.ts +0 -342
  172. package/datetimepicker/DateTimeSelector.d.ts +0 -106
  173. package/datetimepicker/models/DateTimePickerSettings.d.ts +0 -144
  174. package/datetimepicker/models/index.d.ts +0 -6
  175. package/hooks/usePickerFloatingLabel.d.ts +0 -24
  176. package/messages/index.d.ts +0 -124
  177. package/package-metadata.d.ts +0 -9
  178. package/timepicker/TimeList.d.ts +0 -91
  179. package/timepicker/TimePart.d.ts +0 -141
  180. package/timepicker/TimePicker.d.ts +0 -355
  181. package/timepicker/TimeSelector.d.ts +0 -144
  182. package/timepicker/models/IncrementalSteps.d.ts +0 -12
  183. package/timepicker/models/ListItem.d.ts +0 -11
  184. package/timepicker/models/ListService.d.ts +0 -19
  185. package/timepicker/models/ListServiceSettings.d.ts +0 -16
  186. package/timepicker/models/TimePart.d.ts +0 -14
  187. package/timepicker/models/TimePickerSettings.d.ts +0 -133
  188. package/timepicker/models/index.d.ts +0 -11
  189. package/timepicker/services/DOMService.d.ts +0 -14
  190. package/timepicker/services/DayPeriodService.d.ts +0 -51
  191. package/timepicker/services/HoursService.d.ts +0 -37
  192. package/timepicker/services/MinutesService.d.ts +0 -36
  193. package/timepicker/services/SecondsService.d.ts +0 -36
  194. package/timepicker/services/index.d.ts +0 -10
  195. package/timepicker/utils.d.ts +0 -60
  196. package/utils.d.ts +0 -100
  197. package/virtualization/Virtualization.d.ts +0 -120
  198. package/virtualization/services/RowHeightService.d.ts +0 -22
  199. package/virtualization/services/ScrollerService.d.ts +0 -53
  200. package/virtualization/services/index.d.ts +0 -7
@@ -0,0 +1,426 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";
9
+ import * as i from "react";
10
+ import e from "prop-types";
11
+ import { Popup as k } from "@progress/kendo-react-popup";
12
+ import { cloneDate as v } from "@progress/kendo-date-math";
13
+ import { Keys as c, validatePackage as T, canUseDOM as D, classNames as _, IconWrap as P, getActiveElement as F, createPropsContext as z, withIdHOC as A, withPropsContext as B } from "@progress/kendo-react-common";
14
+ import { provideLocalizationService as m, registerForLocalization as N } from "@progress/kendo-react-intl";
15
+ import { arrowsSwapIcon as L } from "@progress/kendo-svg-icons";
16
+ import { packageMetadata as V } from "../package-metadata.mjs";
17
+ import { DateInputWithoutContext as K, DateInput as I } from "../dateinput/DateInput.mjs";
18
+ import { MultiViewCalendar as U } from "../calendar/components/MultiViewCalendar.mjs";
19
+ import { EMPTY_SELECTIONRANGE as r } from "../calendar/models/SelectionRange.mjs";
20
+ import { nullable as h, MAX_DATE as q, MIN_DATE as W } from "../utils.mjs";
21
+ import { MOBILE_MEDIUM_DEVISE as G } from "../common/constants.mjs";
22
+ import { dateRangePickerCancel as w, messages as l, dateRangePickerSet as b, start as C, end as S, separator as E, swapStartEnd as d } from "../messages/index.mjs";
23
+ import { Button as H } from "@progress/kendo-react-buttons";
24
+ import { AdaptiveMode as X } from "../common/AdaptiveMode.mjs";
25
+ import { ActionSheetContent as Y } from "@progress/kendo-react-layout";
26
+ const o = class o extends i.Component {
27
+ constructor(a) {
28
+ super(a), this._element = null, this._calendar = null, this._startDateInput = i.createRef(), this._endDateInput = i.createRef(), this.shouldFocusDateInput = !1, this.shouldFocusCalendar = !1, this.focus = () => {
29
+ this.startDateInput && this.startDateInput.focus();
30
+ }, this.setCalendarRef = (t) => {
31
+ this._calendar = t;
32
+ }, this.focusCalendarElement = () => {
33
+ this._calendar && this._calendar.element && this._calendar.element.focus({ preventScroll: !0 });
34
+ }, this.calculateValue = (t, s) => (t.value !== void 0 ? t.value : s.value) || r, this.calculateShow = (t, s) => t.show !== void 0 ? t.show : s.show, this.renderCalendar = () => {
35
+ const t = this.value || r, s = {
36
+ min: this.min,
37
+ max: this.max,
38
+ allowReverse: this.props.allowReverse,
39
+ mode: "range",
40
+ focusedDate: this.props.focusedDate,
41
+ disabled: this.props.disabled,
42
+ className: this.mobileMode ? "k-calendar-lg" : "",
43
+ mobileMode: this.mobileMode,
44
+ ...this.props.calendarSettings,
45
+ value: t,
46
+ dir: this.props.dir,
47
+ onChange: this.handleCalendarChange
48
+ };
49
+ return this.props.calendar ? /* @__PURE__ */ i.createElement(this.props.calendar, { ...s }) : /* @__PURE__ */ i.createElement(U, { ...s, ref: this.setCalendarRef });
50
+ }, this.renderPopup = () => {
51
+ const t = {
52
+ popupClass: "k-daterangepicker-popup",
53
+ animate: this._element !== null,
54
+ anchor: this._element,
55
+ id: this._popupId,
56
+ anchorAlign: {
57
+ horizontal: "left",
58
+ vertical: "bottom"
59
+ },
60
+ popupAlign: {
61
+ horizontal: "left",
62
+ vertical: "top"
63
+ },
64
+ ...this.props.popupSettings,
65
+ show: this.show
66
+ };
67
+ return this.props.popup ? /* @__PURE__ */ i.createElement(this.props.popup, { ...t }, this.renderCalendar()) : /* @__PURE__ */ i.createElement(k, { ...t }, this.renderCalendar());
68
+ }, this.renderAdaptivePopup = () => {
69
+ const { windowWidth: t = 0 } = this.state, s = {
70
+ expand: this.show,
71
+ onClose: (n) => this.handleCancel(n),
72
+ adaptiveTitle: this.props.adaptiveTitle,
73
+ windowWidth: t,
74
+ footer: {
75
+ cancelText: this.localizationService.toLanguageString(w, l[w]),
76
+ onCancel: this.handleCancel,
77
+ applyText: this.localizationService.toLanguageString(b, l[b]),
78
+ onApply: this.handleBlur
79
+ }
80
+ };
81
+ return /* @__PURE__ */ i.createElement(X, { ...s }, /* @__PURE__ */ i.createElement(Y, { className: "!k-overflow-hidden" }, /* @__PURE__ */ i.createElement("div", { className: "k-scrollable-wrap" }, this.renderCalendar())));
82
+ }, this.handleReverseClick = (t) => {
83
+ const s = {
84
+ start: this.value.end,
85
+ end: this.value.start
86
+ }, n = {
87
+ syntheticEvent: t,
88
+ nativeEvent: t.nativeEvent
89
+ };
90
+ this.handleChange(s, n);
91
+ }, this.handleReverseMouseDown = (t) => {
92
+ t.preventDefault();
93
+ }, this.handleFocus = (t) => {
94
+ clearTimeout(this.nextTickId), this.shouldFocusDateInput || this.mobileMode && this.setState({ currentValue: this.value });
95
+ const { onFocus: s } = this.props;
96
+ s && s.call(void 0, t);
97
+ }, this.handleClick = () => {
98
+ this.shouldFocusDateInput || this.setShow(!0);
99
+ }, this.handleBlur = (t) => {
100
+ this.nextTick(() => {
101
+ this.setShow(!1);
102
+ });
103
+ const { onBlur: s } = this.props;
104
+ s && s.call(void 0, t);
105
+ }, this.handleCancel = (t) => {
106
+ this.nextTick(() => {
107
+ this.setShow(!1), this.setState({ currentValue: r });
108
+ });
109
+ const { onCancel: s } = this.props;
110
+ s && s.call(void 0, t);
111
+ }, this.handleEndChange = (t) => {
112
+ const s = {
113
+ start: this.value.start,
114
+ end: v(t.value || void 0)
115
+ };
116
+ this.handleChange(s, t);
117
+ }, this.handleStartChange = (t) => {
118
+ const s = {
119
+ start: v(t.value || void 0),
120
+ end: this.value.end
121
+ };
122
+ this.handleChange(s, t);
123
+ }, this.extractRangeFromValue = (t) => {
124
+ if (!Array.isArray(t.value) && !(t.value instanceof Date))
125
+ return t.value || r;
126
+ const s = Array.isArray(t.value) ? t.value[0] : t.value;
127
+ return {
128
+ start: this.value.end !== null ? s : this.value.start,
129
+ end: this.value.start !== null ? s : this.value.end
130
+ };
131
+ }, this.handleCalendarChange = (t) => {
132
+ const s = this.extractRangeFromValue(t);
133
+ this.handleChange(s, t);
134
+ }, this.handleKeyDown = (t) => {
135
+ const { keyCode: s, altKey: n } = t;
136
+ s === c.esc ? (t.preventDefault(), this.shouldFocusDateInput = !0, this.setShow(!1)) : n && s === c.down ? (t.preventDefault(), this.shouldFocusCalendar = !0, this.setShow(!0), this.focusCalendarElement()) : n && s === c.up && (t.preventDefault(), this.shouldFocusDateInput = !0, this.setShow(!1));
137
+ }, this.handleChange = (t, s) => {
138
+ this.setState({ value: t }), this.valueDuringOnChange = t;
139
+ const { onChange: n } = this.props;
140
+ if (n) {
141
+ const u = {
142
+ syntheticEvent: s.syntheticEvent,
143
+ nativeEvent: s.nativeEvent,
144
+ value: this.value,
145
+ show: this.show,
146
+ target: this
147
+ };
148
+ n.call(void 0, u);
149
+ }
150
+ this.valueDuringOnChange = void 0;
151
+ }, T(V), this.state = {
152
+ show: this.props.show || this.props.defaultShow || o.defaultProps.defaultShow,
153
+ value: this.props.value || this.props.defaultValue || o.defaultProps.defaultValue,
154
+ currentValue: r
155
+ }, this.nextTick = this.nextTick.bind(this), this.setShow = this.setShow.bind(this), this.focusCalendarElement = this.focusCalendarElement.bind(this), this.focusDateInputElement = this.focusDateInputElement.bind(this);
156
+ }
157
+ get _popupId() {
158
+ return this.props.id + "-popup-id";
159
+ }
160
+ get _startInputId() {
161
+ return this.props.id + "-start-input-id";
162
+ }
163
+ get _endInputId() {
164
+ return this.props.id + "-end-input-id";
165
+ }
166
+ /**
167
+ * Gets the wrapping element of the DateRangePicker.
168
+ */
169
+ get element() {
170
+ return this._element;
171
+ }
172
+ /**
173
+ * Gets the start DateInput component inside the DatePicker component.
174
+ */
175
+ get startDateInput() {
176
+ return this._startDateInput.current;
177
+ }
178
+ /**
179
+ * Gets the end DateInput component inside the DatePicker component.
180
+ */
181
+ get endDateInput() {
182
+ return this._endDateInput.current;
183
+ }
184
+ /**
185
+ * Gets the MultiVieCalendar inside the DateRangePicker.
186
+ */
187
+ get calendar() {
188
+ return this._calendar;
189
+ }
190
+ /**
191
+ * Gets the value of the DateRangePicker.
192
+ */
193
+ get value() {
194
+ return (this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.value !== void 0 ? this.props.value : this.state.value) || r;
195
+ }
196
+ /**
197
+ * Gets the popup state of the DateRangePicker.
198
+ */
199
+ get show() {
200
+ return this.showDuringOnChange !== void 0 ? this.showDuringOnChange : this.props.show !== void 0 ? this.props.show : this.state.show;
201
+ }
202
+ get min() {
203
+ return this.props.min !== void 0 ? this.props.min : o.defaultProps.min;
204
+ }
205
+ get max() {
206
+ return this.props.max !== void 0 ? this.props.max : o.defaultProps.max;
207
+ }
208
+ get document() {
209
+ if (D)
210
+ return this.element && this.element.ownerDocument || document;
211
+ }
212
+ get localizationService() {
213
+ return m(this);
214
+ }
215
+ /**
216
+ * The mobile mode of the DateRangePicker.
217
+ */
218
+ get mobileMode() {
219
+ return !!(this.state.windowWidth && this.state.windowWidth <= G && this.props.adaptive);
220
+ }
221
+ /**
222
+ * @hidden
223
+ */
224
+ componentDidMount() {
225
+ var a;
226
+ this.observerResize = D && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.show && this.forceUpdate(), (a = this.document) != null && a.body && this.observerResize && this.observerResize.observe(this.document.body);
227
+ }
228
+ /**
229
+ * @hidden
230
+ */
231
+ componentDidUpdate() {
232
+ this.shouldFocusCalendar && this.focusCalendarElement(), this.shouldFocusDateInput && this.focusDateInputElement(), this.shouldFocusCalendar = !1, this.shouldFocusDateInput = !1;
233
+ }
234
+ /**
235
+ * @hidden
236
+ */
237
+ componentWillUnmount() {
238
+ var a;
239
+ clearTimeout(this.nextTickId), (a = this.document) != null && a.body && this.observerResize && this.observerResize.disconnect();
240
+ }
241
+ /**
242
+ * @hidden
243
+ */
244
+ render() {
245
+ const a = this.value || r, t = this.mobileMode && this.show ? this.state.currentValue : a, s = (this.props.startDateInputSettings || {}).id || this._startInputId, n = (this.props.endDateInputSettings || {}).id || this._endInputId, u = _(
246
+ "k-daterangepicker",
247
+ {
248
+ "k-disabled": this.props.disabled
249
+ },
250
+ this.props.className
251
+ ), y = this.localizationService.toLanguageString(C, l[C]), x = this.localizationService.toLanguageString(S, l[S]), R = this.localizationService.toLanguageString(E, l[E]), f = {
252
+ disableSelection: this.mobileMode && !0,
253
+ label: y,
254
+ format: this.props.format,
255
+ min: this.min,
256
+ max: this.max,
257
+ id: this._startInputId,
258
+ disabled: this.props.disabled,
259
+ valid: this.props.valid,
260
+ tabIndex: this.props.tabIndex,
261
+ ariaExpanded: this.show,
262
+ ...this.props.startDateInputSettings,
263
+ value: t.start,
264
+ onChange: this.handleStartChange
265
+ }, g = {
266
+ disableSelection: this.mobileMode && !0,
267
+ label: x,
268
+ format: this.props.format,
269
+ min: this.min,
270
+ max: this.max,
271
+ id: this._endInputId,
272
+ disabled: this.props.disabled,
273
+ valid: this.props.valid,
274
+ tabIndex: this.props.tabIndex,
275
+ ariaExpanded: this.show,
276
+ ...this.props.endDateInputSettings,
277
+ value: t.end,
278
+ onChange: this.handleEndChange
279
+ }, M = /* @__PURE__ */ i.createElement(
280
+ H,
281
+ {
282
+ type: "button",
283
+ className: "k-select",
284
+ fillMode: "flat",
285
+ title: m(this).toLanguageString(d, l[d]),
286
+ onMouseDown: this.handleReverseMouseDown,
287
+ onClick: this.handleReverseClick,
288
+ "aria-controls": s + " " + n,
289
+ "aria-label": m(this).toLanguageString(d, l[d])
290
+ },
291
+ /* @__PURE__ */ i.createElement(P, { style: { transform: "rotate(90deg)" }, name: "arrows-swap", icon: L })
292
+ );
293
+ return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
294
+ "span",
295
+ {
296
+ ref: (O) => {
297
+ this._element = O;
298
+ },
299
+ className: u,
300
+ style: this.props.style,
301
+ id: this.props.id,
302
+ "aria-labelledby": this.props.ariaLabelledBy,
303
+ "aria-describedby": this.props.ariaDescribedBy,
304
+ tabIndex: this.props.tabIndex,
305
+ onFocus: this.handleFocus,
306
+ onClick: this.handleClick,
307
+ onKeyDown: this.handleKeyDown,
308
+ onBlur: this.mobileMode ? void 0 : this.handleBlur,
309
+ dir: this.props.dir
310
+ },
311
+ this.props.startDateInput ? /* @__PURE__ */ i.createElement(this.props.startDateInput, { ...f }) : /* @__PURE__ */ i.createElement(
312
+ I,
313
+ {
314
+ ...f,
315
+ ref: this._startDateInput,
316
+ ariaRole: "combobox",
317
+ ariaControls: this._popupId,
318
+ readonly: this.mobileMode
319
+ }
320
+ ),
321
+ (this.props.allowReverse || this.props.calendarSettings && this.props.calendarSettings.allowReverse) && this.props.swapButton ? M : R,
322
+ this.props.endDateInput ? /* @__PURE__ */ i.createElement(this.props.endDateInput, { ...g }) : /* @__PURE__ */ i.createElement(
323
+ I,
324
+ {
325
+ ...g,
326
+ ref: this._endDateInput,
327
+ ariaRole: "combobox",
328
+ ariaControls: this._popupId,
329
+ readonly: this.mobileMode
330
+ }
331
+ ),
332
+ !this.mobileMode && this.renderPopup()
333
+ ), this.mobileMode && this.renderAdaptivePopup());
334
+ }
335
+ focusDateInputElement() {
336
+ if (!document || !this.startDateInput || !this.startDateInput.element || !this.endDateInput || !this.endDateInput.element)
337
+ return;
338
+ const a = F(document);
339
+ (this.value.start === null || this.value.end !== null) && a !== this.endDateInput.element ? this.startDateInput.element.focus({ preventScroll: !0 }) : a !== this.startDateInput.element && this.endDateInput.element.focus({ preventScroll: !0 });
340
+ }
341
+ nextTick(a) {
342
+ clearTimeout(this.nextTickId), this.nextTickId = window.setTimeout(() => a());
343
+ }
344
+ setShow(a) {
345
+ const { onOpen: t, onClose: s } = this.props;
346
+ this.show !== a && (this.setState({ show: a }), a && t && t.call(void 0, {
347
+ target: this
348
+ }), !a && s && s.call(void 0, {
349
+ target: this
350
+ }));
351
+ }
352
+ calculateMedia(a) {
353
+ for (let t of a)
354
+ this.setState({ windowWidth: t.target.clientWidth });
355
+ }
356
+ };
357
+ o.displayName = "DateRangePicker", o.propTypes = {
358
+ allowReverse: e.bool,
359
+ calendarSettings: e.any,
360
+ className: e.string,
361
+ defaultShow: e.bool,
362
+ defaultValue: e.shape({
363
+ start: h(e.instanceOf(Date).isRequired),
364
+ end: h(e.instanceOf(Date).isRequired)
365
+ }),
366
+ disabled: e.bool,
367
+ endDateInputSettings: e.shape(K.propTypes),
368
+ focusedDate: e.instanceOf(Date),
369
+ format: e.oneOfType([
370
+ e.string,
371
+ e.shape({
372
+ skeleton: e.string,
373
+ pattern: e.string,
374
+ date: e.oneOf(["short", "medium", "long", "full"]),
375
+ time: e.oneOf(["short", "medium", "long", "full"]),
376
+ datetime: e.oneOf(["short", "medium", "long", "full"]),
377
+ era: e.oneOf(["narrow", "short", "long"]),
378
+ year: e.oneOf(["numeric", "2-digit"]),
379
+ month: e.oneOf(["numeric", "2-digit", "narrow", "short", "long"]),
380
+ day: e.oneOf(["numeric", "2-digit"]),
381
+ weekday: e.oneOf(["narrow", "short", "long"]),
382
+ hour: e.oneOf(["numeric", "2-digit"]),
383
+ hour12: e.bool,
384
+ minute: e.oneOf(["numeric", "2-digit"]),
385
+ second: e.oneOf(["numeric", "2-digit"]),
386
+ timeZoneName: e.oneOf(["short", "long"])
387
+ })
388
+ ]),
389
+ id: e.string,
390
+ ariaLabelledBy: e.string,
391
+ ariaDescribedBy: e.string,
392
+ max: e.instanceOf(Date),
393
+ min: e.instanceOf(Date),
394
+ onBlur: e.func,
395
+ onChange: e.func,
396
+ onFocus: e.func,
397
+ popupSettings: e.any,
398
+ show: e.bool,
399
+ startDateInputSettings: e.any,
400
+ style: e.any,
401
+ swapButton: e.any,
402
+ tabIndex: e.number,
403
+ dir: e.string,
404
+ value: e.shape({
405
+ start: h(e.instanceOf(Date).isRequired),
406
+ end: h(e.instanceOf(Date).isRequired)
407
+ })
408
+ }, o.defaultProps = {
409
+ allowReverse: !1,
410
+ defaultShow: !1,
411
+ defaultValue: r,
412
+ disabled: !1,
413
+ format: "d",
414
+ max: q,
415
+ min: W,
416
+ swapButton: !1
417
+ };
418
+ let p = o;
419
+ const Z = z(), j = A(B(Z, p));
420
+ j.displayName = "KendoReactDateRangePicker";
421
+ N(p);
422
+ export {
423
+ j as DateRangePicker,
424
+ Z as DateRangePickerPropsContext,
425
+ p as DateRangePickerWithoutContext
426
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2024 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("react"),e=require("prop-types"),V=require("@progress/kendo-react-popup"),D=require("@progress/kendo-date-math"),n=require("@progress/kendo-react-common"),K=require("@progress/kendo-svg-icons"),j=require("../dateinput/DateInput.js"),U=require("@progress/kendo-react-buttons"),$=require("../package-metadata.js"),p=require("../utils.js"),W=require("../common/constants.js"),l=require("../messages/index.js"),m=require("@progress/kendo-react-intl"),X=require("./DateTimeSelector.js"),H=require("../timepicker/utils.js"),Z=require("../hooks/usePickerFloatingLabel.js"),G=require("../common/AdaptiveMode.js"),J=require("@progress/kendo-react-layout");function Q(h){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const i in h)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(h,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>h[i]})}}return t.default=h,Object.freeze(t)}const r=Q(_),o=class o extends r.Component{constructor(t){super(t),this._element=null,this._dateInput=r.createRef(),this._dateTimeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.focus=()=>{const i=this.dateInputElement();i&&i.focus()},this.renderPicker=()=>{const{disabled:i,minTime:s,maxTime:a,format:c,calendar:u,cancelButton:d,weekNumber:f,focusedDate:v}=this.props;return r.createElement(X.DateTimeSelector,{ref:w=>{this._dateTimeSelector=w},cancelButton:d,steps:this.props.steps,value:this.value,onChange:this.handleValueChange,onReject:this.handleReject,disabled:i,weekNumber:f,min:this.min,max:this.max,minTime:s,maxTime:a,focusedDate:v,format:c,calendar:u,mobileMode:this.mobileMode,footerActions:!this.mobileMode})},this.renderAdaptivePopup=()=>{const{windowWidth:i=0}=this.state,s=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerCancel,l.messages[l.dateTimePickerCancel]),a=m.provideLocalizationService(this).toLanguageString(l.dateTimePickerSet,l.messages[l.dateTimePickerSet]),c={expand:this.show,onClose:this.handleBlur,adaptiveTitle:this.props.adaptiveTitle,windowWidth:i,footer:{cancelText:s,onCancel:u=>{var d;return(d=this._dateTimeSelector)==null?void 0:d.handleReject(u)},applyText:a,onApply:u=>{var d;return(d=this._dateTimeSelector)==null?void 0:d.handleAccept(u)}}};return r.createElement(G.AdaptiveMode,{...c},r.createElement(J.ActionSheetContent,{className:"!k-overflow-hidden"},this.renderPicker()))},this.handleReject=()=>{this.shouldFocusDateInput=!0,this.setShow(!1)},this.handleValueChange=i=>{this.setState({value:D.cloneDate(i.value||void 0)}),this.valueDuringOnChange=i.value,this.showDuringOnChange=!1,this.mobileMode||(this.shouldFocusDateInput=!0);const{onChange:s}=this.props;s&&s.call(void 0,{syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,value:this.value,show:this.show,target:this}),this.valueDuringOnChange=void 0,this.showDuringOnChange=void 0,this.setShow(!1)},this.handleFocus=()=>{this.setState({focused:!0})},this.handleBlur=()=>{this.setState({focused:!1}),this.setShow(!1)},this.handleDateIconClick=()=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=i=>{i.preventDefault()},this.handleKeyDown=i=>{const{altKey:s,keyCode:a}=i;if(a===n.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(a===n.Keys.up||a===n.Keys.down)&&(i.preventDefault(),i.stopPropagation(),this.shouldFocusDateInput=a===n.Keys.up,this.setShow(a===n.Keys.down))},this.dateInputElement=()=>this.dateInput&&this.dateInput.element||this.element&&this.element.querySelector(".k-dateinput > input.k-input-inner"),n.validatePackage($.packageMetadata),this.state={value:this.props.defaultValue||o.defaultProps.defaultValue,show:this.props.defaultShow||o.defaultProps.defaultShow,focused:!1}}get _popupId(){return this.props.id+"-popup-id"}get document(){if(n.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get value(){const t=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return t!==null?D.cloneDate(t):null}get show(){return this.showDuringOnChange!==void 0?this.showDuringOnChange:this.props.show!==void 0?this.props.show:this.state.show}get name(){return this.props.name}get mobileMode(){return!!(this.state.windowWidth&&this.state.windowWidth<=W.MOBILE_MEDIUM_DEVISE&&this.props.adaptive)}get min(){return this.props.min!==void 0?this.props.min:o.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:o.defaultProps.max}get validity(){const t=p.isInDateRange(this.value,this.min,this.max)&&H.isInTimeRange(this.value,this.props.minTime||p.MIN_TIME,this.props.maxTime||p.MAX_TIME),i=this.props.validationMessage!==void 0,s=(!this.required||this.value!==null)&&t,a=this.props.valid!==void 0?this.props.valid:s;return{customError:i,rangeOverflow:this.value&&this.max.getTime()<this.value.getTime()||!1,rangeUnderflow:this.value&&this.value.getTime()<this.min.getTime()||!1,valid:a,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:o.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:o.defaultProps.required}get dateInputComp(){return this.props.dateInput||o.defaultProps.dateInput}componentDidMount(){var t;this.observerResize=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.show&&this.forceUpdate(),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentDidUpdate(){const t=this.dateInputElement();this._dateTimeSelector&&this.show&&!this.prevShow&&this._dateTimeSelector.focus({preventScroll:!0}),t&&!this.show&&this.shouldFocusDateInput&&t.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var t;clearTimeout(this.nextTickId),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:t=o.defaultProps.size,rounded:i=o.defaultProps.rounded,fillMode:s=o.defaultProps.fillMode,disabled:a,tabIndex:c,title:u,id:d,format:f,formatPlaceholder:v,min:w,max:k,className:T,width:M,name:O,validationMessage:P,required:C,validityStyles:x,minTime:q,maxTime:E,ariaLabelledBy:R,ariaDescribedBy:z,popup:F=V.Popup}=this.props,b=!this.validityStyles||this.validity.valid,A={id:d,ariaLabelledBy:R,ariaDescribedBy:z,format:f,formatPlaceholder:v,disabled:a,title:u,validityStyles:x,validationMessage:P,required:C,min:w,max:k,minTime:q,maxTime:E,name:O,tabIndex:this.show?-1:c,valid:this.validity.valid,value:this.value,onChange:this.handleValueChange,steps:this.props.steps,label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaExpanded:this.show,size:null,fillMode:null,rounded:null},y=r.createElement(n.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.handleBlur,onSyncFocus:this.props.onFocus,onSyncBlur:this.props.onBlur},({onFocus:B,onBlur:L})=>r.createElement(r.Fragment,null,r.createElement("div",{ref:N=>{this._element=N},className:n.classNames("k-input","k-datetimepicker",{[`k-input-${n.kendoThemeMaps.sizeMap[t]||t}`]:t,[`k-rounded-${n.kendoThemeMaps.roundedMap[i]||i}`]:i,[`k-input-${s}`]:s,"k-invalid":!b,"k-required":this.required,"k-disabled":this.props.disabled},T),onKeyDown:this.handleKeyDown,style:{width:M},onFocus:this.mobileMode?void 0:B,onBlur:L,onClick:this.mobileMode?this.handleDateIconClick:void 0},r.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,readonly:this.mobileMode,...A}),r.createElement(U.Button,{tabIndex:-1,type:"button",icon:"calendar",svgIcon:K.calendarIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleDateIconClick,title:m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector]),className:"k-input-button",rounded:null,"aria-label":m.provideLocalizationService(this).toLanguageString(l.toggleDateTimeSelector,l.messages[l.toggleDateTimeSelector])}),r.createElement(F,{show:this.show,animate:this.element!==null,anchor:this.element,popupClass:"k-datetime-container k-reset",id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"}},!this.mobileMode&&this.renderPicker())),this.mobileMode&&this.renderAdaptivePopup()));return this.props.label?r.createElement(Z.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:d,editorValid:b,editorDisabled:this.props.disabled,children:y,style:{width:this.props.width}}):y}setShow(t){const{onOpen:i,onClose:s}=this.props;this.show!==t&&(this.setState({show:t}),t&&i&&i.call(void 0,{target:this}),!t&&s&&s.call(void 0,{target:this}))}nextTick(t){clearTimeout(this.nextTickId),this.nextTickId=window.setTimeout(()=>t())}calculateMedia(t){for(const i of t)this.setState({windowWidth:i.target.clientWidth})}};o.displayName="DateTimePicker",o.propTypes={className:e.string,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,focusedDate:e.instanceOf(Date),format:e.oneOfType([e.string,e.shape({skeleton:e.string,pattern:e.string,date:e.oneOf(["short","medium","long","full"]),time:e.oneOf(["short","medium","long","full"]),datetime:e.oneOf(["short","medium","long","full"]),era:e.oneOf(["narrow","short","long"]),year:e.oneOf(["numeric","2-digit"]),month:e.oneOf(["numeric","2-digit","narrow","short","long"]),day:e.oneOf(["numeric","2-digit"]),weekday:e.oneOf(["narrow","short","long"]),hour:e.oneOf(["numeric","2-digit"]),hour12:e.bool,minute:e.oneOf(["numeric","2-digit"]),second:e.oneOf(["numeric","2-digit"]),timeZoneName:e.oneOf(["short","long"])})]),formatPlaceholder:e.oneOfType([e.oneOf(["wide","narrow","short","formatPattern"]),e.shape({year:e.string,month:e.string,day:e.string,hour:e.string,minute:e.string,second:e.string})]),id:e.string,ariaLabelledBy:e.string,ariaDescribedBy:e.string,min:e.instanceOf(Date),max:e.instanceOf(Date),name:e.string,popupSettings:e.shape({animate:e.bool,appendTo:e.any,popupClass:e.string}),show:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),weekNumber:e.bool,width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,cancelButton:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"])},o.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"g",max:p.MAX_DATE,min:p.MIN_DATE,popupSettings:{},tabIndex:0,weekNumber:!1,required:!1,validityStyles:!0,cancelButton:!0,dateInput:j.DateInput,size:"medium",rounded:"medium",fillMode:"solid"};let g=o;const S=n.createPropsContext(),I=n.withIdHOC(n.withPropsContext(S,g));I.displayName="KendoReactDateTimePicker";m.registerForLocalization(g);exports.DateTimePicker=I;exports.DateTimePickerPropsContext=S;exports.DateTimePickerWithoutContext=g;