@@ -2,8 +2,7 @@ import tippy from 'tippy.js';
2
2
3
3
const visibleInstances = new Set ( ) ;
4
4
5
- export function createTippy ( target , opts = { } ) {
6
- const { onHide, onShow, onDestroy, ...other } = opts ;
5
+ export function createTippy ( target , { onHide, onShow, onDestroy, role, content, ...other } = { } ) {
7
6
const instance = tippy ( target , {
8
7
appendTo : document . body ,
9
8
animation : false ,
@@ -32,15 +31,16 @@ export function createTippy(target, opts = {}) {
32
31
} ,
33
32
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>` ,
34
33
role : 'menu' , // HTML role attribute, only tooltips should use "tooltip"
35
- theme : other . role || 'menu' , // CSS theme, we support either "tooltip" or "menu"
34
+ theme : role || 'menu' , // CSS theme, we support either "tooltip" or "menu"
35
+ content,
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 ( other . content instanceof Element ) {
43
- other . content . classList . remove ( 'tippy-target' ) ;
42
+ if ( content instanceof Element ) {
43
+ content . classList . remove ( 'tippy-target' ) ;
44
44
}
45
45
46
46
return instance ;
0 commit comments