Debian Codegraph @

node/@patternfly/react-core/dist/js/components/DatePicker/DatePicker.d.ts

raw
1 /// <reference types="react" />
2 import { TextInputProps } from '../TextInput/TextInput';
3 import { PopoverProps } from '../Popover/Popover';
4 import { CalendarFormat } from '../CalendarMonth';
5 /** Props that customize the requirement of a date */
6 export interface DatePickerRequiredObject {
7 /** Flag indicating the date is required. */
8 isRequired?: boolean;
9 /** Error message to display when the text input is empty and the isRequired prop is also passed in. */
10 emptyDateText?: string;
11 }
12 /** The main date picker component. */
13 export interface DatePickerProps extends CalendarFormat, Omit<React.HTMLProps<HTMLInputElement>, 'onChange' | 'onFocus' | 'onBlur' | 'disabled' | 'ref'> {
14 /** The container to append the menu to. Defaults to 'inline'.
15 * If your menu is being cut off you can append it to an element higher up the DOM tree.
16 * Some examples:
17 * menuAppendTo={() => document.body};
18 * menuAppendTo={document.getElementById('target')}
19 */
20 appendTo?: HTMLElement | ((ref?: HTMLElement) => HTMLElement) | 'inline';
21 /** Accessible label for the date picker. */
22 'aria-label'?: string;
23 /** Accessible label for the button to open the date picker. */
24 buttonAriaLabel?: string;
25 /** Additional classes added to the date picker. */
26 className?: string;
27 /** How to format the date in the text input. */
28 dateFormat?: (date: Date) => string;
29 /** How to parse the date in the text input. */
30 dateParse?: (value: string) => Date;
31 /** Helper text to display alongside the date picker. Expects a HelperText component. */
32 helperText?: React.ReactNode;
33 /** Additional props for the text input. */
34 inputProps?: TextInputProps;
35 /** Flag indicating the date picker is disabled. */
36 isDisabled?: boolean;
37 /** Error message to display when the text input contains a non-empty value in an invalid format. */
38 invalidFormatText?: string;
39 /** Callback called every time the text input loses focus. */
40 onBlur?: (event: any, value: string, date?: Date) => void;
41 /** Callback called every time the text input value changes. */
42 onChange?: (event: React.FormEvent<HTMLInputElement>, value: string, date?: Date) => void;
43 /** String to display in the empty text input as a hint for the expected date format. */
44 placeholder?: string;
45 /** Props to pass to the popover that contains the calendar month component. */
46 popoverProps?: Partial<Omit<PopoverProps, 'appendTo'>>;
47 /** Options to customize the requirement of a date */
48 requiredDateOptions?: DatePickerRequiredObject;
49 /** Functions that returns an error message if a date is invalid. */
50 validators?: ((date: Date) => string)[];
51 /** Value of the text input. */
52 value?: string;
53 }
54 /** Allows finer control over the calendar's open state when a React ref is passed into the
55 * date picker component. Accessed via ref.current[property], e.g. ref.current.toggleCalendar().
56 */
57 export interface DatePickerRef {
58 /** Current calendar open status. */
59 isCalendarOpen: boolean;
60 /** Sets the calendar open status. */
61 setCalendarOpen: (isOpen: boolean) => void;
62 /** Toggles the calendar open status. If no parameters are passed, the calendar will simply
63 * toggle its open status.
64 * If the isOpen parameter is passed, that will set the calendar open status to the value
65 * of the isOpen parameter.
66 * If the eventKey parameter is set to 'Escape', that will invoke the date pickers
67 * onEscapePress event to toggle the correct control appropriately.
68 */
69 toggleCalendar: (isOpen?: boolean) => void;
70 }
71 export declare const yyyyMMddFormat: (date: Date) => string;
72 export declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<DatePickerRef>>;
73 //# sourceMappingURL=DatePicker.d.ts.map