react-day-picker
Version:
Customizable Date Picker for React
37 lines (36 loc) • 1.78 kB
TypeScript
import React, { ReactNode } from 'react';
import { DayPickerBase } from '../../types/DayPickerBase';
import { DayPickerRangeProps } from '../../types/DayPickerRange';
import { DayClickEventHandler } from '../../types/EventHandlers';
import { DateRange } from '../../types/Matchers';
import { InternalModifier, Modifiers } from '../../types/Modifiers';
/** Represent the modifiers that are changed by the range selection. */
export declare type SelectRangeModifiers = Pick<Modifiers, InternalModifier.Disabled | InternalModifier.RangeEnd | InternalModifier.RangeMiddle | InternalModifier.RangeStart>;
/** Represents the value of a [[SelectRangeContext]]. */
export interface SelectRangeContextValue {
/** The range of days that has been selected. */
selected: DateRange | undefined;
/** The modifiers for the corresponding selection. */
modifiers: SelectRangeModifiers;
/** Event handler to attach to the day button to enable the range select. */
onDayClick?: DayClickEventHandler;
}
/**
* The SelectRange context shares details about the selected days when in
* range selection mode.
*
* Access this context from the [[useSelectRange]] hook.
*/
export declare const SelectRangeContext: React.Context<SelectRangeContextValue | undefined>;
declare type SelectRangeProviderProps = {
initialProps: DayPickerBase;
children: ReactNode;
};
/** Provides the values for the [[SelectRangeProvider]]. */
export declare function SelectRangeProvider(props: SelectRangeProviderProps): JSX.Element;
declare type SelectRangeProviderInternalProps = {
initialProps: DayPickerRangeProps;
children: ReactNode;
};
export declare function SelectRangeProviderInternal({ initialProps, children }: SelectRangeProviderInternalProps): JSX.Element;
export {};