1 | import * as React from "react";
|
2 | import { DateRange } from "./common/dateRange";
|
3 | import { TimePrecision } from "./timePicker";
|
4 | export interface IDateShortcutBase {
|
5 | /** Shortcut label that appears in the list. */
|
6 | label: string;
|
7 | /**
|
8 | * Set this prop to `true` to allow this shortcut to change the selected
|
9 | * times as well as the dates. By default, time components of a shortcut are
|
10 | * ignored; clicking a shortcut takes the date components of the `dateRange`
|
11 | * and combines them with the currently selected time.
|
12 | *
|
13 | * @default false
|
14 | */
|
15 | includeTime?: boolean;
|
16 | }
|
17 | export declare type DateRangeShortcut = IDateRangeShortcut;
|
18 | /** @deprecated use DateRangeShortcut */
|
19 | export interface IDateRangeShortcut extends IDateShortcutBase {
|
20 | /**
|
21 | * Date range represented by this shortcut. Note that time components of a
|
22 | * shortcut are ignored by default; set `includeTime: true` to respect them.
|
23 | */
|
24 | dateRange: DateRange;
|
25 | }
|
26 | export declare type DatePickerShortcut = IDatePickerShortcut;
|
27 | /** @deprecated use DatePickerShortcut */
|
28 | export interface IDatePickerShortcut extends IDateShortcutBase {
|
29 | /**
|
30 | * Date represented by this shortcut. Note that time components of a
|
31 | * shortcut are ignored by default; set `includeTime: true` to respect them.
|
32 | */
|
33 | date: Date;
|
34 | }
|
35 | export interface IShortcutsProps {
|
36 | allowSingleDayRange: boolean;
|
37 | minDate: Date;
|
38 | maxDate: Date;
|
39 | shortcuts: DateRangeShortcut[] | true;
|
40 | timePrecision: TimePrecision;
|
41 | selectedShortcutIndex?: number;
|
42 | onShortcutClick: (shortcut: DateRangeShortcut, index: number) => void;
|
43 | /**
|
44 | * The DatePicker component reuses this component for a single date.
|
45 | * This changes the default shortcut labels and affects which shortcuts are used.
|
46 | *
|
47 | * @default false
|
48 | */
|
49 | useSingleDateShortcuts?: boolean;
|
50 | }
|
51 | export declare class Shortcuts extends React.PureComponent<IShortcutsProps> {
|
52 | static defaultProps: Partial<IShortcutsProps>;
|
53 | render(): JSX.Element;
|
54 | private getShorcutClickHandler;
|
55 | private isShortcutInRange;
|
56 | }
|