@instadapp/avocado-base 0.0.43 → 0.0.46
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.
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import CopySVG from '~/assets/images/icons/copy.svg'
|
|
3
|
+
import CheckCircle from '~/assets/images/icons/check-circle.svg'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
text: string
|
|
7
|
+
iconOnly?: boolean
|
|
8
|
+
successText?: string
|
|
9
|
+
}>()
|
|
10
|
+
const { copy, copied } = useClipboard()
|
|
11
|
+
const slots = useSlots()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<button
|
|
16
|
+
class="text-slate-400 font-semibold inline-flex items-center gap-2.5"
|
|
17
|
+
@click.stop="copy(text)"
|
|
18
|
+
>
|
|
19
|
+
<Transition mode="out-in" name="slide-left">
|
|
20
|
+
<span v-if="copied && !iconOnly"> {{ successText || 'Copied' }} </span>
|
|
21
|
+
<span v-else-if="slots.content">
|
|
22
|
+
<slot name="content" />
|
|
23
|
+
</span>
|
|
24
|
+
</Transition>
|
|
25
|
+
|
|
26
|
+
<Transition mode="out-in" name="slide">
|
|
27
|
+
<CheckCircle
|
|
28
|
+
v-if="copied"
|
|
29
|
+
class="w-4 h-4 shrink-0 dark:text-slate-900 text-white svg-circle"
|
|
30
|
+
/>
|
|
31
|
+
<slot v-else-if="slots.copy" name="copy" />
|
|
32
|
+
<slot v-else name="copy-icon">
|
|
33
|
+
<CopySVG />
|
|
34
|
+
</slot>
|
|
35
|
+
</Transition>
|
|
36
|
+
</button>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<style scoped>
|
|
40
|
+
.slide-left-enter-active,
|
|
41
|
+
.slide-left-leave-active {
|
|
42
|
+
transition: all 0.1s ease-out;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.slide-left-enter-from {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
transform: translateX(30px);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.slide-left-leave-to {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
transform: translateX(-30px);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.slide-enter-active,
|
|
56
|
+
.slide-leave-active {
|
|
57
|
+
transition: opacity 0.1s ease;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.slide-enter-from,
|
|
61
|
+
.slide-leave-to {
|
|
62
|
+
opacity: 0;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
package/package.json
CHANGED
package/utils/formatter.ts
CHANGED
|
@@ -71,11 +71,8 @@ export function formatDecimal(value: string | number, fractionDigits?: number) {
|
|
|
71
71
|
const num = toBN(value);
|
|
72
72
|
let decimals;
|
|
73
73
|
|
|
74
|
-
if (num.lt(
|
|
74
|
+
if (num.lt(1)) {
|
|
75
75
|
decimals = 4;
|
|
76
|
-
}
|
|
77
|
-
else if (num.lt(1)) {
|
|
78
|
-
decimals = 8;
|
|
79
76
|
} else if (num.lt(10)) {
|
|
80
77
|
decimals = 6;
|
|
81
78
|
} else if (num.lt(100)) {
|