@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.
@@ -1,11 +1,11 @@
1
- import { toRefs as _, ref as h, computed as d, onMounted as S, resolveComponent as C, openBlock as n, createElementBlock as s, normalizeClass as o, createElementVNode as i, createBlock as L, createCommentVNode as v, withDirectives as x, vShow as k, toDisplayString as A } from "vue";
2
- import { isLegacyPlaceholderAvatar as F, randomizedUserAvatarClass as U } from "../utils/imageUtils.js";
3
- import H from "./KvLoadingPlaceholder.js";
4
- import b from "../_virtual/_plugin-vue_export-helper.js";
5
- const p = {
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: H
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(c) {
33
+ setup(u) {
34
34
  const {
35
35
  lenderName: a,
36
36
  lenderImageUrl: t,
37
37
  isSmall: e
38
- } = _(c), r = h(!0), m = h(null), w = d(() => a.value === "" && t.value === "" || a.value === "Anonymous"), u = () => {
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 `${U()} ${l}`;
41
- }, g = d(() => {
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
- }), y = d(() => {
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
- }), f = () => {
48
- r.value = !1;
49
- };
50
- return S(() => {
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
- l && (l != null && l.complete) && !(l != null && l.naturalWidth) && f();
57
+ try {
58
+ await C(l), g();
59
+ } catch (w) {
60
+ console.log(w.message);
61
+ }
53
62
  }), {
54
- isAnonymousUser: w,
55
- avatarClass: u,
56
- imageFilename: g,
57
- lenderNameFirstLetter: y,
58
- isLegacyPlaceholderAvatar: F,
59
- isLoading: r,
60
- onImgLoad: f
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
- }, B = { key: 1 }, I = ["src"], M = { class: "tw-self-center" };
64
- function N(c, a, t, e, r, m) {
65
- const w = C("kv-loading-placeholder");
66
- return n(), s("div", {
67
- class: o(["data-hj-suppress tw-flex", { "tw-w-3": t.isSmall, "tw-w-6": !t.isSmall }])
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(), s("div", {
79
+ e.isAnonymousUser ? (n(), o("div", {
70
80
  key: 0,
71
- class: o(["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 }])
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(), s("svg", {
74
- class: o(["tw-h-full tw-text-brand", { "tw-w-3 tw-h-3": t.isSmall }]),
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
- i("path", {
91
+ s("path", {
82
92
  d: "M8.22861 0.875H0.857178V36.3125H8.22861V0.875Z",
83
93
  fill: "white"
84
94
  }, null, -1),
85
- i("path", {
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
- i("path", {
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(), s("div", B, [
95
- e.isLoading ? (n(), L(w, {
104
+ ], 2)) : !e.isLegacyPlaceholderAvatar(e.imageFilename) && e.imageFilename ? (n(), o("div", j, [
105
+ e.isLoading ? (n(), p(c, {
96
106
  key: 0,
97
- class: o(["!tw-rounded-full", { "!tw-w-3 !tw-h-3": t.isSmall, "!tw-w-6 !tw-h-6": !t.isSmall }])
98
- }, null, 8, ["class"])) : v("", !0),
99
- x(i("img", {
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: o(["tw-rounded-full tw-inline-block", { "tw-w-3 tw-h-3": t.isSmall, "tw-w-6 tw-h-6": !t.isSmall }]),
104
- onLoad: a[0] || (a[0] = (u) => e.onImgLoad())
105
- }, null, 42, I), [
106
- [k, !e.isLoading]
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(), s("div", {
122
+ ])) : e.isLegacyPlaceholderAvatar(e.imageFilename) || !e.imageFilename ? (n(), o("div", {
109
123
  key: 2,
110
- class: o(["tw-rounded-full tw-inline-flex tw-align-center tw-justify-center", e.avatarClass()])
124
+ class: r(["tw-rounded-full tw-inline-flex tw-align-center tw-justify-center", e.avatarClass()])
111
125
  }, [
112
- i("span", M, A(e.lenderNameFirstLetter), 1)
113
- ], 2)) : v("", !0)
126
+ s("span", E, I(e.lenderNameFirstLetter), 1)
127
+ ], 2)) : y("", !0)
114
128
  ], 2);
115
129
  }
116
- const R = /* @__PURE__ */ b(p, [["render", N]]);
130
+ const G = /* @__PURE__ */ N(V, [["render", K]]);
117
131
  export {
118
- R as default
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.8.0",
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": "f3c26f5415ac8b9bd051eb8624aec077a7b89440"
110
+ "gitHead": "8ba3d6143250045239fe8ca0f1a130012fefb9d2"
111
111
  }