segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.36k stars 833 forks source link

Add PopoverRef type #1664

Open dklymenk opened 10 months ago

dklymenk commented 10 months ago

Overview

Popover supports a ref prop that doesn't seem to be documented or typed.

Here is a codesandbox that showcases the ref actually working at run time, but with type errors. This PR addresses those errors by:

I also tweaked the definition for childred prop. Specifically, the getRef prop passed to children to use the new PopoverRef instead of the generic HTMLElement.

Since the type definition for select menu relies on PopoverProps, I added the ref to the list of omitted properties as that component doesn't actually have any ref-related functionality.

The changes can be tested by trying to pass a ref created by useRef<PopoverRef> and making sure there are no type errors related to calling open or close.

Documentation

netlify[bot] commented 10 months ago

Deploy Preview for evergreen-storybook ready!

Name Link
Latest commit ee1d0dd783ba670049a781035aa1ca5b3be72838
Latest deploy log https://app.netlify.com/sites/evergreen-storybook/deploys/64ff8cd1e9517d0009d48d67
Deploy Preview https://deploy-preview-1664--evergreen-storybook.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.