1 | import * as React from 'react';
|
2 | import { TextInputProps } from '../TextInput';
|
3 | export interface TimePickerProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'ref'> {
|
4 |
|
5 | className?: string;
|
6 |
|
7 | 'aria-label'?: string;
|
8 |
|
9 | isDisabled?: boolean;
|
10 |
|
11 | placeholder?: string;
|
12 |
|
13 | delimiter?: string;
|
14 |
|
15 | time?: string | Date;
|
16 |
|
17 | invalidFormatErrorMessage?: string;
|
18 |
|
19 | invalidMinMaxErrorMessage?: string;
|
20 |
|
21 | is24Hour?: boolean;
|
22 |
|
23 | onChange?: (time: string, hour?: number, minute?: number, seconds?: number, isValid?: boolean) => void;
|
24 |
|
25 | validateTime?: (time: string) => boolean;
|
26 |
|
27 | id?: string;
|
28 |
|
29 | width?: string;
|
30 | |
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
38 | /** Size of step between time options in minutes.*/
|
39 | stepMinutes?: number;
|
40 | /** Additional props for input field */
|
41 | inputProps?: TextInputProps;
|
42 | /** A time string indicating the minimum value allowed. The format could be an ISO 8601 formatted date string or in 'HH{delimiter}MM' format */
|
43 | minTime?: string | Date;
|
44 | /** A time string indicating the maximum value allowed. The format could be an ISO 8601 formatted date string or in 'HH{delimiter}MM' format */
|
45 | maxTime?: string | Date;
|
46 | /** Includes number of seconds with the chosen time and allows users to manually edit the seconds value. */
|
47 | includeSeconds?: boolean;
|
48 | }
|
49 | interface TimePickerState {
|
50 | isInvalid: boolean;
|
51 | isOpen: boolean;
|
52 | timeState: string;
|
53 | focusedIndex: number;
|
54 | scrollIndex: number;
|
55 | timeRegex: RegExp;
|
56 | minTimeState: string;
|
57 | maxTimeState: string;
|
58 | }
|
59 | export declare class TimePicker extends React.Component<TimePickerProps, TimePickerState> {
|
60 | static displayName: string;
|
61 | private baseComponentRef;
|
62 | private toggleRef;
|
63 | private inputRef;
|
64 | private menuRef;
|
65 | static defaultProps: {
|
66 | className: string;
|
67 | isDisabled: boolean;
|
68 | time: string;
|
69 | is24Hour: boolean;
|
70 | invalidFormatErrorMessage: string;
|
71 | invalidMinMaxErrorMessage: string;
|
72 | placeholder: string;
|
73 | delimiter: string;
|
74 | 'aria-label': string;
|
75 | width: string;
|
76 | menuAppendTo: string;
|
77 | stepMinutes: number;
|
78 | inputProps: {};
|
79 | minTime: string;
|
80 | maxTime: string;
|
81 | };
|
82 | constructor(props: TimePickerProps);
|
83 | componentDidMount(): void;
|
84 | componentWillUnmount(): void;
|
85 | onDocClick: (event: MouseEvent | TouchEvent) => void;
|
86 | handleGlobalKeys: (event: KeyboardEvent) => void;
|
87 | componentDidUpdate(prevProps: TimePickerProps, prevState: TimePickerState): void;
|
88 | updateFocusedIndex: (increment: number) => void;
|
89 | getIndexToScroll: (index: number) => number;
|
90 | scrollToIndex: (index: number) => void;
|
91 | focusSelection: (index: number) => void;
|
92 | scrollToSelection: (time: string) => void;
|
93 | getRegExp: (includeSeconds?: boolean) => RegExp;
|
94 | getOptions: () => HTMLElement[];
|
95 | isValidFormat: (time: string) => boolean;
|
96 | isValidTime: (time: string) => boolean;
|
97 | isValid: (time: string) => boolean;
|
98 | onToggle: (isOpen: boolean) => void;
|
99 | onSelect: (e: any) => void;
|
100 | onInputClick: (e: any) => void;
|
101 | onInputChange: (newTime: string) => void;
|
102 | onBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
|
103 | render(): JSX.Element;
|
104 | }
|
105 | export {};
|
106 |
|
\ | No newline at end of file |