adminforth 2.4.0-next.212 → 2.4.0-next.213
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/spa/src/afcl/Tooltip.vue +26 -17
- package/package.json +1 -1
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="triggerEl" class="afcl-tooltip inline-flex items-center">
|
|
2
|
+
<div ref="triggerEl" class="afcl-tooltip inline-flex items-center" @mouseenter="mouseOn" @mouseleave="mouseOff">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</div>
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
<teleport to="body" v-if="showTooltip">
|
|
6
|
+
<div
|
|
7
|
+
role="tooltip"
|
|
8
|
+
class="absolute z-20 invisible inline-block px-3 py-2 text-sm font-medium text-lightTooltipText dark:darkTooltipText transition-opacity duration-300 bg-lightTooltipBackground rounded-lg shadow-sm opacity-0 tooltip dark:bg-darkTooltipBackground"
|
|
9
|
+
ref="tooltip"
|
|
10
|
+
>
|
|
11
|
+
<slot name="tooltip"></slot>
|
|
12
|
+
<div class="tooltip-arrow" data-popper-arrow></div>
|
|
13
|
+
</div>
|
|
14
|
+
</teleport>
|
|
13
15
|
</template>
|
|
14
16
|
|
|
15
17
|
<script setup lang="ts">
|
|
16
|
-
import { ref,
|
|
18
|
+
import { ref, nextTick, type Ref } from 'vue';
|
|
17
19
|
import { Tooltip } from 'flowbite';
|
|
18
20
|
|
|
19
21
|
const triggerEl = ref(null);
|
|
20
22
|
const tooltip = ref(null);
|
|
21
|
-
|
|
23
|
+
const showTooltip = ref(false);
|
|
22
24
|
const tp: Ref<Tooltip|null> = ref(null);
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
async function mouseOn() {
|
|
27
|
+
showTooltip.value = true;
|
|
26
28
|
await nextTick();
|
|
29
|
+
|
|
30
|
+
tp.value?.destroy();
|
|
31
|
+
|
|
27
32
|
tp.value = new Tooltip(
|
|
28
33
|
tooltip.value,
|
|
29
34
|
triggerEl.value,
|
|
@@ -32,11 +37,15 @@ onMounted(async () => {
|
|
|
32
37
|
triggerType: 'hover',
|
|
33
38
|
},
|
|
34
39
|
);
|
|
35
|
-
})
|
|
36
40
|
|
|
41
|
+
tp.value.show();
|
|
42
|
+
}
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
function mouseOff() {
|
|
45
|
+
tp.value?.hide();
|
|
40
46
|
tp.value?.destroy();
|
|
41
|
-
|
|
47
|
+
tp.value = null;
|
|
48
|
+
showTooltip.value = false;
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
</script>
|