Socket
Socket
Sign inDemoInstall

react-day-picker

Package Overview
Dependencies
6
Maintainers
1
Versions
227
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.2.1 to 8.3.0

dist/index.esm.d.ts

1216

dist/index.d.ts

@@ -1,40 +0,1176 @@

export * from './DayPicker';
export * from './components/Button';
export * from './components/Caption';
export * from './components/CaptionDropdowns';
export * from './components/CaptionLabel';
export * from './components/CaptionNavigation';
export * from './components/Day';
export * from './components/DayContent';
export * from './components/Dropdown';
export * from './components/Footer';
export * from './components/Head';
export * from './components/HeadRow';
export * from './components/IconDropdown';
export * from './components/IconRight';
export * from './components/IconLeft';
export * from './components/Row';
export * from './components/WeekNumber';
export * from './hooks/useInput';
export * from './hooks/useDayRender';
export * from './hooks/useActiveModifiers';
export * from './contexts/DayPicker';
export * from './contexts/Focus';
export * from './contexts/Navigation';
export * from './contexts/RootProvider';
export * from './contexts/SelectMultiple';
export * from './contexts/SelectRange';
export * from './contexts/SelectSingle';
export * from './types/DayPickerBase';
export * from './types/DayPickerDefault';
export * from './types/DayPickerMultiple';
export * from './types/DayPickerRange';
export * from './types/DayPickerSingle';
export * from './types/EventHandlers';
export * from './types/Formatters';
export * from './types/Labels';
export * from './types/Matchers';
export * from './types/Modifiers';
export * from './types/Styles';
export * from './contexts/Modifiers/utils/isMatch';
export * from './contexts/SelectRange/utils/addToRange';
/// <reference types="react" />
import { Locale } from "date-fns";
import React from "react";
import { ReactNode, HTMLProps } from "react";
/** Represent the props of the {@link Caption} component. */
interface CaptionProps {
/** The ID for the heading element. Must be the same as the labelled-by in Table. */
id?: string;
/** The month where the caption is displayed. */
displayMonth: Date;
}
/**
* The layout of the caption:
*
* - `dropdown`: display dropdowns for choosing the month and the year.
* - `buttons`: display previous month / next month buttons.
*/
type CaptionLayout = "dropdown" | "buttons";
/**
* Render the caption of a month. The caption has a different layout when
* setting the {@link DayPickerBase.captionLayout} prop.
*/
declare function Caption(props: CaptionProps): JSX.Element;
/** The props for the {@link CaptionLabel} component. */
interface CaptionLabelProps {
/** The ID for the heading element. Must be the same as the labelled-by in Table. */
id?: string;
/** The month where the caption is displayed. */
displayMonth: Date;
}
/** Render the caption for the displayed month. This component is used when `captionLayout="buttons"`. */
declare function CaptionLabel(props: CaptionLabelProps): JSX.Element;
/** Represent the props used by the {@link Day} component. */
interface DayProps {
/** The month where the date is displayed. */
displayMonth: Date;
/** The date to render. */
date: Date;
}
/**
* The content of a day cell – as a button or span element according to its
* modifiers.
*/
declare function Day(props: DayProps): JSX.Element;
/**
* A value or a function that matches a specific day.
*
*
* Matchers are passed to DayPicker via {@link DayPickerBase.disabled},
* {@link DayPickerBase.hidden]] or [[DayPickerProps.selected} and are used to
* determine if a day should get a {@link Modifier}.
*
* Matchers can be of different types:
*
* ```
* // will always match the day
* const booleanMatcher: Matcher = true;
*
* // will match the today's date
* const dateMatcher: Matcher = new Date();
*
* // will match the days in the array
* const arrayMatcher: Matcher = [new Date(2019, 1, 2);, new Date(2019, 1, 4)];
*
* // will match days after the 2nd of February 2019
* const afterMatcher: DateAfter = { after: new Date(2019, 1, 2); };
* // will match days before the 2nd of February 2019 }
* const beforeMatcher: DateBefore = { before: : new Date(2019, 1, 2); };
*
* // will match Sundays
* const dayOfWeekMatcher: DayOfWeek = {
* dayOfWeek: 0
* };
*
* // will match the included days, except the two dates
* const intervalMatcher: DateInterval = {
* after: new Date(2019, 1, 2);,
* before: new Date(2019, 1, 5)
* };
*
* // will match the included days, including the two dates
* const rangeMatcher: DateRange = {
* from: new Date(2019, 1, 2);,
* to: new Date(2019, 1, 5)
* };
*
* // will match when the function return true
* const functionMatcher: Matcher = (day: Date) => {
* return day.getMonth() === 2 // match when month is March
* };
* ```
*
* @see {@link isMatch}
*
* */
type Matcher = boolean | ((date: Date) => boolean) | Date | Date[] | DateRange | DateBefore | DateAfter | DateInterval | DayOfWeek;
/** A matcher to match a day falling after the specified date, with the date not included. */
type DateAfter = {
after: Date;
};
/** A matcher to match a day falling before the specified date, with the date not included. */
type DateBefore = {
before: Date;
};
/** A matcher to match a day falling before and after two dates, where the dates are not included. */
type DateInterval = {
before: Date;
after: Date;
};
/** A matcher to match a range of dates. The range can be open. Differently from {@link DateInterval}, the dates here are included. */
type DateRange = {
from: Date | undefined;
to?: Date | undefined;
};
/** A matcher to match a date being one of the specified days of the week (`0-7`, where `0` is Sunday). */
type DayOfWeek = {
dayOfWeek: number[];
};
/** Returns true if `matcher` is of type {@link DateInterval}. */
declare function isDateInterval(matcher: unknown): matcher is DateInterval;
/** Returns true if `value` is a {@link DateRange} type. */
declare function isDateRange(value: unknown): value is DateRange;
/** Returns true if `value` is of type {@link DateAfter}. */
declare function isDateAfterType(value: unknown): value is DateAfter;
/** Returns true if `value` is of type {@link DateBefore}. */
declare function isDateBeforeType(value: unknown): value is DateBefore;
/** Returns true if `value` is a {@link DayOfWeek} type. */
declare function isDayOfWeekType(value: unknown): value is DayOfWeek;
/** A _modifier_ represents different styles or states of a day displayed in the calendar. */
type Modifier = string;
/** The modifiers used by DayPicker. */
type Modifiers = CustomModifiers & InternalModifiers;
/** The name of the modifiers that are used internally by DayPicker. */
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. */
type InternalModifiers = Record<InternalModifier, Matcher[]>;
/**
* The modifiers that are matching a day in the calendar. Use the {@link useActiveModifiers} hook to get the modifiers for a day.
*
* ```
* const activeModifiers: ActiveModifiers = {
* selected: true,
* customModifier: true
* }
* ```
*
* */
type ActiveModifiers = Record<Modifier, true> & Partial<Record<InternalModifier, true>>;
/** The style to apply to each day element matching a modifier. */
type ModifiersStyles = Record<Modifier, React.CSSProperties> & Partial<Record<InternalModifier, React.CSSProperties>>;
/** The classnames to assign to each day element matching a modifier. */
type ModifiersClassNames = Record<Modifier, string> & Partial<Record<InternalModifier, string>>;
/** The custom modifiers passed to the {@link DayPickerBase.modifiers}. */
type DayModifiers = Record<Modifier, Matcher | Matcher[]>;
/**
* A map of matchers used as custom modifiers by DayPicker component. This is
* the same as {@link DayModifiers]], but it accepts only array of [[Matcher}s.
*/
type CustomModifiers = Record<Modifier, Matcher[]>;
/** Represent the props for the {@link DayContent} component. */
interface DayContentProps {
/** The date representing the day. */
date: Date;
/** The month where the day is displayed. */
displayMonth: Date;
/** The active modifiers for the given date. */
activeModifiers: ActiveModifiers;
}
/** Render the content of the day cell. */
declare function DayContent(props: DayContentProps): JSX.Element;
/** The props for the {@link Dropdown} component. */
interface DropdownProps {
/** The name attribute of the element. */
name?: string;
/** The caption displayed to replace the hidden select. */
caption?: React.ReactNode;
children?: React.SelectHTMLAttributes<HTMLSelectElement>["children"];
className?: string;
["aria-label"]?: string;
style?: React.CSSProperties;
/** The selected value. */
value?: string | number;
onChange?: React.ChangeEventHandler<HTMLSelectElement>;
}
/**
* Render a styled select component – displaying a caption and a custom
* drop-down icon.
*/
declare function Dropdown(props: DropdownProps): JSX.Element;
/**
* The props for the {@link Row} component.
*/
interface RowProps {
/** The month where the row is displayed. */
displayMonth: Date;
/** The number of the week to render. */
weekNumber: number;
/** The days contained in the week. */
dates: Date[];
}
/** Render a row in the calendar, with the days and the week number. */
declare function Row(props: RowProps): JSX.Element;
/**
* The props for the {@link WeekNumber} component.
*/
interface WeekNumberProps {
/** The number of the week. */
number: number;
/** The dates in the week. */
dates: Date[];
}
/**
* Render the week number element. If `onWeekNumberClick` is passed to DayPicker, it
* renders a button, otherwise a span element.
*/
declare function WeekNumber(props: WeekNumberProps): JSX.Element;
/** The event handler when a day is clicked. */
type DayClickEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.MouseEvent) => void;
/** The event handler when a day is focused. */
type DayFocusEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.FocusEvent | React.KeyboardEvent) => void;
/** The event handler when a day gets a keyboard event. */
type DayKeyboardEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.KeyboardEvent) => void;
/** The event handler when a day gets a mouse event. */
type DayMouseEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.MouseEvent) => void;
/** The event handler when a month is changed in the calendar. */
type MonthChangeEventHandler = (month: Date) => void;
/** The event handler when selecting multiple days. */
type SelectMultipleEventHandler = (/** The selected days */
days: Date[] | undefined, /** The day that was clicked triggering the event. */
selectedDay: Date, /** The day that was clicked */
activeModifiers: ActiveModifiers, /** The mouse event that triggered this event. */
e: React.MouseEvent) => void;
/** The event handler when selecting a range of days. */
type SelectRangeEventHandler = (/** The current range of the selected days. */
range: DateRange | undefined, /** The day that was selected (or clicked) triggering the event. */
selectedDay: Date, /** The modifiers of the selected day. */
activeModifiers: ActiveModifiers, e: React.MouseEvent) => void;
/** The event handler when selecting a single day. */
type SelectSingleEventHandler = (/** The selected day, `undefined` when `required={false}` (default) and the day is clicked again. */
day: Date | undefined, /** The day that was selected (or clicked) triggering the event. */
selectedDay: Date, /** The modifiers of the selected day. */
activeModifiers: ActiveModifiers, e: React.MouseEvent) => void;
/**The event handler when the week number is clicked. */
type WeekNumberClickEventHandler = (/** The week number that has been clicked. */
weekNumber: number, /** The dates in the clicked week. */
dates: Date[], /** The mouse event that triggered this event. */
e: React.MouseEvent) => void;
/** The event handler when a day gets a touch event. */
type DayTouchEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: React.TouchEvent) => void;
/** Represents a function to format a date. */
type DateFormatter = (date: Date, options?: {
locale?: Locale;
}) => React.ReactNode;
/** Represent a map of formatters used to render localized content. */
type Formatters = {
/** Format the month in the caption when `captionLayout` is `buttons`. */
formatCaption: DateFormatter;
/** Format the month in the navigation dropdown. */
formatMonthCaption: DateFormatter;
/** Format the year in the navigation dropdown. */
formatYearCaption: DateFormatter;
/** Format the day in the day cell. */
formatDay: DateFormatter;
/** Format the week number. */
formatWeekNumber: WeekNumberFormatter;
/** Format the week day name in the header */
formatWeekdayName: DateFormatter;
};
/** Represent a function to format the week number. */
type WeekNumberFormatter = (weekNumber: number, options?: {
locale?: Locale;
}) => React.ReactNode;
/** Map of functions to translate ARIA labels for the relative elements. */
type Labels = {
labelMonthDropdown: () => string;
labelYearDropdown: () => string;
labelNext: NavButtonLabel;
labelPrevious: NavButtonLabel;
labelDay: DayLabel;
labelWeekday: WeekdayLabel;
labelWeekNumber: WeekNumberLabel;
};
/** Return the ARIA label for the {@link Day} component. */
type DayLabel = (day: Date, activeModifiers: ActiveModifiers, options?: {
locale?: Locale;
}) => string;
/** Return the ARIA label for the "next month" / "prev month" buttons in the navigation.*/
type NavButtonLabel = (month?: Date, options?: {
locale?: Locale;
}) => string;
/** Return the ARIA label for the Head component.*/
type WeekdayLabel = (day: Date, options?: {
locale?: Locale;
}) => string;
/** Return the ARIA label of the week number.*/
type WeekNumberLabel = (n: number, options?: {
locale?: Locale;
}) => string;
/** The style (either via class names or via in-line styles) of an element. */
type StyledElement<T> = {
/** The root element. */
readonly root: T;
/** The root element when `numberOfMonths > 1`. */
readonly multiple_months: T;
/** The root element when `showWeekNumber={true}`. */
readonly with_weeknumber: T;
/** The style of an element visually hidden. */
readonly vhidden: T;
/** The style for resetting the buttons. */
readonly button_reset: T;
/** The buttons. */
readonly button: T;
/** The caption (showing the calendar heading and the navigation) */
readonly caption: T;
/** The caption when at the start of a series of months. */
readonly caption_start: T;
/** The caption when at the end of a series of months. */
readonly caption_end: T;
/** The caption when between two months (when `multipleMonths > 2`). */
readonly caption_between: T;
/** The caption label. */
readonly caption_label: T;
/** The drop-downs container. */
readonly caption_dropdowns: T;
/** The drop-down (select) element. */
readonly dropdown: T;
/** The drop-down to change the month. */
readonly dropdown_month: T;
/** The drop-down to change the year. */
readonly dropdown_year: T;
/** The drop-down icon. */
readonly dropdown_icon: T;
/** The months wrapper. */
readonly months: T;
/** The table wrapper. */
readonly month: T;
/** Table containing the monthly calendar. */
readonly table: T;
/** The table body. */
readonly tbody: T;
/** The table footer. */
readonly tfoot: T;
/** The table’s head. */
readonly head: T;
/** The row in the head. */
readonly head_row: T;
/** The head cell. */
readonly head_cell: T;
/** The navigation container. */
readonly nav: T;
/** The navigation button. */
readonly nav_button: T;
/** The "previous month" navigation button. */
readonly nav_button_previous: T;
/** The "next month" navigation button. */
readonly nav_button_next: T;
/** The icon for the navigation button. */
readonly nav_icon: T;
/** The table’s row. */
readonly row: T;
/** The weeknumber displayed in the column. */
readonly weeknumber: T;
/** The table cell containing the day element. */
readonly cell: T;
/** The day element: it is a `span` when not interactive, a `button` otherwise. */
readonly day: T;
/** The day when outside the month. */
readonly day_outside: T;
/** The day when selected. */
readonly day_selected: T;
/** The day when disabled. */
readonly day_disabled: T;
/** The day when hidden. */
readonly day_hidden: T;
/** The day when at the start of a selected range. */
readonly day_range_start: T;
/** The day when at the end of a selected range. */
readonly day_range_end: T;
/** The day in the middle of a selected range: it does not include the "from" and the "to" days. */
readonly day_range_middle: T;
/** The day when today. */
readonly day_today: T;
};
/** These elements must not be in the `styles` or `classNames` records as they are styled via the `modifiersStyles` or `modifiersClassNames` pop */
type InternalModifiersElement = "day_outside" | "day_selected" | "day_disabled" | "day_hidden" | "day_range_start" | "day_range_end" | "day_range_middle" | "day_today";
/** The class names of each element. */
type ClassNames = Partial<StyledElement<string>>;
/**
* The inline-styles of each styled element, to use with the `styles` prop. Day
* modifiers, such as `today` or `hidden`, should be styled using the
* `modifiersStyles` prop.
*/
type Styles = Partial<Omit<StyledElement<React.CSSProperties>, InternalModifiersElement>>;
/** Props of a component that can be styled via classNames or inline-styles. */
type StyledComponent = {
className?: string;
style?: React.CSSProperties;
children?: React.ReactNode;
};
/**
* Selection modes supported by DayPicker.
*
* - `single`: use DayPicker to select single days.
* - `multiple`: allow selecting multiple days.
* - `range`: use DayPicker to select a range of days
* - `default`: disable the built-in selection behavior. Customize what is selected by using {@link DayPickerBase.onDayClick}.
*/
type DaySelectionMode = "single" | "multiple" | "range" | "default";
/**
* The base props for the {@link DayPicker} component and the {@link DayPickerContext}.
*/
interface DayPickerBase {
/** The CSS class to add to the container element. To change the name of the class instead, use `classNames.root`. */
className?: string;
/**
* Change the class names of the HTML elements.
*
* Use this prop when you need to change the default class names — for example
* when using CSS modules.
*/
classNames?: ClassNames;
/**
* Change the class name for the day matching the {@link modifiers}.
*/
modifiersClassNames?: ModifiersClassNames;
/**
* Style to apply to the container element.
*/
style?: React.CSSProperties;
/**
* Change the inline styles for each UIElement.
*/
styles?: Styles;
/**
* Change the inline style for the day matching the {@link modifiers}.
*/
modifiersStyles?: ModifiersStyles;
/**
* An unique id to replace the random generated id, used by DayPicker for accessibility.
*/
id?: string;
/**
* The initial month to show in the calendar. Default is the current month.
*
* Use this prop to let DayPicker control the current month. If you need to set the month programmatically, use {@link month]] and [[onMonthChange}.
*/
defaultMonth?: Date;
/**
* The month displayed in the calendar.
*
* As opposed to {@link DayPickerBase.defaultMonth}, use this prop with {@link DayPickerBase.onMonthChange} to
* change the month programmatically.
*/
month?: Date;
/**
* Event fired when the user navigates between months.
*/
onMonthChange?: MonthChangeEventHandler;
/**
* The number of displayed months. Defaults to `1`.
*/
numberOfMonths?: number;
/**
* The earliest day to start the month navigation.
*/
fromDate?: Date;
/**
* The latest day to end the month navigation.
*/
toDate?: Date;
/**
* The earliest month to start the month navigation.
*/
fromMonth?: Date;
/**
* The latest month to end the month navigation.
*/
toMonth?: Date;
/**
* The earliest year to start the month navigation.
*/
fromYear?: number;
/**
* The latest year to end the month navigation.
*/
toYear?: number;
/**
* Disable the navigation between months.
*/
disableNavigation?: boolean;
/**
* Paginate the month navigation displaying the {@link numberOfMonths} at time.
*/
pagedNavigation?: boolean;
/**
* Render the months in reversed order (when {@link numberOfMonths} is greater
* than `1`) to display the most recent month first.
*/
reverseMonths?: boolean;
/**
* Change the layout of the caption:
*
* - `buttons` (default): display prev/right buttons
* - `dropdown`: display drop-downs to change the month and the year
*
* **Note:** the `dropdown` layout is available only when `fromDate`,
* `fromMonth` or`fromYear` and `toDate`, `toMonth` or `toYear` are set.
*
*/
captionLayout?: CaptionLayout;
/**
* Display six weeks per months, regardless the month’s number of weeks.
* To use this prop, {@link showOutsideDays} must be set. Default to `false`.
*/
fixedWeeks?: boolean;
/**
* Hide the month’s head displaying the weekday names.
*/
hideHead?: boolean;
/**
* Show the outside days. An outside day is a day falling in the next or the
* previous month. Default is `false`.
*/
showOutsideDays?: boolean;
/**
* Show the week numbers column. Weeks are numbered according to the local
* week index. To use ISO week numbering, use the {@link ISOWeek} prop.
*
* @defaultValue false
*/
showWeekNumber?: boolean;
/**
* The index of the first day of the week (0 - Sunday). Overrides the locale's one.
*/
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
/**
* The day of January, which is always in the first week of the year. See also
* https://date-fns.org/docs/getWeek and
* https://en.wikipedia.org/wiki/Week#Numbering
*/
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
/**
* Use ISO week dates instead of the locale setting. See also
* https://en.wikipedia.org/wiki/ISO_week_date.
*
* Setting this prop will ignore {@link weekStartsOn} and {@link firstWeekContainsDate}.
*/
ISOWeek?: boolean;
/**
* Map of components used to create the layout. Look at the [components source](https://github.com/gpbl/react-day-picker/tree/master/packages/react-day-picker/src/components) to understand how internal components are built.
*/
components?: CustomComponents;
/** Content to add to the `tfoot` element. */
footer?: React.ReactNode;
/**
* When a selection mode is set, DayPicker will focus the first selected day
* (if set) or the today's date (if not disabled).
*
* Use this prop when you need to focus DayPicker after a user actions, for
* improved accessibility.
*/
initialFocus?: boolean;
/**
* Apply the `disabled` modifier to the matching days.
*/
disabled?: Matcher | Matcher[] | undefined;
/**
* Apply the `hidden` modifier to the matching days. Will hide them from the
* calendar.
*/
hidden?: Matcher | Matcher[] | undefined;
/** Apply the `selected` modifier to the matching days. */
selected?: Matcher | Matcher[] | undefined;
/**
* The today’s date. Default is the current date. This Date will get the
* `today` modifier to style the day.
*/
today?: Date;
/**
* Add modifiers to the matching days.
*/
modifiers?: DayModifiers;
/** The date-fns locale object used to localize dates. Defaults to* `en-US`. */
locale?: Locale;
/**
* Labels creators to override the defaults. Use this prop to customize the
* ARIA labels attributes.
*/
labels?: Partial<Labels>;
/**
* The text direction of the calendar. Use `ltr` for left-to-right (default)
* or `rtl` for right-to-left.
*/
dir?: string;
/**
* A map of formatters. Use the formatters to override the default formatting
* functions.
*/
formatters?: Partial<Formatters>;
onDayClick?: DayClickEventHandler;
onDayFocus?: DayFocusEventHandler;
onDayBlur?: DayFocusEventHandler;
onDayMouseEnter?: DayMouseEventHandler;
onDayMouseLeave?: DayMouseEventHandler;
onDayKeyDown?: DayKeyboardEventHandler;
onDayKeyUp?: DayKeyboardEventHandler;
onDayKeyPress?: DayKeyboardEventHandler;
onDayTouchCancel?: DayTouchEventHandler;
onDayTouchEnd?: DayTouchEventHandler;
onDayTouchMove?: DayTouchEventHandler;
onDayTouchStart?: DayTouchEventHandler;
onNextClick?: MonthChangeEventHandler;
onPrevClick?: MonthChangeEventHandler;
onWeekNumberClick?: WeekNumberClickEventHandler;
}
/**
* Map of the components that can be changed using the `components` prop.
*
* Look at the [components
* source](https://github.com/gpbl/react-day-picker/tree/master/packages/react-day-picker/src/components)
* to understand how internal components are built.
*/
interface CustomComponents {
/** The component for the caption element. */
Caption?: (props: CaptionProps) => JSX.Element | null;
/** The component for the caption element. */
CaptionLabel?: (props: CaptionLabelProps) => JSX.Element | null;
/**
* The component for the day element.
*
* Each `Day` in DayPicker should render one of the following, according to
* the return value of {@link useDayRender}.
*
* - an empty `React.Fragment`, to render if `isHidden` is true
* - a `button` element, when the day is interactive, e.g. is selectable
* - a `div` or a `span` element, when the day is not interactive
*
*/
Day?: (props: DayProps) => JSX.Element | null;
/** The component for the content of the day element. */
DayContent?: (props: DayContentProps) => JSX.Element | null;
/** The component for the drop-down elements. */
Dropdown?: (props: DropdownProps) => JSX.Element | null;
/** The component for the table footer. */
Footer?: () => JSX.Element | null;
/** The component for the table’s head. */
Head?: () => JSX.Element | null;
/** The component for the table’s head row. */
HeadRow?: () => JSX.Element | null;
/** The component for the small icon in the drop-downs. */
IconDropdown?: (props: StyledComponent) => JSX.Element | null;
/** The arrow right icon (used for the Navigation buttons). */
IconRight?: (props: StyledComponent) => JSX.Element | null;
/** The arrow left icon (used for the Navigation buttons). */
IconLeft?: (props: StyledComponent) => JSX.Element | null;
/** The component for the table rows. */
Row?: (props: RowProps) => JSX.Element | null;
/** The component for the week number in the table rows. */
WeekNumber?: (props: WeekNumberProps) => JSX.Element | null;
}
/**
* All the components in use by DayPicker that can be customized via the {@link components} prop.
*/
type Components = Required<CustomComponents>;
/** The props for the {@link DayPicker} component when using `mode="default"` or `undefined`. */
interface DayPickerDefaultProps extends DayPickerBase {
mode?: DaySelectionMode;
}
/** Returns true when the props are of type {@link DayPickerDefaultProps}. */
declare function isDayPickerDefault(props: DayPickerProps): props is DayPickerDefaultProps;
/** The props for the {@link DayPicker} component when using `mode="range"`. */
interface DayPickerRangeProps extends DayPickerBase {
mode: "range";
/** The selected range of days. */
selected?: DateRange | undefined;
/** Event fired when a range (or a part of the range) is selected. */
onSelect?: SelectRangeEventHandler;
/** The minimum amount of days that can be selected. */
min?: number;
/** The maximum amount of days that can be selected. */
max?: number;
}
/** Returns true when the props are of type {@link DayPickerRangeProps}. */
declare function isDayPickerRange(props: DayPickerProps | DayPickerContextValue): props is DayPickerRangeProps;
/** The props for the {@link DayPicker} component when using `mode="single"`. */
interface DayPickerSingleProps extends DayPickerBase {
mode: "single";
/** The selected day. */
selected?: Date | undefined;
/** Event fired when a day is selected. */
onSelect?: SelectSingleEventHandler;
/** Make the selection required. */
required?: boolean;
}
/** Returns true when the props are of type {@link DayPickerSingleProps}. */
declare function isDayPickerSingle(props: DayPickerProps | DayPickerContextValue): props is DayPickerSingleProps;
/**
* The value of the {@link DayPickerContext} extends the props from DayPicker
* with default and cleaned up values.
*/
interface DayPickerContextValue extends DayPickerBase {
mode: DaySelectionMode;
onSelect?: DayPickerSingleProps["onSelect"] | DayPickerMultipleProps["onSelect"] | DayPickerRangeProps["onSelect"];
required?: boolean;
min?: number;
max?: number;
selected?: Matcher | Matcher[];
captionLayout: CaptionLayout;
components: Components;
classNames: Required<ClassNames>;
formatters: Formatters;
labels: Labels;
locale: Locale;
modifiersClassNames: ModifiersClassNames;
modifiers: DayModifiers;
numberOfMonths: number;
styles: Styles;
today: Date;
}
/**
* The DayPicker context shares the props passed to DayPicker within internal
* and custom components. It is used to set the default values and perform
* one-time calculations required to render the days.
*
* Access to this context from the {@link useDayPicker} hook.
*/
declare const DayPickerContext: React.Context<DayPickerContextValue | undefined>;
/** The props for the {@link DayPickerProvider}. */
interface DayPickerProviderProps {
/** The initial props from the DayPicker component. */
initialProps: DayPickerProps;
children?: ReactNode;
}
/**
* The provider for the {@link DayPickerContext}, assigning the defaults from the
* initial DayPicker props.
*/
declare function DayPickerProvider(props: DayPickerProviderProps): JSX.Element;
/**
* Hook to access the {@link DayPickerContextValue}.
*
* Use the DayPicker context to access to the props passed to DayPicker inside
* internal or custom components.
*/
declare function useDayPicker(): DayPickerContextValue;
/** The props for the {@link DayPicker} component when using `mode="multiple"`. */
interface DayPickerMultipleProps extends DayPickerBase {
mode: "multiple";
/** The selected days. */
selected?: Date[] | undefined;
/** Event fired when a days added or removed to the selection. */
onSelect?: SelectMultipleEventHandler;
/** The minimum amount of days that can be selected. */
min?: number;
/** The maximum amount of days that can be selected. */
max?: number;
}
/** Returns true when the props are of type {@link DayPickerMultipleProps}. */
declare function isDayPickerMultiple(props: DayPickerProps | DayPickerContextValue): props is DayPickerMultipleProps;
type DayPickerProps = DayPickerDefaultProps | DayPickerSingleProps | DayPickerMultipleProps | DayPickerRangeProps;
/**
* DayPicker render a date picker component to let users pick dates from a
* calendar. See http://react-day-picker.js.org for updated documentation and
* examples.
*
* ### Customization
*
* DayPicker offers different customization props. For example,
*
* - show multiple months using `numberOfMonths`
* - display a dropdown to navigate the months via `captionLayout`
* - display the week numbers with `showWeekNumbers`
* - disable or hide days with `disabled` or `hidden`
*
* ### Controlling the months
*
* Change the initially displayed month using the `defaultMonth` prop. The
* displayed months are controlled by DayPicker and stored in its internal
* state. To control the months yourself, use `month` instead of `defaultMonth`
* and use the `onMonthChange` event to set it.
*
* To limit the months the user can navigate to, use
* `fromDate`/`fromMonth`/`fromYear` or `toDate`/`toMonth`/`toYear`.
*
* ### Selection modes
*
* DayPicker supports different selection mode that can be toggled using the
* `mode` prop:
*
* - `mode="single"`: only one day can be selected. Use `required` to make the
* selection required. Use the `onSelect` event handler to get the selected
* days.
* - `mode="multiple"`: users can select one or more days. Limit the amount of
* days that can be selected with the `min` or the `max` props.
* - `mode="range"`: users can select a range of days. Limit the amount of days
* in the range with the `min` or the `max` props.
* - `mode="default"` (default): the built-in selections are disabled. Implement
* your own selection mode with `onDayClick`.
*
* The selection modes should cover the most common use cases. In case you
* need a more refined way of selecting days, use `mode="default"`. Use the
* `selected` props and add the day event handlers to add/remove days from the
* selection.
*
* ### Modifiers
*
* A _modifier_ represents different styles or states for the days displayed in
* the calendar (like "selected" or "disabled"). Define custom modifiers using
* the `modifiers` prop.
*
* ### Formatters and custom component
*
* You can customize how the content is displayed in the date picker by using
* either the formatters or replacing the internal components.
*
* For the most common cases you want to use the `formatters` prop to change how
* the content is formatted in the calendar. Use the `components` prop to
* replace the internal components, like the navigation icons.
*
* ### Styling
*
* DayPicker comes with a default, basic style in `react-day-picker/style` – use
* it as template for your own style.
*
* If you are using CSS modules, pass the imported styles object the
* `classNames` props.
*
* You can also style the elements via inline-styles using the `styles` prop.
*
* ### Form fields
*
* If you need to bind the date picker to a form field, you can use the
* `useInput` hooks for a basic behavior. See the `useInput` source as an
* example to bind the date picker with form fields.
*
* ### Localization
*
* To localize DayPicker, import the locale from `date-fns` package and use the
* `locale` prop.
*
* For example, to use Spanish locale:
*
* ```
* import es from 'date-fns/locale/es';
* <DayPicker locale={es} />
* ```
*/
declare function DayPicker(props: DayPickerDefaultProps | DayPickerSingleProps | DayPickerMultipleProps | DayPickerRangeProps): JSX.Element;
/** The props for the {@link Button} component. */
type ButtonProps = React.HTMLProps<HTMLButtonElement>;
/**
* Render a button HTML element applying the reset class name.
*/
declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "multiple" | "default" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "children" | "className" | "id" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<HTMLButtonElement>>;
/**
* Render a caption with the dropdowns to navigate between months and years.
*/
declare function CaptionDropdowns(props: CaptionProps): JSX.Element;
/**
* Render a caption with a button-based navigation.
*/
declare function CaptionNavigation(props: CaptionProps): JSX.Element;
/** Render the Footer component (empty as default).*/
declare function Footer(): JSX.Element;
/** Render the table head. */
declare function Head(): JSX.Element;
/**
* Render the HeadRow component - i.e. the table head row with the weekday names.
*/
declare function HeadRow(): JSX.Element;
/**
* Render the icon in the styled drop-down.
*/
declare function IconDropdown(props: StyledComponent): JSX.Element;
/**
* Render the "next month" button in the navigation.
*/
declare function IconRight(props: StyledComponent): JSX.Element;
/**
* Render the "previous month" button in the navigation.
*/
declare function IconLeft(props: StyledComponent): JSX.Element;
/** The props to attach to the input field when using {@link useInput}. */
type InputHTMLAttributes = Pick<React.InputHTMLAttributes<HTMLInputElement>, "onBlur" | "onChange" | "onFocus" | "value" | "placeholder">;
/** The props to attach to the DayPicker component when using {@link useInput}. */
type InputDayPickerProps = Pick<DayPickerSingleProps, "fromDate" | "toDate" | "locale" | "month" | "onDayClick" | "onMonthChange" | "selected" | "today">;
interface UseInputOptions extends Pick<DayPickerBase, "locale" | "fromDate" | "toDate" | "fromMonth" | "toMonth" | "fromYear" | "toYear" | "today"> {
/** The initially selected date */
defaultSelected?: Date;
/** The format string for formatting the input field. See https://date-fns.org/docs/format for a list of format strings. Default to `PP`. */
format?: string;
/** Make the selection required. */
required?: boolean;
}
/** Represent the value returned by {@link useInput}. */
interface UseInputValue {
/** The props to pass to a DayPicker component. */
dayPickerProps: InputDayPickerProps;
/** The props to pass to an input field. */
inputProps: InputHTMLAttributes;
/** A function to reset to the initial state. */
reset: () => void;
/** A function to set the selected day. */
setSelected: (day: Date | undefined) => void;
}
/** Return props and setters for binding an input field to DayPicker. */
declare function useInput(options?: UseInputOptions): UseInputValue;
type EventName = "onClick" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "onMouseEnter" | "onMouseLeave" | "onTouchCancel" | "onTouchEnd" | "onTouchMove" | "onTouchStart";
type DayEventHandlers = Pick<HTMLProps<HTMLButtonElement>, EventName>;
type SelectedDays = Date | Date[] | DateRange | undefined;
type DayRender = {
/** Whether the day should be rendered a `button` instead of a `div` */
isButton: boolean;
/** Whether the day should be hidden. */
isHidden: boolean;
/** The modifiers active for the given day. */
activeModifiers: ActiveModifiers;
/** The props to apply to the button element (when `isButton` is true). */
buttonProps: StyledComponent & Pick<ButtonProps, "disabled" | "aria-pressed" | "tabIndex"> & DayEventHandlers;
/** The props to apply to the div element (when `isButton` is false). */
divProps: StyledComponent;
selectedDays: SelectedDays;
};
/**
* Return props and data used to render the {@link Day} component.
*
* Use this hook when creating a component to replace the built-in `Day`
* component.
*/
declare function useDayRender(/** The date to render. */
day: Date, /** The month where the date is displayed (if not the same as `date`, it means it is an "outside" day). */
displayMonth: Date, /** A ref to the button element that will be target of focus when rendered (if required). */
buttonRef: React.RefObject<HTMLButtonElement>): DayRender;
/**
* Return the active modifiers for the specified day.
*
* This hook is meant to be used inside internal or custom components.
*
* @param day
* @param displayMonth
*/
declare function useActiveModifiers(day: Date, /**
* The month where the date is displayed. If not the same as `date`, the day
* is an "outside day".
*/
displayMonth?: Date): ActiveModifiers;
/** Represents the value of the {@link FocusContext}. */
type FocusContextValue = {
/** The day currently focused. */
focusedDay: Date | undefined;
/** Day that will be focused. */
focusTarget: Date | undefined;
/** Focus a day. */
focus: (day: Date) => void;
/** Blur the focused day. */
blur: () => void;
/** Focus the day after the focused day. */
focusDayAfter: () => void;
/** Focus the day before the focused day. */
focusDayBefore: () => void;
/** Focus the day in the week before the focused day. */
focusWeekBefore: () => void;
/** Focus the day in the week after the focused day. */
focusWeekAfter: () => void;
/* Focus the day in the month before the focused day. */
focusMonthBefore: () => void;
/* Focus the day in the month after the focused day. */
focusMonthAfter: () => void;
/* Focus the day in the year before the focused day. */
focusYearBefore: () => void;
/* Focus the day in the year after the focused day. */
focusYearAfter: () => void;
/* Focus the day at the start of the week of the focused day. */
focusStartOfWeek: () => void;
/* Focus the day at the end of the week of focused day. */
focusEndOfWeek: () => void;
};
/**
* The Focus context shares details about the focused day for the keyboard
*
* Access this context from the {@link useFocusContext} hook.
*/
declare const FocusContext: React.Context<FocusContextValue | undefined>;
/** The provider for the {@link FocusContext}. */
declare function FocusProvider(props: {
children: ReactNode;
}): JSX.Element;
/**
* Hook to access the {@link FocusContextValue}. Use this hook to handle the
* focus state of the elements.
*
* This hook is meant to be used inside internal or custom components.
*/
declare function useFocusContext(): FocusContextValue;
/** Represents the value of the {@link NavigationContext}. */
interface NavigationContextValue {
/** The month to display in the calendar. When `numberOfMonths` is greater than one, is the first of the displayed months. */
currentMonth: Date;
/** The months rendered by DayPicker. DayPicker can render multiple months via `numberOfMonths`. */
displayMonths: Date[];
/** Navigate to the specified month. */
goToMonth: (month: Date) => void;
/** Navigate to the specified date. */
goToDate: (date: Date, refDate?: Date) => void;
/** The next month to display. */
nextMonth?: Date;
/** The previous month to display. */
previousMonth?: Date;
/** Whether the given day is included in the displayed months. */
isDateDisplayed: (day: Date) => boolean;
}
/**
* The Navigation context shares details and methods to navigate the months in DayPicker.
* Access this context from the {@link useNavigation} hook.
*/
declare const NavigationContext: React.Context<NavigationContextValue | undefined>;
/** Provides the values for the {@link NavigationContext}. */
declare function NavigationProvider(props: {
children?: ReactNode;
}): JSX.Element;
/**
* Hook to access the {@link NavigationContextValue}. Use this hook to navigate
* between months or years in DayPicker.
*
* This hook is meant to be used inside internal or custom components.
*/
declare function useNavigation(): NavigationContextValue;
/** The props of {@link RootProvider}. */
type RootContext = DayPickerBase & {
children: React.ReactNode;
};
/** Provide the value for all the context providers. */
declare function RootProvider(props: RootContext): JSX.Element;
/** Represent the modifiers that are changed by the multiple selection. */
type SelectMultipleModifiers = Pick<Modifiers, InternalModifier.Disabled>;
/** Represents the value of a {@link SelectMultipleContext}. */
interface SelectMultipleContextValue {
/** The days that have been selected. */
selected: Date[] | undefined;
/** The modifiers for the corresponding selection. */
modifiers: SelectMultipleModifiers;
/** Event handler to attach to the day button to enable the multiple select. */
onDayClick?: DayClickEventHandler;
}
/**
* The SelectMultiple context shares details about the selected days when in
* multiple selection mode.
*
* Access this context from the {@link useSelectMultiple} hook.
*/
declare const SelectMultipleContext: React.Context<SelectMultipleContextValue | undefined>;
type SelectMultipleProviderProps = {
initialProps: DayPickerBase;
children: ReactNode;
};
/** Provides the values for the {@link SelectMultipleContext}. */
declare function SelectMultipleProvider(props: SelectMultipleProviderProps): JSX.Element;
type SelectMultipleProviderInternalProps = {
initialProps: DayPickerMultipleProps;
children: ReactNode;
};
declare function SelectMultipleProviderInternal({ initialProps, children }: SelectMultipleProviderInternalProps): JSX.Element;
/**
* Hook to access the {@link SelectMultipleContextValue}.
*
* This hook is meant to be used inside internal or custom components.
*/
declare function useSelectMultiple(): SelectMultipleContextValue;
/** Represent the modifiers that are changed by the range selection. */
type SelectRangeModifiers = Pick<Modifiers, InternalModifier.Disabled | InternalModifier.RangeEnd | InternalModifier.RangeMiddle | InternalModifier.RangeStart>;
/** Represents the value of a {@link SelectRangeContext}. */
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 {@link useSelectRange} hook.
*/
declare const SelectRangeContext: React.Context<SelectRangeContextValue | undefined>;
type SelectRangeProviderProps = {
initialProps: DayPickerBase;
children: ReactNode;
};
/** Provides the values for the {@link SelectRangeProvider}. */
declare function SelectRangeProvider(props: SelectRangeProviderProps): JSX.Element;
type SelectRangeProviderInternalProps = {
initialProps: DayPickerRangeProps;
children: ReactNode;
};
declare function SelectRangeProviderInternal({ initialProps, children }: SelectRangeProviderInternalProps): JSX.Element;
/**
* Hook to access the {@link SelectRangeContextValue}.
*
* This hook is meant to be used inside internal or custom components.
*/
declare function useSelectRange(): SelectRangeContextValue;
/** Represents the value of a {@link SelectSingleContext}. */
interface SelectSingleContextValue {
/** The day that has been selected. */
selected: Date | undefined;
/** Event handler to attach to the day button to enable the single select. */
onDayClick?: DayClickEventHandler;
}
/**
* The SelectSingle context shares details about the selected days when in
* single selection mode.
*
* Access this context from the {@link useSelectSingle} hook.
*/
declare const SelectSingleContext: React.Context<SelectSingleContextValue | undefined>;
type SelectSingleProviderProps = {
initialProps: DayPickerBase;
children: React.ReactNode;
};
/** Provides the values for the {@link SelectSingleProvider}. */
declare function SelectSingleProvider(props: SelectSingleProviderProps): JSX.Element;
type SelectSingleProviderInternal = {
initialProps: DayPickerSingleProps;
children: React.ReactNode;
};
declare function SelectSingleProviderInternal({ initialProps, children }: SelectSingleProviderInternal): JSX.Element;
/**
* Hook to access the {@link SelectSingleContextValue}.
*
* This hook is meant to be used inside internal or custom components.
*/
declare function useSelectSingle(): SelectSingleContextValue;
/**
* Returns whether a day matches against at least one of the given Matchers.
*
* ```
* const day = new Date(2022, 5, 19);
* const matcher1: DateRange = {
* from: new Date(2021, 12, 21),
* to: new Date(2021, 12, 30)
* }
* const matcher2: DateRange = {
* from: new Date(2022, 5, 1),
* to: new Date(2022, 5, 23)
* }
*
* const isMatch(day, [matcher1, matcher2]); // true, since day is in the matcher1 range.
* ```
* */
declare function isMatch(day: Date, matchers: Matcher[]): boolean;
/**
* Add a day to an existing range.
*
* The returned range takes in account the `undefined` values and if the added
* day is already present in the range.
*/
declare function addToRange(day: Date, range?: DateRange): DateRange | undefined;
export { DayPickerProps, DayPicker, ButtonProps, Button, CaptionProps, CaptionLayout, Caption, CaptionDropdowns, CaptionLabelProps, CaptionLabel, CaptionNavigation, DayProps, Day, DayContentProps, DayContent, DropdownProps, Dropdown, Footer, Head, HeadRow, IconDropdown, IconRight, IconLeft, RowProps, Row, WeekNumberProps, WeekNumber, InputHTMLAttributes, InputDayPickerProps, UseInputOptions, UseInputValue, useInput, DayRender, useDayRender, useActiveModifiers, DayPickerContextValue, DayPickerContext, DayPickerProviderProps, DayPickerProvider, useDayPicker, FocusContextValue, FocusContext, FocusProvider, useFocusContext, NavigationContextValue, NavigationContext, NavigationProvider, useNavigation, RootContext, RootProvider, SelectMultipleModifiers, SelectMultipleContextValue, SelectMultipleContext, SelectMultipleProviderProps, SelectMultipleProvider, SelectMultipleProviderInternal, useSelectMultiple, SelectRangeModifiers, SelectRangeContextValue, SelectRangeContext, SelectRangeProvider, SelectRangeProviderInternal, useSelectRange, SelectSingleContextValue, SelectSingleContext, SelectSingleProvider, SelectSingleProviderInternal, useSelectSingle, DaySelectionMode, DayPickerBase, CustomComponents, Components, DayPickerDefaultProps, isDayPickerDefault, DayPickerMultipleProps, isDayPickerMultiple, DayPickerRangeProps, isDayPickerRange, DayPickerSingleProps, isDayPickerSingle, DayClickEventHandler, DayFocusEventHandler, DayKeyboardEventHandler, DayMouseEventHandler, MonthChangeEventHandler, SelectMultipleEventHandler, SelectRangeEventHandler, SelectSingleEventHandler, WeekNumberClickEventHandler, DayTouchEventHandler, DateFormatter, Formatters, WeekNumberFormatter, Labels, DayLabel, NavButtonLabel, WeekdayLabel, WeekNumberLabel, Matcher, DateAfter, DateBefore, DateInterval, DateRange, DayOfWeek, isDateInterval, isDateRange, isDateAfterType, isDateBeforeType, isDayOfWeekType, Modifier, Modifiers, InternalModifier, InternalModifiers, ActiveModifiers, ModifiersStyles, ModifiersClassNames, DayModifiers, CustomModifiers, StyledElement, InternalModifiersElement, ClassNames, Styles, StyledComponent, isMatch, addToRange };

2

dist/react-day-picker.min.js

@@ -1,1 +0,1 @@

!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("date-fns/locale/en-US"),n=require("date-fns/format"),a=require("date-fns/endOfMonth"),r=require("date-fns/startOfDay"),o=require("date-fns/startOfMonth"),l=require("date-fns/isSameYear"),u=require("date-fns/setMonth"),i=require("date-fns/setYear"),d=require("date-fns/startOfYear"),s=require("date-fns/addMonths"),c=require("date-fns/isBefore"),f=require("date-fns/isSameMonth"),p=require("date-fns/differenceInCalendarMonths"),m=require("date-fns/addDays"),v=require("date-fns/startOfWeek"),y=require("date-fns/getUnixTime"),h=require("date-fns/isSameDay"),b=require("date-fns/differenceInCalendarDays"),D=require("date-fns/isAfter"),g=require("date-fns/isDate"),M=require("date-fns/addWeeks"),w=require("date-fns/addYears"),x=require("date-fns/endOfWeek"),E=require("date-fns/max"),k=require("date-fns/min"),_=require("date-fns/getWeeksInMonth"),N=require("date-fns/getWeek"),C=require("date-fns/parse");function P(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function S(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var O=P(e),L=S(e),W=P(t),T=P(n),I=P(a),B=P(r),j=P(o),F=P(l),q=P(u),R=P(i),A=P(d),Y=P(s),H=P(c),K=P(f),U=P(p),z=P(m),Z=P(v),G=P(y),J=P(h),Q=P(b),V=P(D),X=P(g),$=P(M),ee=P(w),te=P(x),ne=P(E),ae=P(k),re=P(_),oe=P(N),le=P(C),ue=function(){return ue=Object.assign||function(e){for(var t,n=1,a=arguments.length;n<a;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ue.apply(this,arguments)};function ie(e){return"multiple"===e.mode}function de(e){return"range"===e.mode}function se(e){return"single"===e.mode}var ce={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};var fe=Object.freeze({__proto__:null,formatCaption:function(e,t){return T.default(e,"LLLL y",t)},formatDay:function(e,t){return T.default(e,"d",t)},formatMonthCaption:function(e,t){return T.default(e,"LLLL",t)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,t){return T.default(e,"cccccc",t)},formatYearCaption:function(e,t){return T.default(e,"yyyy",t)}}),pe=Object.freeze({__proto__:null,labelDay:function(e,t,n){return T.default(e,"do MMMM (EEEE)",n)},labelMonthDropdown:function(){return"Month: "},labelNext:function(){return"Go to next month"},labelPrevious:function(){return"Go to previous month"},labelWeekday:function(e,t){return T.default(e,"cccc",t)},labelWeekNumber:function(e){return"Week n. ".concat(e)},labelYearDropdown:function(){return"Year: "}});function me(e){var t=e.fromYear,n=e.toYear,a=e.fromMonth,r=e.toMonth,o=e.fromDate,l=e.toDate;return a?o=j.default(a):t&&(o=new Date(t,0,1)),r?l=I.default(r):n&&(l=new Date(n,11,31)),{fromDate:o?B.default(o):void 0,toDate:l?B.default(l):void 0}}var ve=e.createContext(void 0);function ye(e){var t,n,a,r,o,l,u,i,d=e.initialProps,s=(o=ce,l=W.default,u=new Date,{captionLayout:"buttons",classNames:o,formatters:fe,labels:pe,locale:l,modifiersClassNames:{},modifiers:{},numberOfMonths:1,styles:{},today:u,mode:"default"}),c=me(d),f=c.fromDate,p=c.toDate,m=null!==(t=d.captionLayout)&&void 0!==t?t:s.captionLayout;"buttons"===m||f&&p||(m="buttons"),(se(d)||ie(d)||de(d))&&(i=d.onSelect);var v={captionLayout:m,className:d.className,classNames:ue(ue({},s.classNames),d.classNames),components:ue(ue({},s.components),d.components),defaultMonth:d.defaultMonth,dir:d.dir,disabled:d.disabled,disableNavigation:d.disableNavigation,fixedWeeks:d.fixedWeeks,footer:d.footer,formatters:ue(ue({},s.formatters),d.formatters),fromDate:f,hidden:d.hidden,hideHead:d.hideHead,initialFocus:d.initialFocus,labels:ue(ue({},s.labels),d.labels),locale:null!==(n=d.locale)&&void 0!==n?n:s.locale,mode:d.mode||"default",modifiers:ue(ue({},s.modifiers),d.modifiers),modifiersClassNames:ue(ue({},s.modifiersClassNames),d.modifiersClassNames),modifiersStyles:d.modifiersStyles,month:d.month,numberOfMonths:null!==(a=d.numberOfMonths)&&void 0!==a?a:s.numberOfMonths,onDayBlur:d.onDayBlur,onDayClick:d.onDayClick,onDayFocus:d.onDayFocus,onDayKeyDown:d.onDayKeyDown,onDayKeyPress:d.onDayKeyPress,onDayKeyUp:d.onDayKeyUp,onDayMouseEnter:d.onDayMouseEnter,onDayMouseLeave:d.onDayMouseLeave,onDayTouchCancel:d.onDayTouchCancel,onDayTouchEnd:d.onDayTouchEnd,onDayTouchMove:d.onDayTouchMove,onDayTouchStart:d.onDayTouchStart,onMonthChange:d.onMonthChange,onNextClick:d.onNextClick,onPrevClick:d.onPrevClick,onSelect:i,onWeekNumberClick:d.onWeekNumberClick,pagedNavigation:d.pagedNavigation,reverseMonths:d.reverseMonths,selected:d.selected,showOutsideDays:d.showOutsideDays,showWeekNumber:d.showWeekNumber,style:d.style,styles:ue(ue({},s.styles),d.styles),toDate:p,today:null!==(r=d.today)&&void 0!==r?r:s.today,weekStartsOn:d.weekStartsOn};return O.default.createElement(ve.Provider,{value:v},e.children)}function he(){var t=e.useContext(ve);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function be(e){var t=he(),n=t.locale,a=t.classNames,r=t.styles,o=t.formatters.formatCaption;return O.default.createElement("h2",{className:a.caption_label,style:r.caption_label,"aria-live":"polite","aria-atomic":"true",id:e.id},o(e.displayMonth,{locale:n}))}function De(e){return O.default.createElement("svg",ue({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e),O.default.createElement("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"}))}function ge(e){var t,n,a=e.onChange,r=e.value,o=e.children,l=e.caption,u=e.className,i=e.style,d=he(),s=null!==(n=null===(t=d.components)||void 0===t?void 0:t.IconDropdown)&&void 0!==n?n:De;return O.default.createElement("div",{className:u,style:i},O.default.createElement("span",{className:d.classNames.vhidden},e["aria-label"]),O.default.createElement("select",{name:e.name,"aria-label":e["aria-label"],className:d.classNames.dropdown,style:d.styles.dropdown,value:r,onChange:a},o),O.default.createElement("div",{className:d.classNames.caption_label,style:d.styles.caption_label,"aria-hidden":"true"},l,O.default.createElement(s,{className:d.classNames.dropdown_icon,style:d.styles.dropdown_icon})))}function Me(e){var t,n=he(),a=n.fromDate,r=n.toDate,o=n.styles,l=n.locale,u=n.formatters.formatMonthCaption,i=n.classNames,d=n.components,s=n.labels.labelMonthDropdown;if(!a)return O.default.createElement(O.default.Fragment,null);if(!r)return O.default.createElement(O.default.Fragment,null);var c=[];if(F.default(a,r))for(var f=j.default(a),p=a.getMonth();p<=r.getMonth();p++)c.push(q.default(f,p));else for(f=j.default(new Date),p=0;p<=11;p++)c.push(q.default(f,p));var m=null!==(t=null==d?void 0:d.Dropdown)&&void 0!==t?t:ge;return O.default.createElement(m,{name:"months","aria-label":s(),className:i.dropdown_month,style:o.dropdown_month,onChange:function(t){var n=Number(t.target.value),a=q.default(j.default(e.displayMonth),n);e.onChange(a)},value:e.displayMonth.getMonth(),caption:u(e.displayMonth,{locale:l})},c.map((function(e){return O.default.createElement("option",{key:e.getMonth(),value:e.getMonth()},u(e,{locale:l}))})))}function we(e){var t,n=e.displayMonth,a=he(),r=a.fromDate,o=a.toDate,l=a.locale,u=a.styles,i=a.classNames,d=a.components,s=a.formatters.formatYearCaption,c=a.labels.labelYearDropdown,f=[];if(!r)return O.default.createElement(O.default.Fragment,null);if(!o)return O.default.createElement(O.default.Fragment,null);for(var p=r.getFullYear(),m=o.getFullYear(),v=p;v<=m;v++)f.push(R.default(A.default(new Date),v));var y=null!==(t=null==d?void 0:d.Dropdown)&&void 0!==t?t:ge;return O.default.createElement(y,{name:"years","aria-label":c(),className:i.dropdown_year,style:u.dropdown_year,onChange:function(t){var a=R.default(j.default(n),Number(t.target.value));e.onChange(a)},value:n.getFullYear(),caption:s(n,{locale:l})},f.map((function(e){return O.default.createElement("option",{key:e.getFullYear(),value:e.getFullYear()},s(e,{locale:l}))})))}function xe(){var t=he(),n=function(e){var t=e.month,n=e.defaultMonth,a=e.today,r=t||n||a||new Date,o=e.toDate,l=e.fromDate,u=e.numberOfMonths,i=void 0===u?1:u;if(o&&U.default(o,r)<0){var d=-1*(i-1);r=Y.default(o,d)}return l&&U.default(r,l)<0&&(r=l),j.default(r)}(t),a=function(t,n){var a=e.useState(t),r=a[0];return[void 0===n?r:n,a[1]]}(n,t.month),r=a[0],o=a[1];return[r,function(e){var n;if(!t.disableNavigation){var a=j.default(e);o(a),null===(n=t.onMonthChange)||void 0===n||n.call(t,a)}}]}var Ee=e.createContext(void 0);function ke(e){var t=he(),n=xe(),a=n[0],r=n[1],o=function(e,t){for(var n=t.reverseMonths,a=t.numberOfMonths,r=j.default(e),o=j.default(Y.default(r,a)),l=U.default(o,r),u=[],i=0;i<l;i++){var d=Y.default(r,i);u.push(d)}return n&&(u=u.reverse()),u}(a,t),l=function(e,t){if(!t.disableNavigation){var n=t.toDate,a=t.pagedNavigation,r=t.numberOfMonths,o=void 0===r?1:r,l=a?o:1,u=j.default(e);if(!n)return Y.default(u,l);if(!(U.default(n,e)<o))return Y.default(u,l)}}(a,t),u=function(e,t){if(!t.disableNavigation){var n=t.fromDate,a=t.pagedNavigation,r=t.numberOfMonths,o=a?void 0===r?1:r:1,l=j.default(e);if(!n)return Y.default(l,-o);if(!(U.default(l,n)<=0))return Y.default(l,-o)}}(a,t),i=function(e){return o.some((function(t){return K.default(e,t)}))},d={currentMonth:a,displayMonths:o,goToMonth:r,goToDate:function(e,n){i(e)||(n&&H.default(e,n)?r(Y.default(e,1+-1*t.numberOfMonths)):r(e))},previousMonth:u,nextMonth:l,isDateDisplayed:i};return O.default.createElement(Ee.Provider,{value:d},e.children)}function _e(){var t=e.useContext(Ee);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function Ne(e){var t,n=he(),a=n.classNames,r=n.styles,o=n.components,l=_e().goToMonth,u=function(e){l(e)},i=null!==(t=null==o?void 0:o.CaptionLabel)&&void 0!==t?t:be,d=O.default.createElement(i,{id:e.id,displayMonth:e.displayMonth});return O.default.createElement("div",{className:a.caption_dropdowns,style:r.caption_dropdowns},O.default.createElement("div",{className:a.vhidden},d),O.default.createElement(Me,{onChange:u,displayMonth:e.displayMonth}),O.default.createElement(we,{onChange:u,displayMonth:e.displayMonth}))}function Ce(e){return O.default.createElement("svg",ue({width:"16px",height:"16px",viewBox:"0 0 120 120"},e),O.default.createElement("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"}))}function Pe(e){return O.default.createElement("svg",ue({width:"16px",height:"16px",viewBox:"0 0 120 120"},e),O.default.createElement("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"}))}var Se=e.forwardRef((function(e,t){var n=he(),a=n.classNames,r=n.styles,o=[a.button_reset,a.button];e.className&&o.push(e.className);var l=o.join(" "),u=ue(ue({},r.button_reset),r.button);return e.style&&Object.assign(u,e.style),O.default.createElement("button",ue({},e,{ref:t,type:"button",className:l,style:u}))}));function Oe(e){var t,n,a=he(),r=a.dir,o=a.locale,l=a.classNames,u=a.styles,i=a.labels,d=i.labelPrevious,s=i.labelNext,c=a.components;if(!e.nextMonth&&!e.previousMonth)return O.default.createElement(O.default.Fragment,null);var f=d(e.previousMonth,{locale:o}),p=[l.nav_button,l.nav_button_previous].join(" "),m=s(e.nextMonth,{locale:o}),v=[l.nav_button,l.nav_button_next].join(" "),y=null!==(t=null==c?void 0:c.IconRight)&&void 0!==t?t:Pe,h=null!==(n=null==c?void 0:c.IconLeft)&&void 0!==n?n:Ce;return O.default.createElement("div",{className:l.nav,style:u.nav},!e.hidePrevious&&O.default.createElement(Se,{name:"previous-month","aria-label":f,className:p,style:u.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick},"rtl"===r?O.default.createElement(y,{className:l.nav_icon,style:u.nav_icon}):O.default.createElement(h,{className:l.nav_icon,style:u.nav_icon})),!e.hideNext&&O.default.createElement(Se,{name:"next-month","aria-label":m,className:v,style:u.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick},"rtl"===r?O.default.createElement(h,{className:l.nav_icon,style:u.nav_icon}):O.default.createElement(y,{className:l.nav_icon,style:u.nav_icon})))}function Le(e){var t,n,a=he(),r=a.numberOfMonths,o=a.dir,l=a.components,u=_e(),i=u.previousMonth,d=u.nextMonth,s=u.goToMonth,c=u.displayMonths,f=c.findIndex((function(t){return K.default(e.displayMonth,t)})),p=0===f,m=f===c.length-1;"rtl"===o&&(m=(t=[p,m])[0],p=t[1]);var v=r>1&&(p||!m),y=r>1&&(m||!p),h=null!==(n=null==l?void 0:l.CaptionLabel)&&void 0!==n?n:be,b=O.default.createElement(h,{id:e.id,displayMonth:e.displayMonth});return O.default.createElement(O.default.Fragment,null,b,O.default.createElement(Oe,{displayMonth:e.displayMonth,hideNext:v,hidePrevious:y,nextMonth:d,previousMonth:i,onPreviousClick:function(){i&&s(i)},onNextClick:function(){d&&s(d)}}))}function We(e){var t,n,a=he(),r=a.classNames,o=a.disableNavigation,l=a.styles,u=a.captionLayout,i=a.components,d=null!==(t=null==i?void 0:i.CaptionLabel)&&void 0!==t?t:be;return n=o?O.default.createElement(d,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===u?O.default.createElement(Ne,{displayMonth:e.displayMonth,id:e.id}):O.default.createElement(Le,{displayMonth:e.displayMonth,id:e.id}),O.default.createElement("div",{className:r.caption,style:l.caption},n)}function Te(){var e=he(),t=e.footer,n=e.styles,a=e.classNames.tfoot;return t?O.default.createElement("tfoot",{className:a,style:n.tfoot},O.default.createElement("tr",null,O.default.createElement("td",{colSpan:8},t))):O.default.createElement(O.default.Fragment,null)}function Ie(){var e=he(),t=e.classNames,n=e.styles,a=e.showWeekNumber,r=e.locale,o=e.weekStartsOn,l=e.formatters.formatWeekdayName,u=e.labels.labelWeekday,i=function(e,t){for(var n=Z.default(new Date,{locale:e,weekStartsOn:t}),a=[],r=0;r<7;r++){var o=z.default(n,r);a.push(o)}return a}(r,o);return O.default.createElement("tr",{style:n.head_row,className:t.head_row},a&&O.default.createElement("th",{scope:"col",style:n.head_cell,className:t.head_cell}),i.map((function(e,a){return O.default.createElement("th",{key:a,scope:"col",className:t.head_cell,style:n.head_cell},O.default.createElement("span",{"aria-hidden":!0},l(e,{locale:r})),O.default.createElement("span",{className:t.vhidden},u(e,{locale:r})))})))}function Be(){var e,t=he(),n=t.classNames,a=t.styles,r=t.components,o=null!==(e=null==r?void 0:r.HeadRow)&&void 0!==e?e:Ie;return O.default.createElement("thead",{style:a.head,className:n.head},O.default.createElement(o,null))}function je(e){var t=he(),n=t.locale,a=t.formatters.formatDay;return O.default.createElement(O.default.Fragment,null,a(e.date,{locale:n}))}var Fe=e.createContext(void 0);function qe(e){if(!ie(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return O.default.createElement(Fe.Provider,{value:t},e.children)}return O.default.createElement(Re,{initialProps:e.initialProps,children:e.children})}function Re(e){var t=e.initialProps,n=e.children,a=t.selected,r=t.min,o=t.max,l={disabled:[]};a&&l.disabled.push((function(e){var t=o&&a.length>o-1,n=a.some((function(t){return J.default(t,e)}));return Boolean(t&&!n)}));var u={selected:a,onDayClick:function(e,n,l){var u,i;if((null===(u=t.onDayClick)||void 0===u||u.call(t,e,n,l),!Boolean(n.selected&&r&&(null==a?void 0:a.length)===r))&&!Boolean(!n.selected&&o&&(null==a?void 0:a.length)===o)){var d=a?function(e,t,n){if(n||2===arguments.length)for(var a,r=0,o=t.length;r<o;r++)!a&&r in t||(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}([],a,!0):[];if(n.selected){var s=d.findIndex((function(t){return J.default(e,t)}));d.splice(s,1)}else d.push(e);null===(i=t.onSelect)||void 0===i||i.call(t,d,e,n,l)}},modifiers:l};return O.default.createElement(Fe.Provider,{value:u},n)}function Ae(){var t=e.useContext(Fe);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function Ye(e,t){var n=t||{},a=n.from,r=n.to;if(!a)return{from:e,to:void 0};if(!r&&J.default(a,e))return{from:a,to:e};if(!r&&H.default(e,a))return{from:e,to:a};if(!r)return{from:a,to:e};if(!J.default(r,e)||!J.default(a,e)){if(J.default(r,e))return{from:r,to:void 0};if(!J.default(a,e))return V.default(a,e)?{from:e,to:r}:{from:a,to:e}}}var He,Ke=e.createContext(void 0);function Ue(e){if(!de(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return O.default.createElement(Ke.Provider,{value:t},e.children)}return O.default.createElement(ze,{initialProps:e.initialProps,children:e.children})}function ze(e){var t=e.initialProps,n=e.children,a=t.selected,r=a||{},o=r.from,l=r.to,u=t.min,i=t.max,d={range_start:[],range_end:[],range_middle:[],disabled:[]};return o&&(d.range_start=[o],l?(d.range_end=[l],d.range_middle=[{after:o,before:l}]):d.range_end=[o]),u&&o&&l&&d.disabled.push((function(e){return H.default(e,o)&&Q.default(o,e)<u||V.default(e,l)&&Q.default(e,o)<u})),i&&o&&l&&d.disabled.push((function(e){return H.default(e,o)&&Q.default(l,e)>=i||V.default(e,l)&&Q.default(e,o)>=i})),O.default.createElement(Ke.Provider,{value:{selected:a,onDayClick:function(e,n,r){var o,l;null===(o=t.onDayClick)||void 0===o||o.call(t,e,n,r);var d=Ye(e,a);if((u||i)&&a&&(null==d?void 0:d.to)&&d.from&&d.from!==d.to){var s=Math.abs(Q.default(null==d?void 0:d.to,null==d?void 0:d.from));if(u&&s<u||i&&s>=i)return}null===(l=t.onSelect)||void 0===l||l.call(t,d,e,n,r)},modifiers:d}},n)}function Ze(){var t=e.useContext(Ke);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function Ge(e){return Array.isArray(e)?e:void 0!==e?[e]:[]}exports.InternalModifier=void 0,(He=exports.InternalModifier||(exports.InternalModifier={})).Outside="outside",He.Disabled="disabled",He.Selected="selected",He.Hidden="hidden",He.Today="today",He.RangeStart="range_start",He.RangeEnd="range_end",He.RangeMiddle="range_middle";var Je=exports.InternalModifier.Selected,Qe=exports.InternalModifier.Disabled,Ve=exports.InternalModifier.Hidden,Xe=exports.InternalModifier.Today,$e=exports.InternalModifier.RangeEnd,et=exports.InternalModifier.RangeMiddle,tt=exports.InternalModifier.RangeStart,nt=exports.InternalModifier.Outside;var at=e.createContext(void 0);function rt(e){var t=he(),n=function(e,t,n){var a,r=((a={})[Je]=Ge(e.selected),a[Qe]=Ge(e.disabled),a[Ve]=Ge(e.hidden),a[Xe]=[e.today],a[$e]=[],a[et]=[],a[tt]=[],a[nt]=[],a);return e.fromDate&&r[Qe].push({before:e.fromDate}),e.toDate&&r[Qe].push({after:e.toDate}),ie(e)?r[Qe]=r[Qe].concat(t.modifiers[Qe]):de(e)&&(r[Qe]=r[Qe].concat(n.modifiers[Qe]),r[tt]=n.modifiers[tt],r[et]=n.modifiers[et],r[$e]=n.modifiers[$e]),r}(t,Ae(),Ze()),a=function(e){var t={};return Object.entries(e).forEach((function(e){var n=e[0],a=e[1];t[n]=Ge(a)})),t}(t.modifiers),r=ue(ue({},n),a);return O.default.createElement(at.Provider,{value:r},e.children)}function ot(){var t=e.useContext(at);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function lt(e){return Boolean(e&&"object"==typeof e&&"before"in e&&"after"in e)}function ut(e){return Boolean(e&&"object"==typeof e&&"from"in e)}function it(e){return Boolean(e&&"object"==typeof e&&"after"in e)}function dt(e){return Boolean(e&&"object"==typeof e&&"before"in e)}function st(e){return Boolean(e&&"object"==typeof e&&"dayOfWeek"in e)}function ct(e,t){return t.some((function(t){if("boolean"==typeof t)return t;if(n=t,X.default(n))return J.default(e,t);var n;if(function(e){return Array.isArray(e)&&e.every(X.default)}(t))return t.includes(e);if(ut(t))return function(e,t){var n,a=t.from,r=t.to;if(!a)return!1;if(!r&&J.default(a,e))return!0;if(!r)return!1;var o=Q.default(r,a)<0;return r&&o&&(a=(n=[r,a])[0],r=n[1]),Q.default(e,a)>=0&&Q.default(r,e)>=0}(e,t);if(st(t))return t.dayOfWeek.includes(e.getDay());if(lt(t)){var a=Q.default(t.before,e)>0,r=Q.default(e,t.after)>0;return a&&r}return it(t)?Q.default(e,t.after)>0:dt(t)?Q.default(t.before,e)>0:"function"==typeof t&&t(e)}))}function ft(e,t,n){var a=Object.keys(t).reduce((function(n,a){var r=t[a];return ct(e,r)&&n.push(a),n}),[]),r={};return a.forEach((function(e){return r[e]=!0})),n&&!K.default(e,n)&&(r.outside=!0),r}function pt(e,t,n,a,r){var o=a.weekStartsOn,l=a.fromDate,u=a.toDate,i=a.locale,d={day:z.default,week:$.default,month:Y.default,year:ee.default,startOfWeek:function(e){return Z.default(e,{locale:i,weekStartsOn:o})},endOfWeek:function(e){return te.default(e,{locale:i,weekStartsOn:o})}}[t](e,"after"===n?1:-1);if("before"===n&&l?d=ne.default([l,d]):"after"===n&&u&&(d=ae.default([u,d])),r){var s=ft(d,r);if(!(!s.disabled&&!s.hidden))return pt(d,t,n,a,r)}return d}var mt=e.createContext(void 0);function vt(t){var n=_e(),a=ot(),r=e.useState(),o=r[0],l=r[1],u=e.useState(),i=u[0],d=u[1],s=function(e,t){for(var n,a,r=j.default(e[0]),o=I.default(e[e.length-1]),l=r;l<=o;){var u=ft(l,t);if(u.disabled||u.hidden)l=z.default(l,1);else{if(u.selected)return l;u.today&&!a&&(a=l),n||(n=l),l=z.default(l,1)}}return a||n}(n.displayMonths,a),c=(null!=o?o:i&&n.isDateDisplayed(i))?i:s,f=function(e){l(e)},p=he(),m=function(e,t){if(o){var r=pt(o,e,t,p,a);J.default(o,r)||(n.goToDate(r,o),f(r))}},v={focusedDay:o,focusTarget:c,blur:function(){d(o),l(void 0)},focus:f,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return O.default.createElement(mt.Provider,{value:v},t.children)}function yt(){var t=e.useContext(mt);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function ht(e,t){return ft(e,ot(),t)}var bt=e.createContext(void 0);function Dt(e){if(!se(e.initialProps)){var t={selected:void 0};return O.default.createElement(bt.Provider,{value:t},e.children)}return O.default.createElement(gt,{initialProps:e.initialProps,children:e.children})}function gt(e){var t=e.initialProps,n=e.children,a={selected:t.selected,onDayClick:function(e,n,a){var r,o,l;null===(r=t.onDayClick)||void 0===r||r.call(t,e,n,a),!n.selected||t.required?null===(l=t.onSelect)||void 0===l||l.call(t,e,e,n,a):null===(o=t.onSelect)||void 0===o||o.call(t,void 0,e,n,a)}};return O.default.createElement(bt.Provider,{value:a},n)}function Mt(){var t=e.useContext(bt);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function wt(e,t){var n=[e.classNames.day];return Object.keys(t).forEach((function(t){var a=e.modifiersClassNames[t];if(a)n.push(a);else if(function(e){return Object.values(exports.InternalModifier).includes(e)}(t)){var r=e.classNames["day_".concat(t)];r&&n.push(r)}})),n}function xt(t,n,a){var r,o,l,u=he(),i=yt(),d=ht(t,n),s=function(e,t){var n=he(),a=Mt(),r=Ae(),o=Ze(),l=yt(),u=l.focusDayAfter,i=l.focusDayBefore,d=l.focusWeekAfter,s=l.focusWeekBefore,c=l.blur,f=l.focus,p=l.focusMonthBefore,m=l.focusMonthAfter,v=l.focusYearBefore,y=l.focusYearAfter,h=l.focusStartOfWeek,b=l.focusEndOfWeek,D={onClick:function(l){var u,i,d,s;se(n)?null===(u=a.onDayClick)||void 0===u||u.call(a,e,t,l):ie(n)?null===(i=r.onDayClick)||void 0===i||i.call(r,e,t,l):de(n)?null===(d=o.onDayClick)||void 0===d||d.call(o,e,t,l):null===(s=n.onDayClick)||void 0===s||s.call(n,e,t,l)},onFocus:function(a){var r;f(e),null===(r=n.onDayFocus)||void 0===r||r.call(n,e,t,a)},onBlur:function(a){var r;c(),null===(r=n.onDayBlur)||void 0===r||r.call(n,e,t,a)},onKeyDown:function(a){var r;switch(a.key){case"ArrowLeft":a.preventDefault(),a.stopPropagation(),"rtl"===n.dir?u():i();break;case"ArrowRight":a.preventDefault(),a.stopPropagation(),"rtl"===n.dir?i():u();break;case"ArrowDown":a.preventDefault(),a.stopPropagation(),d();break;case"ArrowUp":a.preventDefault(),a.stopPropagation(),s();break;case"PageUp":a.preventDefault(),a.stopPropagation(),a.shiftKey?v():p();break;case"PageDown":a.preventDefault(),a.stopPropagation(),a.shiftKey?y():m();break;case"Home":a.preventDefault(),a.stopPropagation(),h();break;case"End":a.preventDefault(),a.stopPropagation(),b()}null===(r=n.onDayKeyDown)||void 0===r||r.call(n,e,t,a)},onKeyUp:function(a){var r;null===(r=n.onDayKeyUp)||void 0===r||r.call(n,e,t,a)},onMouseEnter:function(a){var r;null===(r=n.onDayMouseEnter)||void 0===r||r.call(n,e,t,a)},onMouseLeave:function(a){var r;null===(r=n.onDayMouseLeave)||void 0===r||r.call(n,e,t,a)},onTouchCancel:function(a){var r;null===(r=n.onDayTouchCancel)||void 0===r||r.call(n,e,t,a)},onTouchEnd:function(a){var r;null===(r=n.onDayTouchEnd)||void 0===r||r.call(n,e,t,a)},onTouchMove:function(a){var r;null===(r=n.onDayTouchMove)||void 0===r||r.call(n,e,t,a)},onTouchStart:function(a){var r;null===(r=n.onDayTouchStart)||void 0===r||r.call(n,e,t,a)}};return D}(t,d),c=function(){var e=he(),t=Mt(),n=Ae(),a=Ze();return se(e)?t.selected:ie(e)?n.selected:de(e)?a.selected:void 0}(),f=Boolean(u.onDayClick||"default"!==u.mode);e.useEffect((function(){var e;d.outside||i.focusedDay&&f&&J.default(i.focusedDay,t)&&(null===(e=a.current)||void 0===e||e.focus())}),[i.focusedDay,t,a,f,d.outside]);var p=wt(u,d).join(" "),m=function(e,t){var n=ue({},e.styles.day);return Object.keys(t).forEach((function(t){var a;n=ue(ue({},n),null===(a=e.modifiersStyles)||void 0===a?void 0:a[t])})),n}(u,d),v=u.labels.labelDay(t,d,{locale:u.locale}),y=Boolean(d.outside&&!u.showOutsideDays||d.hidden),h=null!==(l=null===(o=u.components)||void 0===o?void 0:o.DayContent)&&void 0!==l?l:je,b={style:m,className:p,children:O.default.createElement(h,{date:t,displayMonth:n,activeModifiers:d}),"aria-label":v},D=Boolean(i.focusTarget&&J.default(i.focusTarget,t)),g=ue(ue(ue({},b),((r={disabled:d.disabled})["aria-pressed"]=d.selected,r["aria-label"]=v,r.tabIndex=D?0:-1,r)),s);return{isButton:f,isHidden:y,activeModifiers:d,selectedDays:c,buttonProps:g,divProps:b}}function Et(t){var n=e.useRef(null),a=xt(t.date,t.displayMonth,n);return a.isHidden?O.default.createElement(O.default.Fragment,null):a.isButton?O.default.createElement(Se,ue({name:"day",ref:n},a.buttonProps)):O.default.createElement("div",ue({},a.divProps))}function kt(e){var t=e.number,n=e.dates,a=he(),r=a.onWeekNumberClick,o=a.styles,l=a.classNames,u=a.locale,i=a.labels.labelWeekNumber,d=(0,a.formatters.formatWeekNumber)(Number(t),{locale:u});if(!r)return O.default.createElement("span",{className:l.weeknumber,style:o.weeknumber},d);var s=i(Number(t),{locale:u});return O.default.createElement(Se,{name:"week-number","aria-label":s,className:l.weeknumber,style:o.weeknumber,onClick:function(e){r(t,n,e)}},d)}function _t(e){var t,n,a,r=he(),o=r.styles,l=r.classNames,u=r.showWeekNumber,i=r.components,d=null!==(t=null==i?void 0:i.Day)&&void 0!==t?t:Et,s=null!==(n=null==i?void 0:i.WeekNumber)&&void 0!==n?n:kt;return u&&(a=O.default.createElement("td",{className:l.cell,style:o.cell},O.default.createElement(s,{number:e.weekNumber,dates:e.dates}))),O.default.createElement("tr",{className:l.row,style:o.row},a,e.dates.map((function(t){return O.default.createElement("td",{className:l.cell,style:o.cell,key:G.default(t)},O.default.createElement(d,{displayMonth:e.displayMonth,date:t}))})))}function Nt(e,t,n){for(var a=te.default(t,n),r=Z.default(e,n),o=Q.default(a,r),l=[],u=0;u<=o;u++)l.push(z.default(r,u));return l.reduce((function(e,t){var a=oe.default(t,n),r=e.find((function(e){return e.weekNumber===a}));return r?(r.dates.push(t),e):(e.push({weekNumber:a,dates:[t]}),e)}),[])}function Ct(e){var t,n,a,r=he(),o=r.locale,l=r.classNames,u=r.styles,i=r.hideHead,d=r.fixedWeeks,s=r.components,c=r.weekStartsOn,f=function(e,t){var n=Nt(j.default(e),I.default(e),t);if(null==t?void 0:t.useFixedWeeks){var a=re.default(e,t);if(a<6){var r=n[n.length-1],o=r.dates[r.dates.length-1],l=$.default(o,6-a),u=Nt($.default(o,1),l,t);n.push.apply(n,u)}}return n}(e.displayMonth,{useFixedWeeks:Boolean(d),locale:o,weekStartsOn:c}),p=null!==(t=null==s?void 0:s.Head)&&void 0!==t?t:Be,m=null!==(n=null==s?void 0:s.Row)&&void 0!==n?n:_t,v=null!==(a=null==s?void 0:s.Footer)&&void 0!==a?a:Te;return O.default.createElement("table",{className:l.table,style:u.table,role:"grid","aria-labelledby":e["aria-labelledby"]},!i&&O.default.createElement(p,null),O.default.createElement("tbody",{className:l.tbody,style:u.tbody},f.map((function(t){return O.default.createElement(m,{displayMonth:e.displayMonth,key:t.weekNumber,dates:t.dates,weekNumber:t.weekNumber})}))),O.default.createElement(v,null))}var Pt="undefined"!=typeof window&&window.document&&window.document.createElement?L.useLayoutEffect:L.useEffect,St=!1,Ot=0;function Lt(){return"react-day-picker-".concat(++Ot)}function Wt(e){var t,n,a=he(),r=a.dir,o=a.classNames,l=a.styles,u=a.components,i=_e().displayMonths,d=function(e){var t,n=null!=e?e:St?Lt():null,a=L.useState(n),r=a[0],o=a[1];return Pt((function(){null===r&&o(Lt())}),[]),L.useEffect((function(){!1===St&&(St=!0)}),[]),null!==(t=null!=e?e:r)&&void 0!==t?t:void 0}(),s=[o.month],c=l.month,f=0===e.displayIndex,p=e.displayIndex===i.length-1,m=!f&&!p;"rtl"===r&&(p=(t=[f,p])[0],f=t[1]),f&&(s.push(o.caption_start),c=ue(ue({},c),l.caption_start)),p&&(s.push(o.caption_end),c=ue(ue({},c),l.caption_end)),m&&(s.push(o.caption_between),c=ue(ue({},c),l.caption_between));var v=null!==(n=null==u?void 0:u.Caption)&&void 0!==n?n:We;return O.default.createElement("div",{key:e.displayIndex,className:s.join(" "),style:c},O.default.createElement(v,{id:d,displayMonth:e.displayMonth}),O.default.createElement(Ct,{"aria-labelledby":d,displayMonth:e.displayMonth}))}function Tt(){var t=he(),n=yt(),a=_e(),r=e.useState(!1),o=r[0],l=r[1];e.useEffect((function(){t.initialFocus&&n.focusTarget&&(o||(n.focus(n.focusTarget),l(!0)))}),[t.initialFocus,o,n.focus,n.focusTarget,n]);var u=[t.classNames.root,t.className];t.numberOfMonths>1&&u.push(t.classNames.multiple_months),t.showWeekNumber&&u.push(t.classNames.with_weeknumber);var i=ue(ue({},t.styles.root),t.style);return O.default.createElement("div",{className:u.join(" "),style:i,dir:t.dir},O.default.createElement("div",{className:t.classNames.months,style:t.styles.months},a.displayMonths.map((function(e,t){return O.default.createElement(Wt,{key:t,displayIndex:t,displayMonth:e})}))))}function It(e){var t=e.children,n=function(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(a=Object.getOwnPropertySymbols(e);r<a.length;r++)t.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r])&&(n[a[r]]=e[a[r]])}return n}(e,["children"]);return O.default.createElement(ye,{initialProps:n},O.default.createElement(ke,null,O.default.createElement(Dt,{initialProps:n},O.default.createElement(qe,{initialProps:n},O.default.createElement(Ue,{initialProps:n},O.default.createElement(rt,null,O.default.createElement(vt,null,t)))))))}function Bt(e){return!isNaN(e.getTime())}exports.Button=Se,exports.Caption=We,exports.CaptionDropdowns=Ne,exports.CaptionLabel=be,exports.CaptionNavigation=Le,exports.Day=Et,exports.DayContent=je,exports.DayPicker=function(e){return O.default.createElement(It,ue({},e),O.default.createElement(Tt,null))},exports.DayPickerContext=ve,exports.DayPickerProvider=ye,exports.Dropdown=ge,exports.FocusContext=mt,exports.FocusProvider=vt,exports.Footer=Te,exports.Head=Be,exports.HeadRow=Ie,exports.IconDropdown=De,exports.IconLeft=Ce,exports.IconRight=Pe,exports.NavigationContext=Ee,exports.NavigationProvider=ke,exports.RootProvider=It,exports.Row=_t,exports.SelectMultipleContext=Fe,exports.SelectMultipleProvider=qe,exports.SelectMultipleProviderInternal=Re,exports.SelectRangeContext=Ke,exports.SelectRangeProvider=Ue,exports.SelectRangeProviderInternal=ze,exports.SelectSingleContext=bt,exports.SelectSingleProvider=Dt,exports.SelectSingleProviderInternal=gt,exports.WeekNumber=kt,exports.addToRange=Ye,exports.isDateAfterType=it,exports.isDateBeforeType=dt,exports.isDateInterval=lt,exports.isDateRange=ut,exports.isDayOfWeekType=st,exports.isDayPickerDefault=function(e){return void 0===e.mode||"default"===e.mode},exports.isDayPickerMultiple=ie,exports.isDayPickerRange=de,exports.isDayPickerSingle=se,exports.isMatch=ct,exports.useActiveModifiers=ht,exports.useDayPicker=he,exports.useDayRender=xt,exports.useFocusContext=yt,exports.useInput=function(t){void 0===t&&(t={});var n=t.locale,a=void 0===n?W.default:n,r=t.required,o=t.format,l=void 0===o?"PP":o,u=t.defaultSelected,i=t.today,d=void 0===i?new Date:i,s=me(t),c=s.fromDate,f=s.toDate,p=function(e){return le.default(e,l,d,{locale:a})},m=e.useState(null!=u?u:d),v=m[0],y=m[1],h=e.useState(u),b=h[0],D=h[1],g=u?T.default(u,l,{locale:a}):"",M=e.useState(g),w=M[0],x=M[1],E=function(){D(u),y(null!=u?u:d),x(null!=g?g:"")},k={month:v,onDayClick:function(e,t){var n=t.selected;if(!r&&n)return D(void 0),void x("");D(e),x(e?T.default(e,l,{locale:a}):"")},onMonthChange:function(e){y(e)},selected:b,locale:a,fromDate:c,toDate:f,today:d},_={onBlur:function(e){Bt(p(e.target.value))||E()},onChange:function(e){x(e.target.value);var t=p(e.target.value),n=c&&Q.default(c,t)>0,a=f&&Q.default(t,f)>0;!Bt(t)||n||a?D(void 0):(D(t),y(t))},onFocus:function(e){if(e.target.value){var t=p(e.target.value);Bt(t)&&y(t)}else E()},value:w,placeholder:T.default(new Date,l,{locale:a})};return{dayPickerProps:k,inputProps:_,reset:E,setSelected:function(e){D(e),y(null!=e?e:d),x(e?T.default(e,l,{locale:a}):"")}}},exports.useNavigation=_e,exports.useSelectMultiple=Ae,exports.useSelectRange=Ze,exports.useSelectSingle=Mt}));
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("date-fns/locale/en-US"),a=require("date-fns/isSameYear"),n=require("date-fns/setMonth"),r=require("date-fns/startOfMonth"),o=require("date-fns/setYear"),l=require("date-fns/startOfYear"),u=require("date-fns/addMonths"),i=require("date-fns/isBefore"),d=require("date-fns/isSameMonth"),s=require("date-fns/differenceInCalendarMonths"),f=require("date-fns/isSameDay"),c=require("date-fns/addDays"),p=require("date-fns/differenceInCalendarDays"),m=require("date-fns/subDays"),v=require("date-fns/isAfter"),y=require("date-fns/isDate"),h=require("date-fns/endOfMonth"),b=require("date-fns/addWeeks"),g=require("date-fns/addYears"),w=require("date-fns/endOfISOWeek"),D=require("date-fns/endOfWeek"),x=require("date-fns/max"),M=require("date-fns/min"),_=require("date-fns/startOfISOWeek"),k=require("date-fns/startOfWeek"),E=require("date-fns/getUnixTime"),N=require("date-fns/format"),C=require("date-fns/startOfDay"),P=require("date-fns/getWeeksInMonth"),O=require("date-fns/getISOWeek"),S=require("date-fns/getWeek"),W=require("date-fns/parse");function I(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function L(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var q=I(e),B=L(e),j=I(t),F=I(a),R=I(n),T=I(r),A=I(o),Y=I(l),H=I(u),K=I(i),U=I(d),z=I(s),Z=I(f),G=I(c),J=I(p),Q=I(m),V=I(v),X=I(y),$=I(h),ee=I(b),te=I(g),ae=I(w),ne=I(D),re=I(x),oe=I(M),le=I(_),ue=I(k),ie=I(E),de=I(N),se=I(C),fe=I(P),ce=I(O),pe=I(S),me=I(W),ve=function(){return ve=Object.assign||function(e){for(var t,a=1,n=arguments.length;a<n;a++)for(var r in t=arguments[a])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ve.apply(this,arguments)};function ye(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]])}return a}function he(e){return"multiple"===e.mode}function be(e){return"range"===e.mode}function ge(e){return"single"===e.mode}function we(e){var t=qt(),a=t.fromDate,n=t.toDate,r=t.styles,o=t.locale,l=t.formatters.formatMonthCaption,u=t.classNames,i=t.components.Dropdown,d=t.labels.labelMonthDropdown;if(!a)return q.default.createElement(q.default.Fragment,null);if(!n)return q.default.createElement(q.default.Fragment,null);var s=[];if(F.default(a,n))for(var f=T.default(a),c=a.getMonth();c<=n.getMonth();c++)s.push(R.default(f,c));else for(f=T.default(new Date),c=0;c<=11;c++)s.push(R.default(f,c));return q.default.createElement(i,{name:"months","aria-label":d(),className:u.dropdown_month,style:r.dropdown_month,onChange:function(t){var a=Number(t.target.value),n=R.default(T.default(e.displayMonth),a);e.onChange(n)},value:e.displayMonth.getMonth(),caption:l(e.displayMonth,{locale:o})},s.map((function(e){return q.default.createElement("option",{key:e.getMonth(),value:e.getMonth()},l(e,{locale:o}))})))}function De(e){var t=e.displayMonth,a=qt(),n=a.fromDate,r=a.toDate,o=a.locale,l=a.styles,u=a.classNames,i=a.components.Dropdown,d=a.formatters.formatYearCaption,s=a.labels.labelYearDropdown,f=[];if(!n)return q.default.createElement(q.default.Fragment,null);if(!r)return q.default.createElement(q.default.Fragment,null);for(var c=n.getFullYear(),p=r.getFullYear(),m=c;m<=p;m++)f.push(A.default(Y.default(new Date),m));return q.default.createElement(i,{name:"years","aria-label":s(),className:u.dropdown_year,style:l.dropdown_year,onChange:function(a){var n=A.default(T.default(t),Number(a.target.value));e.onChange(n)},value:t.getFullYear(),caption:d(t,{locale:o})},f.map((function(e){return q.default.createElement("option",{key:e.getFullYear(),value:e.getFullYear()},d(e,{locale:o}))})))}function xe(){var t=qt(),a=function(e){var t=e.month,a=e.defaultMonth,n=e.today,r=t||a||n||new Date,o=e.toDate,l=e.fromDate,u=e.numberOfMonths,i=void 0===u?1:u;if(o&&z.default(o,r)<0){var d=-1*(i-1);r=H.default(o,d)}return l&&z.default(r,l)<0&&(r=l),T.default(r)}(t),n=function(t,a){var n=e.useState(t),r=n[0];return[void 0===a?r:a,n[1]]}(a,t.month),r=n[0],o=n[1];return[r,function(e){var a;if(!t.disableNavigation){var n=T.default(e);o(n),null===(a=t.onMonthChange)||void 0===a||a.call(t,n)}}]}var Me=e.createContext(void 0);function _e(e){var t=qt(),a=xe(),n=a[0],r=a[1],o=function(e,t){for(var a=t.reverseMonths,n=t.numberOfMonths,r=T.default(e),o=T.default(H.default(r,n)),l=z.default(o,r),u=[],i=0;i<l;i++){var d=H.default(r,i);u.push(d)}return a&&(u=u.reverse()),u}(n,t),l=function(e,t){if(!t.disableNavigation){var a=t.toDate,n=t.pagedNavigation,r=t.numberOfMonths,o=void 0===r?1:r,l=n?o:1,u=T.default(e);if(!a)return H.default(u,l);if(!(z.default(a,e)<o))return H.default(u,l)}}(n,t),u=function(e,t){if(!t.disableNavigation){var a=t.fromDate,n=t.pagedNavigation,r=t.numberOfMonths,o=n?void 0===r?1:r:1,l=T.default(e);if(!a)return H.default(l,-o);if(!(z.default(l,a)<=0))return H.default(l,-o)}}(n,t),i=function(e){return o.some((function(t){return U.default(e,t)}))},d={currentMonth:n,displayMonths:o,goToMonth:r,goToDate:function(e,a){i(e)||(a&&K.default(e,a)?r(H.default(e,1+-1*t.numberOfMonths)):r(e))},previousMonth:u,nextMonth:l,isDateDisplayed:i};return q.default.createElement(Me.Provider,{value:d},e.children)}function ke(){var t=e.useContext(Me);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function Ee(e){var t=qt(),a=t.classNames,n=t.styles,r=t.components.CaptionLabel,o=ke().goToMonth,l=function(e){o(e)},u=q.default.createElement(r,{id:e.id,displayMonth:e.displayMonth});return q.default.createElement("div",{className:a.caption_dropdowns,style:n.caption_dropdowns},q.default.createElement("div",{className:a.vhidden},u),q.default.createElement(we,{onChange:l,displayMonth:e.displayMonth}),q.default.createElement(De,{onChange:l,displayMonth:e.displayMonth}))}var Ne=e.forwardRef((function(e,t){var a=qt(),n=a.classNames,r=a.styles,o=[n.button_reset,n.button];e.className&&o.push(e.className);var l=o.join(" "),u=ve(ve({},r.button_reset),r.button);return e.style&&Object.assign(u,e.style),q.default.createElement("button",ve({},e,{ref:t,type:"button",className:l,style:u}))}));function Ce(e){var t=qt(),a=t.dir,n=t.locale,r=t.classNames,o=t.styles,l=t.labels,u=l.labelPrevious,i=l.labelNext,d=t.components,s=d.IconRight,f=d.IconLeft;if(!e.nextMonth&&!e.previousMonth)return q.default.createElement(q.default.Fragment,null);var c=u(e.previousMonth,{locale:n}),p=[r.nav_button,r.nav_button_previous].join(" "),m=i(e.nextMonth,{locale:n}),v=[r.nav_button,r.nav_button_next].join(" ");return q.default.createElement("div",{className:r.nav,style:o.nav},!e.hidePrevious&&q.default.createElement(Ne,{name:"previous-month","aria-label":c,className:p,style:o.nav_button_previous,disabled:!e.previousMonth,onClick:e.onPreviousClick},"rtl"===a?q.default.createElement(s,{className:r.nav_icon,style:o.nav_icon}):q.default.createElement(f,{className:r.nav_icon,style:o.nav_icon})),!e.hideNext&&q.default.createElement(Ne,{name:"next-month","aria-label":m,className:v,style:o.nav_button_next,disabled:!e.nextMonth,onClick:e.onNextClick},"rtl"===a?q.default.createElement(f,{className:r.nav_icon,style:o.nav_icon}):q.default.createElement(s,{className:r.nav_icon,style:o.nav_icon})))}function Pe(e){var t,a=qt(),n=a.numberOfMonths,r=a.dir,o=a.components.CaptionLabel,l=ke(),u=l.previousMonth,i=l.nextMonth,d=l.goToMonth,s=l.displayMonths,f=s.findIndex((function(t){return U.default(e.displayMonth,t)})),c=0===f,p=f===s.length-1;"rtl"===r&&(p=(t=[c,p])[0],c=t[1]);var m=n>1&&(c||!p),v=n>1&&(p||!c);return q.default.createElement(q.default.Fragment,null,q.default.createElement(o,{id:e.id,displayMonth:e.displayMonth}),q.default.createElement(Ce,{displayMonth:e.displayMonth,hideNext:m,hidePrevious:v,nextMonth:i,previousMonth:u,onPreviousClick:function(){u&&d(u)},onNextClick:function(){i&&d(i)}}))}function Oe(e){var t,a=qt(),n=a.classNames,r=a.disableNavigation,o=a.styles,l=a.captionLayout,u=a.components.CaptionLabel;return t=r?q.default.createElement(u,{id:e.id,displayMonth:e.displayMonth}):"dropdown"===l?q.default.createElement(Ee,{displayMonth:e.displayMonth,id:e.id}):q.default.createElement(Pe,{displayMonth:e.displayMonth,id:e.id}),q.default.createElement("div",{className:n.caption,style:o.caption},t)}function Se(e){var t=qt(),a=t.locale,n=t.classNames,r=t.styles,o=t.formatters.formatCaption;return q.default.createElement("h2",{className:n.caption_label,style:r.caption_label,"aria-live":"polite","aria-atomic":"true",id:e.id},o(e.displayMonth,{locale:a}))}var We=e.createContext(void 0);function Ie(e){if(!he(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return q.default.createElement(We.Provider,{value:t},e.children)}return q.default.createElement(Le,{initialProps:e.initialProps,children:e.children})}function Le(e){var t=e.initialProps,a=e.children,n=t.selected,r=t.min,o=t.max,l={disabled:[]};n&&l.disabled.push((function(e){var t=o&&n.length>o-1,a=n.some((function(t){return Z.default(t,e)}));return Boolean(t&&!a)}));var u={selected:n,onDayClick:function(e,a,l){var u,i;if((null===(u=t.onDayClick)||void 0===u||u.call(t,e,a,l),!Boolean(a.selected&&r&&(null==n?void 0:n.length)===r))&&!Boolean(!a.selected&&o&&(null==n?void 0:n.length)===o)){var d=n?function(e,t,a){if(a||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}([],n,!0):[];if(a.selected){var s=d.findIndex((function(t){return Z.default(e,t)}));d.splice(s,1)}else d.push(e);null===(i=t.onSelect)||void 0===i||i.call(t,d,e,a,l)}},modifiers:l};return q.default.createElement(We.Provider,{value:u},a)}function qe(){var t=e.useContext(We);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function Be(e,t){var a=t||{},n=a.from,r=a.to;if(!n)return{from:e,to:void 0};if(!r&&Z.default(n,e))return{from:n,to:e};if(!r&&K.default(e,n))return{from:e,to:n};if(!r)return{from:n,to:e};if(!Z.default(r,e)||!Z.default(n,e)){if(Z.default(r,e))return{from:r,to:void 0};if(!Z.default(n,e))return V.default(n,e)?{from:e,to:r}:{from:n,to:e}}}var je,Fe=e.createContext(void 0);function Re(e){if(!be(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return q.default.createElement(Fe.Provider,{value:t},e.children)}return q.default.createElement(Te,{initialProps:e.initialProps,children:e.children})}function Te(e){var t=e.initialProps,a=e.children,n=t.selected,r=n||{},o=r.from,l=r.to,u=t.min,i=t.max,d={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o&&(d.range_start=[o],l?(d.range_end=[l],d.range_middle=[{after:o,before:l}]):d.range_end=[o]),u&&(o&&!l&&d.disabled.push({after:Q.default(o,u-1),before:G.default(o,u-1)}),o&&l&&d.disabled.push({after:o,before:G.default(o,u-1)})),i&&(o&&!l&&(d.disabled.push({before:G.default(o,1-i)}),d.disabled.push({after:G.default(o,i-1)})),o&&l)){var s=i-(J.default(l,o)+1);d.disabled.push({before:Q.default(o,s)}),d.disabled.push({after:G.default(l,s)})}return q.default.createElement(Fe.Provider,{value:{selected:n,onDayClick:function(e,a,r){var o,l;null===(o=t.onDayClick)||void 0===o||o.call(t,e,a,r);var u=Be(e,n);null===(l=t.onSelect)||void 0===l||l.call(t,u,e,a,r)},modifiers:d}},a)}function Ae(){var t=e.useContext(Fe);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function Ye(e){return Array.isArray(e)?e:void 0!==e?[e]:[]}exports.InternalModifier=void 0,(je=exports.InternalModifier||(exports.InternalModifier={})).Outside="outside",je.Disabled="disabled",je.Selected="selected",je.Hidden="hidden",je.Today="today",je.RangeStart="range_start",je.RangeEnd="range_end",je.RangeMiddle="range_middle";var He=exports.InternalModifier.Selected,Ke=exports.InternalModifier.Disabled,Ue=exports.InternalModifier.Hidden,ze=exports.InternalModifier.Today,Ze=exports.InternalModifier.RangeEnd,Ge=exports.InternalModifier.RangeMiddle,Je=exports.InternalModifier.RangeStart,Qe=exports.InternalModifier.Outside;var Ve=e.createContext(void 0);function Xe(e){var t=qt(),a=function(e,t,a){var n,r=((n={})[He]=Ye(e.selected),n[Ke]=Ye(e.disabled),n[Ue]=Ye(e.hidden),n[ze]=[e.today],n[Ze]=[],n[Ge]=[],n[Je]=[],n[Qe]=[],n);return e.fromDate&&r[Ke].push({before:e.fromDate}),e.toDate&&r[Ke].push({after:e.toDate}),he(e)?r[Ke]=r[Ke].concat(t.modifiers[Ke]):be(e)&&(r[Ke]=r[Ke].concat(a.modifiers[Ke]),r[Je]=a.modifiers[Je],r[Ge]=a.modifiers[Ge],r[Ze]=a.modifiers[Ze]),r}(t,qe(),Ae()),n=function(e){var t={};return Object.entries(e).forEach((function(e){var a=e[0],n=e[1];t[a]=Ye(n)})),t}(t.modifiers),r=ve(ve({},a),n);return q.default.createElement(Ve.Provider,{value:r},e.children)}function $e(){var t=e.useContext(Ve);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function et(e){return Boolean(e&&"object"==typeof e&&"before"in e&&"after"in e)}function tt(e){return Boolean(e&&"object"==typeof e&&"from"in e)}function at(e){return Boolean(e&&"object"==typeof e&&"after"in e)}function nt(e){return Boolean(e&&"object"==typeof e&&"before"in e)}function rt(e){return Boolean(e&&"object"==typeof e&&"dayOfWeek"in e)}function ot(e,t){return t.some((function(t){if("boolean"==typeof t)return t;if(a=t,X.default(a))return Z.default(e,t);var a;if(function(e){return Array.isArray(e)&&e.every(X.default)}(t))return t.includes(e);if(tt(t))return function(e,t){var a,n=t.from,r=t.to;if(!n)return!1;if(!r&&Z.default(n,e))return!0;if(!r)return!1;var o=J.default(r,n)<0;return r&&o&&(n=(a=[r,n])[0],r=a[1]),J.default(e,n)>=0&&J.default(r,e)>=0}(e,t);if(rt(t))return t.dayOfWeek.includes(e.getDay());if(et(t)){var n=J.default(t.before,e)>0,r=J.default(e,t.after)>0;return n&&r}return at(t)?J.default(e,t.after)>0:nt(t)?J.default(t.before,e)>0:"function"==typeof t&&t(e)}))}function lt(e,t,a){var n=Object.keys(t).reduce((function(a,n){var r=t[n];return ot(e,r)&&a.push(n),a}),[]),r={};return n.forEach((function(e){return r[e]=!0})),a&&!U.default(e,a)&&(r.outside=!0),r}function ut(e,t){var a=t.moveBy,n=t.direction,r=t.context,o=t.modifiers,l=t.retry,u=void 0===l?{count:0,lastFocused:e}:l,i=r.weekStartsOn,d=r.fromDate,s=r.toDate,f=r.locale,c={day:G.default,week:ee.default,month:H.default,year:te.default,startOfWeek:function(e){return r.ISOWeek?le.default(e):ue.default(e,{locale:f,weekStartsOn:i})},endOfWeek:function(e){return r.ISOWeek?ae.default(e):ne.default(e,{locale:f,weekStartsOn:i})}}[a](e,"after"===n?1:-1);"before"===n&&d?c=re.default([d,c]):"after"===n&&s&&(c=oe.default([s,c]));var p=!0;if(o){var m=lt(c,o);p=!m.disabled&&!m.hidden}return p?c:u.count>365?u.lastFocused:ut(c,{moveBy:a,direction:n,context:r,modifiers:o,retry:ve(ve({},u),{count:u.count+1})})}var it=e.createContext(void 0);function dt(t){var a=ke(),n=$e(),r=e.useState(),o=r[0],l=r[1],u=e.useState(),i=u[0],d=u[1],s=function(e,t){for(var a,n,r=T.default(e[0]),o=$.default(e[e.length-1]),l=r;l<=o;){var u=lt(l,t);if(u.disabled||u.hidden)l=G.default(l,1);else{if(u.selected)return l;u.today&&!n&&(n=l),a||(a=l),l=G.default(l,1)}}return n||a}(a.displayMonths,n),f=(null!=o?o:i&&a.isDateDisplayed(i))?i:s,c=function(e){l(e)},p=qt(),m=function(e,t){if(o){var r=ut(o,{moveBy:e,direction:t,context:p,modifiers:n});Z.default(o,r)||(a.goToDate(r,o),c(r))}},v={focusedDay:o,focusTarget:f,blur:function(){d(o),l(void 0)},focus:c,focusDayAfter:function(){return m("day","after")},focusDayBefore:function(){return m("day","before")},focusWeekAfter:function(){return m("week","after")},focusWeekBefore:function(){return m("week","before")},focusMonthBefore:function(){return m("month","before")},focusMonthAfter:function(){return m("month","after")},focusYearBefore:function(){return m("year","before")},focusYearAfter:function(){return m("year","after")},focusStartOfWeek:function(){return m("startOfWeek","before")},focusEndOfWeek:function(){return m("endOfWeek","after")}};return q.default.createElement(it.Provider,{value:v},t.children)}function st(){var t=e.useContext(it);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function ft(e,t){return lt(e,$e(),t)}var ct=e.createContext(void 0);function pt(e){if(!ge(e.initialProps)){var t={selected:void 0};return q.default.createElement(ct.Provider,{value:t},e.children)}return q.default.createElement(mt,{initialProps:e.initialProps,children:e.children})}function mt(e){var t=e.initialProps,a=e.children,n={selected:t.selected,onDayClick:function(e,a,n){var r,o,l;null===(r=t.onDayClick)||void 0===r||r.call(t,e,a,n),!a.selected||t.required?null===(l=t.onSelect)||void 0===l||l.call(t,e,e,a,n):null===(o=t.onSelect)||void 0===o||o.call(t,void 0,e,a,n)}};return q.default.createElement(ct.Provider,{value:n},a)}function vt(){var t=e.useContext(ct);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function yt(e,t){var a=[e.classNames.day];return Object.keys(t).forEach((function(t){var n=e.modifiersClassNames[t];if(n)a.push(n);else if(function(e){return Object.values(exports.InternalModifier).includes(e)}(t)){var r=e.classNames["day_".concat(t)];r&&a.push(r)}})),a}function ht(t,a,n){var r,o=qt(),l=o.components.DayContent,u=ye(o,["components"]),i=st(),d=ft(t,a),s=function(e,t){var a=qt(),n=vt(),r=qe(),o=Ae(),l=st(),u=l.focusDayAfter,i=l.focusDayBefore,d=l.focusWeekAfter,s=l.focusWeekBefore,f=l.blur,c=l.focus,p=l.focusMonthBefore,m=l.focusMonthAfter,v=l.focusYearBefore,y=l.focusYearAfter,h=l.focusStartOfWeek,b=l.focusEndOfWeek,g={onClick:function(l){var u,i,d,s;ge(a)?null===(u=n.onDayClick)||void 0===u||u.call(n,e,t,l):he(a)?null===(i=r.onDayClick)||void 0===i||i.call(r,e,t,l):be(a)?null===(d=o.onDayClick)||void 0===d||d.call(o,e,t,l):null===(s=a.onDayClick)||void 0===s||s.call(a,e,t,l)},onFocus:function(n){var r;c(e),null===(r=a.onDayFocus)||void 0===r||r.call(a,e,t,n)},onBlur:function(n){var r;f(),null===(r=a.onDayBlur)||void 0===r||r.call(a,e,t,n)},onKeyDown:function(n){var r;switch(n.key){case"ArrowLeft":n.preventDefault(),n.stopPropagation(),"rtl"===a.dir?u():i();break;case"ArrowRight":n.preventDefault(),n.stopPropagation(),"rtl"===a.dir?i():u();break;case"ArrowDown":n.preventDefault(),n.stopPropagation(),d();break;case"ArrowUp":n.preventDefault(),n.stopPropagation(),s();break;case"PageUp":n.preventDefault(),n.stopPropagation(),n.shiftKey?v():p();break;case"PageDown":n.preventDefault(),n.stopPropagation(),n.shiftKey?y():m();break;case"Home":n.preventDefault(),n.stopPropagation(),h();break;case"End":n.preventDefault(),n.stopPropagation(),b()}null===(r=a.onDayKeyDown)||void 0===r||r.call(a,e,t,n)},onKeyUp:function(n){var r;null===(r=a.onDayKeyUp)||void 0===r||r.call(a,e,t,n)},onMouseEnter:function(n){var r;null===(r=a.onDayMouseEnter)||void 0===r||r.call(a,e,t,n)},onMouseLeave:function(n){var r;null===(r=a.onDayMouseLeave)||void 0===r||r.call(a,e,t,n)},onTouchCancel:function(n){var r;null===(r=a.onDayTouchCancel)||void 0===r||r.call(a,e,t,n)},onTouchEnd:function(n){var r;null===(r=a.onDayTouchEnd)||void 0===r||r.call(a,e,t,n)},onTouchMove:function(n){var r;null===(r=a.onDayTouchMove)||void 0===r||r.call(a,e,t,n)},onTouchStart:function(n){var r;null===(r=a.onDayTouchStart)||void 0===r||r.call(a,e,t,n)}};return g}(t,d),f=function(){var e=qt(),t=vt(),a=qe(),n=Ae();return ge(e)?t.selected:he(e)?a.selected:be(e)?n.selected:void 0}(),c=Boolean(u.onDayClick||"default"!==u.mode);e.useEffect((function(){var e;d.outside||i.focusedDay&&c&&Z.default(i.focusedDay,t)&&(null===(e=n.current)||void 0===e||e.focus())}),[i.focusedDay,t,n,c,d.outside]);var p=yt(u,d).join(" "),m=function(e,t){var a=ve({},e.styles.day);return Object.keys(t).forEach((function(t){var n;a=ve(ve({},a),null===(n=e.modifiersStyles)||void 0===n?void 0:n[t])})),a}(u,d),v=u.labels.labelDay(t,d,{locale:u.locale}),y=Boolean(d.outside&&!u.showOutsideDays||d.hidden),h={style:m,className:p,children:q.default.createElement(l,{date:t,displayMonth:a,activeModifiers:d}),"aria-label":v},b=Boolean(i.focusTarget&&Z.default(i.focusTarget,t)),g=ve(ve(ve({},h),((r={disabled:d.disabled})["aria-pressed"]=d.selected,r["aria-label"]=v,r.tabIndex=b?0:-1,r)),s);return{isButton:c,isHidden:y,activeModifiers:d,selectedDays:f,buttonProps:g,divProps:h}}function bt(t){var a=e.useRef(null),n=ht(t.date,t.displayMonth,a);return n.isHidden?q.default.createElement(q.default.Fragment,null):n.isButton?q.default.createElement(Ne,ve({name:"day",ref:a},n.buttonProps)):q.default.createElement("div",ve({},n.divProps))}function gt(e){var t=qt(),a=t.locale,n=t.formatters.formatDay;return q.default.createElement(q.default.Fragment,null,n(e.date,{locale:a}))}function wt(e){var t=e.onChange,a=e.value,n=e.children,r=e.caption,o=e.className,l=e.style,u=qt(),i=u.components.IconDropdown,d=ye(u,["components"]);return q.default.createElement("div",{className:o,style:l},q.default.createElement("span",{className:d.classNames.vhidden},e["aria-label"]),q.default.createElement("select",{name:e.name,"aria-label":e["aria-label"],className:d.classNames.dropdown,style:d.styles.dropdown,value:a,onChange:t},n),q.default.createElement("div",{className:d.classNames.caption_label,style:d.styles.caption_label,"aria-hidden":"true"},r,q.default.createElement(i,{className:d.classNames.dropdown_icon,style:d.styles.dropdown_icon})))}function Dt(){var e=qt(),t=e.footer,a=e.styles,n=e.classNames.tfoot;return t?q.default.createElement("tfoot",{className:n,style:a.tfoot},q.default.createElement("tr",null,q.default.createElement("td",{colSpan:8},t))):q.default.createElement(q.default.Fragment,null)}function xt(){var e=qt(),t=e.classNames,a=e.styles,n=e.components.HeadRow;return q.default.createElement("thead",{style:a.head,className:t.head},q.default.createElement(n,null))}function Mt(){var e=qt(),t=e.classNames,a=e.styles,n=e.showWeekNumber,r=e.locale,o=e.weekStartsOn,l=e.ISOWeek,u=e.formatters.formatWeekdayName,i=e.labels.labelWeekday,d=function(e,t,a){for(var n=a?le.default(new Date):ue.default(new Date,{locale:e,weekStartsOn:t}),r=[],o=0;o<7;o++){var l=G.default(n,o);r.push(l)}return r}(r,o,l);return q.default.createElement("tr",{style:a.head_row,className:t.head_row},n&&q.default.createElement("th",{scope:"col",style:a.head_cell,className:t.head_cell}),d.map((function(e,n){return q.default.createElement("th",{key:n,scope:"col",className:t.head_cell,style:a.head_cell},q.default.createElement("span",{"aria-hidden":!0},u(e,{locale:r})),q.default.createElement("span",{className:t.vhidden},i(e,{locale:r})))})))}function _t(e){return q.default.createElement("svg",ve({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},e),q.default.createElement("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"}))}function kt(e){return q.default.createElement("svg",ve({width:"16px",height:"16px",viewBox:"0 0 120 120"},e),q.default.createElement("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"}))}function Et(e){return q.default.createElement("svg",ve({width:"16px",height:"16px",viewBox:"0 0 120 120"},e),q.default.createElement("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"}))}function Nt(e){var t,a=qt(),n=a.styles,r=a.classNames,o=a.showWeekNumber,l=a.components,u=l.Day,i=l.WeekNumber;return o&&(t=q.default.createElement("td",{className:r.cell,style:n.cell},q.default.createElement(i,{number:e.weekNumber,dates:e.dates}))),q.default.createElement("tr",{className:r.row,style:n.row},t,e.dates.map((function(t){return q.default.createElement("td",{className:r.cell,style:n.cell,key:ie.default(t)},q.default.createElement(u,{displayMonth:e.displayMonth,date:t}))})))}function Ct(e){var t=e.number,a=e.dates,n=qt(),r=n.onWeekNumberClick,o=n.styles,l=n.classNames,u=n.locale,i=n.labels.labelWeekNumber,d=(0,n.formatters.formatWeekNumber)(Number(t),{locale:u});if(!r)return q.default.createElement("span",{className:l.weeknumber,style:o.weeknumber},d);var s=i(Number(t),{locale:u});return q.default.createElement(Ne,{name:"week-number","aria-label":s,className:l.weeknumber,style:o.weeknumber,onClick:function(e){r(t,a,e)}},d)}var Pt={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};var Ot=Object.freeze({__proto__:null,formatCaption:function(e,t){return de.default(e,"LLLL y",t)},formatDay:function(e,t){return de.default(e,"d",t)},formatMonthCaption:function(e,t){return de.default(e,"LLLL",t)},formatWeekNumber:function(e){return"".concat(e)},formatWeekdayName:function(e,t){return de.default(e,"cccccc",t)},formatYearCaption:function(e,t){return de.default(e,"yyyy",t)}}),St=Object.freeze({__proto__:null,labelDay:function(e,t,a){return de.default(e,"do MMMM (EEEE)",a)},labelMonthDropdown:function(){return"Month: "},labelNext:function(){return"Go to next month"},labelPrevious:function(){return"Go to previous month"},labelWeekday:function(e,t){return de.default(e,"cccc",t)},labelWeekNumber:function(e){return"Week n. ".concat(e)},labelYearDropdown:function(){return"Year: "}});function Wt(e){var t=e.fromYear,a=e.toYear,n=e.fromMonth,r=e.toMonth,o=e.fromDate,l=e.toDate;return n?o=T.default(n):t&&(o=new Date(t,0,1)),r?l=$.default(r):a&&(l=new Date(a,11,31)),{fromDate:o?se.default(o):void 0,toDate:l?se.default(l):void 0}}var It=e.createContext(void 0);function Lt(e){var t,a,n,r,o,l=e.initialProps,u=(a=Pt,n=j.default,r=new Date,{captionLayout:"buttons",classNames:a,components:{Caption:Oe,CaptionLabel:Se,Day:bt,DayContent:gt,Dropdown:wt,Footer:Dt,Head:xt,HeadRow:Mt,IconDropdown:_t,IconRight:Et,IconLeft:kt,Row:Nt,WeekNumber:Ct},formatters:Ot,labels:St,locale:n,modifiersClassNames:{},modifiers:{},numberOfMonths:1,styles:{},today:r,mode:"default"}),i=Wt(l),d=i.fromDate,s=i.toDate,f=null!==(t=l.captionLayout)&&void 0!==t?t:u.captionLayout;"buttons"===f||d&&s||(f="buttons"),(ge(l)||he(l)||be(l))&&(o=l.onSelect);var c=ve(ve(ve({},u),l),{captionLayout:f,classNames:ve(ve({},u.classNames),l.classNames),components:ve(ve({},u.components),l.components),formatters:ve(ve({},u.formatters),l.formatters),fromDate:d,labels:ve(ve({},u.labels),l.labels),mode:l.mode||u.mode,modifiers:ve(ve({},u.modifiers),l.modifiers),modifiersClassNames:ve(ve({},u.modifiersClassNames),l.modifiersClassNames),onSelect:o,styles:ve(ve({},u.styles),l.styles),toDate:s});return q.default.createElement(It.Provider,{value:c},e.children)}function qt(){var t=e.useContext(It);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function Bt(e,t,a){for(var n=(null==a?void 0:a.ISOWeek)?ae.default(t):ne.default(t,a),r=(null==a?void 0:a.ISOWeek)?le.default(e):ue.default(e,a),o=J.default(n,r),l=[],u=0;u<=o;u++)l.push(G.default(r,u));return l.reduce((function(e,t){var n=(null==a?void 0:a.ISOWeek)?ce.default(t):pe.default(t,a),r=e.find((function(e){return e.weekNumber===n}));return r?(r.dates.push(t),e):(e.push({weekNumber:n,dates:[t]}),e)}),[])}function jt(e){var t=qt(),a=t.locale,n=t.classNames,r=t.styles,o=t.hideHead,l=t.fixedWeeks,u=t.components,i=u.Head,d=u.Row,s=u.Footer,f=t.weekStartsOn,c=t.firstWeekContainsDate,p=t.ISOWeek,m=function(e,t){var a=Bt(T.default(e),$.default(e),t);if(null==t?void 0:t.useFixedWeeks){var n=fe.default(e,t);if(n<6){var r=a[a.length-1],o=r.dates[r.dates.length-1],l=ee.default(o,6-n),u=Bt(ee.default(o,1),l,t);a.push.apply(a,u)}}return a}(e.displayMonth,{useFixedWeeks:Boolean(l),ISOWeek:p,locale:a,weekStartsOn:f,firstWeekContainsDate:c});return q.default.createElement("table",{className:n.table,style:r.table,role:"grid","aria-labelledby":e["aria-labelledby"]},!o&&q.default.createElement(i,null),q.default.createElement("tbody",{className:n.tbody,style:r.tbody},m.map((function(t){return q.default.createElement(d,{displayMonth:e.displayMonth,key:t.weekNumber,dates:t.dates,weekNumber:t.weekNumber})}))),q.default.createElement(s,null))}var Ft="undefined"!=typeof window&&window.document&&window.document.createElement?B.useLayoutEffect:B.useEffect,Rt=!1,Tt=0;function At(){return"react-day-picker-".concat(++Tt)}function Yt(e){var t,a=qt(),n=a.dir,r=a.classNames,o=a.styles,l=a.components.Caption,u=ke().displayMonths,i=function(e){var t,a=null!=e?e:Rt?At():null,n=B.useState(a),r=n[0],o=n[1];return Ft((function(){null===r&&o(At())}),[]),B.useEffect((function(){!1===Rt&&(Rt=!0)}),[]),null!==(t=null!=e?e:r)&&void 0!==t?t:void 0}(a.id?"".concat(a.id,"-").concat(e.displayIndex):void 0),d=[r.month],s=o.month,f=0===e.displayIndex,c=e.displayIndex===u.length-1,p=!f&&!c;return"rtl"===n&&(c=(t=[f,c])[0],f=t[1]),f&&(d.push(r.caption_start),s=ve(ve({},s),o.caption_start)),c&&(d.push(r.caption_end),s=ve(ve({},s),o.caption_end)),p&&(d.push(r.caption_between),s=ve(ve({},s),o.caption_between)),q.default.createElement("div",{key:e.displayIndex,className:d.join(" "),style:s},q.default.createElement(l,{id:i,displayMonth:e.displayMonth}),q.default.createElement(jt,{"aria-labelledby":i,displayMonth:e.displayMonth}))}function Ht(){var t=qt(),a=st(),n=ke(),r=e.useState(!1),o=r[0],l=r[1];e.useEffect((function(){t.initialFocus&&a.focusTarget&&(o||(a.focus(a.focusTarget),l(!0)))}),[t.initialFocus,o,a.focus,a.focusTarget,a]);var u=[t.classNames.root,t.className];t.numberOfMonths>1&&u.push(t.classNames.multiple_months),t.showWeekNumber&&u.push(t.classNames.with_weeknumber);var i=ve(ve({},t.styles.root),t.style);return q.default.createElement("div",{className:u.join(" "),style:i,dir:t.dir},q.default.createElement("div",{className:t.classNames.months,style:t.styles.months},n.displayMonths.map((function(e,t){return q.default.createElement(Yt,{key:t,displayIndex:t,displayMonth:e})}))))}function Kt(e){var t=e.children,a=ye(e,["children"]);return q.default.createElement(Lt,{initialProps:a},q.default.createElement(_e,null,q.default.createElement(pt,{initialProps:a},q.default.createElement(Ie,{initialProps:a},q.default.createElement(Re,{initialProps:a},q.default.createElement(Xe,null,q.default.createElement(dt,null,t)))))))}function Ut(e){return!isNaN(e.getTime())}exports.Button=Ne,exports.Caption=Oe,exports.CaptionDropdowns=Ee,exports.CaptionLabel=Se,exports.CaptionNavigation=Pe,exports.Day=bt,exports.DayContent=gt,exports.DayPicker=function(e){return q.default.createElement(Kt,ve({},e),q.default.createElement(Ht,null))},exports.DayPickerContext=It,exports.DayPickerProvider=Lt,exports.Dropdown=wt,exports.FocusContext=it,exports.FocusProvider=dt,exports.Footer=Dt,exports.Head=xt,exports.HeadRow=Mt,exports.IconDropdown=_t,exports.IconLeft=kt,exports.IconRight=Et,exports.NavigationContext=Me,exports.NavigationProvider=_e,exports.RootProvider=Kt,exports.Row=Nt,exports.SelectMultipleContext=We,exports.SelectMultipleProvider=Ie,exports.SelectMultipleProviderInternal=Le,exports.SelectRangeContext=Fe,exports.SelectRangeProvider=Re,exports.SelectRangeProviderInternal=Te,exports.SelectSingleContext=ct,exports.SelectSingleProvider=pt,exports.SelectSingleProviderInternal=mt,exports.WeekNumber=Ct,exports.addToRange=Be,exports.isDateAfterType=at,exports.isDateBeforeType=nt,exports.isDateInterval=et,exports.isDateRange=tt,exports.isDayOfWeekType=rt,exports.isDayPickerDefault=function(e){return void 0===e.mode||"default"===e.mode},exports.isDayPickerMultiple=he,exports.isDayPickerRange=be,exports.isDayPickerSingle=ge,exports.isMatch=ot,exports.useActiveModifiers=ft,exports.useDayPicker=qt,exports.useDayRender=ht,exports.useFocusContext=st,exports.useInput=function(t){void 0===t&&(t={});var a=t.locale,n=void 0===a?j.default:a,r=t.required,o=t.format,l=void 0===o?"PP":o,u=t.defaultSelected,i=t.today,d=void 0===i?new Date:i,s=Wt(t),f=s.fromDate,c=s.toDate,p=function(e){return me.default(e,l,d,{locale:n})},m=e.useState(null!=u?u:d),v=m[0],y=m[1],h=e.useState(u),b=h[0],g=h[1],w=u?de.default(u,l,{locale:n}):"",D=e.useState(w),x=D[0],M=D[1],_=function(){g(u),y(null!=u?u:d),M(null!=w?w:"")},k={month:v,onDayClick:function(e,t){var a=t.selected;if(!r&&a)return g(void 0),void M("");g(e),M(e?de.default(e,l,{locale:n}):"")},onMonthChange:function(e){y(e)},selected:b,locale:n,fromDate:f,toDate:c,today:d},E={onBlur:function(e){Ut(p(e.target.value))||_()},onChange:function(e){M(e.target.value);var t=p(e.target.value),a=f&&J.default(f,t)>0,n=c&&J.default(t,c)>0;!Ut(t)||a||n?g(void 0):(g(t),y(t))},onFocus:function(e){if(e.target.value){var t=p(e.target.value);Ut(t)&&y(t)}else _()},value:x,placeholder:de.default(new Date,l,{locale:n})};return{dayPickerProps:k,inputProps:E,reset:_,setSelected:function(e){g(e),y(null!=e?e:d),M(e?de.default(e,l,{locale:n}):"")}}},exports.useNavigation=ke,exports.useSelectMultiple=qe,exports.useSelectRange=Ae,exports.useSelectSingle=vt}));
{
"name": "react-day-picker",
"version": "8.2.1",
"version": "8.3.0",
"description": "Customizable Date Picker for React",

@@ -39,3 +39,2 @@ "author": "Giampaolo Bellavite <io@gpbl.dev>",

"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-typescript": "^8.3.4",
"@testing-library/jest-dom": "^5.16.4",

@@ -68,2 +67,3 @@ "@testing-library/react": "^12.1.4",

"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-ts": "^3.0.2",
"timekeeper": "^2.2.0",

@@ -70,0 +70,0 @@ "ts-jest": "^27.1.4",

@@ -9,2 +9,3 @@ import es from 'date-fns/locale/es';

const prevSunday = new Date(2022, 1, 6);
const prevMonday = new Date(2022, 1, 7);

@@ -38,1 +39,10 @@ freezeBeforeAll(today);

);
describe('when using ISO week', () => {
beforeEach(() => {
result = getWeekdays(es, 3, true);
});
test('should return Monday as first day', () => {
expect(result[0]).toEqual(prevMonday);
});
});
import addDays from 'date-fns/addDays';
import startOfISOWeek from 'date-fns/startOfISOWeek';
import startOfWeek from 'date-fns/startOfWeek';

@@ -12,6 +13,11 @@

locale?: Locale,
/** The index of the first day of the week (0 - Sunday) */
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6
/** The index of the first day of the week (0 - Sunday). */
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
/** Use ISOWeek instead of locale/ */
ISOWeek?: boolean
): Date[] {
const start = startOfWeek(new Date(), { locale, weekStartsOn });
const start = ISOWeek
? startOfISOWeek(new Date())
: startOfWeek(new Date(), { locale, weekStartsOn });
const days = [];

@@ -18,0 +24,0 @@ for (let i = 0; i < 7; i++) {

@@ -5,4 +5,7 @@ import type { Locale } from 'date-fns';

import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';
import endOfISOWeek from 'date-fns/endOfISOWeek';
import endOfWeek from 'date-fns/endOfWeek';
import getISOWeek from 'date-fns/getISOWeek';
import getWeek from 'date-fns/getWeek';
import startOfISOWeek from 'date-fns/startOfISOWeek';
import startOfWeek from 'date-fns/startOfWeek';

@@ -17,2 +20,3 @@

options?: {
ISOWeek?: boolean;
locale?: Locale;

@@ -23,4 +27,9 @@ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;

): MonthWeek[] {
const toWeek = endOfWeek(toDate, options);
const fromWeek = startOfWeek(fromDate, options);
const toWeek = options?.ISOWeek
? endOfISOWeek(toDate)
: endOfWeek(toDate, options);
const fromWeek = options?.ISOWeek
? startOfISOWeek(fromDate)
: startOfWeek(fromDate, options);
const nOfDays = differenceInCalendarDays(toWeek, fromWeek);

@@ -34,3 +43,6 @@ const days: Date[] = [];

const weeksInMonth = days.reduce((result: MonthWeek[], date) => {
const weekNumber = getWeek(date, options);
const weekNumber = options?.ISOWeek
? getISOWeek(date)
: getWeek(date, options);
const existingWeek = result.find(

@@ -37,0 +49,0 @@ (value) => value.weekNumber === weekNumber

@@ -63,3 +63,3 @@ import { enGB, enUS } from 'date-fns/locale';

});
test('the first week should be the last of January', () => {
test('the last week should be the last of January', () => {
const weekNumbers = weeks.map((week) => week.weekNumber);

@@ -69,2 +69,34 @@ expect(weekNumbers[weekNumbers.length - 1]).toEqual(5);

});
describe('when setting a 3 as first day of year', () => {
const date = new Date(2022, 0);
const weeks = getMonthWeeks(date, { locale, firstWeekContainsDate: 3 });
test('the number of week should have number 53', () => {
const weekNumbers = weeks.map((week) => week.weekNumber);
expect(weekNumbers[0]).toEqual(53);
});
});
});
describe('when using the ISOWeek numbers', () => {
const locale = enUS;
describe('when getting the weeks for September 2022', () => {
const date = new Date(2022, 8);
const weeks = getMonthWeeks(date, { locale, ISOWeek: true });
test('the last week should have number 39', () => {
const weekNumbers = weeks.map((week) => week.weekNumber);
expect(weekNumbers[weekNumbers.length - 1]).toEqual(39);
});
});
});
describe('when not using the ISOWeek numbers', () => {
const locale = enUS;
describe('when getting the weeks for September 2022', () => {
const date = new Date(2022, 8);
const weeks = getMonthWeeks(date, { locale, ISOWeek: false });
test('the last week should have number 40', () => {
const weekNumbers = weeks.map((week) => week.weekNumber);
expect(weekNumbers[weekNumbers.length - 1]).toEqual(40);
});
});
});

@@ -23,10 +23,9 @@ import type { Locale } from 'date-fns';

export function getMonthWeeks(
/** The month to get the weeks from */
month: Date,
options: {
locale: Locale;
/** Add extra weeks up to 6 weeks */
useFixedWeeks?: boolean;
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
ISOWeek?: boolean;
}

@@ -40,4 +39,4 @@ ): MonthWeek[] {

// Add extra weeks to the month, up to 6 weeks
if (options?.useFixedWeeks) {
// Add extra weeks to the month, up to 6 weeks
const nrOfMonthWeeks = getWeeksInMonth(month, options);

@@ -44,0 +43,0 @@ if (nrOfMonthWeeks < 6) {

@@ -1,2 +0,1 @@

export * from './useDayPicker';
export * from './DayPickerContext';
export * from './FocusContext';
export * from './useFocusContext';

@@ -1,2 +0,2 @@

export * from './useModifiers';
export * from './ModifiersContext';
export * from './utils/getActiveModifiers';
import { addDays } from 'date-fns';
import { DayPickerContextValue } from 'contexts/DayPicker';
import { getDefaultContextValue } from 'contexts/DayPicker/defaultContextValue';
import { getDefaultContextValues } from 'contexts/DayPicker/defaultContextValues';
import { SelectRangeContextValue } from 'contexts/SelectRange';

@@ -10,3 +10,4 @@ import { InternalModifier, InternalModifiers } from 'types/Modifiers';

const defaultDayPickerContext: DayPickerContextValue = getDefaultContextValue();
const defaultDayPickerContext: DayPickerContextValue =
getDefaultContextValues();
const defaultSelectMultipleContext = {

@@ -13,0 +14,0 @@ selected: undefined,

export * from './NavigationContext';
export * from './useNavigation';
export * from './SelectMultipleContext';
export * from './useSelectMultiple';
export * from './SelectRangeContext';
export * from './useSelectRange';
export * from './SelectSingleContext';
export * from './useSelectSingle';

@@ -72,2 +72,7 @@ import type { Locale } from 'date-fns';

/**
* An unique id to replace the random generated id, used by DayPicker for accessibility.
*/
id?: string;
/**
* The initial month to show in the calendar. Default is the current month.

@@ -139,2 +144,3 @@ *

* `fromMonth` or`fromYear` and `toDate`, `toMonth` or `toYear` are set.
*
*/

@@ -157,6 +163,27 @@ captionLayout?: CaptionLayout;

/**
* Show the week numbers column. Default to `false`.
* Show the week numbers column. Weeks are numbered according to the local
* week index. To use ISO week numbering, use the {@link ISOWeek} prop.
*
* @defaultValue false
*/
showWeekNumber?: boolean;
/**
* The index of the first day of the week (0 - Sunday). Overrides the locale's one.
*/
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
/**
* The day of January, which is always in the first week of the year. See also
* https://date-fns.org/docs/getWeek and
* https://en.wikipedia.org/wiki/Week#Numbering
*/
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
/**
* Use ISO week dates instead of the locale setting. See also
* https://en.wikipedia.org/wiki/ISO_week_date.
*
* Setting this prop will ignore {@link weekStartsOn} and {@link firstWeekContainsDate}.
*/
ISOWeek?: boolean;
/**
* Map of components used to create the layout. Look at the [components source](https://github.com/gpbl/react-day-picker/tree/master/packages/react-day-picker/src/components) to understand how internal components are built.

@@ -222,7 +249,2 @@ */

/**
* The index of the first day of the week (0 - Sunday). Overrides the locale's one.
*/
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
onDayClick?: DayClickEventHandler;

@@ -290,1 +312,6 @@ onDayFocus?: DayFocusEventHandler;

}
/**
* All the components in use by DayPicker that can be customized via the {@link components} prop.
*/
export type Components = Required<CustomComponents>;

@@ -60,13 +60,11 @@ import { DateRange } from 'types/Matchers';

/** The event handler when selecting a single day. */
export interface SelectSingleEventHandler {
(
/** The selected day, `undefined` when `required={false}` (default) and the day is clicked again. */
day: Date | undefined,
/** The day that was selected (or clicked) triggering the event. */
selectedDay: Date,
/** The modifiers of the selected day. */
activeModifiers: ActiveModifiers,
e: React.MouseEvent
): void;
}
export type SelectSingleEventHandler = (
/** The selected day, `undefined` when `required={false}` (default) and the day is clicked again. */
day: Date | undefined,
/** The day that was selected (or clicked) triggering the event. */
selectedDay: Date,
/** The modifiers of the selected day. */
activeModifiers: ActiveModifiers,
e: React.MouseEvent
) => void;

@@ -73,0 +71,0 @@ /**The event handler when the week number is clicked. */

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc