import React from "react"; import { DateInputProps } from "../../Date.Input"; import { DateRange } from "../../Date.typeutils"; import { DatePickerProps } from "../DatePicker"; import { DateValidationT, UseDatepickerOptions } from "./useDatepicker"; export type RangeValidationT = { from: DateValidationT; to: DateValidationT & { isBeforeFrom?: boolean; }; }; export interface UseRangeDatepickerOptions extends Omit { /** * The initially selected DateRange */ defaultSelected?: DateRange; /** * Callback for changed state */ onRangeChange?: (val?: DateRange) => void; /** * validation-callback */ onValidate?: (val: RangeValidationT) => void; } interface UseRangeDatepickerValue { /** * Use: */ datepickerProps: DatePickerProps; /** * Use: */ fromInputProps: Pick & { /** * @private */ setAnchorRef: React.Dispatch>; }; /** * Use: */ toInputProps: Pick & { /** * @private */ setAnchorRef?: React.Dispatch>; }; /** * Resets all states (callback) */ reset: () => void; /** * Currently selected DateRange * Up to user to validate values */ selectedRange?: DateRange; /** * Manually override currently selected day */ setSelected: (date?: DateRange) => void; } /** * * @see 🏷️ {@link UseRangeDatepickerOptions} * @see 🏷️ {@link UseRangeDatepickerValue} * @see 🏷️ {@link RangeValidationT} * @example * const { datepickerProps, fromInputProps, toInputProps } = useRangeDatepicker({ * fromDate: new Date("Aug 23 2019"), * onRangeChange: console.log, * onValidate: console.log, * }); */ export declare const useRangeDatepicker: (opt?: UseRangeDatepickerOptions) => UseRangeDatepickerValue; export {};