Repository: gpbl/react-day-picker
Pull request #2093 (2024-04-21 23:35:00)

build: flat components directory
To reduce the diff with the upcoming updates, I'm flatting the `src/components` directory.


Patch:
diff --git a/jest.config.ts b/jest.config.ts
index 8a0a02561..4f31e7525 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -4,11 +4,7 @@ const config: Config.InitialOptions = {
   preset: "ts-jest",
   roots: ["./src"],
   moduleNameMapper: {
-    "^test/(.*)": ["<rootDir>/test/$1"],
-    "^components(.*)": ["<rootDir>/src/components$1"],
-    "^contexts(.*)": ["<rootDir>/src/contexts$1"],
-    "^hooks(.*)": ["<rootDir>/src/hooks$1"],
-    "^types(.*)": ["<rootDir>/src/types$1"]
+    "@/test/(.*)": ["<rootDir>/test/$1"]
   },
   testEnvironment: "jsdom",
   coverageReporters: ["lcov", "text", "clover"],
diff --git a/react-day-picker.code-workspace b/react-day-picker.code-workspace
index d1511c95a..9de744573 100644
--- a/react-day-picker.code-workspace
+++ b/react-day-picker.code-workspace
@@ -134,6 +134,8 @@
     ],
     "jest.disabledWorkspaceFolders": ["repository"],
     "npm.packageManager": "pnpm",
-    "task.allowAutomaticTasks": "on"
+    "task.allowAutomaticTasks": "on",
+    "typescript.updateImportsOnFileMove.enabled": "always",
+    "javascript.updateImportsOnFileMove.enabled": "always"
   }
 }
diff --git a/src/components/Button/Button.tsx b/src/components/Button.tsx
similarity index 93%
rename from src/components/Button/Button.tsx
rename to src/components/Button.tsx
index b874c3871..2fde97bea 100644
--- a/src/components/Button/Button.tsx
+++ b/src/components/Button.tsx
@@ -1,6 +1,5 @@
 import { forwardRef } from "react";
-
-import { useDayPicker } from "../../contexts/DayPicker";
+import { useDayPicker } from "../contexts/DayPicker";
 
 /** The props for the {@link Button} component. */
 export type ButtonProps = JSX.IntrinsicElements["button"];
diff --git a/src/components/Button/index.ts b/src/components/Button/index.ts
deleted file mode 100644
index e22c29adc..000000000
--- a/src/components/Button/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Button";
diff --git a/src/components/Caption/Caption.tsx b/src/components/Caption.tsx
similarity index 89%
rename from src/components/Caption/Caption.tsx
rename to src/components/Caption.tsx
index 7236063b7..7eb2f8860 100644
--- a/src/components/Caption/Caption.tsx
+++ b/src/components/Caption.tsx
@@ -1,7 +1,7 @@
-import { CaptionDropdowns } from "../../components/CaptionDropdowns";
-import { CaptionLabel } from "../../components/CaptionLabel";
-import { CaptionNavigation } from "../../components/CaptionNavigation";
-import { useDayPicker } from "../../contexts/DayPicker";
+import { CaptionDropdowns } from "./CaptionDropdowns";
+import { CaptionLabel } from "./CaptionLabel";
+import { CaptionNavigation } from "./CaptionNavigation";
+import { useDayPicker } from "../contexts/DayPicker";
 
 /** Represent the props of the {@link Caption} component. */
 export interface CaptionProps {
diff --git a/src/components/Caption/index.ts b/src/components/Caption/index.ts
deleted file mode 100644
index 4fe362c9d..000000000
--- a/src/components/Caption/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Caption";
diff --git a/src/components/CaptionDropdowns/CaptionDropdowns.tsx b/src/components/CaptionDropdowns.tsx
similarity index 71%
rename from src/components/CaptionDropdowns/CaptionDropdowns.tsx
rename to src/components/CaptionDropdowns.tsx
index bcd72e92f..c1df1f7ce 100644
--- a/src/components/CaptionDropdowns/CaptionDropdowns.tsx
+++ b/src/components/CaptionDropdowns.tsx
@@ -1,12 +1,12 @@
 import { addMonths } from "date-fns";
 
-import { CaptionProps } from "../../components/Caption/Caption";
-import { CaptionLabel } from "../../components/CaptionLabel";
-import { MonthsDropdown } from "../../components/MonthsDropdown";
-import { YearsDropdown } from "../../components/YearsDropdown";
-import { useDayPicker } from "../../contexts/DayPicker";
-import { useNavigation } from "../../contexts/Navigation";
-import { MonthChangeEventHandler } from "../../types/EventHandlers";
+import { CaptionLabel } from "./CaptionLabel";
+import { MonthsDropdown } from "./MonthsDropdown";
+import { YearsDropdown } from "./YearsDropdown";
+import { useDayPicker } from "../contexts/DayPicker";
+import { useNavigation } from "../contexts/Navigation";
+import { MonthChangeEventHandler } from "../types/EventHandlers";
+import { CaptionProps } from "./Caption";
 
 /** Render a caption with the dropdowns to navigate between months and years. */
 export function CaptionDropdowns(props: CaptionProps): JSX.Element {
diff --git a/src/components/CaptionDropdowns/index.ts b/src/components/CaptionDropdowns/index.ts
deleted file mode 100644
index 5f63f4ede..000000000
--- a/src/components/CaptionDropdowns/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./CaptionDropdowns";
diff --git a/src/components/CaptionLabel/CaptionLabel.tsx b/src/components/CaptionLabel.tsx
similarity index 94%
rename from src/components/CaptionLabel/CaptionLabel.tsx
rename to src/components/CaptionLabel.tsx
index a0c30d534..bbd781ec8 100644
--- a/src/components/CaptionLabel/CaptionLabel.tsx
+++ b/src/components/CaptionLabel.tsx
@@ -1,4 +1,4 @@
-import { useDayPicker } from "../../contexts/DayPicker";
+import { useDayPicker } from "../contexts/DayPicker";
 
 /** The props for the {@link CaptionLabel} component. */
 export interface CaptionLabelProps {
diff --git a/src/components/CaptionLabel/index.ts b/src/components/CaptionLabel/index.ts
deleted file mode 100644
index e1373da1e..000000000
--- a/src/components/CaptionLabel/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./CaptionLabel";
diff --git a/src/components/CaptionNavigation/CaptionNavigation.tsx b/src/components/CaptionNavigation.tsx
similarity index 83%
rename from src/components/CaptionNavigation/CaptionNavigation.tsx
rename to src/components/CaptionNavigation.tsx
index 8e0a07d7b..5bb2153bc 100644
--- a/src/components/CaptionNavigation/CaptionNavigation.tsx
+++ b/src/components/CaptionNavigation.tsx
@@ -2,10 +2,10 @@ import { MouseEventHandler } from "react";
 
 import { isSameMonth } from "date-fns";
 
-import { CaptionProps } from "../../components/Caption/Caption";
-import { Navigation } from "../../components/Navigation";
-import { useDayPicker } from "../../contexts/DayPicker";
-import { useNavigation } from "../../contexts/Navigation";
+import { CaptionProps } from "./Caption";
+import { Navigation } from "./Navigation";
+import { useDayPicker } from "../contexts/DayPicker";
+import { useNavigation } from "../contexts/Navigation";
 
 /** Render a caption with a button-based navigation. */
 export function CaptionNavigation(props: CaptionProps): JSX.Element {
diff --git a/src/components/CaptionNavigation/index.ts b/src/components/CaptionNavigation/index.ts
deleted file mode 100644
index f7cf28683..000000000
--- a/src/components/CaptionNavigation/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./CaptionNavigation";
diff --git a/src/components/Day/Day.tsx b/src/components/Day.tsx
similarity index 88%
rename from src/components/Day/Day.tsx
rename to src/components/Day.tsx
index be21ea4fb..19e6f3796 100644
--- a/src/components/Day/Day.tsx
+++ b/src/components/Day.tsx
@@ -1,8 +1,8 @@
 import { useRef } from "react";
 
-import { useDayRender } from "../../hooks/useDayRender";
+import { useDayRender } from "../hooks/useDayRender";
 
-import { Button } from "../Button";
+import { Button } from "./Button";
 
 /** Represent the props used by the {@link Day} component. */
 export interface DayProps {
diff --git a/src/components/DayContent/DayContent.tsx b/src/components/DayContent.tsx
similarity index 82%
rename from src/components/DayContent/DayContent.tsx
rename to src/components/DayContent.tsx
index 7ac508fcc..6e59b915e 100644
--- a/src/components/DayContent/DayContent.tsx
+++ b/src/components/DayContent.tsx
@@ -1,5 +1,5 @@
-import { useDayPicker } from "../../contexts/DayPicker";
-import { ActiveModifiers } from "../../types/Modifiers";
+import { useDayPicker } from "../contexts/DayPicker";
+import { ActiveModifiers } from "../types/Modifiers";
 
 /** Represent the props for the {@link DayContent} component. */
 export interface DayContentProps {
diff --git a/src/components/DayContent/index.ts b/src/components/DayContent/index.ts
deleted file mode 100644
index ec83baeec..000000000
--- a/src/components/DayContent/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./DayContent";
diff --git a/src/components/Dropdown/Dropdown.tsx b/src/components/Dropdown.tsx
similarity index 93%
rename from src/components/Dropdown/Dropdown.tsx
rename to src/components/Dropdown.tsx
index 3c9a59058..dacc6e3f9 100644
--- a/src/components/Dropdown/Dropdown.tsx
+++ b/src/components/Dropdown.tsx
@@ -5,8 +5,8 @@ import {
   SelectHTMLAttributes
 } from "react";
 
-import { IconDropdown } from "../../components/IconDropdown";
-import { useDayPicker } from "../../contexts/DayPicker";
+import { IconDropdown } from "./IconDropdown";
+import { useDayPicker } from "../contexts/DayPicker";
 
 /** The props for the {@link Dropdown} component. */
 export interface DropdownProps {
diff --git a/src/components/Dropdown/index.ts b/src/components/Dropdown/index.ts
deleted file mode 100644
index f024a9e9a..000000000
--- a/src/components/Dropdown/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Dropdown";
diff --git a/src/components/Footer/Footer.tsx b/src/components/Footer.tsx
similarity index 90%
rename from src/components/Footer/Footer.tsx
rename to src/components/Footer.tsx
index c16a5e36f..e82d073f1 100644
--- a/src/components/Footer/Footer.tsx
+++ b/src/components/Footer.tsx
@@ -1,4 +1,4 @@
-import { useDayPicker } from "../../contexts/DayPicker";
+import { useDayPicker } from "../contexts/DayPicker";
 
 export interface FooterProps {
   /** The month where the footer is displayed. */
diff --git a/src/components/Footer/index.ts b/src/components/Footer/index.ts
deleted file mode 100644
index 5fca53f7d..000000000
--- a/src/components/Footer/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Footer";
diff --git a/src/components/Head/Head.tsx b/src/components/Head.tsx
similarity index 73%
rename from src/components/Head/Head.tsx
rename to src/components/Head.tsx
index 7333f7cc8..9557db221 100644
--- a/src/components/Head/Head.tsx
+++ b/src/components/Head.tsx
@@ -1,5 +1,5 @@
-import { HeadRow } from "../../components/HeadRow";
-import { useDayPicker } from "../../contexts/DayPicker";
+import { HeadRow } from "./HeadRow";
+import { useDayPicker } from "../contexts/DayPicker";
 
 /** Render the table head. */
 export function Head(): JSX.Element {
diff --git a/src/components/Head/index.ts b/src/components/Head/index.ts
deleted file mode 100644
index f5ad9af4c..000000000
--- a/src/components/Head/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Head";
diff --git a/src/components/HeadRow/HeadRow.tsx b/src/components/HeadRow.tsx
similarity index 89%
rename from src/components/HeadRow/HeadRow.tsx
rename to src/components/HeadRow.tsx
index 13e62ea5e..84b430928 100644
--- a/src/components/HeadRow/HeadRow.tsx
+++ b/src/components/HeadRow.tsx
@@ -1,6 +1,6 @@
-import { useDayPicker } from "../../contexts/DayPicker";
+import { useDayPicker } from "../contexts/DayPicker";
 
-import { getWeekdays } from "./utils";
+import { getWeekdays } from "./utils/getWeekdays";
 
 /**
  * Render the HeadRow component - i.e. the table head row with the weekday
diff --git a/src/components/HeadRow/index.ts b/src/components/HeadRow/index.ts
deleted file mode 100644
index 507fdedc9..000000000
--- a/src/components/HeadRow/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./HeadRow";
diff --git a/src/components/IconDropdown/IconDropdown.tsx b/src/components/IconDropdown.tsx
similarity index 94%
rename from src/components/IconDropdown/IconDropdown.tsx
rename to src/components/IconDropdown.tsx
index df4b46471..5e6de74dc 100644
--- a/src/components/IconDropdown/IconDropdown.tsx
+++ b/src/components/IconDropdown.tsx
@@ -1,4 +1,4 @@
-import { StyledComponent } from "../../types/Styles";
+import { StyledComponent } from "../types/Styles";
 
 /** Render the icon in the styled drop-down. */
 export function IconDropdown(props: StyledComponent): JSX.Element {
diff --git a/src/components/IconDropdown/index.ts b/src/components/IconDropdown/index.ts
deleted file mode 100644
index 367fc7217..000000000
--- a/src/components/IconDropdown/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./IconDropdown";
diff --git a/src/components/IconLeft/IconLeft.tsx b/src/components/IconLeft.tsx
similarity index 94%
rename from src/components/IconLeft/IconLeft.tsx
rename to src/components/IconLeft.tsx
index 33aed93b5..5d7c3fe62 100644
--- a/src/components/IconLeft/IconLeft.tsx
+++ b/src/components/IconLeft.tsx
@@ -1,4 +1,4 @@
-import { StyledComponent } from "../../types/Styles";
+import { StyledComponent } from "../types/Styles";
 
 /** Render the "previous month" button in the navigation. */
 export function IconLeft(props: StyledComponent): JSX.Element {
diff --git a/src/components/IconLeft/index.ts b/src/components/IconLeft/index.ts
deleted file mode 100644
index abe86842c..000000000
--- a/src/components/IconLeft/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./IconLeft";
diff --git a/src/components/IconRight/IconRight.tsx b/src/components/IconRight.tsx
similarity index 93%
rename from src/components/IconRight/IconRight.tsx
rename to src/components/IconRight.tsx
index dd3ac55c9..6cce3c8e3 100644
--- a/src/components/IconRight/IconRight.tsx
+++ b/src/components/IconRight.tsx
@@ -1,4 +1,4 @@
-import { StyledComponent } from "../../types/Styles";
+import { StyledComponent } from "../types/Styles";
 
 /** Render the "next month" button in the navigation. */
 export function IconRight(props: StyledComponent): JSX.Element {
diff --git a/src/components/IconRight/index.ts b/src/components/IconRight/index.ts
deleted file mode 100644
index 8bbe0d3a5..000000000
--- a/src/components/IconRight/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./IconRight";
diff --git a/src/components/Month/Month.tsx b/src/components/Month.tsx
similarity index 86%
rename from src/components/Month/Month.tsx
rename to src/components/Month.tsx
index dc13c31db..0d26d9e51 100644
--- a/src/components/Month/Month.tsx
+++ b/src/components/Month.tsx
@@ -1,8 +1,8 @@
-import { Caption } from "../../components/Caption";
-import { Table } from "../../components/Table";
-import { useDayPicker } from "../../contexts/DayPicker";
-import { useNavigation } from "../../contexts/Navigation";
-import { useId } from "../../hooks/useId";
+import { Caption } from "./Caption";
+import { Table } from "./Table";
+import { useDayPicker } from "../contexts/DayPicker";
+import { useNavigation } from "../contexts/Navigation";
+import { useId } from "../hooks/useId";
 
 /** The props for the {@link Month} component. */
 export interface MonthProps {
diff --git a/src/components/Month/index.ts b/src/components/Month/index.ts
deleted file mode 100644
index 83b8c8549..000000000
--- a/src/components/Month/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Month";
diff --git a/src/components/Months/Months.tsx b/src/components/Months.tsx
similarity index 87%
rename from src/components/Months/Months.tsx
rename to src/components/Months.tsx
index 2a6e8f010..764c1faf2 100644
--- a/src/components/Months/Months.tsx
+++ b/src/components/Months.tsx
@@ -1,6 +1,6 @@
 import { ReactNode } from "react";
 
-import { useDayPicker } from "../../contexts/DayPicker";
+import { useDayPicker } from "../contexts/DayPicker";
 
 /** The props for the {@link Months} component. */
 export type MonthsProps = { children: ReactNode };
diff --git a/src/components/Months/index.ts b/src/components/Months/index.ts
deleted file mode 100644
index e087e7ba5..000000000
--- a/src/components/Months/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Months";
diff --git a/src/components/MonthsDropdown/MonthsDropdown.tsx b/src/components/MonthsDropdown.tsx
similarity index 92%
rename from src/components/MonthsDropdown/MonthsDropdown.tsx
rename to src/components/MonthsDropdown.tsx
index 5eeeb0517..a92117dc4 100644
--- a/src/components/MonthsDropdown/MonthsDropdown.tsx
+++ b/src/components/MonthsDropdown.tsx
@@ -2,9 +2,9 @@ import { ChangeEventHandler } from "react";
 
 import { isSameYear, setMonth, startOfMonth } from "date-fns";
 
-import { Dropdown } from "../../components/Dropdown";
-import { useDayPicker } from "../../contexts/DayPicker";
-import { MonthChangeEventHandler } from "../../types/EventHandlers";
+import { Dropdown } from "./Dropdown";
+import { useDayPicker } from "../contexts/DayPicker";
+import { MonthChangeEventHandler } from "../types/EventHandlers";
 
 /** The props for the {@link MonthsDropdown} component. */
 export interface MonthsDropdownProps {
diff --git a/src/components/MonthsDropdown/index.ts b/src/components/MonthsDropdown/index.ts
deleted file mode 100644
index 782f1716f..000000000
--- a/src/components/MonthsDropdown/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./MonthsDropdown";
diff --git a/src/components/Navigation/Navigation.tsx b/src/components/Navigation.tsx
similarity index 93%
rename from src/components/Navigation/Navigation.tsx
rename to src/components/Navigation.tsx
index c434e0a37..d6354aa24 100644
--- a/src/components/Navigation/Navigation.tsx
+++ b/src/components/Navigation.tsx
@@ -1,10 +1,10 @@
 import { MouseEventHandler } from "react";
 
-import { IconLeft } from "../../components/IconLeft";
-import { IconRight } from "../../components/IconRight";
-import { useDayPicker } from "../../contexts/DayPicker";
+import { IconLeft } from "./IconLeft";
+import { IconRight } from "./IconRight";
+import { useDayPicker } from "../contexts/DayPicker";
 
-import { Button } from "../Button";
+import { Button } from "./Button";
 
 /** The props for the {@link Navigation} component. */
 export interface NavigationProps {
diff --git a/src/components/Navigation/index.ts b/src/components/Navigation/index.ts
deleted file mode 100644
index 8953bdfab..000000000
--- a/src/components/Navigation/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Navigation";
diff --git a/src/components/Root/Root.tsx b/src/components/Root.tsx
similarity index 87%
rename from src/components/Root/Root.tsx
rename to src/components/Root.tsx
index e14af836f..990eb024e 100644
--- a/src/components/Root/Root.tsx
+++ b/src/components/Root.tsx
@@ -1,12 +1,12 @@
 import { useEffect, useState } from "react";
 
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { Month } from "../../components/Month";
-import { Months } from "../../components/Months";
-import { useDayPicker } from "../../contexts/DayPicker";
-import { useFocusContext } from "../../contexts/Focus";
-import { useNavigation } from "../../contexts/Navigation";
+import { Month } from "./Month";
+import { Months } from "./Months";
+import { useDayPicker } from "../contexts/DayPicker";
+import { useFocusContext } from "../contexts/Focus";
+import { useNavigation } from "../contexts/Navigation";
 
 function isDataAttributes(attrs: DayPickerProps): attrs is {
   [key: string]: string | boolean | number | undefined;
diff --git a/src/components/Root/index.ts b/src/components/Root/index.ts
deleted file mode 100644
index 467d41e42..000000000
--- a/src/components/Root/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Root";
diff --git a/src/components/Row/Row.tsx b/src/components/Row.tsx
similarity index 88%
rename from src/components/Row/Row.tsx
rename to src/components/Row.tsx
index 8a0e3eac2..4b01f609b 100644
--- a/src/components/Row/Row.tsx
+++ b/src/components/Row.tsx
@@ -1,8 +1,8 @@
 import { getUnixTime } from "date-fns";
 
-import { Day } from "../../components/Day";
-import { WeekNumber } from "../../components/WeekNumber";
-import { useDayPicker } from "../../contexts/DayPicker";
+import { Day } from "./Day";
+import { WeekNumber } from "./WeekNumber";
+import { useDayPicker } from "../contexts/DayPicker";
 
 /** The props for the {@link Row} component. */
 export interface RowProps {
diff --git a/src/components/Row/index.ts b/src/components/Row/index.ts
deleted file mode 100644
index 8189e64ff..000000000
--- a/src/components/Row/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Row";
diff --git a/src/components/Table/Table.tsx b/src/components/Table.tsx
similarity index 88%
rename from src/components/Table/Table.tsx
rename to src/components/Table.tsx
index 134ed89d6..71f0d8828 100644
--- a/src/components/Table/Table.tsx
+++ b/src/components/Table.tsx
@@ -1,7 +1,7 @@
-import { Footer } from "../../components/Footer";
-import { Head } from "../../components/Head";
-import { Row } from "../../components/Row";
-import { useDayPicker } from "../../contexts/DayPicker";
+import { Footer } from "./Footer";
+import { Head } from "./Head";
+import { Row } from "./Row";
+import { useDayPicker } from "../contexts/DayPicker";
 
 import { getMonthWeeks } from "./utils/getMonthWeeks";
 
diff --git a/src/components/Table/index.ts b/src/components/Table/index.ts
deleted file mode 100644
index e40efa476..000000000
--- a/src/components/Table/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./Table";
diff --git a/src/components/WeekNumber/WeekNumber.tsx b/src/components/WeekNumber.tsx
similarity index 93%
rename from src/components/WeekNumber/WeekNumber.tsx
rename to src/components/WeekNumber.tsx
index 2eb5b0c2d..60f2b1929 100644
--- a/src/components/WeekNumber/WeekNumber.tsx
+++ b/src/components/WeekNumber.tsx
@@ -1,8 +1,8 @@
 import { MouseEventHandler } from "react";
 
-import { useDayPicker } from "../../contexts/DayPicker";
+import { useDayPicker } from "../contexts/DayPicker";
 
-import { Button } from "../Button";
+import { Button } from "./Button";
 
 /** The props for the {@link WeekNumber} component. */
 export interface WeekNumberProps {
diff --git a/src/components/WeekNumber/index.ts b/src/components/WeekNumber/index.ts
deleted file mode 100644
index 98d25ed16..000000000
--- a/src/components/WeekNumber/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./WeekNumber";
diff --git a/src/components/YearsDropdown/YearsDropdown.tsx b/src/components/YearsDropdown.tsx
similarity index 91%
rename from src/components/YearsDropdown/YearsDropdown.tsx
rename to src/components/YearsDropdown.tsx
index fc5d5c586..2df67dc13 100644
--- a/src/components/YearsDropdown/YearsDropdown.tsx
+++ b/src/components/YearsDropdown.tsx
@@ -2,9 +2,9 @@ import { ChangeEventHandler } from "react";
 
 import { setYear, startOfMonth, startOfYear } from "date-fns";
 
-import { Dropdown } from "../../components/Dropdown";
-import { useDayPicker } from "../../contexts/DayPicker";
-import { MonthChangeEventHandler } from "../../types/EventHandlers";
+import { Dropdown } from "./Dropdown";
+import { useDayPicker } from "../contexts/DayPicker";
+import { MonthChangeEventHandler } from "../types/EventHandlers";
 
 /** The props for the {@link YearsDropdown} component. */
 export interface YearsDropdownProps {
diff --git a/src/components/YearsDropdown/index.ts b/src/components/YearsDropdown/index.ts
deleted file mode 100644
index b47dcc8b5..000000000
--- a/src/components/YearsDropdown/index.ts
+++ /dev/null
@@ -1,1 +0,0 @@
-export * from "./YearsDropdown";


Test patch:
diff --git a/src/components/Button/Button.test.tsx b/src/components/Button.test.tsx
similarity index 96%
rename from src/components/Button/Button.test.tsx
rename to src/components/Button.test.tsx
index b69784f7b..7747b04cb 100644
--- a/src/components/Button/Button.test.tsx
+++ b/src/components/Button.test.tsx
@@ -1,8 +1,7 @@
 import { screen } from "@testing-library/react";
 
-import { customRender } from "../../../test/render";
-
 import { Button } from "./Button";
+import { customRender } from "@/test/render";
 
 let button: HTMLButtonElement;
 
diff --git a/src/components/Caption/Caption.test.tsx b/src/components/Caption.test.tsx
similarity index 92%
rename from src/components/Caption/Caption.test.tsx
rename to src/components/Caption.test.tsx
index a06345481..47f7b5cbc 100644
--- a/src/components/Caption/Caption.test.tsx
+++ b/src/components/Caption.test.tsx
@@ -1,7 +1,7 @@
 import { screen } from "@testing-library/react";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
+import { customRender } from "@/test/render";
 import {
   getMonthCaption,
   getMonthDropdown,
@@ -10,10 +10,10 @@ import {
   getYearDropdown,
   queryNextButton,
   queryPrevButton
-} from "../../../test/selectors";
-import { freezeBeforeAll } from "../../../test/utils";
+} from "@/test/selectors";
+import { freezeBeforeAll } from "@/test/utils";
 
-import { CustomComponents } from "../../types/DayPickerBase";
+import { CustomComponents } from "../types/DayPickerBase";
 
 import { Caption, CaptionProps } from "./Caption";
 
diff --git a/src/components/CaptionDropdowns/CaptionDropdowns.test.tsx b/src/components/CaptionDropdowns.test.tsx
similarity index 90%
rename from src/components/CaptionDropdowns/CaptionDropdowns.test.tsx
rename to src/components/CaptionDropdowns.test.tsx
index 2844cb868..53bee9d25 100644
--- a/src/components/CaptionDropdowns/CaptionDropdowns.test.tsx
+++ b/src/components/CaptionDropdowns.test.tsx
@@ -1,19 +1,19 @@
 import { screen } from "@testing-library/react";
 import { setMonth, setYear } from "date-fns";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
+import { customRender } from "@/test/render";
 import {
   getMonthDropdown,
   getYearDropdown,
   queryMonthDropdown,
   queryYearDropdown
-} from "../../../test/selectors";
-import { user } from "../../../test/user";
-import { freezeBeforeAll } from "../../../test/utils";
+} from "@/test/selectors";
+import { user } from "@/test/user";
+import { freezeBeforeAll } from "@/test/utils";
 
-import { CaptionProps } from "../../components/Caption";
-import { CustomComponents } from "../../types/DayPickerBase";
+import { CaptionProps } from "./Caption";
+import { CustomComponents } from "../types/DayPickerBase";
 
 import { CaptionDropdowns } from "./CaptionDropdowns";
 
diff --git a/src/components/CaptionLabel/CaptionLabel.test.tsx b/src/components/CaptionLabel.test.tsx
similarity index 81%
rename from src/components/CaptionLabel/CaptionLabel.test.tsx
rename to src/components/CaptionLabel.test.tsx
index 5c8290f1b..232ff1fda 100644
--- a/src/components/CaptionLabel/CaptionLabel.test.tsx
+++ b/src/components/CaptionLabel.test.tsx
@@ -1,6 +1,6 @@
-import { customRender } from "../../../test/render";
-import { getMonthCaption } from "../../../test/selectors";
-import { freezeBeforeAll } from "../../../test/utils";
+import { customRender } from "@/test/render";
+import { getMonthCaption } from "@/test/selectors";
+import { freezeBeforeAll } from "@/test/utils";
 
 import { CaptionLabel } from "./CaptionLabel";
 
diff --git a/src/components/CaptionNavigation/CaptionNavigation.test.tsx b/src/components/CaptionNavigation.test.tsx
similarity index 95%
rename from src/components/CaptionNavigation/CaptionNavigation.test.tsx
rename to src/components/CaptionNavigation.test.tsx
index d12e2b312..656a4027b 100644
--- a/src/components/CaptionNavigation/CaptionNavigation.test.tsx
+++ b/src/components/CaptionNavigation.test.tsx
@@ -1,15 +1,15 @@
 import { addMonths } from "date-fns";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
+import { customRender } from "@/test/render";
 import {
   getNextButton,
   getPrevButton,
   queryNextButton,
   queryPrevButton
-} from "../../../test/selectors";
-import { user } from "../../../test/user";
-import { freezeBeforeAll } from "../../../test/utils";
+} from "@/test/selectors";
+import { user } from "@/test/user";
+import { freezeBeforeAll } from "@/test/utils";
 
 import { CaptionNavigation } from "./CaptionNavigation";
 
diff --git a/src/components/Day/Day.test.tsx b/src/components/Day.test.tsx
similarity index 90%
rename from src/components/Day/Day.test.tsx
rename to src/components/Day.test.tsx
index 626af13c9..eff5b4481 100644
--- a/src/components/Day/Day.test.tsx
+++ b/src/components/Day.test.tsx
@@ -1,10 +1,10 @@
 import { screen } from "@testing-library/react";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
-import { freezeBeforeAll } from "../../../test/utils";
+import { customRender } from "@/test/render";
+import { freezeBeforeAll } from "@/test/utils";
 
-import { CustomComponents } from "../../types/DayPickerBase";
+import { CustomComponents } from "../types/DayPickerBase";
 
 import { Day, DayProps } from "./Day";
 
diff --git a/src/components/DayContent/DayContent.test.tsx b/src/components/DayContent.test.tsx
similarity index 75%
rename from src/components/DayContent/DayContent.test.tsx
rename to src/components/DayContent.test.tsx
index 4c446e180..70c51d307 100644
--- a/src/components/DayContent/DayContent.test.tsx
+++ b/src/components/DayContent.test.tsx
@@ -1,10 +1,10 @@
 import { es } from "date-fns/locale";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
-import { freezeBeforeAll } from "../../../test/utils";
+import { customRender } from "@/test/render";
+import { freezeBeforeAll } from "@/test/utils";
 
-import { DayContent, DayContentProps } from "../../components/DayContent";
+import { DayContent, DayContentProps } from "./DayContent";
 
 const today = new Date(2021, 8);
 
diff --git a/src/components/Dropdown/Dropdown.test.tsx b/src/components/Dropdown.test.tsx
similarity index 81%
rename from src/components/Dropdown/Dropdown.test.tsx
rename to src/components/Dropdown.test.tsx
index b7e70251e..f973ef320 100644
--- a/src/components/Dropdown/Dropdown.test.tsx
+++ b/src/components/Dropdown.test.tsx
@@ -1,12 +1,12 @@
 import { fireEvent, screen } from "@testing-library/react";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
-import { freezeBeforeAll } from "../../../test/utils";
+import { customRender } from "@/test/render";
+import { freezeBeforeAll } from "@/test/utils";
 
-import { Dropdown, DropdownProps } from "../../components/Dropdown";
-import { defaultClassNames } from "../../contexts/DayPicker/defaultClassNames";
-import { CustomComponents } from "../../types/DayPickerBase";
+import { Dropdown, DropdownProps } from "./Dropdown";
+import { defaultClassNames } from "../contexts/DayPicker/defaultClassNames";
+import { CustomComponents } from "../types/DayPickerBase";
 
 const today = new Date(2021, 8);
 
diff --git a/src/components/Footer/Footer.test.tsx b/src/components/Footer.test.tsx
similarity index 80%
rename from src/components/Footer/Footer.test.tsx
rename to src/components/Footer.test.tsx
index 342a3d8ee..efbff9378 100644
--- a/src/components/Footer/Footer.test.tsx
+++ b/src/components/Footer.test.tsx
@@ -1,5 +1,5 @@
-import { customRender } from "../../../test/render";
-import { getTableFooter, queryTableFooter } from "../../../test/selectors";
+import { customRender } from "@/test/render";
+import { getTableFooter, queryTableFooter } from "@/test/selectors";
 
 import { Footer } from "./Footer";
 
diff --git a/src/components/Head/Head.test.tsx b/src/components/Head.test.tsx
similarity index 92%
rename from src/components/Head/Head.test.tsx
rename to src/components/Head.test.tsx
index 235211eef..9ac8de1fb 100644
--- a/src/components/Head/Head.test.tsx
+++ b/src/components/Head.test.tsx
@@ -1,7 +1,7 @@
 import { RenderResult, screen } from "@testing-library/react";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
+import { customRender } from "@/test/render";
 
 import { Head } from "./Head";
 
diff --git a/src/components/HeadRow/HeadRow.test.tsx b/src/components/HeadRow.test.tsx
similarity index 95%
rename from src/components/HeadRow/HeadRow.test.tsx
rename to src/components/HeadRow.test.tsx
index 013bb6c0b..f291e04ee 100644
--- a/src/components/HeadRow/HeadRow.test.tsx
+++ b/src/components/HeadRow.test.tsx
@@ -1,9 +1,8 @@
 import { RenderResult } from "@testing-library/react";
-import { DayPickerProps } from "../../DayPicker";
-
-import { customRender } from "../../../test/render";
+import { DayPickerProps } from "../DayPicker";
 
 import { HeadRow } from "./HeadRow";
+import { customRender } from "@/test/render";
 
 let container: HTMLElement;
 let view: RenderResult;
diff --git a/src/components/IconDropdown/IconDropdown.test.tsx b/src/components/IconDropdown.test.tsx
similarity index 88%
rename from src/components/IconDropdown/IconDropdown.test.tsx
rename to src/components/IconDropdown.test.tsx
index da90207ef..484f629c3 100644
--- a/src/components/IconDropdown/IconDropdown.test.tsx
+++ b/src/components/IconDropdown.test.tsx
@@ -1,4 +1,4 @@
-import { customRender } from "../../../test/render";
+import { customRender } from "@/test/render";
 
 import { IconDropdown } from "./IconDropdown";
 
diff --git a/src/components/IconLeft/IconLeft.test.tsx b/src/components/IconLeft.test.tsx
similarity index 88%
rename from src/components/IconLeft/IconLeft.test.tsx
rename to src/components/IconLeft.test.tsx
index db8a3d32c..2c6f02c28 100644
--- a/src/components/IconLeft/IconLeft.test.tsx
+++ b/src/components/IconLeft.test.tsx
@@ -1,5 +1,4 @@
-import { customRender } from "../../../test/render";
-
+import { customRender } from "@/test/render";
 import { IconLeft } from "./IconLeft";
 
 let root: HTMLElement;
diff --git a/src/components/IconRight/IconRight.test.tsx b/src/components/IconRight.test.tsx
similarity index 88%
rename from src/components/IconRight/IconRight.test.tsx
rename to src/components/IconRight.test.tsx
index 2f5fd2c2e..d99ebf517 100644
--- a/src/components/IconRight/IconRight.test.tsx
+++ b/src/components/IconRight.test.tsx
@@ -1,4 +1,4 @@
-import { customRender } from "../../../test/render";
+import { customRender } from "@/test/render";
 
 import { IconRight } from "./IconRight";
 
diff --git a/src/components/Month/Month.test.tsx b/src/components/Month.test.tsx
similarity index 96%
rename from src/components/Month/Month.test.tsx
rename to src/components/Month.test.tsx
index b04e39c73..ff533012d 100644
--- a/src/components/Month/Month.test.tsx
+++ b/src/components/Month.test.tsx
@@ -1,12 +1,11 @@
 import { screen } from "@testing-library/react";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
-import { getMonthCaption, getMonthGrid } from "../../../test/selectors";
-
-import { CustomComponents } from "../../types/DayPickerBase";
+import { customRender } from "@/test/render";
+import { getMonthCaption, getMonthGrid } from "@/test/selectors";
 
 import { Month, MonthProps } from "./Month";
+import { CustomComponents } from "../types/DayPickerBase";
 
 let root: HTMLDivElement;
 
diff --git a/src/components/Months/Months.test.tsx b/src/components/Months.test.tsx
similarity index 93%
rename from src/components/Months/Months.test.tsx
rename to src/components/Months.test.tsx
index 8a2755ae0..f622f66a1 100644
--- a/src/components/Months/Months.test.tsx
+++ b/src/components/Months.test.tsx
@@ -1,4 +1,4 @@
-import { customRender } from "../../../test/render";
+import { customRender } from "@/test/render";
 
 import { Months } from "./Months";
 
diff --git a/src/components/MonthsDropdown/MonthsDropdown.test.tsx b/src/components/MonthsDropdown.test.tsx
similarity index 94%
rename from src/components/MonthsDropdown/MonthsDropdown.test.tsx
rename to src/components/MonthsDropdown.test.tsx
index 3f07abf9f..8239270c3 100644
--- a/src/components/MonthsDropdown/MonthsDropdown.test.tsx
+++ b/src/components/MonthsDropdown.test.tsx
@@ -1,10 +1,10 @@
 import { screen } from "@testing-library/react";
 import { addMonths, differenceInMonths } from "date-fns";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
-import { user } from "../../../test/user";
-import { freezeBeforeAll } from "../../../test/utils";
+import { customRender } from "@/test/render";
+import { user } from "@/test/user";
+import { freezeBeforeAll } from "@/test/utils";
 
 import { MonthsDropdown, MonthsDropdownProps } from "./MonthsDropdown";
 
diff --git a/src/components/Navigation/Navigation.test.tsx b/src/components/Navigation.test.tsx
similarity index 94%
rename from src/components/Navigation/Navigation.test.tsx
rename to src/components/Navigation.test.tsx
index c5538d44d..d77b479ca 100644
--- a/src/components/Navigation/Navigation.test.tsx
+++ b/src/components/Navigation.test.tsx
@@ -1,8 +1,8 @@
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
-import { getNextButton, getPrevButton } from "../../../test/selectors";
-import { user } from "../../../test/user";
+import { customRender } from "@/test/render";
+import { getNextButton, getPrevButton } from "@/test/selectors";
+import { user } from "@/test/user";
 
 import { Navigation, NavigationProps } from "./Navigation";
 
diff --git a/src/components/Root/Root.test.tsx b/src/components/Root.test.tsx
similarity index 91%
rename from src/components/Root/Root.test.tsx
rename to src/components/Root.test.tsx
index a501948d6..407ef484f 100644
--- a/src/components/Root/Root.test.tsx
+++ b/src/components/Root.test.tsx
@@ -1,14 +1,14 @@
 import { RenderResult, screen } from "@testing-library/react";
 import { addDays } from "date-fns";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
-import { getDayButton, queryMonthGrids } from "../../../test/selectors";
-import { freezeBeforeAll } from "../../../test/utils";
+import { customRender } from "@/test/render";
+import { getDayButton, queryMonthGrids } from "@/test/selectors";
+import { freezeBeforeAll } from "@/test/utils";
 
-import { MonthsProps } from "../../components/Months";
-import { defaultClassNames } from "../../contexts/DayPicker/defaultClassNames";
-import { ClassNames } from "../../types/Styles";
+import { MonthsProps } from "./Months";
+import { defaultClassNames } from "../contexts/DayPicker/defaultClassNames";
+import { ClassNames } from "../types/Styles";
 
 import { Root } from "./Root";
 
diff --git a/src/components/Row/Row.test.tsx b/src/components/Row.test.tsx
similarity index 91%
rename from src/components/Row/Row.test.tsx
rename to src/components/Row.test.tsx
index 20bda14ac..b61faf6f4 100644
--- a/src/components/Row/Row.test.tsx
+++ b/src/components/Row.test.tsx
@@ -1,9 +1,9 @@
 import { screen } from "@testing-library/react";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render/customRender";
+import { customRender } from "@/test/render/customRender";
 
-import { CustomComponents } from "../../types/DayPickerBase";
+import { CustomComponents } from "../types/DayPickerBase";
 
 import { Row, RowProps } from "./Row";
 
diff --git a/src/components/Table/Table.test.tsx b/src/components/Table.test.tsx
similarity index 85%
rename from src/components/Table/Table.test.tsx
rename to src/components/Table.test.tsx
index d384dcca5..3162698f0 100644
--- a/src/components/Table/Table.test.tsx
+++ b/src/components/Table.test.tsx
@@ -1,9 +1,9 @@
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render/customRender";
-import { freezeBeforeAll } from "../../../test/utils";
+import { customRender } from "@/test/render/customRender";
+import { freezeBeforeAll } from "@/test/utils";
 
-import { FooterProps } from "../../components/Footer";
+import { FooterProps } from "./Footer";
 
 import { Table, TableProps } from "./Table";
 
diff --git a/src/components/WeekNumber/WeekNumber.test.tsx b/src/components/WeekNumber.test.tsx
similarity index 92%
rename from src/components/WeekNumber/WeekNumber.test.tsx
rename to src/components/WeekNumber.test.tsx
index 06adff688..8d9fa9e8f 100644
--- a/src/components/WeekNumber/WeekNumber.test.tsx
+++ b/src/components/WeekNumber.test.tsx
@@ -1,8 +1,8 @@
 import { screen } from "@testing-library/react";
 import { userEvent } from "@testing-library/user-event";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render/customRender";
+import { customRender } from "@/test/render/customRender";
 
 import { WeekNumber, WeekNumberProps } from "./WeekNumber";
 
diff --git a/src/components/YearsDropdown/YearsDropdown.test.tsx b/src/components/YearsDropdown.test.tsx
similarity index 94%
rename from src/components/YearsDropdown/YearsDropdown.test.tsx
rename to src/components/YearsDropdown.test.tsx
index 53bcd2e18..939553560 100644
--- a/src/components/YearsDropdown/YearsDropdown.test.tsx
+++ b/src/components/YearsDropdown.test.tsx
@@ -1,10 +1,10 @@
 import { screen } from "@testing-library/react";
 import { addMonths, differenceInYears } from "date-fns";
-import { DayPickerProps } from "../../DayPicker";
+import { DayPickerProps } from "../DayPicker";
 
-import { customRender } from "../../../test/render";
-import { user } from "../../../test/user";
-import { freezeBeforeAll } from "../../../test/utils";
+import { customRender } from "@/test/render";
+import { user } from "@/test/user";
+import { freezeBeforeAll } from "@/test/utils";
 
 import { YearsDropdown, YearsDropdownProps } from "./YearsDropdown";
 
diff --git a/src/components/MonthsDropdown/__snapshots__/MonthsDropdown.test.tsx.snap b/src/components/__snapshots__/MonthsDropdown.test.tsx.snap
similarity index 100%
rename from src/components/MonthsDropdown/__snapshots__/MonthsDropdown.test.tsx.snap
rename to src/components/__snapshots__/MonthsDropdown.test.tsx.snap
diff --git a/src/components/Table/__snapshots__/Table.test.tsx.snap b/src/components/__snapshots__/Table.test.tsx.snap
similarity index 100%
rename from src/components/Table/__snapshots__/Table.test.tsx.snap
rename to src/components/__snapshots__/Table.test.tsx.snap
diff --git a/src/components/WeekNumber/__snapshots__/WeekNumber.test.tsx.snap b/src/components/__snapshots__/WeekNumber.test.tsx.snap
similarity index 100%
rename from src/components/WeekNumber/__snapshots__/WeekNumber.test.tsx.snap
rename to src/components/__snapshots__/WeekNumber.test.tsx.snap
diff --git a/src/components/YearsDropdown/__snapshots__/YearsDropdown.test.tsx.snap b/src/components/__snapshots__/YearsDropdown.test.tsx.snap
similarity index 100%
rename from src/components/YearsDropdown/__snapshots__/YearsDropdown.test.tsx.snap
rename to src/components/__snapshots__/YearsDropdown.test.tsx.snap
diff --git a/src/components/Day/index.ts b/src/components/index.ts
similarity index 100%
rename from src/components/Day/index.ts
rename to src/components/index.ts
diff --git a/src/components/Table/utils/daysToMonthWeeks.ts b/src/components/utils/daysToMonthWeeks.ts
similarity index 100%
rename from src/components/Table/utils/daysToMonthWeeks.ts
rename to src/components/utils/daysToMonthWeeks.ts
diff --git a/src/components/Table/utils/getMonthWeeks.test.ts b/src/components/utils/getMonthWeeks.test.ts
similarity index 100%
rename from src/components/Table/utils/getMonthWeeks.test.ts
rename to src/components/utils/getMonthWeeks.test.ts
diff --git a/src/components/Table/utils/getMonthWeeks.ts b/src/components/utils/getMonthWeeks.ts
similarity index 100%
rename from src/components/Table/utils/getMonthWeeks.ts
rename to src/components/utils/getMonthWeeks.ts
diff --git a/src/components/HeadRow/utils/getWeekdays.test.ts b/src/components/utils/getWeekdays.test.ts
similarity index 94%
rename from src/components/HeadRow/utils/getWeekdays.test.ts
rename to src/components/utils/getWeekdays.test.ts
index 2bbe50c8e..1f163c86b 100644
--- a/src/components/HeadRow/utils/getWeekdays.test.ts
+++ b/src/components/utils/getWeekdays.test.ts
@@ -1,6 +1,6 @@
 import { es } from "date-fns/locale";
 
-import { freezeBeforeAll } from "../../../../test/utils";
+import { freezeBeforeAll } from "@/test/utils";
 
 import { getWeekdays } from "./getWeekdays";