@@ -4,7 +4,7 @@ namespace Stacks {
44
55 export abstract class BasePopoverController extends StacksController {
66 // @ts -ignore
7- private popper ! : Popper ;
7+ private floatingUI ! : FloatingUICore ;
88
99 protected popoverElement ! : HTMLElement ;
1010
@@ -71,7 +71,7 @@ namespace Stacks {
7171 this . validate ( ) ;
7272 if ( this . isVisible ) {
7373 // just call initialize here, not show. This keeps already visible popovers from adding/firing document events
74- this . initializePopper ( ) ;
74+ this . initializeFloatingUI ( ) ;
7575 } else if ( this . data . get ( "auto-show" ) === "true" ) {
7676 this . show ( null ) ;
7777 }
@@ -84,9 +84,9 @@ namespace Stacks {
8484 */
8585 disconnect ( ) {
8686 this . hide ( ) ;
87- if ( this . popper ) {
88- this . popper . destroy ( ) ;
89- delete this . popper ;
87+ if ( this . floatingUI ) {
88+ this . floatingUI . destroy ( ) ;
89+ delete this . floatingUI ;
9090 }
9191 super . disconnect ( ) ;
9292 }
@@ -110,8 +110,8 @@ namespace Stacks {
110110 dispatcher : dispatcherElement
111111 } ) . defaultPrevented ) { return ; }
112112
113- if ( ! this . popper ) {
114- this . initializePopper ( ) ;
113+ if ( ! this . floatingUI ) {
114+ this . initializeFloatingUI ( ) ;
115115 }
116116
117117 this . popoverElement ! . classList . add ( "is-visible" ) ;
@@ -136,10 +136,10 @@ namespace Stacks {
136136
137137 this . popoverElement . classList . remove ( "is-visible" ) ;
138138
139- if ( this . popper ) {
139+ if ( this . floatingUI ) {
140140 // completely destroy the popper on hide; this is in line with Popper.js's performance recommendations
141- this . popper . destroy ( ) ;
142- delete this . popper ;
141+ this . floatingUI . destroy ( ) ;
142+ delete this . floatingUI ;
143143 }
144144
145145 // on first interaction, hide-on-outside-click with value "after-dismissal" reverts to the default behavior
@@ -180,25 +180,29 @@ namespace Stacks {
180180 /**
181181 * Initializes the Popper for this instance
182182 */
183- private initializePopper ( ) {
183+ private initializeFloatingUI ( ) {
184184 // @ts -ignore
185- this . popper = Popper . createPopper ( this . referenceElement , this . popoverElement , {
186- placement : this . data . get ( "placement" ) || "bottom" ,
187- modifiers : [
188- {
189- name : "offset" ,
190- options : {
191- offset : [ 0 , 10 ] , // The entire popover should be 10px away from the element
192- }
193- } ,
194- {
195- name : "arrow" ,
196- options : {
197- element : ".s-popover--arrow"
198- } ,
199- } ,
200- ]
201- } ) ;
185+ // this.floatingUI = FloatingUICore.computePosition(this.refrenceElement, this.popoverElement, {
186+ // // @ts -ignore
187+ // middleware: [ FloatingUICore.offset(), FloatingUICore.flip(), FloatingUICore.shift() ]
188+ // });
189+ // this.floatingUI = FloatingUICore.createPopper(this.referenceElement, this.popoverElement, {
190+ // placement: this.data.get("placement") || "bottom",
191+ // modifiers: [
192+ // {
193+ // name: "offset",
194+ // options: {
195+ // offset: [0, 10], // The entire popover should be 10px away from the element
196+ // }
197+ // },
198+ // {
199+ // name: "arrow",
200+ // options: {
201+ // element: ".s-popover--arrow"
202+ // },
203+ // },
204+ // ]
205+ // });
202206 }
203207
204208 /**
@@ -262,8 +266,8 @@ namespace Stacks {
262266 * Schedules the popover to update on the next animation frame if visible
263267 */
264268 protected scheduleUpdate ( ) {
265- if ( this . popper && this . isVisible ) {
266- this . popper . update ( ) ;
269+ if ( this . floatingUI && this . isVisible ) {
270+ this . floatingUI . update ( ) ;
267271 }
268272 }
269273 }
0 commit comments