gpbl / react-day-picker

DayPicker is a customizable date picker component for React. Add date pickers, calendars, and date inputs to your web applications.
https://daypicker.dev
MIT License
5.86k stars 701 forks source link

feat(types): deprecations and updated type names #2138

Closed gpbl closed 1 month ago

gpbl commented 1 month ago

In this PR, I'm updating the types to make them more consistent to the next version of react-day-picker.

Breaking: Formatters

Formatters were not meant to return a ReactNode but a string. For React Nodes, a custom component should be used instead.

Breaking: Renamed Previous/Next Buttons label

These will require a test update.

Deprecated Types

The following types have been renamed. The old names have been deprecated in components/deprecated.ts and shouldn't be used anymore.

Deprecated Name New Name Commit
DaySelectionMode Mode 53a1c6cf
DayPickerDefaultProps PropsDefault 81439e74
DayPickerSingleProps PropsSingle 81439e74
DayPickerMultipleProps PropsMulti 81439e74
DayPickerRangeProps PropsRange 81439e74
WeekNumber WeekNumberRowHeader 280f5520
Row WeekRow aeff9abe
HeadRow WeekdaysRow b6302b1a
Caption MonthCaption 4d3e9677
Month MonthGrid d2b962ee
Root Calendar bf335389
RootProviderProps ContextProvidersProps d58410fd
RootProvider ContextProviders f868d8a6

Custom Components

Instead of adding manually the custom components, they are now exported in custom-components.ts. The type is now defined using the exports.