1 | import React from 'react';
|
2 | import { CalendarProps } from './Calendar';
|
3 | import { DatePickerInputProps } from './DatePickerInput';
|
4 | import { DateFormats } from './Localization';
|
5 | import { PopupProps } from './Popup';
|
6 | import { TimeInputProps } from './TimeInput';
|
7 | import { WidgetProps } from './Widget';
|
8 | import { TransitionProps } from 'react-transition-group/Transition';
|
9 | import { WidgetHTMLProps, InferFormat } from './shared';
|
10 | export interface DatePickerProps<TLocalizer = unknown> extends Omit<WidgetHTMLProps, 'onChange' | 'defaultValue'>, Omit<WidgetProps, 'onChange' | 'onSelect' | 'defaultValue'> {
|
11 | /**
|
12 | * @example ['valuePicker', [ ['new Date()', null] ]]
|
13 | */
|
14 | value?: Date | null;
|
15 | defaultValue?: Date | null;
|
16 | /**
|
17 | * @example ['onChangePicker', [ ['new Date()', null] ]]
|
18 | */
|
19 | onChange?: (date: Date | null | undefined, rawValue: string) => void;
|
20 | /**
|
21 | * @example ['openDateTime']
|
22 | */
|
23 | open?: boolean;
|
24 | onToggle?: (isOpen: boolean) => void;
|
25 | /**
|
26 | * Default current date at which the calendar opens. If none is provided, opens at today's date or the `value` date (if any).
|
27 | */
|
28 | currentDate?: Date;
|
29 | /**
|
30 | * Change event Handler that is called when the currentDate is changed. The handler is called with the currentDate object.
|
31 | */
|
32 | onCurrentDateChange?: () => void;
|
33 | onSelect?: (date: Date | null, rawValue: string) => void;
|
34 | /**
|
35 | * The minimum Date that can be selected. Min only limits selection, it doesn't constrain the date values that
|
36 | * can be typed or pasted into the widget. If you need this behavior you can constrain values via
|
37 | * the `onChange` handler.
|
38 | *
|
39 | * @example ['prop', ['min', 'new Date()']]
|
40 | */
|
41 | min?: Date;
|
42 | /**
|
43 | * The maximum Date that can be selected. Max only limits selection, it doesn't constrain the date values that
|
44 | * can be typed or pasted into the widget. If you need this behavior you can constrain values via
|
45 | * the `onChange` handler.
|
46 | *
|
47 | * @example ['prop', ['max', 'new Date()']]
|
48 | */
|
49 | max?: Date;
|
50 | /**
|
51 | * The amount of minutes between each entry in the time list.
|
52 | *
|
53 | * @example ['prop', { step: 90 }]
|
54 | */
|
55 | step?: number;
|
56 | /**
|
57 | * Enable the time list component of the picker.
|
58 | */
|
59 | includeTime?: boolean;
|
60 | timePrecision?: 'minutes' | 'seconds' | 'milliseconds';
|
61 | timeInputProps?: Partial<TimeInputProps>;
|
62 | /** Specify the element used to render the calendar dropdown icon. */
|
63 | selectIcon?: React.ReactNode;
|
64 | /**
|
65 | * @example ['prop', { dropUp: true }]
|
66 | */
|
67 | dropUp?: boolean;
|
68 | popupTransition?: React.ComponentType<TransitionProps>;
|
69 | popupComponent?: React.ComponentType<PopupProps>;
|
70 | placeholder?: string;
|
71 | name?: string;
|
72 | autoFocus?: boolean;
|
73 | /**
|
74 | * @example ['disabled', ['new Date()']]
|
75 | */
|
76 | disabled?: boolean;
|
77 | /**
|
78 | * @example ['readOnly', ['new Date()']]
|
79 | */
|
80 | readOnly?: boolean;
|
81 | /**
|
82 | * Determines how the widget parses the typed date string into a Date object. You can provide a date format
|
83 | * or a function that returns a date to handle parsing yourself. When `parse` is unspecified and
|
84 | * the default `localizer.parse` is used and passed the string as well as `valueDisplayFormat` or `valueEditFormat`.
|
85 | */
|
86 | parse?: string | ((str: string, localizer?: TLocalizer) => Date | undefined);
|
87 | onKeyDown?: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
88 | onKeyPress?: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
89 | onBlur?: () => void;
|
90 | onFocus?: () => void;
|
91 | /** Adds a css class to the input container element. */
|
92 | containerClassName?: string;
|
93 | calendarProps?: Partial<CalendarProps>;
|
94 | inputProps?: Partial<DatePickerInputProps>;
|
95 | valueFormat?: InferFormat<TLocalizer>;
|
96 | valueDisplayFormat?: InferFormat<TLocalizer>;
|
97 | valueEditFormat?: InferFormat<TLocalizer>;
|
98 | formats?: DateFormats<InferFormat<TLocalizer>>;
|
99 | messages?: CalendarProps['messages'] & {
|
100 | dateButton?: string;
|
101 | };
|
102 | }
|
103 | export interface DatePickerHandle {
|
104 | focus(): void;
|
105 | }
|
106 | /**
|
107 | * ---
|
108 | * subtitle: DatePicker, TimePicker
|
109 | * localized: true
|
110 | * shortcuts:
|
111 | * - { key: alt + down arrow, label: open calendar or time }
|
112 | * - { key: alt + up arrow, label: close calendar or time }
|
113 | * - { key: down arrow, label: move focus to next item }
|
114 | * - { key: up arrow, label: move focus to previous item }
|
115 | * - { key: home, label: move focus to first item }
|
116 | * - { key: end, label: move focus to last item }
|
117 | * - { key: enter, label: select focused item }
|
118 | * - { key: any key, label: search list for item starting with key }
|
119 | * ---
|
120 | *
|
121 | * @public
|
122 | * @extends Calendar
|
123 | */
|
124 | declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps<unknown> & React.RefAttributes<DatePickerHandle>>;
|
125 | export default DatePicker;
|
126 | //# sourceMappingURL=DatePicker.d.ts.map |
\ | No newline at end of file |