Debian Codegraph @

node/@patternfly/react-core/dist/esm/components/TimePicker/TimePicker.d.ts

raw
1 import { Component } from 'react';
2 import { TextInputProps } from '../TextInput';
3 export interface TimePickerProps extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'ref'> {
4 /** Additional classes added to the time picker. */
5 className?: string;
6 /** Accessible label for the time picker */
7 'aria-label'?: string;
8 /** Flag indicating the time picker is disabled */
9 isDisabled?: boolean;
10 /** String to display in the empty time picker field as a hint for the expected time format */
11 placeholder?: string;
12 /** Character to display between the hour and minute */
13 delimiter?: string;
14 /** A time string. The format could be an ISO 8601 formatted date string or in 'HH{delimiter}MM' format */
15 time?: string | Date;
16 /** Error message to display when the time is provided in an invalid format. */
17 invalidFormatErrorMessage?: string;
18 /** Error message to display when the time provided is not within the minTime/maxTime constraints */
19 invalidMinMaxErrorMessage?: string;
20 /** True if the time is 24 hour time. False if the time is 12 hour time */
21 is24Hour?: boolean;
22 /** Optional event handler called each time the value in the time picker input changes. */
23 onChange?: (event: React.FormEvent<HTMLInputElement>, time: string, hour?: number, minute?: number, seconds?: number, isValid?: boolean) => void;
24 /** Optional validator can be provided to override the internal time validator. */
25 validateTime?: (time: string) => boolean;
26 /** Id of the time picker */
27 id?: string;
28 /** Width of the time picker. */
29 width?: string;
30 /** The container to append the menu to. Defaults to 'inline'.
31 * If your menu is being cut off you can append it to an element higher up the DOM tree.
32 * Some examples:
33 * menuAppendTo="parent"
34 * menuAppendTo={() => document.body}
35 * menuAppendTo={document.getElementById('target')}
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 /** Flag to control the opened state of the time picker menu */
49 isOpen?: boolean;
50 /** Handler invoked each time the open state of time picker updates */
51 setIsOpen?: (isOpen?: boolean) => void;
52 /** z-index of the time picker */
53 zIndex?: number;
54 }
55 interface TimePickerState {
56 isInvalid: boolean;
57 isTimeOptionsOpen: boolean;
58 timeState: string;
59 focusedIndex: number;
60 scrollIndex: number;
61 timeRegex: RegExp;
62 minTimeState: string;
63 maxTimeState: string;
64 }
65 declare class TimePicker extends Component<TimePickerProps, TimePickerState> {
66 static displayName: string;
67 private baseComponentRef;
68 private toggleRef;
69 private inputRef;
70 private menuRef;
71 static defaultProps: {
72 className: string;
73 isDisabled: boolean;
74 time: string;
75 is24Hour: boolean;
76 invalidFormatErrorMessage: string;
77 invalidMinMaxErrorMessage: string;
78 placeholder: string;
79 delimiter: string;
80 'aria-label': string;
81 width: string;
82 menuAppendTo: string;
83 stepMinutes: number;
84 inputProps: {};
85 minTime: string;
86 maxTime: string;
87 isOpen: boolean;
88 setIsOpen: () => void;
89 zIndex: number;
90 };
91 constructor(props: TimePickerProps);
92 componentDidMount(): void;
93 componentWillUnmount(): void;
94 onDocClick: (event: MouseEvent | TouchEvent) => void;
95 handleGlobalKeys: (event: KeyboardEvent) => void;
96 componentDidUpdate(prevProps: TimePickerProps, prevState: TimePickerState): void;
97 updateFocusedIndex: (increment: number) => void;
98 getIndexToScroll: (index: number) => number;
99 scrollToIndex: (index: number) => void;
100 focusSelection: (index: number) => void;
101 scrollToSelection: (time: string) => void;
102 getRegExp: (includeSeconds?: boolean) => RegExp;
103 getOptions: () => HTMLElement[];
104 isValidFormat: (time: string) => boolean;
105 isValidTime: (time: string) => boolean;
106 isValid: (time: string) => boolean;
107 onToggle: (isOpen: boolean) => void;
108 onSelect: (e: any) => void;
109 onInputClick: (e: any) => void;
110 onInputChange: (event: React.FormEvent<HTMLInputElement>, newTime: string) => void;
111 render(): import("react/jsx-runtime").JSX.Element;
112 }
113 export { TimePicker };
114 //# sourceMappingURL=TimePicker.d.ts.map