evergreen icon indicating copy to clipboard operation
evergreen copied to clipboard

Add PopoverRef type

Open dklymenk opened this issue 2 years ago • 1 comments

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:

  • introducing a PopoverRef type that has the signatures for open and close methods
  • adding an optional ref prop to PopoverProps

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

  • [x] Updated Typescript types and/or component PropTypes
  • [ ] Added / modified component docs
  • [ ] Added / modified Storybook stories

dklymenk avatar Sep 11 '23 20:09 dklymenk

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.

netlify[bot] avatar Sep 11 '23 20:09 netlify[bot]