@@ -4,7 +4,7 @@ namespace Stacks {
4
4
5
5
export abstract class BasePopoverController extends StacksController {
6
6
// @ts -ignore
7
- private popper ! : Popper ;
7
+ private floatingUI ! : FloatingUICore ;
8
8
9
9
protected popoverElement ! : HTMLElement ;
10
10
@@ -71,7 +71,7 @@ namespace Stacks {
71
71
this . validate ( ) ;
72
72
if ( this . isVisible ) {
73
73
// just call initialize here, not show. This keeps already visible popovers from adding/firing document events
74
- this . initializePopper ( ) ;
74
+ this . initializeFloatingUI ( ) ;
75
75
} else if ( this . data . get ( "auto-show" ) === "true" ) {
76
76
this . show ( null ) ;
77
77
}
@@ -84,9 +84,9 @@ namespace Stacks {
84
84
*/
85
85
disconnect ( ) {
86
86
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 ;
90
90
}
91
91
super . disconnect ( ) ;
92
92
}
@@ -110,8 +110,8 @@ namespace Stacks {
110
110
dispatcher : dispatcherElement
111
111
} ) . defaultPrevented ) { return ; }
112
112
113
- if ( ! this . popper ) {
114
- this . initializePopper ( ) ;
113
+ if ( ! this . floatingUI ) {
114
+ this . initializeFloatingUI ( ) ;
115
115
}
116
116
117
117
this . popoverElement ! . classList . add ( "is-visible" ) ;
@@ -136,10 +136,10 @@ namespace Stacks {
136
136
137
137
this . popoverElement . classList . remove ( "is-visible" ) ;
138
138
139
- if ( this . popper ) {
139
+ if ( this . floatingUI ) {
140
140
// 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 ;
143
143
}
144
144
145
145
// on first interaction, hide-on-outside-click with value "after-dismissal" reverts to the default behavior
@@ -180,25 +180,29 @@ namespace Stacks {
180
180
/**
181
181
* Initializes the Popper for this instance
182
182
*/
183
- private initializePopper ( ) {
183
+ private initializeFloatingUI ( ) {
184
184
// @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
+ // });
202
206
}
203
207
204
208
/**
@@ -262,8 +266,8 @@ namespace Stacks {
262
266
* Schedules the popover to update on the next animation frame if visible
263
267
*/
264
268
protected scheduleUpdate ( ) {
265
- if ( this . popper && this . isVisible ) {
266
- this . popper . update ( ) ;
269
+ if ( this . floatingUI && this . isVisible ) {
270
+ this . floatingUI . update ( ) ;
267
271
}
268
272
}
269
273
}
0 commit comments