Skip to content

Commit

Permalink
feat: add more properties to useDayPicker
Browse files Browse the repository at this point in the history
Fix #2420.
  • Loading branch information
gpbl committed Sep 6, 2024
1 parent 9493010 commit 02ded33
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/DayPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,12 @@ export function DayPicker(props: DayPickerProps) {
nextMonth,
previousMonth,
goToMonth,
getModifiers
getModifiers,
components,
classNames,
styles,
labels,
formatters
};

return (
Expand Down
19 changes: 18 additions & 1 deletion src/useDayPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { CalendarDay } from "./classes/CalendarDay.js";
import { CalendarMonth } from "./classes/CalendarMonth.js";
import type { DayPickerProps } from "./types/props.js";
import type { SelectedValue, SelectHandler } from "./types/selection.js";
import { Modifiers } from "./types/shared.js";
import {
ClassNames,
CustomComponents,
Formatters,
Labels,
Modifiers,
Styles
} from "./types/shared.js";

/** @private */
export const dayPickerContext = createContext<
Expand All @@ -28,6 +35,16 @@ export type DayPickerContext<T extends DayPickerProps> = {
select: SelectHandler<T> | undefined;
/** Whether the given date is selected. */
isSelected: ((date: Date) => boolean) | undefined;
/** The components used internally by DayP. */
components: CustomComponents;
/** The class names for the UI elements. */
classNames: ClassNames;
/** The styles for the UI elements. */
styles: Partial<Styles> | undefined;
/** The labels used in the UI. */
labels: Labels;
/** The formatters used to format the UI elements. */
formatters: Formatters;
};

/**
Expand Down

0 comments on commit 02ded33

Please sign in to comment.