UNPKG

react-day-picker

Version:

Customizable Date Picker for React

52 lines (51 loc) 2.52 kB
/// <reference types="react" /> import { Matcher } from './Matchers'; /** A _modifier_ represents different styles or states of a day displayed in the calendar. */ export declare type Modifier = string; /** The modifiers used by DayPicker. */ export declare type Modifiers = CustomModifiers & InternalModifiers; /** The name of the modifiers that are used internally by DayPicker. */ export declare enum InternalModifier { Outside = "outside", /** Name of the modifier applied to the disabled days, using the `disabled` prop. */ Disabled = "disabled", /** Name of the modifier applied to the selected days using the `selected` prop). */ Selected = "selected", /** Name of the modifier applied to the hidden days using the `hidden` prop). */ Hidden = "hidden", /** Name of the modifier applied to the day specified using the `today` prop). */ Today = "today", /** The modifier applied to the day starting a selected range, when in range selection mode. */ RangeStart = "range_start", /** The modifier applied to the day ending a selected range, when in range selection mode. */ RangeEnd = "range_end", /** The modifier applied to the days between the start and the end of a selected range, when in range selection mode. */ RangeMiddle = "range_middle" } /** Map of matchers used for the internal modifiers. */ export declare type InternalModifiers = Record<InternalModifier, Matcher[]>; /** * Active modifiers are those Modifiers matching a specific day. * * @example * * ``` * const activeModifiers: ActiveModifiers = { * selected: true, * customModifier: true * } * ``` * * */ export declare type ActiveModifiers = Record<Modifier, true> & Partial<Record<InternalModifier, true>>; /** The style to apply to each day element matching a modifier. */ export declare type ModifiersStyles = Record<Modifier, React.CSSProperties> & Partial<Record<InternalModifier, React.CSSProperties>>; /** The classnames to assign to each day element matching a modifier. */ export declare type ModifiersClassNames = Record<Modifier, string> & Partial<Record<InternalModifier, string>>; /** The custom modifiers passed to the [[DayPickerProps.modifiers]]. */ export declare type DayModifiers = Record<Modifier, Matcher | Matcher[]>; /** * A map of matchers used as custom modifiers by DayPicker component. This is * the same as [[DayModifiers]], but it accepts only array of [[Matcher]]s. */ export declare type CustomModifiers = Record<Modifier, Matcher[]>;