From b8a85bb36a3937ff9ee8300fb89eee44d6adbffb Mon Sep 17 00:00:00 2001 From: Goupil Date: Thu, 27 Jun 2024 15:27:13 +0200 Subject: [PATCH] Update all src imports --- src/DayPicker.test.tsx | 6 +-- src/DayPicker.tsx | 8 +-- src/UI.ts | 2 +- src/classes/CalendarDay.test.ts | 2 +- src/classes/CalendarDay.ts | 4 +- src/classes/CalendarMonth.test.ts | 6 +-- src/classes/CalendarMonth.ts | 2 +- src/classes/CalendarWeek.test.ts | 4 +- src/classes/CalendarWeek.ts | 2 +- src/components/Button.tsx | 2 +- src/components/Calendar.test.tsx | 8 +-- src/components/Calendar.tsx | 14 ++--- src/components/Chevron.tsx | 6 +-- src/components/Day.tsx | 8 +-- src/components/DayDate.tsx | 6 +-- src/components/DayWrapper.tsx | 20 ++++---- src/components/Dropdown.tsx | 12 ++--- src/components/DropdownNav.tsx | 12 ++--- src/components/Footer.tsx | 2 +- src/components/Month.tsx | 14 ++--- src/components/MonthCaption.tsx | 10 ++-- src/components/Months.tsx | 4 +- src/components/MonthsDropdown.tsx | 12 ++--- src/components/Nav.test.tsx | 10 ++-- src/components/Nav.tsx | 10 ++-- src/components/Option.tsx | 4 +- src/components/Select.tsx | 4 +- src/components/Week.tsx | 12 ++--- src/components/WeekNumber.tsx | 8 +-- src/components/Weekday.tsx | 6 +-- src/components/Weekdays.tsx | 10 ++-- src/components/YearsDropdown.tsx | 12 ++--- src/contexts/providers.tsx | 14 ++--- src/contexts/useCalendar.test.ts | 4 +- src/contexts/useCalendar.tsx | 34 ++++++------ src/contexts/useFocus.test.tsx | 4 +- src/contexts/useFocus.tsx | 16 +++--- src/contexts/useModifiers.tsx | 20 ++++---- src/contexts/useProps.tsx | 16 +++--- src/formatters/formatCaption.test.ts | 6 +-- src/formatters/formatCaption.ts | 4 +- src/formatters/formatDay.test.ts | 2 +- src/formatters/formatDay.ts | 6 +-- src/formatters/formatMonthDropdown.test.ts | 4 +- src/formatters/formatMonthDropdown.ts | 4 +- src/formatters/formatWeekNumber.test.ts | 2 +- src/formatters/formatWeekdayName.test.ts | 4 +- src/formatters/formatWeekdayName.ts | 6 +-- src/formatters/formatYearDropdown.test.ts | 2 +- src/helpers/debounce.test.ts | 2 +- src/helpers/getClassNamesForModifiers.ts | 4 +- src/helpers/getDataAttributes.test.tsx | 2 +- src/helpers/getDataAttributes.tsx | 2 +- src/helpers/getDates.test.ts | 4 +- src/helpers/getDates.ts | 14 ++--- src/helpers/getDays.test.ts | 4 +- src/helpers/getDays.ts | 2 +- src/helpers/getDefaultClassNames.test.ts | 2 +- src/helpers/getDefaultClassNames.ts | 2 +- src/helpers/getDisplayMonths.test.ts | 4 +- src/helpers/getDisplayMonths.ts | 2 +- src/helpers/getDropdownMonths.test.ts | 10 ++-- src/helpers/getDropdownMonths.ts | 4 +- src/helpers/getDropdownYears.test.ts | 8 +-- src/helpers/getDropdownYears.ts | 4 +- src/helpers/getFormatters.test.ts | 6 +-- src/helpers/getFormatters.ts | 4 +- src/helpers/getInitialMonth.test.ts | 6 +-- src/helpers/getInitialMonth.ts | 2 +- src/helpers/getMonths.test.ts | 8 +-- src/helpers/getMonths.ts | 24 ++++----- src/helpers/getNextFocus.test.tsx | 10 ++-- src/helpers/getNextFocus.tsx | 10 ++-- src/helpers/getNextMonth.test.ts | 6 +-- src/helpers/getNextMonth.ts | 2 +- src/helpers/getPossibleFocusDate.test.ts | 46 ++++++++--------- src/helpers/getPossibleFocusDate.ts | 4 +- src/helpers/getPreviousMonth.test.ts | 4 +- src/helpers/getPreviousMonth.ts | 2 +- src/helpers/getStartEndMonths.test.ts | 2 +- src/helpers/getStartEndMonths.ts | 4 +- src/helpers/getStyleForModifiers.test.ts | 8 +-- src/helpers/getStyleForModifiers.ts | 6 +-- src/helpers/getWeekdays.test.ts | 6 +-- src/helpers/getWeekdays.ts | 6 +-- src/helpers/getWeeks.test.ts | 4 +- src/helpers/getWeeks.ts | 2 +- src/helpers/useControlledValue.test.ts | 4 +- src/helpers/useControlledValue.ts | 2 +- src/jalali.tsx | 6 +-- src/labels/labelCaption.ts | 6 +-- src/labels/labelDay.test.ts | 6 +-- src/labels/labelDay.ts | 8 +-- src/labels/labelGrid.ts | 6 +-- src/labels/labelMonthDropdown.test.ts | 2 +- src/labels/labelMonthDropdown.ts | 2 +- src/labels/labelNext.test.ts | 2 +- src/labels/labelNext.ts | 2 +- src/labels/labelPrevious.test.ts | 2 +- src/labels/labelPrevious.ts | 2 +- src/labels/labelWeekNumber.test.ts | 2 +- src/labels/labelWeekNumber.ts | 2 +- src/labels/labelWeekNumberHeader.test.ts | 2 +- src/labels/labelWeekNumberHeader.ts | 2 +- src/labels/labelWeekday.test.ts | 4 +- src/labels/labelWeekday.ts | 6 +-- src/labels/labelYearDropdown.test.ts | 2 +- src/labels/labelYearDropdown.ts | 2 +- src/lib/dateLib.ts | 60 +++++++++++----------- src/selection/useMulti.tsx | 6 +-- src/selection/useRange.tsx | 10 ++-- src/selection/useSingle.tsx | 6 +-- src/types/deprecated.ts | 14 ++--- src/types/props.test.tsx | 4 +- src/types/props.ts | 4 +- src/types/shared.ts | 30 +++++------ src/utc.tsx | 6 +-- src/utils/addToRange.test.ts | 6 +-- src/utils/addToRange.ts | 4 +- src/utils/dateMatchModifiers.test.ts | 6 +-- src/utils/dateMatchModifiers.ts | 6 +-- src/utils/isDateInRange.test.ts | 6 +-- src/utils/isDateInRange.ts | 4 +- 123 files changed, 438 insertions(+), 438 deletions(-) diff --git a/src/DayPicker.test.tsx b/src/DayPicker.test.tsx index 4b55b1e35f..a525df467c 100644 --- a/src/DayPicker.test.tsx +++ b/src/DayPicker.test.tsx @@ -1,8 +1,8 @@ -import React from "react"; +import React from "react" -import { render, screen } from "@testing-library/react"; +import { render, screen } from "@testing-library/react" -import { DayPicker } from "./DayPicker"; +import { DayPicker } from "./DayPicker.js" test("should render a date picker component", () => { render(); diff --git a/src/DayPicker.tsx b/src/DayPicker.tsx index a22c31013c..ec02df0cfc 100644 --- a/src/DayPicker.tsx +++ b/src/DayPicker.tsx @@ -1,8 +1,8 @@ -import React from "react"; +import React from "react" -import { Calendar } from "./components/Calendar"; -import { ContextProviders } from "./contexts/providers"; -import type { DayPickerProps } from "./types"; +import { Calendar } from "./components/Calendar.js" +import { ContextProviders } from "./contexts/providers.js" +import type { DayPickerProps } from "./types/index.js" /** * Render the date picker calendar. diff --git a/src/UI.ts b/src/UI.ts index f8705cf4c7..e3c696f990 100644 --- a/src/UI.ts +++ b/src/UI.ts @@ -1,4 +1,4 @@ -import type { CustomComponents, ClassNames, Styles } from "./types"; +import type { CustomComponents, ClassNames, Styles } from "./types/index.js" /** * The UI elements composing DayPicker. These elements are mapped to diff --git a/src/classes/CalendarDay.test.ts b/src/classes/CalendarDay.test.ts index 8a250af2cd..4c9066f676 100644 --- a/src/classes/CalendarDay.test.ts +++ b/src/classes/CalendarDay.test.ts @@ -1,4 +1,4 @@ -import { CalendarDay } from "./CalendarDay"; +import { CalendarDay } from "./CalendarDay.js" it("should set `displayMonth` to undefined when date and `displayMonth` are in the same month", () => { const date = new Date(2020, 0, 1); diff --git a/src/classes/CalendarDay.ts b/src/classes/CalendarDay.ts index ed928ce090..4a1c0643d8 100644 --- a/src/classes/CalendarDay.ts +++ b/src/classes/CalendarDay.ts @@ -1,5 +1,5 @@ -import { dateLib as defaultDateLib } from "../lib"; -import type { DateLib } from "../types"; +import { dateLib as defaultDateLib } from "../lib/index.js" +import type { DateLib } from "../types/index.js" /** * Represent the day displayed in the calendar. diff --git a/src/classes/CalendarMonth.test.ts b/src/classes/CalendarMonth.test.ts index deb245bc29..962bbb1b8e 100644 --- a/src/classes/CalendarMonth.test.ts +++ b/src/classes/CalendarMonth.test.ts @@ -1,6 +1,6 @@ -import { CalendarDay } from "./CalendarDay"; -import { CalendarMonth } from "./CalendarMonth"; -import { CalendarWeek } from "./CalendarWeek"; +import { CalendarDay } from "./CalendarDay.js" +import { CalendarMonth } from "./CalendarMonth.js" +import { CalendarWeek } from "./CalendarWeek.js" let month: CalendarMonth; let date: Date; diff --git a/src/classes/CalendarMonth.ts b/src/classes/CalendarMonth.ts index 1693873f62..338a9b58a3 100644 --- a/src/classes/CalendarMonth.ts +++ b/src/classes/CalendarMonth.ts @@ -1,4 +1,4 @@ -import { CalendarWeek } from "./CalendarWeek"; +import { CalendarWeek } from "./CalendarWeek.js" /** Represent a month in a calendar year. Contains the weeks within the month. */ export class CalendarMonth { diff --git a/src/classes/CalendarWeek.test.ts b/src/classes/CalendarWeek.test.ts index 9d2c2be9ff..711fa210d6 100644 --- a/src/classes/CalendarWeek.test.ts +++ b/src/classes/CalendarWeek.test.ts @@ -1,5 +1,5 @@ -import { CalendarDay } from "./CalendarDay"; -import { CalendarWeek } from "./CalendarWeek"; +import { CalendarDay } from "./CalendarDay.js" +import { CalendarWeek } from "./CalendarWeek.js" let week: CalendarWeek; const days = [ diff --git a/src/classes/CalendarWeek.ts b/src/classes/CalendarWeek.ts index b56fa5f0f3..964351eb2c 100644 --- a/src/classes/CalendarWeek.ts +++ b/src/classes/CalendarWeek.ts @@ -1,4 +1,4 @@ -import { CalendarDay } from "./CalendarDay"; +import { CalendarDay } from "./CalendarDay.js" /** Represent a week in a calendar month. */ export class CalendarWeek { diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 05ca2e41d1..5924e34786 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -1,4 +1,4 @@ -import React, { type ButtonHTMLAttributes } from "react"; +import React, { type ButtonHTMLAttributes } from "react" /** * Render the button elements in the calendar. diff --git a/src/components/Calendar.test.tsx b/src/components/Calendar.test.tsx index 847564f121..6a645b3da6 100644 --- a/src/components/Calendar.test.tsx +++ b/src/components/Calendar.test.tsx @@ -1,9 +1,9 @@ -import React from "react"; +import React from "react" -import { grid, nav } from "@/test/elements"; -import { render } from "@/test/render"; +import { grid, nav } from "@/test/elements.js" +import { render } from "@/test/render.js" -import { Calendar } from "./Calendar"; +import { Calendar } from "./Calendar.js" it("should render the navigation and month grids", () => { render(); diff --git a/src/components/Calendar.tsx b/src/components/Calendar.tsx index 14767b924b..b539b2f3cd 100644 --- a/src/components/Calendar.tsx +++ b/src/components/Calendar.tsx @@ -1,12 +1,12 @@ -import React from "react"; +import React from "react" -import { UI, CalendarFlag } from "../UI"; -import { useCalendar, useProps } from "../contexts"; +import { UI, CalendarFlag } from "../UI.js" +import { useCalendar, useProps } from "../contexts/index.js" -import { Footer as DefaultFooter } from "./Footer"; -import { Month as DefaultMonth } from "./Month"; -import { Months as DefaultMonths } from "./Months"; -import { Nav as DefaultNav } from "./Nav"; +import { Footer as DefaultFooter } from "./Footer.js" +import { Month as DefaultMonth } from "./Month.js" +import { Months as DefaultMonths } from "./Months.js" +import { Nav as DefaultNav } from "./Nav.js" /** * Render the DayPicker Calendar with navigation and the month grids. diff --git a/src/components/Chevron.tsx b/src/components/Chevron.tsx index 984936ad3d..cc00d09866 100644 --- a/src/components/Chevron.tsx +++ b/src/components/Chevron.tsx @@ -1,7 +1,7 @@ -import React from "react"; +import React from "react" -import { ChevronFlag, UI } from "../UI"; -import { useProps } from "../contexts"; +import { ChevronFlag, UI } from "../UI.js" +import { useProps } from "../contexts/index.js" /** * Render the chevron icon used in the navigation buttons and dropdowns. diff --git a/src/components/Day.tsx b/src/components/Day.tsx index efc3589eae..4b90f4defa 100644 --- a/src/components/Day.tsx +++ b/src/components/Day.tsx @@ -1,8 +1,8 @@ -import React from "react"; -import type { ReactNode } from "react"; +import React from "react" +import type { ReactNode } from "react" -import type { CalendarDay } from "../classes"; -import type { Modifiers } from "../types"; +import type { CalendarDay } from "../classes/index.js" +import type { Modifiers } from "../types/index.js" /** * Render the gridcell of a day in the calendar and handle the interaction and diff --git a/src/components/DayDate.tsx b/src/components/DayDate.tsx index b6c7abbb32..3e762f6486 100644 --- a/src/components/DayDate.tsx +++ b/src/components/DayDate.tsx @@ -1,7 +1,7 @@ -import React from "react"; +import React from "react" -import type { CalendarDay } from "../classes"; -import type { Modifiers } from "../types"; +import type { CalendarDay } from "../classes/index.js" +import type { Modifiers } from "../types/index.js" /** * Render the date as string inside the day grid cell. diff --git a/src/components/DayWrapper.tsx b/src/components/DayWrapper.tsx index 46136edd8d..79ed48398f 100644 --- a/src/components/DayWrapper.tsx +++ b/src/components/DayWrapper.tsx @@ -1,15 +1,15 @@ -import React from "react"; +import React from "react" -import { UI, DayFlag } from "../UI"; -import { CalendarDay } from "../classes/CalendarDay"; -import { useCalendar, useFocus, useModifiers, useProps } from "../contexts"; -import { debounce } from "../helpers/debounce"; -import { getClassNamesForModifiers } from "../helpers/getClassNamesForModifiers"; -import { getStyleForModifiers } from "../helpers/getStyleForModifiers"; -import { useMulti, useRange, useSingle } from "../selection"; +import { UI, DayFlag } from "../UI.js" +import { CalendarDay } from "../classes/CalendarDay.js" +import { useCalendar, useFocus, useModifiers, useProps } from "../contexts/index.js" +import { debounce } from "../helpers/debounce.js" +import { getClassNamesForModifiers } from "../helpers/getClassNamesForModifiers.js" +import { getStyleForModifiers } from "../helpers/getStyleForModifiers.js" +import { useMulti, useRange, useSingle } from "../selection/index.js" -import { type DayProps, Day as DefaultDay } from "./Day"; -import { type DayDateProps, DayDate as DefaultDayDate } from "./DayDate"; +import { type DayProps, Day as DefaultDay } from "./Day.js" +import { type DayDateProps, DayDate as DefaultDayDate } from "./DayDate.js" /** * Provides a `Day` the day state and the html attributes. Developers may use a diff --git a/src/components/Dropdown.tsx b/src/components/Dropdown.tsx index fb395cbebc..2a79c6d1f4 100644 --- a/src/components/Dropdown.tsx +++ b/src/components/Dropdown.tsx @@ -1,11 +1,11 @@ -import React, { type SelectHTMLAttributes } from "react"; +import React, { type SelectHTMLAttributes } from "react" -import { UI } from "../UI"; -import { useProps } from "../contexts"; +import { UI } from "../UI.js" +import { useProps } from "../contexts/index.js" -import { Chevron as DefaultChevron } from "./Chevron"; -import { Option as DefaultOption } from "./Option"; -import { Select as DefaultSelect } from "./Select"; +import { Chevron as DefaultChevron } from "./Chevron.js" +import { Option as DefaultOption } from "./Option.js" +import { Select as DefaultSelect } from "./Select.js" /** An option to use in the dropdown. Maps to the `