@kiva/kv-components 6.8.0 → 6.9.0
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/vue/KvUserAvatar.js +64 -50
- package/package.json +2 -2
package/dist/vue/KvUserAvatar.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { toRefs as
|
|
2
|
-
import { isLegacyPlaceholderAvatar as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { toRefs as A, ref as v, computed as d, onMounted as F, resolveComponent as U, openBlock as n, createElementBlock as o, normalizeClass as r, createElementVNode as s, createBlock as p, normalizeStyle as H, createCommentVNode as y, withDirectives as b, vShow as B, toDisplayString as I } from "vue";
|
|
2
|
+
import { isLegacyPlaceholderAvatar as P, randomizedUserAvatarClass as D } from "../utils/imageUtils.js";
|
|
3
|
+
import M from "./KvLoadingPlaceholder.js";
|
|
4
|
+
import N from "../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
const V = {
|
|
6
6
|
name: "KvUserAvatar",
|
|
7
7
|
components: {
|
|
8
|
-
KvLoadingPlaceholder:
|
|
8
|
+
KvLoadingPlaceholder: M
|
|
9
9
|
},
|
|
10
10
|
props: {
|
|
11
11
|
/**
|
|
@@ -30,90 +30,104 @@ const p = {
|
|
|
30
30
|
default: !1
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
setup(
|
|
33
|
+
setup(u) {
|
|
34
34
|
const {
|
|
35
35
|
lenderName: a,
|
|
36
36
|
lenderImageUrl: t,
|
|
37
37
|
isSmall: e
|
|
38
|
-
} =
|
|
38
|
+
} = A(u), i = v(!0), m = v(null), c = d(() => a.value === "" && t.value === "" || a.value === "Anonymous"), f = () => {
|
|
39
39
|
const l = e != null && e.value ? "tw-w-3 tw-h-3 tw-text-h4" : "tw-w-6 tw-h-6 tw-text-h2";
|
|
40
|
-
return `${
|
|
41
|
-
},
|
|
40
|
+
return `${D()} ${l}`;
|
|
41
|
+
}, S = d(() => {
|
|
42
42
|
var l;
|
|
43
43
|
return ((l = t == null ? void 0 : t.value) == null ? void 0 : l.split("/").pop()) ?? "";
|
|
44
|
-
}),
|
|
44
|
+
}), _ = d(() => {
|
|
45
45
|
var l;
|
|
46
46
|
return (l = a == null ? void 0 : a.value) == null ? void 0 : l.substring(0, 1).toUpperCase();
|
|
47
|
-
}),
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
47
|
+
}), g = () => {
|
|
48
|
+
i.value = !1;
|
|
49
|
+
}, C = (l, w = 1e4) => new Promise((L, k) => {
|
|
50
|
+
const x = Date.now() + w, h = () => {
|
|
51
|
+
l.complete ? L(l) : Date.now() > x ? k(new Error(`Timeout: ${l.src}`)) : setTimeout(h, 50);
|
|
52
|
+
};
|
|
53
|
+
h();
|
|
54
|
+
});
|
|
55
|
+
return F(async () => {
|
|
51
56
|
const l = m.value;
|
|
52
|
-
|
|
57
|
+
try {
|
|
58
|
+
await C(l), g();
|
|
59
|
+
} catch (w) {
|
|
60
|
+
console.log(w.message);
|
|
61
|
+
}
|
|
53
62
|
}), {
|
|
54
|
-
isAnonymousUser:
|
|
55
|
-
avatarClass:
|
|
56
|
-
imageFilename:
|
|
57
|
-
lenderNameFirstLetter:
|
|
58
|
-
isLegacyPlaceholderAvatar:
|
|
59
|
-
isLoading:
|
|
60
|
-
onImgLoad:
|
|
63
|
+
isAnonymousUser: c,
|
|
64
|
+
avatarClass: f,
|
|
65
|
+
imageFilename: S,
|
|
66
|
+
lenderNameFirstLetter: _,
|
|
67
|
+
isLegacyPlaceholderAvatar: P,
|
|
68
|
+
isLoading: i,
|
|
69
|
+
onImgLoad: g,
|
|
70
|
+
imageRef: m
|
|
61
71
|
};
|
|
62
72
|
}
|
|
63
|
-
},
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
return n(),
|
|
67
|
-
class:
|
|
73
|
+
}, j = { key: 1 }, z = ["src"], E = { class: "tw-self-center" };
|
|
74
|
+
function K(u, a, t, e, i, m) {
|
|
75
|
+
const c = U("kv-loading-placeholder");
|
|
76
|
+
return n(), o("div", {
|
|
77
|
+
class: r(["data-hj-suppress tw-flex", { "tw-w-3": t.isSmall, "tw-w-6": !t.isSmall }])
|
|
68
78
|
}, [
|
|
69
|
-
e.isAnonymousUser ? (n(),
|
|
79
|
+
e.isAnonymousUser ? (n(), o("div", {
|
|
70
80
|
key: 0,
|
|
71
|
-
class:
|
|
81
|
+
class: r(["tw-rounded-full tw-bg-brand tw-inline-flex tw-align-center tw-justify-center", { "tw-w-3 tw-h-3": t.isSmall, "tw-w-6 tw-h-6": !t.isSmall }])
|
|
72
82
|
}, [
|
|
73
|
-
(n(),
|
|
74
|
-
class:
|
|
83
|
+
(n(), o("svg", {
|
|
84
|
+
class: r(["tw-h-full tw-text-brand", { "tw-w-3 tw-h-3": t.isSmall }]),
|
|
75
85
|
width: "25",
|
|
76
86
|
height: "37",
|
|
77
87
|
viewBox: "0 0 25 37",
|
|
78
88
|
fill: "none",
|
|
79
89
|
xmlns: "http://www.w3.org/2000/svg"
|
|
80
90
|
}, a[1] || (a[1] = [
|
|
81
|
-
|
|
91
|
+
s("path", {
|
|
82
92
|
d: "M8.22861 0.875H0.857178V36.3125H8.22861V0.875Z",
|
|
83
93
|
fill: "white"
|
|
84
94
|
}, null, -1),
|
|
85
|
-
|
|
95
|
+
s("path", {
|
|
86
96
|
d: "M10.1143 23.2751C21.9428 23.2751 24.6857 13.2126 24.6857 11.4626H23.6571C11.8286 11.4626 9.08569 21.5251 9.08569 23.2751H10.1143Z",
|
|
87
97
|
fill: "white"
|
|
88
98
|
}, null, -1),
|
|
89
|
-
|
|
99
|
+
s("path", {
|
|
90
100
|
d: "M9.08569 24.2376C9.08569 26.0751 11.1428 36.3126 23.8285 36.3126H24.8571C24.8571 34.4751 22.8 24.2376 10.1143 24.2376H9.08569Z",
|
|
91
101
|
fill: "white"
|
|
92
102
|
}, null, -1)
|
|
93
103
|
]), 2))
|
|
94
|
-
], 2)) : !e.isLegacyPlaceholderAvatar(e.imageFilename) && e.imageFilename ? (n(),
|
|
95
|
-
e.isLoading ? (n(),
|
|
104
|
+
], 2)) : !e.isLegacyPlaceholderAvatar(e.imageFilename) && e.imageFilename ? (n(), o("div", j, [
|
|
105
|
+
e.isLoading ? (n(), p(c, {
|
|
96
106
|
key: 0,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
style: H({
|
|
108
|
+
width: t.isSmall ? "1.5rem" : "3rem",
|
|
109
|
+
height: t.isSmall ? "1.5rem" : "3rem"
|
|
110
|
+
}),
|
|
111
|
+
class: "!tw-rounded-full"
|
|
112
|
+
}, null, 8, ["style"])) : y("", !0),
|
|
113
|
+
b(s("img", {
|
|
100
114
|
ref: "imageRef",
|
|
101
115
|
src: t.lenderImageUrl,
|
|
102
116
|
alt: "Image of lender",
|
|
103
|
-
class:
|
|
104
|
-
onLoad: a[0] || (a[0] = (
|
|
105
|
-
}, null, 42,
|
|
106
|
-
[
|
|
117
|
+
class: r(["tw-rounded-full tw-inline-block", { "tw-w-3 tw-h-3": t.isSmall, "tw-w-6 tw-h-6": !t.isSmall }]),
|
|
118
|
+
onLoad: a[0] || (a[0] = (f) => e.onImgLoad())
|
|
119
|
+
}, null, 42, z), [
|
|
120
|
+
[B, !e.isLoading]
|
|
107
121
|
])
|
|
108
|
-
])) : e.isLegacyPlaceholderAvatar(e.imageFilename) || !e.imageFilename ? (n(),
|
|
122
|
+
])) : e.isLegacyPlaceholderAvatar(e.imageFilename) || !e.imageFilename ? (n(), o("div", {
|
|
109
123
|
key: 2,
|
|
110
|
-
class:
|
|
124
|
+
class: r(["tw-rounded-full tw-inline-flex tw-align-center tw-justify-center", e.avatarClass()])
|
|
111
125
|
}, [
|
|
112
|
-
|
|
113
|
-
], 2)) :
|
|
126
|
+
s("span", E, I(e.lenderNameFirstLetter), 1)
|
|
127
|
+
], 2)) : y("", !0)
|
|
114
128
|
], 2);
|
|
115
129
|
}
|
|
116
|
-
const
|
|
130
|
+
const G = /* @__PURE__ */ N(V, [["render", K]]);
|
|
117
131
|
export {
|
|
118
|
-
|
|
132
|
+
G as default
|
|
119
133
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"embla-carousel-fade",
|
|
108
108
|
"popper.js"
|
|
109
109
|
],
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "8ba3d6143250045239fe8ca0f1a130012fefb9d2"
|
|
111
111
|
}
|