@kiva/kv-components 6.6.0 → 6.8.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,8 +1,12 @@
1
- import { toRefs as f, computed as o, openBlock as n, createElementBlock as s, normalizeClass as r, createElementVNode as i, toDisplayString as h, createCommentVNode as v } from "vue";
2
- import { isLegacyPlaceholderAvatar as g, randomizedUserAvatarClass as y } from "../utils/imageUtils.js";
3
- import _ from "../_virtual/_plugin-vue_export-helper.js";
4
- const x = {
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 = {
5
6
  name: "KvUserAvatar",
7
+ components: {
8
+ KvLoadingPlaceholder: H
9
+ },
6
10
  props: {
7
11
  /**
8
12
  * The name of the lender
@@ -26,46 +30,54 @@ const x = {
26
30
  default: !1
27
31
  }
28
32
  },
29
- setup(w) {
33
+ setup(c) {
30
34
  const {
31
- lenderName: l,
32
- lenderImageUrl: e,
33
- isSmall: t
34
- } = f(w), m = o(() => l.value === "" && e.value === "" || l.value === "Anonymous"), c = () => {
35
- const a = t != null && t.value ? "tw-w-3 tw-h-3 tw-text-h4" : "tw-w-6 tw-h-6 tw-text-h2";
36
- return `${y()} ${a}`;
37
- }, d = o(() => {
38
- var a;
39
- return ((a = e == null ? void 0 : e.value) == null ? void 0 : a.split("/").pop()) ?? "";
40
- }), u = o(() => {
41
- var a;
42
- return (a = l == null ? void 0 : l.value) == null ? void 0 : a.substring(0, 1).toUpperCase();
43
- });
44
- return {
45
- isAnonymousUser: m,
46
- avatarClass: c,
47
- imageFilename: d,
48
- lenderNameFirstLetter: u,
49
- isLegacyPlaceholderAvatar: g
35
+ lenderName: a,
36
+ lenderImageUrl: t,
37
+ isSmall: e
38
+ } = _(c), r = h(!0), m = h(null), w = d(() => a.value === "" && t.value === "" || a.value === "Anonymous"), u = () => {
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(() => {
42
+ var l;
43
+ return ((l = t == null ? void 0 : t.value) == null ? void 0 : l.split("/").pop()) ?? "";
44
+ }), y = d(() => {
45
+ var l;
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(() => {
51
+ const l = m.value;
52
+ l && (l != null && l.complete) && !(l != null && l.naturalWidth) && f();
53
+ }), {
54
+ isAnonymousUser: w,
55
+ avatarClass: u,
56
+ imageFilename: g,
57
+ lenderNameFirstLetter: y,
58
+ isLegacyPlaceholderAvatar: F,
59
+ isLoading: r,
60
+ onImgLoad: f
50
61
  };
51
62
  }
52
- }, C = { key: 1 }, S = ["src"], A = { class: "tw-self-center" };
53
- function F(w, l, e, t, m, c) {
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");
54
66
  return n(), s("div", {
55
- class: r(["data-hj-suppress tw-flex", { "tw-w-3": e.isSmall, "tw-w-6": !e.isSmall }])
67
+ class: o(["data-hj-suppress tw-flex", { "tw-w-3": t.isSmall, "tw-w-6": !t.isSmall }])
56
68
  }, [
57
- t.isAnonymousUser ? (n(), s("div", {
69
+ e.isAnonymousUser ? (n(), s("div", {
58
70
  key: 0,
59
- class: r(["tw-rounded-full tw-bg-brand tw-inline-flex tw-align-center tw-justify-center", { "tw-w-3 tw-h-3": e.isSmall, "tw-w-6 tw-h-6": !e.isSmall }])
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 }])
60
72
  }, [
61
73
  (n(), s("svg", {
62
- class: r(["tw-h-full tw-text-brand", { "tw-w-3 tw-h-3": e.isSmall }]),
74
+ class: o(["tw-h-full tw-text-brand", { "tw-w-3 tw-h-3": t.isSmall }]),
63
75
  width: "25",
64
76
  height: "37",
65
77
  viewBox: "0 0 25 37",
66
78
  fill: "none",
67
79
  xmlns: "http://www.w3.org/2000/svg"
68
- }, l[0] || (l[0] = [
80
+ }, a[1] || (a[1] = [
69
81
  i("path", {
70
82
  d: "M8.22861 0.875H0.857178V36.3125H8.22861V0.875Z",
71
83
  fill: "white"
@@ -79,21 +91,29 @@ function F(w, l, e, t, m, c) {
79
91
  fill: "white"
80
92
  }, null, -1)
81
93
  ]), 2))
82
- ], 2)) : !t.isLegacyPlaceholderAvatar(t.imageFilename) && t.imageFilename ? (n(), s("div", C, [
83
- i("img", {
84
- src: e.lenderImageUrl,
94
+ ], 2)) : !e.isLegacyPlaceholderAvatar(e.imageFilename) && e.imageFilename ? (n(), s("div", B, [
95
+ e.isLoading ? (n(), L(w, {
96
+ 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", {
100
+ ref: "imageRef",
101
+ src: t.lenderImageUrl,
85
102
  alt: "Image of lender",
86
- class: r(["tw-rounded-full tw-inline-block", { "tw-w-3 tw-h-3": e.isSmall, "tw-w-6 tw-h-6": !e.isSmall }])
87
- }, null, 10, S)
88
- ])) : t.isLegacyPlaceholderAvatar(t.imageFilename) || !t.imageFilename ? (n(), s("div", {
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]
107
+ ])
108
+ ])) : e.isLegacyPlaceholderAvatar(e.imageFilename) || !e.imageFilename ? (n(), s("div", {
89
109
  key: 2,
90
- class: r(["tw-rounded-full tw-inline-flex tw-align-center tw-justify-center", t.avatarClass()])
110
+ class: o(["tw-rounded-full tw-inline-flex tw-align-center tw-justify-center", e.avatarClass()])
91
111
  }, [
92
- i("span", A, h(t.lenderNameFirstLetter), 1)
112
+ i("span", M, A(e.lenderNameFirstLetter), 1)
93
113
  ], 2)) : v("", !0)
94
114
  ], 2);
95
115
  }
96
- const b = /* @__PURE__ */ _(x, [["render", F]]);
116
+ const R = /* @__PURE__ */ b(p, [["render", N]]);
97
117
  export {
98
- b as default
118
+ R as default
99
119
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "6.6.0",
3
+ "version": "6.8.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": "640523fa07c1542647510ed746713061bb595ded"
110
+ "gitHead": "f3c26f5415ac8b9bd051eb8624aec077a7b89440"
111
111
  }