@progress/kendo-react-dateinputs 13.3.0 → 13.4.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.
- package/PopupSettings.d.ts +22 -0
- package/calendar/components/Calendar.d.ts +202 -0
- package/calendar/components/Calendar.mjs +7 -7
- package/calendar/components/CalendarCell.d.ts +71 -0
- package/calendar/components/CalendarHeaderTitle.d.ts +38 -0
- package/calendar/components/CalendarNavigationItem.d.ts +39 -0
- package/calendar/components/CalendarWeekCell.d.ts +42 -0
- package/calendar/components/Header.d.ts +65 -0
- package/calendar/components/Header.mjs +3 -3
- package/calendar/components/HorizontalViewList.d.ts +80 -0
- package/calendar/components/HorizontalViewList.mjs +3 -3
- package/calendar/components/MultiViewCalendar.d.ts +226 -0
- package/calendar/components/MultiViewCalendar.js +1 -1
- package/calendar/components/MultiViewCalendar.mjs +17 -17
- package/calendar/components/Navigation.d.ts +85 -0
- package/calendar/components/TodayCommand.d.ts +46 -0
- package/calendar/components/TodayCommand.mjs +3 -3
- package/calendar/components/View.d.ts +101 -0
- package/calendar/components/ViewList.d.ts +128 -0
- package/calendar/models/ActiveView.d.ts +11 -0
- package/calendar/models/CalendarSettings.d.ts +256 -0
- package/calendar/models/CalendarViewEnum.d.ts +16 -0
- package/calendar/models/CellContext.d.ts +72 -0
- package/calendar/models/MultiViewCalendarMode.d.ts +16 -0
- package/calendar/models/MultiViewCalendarSettings.d.ts +129 -0
- package/calendar/models/NavigationAction.d.ts +22 -0
- package/calendar/models/SelectionRange.d.ts +24 -0
- package/calendar/models/SelectionRangeEnd.d.ts +11 -0
- package/calendar/models/ViewService.d.ts +32 -0
- package/calendar/models/WeekDaysFormat.d.ts +11 -0
- package/calendar/models/index.d.ts +18 -0
- package/calendar/services/BusViewService.d.ts +28 -0
- package/calendar/services/CenturyViewService.d.ts +32 -0
- package/calendar/services/CenturyViewService.mjs +4 -4
- package/calendar/services/DOMService.d.ts +36 -0
- package/calendar/services/DecadeViewService.d.ts +34 -0
- package/calendar/services/DecadeViewService.mjs +4 -4
- package/calendar/services/MonthViewService.d.ts +40 -0
- package/calendar/services/MonthViewService.mjs +2 -2
- package/calendar/services/NavigationService.d.ts +21 -0
- package/calendar/services/ScrollSyncService.d.ts +28 -0
- package/calendar/services/WeekNamesService.d.ts +17 -0
- package/calendar/services/YearViewService.d.ts +38 -0
- package/calendar/services/YearViewService.mjs +2 -2
- package/calendar/services/index.d.ts +17 -0
- package/calendar/utils/ScrollSync.d.ts +20 -0
- package/codemods/utils.js +1 -8
- package/codemods/v11/dateinput-handle.js +1 -8
- package/codemods/v11/datepicker-handle.js +1 -8
- package/common/AdaptiveMode.d.ts +22 -0
- package/common/ClearButton.d.ts +20 -0
- package/dateinput/DateInput.d.ts +248 -0
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +63 -65
- package/dateinput/dateInputIntl.d.ts +30 -0
- package/dateinput/models/DateInputSettings.d.ts +107 -0
- package/dateinput/models/common-package-props.d.ts +34 -0
- package/dateinput/models/dateinput-options.d.ts +105 -0
- package/dateinput/models/format-placeholder.d.ts +46 -0
- package/dateinput/models/incremental-steps.d.ts +24 -0
- package/dateinput/models/index.d.ts +15 -0
- package/dateinput/models/kendo-date.d.ts +60 -0
- package/dateinput/models/mask.d.ts +14 -0
- package/dateinput/models/selection.d.ts +14 -0
- package/dateinput/utils.d.ts +31 -0
- package/datepicker/DatePicker.d.ts +279 -0
- package/datepicker/DatePicker.js +1 -1
- package/datepicker/DatePicker.mjs +68 -72
- package/datepicker/ToggleButton.d.ts +17 -0
- package/datepicker/models/DatePickerSettings.d.ts +248 -0
- package/datepicker/models/index.d.ts +9 -0
- package/daterangepicker/DateRangePicker.d.ts +357 -0
- package/daterangepicker/DateRangePicker.mjs +13 -13
- package/daterangepicker/models/DateRangePickerCalendarSettings.d.ts +13 -0
- package/daterangepicker/models/DateRangePickerDateInputSettings.d.ts +13 -0
- package/daterangepicker/models/DateRangePickerPopupSettings.d.ts +13 -0
- package/daterangepicker/models/DateRangePickerSettings.d.ts +129 -0
- package/daterangepicker/models/index.d.ts +12 -0
- package/datetimepicker/DateTimePicker.d.ts +420 -0
- package/datetimepicker/DateTimePicker.js +1 -1
- package/datetimepicker/DateTimePicker.mjs +16 -20
- package/datetimepicker/DateTimeSelector.d.ts +111 -0
- package/datetimepicker/DateTimeSelector.mjs +3 -3
- package/datetimepicker/models/DateTimePickerSettings.d.ts +154 -0
- package/datetimepicker/models/index.d.ts +9 -0
- package/dist/cdn/js/kendo-react-dateinputs.js +1 -1
- package/hooks/usePickerFloatingLabel.d.ts +27 -0
- package/index.d.mts +35 -4952
- package/index.d.ts +35 -4952
- package/messages/index.d.ts +132 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +10 -16
- package/package.json +8 -8
- package/timepicker/TimeList.d.ts +97 -0
- package/timepicker/TimeList.js +5 -5
- package/timepicker/TimeList.mjs +122 -112
- package/timepicker/TimePart.d.ts +146 -0
- package/timepicker/TimePart.mjs +3 -3
- package/timepicker/TimePicker.d.ts +417 -0
- package/timepicker/TimePicker.js +1 -1
- package/timepicker/TimePicker.mjs +64 -68
- package/timepicker/TimeSelector.d.ts +149 -0
- package/timepicker/TimeSelector.mjs +3 -3
- package/timepicker/models/IncrementalSteps.d.ts +18 -0
- package/timepicker/models/ListItem.d.ts +14 -0
- package/timepicker/models/ListService.d.ts +22 -0
- package/timepicker/models/ListServiceSettings.d.ts +19 -0
- package/timepicker/models/TimePart.d.ts +17 -0
- package/timepicker/models/TimePickerSettings.d.ts +137 -0
- package/timepicker/models/index.d.ts +14 -0
- package/timepicker/services/DOMService.d.ts +18 -0
- package/timepicker/services/DayPeriodService.d.ts +54 -0
- package/timepicker/services/HoursService.d.ts +40 -0
- package/timepicker/services/MinutesService.d.ts +39 -0
- package/timepicker/services/SecondsService.d.ts +39 -0
- package/timepicker/services/index.d.ts +13 -0
- package/timepicker/utils.d.ts +63 -0
- package/timepicker/utils.mjs +1 -1
- package/utils.d.ts +103 -0
- package/utils.js +1 -1
- package/utils.mjs +46 -46
- package/virtualization/Virtualization.d.ts +125 -0
- package/virtualization/services/ScrollerService.d.ts +56 -0
- package/virtualization/services/index.d.ts +10 -0
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { default as PropTypes } from 'prop-types';
|
|
9
|
+
import { FormComponent, FormComponentProps, FormComponentValidity, DateInputsClassStructure, AdaptiveModeContextType } from '@progress/kendo-react-common';
|
|
10
|
+
import { LocalizationService } from '@progress/kendo-react-intl';
|
|
11
|
+
import { DateInputHandle, DateInputProps } from '../dateinput/DateInput.js';
|
|
12
|
+
import { TimeSelector } from './TimeSelector.js';
|
|
13
|
+
import { TimePickerSettings } from './models/index.js';
|
|
14
|
+
import { DateInputCommonPackageProps } from '../dateinput/models/common-package-props.js';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
/**
|
|
17
|
+
* The arguments for the `onChange` event of the TimePicker.
|
|
18
|
+
*/
|
|
19
|
+
export interface TimePickerChangeEvent {
|
|
20
|
+
/** The native DOM event. */
|
|
21
|
+
nativeEvent?: any;
|
|
22
|
+
/** The React synthetic event. */
|
|
23
|
+
syntheticEvent: React.SyntheticEvent<any>;
|
|
24
|
+
/** The new `value`. */
|
|
25
|
+
value: Date | null;
|
|
26
|
+
/** The current popup state. */
|
|
27
|
+
show: boolean;
|
|
28
|
+
/** The component instance that fired the event. */
|
|
29
|
+
target: TimePicker;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The arguments for the `onOpen` event of the TimePicker.
|
|
33
|
+
*/
|
|
34
|
+
export interface TimePickerOpenEvent {
|
|
35
|
+
/** The component instance that fired the event. */
|
|
36
|
+
target: TimePicker;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The arguments for the `onClose` event of the TimePicker.
|
|
40
|
+
*/
|
|
41
|
+
export interface TimePickerCloseEvent {
|
|
42
|
+
/** The component instance that fired the event. */
|
|
43
|
+
target: TimePicker;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Represents the props of the [KendoReact TimePicker component](https://www.telerik.com/kendo-react-ui/components/dateinputs/timepicker).
|
|
47
|
+
*/
|
|
48
|
+
export interface TimePickerProps extends TimePickerSettings, FormComponentProps, DateInputCommonPackageProps {
|
|
49
|
+
/**
|
|
50
|
+
* Sets the default value of the TimePicker ([see example](https://www.telerik.com/kendo-react-ui/components/dateinputs/timepicker/default-value#toc-setting-the-default-value)).
|
|
51
|
+
*/
|
|
52
|
+
defaultValue?: Date | null;
|
|
53
|
+
/**
|
|
54
|
+
* Fires each time the user selects a new value ([see example](https://www.telerik.com/kendo-react-ui/components/dateinputs/timepicker/controlled-state#toc-controlling-the-date-value)).
|
|
55
|
+
*/
|
|
56
|
+
onChange?: (event: TimePickerChangeEvent) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Fires each time the popup is opened.
|
|
59
|
+
*/
|
|
60
|
+
onOpen?: (event: TimePickerOpenEvent) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Fires each time the popup is closed.
|
|
63
|
+
*/
|
|
64
|
+
onClose?: (event: TimePickerCloseEvent) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Specifies the value of the TimePicker ([see example](https://www.telerik.com/kendo-react-ui/components/dateinputs/timepicker/controlled-state#toc-controlling-the-date-value)).
|
|
67
|
+
*
|
|
68
|
+
* > The `value` has to be a valid [JavaScript `Date`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date) instance.
|
|
69
|
+
*/
|
|
70
|
+
value?: Date | null;
|
|
71
|
+
/**
|
|
72
|
+
* Configures the `size` of the TimePicker.
|
|
73
|
+
*
|
|
74
|
+
* The available options are:
|
|
75
|
+
* - small
|
|
76
|
+
* - medium
|
|
77
|
+
* - large
|
|
78
|
+
*
|
|
79
|
+
* @default undefined (theme-controlled)
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```tsx
|
|
83
|
+
* <TimePicker size="large" />
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
size?: 'small' | 'medium' | 'large';
|
|
87
|
+
/**
|
|
88
|
+
* Configures the `roundness` of the TimePicker.
|
|
89
|
+
*
|
|
90
|
+
* The available options are:
|
|
91
|
+
* - small
|
|
92
|
+
* - medium
|
|
93
|
+
* - large
|
|
94
|
+
* - full
|
|
95
|
+
*
|
|
96
|
+
* @default undefined (theme-controlled)
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```tsx
|
|
100
|
+
* <TimePicker rounded="full" />
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
rounded?: 'small' | 'medium' | 'large' | 'full';
|
|
104
|
+
/**
|
|
105
|
+
* Configures the `fillMode` of the TimePicker.
|
|
106
|
+
*
|
|
107
|
+
* The available options are:
|
|
108
|
+
* - solid
|
|
109
|
+
* - outline
|
|
110
|
+
* - flat
|
|
111
|
+
*
|
|
112
|
+
* @default undefined (theme-controlled)
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```tsx
|
|
116
|
+
* <TimePicker fillMode="outline" />
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
fillMode?: 'solid' | 'flat' | 'outline';
|
|
120
|
+
/**
|
|
121
|
+
* Providing different rendering of the popup element based on the screen dimensions.
|
|
122
|
+
*
|
|
123
|
+
* @default `false`
|
|
124
|
+
*/
|
|
125
|
+
adaptive?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Specifies the text that is rendered as title in the adaptive popup(action sheet).
|
|
128
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
129
|
+
* If not provided, the title will be the same as the label.
|
|
130
|
+
*/
|
|
131
|
+
adaptiveTitle?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Specifies the text that is rendered as subtitle in the adaptive popup(action sheet).
|
|
134
|
+
* Applicable only when `adaptive` is set to `true`.
|
|
135
|
+
*/
|
|
136
|
+
adaptiveSubtitle?: string;
|
|
137
|
+
/**
|
|
138
|
+
* @hidden
|
|
139
|
+
*/
|
|
140
|
+
unstyled?: DateInputsClassStructure;
|
|
141
|
+
/**
|
|
142
|
+
* Indicates whether the mouse scroll can be used to increase/decrease the time segments values.
|
|
143
|
+
*
|
|
144
|
+
* @default `true`
|
|
145
|
+
*/
|
|
146
|
+
enableMouseWheel?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Sets the HTML attributes of the inner focusable input element.
|
|
149
|
+
* Attributes which are essential for certain component functionalities cannot be changed.
|
|
150
|
+
*/
|
|
151
|
+
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
152
|
+
/**
|
|
153
|
+
* @hidden
|
|
154
|
+
* This prop is provided by the withAdaptiveModeContext HOC to subscribe to AdaptiveModeContext.
|
|
155
|
+
*/
|
|
156
|
+
_adaptiveMode?: AdaptiveModeContextType;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* @hidden
|
|
160
|
+
*/
|
|
161
|
+
export interface TimePickerState {
|
|
162
|
+
value: Date | null;
|
|
163
|
+
show: boolean;
|
|
164
|
+
focused: boolean;
|
|
165
|
+
windowWidth?: number;
|
|
166
|
+
candidate: Date | null;
|
|
167
|
+
}
|
|
168
|
+
/** @hidden */
|
|
169
|
+
export declare class TimePickerWithoutContext extends React.Component<TimePickerProps, TimePickerState> implements FormComponent {
|
|
170
|
+
/**
|
|
171
|
+
* @hidden
|
|
172
|
+
*/
|
|
173
|
+
static displayName: string;
|
|
174
|
+
/**
|
|
175
|
+
* @hidden
|
|
176
|
+
*/
|
|
177
|
+
static propTypes: {
|
|
178
|
+
className: PropTypes.Requireable<string>;
|
|
179
|
+
cancelButton: PropTypes.Requireable<boolean>;
|
|
180
|
+
nowButton: PropTypes.Requireable<boolean>;
|
|
181
|
+
defaultShow: PropTypes.Requireable<boolean>;
|
|
182
|
+
defaultValue: PropTypes.Requireable<Date>;
|
|
183
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
184
|
+
format: PropTypes.Requireable<NonNullable<string | PropTypes.InferProps<{
|
|
185
|
+
skeleton: PropTypes.Requireable<string>;
|
|
186
|
+
pattern: PropTypes.Requireable<string>;
|
|
187
|
+
date: PropTypes.Requireable<string>;
|
|
188
|
+
time: PropTypes.Requireable<string>;
|
|
189
|
+
datetime: PropTypes.Requireable<string>;
|
|
190
|
+
era: PropTypes.Requireable<string>;
|
|
191
|
+
year: PropTypes.Requireable<string>;
|
|
192
|
+
month: PropTypes.Requireable<string>;
|
|
193
|
+
day: PropTypes.Requireable<string>;
|
|
194
|
+
weekday: PropTypes.Requireable<string>;
|
|
195
|
+
hour: PropTypes.Requireable<string>;
|
|
196
|
+
hour12: PropTypes.Requireable<boolean>;
|
|
197
|
+
minute: PropTypes.Requireable<string>;
|
|
198
|
+
second: PropTypes.Requireable<string>;
|
|
199
|
+
timeZoneName: PropTypes.Requireable<string>;
|
|
200
|
+
}> | null | undefined>>;
|
|
201
|
+
formatPlaceholder: PropTypes.Requireable<NonNullable<"short" | "narrow" | "wide" | "formatPattern" | PropTypes.InferProps<{
|
|
202
|
+
year: PropTypes.Requireable<string>;
|
|
203
|
+
month: PropTypes.Requireable<string>;
|
|
204
|
+
day: PropTypes.Requireable<string>;
|
|
205
|
+
hour: PropTypes.Requireable<string>;
|
|
206
|
+
minute: PropTypes.Requireable<string>;
|
|
207
|
+
second: PropTypes.Requireable<string>;
|
|
208
|
+
}> | null | undefined>>;
|
|
209
|
+
id: PropTypes.Requireable<string>;
|
|
210
|
+
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
211
|
+
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
212
|
+
min: PropTypes.Requireable<Date>;
|
|
213
|
+
max: PropTypes.Requireable<Date>;
|
|
214
|
+
name: PropTypes.Requireable<string>;
|
|
215
|
+
popupSettings: PropTypes.Requireable<PropTypes.InferProps<{
|
|
216
|
+
animate: PropTypes.Requireable<boolean>;
|
|
217
|
+
appendTo: PropTypes.Requireable<any>;
|
|
218
|
+
popupClass: PropTypes.Requireable<string>;
|
|
219
|
+
}>>;
|
|
220
|
+
show: PropTypes.Requireable<boolean>;
|
|
221
|
+
steps: PropTypes.Requireable<PropTypes.InferProps<{
|
|
222
|
+
hour: PropTypes.Requireable<number>;
|
|
223
|
+
minute: PropTypes.Requireable<number>;
|
|
224
|
+
second: PropTypes.Requireable<number>;
|
|
225
|
+
}>>;
|
|
226
|
+
smoothScroll: PropTypes.Requireable<boolean>;
|
|
227
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
228
|
+
title: PropTypes.Requireable<string>;
|
|
229
|
+
value: PropTypes.Requireable<Date>;
|
|
230
|
+
width: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
231
|
+
validationMessage: PropTypes.Requireable<string>;
|
|
232
|
+
required: PropTypes.Requireable<boolean>;
|
|
233
|
+
validate: PropTypes.Requireable<boolean>;
|
|
234
|
+
valid: PropTypes.Requireable<boolean>;
|
|
235
|
+
size: PropTypes.Requireable<"small" | "medium" | "large" | undefined>;
|
|
236
|
+
rounded: PropTypes.Requireable<"small" | "medium" | "large" | "full" | undefined>;
|
|
237
|
+
fillMode: PropTypes.Requireable<"flat" | "solid" | "outline" | undefined>;
|
|
238
|
+
inputAttributes: PropTypes.Requireable<object>;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* @hidden
|
|
242
|
+
*/
|
|
243
|
+
static defaultProps: {
|
|
244
|
+
defaultShow: boolean;
|
|
245
|
+
defaultValue: null;
|
|
246
|
+
disabled: boolean;
|
|
247
|
+
format: string;
|
|
248
|
+
max: Date;
|
|
249
|
+
min: Date;
|
|
250
|
+
popupSettings: {};
|
|
251
|
+
tabIndex: number;
|
|
252
|
+
steps: {};
|
|
253
|
+
validityStyles: boolean;
|
|
254
|
+
dateInput: React.ComponentType<DateInputProps<any>>;
|
|
255
|
+
size: "small" | "medium" | "large" | undefined;
|
|
256
|
+
rounded: "small" | "medium" | "large" | "full" | undefined;
|
|
257
|
+
fillMode: "flat" | "solid" | "outline" | undefined;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* @hidden
|
|
261
|
+
*/
|
|
262
|
+
readonly state: TimePickerState;
|
|
263
|
+
private get _popupId();
|
|
264
|
+
private _element;
|
|
265
|
+
private _dateInput;
|
|
266
|
+
private _timeSelector;
|
|
267
|
+
private valueDuringOnChange?;
|
|
268
|
+
private showDuringOnChange?;
|
|
269
|
+
private shouldFocusDateInput;
|
|
270
|
+
private prevShow;
|
|
271
|
+
private observerResize?;
|
|
272
|
+
private get document();
|
|
273
|
+
private readonly showLicenseWatermark;
|
|
274
|
+
private readonly licenseMessage?;
|
|
275
|
+
constructor(props: TimePickerProps);
|
|
276
|
+
/**
|
|
277
|
+
* Gets the wrapping element of the TimePicker.
|
|
278
|
+
*/
|
|
279
|
+
get element(): HTMLSpanElement | null;
|
|
280
|
+
/**
|
|
281
|
+
* Gets the DateInput component inside the TimePicker component.
|
|
282
|
+
*/
|
|
283
|
+
get dateInput(): DateInputHandle | null;
|
|
284
|
+
/**
|
|
285
|
+
* Gets the TimeSelector component inside the TimePicker component.
|
|
286
|
+
*/
|
|
287
|
+
get timeSelector(): TimeSelector | null;
|
|
288
|
+
/**
|
|
289
|
+
* Gets the value of the TimePicker.
|
|
290
|
+
*/
|
|
291
|
+
get value(): Date | null;
|
|
292
|
+
/**
|
|
293
|
+
* Gets the popup state of the TimeSelector.
|
|
294
|
+
*/
|
|
295
|
+
get show(): boolean;
|
|
296
|
+
/**
|
|
297
|
+
* Gets the `name` property of the TimePicker.
|
|
298
|
+
*/
|
|
299
|
+
get name(): string | undefined;
|
|
300
|
+
/**
|
|
301
|
+
* Represents the validity state into which the TimePicker is set.
|
|
302
|
+
*/
|
|
303
|
+
get validity(): FormComponentValidity;
|
|
304
|
+
/**
|
|
305
|
+
* Returns a boolean value indicating whether the TimePicker is in mobile mode.
|
|
306
|
+
*/
|
|
307
|
+
get mobileMode(): boolean;
|
|
308
|
+
/**
|
|
309
|
+
* @hidden
|
|
310
|
+
*/
|
|
311
|
+
protected get validityStyles(): boolean;
|
|
312
|
+
/**
|
|
313
|
+
* @hidden
|
|
314
|
+
*/
|
|
315
|
+
protected get required(): boolean;
|
|
316
|
+
private get popupSettings();
|
|
317
|
+
private get min();
|
|
318
|
+
private get max();
|
|
319
|
+
protected get dateInputComp(): React.ComponentType<DateInputProps<any>>;
|
|
320
|
+
protected get localizationService(): LocalizationService;
|
|
321
|
+
/**
|
|
322
|
+
* @hidden
|
|
323
|
+
*/
|
|
324
|
+
componentDidMount(): void;
|
|
325
|
+
/**
|
|
326
|
+
* @hidden
|
|
327
|
+
*/
|
|
328
|
+
componentDidUpdate(): void;
|
|
329
|
+
/**
|
|
330
|
+
* @hidden
|
|
331
|
+
*/
|
|
332
|
+
componentWillUnmount(): void;
|
|
333
|
+
/**
|
|
334
|
+
* @hidden
|
|
335
|
+
*/
|
|
336
|
+
focus: () => void;
|
|
337
|
+
/**
|
|
338
|
+
* @hidden
|
|
339
|
+
*/
|
|
340
|
+
render(): React.JSX.Element;
|
|
341
|
+
private renderTimeSelector;
|
|
342
|
+
private renderPopup;
|
|
343
|
+
private renderAdaptivePopup;
|
|
344
|
+
protected setTimeSelectorRef: (timeSelector: TimeSelector | null) => void;
|
|
345
|
+
protected nextValue: (nextProps: TimePickerProps, nextState: TimePickerState) => Date | null;
|
|
346
|
+
protected nextShow: (nextProps: TimePickerProps, nextState: TimePickerState) => boolean;
|
|
347
|
+
protected normalizeTime(date: Date): Date;
|
|
348
|
+
protected setShow(show: boolean): void;
|
|
349
|
+
protected mergeTime(value: Date | null): Date | null;
|
|
350
|
+
private handleInputValueChange;
|
|
351
|
+
private handleTimeChange;
|
|
352
|
+
private handleValueChange;
|
|
353
|
+
private handleFocus;
|
|
354
|
+
private handleBlur;
|
|
355
|
+
private handleValueReject;
|
|
356
|
+
private handleClick;
|
|
357
|
+
private handleIconMouseDown;
|
|
358
|
+
private handleKeyDown;
|
|
359
|
+
private calculateMedia;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Represents the PropsContext of the `TimePicker` component.
|
|
363
|
+
* Used for global configuration of all `TimePicker` instances.
|
|
364
|
+
*
|
|
365
|
+
* For more information, refer to the [DateInputs Props Context](https://www.telerik.com/kendo-react-ui/components/dateinputs/props-context) article.
|
|
366
|
+
*/
|
|
367
|
+
export declare const TimePickerPropsContext: React.Context<(p: TimePickerProps) => TimePickerProps>;
|
|
368
|
+
/**
|
|
369
|
+
* Represent the `ref` of the TimePicker component.
|
|
370
|
+
*/
|
|
371
|
+
export interface TimePickerHandle extends Pick<TimePickerWithoutContext, keyof TimePickerWithoutContext> {
|
|
372
|
+
/**
|
|
373
|
+
* Gets the DateInput component inside the TimePicker component.
|
|
374
|
+
*/
|
|
375
|
+
dateInput: DateInputHandle | null;
|
|
376
|
+
/**
|
|
377
|
+
* Returns the HTML element of the TimePicker component.
|
|
378
|
+
*/
|
|
379
|
+
element: HTMLSpanElement | null;
|
|
380
|
+
/**
|
|
381
|
+
* Returns a boolean value indicating whether the TimePicker is in mobile mode.
|
|
382
|
+
*/
|
|
383
|
+
mobileMode: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Gets the `name` property of the TimePicker.
|
|
386
|
+
*/
|
|
387
|
+
name: string | undefined;
|
|
388
|
+
/**
|
|
389
|
+
* The props of the TimePickerHandle component.
|
|
390
|
+
*/
|
|
391
|
+
props: Readonly<TimePickerProps>;
|
|
392
|
+
/**
|
|
393
|
+
* Gets the popup state of the TimeSelector.
|
|
394
|
+
*/
|
|
395
|
+
show: boolean;
|
|
396
|
+
/**
|
|
397
|
+
* Represents the validity state into which the TimePicker is set.
|
|
398
|
+
*/
|
|
399
|
+
validity: FormComponentValidity;
|
|
400
|
+
/**
|
|
401
|
+
* Gets the value of the TimePicker.
|
|
402
|
+
*/
|
|
403
|
+
value: Date | null;
|
|
404
|
+
/**
|
|
405
|
+
* Gets the TimeSelector component inside the TimePicker component.
|
|
406
|
+
*/
|
|
407
|
+
timeSelector: TimeSelector | null;
|
|
408
|
+
}
|
|
409
|
+
/** @hidden */
|
|
410
|
+
export type TimePicker = TimePickerHandle;
|
|
411
|
+
/**
|
|
412
|
+
* Represents the KendoReact TimePicker Component.
|
|
413
|
+
*
|
|
414
|
+
* Accepts properties of type [TimePicker](https://www.telerik.com/kendo-react-ui/components/dateinputs/api/timepickerprops).
|
|
415
|
+
* Obtaining the `ref` returns an object of type [TimePickerHandle](https://www.telerik.com/kendo-react-ui/components/dateinputs/api/timepickerhandle).
|
|
416
|
+
*/
|
|
417
|
+
export declare const TimePicker: React.ForwardRefExoticComponent<TimePickerProps & React.RefAttributes<any>>;
|
package/timepicker/TimePicker.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),e=require("prop-types"),Z=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),$=require("@progress/kendo-svg-icons"),M=require("@progress/kendo-react-intl"),T=require("../package-metadata.js"),l=require("../messages/index.js"),J=require("../dateinput/DateInput.js"),Q=require("./TimeSelector.js"),p=require("../utils.js"),f=require("./utils.js"),Y=require("../hooks/usePickerFloatingLabel.js"),ee=require("@progress/kendo-react-buttons"),te=require("../common/AdaptiveMode.js"),ie=require("@progress/kendo-react-layout");function se(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return i.default=c,Object.freeze(i)}const a=se(X),r=class r extends a.Component{constructor(i){super(i),this._element=null,this._dateInput=a.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.showLicenseWatermark=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:s,nowButton:n,disabled:u,format:d,steps:h,unstyled:g}=this.props;return a.createElement(Q.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:s,disabled:u,nowButton:n,format:d,min:this.min,max:this.max,steps:h,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject,unstyled:g})},this.renderPopup=()=>{const{popupClass:t,...s}=this.popupSettings,{unstyled:n}=this.props,u=n&&n.uTimePicker,d=o.classNames(t),h={popupClass:o.uTimePicker.popup({c:u}),show:this.show,animate:this.element!==null,anchor:this.element,className:d,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...s};return this.props.popup?a.createElement(this.props.popup,{...h},this.renderTimeSelector()):a.createElement(Z.Popup,{...h},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(l.toggleClock,l.messages[l.timePickerCancel]),onCancel:this.handleValueReject,applyText:this.localizationService.toLanguageString(l.timePickerSet,l.messages[l.timePickerSet]),onApply:n=>this.handleValueChange(n)}};return a.createElement(te.AdaptiveMode,{...s},a.createElement(ie.ActionSheetContent,null,this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},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=>{const s=this.mergeTime(t.value);this.handleValueChange({...t,value:s})},this.handleTimeChange=t=>{this.setState({candidate:t.time})},this.handleValueChange=t=>{this.setState({value:y.cloneDate(t.value||this.state.candidate)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.shouldFocusDateInput=!0;const{onChange:s}=this.props,n=this.state.candidate||this.value;s&&s.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:n,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.handleValueReject=t=>{this.setShow(!1)},this.handleClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:n}=t;if(n===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(n===o.Keys.up||n===o.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=n===o.Keys.up,this.setShow(n===o.Keys.down))},this.showLicenseWatermark=!o.validatePackage(T.packageMetadata,{component:"TimePicker"}),this.licenseMessage=o.getLicenseMessage(T.packageMetadata),this.state={value:this.props.defaultValue||r.defaultProps.defaultValue,show:this.props.defaultShow||r.defaultProps.defaultShow,focused:!1,candidate:null},this.normalizeTime=this.normalizeTime.bind(this),this.setShow=this.setShow.bind(this),this.mergeTime=this.mergeTime.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get timeSelector(){return this._timeSelector}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?y.cloneDate(i):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 validity(){const i=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),s=this.normalizeTime(this.max),n=f.isInRange(i,t,s),u=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&n,h=this.props.valid!==void 0?this.props.valid:d;return{customError:u,rangeOverflow:f.isBiggerThanMax(i,s),rangeUnderflow:f.isSmallerThanMin(i,t),valid:h,valueMissing:this.value===null}}get mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:r.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get popupSettings(){return this.props.popupSettings||r.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:r.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:r.defaultProps.max}get dateInputComp(){return this.props.dateInput||r.defaultProps.dateInput}get localizationService(){return M.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=o.canUseDOM&&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)}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow&&this._timeSelector.focusActiveList(),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._timeSelector&&this._timeSelector.focusActiveList()},300),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=r.defaultProps.size,rounded:t=r.defaultProps.rounded,fillMode:s=r.defaultProps.fillMode,disabled:n,tabIndex:u,title:d,id:h,className:g,format:P,formatPlaceholder:k,width:O,name:D,steps:z,validationMessage:x,required:q,validityStyles:R,ariaLabelledBy:E,ariaDescribedBy:B,unstyled:v,enableMouseWheel:A,autoCorrectParts:F,autoSwitchParts:L,autoSwitchKeys:V,allowCaretMode:N,inputAttributes:_}=this.props,w=v&&v.uTimePicker,b=!this.validityStyles||this.validity.valid,K={disabled:n,format:P,formatPlaceholder:k,id:h,ariaLabelledBy:E,ariaDescribedBy:B,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:D,onChange:this.handleInputValueChange,required:q,steps:z,tabIndex:this.show?-1:u,title:d,valid:this.validity.valid,validationMessage:x,validityStyles:R,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,size:null,fillMode:null,rounded:null,enableMouseWheel:A,autoCorrectParts:F,autoSwitchParts:L,autoSwitchKeys:V,allowCaretMode:N,inputAttributes:_},j=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),W=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),S=a.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:U,onBlur:H})=>a.createElement(a.Fragment,null,a.createElement("span",{ref:G=>{this._element=G},className:o.classNames(o.uTimePicker.wrapper({c:w,size:i,rounded:t,fillMode:s,invalid:!b,required:this.required,disabled:n}),g),onKeyDown:this.handleKeyDown,style:{width:O},onFocus:this.mobileMode?this.handleClick:U,onBlur:H,onClick:this.mobileMode?this.handleClick:void 0},a.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,...K}),a.createElement(ee.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:$.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:W,className:o.classNames(o.uTimePicker.inputButton({c:w})),rounded:null,fillMode:s,"aria-label":j}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&a.createElement(o.WatermarkOverlay,{message:this.licenseMessage})));return this.props.label?a.createElement(Y.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:b,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}normalizeTime(i){return p.setTime(p.MIDNIGHT_DATE,i)}setShow(i){const{onOpen:t,onClose:s}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&s&&s.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?p.setTime(this.value,i):i}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.target.clientWidth})}};r.displayName="TimePicker",r.propTypes={className:e.string,cancelButton:e.bool,nowButton:e.bool,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,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,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),inputAttributes:e.object},r.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:p.MAX_TIME,min:p.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},validityStyles:!0,dateInput:J.DateInput,size:"medium",rounded:"medium",fillMode:"solid"};let m=r;const C=o.createPropsContext(),I=o.withIdHOC(o.withPropsContext(C,o.withUnstyledHOC(o.withAdaptiveModeContext(m))));I.displayName="KendoReactTimePicker";M.registerForLocalization(m);exports.TimePicker=I;exports.TimePickerPropsContext=C;exports.TimePickerWithoutContext=m;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),e=require("prop-types"),Z=require("@progress/kendo-react-popup"),y=require("@progress/kendo-date-math"),o=require("@progress/kendo-react-common"),$=require("@progress/kendo-svg-icons"),C=require("@progress/kendo-react-intl"),T=require("../package-metadata.js"),l=require("../messages/index.js"),J=require("../dateinput/DateInput.js"),Q=require("./TimeSelector.js"),p=require("../utils.js"),f=require("./utils.js"),Y=require("../hooks/usePickerFloatingLabel.js"),ee=require("@progress/kendo-react-buttons"),te=require("../common/AdaptiveMode.js"),ie=require("@progress/kendo-react-layout");function se(c){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(i,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return i.default=c,Object.freeze(i)}const a=se(X),r=class r extends a.Component{constructor(i){super(i),this._element=null,this._dateInput=a.createRef(),this._timeSelector=null,this.shouldFocusDateInput=!1,this.prevShow=!1,this.showLicenseWatermark=!1,this.focus=()=>{this.dateInput&&this.dateInput.focus()},this.renderTimeSelector=()=>{const{smoothScroll:t,cancelButton:s,nowButton:n,disabled:u,format:d,steps:h,unstyled:g}=this.props;return a.createElement(Q.TimeSelector,{ref:this.setTimeSelectorRef,mobileMode:this.mobileMode,show:this.show,cancelButton:s,disabled:u,nowButton:n,format:d,min:this.min,max:this.max,steps:h,smoothScroll:t,value:this.value,footer:!this.mobileMode,handleTimeChange:this.mobileMode&&this.handleTimeChange,onChange:this.handleValueChange,onReject:this.handleValueReject,unstyled:g})},this.renderPopup=()=>{const{popupClass:t,...s}=this.popupSettings,{unstyled:n}=this.props,u=n&&n.uTimePicker,d=o.classNames(t),h={popupClass:o.uTimePicker.popup({c:u}),show:this.show,animate:this.element!==null,anchor:this.element,className:d,id:this._popupId,anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},...s};return this.props.popup?a.createElement(this.props.popup,{...h},this.renderTimeSelector()):a.createElement(Z.Popup,{...h},this.renderTimeSelector())},this.renderAdaptivePopup=()=>{const{windowWidth:t=0}=this.state,s={expand:this.show,onClose:this.handleBlur,title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,windowWidth:t,footer:{cancelText:this.localizationService.toLanguageString(l.toggleClock,l.messages[l.timePickerCancel]),onCancel:this.handleValueReject,applyText:this.localizationService.toLanguageString(l.timePickerSet,l.messages[l.timePickerSet]),onApply:n=>this.handleValueChange(n)}};return a.createElement(te.AdaptiveMode,{...s},a.createElement(ie.ActionSheetContent,null,this.renderTimeSelector()))},this.setTimeSelectorRef=t=>{this._timeSelector=t},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=>{const s=this.mergeTime(t.value);this.handleValueChange({...t,value:s})},this.handleTimeChange=t=>{this.setState({candidate:t.time})},this.handleValueChange=t=>{this.setState({value:y.cloneDate(t.value||this.state.candidate)}),this.valueDuringOnChange=t.value,this.showDuringOnChange=!1,this.shouldFocusDateInput=!0;const{onChange:s}=this.props,n=this.state.candidate||this.value;s&&s.call(void 0,{syntheticEvent:t.syntheticEvent,nativeEvent:t.nativeEvent,value:n,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.handleValueReject=t=>{this.setShow(!1)},this.handleClick=t=>{this.props.disabled||(this.shouldFocusDateInput=!0,this.setShow(!this.show))},this.handleIconMouseDown=t=>{t.preventDefault()},this.handleKeyDown=t=>{const{altKey:s,keyCode:n}=t;if(n===o.Keys.esc){this.shouldFocusDateInput=!0,this.setShow(!1);return}s&&(n===o.Keys.up||n===o.Keys.down)&&(t.preventDefault(),t.stopPropagation(),this.shouldFocusDateInput=n===o.Keys.up,this.setShow(n===o.Keys.down))},this.showLicenseWatermark=!o.validatePackage(T.packageMetadata,{component:"TimePicker"}),this.licenseMessage=o.getLicenseMessage(T.packageMetadata),this.state={value:this.props.defaultValue||r.defaultProps.defaultValue,show:this.props.defaultShow||r.defaultProps.defaultShow,focused:!1,candidate:null},this.normalizeTime=this.normalizeTime.bind(this),this.setShow=this.setShow.bind(this),this.mergeTime=this.mergeTime.bind(this)}get _popupId(){return this.props.id+"-popup-id"}get document(){if(o.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get dateInput(){return this._dateInput.current}get timeSelector(){return this._timeSelector}get value(){const i=this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value;return i!==null?y.cloneDate(i):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 validity(){const i=this.value&&this.normalizeTime(this.value),t=this.normalizeTime(this.min),s=this.normalizeTime(this.max),n=f.isInRange(i,t,s),u=this.props.validationMessage!==void 0,d=(!this.required||this.value!==null)&&n,h=this.props.valid!==void 0?this.props.valid:d;return{customError:u,rangeOverflow:f.isBiggerThanMax(i,s),rangeUnderflow:f.isSmallerThanMin(i,t),valid:h,valueMissing:this.value===null}}get mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:r.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}get popupSettings(){return this.props.popupSettings||r.defaultProps.popupSettings}get min(){return this.props.min!==void 0?this.props.min:r.defaultProps.min}get max(){return this.props.max!==void 0?this.props.max:r.defaultProps.max}get dateInputComp(){return this.props.dateInput||r.defaultProps.dateInput}get localizationService(){return C.provideLocalizationService(this)}componentDidMount(){var i;this.observerResize=o.canUseDOM&&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)}componentDidUpdate(){this._timeSelector&&this.show&&!this.prevShow&&this._timeSelector.focusActiveList(),this.mobileMode&&this.show&&!this.prevShow&&setTimeout(()=>{this._timeSelector&&this._timeSelector.focusActiveList()},300),this.dateInput&&this.dateInput.element&&!this.show&&this.shouldFocusDateInput&&this.dateInput.element.focus({preventScroll:!0}),this.prevShow=this.show,this.shouldFocusDateInput=!1}componentWillUnmount(){var i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const{size:i=r.defaultProps.size,rounded:t=r.defaultProps.rounded,fillMode:s=r.defaultProps.fillMode,disabled:n,tabIndex:u,title:d,id:h,className:g,format:P,formatPlaceholder:k,width:O,name:D,steps:z,validationMessage:x,required:q,validityStyles:R,ariaLabelledBy:E,ariaDescribedBy:B,unstyled:v,enableMouseWheel:A,autoCorrectParts:F,autoSwitchParts:L,autoSwitchKeys:V,allowCaretMode:N,inputAttributes:_}=this.props,w=v&&v.uTimePicker,b=!this.validityStyles||this.validity.valid,K={disabled:n,format:P,formatPlaceholder:k,id:h,ariaLabelledBy:E,ariaDescribedBy:B,max:this.normalizeTime(this.max),min:this.normalizeTime(this.min),name:D,onChange:this.handleInputValueChange,required:q,steps:z,tabIndex:this.show?-1:u,title:d,valid:this.validity.valid,validationMessage:x,validityStyles:R,value:this.value&&this.normalizeTime(this.value),label:void 0,placeholder:this.state.focused?null:this.props.placeholder,ariaHasPopup:"dialog",ariaExpanded:this.show,enableMouseWheel:A,autoCorrectParts:F,autoSwitchParts:L,autoSwitchKeys:V,allowCaretMode:N,inputAttributes:_},j=this.localizationService.toLanguageString(l.toggleClock,l.messages[l.toggleClock]),W=this.localizationService.toLanguageString(l.toggleTimeSelector,l.messages[l.toggleTimeSelector]),S=a.createElement(o.AsyncFocusBlur,{onFocus:this.handleFocus,onBlur:this.mobileMode?void 0:this.handleBlur,onSyncBlur:this.props.onBlur,onSyncFocus:this.props.onFocus},({onFocus:U,onBlur:H})=>a.createElement(a.Fragment,null,a.createElement("span",{ref:G=>{this._element=G},className:o.classNames(o.uTimePicker.wrapper({c:w,size:i,rounded:t,fillMode:s,invalid:!b,required:this.required,disabled:n}),g),onKeyDown:this.handleKeyDown,style:{width:O},onFocus:this.mobileMode?this.handleClick:U,onBlur:H,onClick:this.mobileMode?this.handleClick:void 0},a.createElement(this.dateInputComp,{_ref:this._dateInput,ariaRole:"combobox",ariaControls:this._popupId,...K}),a.createElement(ee.Button,{tabIndex:-1,type:"button",icon:"clock",svgIcon:$.clockIcon,onMouseDown:this.handleIconMouseDown,onClick:this.mobileMode?void 0:this.handleClick,title:W,className:o.classNames(o.uTimePicker.inputButton({c:w})),fillMode:s,"aria-label":j}),!this.mobileMode&&this.renderPopup()),this.mobileMode&&this.renderAdaptivePopup(),this.showLicenseWatermark&&a.createElement(o.WatermarkOverlay,{message:this.licenseMessage})));return this.props.label?a.createElement(Y.PickerFloatingLabel,{dateInput:this._dateInput,label:this.props.label,editorId:h,editorValid:b,editorDisabled:this.props.disabled,children:S,style:{width:this.props.width}}):S}normalizeTime(i){return p.setTime(p.MIDNIGHT_DATE,i)}setShow(i){const{onOpen:t,onClose:s}=this.props;this.show!==i&&(this.setState({show:i}),i&&t&&t.call(void 0,{target:this}),!i&&s&&s.call(void 0,{target:this}))}mergeTime(i){return this.value&&i?p.setTime(this.value,i):i}calculateMedia(i){for(const t of i)this.setState({windowWidth:t.target.clientWidth})}};r.displayName="TimePicker",r.propTypes={className:e.string,cancelButton:e.bool,nowButton:e.bool,defaultShow:e.bool,defaultValue:e.instanceOf(Date),disabled:e.bool,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,steps:e.shape({hour:e.number,minute:e.number,second:e.number}),smoothScroll:e.bool,tabIndex:e.number,title:e.string,value:e.instanceOf(Date),width:e.oneOfType([e.number,e.string]),validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full"]),fillMode:e.oneOf(["solid","flat","outline"]),inputAttributes:e.object},r.defaultProps={defaultShow:!1,defaultValue:null,disabled:!1,format:"t",max:p.MAX_TIME,min:p.MIN_TIME,popupSettings:{},tabIndex:0,steps:{},validityStyles:!0,dateInput:J.DateInput,size:void 0,rounded:void 0,fillMode:void 0};let m=r;const M=o.createPropsContext(),I=o.withIdHOC(o.withPropsContext(M,o.withUnstyledHOC(o.withAdaptiveModeContext(m))));I.displayName="KendoReactTimePicker";C.registerForLocalization(m);exports.TimePicker=I;exports.TimePickerPropsContext=M;exports.TimePickerWithoutContext=m;
|