react-day-picker 8.9.1 → 8.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014-2021 Giampaolo Bellavite <io@gpbl.dev> and contributors
3
+ Copyright (c) 2014-2024 Giampaolo Bellavite <io@gpbl.dev> and contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -4,13 +4,11 @@
4
4
 
5
5
  ➡️ **[react-day-picker.js.org](http://react-day-picker.js.org)** for guides, examples and API reference.
6
6
 
7
- <a href="http://react-day-picker.js.org">
8
- <picture>
9
- <source media="(prefers-color-scheme: dark)" srcSet="https://user-images.githubusercontent.com/120693/188241991-19d0e8a1-230a-48c8-8477-3c90d4e36197.png"/>
10
- <source media="(prefers-color-scheme: light)" srcSet="https://user-images.githubusercontent.com/120693/188238076-311ec6d1-503d-4c21-8ffe-d89faa60e40f.png"/>
11
- <img alt="Shows a screenshot of the React DayPicker component in a browser’s window." width="900" />
12
- </picture>
13
- </a>
7
+ <picture>
8
+ <source media="(prefers-color-scheme: dark)" srcSet="https://user-images.githubusercontent.com/120693/188241991-19d0e8a1-230a-48c8-8477-3c90d4e36197.png"/>
9
+ <source media="(prefers-color-scheme: light)" srcSet="https://user-images.githubusercontent.com/120693/188238076-311ec6d1-503d-4c21-8ffe-d89faa60e40f.png"/>
10
+ <img alt="Shows a screenshot of the React DayPicker component in a browser’s window." width="900" />
11
+ </picture>
14
12
 
15
13
  ## Main features
16
14
 
@@ -32,15 +30,7 @@ pnpm install react-day-picker date-fns # using pnpm
32
30
  yarn add react-day-picker date-fns # using yarn
33
31
  ```
34
32
 
35
- <a href="https://www.npmjs.com/package/react-day-picker">
36
- <img src="https://img.shields.io/npm/v/react-day-picker.svg?style=flat-square" alt="npm version"/>
37
- </a> <a href="http://npm-stat.com/charts.html?package=react-day-picker">
38
- <img src="https://img.shields.io/npm/dm/react-day-picker.svg?style=flat-square" alt="npm downloads"/>
39
- </a> <a href="https://github.com/gpbl/react-day-picker/stargazers">
40
- <img src="https://img.shields.io/github/stars/gpbl/react-day-picker?style=flat-square" alt="stars"/>
41
- </a> <a href="https://github.com/sponsors/gpbl">
42
- <img src="https://img.shields.io/github/sponsors/gpbl?style=flat-square" alt="sponsors"/>
43
- </a>
33
+ <a href="https://www.npmjs.com/package/react-day-picker"><img src="https://img.shields.io/npm/v/react-day-picker.svg?style=flat-square" alt="npm version"/></a> <img src="https://img.shields.io/npm/dm/react-day-picker.svg?style=flat-square" alt="npm downloads"/> <img src="https://img.shields.io/bundlephobia/minzip/react-day-picker" alt="Min gzipped size"/>
44
34
 
45
35
  ## Example
46
36
 
package/dist/index.d.ts CHANGED
@@ -68,12 +68,12 @@ declare function Day(props: DayProps): JSX.Element;
68
68
  * const dateMatcher: Matcher = new Date();
69
69
  *
70
70
  * // will match the days in the array
71
- * const arrayMatcher: Matcher = [new Date(2019, 1, 2);, new Date(2019, 1, 4)];
71
+ * const arrayMatcher: Matcher = [new Date(2019, 1, 2), new Date(2019, 1, 4)];
72
72
  *
73
73
  * // will match days after the 2nd of February 2019
74
- * const afterMatcher: DateAfter = { after: new Date(2019, 1, 2); };
74
+ * const afterMatcher: DateAfter = { after: new Date(2019, 1, 2) };
75
75
  * // will match days before the 2nd of February 2019 }
76
- * const beforeMatcher: DateBefore = { before: new Date(2019, 1, 2); };
76
+ * const beforeMatcher: DateBefore = { before: new Date(2019, 1, 2) };
77
77
  *
78
78
  * // will match Sundays
79
79
  * const dayOfWeekMatcher: DayOfWeek = {
@@ -82,13 +82,13 @@ declare function Day(props: DayProps): JSX.Element;
82
82
  *
83
83
  * // will match the included days, except the two dates
84
84
  * const intervalMatcher: DateInterval = {
85
- * after: new Date(2019, 1, 2);,
85
+ * after: new Date(2019, 1, 2),
86
86
  * before: new Date(2019, 1, 5)
87
87
  * };
88
88
  *
89
89
  * // will match the included days, including the two dates
90
90
  * const rangeMatcher: DateRange = {
91
- * from: new Date(2019, 1, 2);,
91
+ * from: new Date(2019, 1, 2),
92
92
  * to: new Date(2019, 1, 5)
93
93
  * };
94
94
  *
@@ -120,7 +120,7 @@ type DateRange = {
120
120
  from: Date | undefined;
121
121
  to?: Date | undefined;
122
122
  };
123
- /** A matcher to match a date being one of the specified days of the week (`0-7`, where `0` is Sunday). */
123
+ /** A matcher to match a date being one of the specified days of the week (`0-6`, where `0` is Sunday). */
124
124
  type DayOfWeek = {
125
125
  dayOfWeek: number[];
126
126
  };
@@ -626,22 +626,23 @@ interface DayPickerBase {
626
626
  /**
627
627
  * The index of the first day of the week (0 - Sunday). Overrides the locale's one.
628
628
  *
629
- * See also {@link ISOWeek}.
629
+ * @see {@link ISOWeek}.
630
630
  */
631
631
  weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
632
632
  /**
633
- * The day of January, which is always in the first week of the year. See also
634
- * https://date-fns.org/docs/getWeek and
635
- * https://en.wikipedia.org/wiki/Week#Numbering
633
+ * The day of January, which is always in the first week of the year. Can be
634
+ * either Monday (`1`) or Thursday (`4`).
636
635
  *
637
- * See also {@link ISOWeek}.
636
+ * @see https://date-fns.org/docs/getWeek
637
+ * @see https://en.wikipedia.org/wiki/Week#Numbering
638
+ * @see {@link ISOWeek}.
638
639
  */
639
- firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
640
+ firstWeekContainsDate?: 1 | 4;
640
641
  /**
641
- * Use ISO week dates instead of the locale setting. See also
642
- * https://en.wikipedia.org/wiki/ISO_week_date.
642
+ * Use ISO week dates instead of the locale setting. Setting this prop will
643
+ * ignore {@link weekStartsOn} and {@link firstWeekContainsDate}.
643
644
  *
644
- * Setting this prop will ignore {@link weekStartsOn} and {@link firstWeekContainsDate}.
645
+ * @see https://en.wikipedia.org/wiki/ISO_week_date
645
646
  */
646
647
  ISOWeek?: boolean;
647
648
  /**
@@ -791,9 +792,7 @@ interface DayPickerBase {
791
792
  /**
792
793
  * Map of the components that can be changed using the `components` prop.
793
794
  *
794
- * Look at the [components
795
- * source](https://github.com/gpbl/react-day-picker/tree/main/src/components)
796
- * to understand how internal components are built.
795
+ * @see https://github.com/gpbl/react-day-picker/tree/main/src/components
797
796
  */
798
797
  interface CustomComponents {
799
798
  /** The component for the caption element. */
@@ -1219,10 +1218,11 @@ declare function NavigationProvider(props: {
1219
1218
  */
1220
1219
  declare function useNavigation(): NavigationContextValue;
1221
1220
 
1221
+ type RootContextProps = Partial<DayPickerDefaultProps> | Partial<DayPickerSingleProps> | Partial<DayPickerMultipleProps> | Partial<DayPickerRangeProps>;
1222
1222
  /** The props of {@link RootProvider}. */
1223
- interface RootContext {
1223
+ type RootContext = RootContextProps & {
1224
1224
  children?: ReactNode;
1225
- }
1225
+ };
1226
1226
  /** Provide the value for all the context providers. */
1227
1227
  declare function RootProvider(props: RootContext): JSX.Element;
1228
1228
 
@@ -1360,4 +1360,4 @@ declare function isMatch(day: Date, matchers: Matcher[]): boolean;
1360
1360
  */
1361
1361
  declare function addToRange(day: Date, range?: DateRange): DateRange | undefined;
1362
1362
 
1363
- export { ActiveModifiers, Button, ButtonProps, Caption, CaptionDropdowns, CaptionLabel, CaptionLabelProps, CaptionLayout, CaptionNavigation, CaptionProps, ClassNames, CustomComponents, CustomModifiers, DateAfter, DateBefore, DateFormatter, DateInterval, DateRange, Day, DayClickEventHandler, DayContent, DayContentProps, DayFocusEventHandler, DayKeyboardEventHandler, DayLabel, DayModifiers, DayMouseEventHandler, DayOfWeek, DayPicker, DayPickerBase, DayPickerContext, DayPickerContextValue, DayPickerDefaultProps, DayPickerMultipleProps, DayPickerProps, DayPickerProvider, DayPickerProviderProps, DayPickerRangeProps, DayPickerSingleProps, DayPointerEventHandler, DayProps, DayRender, DaySelectionMode, DayTouchEventHandler, Dropdown, DropdownProps, FocusContext, FocusContextValue, FocusProvider, FocusProviderProps, Footer, FooterProps, Formatters, Head, HeadRow, IconDropdown, IconLeft, IconRight, InputDayPickerProps, InputProps, InternalModifier, InternalModifiers, InternalModifiersElement, Labels, Matcher, Modifier, Modifiers, ModifiersClassNames, ModifiersStyles, MonthChangeEventHandler, Months, MonthsProps, NavButtonLabel, NavigationContext, NavigationContextValue, NavigationProvider, RootContext, RootProvider, Row, RowProps, SelectMultipleContext, SelectMultipleContextValue, SelectMultipleEventHandler, SelectMultipleModifiers, SelectMultipleProvider, SelectMultipleProviderInternal, SelectMultipleProviderInternalProps, SelectMultipleProviderProps, SelectRangeContext, SelectRangeContextValue, SelectRangeEventHandler, SelectRangeModifiers, SelectRangeProvider, SelectRangeProviderInternal, SelectRangeProviderInternalProps, SelectRangeProviderProps, SelectSingleContext, SelectSingleContextValue, SelectSingleEventHandler, SelectSingleProvider, SelectSingleProviderInternal, SelectSingleProviderProps, StyledComponent, StyledElement, Styles, UseInputOptions, UseInputValue, WeekNumber, WeekNumberClickEventHandler, WeekNumberFormatter, WeekNumberLabel, WeekNumberProps, WeekdayLabel, addToRange, isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, isDayOfWeekType, isDayPickerDefault, isDayPickerMultiple, isDayPickerRange, isDayPickerSingle, isMatch, useActiveModifiers, useDayPicker, useDayRender, useFocusContext, useInput, useNavigation, useSelectMultiple, useSelectRange, useSelectSingle };
1363
+ export { type ActiveModifiers, Button, type ButtonProps, Caption, CaptionDropdowns, CaptionLabel, type CaptionLabelProps, type CaptionLayout, CaptionNavigation, type CaptionProps, type ClassNames, type CustomComponents, type CustomModifiers, type DateAfter, type DateBefore, type DateFormatter, type DateInterval, type DateRange, Day, type DayClickEventHandler, DayContent, type DayContentProps, type DayFocusEventHandler, type DayKeyboardEventHandler, type DayLabel, type DayModifiers, type DayMouseEventHandler, type DayOfWeek, DayPicker, type DayPickerBase, DayPickerContext, type DayPickerContextValue, type DayPickerDefaultProps, type DayPickerMultipleProps, type DayPickerProps, DayPickerProvider, type DayPickerProviderProps, type DayPickerRangeProps, type DayPickerSingleProps, type DayPointerEventHandler, type DayProps, type DayRender, type DaySelectionMode, type DayTouchEventHandler, Dropdown, type DropdownProps, FocusContext, type FocusContextValue, FocusProvider, type FocusProviderProps, Footer, type FooterProps, type Formatters, Head, HeadRow, IconDropdown, IconLeft, IconRight, type InputDayPickerProps, type InputProps, InternalModifier, type InternalModifiers, type InternalModifiersElement, type Labels, type Matcher, type Modifier, type Modifiers, type ModifiersClassNames, type ModifiersStyles, type MonthChangeEventHandler, Months, type MonthsProps, type NavButtonLabel, NavigationContext, type NavigationContextValue, NavigationProvider, type RootContext, RootProvider, Row, type RowProps, SelectMultipleContext, type SelectMultipleContextValue, type SelectMultipleEventHandler, type SelectMultipleModifiers, SelectMultipleProvider, SelectMultipleProviderInternal, type SelectMultipleProviderInternalProps, type SelectMultipleProviderProps, SelectRangeContext, type SelectRangeContextValue, type SelectRangeEventHandler, type SelectRangeModifiers, SelectRangeProvider, SelectRangeProviderInternal, type SelectRangeProviderInternalProps, type SelectRangeProviderProps, SelectSingleContext, type SelectSingleContextValue, type SelectSingleEventHandler, SelectSingleProvider, SelectSingleProviderInternal, type SelectSingleProviderProps, type StyledComponent, type StyledElement, type Styles, type UseInputOptions, type UseInputValue, WeekNumber, type WeekNumberClickEventHandler, type WeekNumberFormatter, type WeekNumberLabel, type WeekNumberProps, type WeekdayLabel, addToRange, isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, isDayOfWeekType, isDayPickerDefault, isDayPickerMultiple, isDayPickerRange, isDayPickerSingle, isMatch, useActiveModifiers, useDayPicker, useDayRender, useFocusContext, useInput, useNavigation, useSelectMultiple, useSelectRange, useSelectSingle };