Add PopoverRef type
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
PopoverReftype that has the signatures foropenandclosemethods - adding an optional
refprop toPopoverProps
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
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...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.