Skip to content

Commit

Permalink
fix: add react import
Browse files Browse the repository at this point in the history
  • Loading branch information
arjendevos committed Jul 3, 2024
1 parent b6770b1 commit f5d2edd
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/components/DatepickerCalendar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as React from 'react';

import { twMerge } from 'tailwind-merge';

import { DatepickerConfig, DatepickerMonth, DatepickerValue } from '@types';
Expand Down
22 changes: 11 additions & 11 deletions src/components/DatepickerCalendarDates.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallback, useMemo } from 'react';
import * as React from 'react';

import { DatepickerConfig, DatepickerMonth, DatepickerValue, DateRange } from '@types';
import {
Expand All @@ -23,9 +23,9 @@ interface Props {
}

export default function DatepickerCalendarDates({ config, month, value, onChange }: Props) {
const generatedDates = useMemo(() => generate42CalendarDates(month, config), [month, config]);
const generatedDates = React.useMemo(() => generate42CalendarDates(month, config), [month, config]);

const weekDays = useMemo(() => {
const weekDays = React.useMemo(() => {
const today = new Date();
const days: {
short: string;
Expand All @@ -47,7 +47,7 @@ export default function DatepickerCalendarDates({ config, month, value, onChange
return days;
}, [config.dir, config.locale, config.weeksStartOnMonday]);

const isSelected = useCallback(
const isSelected = React.useCallback(
(date: Date) => {
if (!value) return false;
const type = dateValueType(value, config);
Expand Down Expand Up @@ -81,7 +81,7 @@ export default function DatepickerCalendarDates({ config, month, value, onChange
[value, config]
);

const onClick = useCallback(
const onClick = React.useCallback(
(d: Date) => {
const type = dateValueType(value, config);
if (type === 'single') {
Expand Down Expand Up @@ -140,7 +140,7 @@ export default function DatepickerCalendarDates({ config, month, value, onChange
[config, onChange, value]
);

const isInDisabledRange = useCallback(
const isInDisabledRange = React.useCallback(
(date: Date) => {
if (!config.disabled) return false;

Expand All @@ -156,7 +156,7 @@ export default function DatepickerCalendarDates({ config, month, value, onChange
[config.disabled]
);

const isInRange = useCallback(
const isInRange = React.useCallback(
(date: Date) => {
if (!value) return false;
if (config.type !== 'range') return false;
Expand All @@ -169,7 +169,7 @@ export default function DatepickerCalendarDates({ config, month, value, onChange
[config.type, value]
);

const isEndRange = useCallback(
const isEndRange = React.useCallback(
(date: Date) => {
if (!value) return false;
if (config.type !== 'range') return false;
Expand All @@ -182,7 +182,7 @@ export default function DatepickerCalendarDates({ config, month, value, onChange
[config.type, value]
);

const isStartRange = useCallback(
const isStartRange = React.useCallback(
(date: Date) => {
if (!value) return false;
if (config.type !== 'range') return false;
Expand All @@ -195,7 +195,7 @@ export default function DatepickerCalendarDates({ config, month, value, onChange
[config.type, value]
);

const isSameDay = useCallback(
const isSameDay = React.useCallback(
(date: Date) => {
if (!value) return false;
if (config.type !== 'range') return false;
Expand All @@ -208,7 +208,7 @@ export default function DatepickerCalendarDates({ config, month, value, onChange
[config.type, value]
);

const isDisabled = useCallback(
const isDisabled = React.useCallback(
(date: Date) => {
if (isInDisabledRange(date)) return true;

Expand Down
1 change: 1 addition & 0 deletions src/components/DatepickerCalendarDatesItem.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import { twMerge } from 'tailwind-merge';

Expand Down
1 change: 1 addition & 0 deletions src/components/DatepickerCalendarMonth.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as React from 'react';
import { DatepickerConfig, DatepickerMonth } from '@types';

interface Props {
Expand Down
6 changes: 3 additions & 3 deletions src/components/DatepickerExpanded.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import * as React from 'react';

import { DatepickerConfig, DatepickerValue, DateRange } from '@types';
import { dateValueType, getNextMonthAndYear, getPreviousMonthAndYear } from '@utils';
Expand All @@ -14,8 +14,8 @@ interface Props {
}

export default function DatepickerExpanded({ value, onChange, config }: Props) {
const [internalValue, setInternalValue] = useState(value);
const [month, setMonth] = useState({
const [internalValue, setInternalValue] = React.useState(value);
const [month, setMonth] = React.useState({
month: new Date().getMonth(),
year: new Date().getFullYear()
});
Expand Down
1 change: 1 addition & 0 deletions src/components/DatepickerExpandedShortcuts.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as React from 'react';
import { DatepickerConfig, DatepickerValue } from '@types';
import { dateRangeTypes, displayDateRangeType, getDateRange, isEqualToRange } from '@utils';

Expand Down

0 comments on commit f5d2edd

Please sign in to comment.