Skip to content

Commit

Permalink
feat(calendar): add calendar cell
Browse files Browse the repository at this point in the history
  • Loading branch information
1amageek committed Jan 16, 2025
1 parent 9091f51 commit b920894
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 7 additions & 5 deletions packages/components/calendar/__tests__/calendar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable jsx-a11y/no-autofocus */
import * as React from "react";
import {render, act, fireEvent} from "@testing-library/react";
import {CalendarDate, isWeekend} from "@internationalized/date";
import {CalendarDate, DateValue, isWeekend} from "@internationalized/date";
import {triggerPress, keyCodes} from "@nextui-org/test-utils";
import {useLocale} from "@react-aria/i18n";
import {NextUIProvider} from "@nextui-org/system";
Expand All @@ -11,14 +11,16 @@ import {Calendar as CalendarBase, CalendarProps} from "../src";
/**
* Custom calendar to disable animations and avoid issues with react-motion and jest
*/
const Calendar = React.forwardRef((props: CalendarProps, ref: React.Ref<HTMLDivElement>) => {
return <CalendarBase {...props} ref={ref} disableAnimation />;
});
const Calendar = React.forwardRef(
(props: CalendarProps<DateValue>, ref: React.ForwardedRef<HTMLDivElement>) => {
return <CalendarBase {...props} ref={ref} disableAnimation />;
},
);

Calendar.displayName = "Calendar";

const CalendarWithLocale = React.forwardRef(
(props: CalendarProps & {locale: string}, ref: React.Ref<HTMLDivElement>) => {
(props: CalendarProps<DateValue> & {locale: string}, ref: React.ForwardedRef<HTMLDivElement>) => {
const {locale, ...otherProps} = props;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ let cellFormatter = new Intl.DateTimeFormat("en-US", {
/**
* Custom range-calendar to disable animations and avoid issues with react-motion and jest
*/
const RangeCalendar = React.forwardRef(
(props: RangeCalendarProps, ref: React.Ref<HTMLDivElement>) => {
return <RangeCalendarCalendarBase {...props} ref={ref} disableAnimation />;
},
);
const RangeCalendar = React.forwardRef<HTMLDivElement, RangeCalendarProps>((props, ref) => {
return <RangeCalendarCalendarBase {...props} ref={ref} disableAnimation />;
});

RangeCalendar.displayName = "RangeCalendar";

Expand Down

0 comments on commit b920894

Please sign in to comment.