react-day-picker 8.0.0-beta.38 → 8.0.0-beta.39

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/DayPicker.d.ts +0 -1
  3. package/dist/components/Caption/Caption.d.ts +0 -1
  4. package/dist/components/CaptionLabel/CaptionLabel.d.ts +0 -1
  5. package/dist/components/Day/Day.d.ts +0 -1
  6. package/dist/components/DayContent/DayContent.d.ts +0 -1
  7. package/dist/components/Footer/Footer.d.ts +0 -1
  8. package/dist/components/Head/Head.d.ts +0 -1
  9. package/dist/components/IconDropdown/IconDropdown.d.ts +0 -1
  10. package/dist/components/IconLeft/IconLeft.d.ts +0 -1
  11. package/dist/components/IconRight/IconRight.d.ts +0 -1
  12. package/dist/components/Month/Month.d.ts +0 -1
  13. package/dist/components/MonthsDropdown/MonthsDropdown.d.ts +0 -1
  14. package/dist/components/Root/Root.d.ts +0 -1
  15. package/dist/components/Row/Row.d.ts +0 -1
  16. package/dist/components/Table/Table.d.ts +0 -1
  17. package/dist/components/Table/utils/daysToMonthWeeks.d.ts +8 -0
  18. package/dist/components/Table/utils/getMonthWeeks.d.ts +21 -0
  19. package/dist/components/WeekNumber/WeekNumber.d.ts +0 -1
  20. package/dist/components/YearsDropdown/YearsDropdown.d.ts +0 -1
  21. package/dist/contexts/Modifiers/utils/isMatch.d.ts +17 -1
  22. package/dist/contexts/Navigation/NavigationContext.d.ts +3 -3
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.esm.js +147 -186
  25. package/dist/index.esm.js.map +1 -1
  26. package/dist/index.js +147 -185
  27. package/dist/index.js.map +1 -1
  28. package/dist/react-day-picker.min.js +1 -1
  29. package/dist/style.css.d.ts +35 -36
  30. package/dist/types/Matchers.d.ts +51 -1
  31. package/package.json +20 -20
  32. package/dist/components/Table/utils/getOutsideEndDays.d.ts +0 -3
  33. package/dist/components/Table/utils/getOutsideStartDays.d.ts +0 -4
  34. package/dist/components/Table/utils/getWeeks.d.ts +0 -17
package/CHANGELOG.md CHANGED
@@ -18,6 +18,13 @@ See the preview website at https://react-day-picker-next.netlify.app.
18
18
 
19
19
  ---
20
20
 
21
+ ### v8.0.0-beta.39
22
+
23
+ - chore: cleaned up icon components
24
+ - chore: exported `isMatch` function
25
+ - fix: useNavigation not setting the start of the month
26
+ - chore: completed unit tests
27
+
21
28
  ### v8.0.0-beta.38
22
29
 
23
30
  - fix(regression): restore missing `Caption` component
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { DayPickerProps } from './types/DayPicker';
3
2
  import { DayPickerCustomProps } from './types/DayPickerCustom';
4
3
  import { DayPickerMultipleProps } from './types/DayPickerMultiple';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /** Represent the props of the [[Caption]] component. */
3
2
  export interface CaptionProps {
4
3
  /** The ID for the heading element. Must be the same as the labelled-by in Table. */
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /** The props for the [[CaptionLabel]] component. */
3
2
  export interface CaptionLabelProps {
4
3
  /** The ID for the heading element. Must be the same as the labelled-by in Table. */
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /** Represent the props used by the [[Day]] component. */
3
2
  export interface DayProps {
4
3
  /** The month where the date is displayed. */
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ActiveModifiers } from '../../types/Modifiers';
3
2
  /** Represent the props for the [[DayContent]] component. */
4
3
  export interface DayContentProps {
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  /** Render the Footer component (empty as default).*/
3
2
  export declare function Footer(): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Render the Head component - i.e. the table head with the weekday names.
4
3
  */
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { StyledComponent } from '../../types/Styles';
3
2
  /**
4
3
  * Render the icon in the styled drop-down.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { StyledComponent } from '../../types/Styles';
3
2
  /**
4
3
  * Render the "previous month" button in the navigation.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { StyledComponent } from '../../types/Styles';
3
2
  /**
4
3
  * Render the "next month" button in the navigation.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /** The props for the [[Month]] component. */
3
2
  export interface MonthProps {
4
3
  displayIndex: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { MonthChangeEventHandler } from '../../types/EventHandlers';
3
2
  /** The props for the [[MonthsDropdown]] component. */
4
3
  export interface MonthsDropdownProps {
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  /** Render the container with the months according to the number of months to display. */
3
2
  export declare function Root(): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * The props for the [[Row]] component.
4
3
  */
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /** The props for the [[Table]] component. */
3
2
  export interface TableProps {
4
3
  /** The ID of the label of the table (the same given to the Caption). */
@@ -0,0 +1,8 @@
1
+ import { Locale } from 'date-fns';
2
+ import { MonthWeek } from './getMonthWeeks';
3
+ /** Return the weeks between two dates. */
4
+ export declare function daysToMonthWeeks(fromDate: Date, toDate: Date, options?: {
5
+ locale?: Locale;
6
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
7
+ firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
8
+ }): MonthWeek[];
@@ -0,0 +1,21 @@
1
+ import { Locale } from 'date-fns';
2
+ /** Represents a week in the month.*/
3
+ export declare type MonthWeek = {
4
+ /** The week number from the start of the year. */
5
+ weekNumber: number;
6
+ /** The dates in the week. */
7
+ dates: Date[];
8
+ };
9
+ /**
10
+ * Return the weeks belonging to the given month, adding the "outside days" to
11
+ * the first and last week.
12
+ */
13
+ export declare function getMonthWeeks(
14
+ /** The month to get the weeks from */
15
+ month: Date, options: {
16
+ locale: Locale;
17
+ /** Add extra weeks up to 6 weeks */
18
+ useFixedWeeks?: boolean;
19
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
20
+ firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
21
+ }): MonthWeek[];
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * The props for the [[WeekNumber]] component.
4
3
  */
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { MonthChangeEventHandler } from '../../types/EventHandlers';
3
2
  /**
4
3
  * The props for the [[YearsDropdown]] component.
@@ -1,3 +1,19 @@
1
1
  import { Matcher } from '../../../types/Matchers';
2
- /** Returns `true` whether the day matches against the given matchers. */
2
+ /**
3
+ * Returns whether a day matches against at least one of the given Matchers.
4
+ *
5
+ * ```
6
+ * const day = new Date(2022, 5, 19);
7
+ * const matcher1: DateRange = {
8
+ * from: new Date(2021, 12, 21),
9
+ * to: new Date(2021, 12, 30)
10
+ * }
11
+ * const matcher2: DateRange = {
12
+ * from: new Date(2022, 5, 1),
13
+ * to: new Date(2022, 5, 23)
14
+ * }
15
+ *
16
+ * const isMatch(day, [matcher1, matcher2]); // true, since day is in the matcher1 range.
17
+ * ```
18
+ * */
3
19
  export declare function isMatch(day: Date, matchers: Matcher[]): boolean;
@@ -1,8 +1,8 @@
1
1
  import React, { ReactNode } from 'react';
2
2
  /** Represents the value of the [[NavigationContext]]. */
3
3
  export interface NavigationContextValue {
4
- /** The current month. Note that when `numberOfMonths > 1` represent the first month in the displayed months. */
5
- month: Date;
4
+ /** The month to display in the calendar. Note that when `numberOfMonths > 1` represent the first month in the displayed months. */
5
+ currentMonth: Date;
6
6
  /** The months rendered by DayPicker. DayPicker can render one than one month via `numberOfMonths`. */
7
7
  displayMonths: Date[];
8
8
  /** Navigate to the specified month. */
@@ -13,7 +13,7 @@ export interface NavigationContextValue {
13
13
  nextMonth?: Date;
14
14
  /** The previous month to display. `undefined` if no months left */
15
15
  previousMonth?: Date;
16
- /** Return true if the day is displayed in the calendar. */
16
+ /** Return true if the day is currently included in the months displayed in the calendar. */
17
17
  isDateDisplayed: (day: Date) => boolean;
18
18
  }
19
19
  /**
package/dist/index.d.ts CHANGED
@@ -33,3 +33,4 @@ export * from './types/Labels';
33
33
  export * from './types/Matchers';
34
34
  export * from './types/Modifiers';
35
35
  export * from './types/Styles';
36
+ export * from './contexts/Modifiers/utils/isMatch';