@@ -2,7 +2,8 @@ import tippy from 'tippy.js';
2
2
3
3
const visibleInstances = new Set ( ) ;
4
4
5
- export function createTippy ( target , { onHide, onShow, onDestroy, role, content, ...other } = { } ) {
5
+ export function createTippy ( target , opts = { } ) {
6
+ const { onHide, onShow, onDestroy, ...other } = opts ;
6
7
const instance = tippy ( target , {
7
8
appendTo : document . body ,
8
9
animation : false ,
@@ -31,16 +32,15 @@ export function createTippy(target, {onHide, onShow, onDestroy, role, content, .
31
32
} ,
32
33
arrow : `<svg width="16" height="7"><path d="m0 7 8-7 8 7Z" class="tippy-svg-arrow-outer"/><path d="m0 8 8-7 8 7Z" class="tippy-svg-arrow-inner"/></svg>` ,
33
34
role : 'menu' , // HTML role attribute, only tooltips should use "tooltip"
34
- theme : role || 'menu' , // CSS theme, we support either "tooltip" or "menu"
35
- content,
35
+ theme : other . role || 'menu' , // CSS theme, we support either "tooltip" or "menu"
36
36
...other ,
37
37
} ) ;
38
38
39
39
// for popups where content refers to a DOM element, we use the 'tippy-target' class
40
40
// to initially hide the content, now we can remove it as the content has been removed
41
41
// from the DOM by tippy
42
- if ( content instanceof Element ) {
43
- content . classList . remove ( 'tippy-target' ) ;
42
+ if ( other . content instanceof Element ) {
43
+ other . content . classList . remove ( 'tippy-target' ) ;
44
44
}
45
45
46
46
return instance ;
0 commit comments