ui icon indicating copy to clipboard operation
ui copied to clipboard

Upgrade `react-day-picker` to v9

Open AhmedBaset opened this issue 1 year ago • 9 comments

Close #4366

I'm opening this PR as early as possible to avoid the issues we had with <Command /> when cmdk v1.0 was released. And to make it easy for current users to upgrade in their codebases by copying the new update.

This PR upgrades react-day-picker to the latest v9

See Changelog and Upgrade Guide

Notable Changes:

  • Renaming some classNames
  • date-fns is now a dependency rather than a peer dependency

TODOs:

  • [x] Pin react-day-picker to 9.0 to avoid the same issue with the next major
x o
default image
new-york image

To upgrade in your codebase:

  • pnpm update react-day-picker@9
  • pnpm un date-fns If you don't use it anywhere else
  • Wait the next shadcn-ui release and run shadcn-ui add calendar --overwrite or copy the source code directly for default or new york styles.

AhmedBaset avatar Jul 22 '24 02:07 AhmedBaset

@AhmedBaset is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jul 22 '24 02:07 vercel[bot]

Thanks, @AhmedBaset, appreciate your work on this. However, I believe there's a bit more to address regarding Tailwind. In react-day-picker v9, the aria-selected attribute has been moved from ~~cell~~ day_button to ~~row~~ day. This component relies heavily on that attribute, so additional adjustments are needed.

valentinpolitov avatar Jul 22 '24 19:07 valentinpolitov

Thanks, @AhmedBaset, appreciate your work on this. However, I believe there's a bit more to address regarding Tailwind. In react-day-picker v9, the aria-selected attribute has been moved from ~cell~ day_button to ~row~ day. This component relies heavily on that attribute, so additional adjustments are needed.

Thanks for the feedback. It's still WIP.

AhmedBaset avatar Jul 22 '24 19:07 AhmedBaset

@AhmedBaset Thanks for your work here. I've pinned react-day=picker to v8 for now. Let me know when this is ready for upgrade.

(Ideally, if you get to it, it would be great to document the upgrade on the calendar page. See https://ui.shadcn.com/docs/components/input-otp#changelog as an example).

shadcn avatar Jul 23 '24 07:07 shadcn

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2024 7:16am

vercel[bot] avatar Jul 23 '24 07:07 vercel[bot]

@shadcn made a similar PR here https://github.com/shadcn-ui/ui/pull/4421 just noticed this one now, but my PR also adds a new feature, feel free to review it :)

flixlix avatar Jul 26 '24 13:07 flixlix

Pinging @shadcn to review

AhmedBaset avatar Jul 31 '24 07:07 AhmedBaset

v9 adds new functionality which also breaks extra styling: <DayPicker hideNavigation captionLayout="dropdown" />

https://daypicker.dev/docs/navigation#hidenavigation

Christophvh avatar Aug 07 '24 11:08 Christophvh

Hello all!

Please take a look at:

Version 9

Version 8

I'm new to open-source, what's normally the way that people contribute?

The code for above lives here.

My approach is aware of the switch RDP made with the aria-selected attributes and seems to be exactly matching the styles of v8. I had hoped to write some UI regression tests with storybook but it wasn't that great at detecting the subtle visual changes.

Currently having some teething issues with the navigation positioning when use opt to use a custom dropdown:

          <Calendar
            mode="single"
            captionLayout="dropdown"
            selected={date}
            onSelect={setDate}
            showOutsideDays={true}
            endMonth={new Date(2099, 11)}
            components={{
              Dropdown: MonthAndYearDropdown,
              Chevron: ({ orientation }) =>
                orientation === "left" ? (
                  <ChevronLeft className="size-4" />
                ) : (
                  <ChevronRight className="size-4" />
                ),
            }}
          />

Code for the above can be found here.

-Nick

Nhollas avatar Aug 12 '24 15:08 Nhollas

here

Hello all!

Please take a look at:

Version 9

Version 8

I'm new to open-source, what's normally the way that people contribute?

The code for above lives here.

My approach is aware of the switch RDP made with the aria-selected attributes and seems to be exactly matching the styles of v8. I had hoped to write some UI regression tests with storybook but it wasn't that great at detecting the subtle visual changes.

Currently having some teething issues with the navigation positioning when use opt to use a custom dropdown:

          <Calendar
            mode="single"
            captionLayout="dropdown"
            selected={date}
            onSelect={setDate}
            showOutsideDays={true}
            endMonth={new Date(2099, 11)}
            components={{
              Dropdown: MonthAndYearDropdown,
              Chevron: ({ orientation }) =>
                orientation === "left" ? (
                  <ChevronLeft className="size-4" />
                ) : (
                  <ChevronRight className="size-4" />
                ),
            }}
          />

Code for the above can be found here.

-Nick

NICE!

-> months: 'flex flex-col sm:flex-row gap-y-4 sm:gap-x-4 sm:gap-y-0', needs relative it seems

uschen avatar Oct 09 '24 01:10 uschen

@shadcn Is there any ETA or planned time when this will be merged? We are waiting quite eagerly for this for a while now already. We mainly want to upgrade due to the UTC dates support in react day picker v9, which we need for our use-case.

lukasbindreiter avatar Nov 05 '24 14:11 lukasbindreiter

any update on this?

jxnnyo avatar Feb 02 '25 20:02 jxnnyo

any updates???

emonorg avatar Feb 05 '25 17:02 emonorg

Woho good news everyone, it seems this has finally been done:

June 2025 Changelog - Calendar Component 🥳

lukasbindreiter avatar Jun 10 '25 07:06 lukasbindreiter

This is now shipped in latest. @AhmedBaset thanks for all your work on this. We took a different approach and also added Tailwind v4 support but appreciate your work here. Thank you.

shadcn avatar Jul 01 '25 12:07 shadcn