Skip to content

Commit

Permalink
Add PopoverRef type
Browse files Browse the repository at this point in the history
  • Loading branch information
dklymenk committed Sep 11, 2023
1 parent cce2742 commit ee1d0dd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,11 @@ export declare const Pill: BoxComponent<PillOwnProps, 'strong'>

export type PopoverStatelessProps = BoxProps<'div'>

export type PopoverRef = {
open: () => void
close: () => void
}

export interface PopoverProps {
/**
* The position the Popover is on. Smart positioning might override this.
Expand Down Expand Up @@ -1553,10 +1558,14 @@ export interface PopoverProps {
children:
| ((props: {
toggle: () => void
getRef: (ref: React.RefObject<HTMLElement>) => void
getRef: (ref: React.RefObject<PopoverRef>) => void
isShown: boolean
}) => React.ReactNode)
| React.ReactNode
/**
* Pass a ref to Popover.
*/
ref?: React.RefObject<PopoverRef>
/**
* The display property passed to the Popover card.
*/
Expand Down Expand Up @@ -1955,7 +1964,7 @@ export interface SelectMenuItem {

export type SelectMenuPropsViewCallback = (args: { close(): void }) => React.ReactNode

export interface SelectMenuProps extends Omit<PopoverProps, 'position' | 'content'> {
export interface SelectMenuProps extends Omit<PopoverProps, 'position' | 'content' | 'ref'> {
/**
* The title of the Select Menu.
*/
Expand Down

0 comments on commit ee1d0dd

Please sign in to comment.