diff --git a/src/DayPicker.tsx b/src/DayPicker.tsx index 30516edf0..c746af3f0 100644 --- a/src/DayPicker.tsx +++ b/src/DayPicker.tsx @@ -137,8 +137,6 @@ export function DayPicker(props: DayPickerProps) { labelGrid, labelMonthDropdown, labelNav, - labelNext, - labelPrevious, labelWeekday, labelWeekNumber, labelWeekNumberHeader, @@ -278,36 +276,11 @@ export function DayPicker(props: DayPickerProps) { className={classNames[UI.Nav]} style={styles?.[UI.Nav]} aria-label={labelNav()} - > - - - - - - - + onPreviousClick={handlePreviousClick} + onNextClick={handleNextClick} + previousMonth={previousMonth} + nextMonth={nextMonth} + /> )} {months.map((calendarMonth, displayIndex) => { const handleMonthChange: ChangeEventHandler = ( diff --git a/src/components/Nav.tsx b/src/components/Nav.tsx index 748c3c702..955df9361 100644 --- a/src/components/Nav.tsx +++ b/src/components/Nav.tsx @@ -1,4 +1,7 @@ -import React from "react"; +import React, { MouseEventHandler } from "react"; + +import { UI } from "../UI.js"; +import { useDayPicker } from "../useDayPicker.js"; /** * Render the toolbar with the navigation button. @@ -6,8 +9,60 @@ import React from "react"; * @group Components * @see https://daypicker.dev/guides/custom-components */ -export function Nav(props: JSX.IntrinsicElements["nav"]) { - return