1- import * as React from " react" ;
2- import * as PopperJS from " @popperjs/core" ;
1+ import * as React from ' react' ;
2+ import * as PopperJS from ' @popperjs/core' ;
33
44interface ManagerProps {
55 children : React . ReactNode ;
66}
7- export class Manager extends React . Component < ManagerProps , { } > { }
7+ export class Manager extends React . Component < ManagerProps , { } > { }
88
99interface ReferenceChildrenProps {
1010 // React refs are supposed to be contravariant (allows a more general type to be passed rather than a more specific one)
@@ -17,7 +17,7 @@ interface ReferenceProps {
1717 children : ( props : ReferenceChildrenProps ) => React . ReactNode ;
1818 innerRef ?: React . Ref < any > ;
1919}
20- export class Reference extends React . Component < ReferenceProps , { } > { }
20+ export class Reference extends React . Component < ReferenceProps , { } > { }
2121
2222export interface PopperArrowProps {
2323 ref : React . Ref < any > ;
@@ -44,6 +44,20 @@ export interface PopperProps {
4444 placement ?: PopperJS . Placement ;
4545 strategy ?: PopperJS . PositioningStrategy ;
4646 referenceElement ?: HTMLElement | PopperJS . VirtualElement ;
47- onFirstUpdate ?: ( state : Partial < PopperJS . State > ) => void
47+ onFirstUpdate ?: ( state : Partial < PopperJS . State > ) => void ;
4848}
49- export class Popper extends React . Component < PopperProps , { } > { }
49+ export class Popper extends React . Component < PopperProps , { } > { }
50+
51+ export function usePopper (
52+ referenceElement ?: Element | null ,
53+ popperElement ?: HTMLElement | null ,
54+ options ?: Partial < PopperJS . Options > & {
55+ createPopper ?: typeof PopperJS . createPopper ;
56+ }
57+ ) : {
58+ styles : { [ key : string ] : React . CSSProperties } ;
59+ attributes : { [ key : string ] : { [ key : string ] : string } } ;
60+ state : PopperJS . State ;
61+ update : Pick < PopperJS . Instance , 'update' > ;
62+ forceUpdate : Pick < PopperJS . Instance , 'forceUpdate' > ;
63+ } ;
0 commit comments