@veritree/ui 0.5.1 → 0.6.1
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/index.js +15 -2
- package/package.json +1 -1
- package/src/Avatar/VTAvatar.vue +50 -0
- package/src/Avatar/VTAvatarImage.vue +38 -0
- package/src/Avatar/VTAvatarText.vue +9 -0
- package/src/Drawer/VTDrawer.vue +0 -1
- package/src/Image/VTImage.vue +74 -0
- package/src/Image/VTImageCounter.vue +6 -0
- package/src/Image/VTImageHover.vue +5 -0
- package/src/Spinner/VTSpinner.vue +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import VTAvatar from './src/Avatar/VTAvatar.vue';
|
|
2
|
+
import VTAvatarImage from './src/Avatar/VTAvatarImage.vue';
|
|
3
|
+
import VTAvatarText from './src/Avatar/VTAvatarText.vue';
|
|
4
|
+
import VTImage from './src/Image/VTImage.vue';
|
|
5
|
+
import VTImageCounter from './src/Image/VTImageCounter.vue';
|
|
6
|
+
import VTImageHover from './src/Image/VTImageHover.vue';
|
|
7
|
+
|
|
1
8
|
import VTAlert from './src/Alerts/VTAlert.vue';
|
|
2
9
|
|
|
3
|
-
|
|
10
|
+
import VTSpinner from './src/Spinner/VTSpinner.vue';
|
|
4
11
|
|
|
5
12
|
import VTButton from './src/Button/VTButton.vue';
|
|
6
13
|
// import VTButtonSave from './src/Button/VTButtonSave.vue';
|
|
@@ -49,8 +56,14 @@ import VTDrawerMain from './src/Drawer/VTDrawerMain.vue';
|
|
|
49
56
|
import VTDrawerOverlay from './src/Drawer/VTDrawerOverlay.vue';
|
|
50
57
|
|
|
51
58
|
export {
|
|
59
|
+
VTAvatar,
|
|
60
|
+
VTAvatarImage,
|
|
61
|
+
VTAvatarText,
|
|
62
|
+
VTImage,
|
|
63
|
+
VTImageCounter,
|
|
64
|
+
VTImageHover,
|
|
52
65
|
VTAlert,
|
|
53
|
-
|
|
66
|
+
VTSpinner,
|
|
54
67
|
VTButton,
|
|
55
68
|
// VTButtonSave,
|
|
56
69
|
VTInput,
|
package/package.json
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="{
|
|
4
|
+
Avatar: headless,
|
|
5
|
+
'flex items-center justify-center overflow-hidden rounded-full':
|
|
6
|
+
!headless,
|
|
7
|
+
'h-10 w-10': !small,
|
|
8
|
+
'h-8 w-8': small,
|
|
9
|
+
'border border-solid': !dark,
|
|
10
|
+
'bg-white text-fd-500': dark,
|
|
11
|
+
}"
|
|
12
|
+
>
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
name: 'VTAvatar',
|
|
20
|
+
|
|
21
|
+
provide() {
|
|
22
|
+
return {
|
|
23
|
+
api: () => {
|
|
24
|
+
const { dark: isDark, headless: isHeadless, light: isLight } = this;
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
isDark,
|
|
28
|
+
isHeadless,
|
|
29
|
+
isLight,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
props: {
|
|
36
|
+
headless: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false,
|
|
39
|
+
},
|
|
40
|
+
dark: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false,
|
|
43
|
+
},
|
|
44
|
+
small: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
</script>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VTImage v-if="src" :src="src" v-bind="attrs" width="40" />
|
|
3
|
+
<VTImage v-else-if="cdnSrc" :cdn-src="cdnSrc" v-bind="attrs" width="40" />
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script>
|
|
7
|
+
import VTImage from "../Image/VTImage.vue";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
name: "VTAvatarImage",
|
|
11
|
+
|
|
12
|
+
components: { VTImage },
|
|
13
|
+
|
|
14
|
+
props: {
|
|
15
|
+
alt: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
src: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "",
|
|
22
|
+
},
|
|
23
|
+
cdnSrc: {
|
|
24
|
+
type: [String, Object],
|
|
25
|
+
default: null,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
computed: {
|
|
30
|
+
attrs() {
|
|
31
|
+
return {
|
|
32
|
+
alt: this.alt,
|
|
33
|
+
class: "h-auto w-full",
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
</script>
|
package/src/Drawer/VTDrawer.vue
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<img
|
|
3
|
+
:src="srcComputed"
|
|
4
|
+
:class="{ 'animate-pulse': !isLoaded }"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
@load="onLoad"
|
|
7
|
+
@error="onError"
|
|
8
|
+
/>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import { specifyImageWidth } from "~/utils/images";
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
name: "VTImage",
|
|
16
|
+
|
|
17
|
+
props: {
|
|
18
|
+
src: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "",
|
|
21
|
+
},
|
|
22
|
+
cdnSrc: {
|
|
23
|
+
type: [String, Object],
|
|
24
|
+
default: null,
|
|
25
|
+
},
|
|
26
|
+
placeholder: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: `data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22600%22%20height%3D%22400%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20%25%7Bw%7D%20%25%7Bh%7D%22%20preserveAspectRatio%3D%22none%22%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20style%3D%22fill%3A%23bbb%3B%22%3E%3C%2Frect%3E%3C%2Fsvg%3E`,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
data() {
|
|
33
|
+
return {
|
|
34
|
+
canLoad: true,
|
|
35
|
+
isLoaded: false,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
computed: {
|
|
40
|
+
srcComputed() {
|
|
41
|
+
if (!this.isLoaded) {
|
|
42
|
+
return this.placeholder;
|
|
43
|
+
} else {
|
|
44
|
+
if (!this.canLoad) {
|
|
45
|
+
return this.placeholder;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (this.cdnSrc) {
|
|
49
|
+
return this.specifyImageWidth(this.cdnSrc, this.$attrs.width);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (this.src) {
|
|
53
|
+
return this.src;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return null;
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
methods: {
|
|
62
|
+
specifyImageWidth,
|
|
63
|
+
|
|
64
|
+
onLoad() {
|
|
65
|
+
this.isLoaded = true;
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
onError() {
|
|
69
|
+
this.canLoad = false;
|
|
70
|
+
this.$emit("error");
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
</script>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
>
|
|
9
9
|
<path
|
|
10
10
|
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
|
11
|
-
fill="
|
|
11
|
+
fill="currentColor"
|
|
12
12
|
/>
|
|
13
13
|
</svg>
|
|
14
14
|
</template>
|