@kiva/kv-components 6.69.2 → 7.0.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,5 +1,5 @@
1
1
  import r from "./KvUserAvatar.js";
2
- import { resolveComponent as o, openBlock as i, createElementBlock as a, createElementVNode as t, createVNode as c } from "vue";
2
+ import { resolveComponent as o, openBlock as a, createElementBlock as i, createElementVNode as t, createVNode as c } from "vue";
3
3
  import l from "../_virtual/_plugin-vue_export-helper.js";
4
4
  const s = {
5
5
  name: "KvActivityRow",
@@ -13,14 +13,15 @@ const s = {
13
13
  }
14
14
  }
15
15
  }, m = { class: "tw-flex tw-gap-x-1 tw-items-center" }, d = ["innerHTML"];
16
- function v(_, u, e, p, f, y) {
16
+ function v(_, p, e, u, f, w) {
17
17
  const n = o("KvUserAvatar");
18
- return i(), a("div", m, [
18
+ return a(), i("div", m, [
19
19
  t("div", null, [
20
20
  c(n, {
21
21
  "lender-name": e.activity.lenderName,
22
22
  "lender-image-url": e.activity.lenderImage,
23
- "is-small": !0
23
+ class: "tw-w-3 tw-h-3",
24
+ "is-small": ""
24
25
  }, null, 8, ["lender-name", "lender-image-url"])
25
26
  ]),
26
27
  t("div", null, [
@@ -1 +1 @@
1
- @media (min-width: 45.875rem){.cart-modal[data-v-5233d12c] div.container{right:var(--modal-right)!important;top:var(--modal-top)!important}}
1
+ @media (min-width: 45.875rem){.cart-modal[data-v-93b3820a] div.container{right:var(--modal-right)!important;top:var(--modal-top)!important}}
@@ -1,4 +1,4 @@
1
- import { toRefs as N, ref as B, computed as C, watch as F, onMounted as O, onUnmounted as z, resolveComponent as E, openBlock as u, createBlock as D, normalizeStyle as G, withCtx as S, createElementBlock as m, createVNode as R, createElementVNode as e, normalizeClass as T, toDisplayString as I, createCommentVNode as b } from "vue";
1
+ import { toRefs as N, ref as B, computed as C, watch as F, onMounted as O, onUnmounted as G, resolveComponent as E, openBlock as u, createBlock as z, normalizeStyle as D, withCtx as S, createElementBlock as m, createVNode as R, createElementVNode as e, normalizeClass as T, toDisplayString as I, createCommentVNode as b } from "vue";
2
2
  import { throttle as U } from "../utils/throttle.js";
3
3
  import Y from "./KvCartModal.js";
4
4
  import W from "./KvCartPill.js";
@@ -117,7 +117,7 @@ const Q = {
117
117
  ],
118
118
  setup(c, { emit: i }) {
119
119
  const {
120
- modalVisible: r,
120
+ modalVisible: n,
121
121
  addedLoan: l,
122
122
  userData: p,
123
123
  hasEverLoggedIn: A,
@@ -129,8 +129,8 @@ const Q = {
129
129
  var t;
130
130
  return ((t = l.value) == null ? void 0 : t.basketSize) ?? 0;
131
131
  }), q = C(() => {
132
- const t = window.innerWidth - k.value - 200, o = `${t > 0 ? t : 0}`, n = `${g.value}`;
133
- return { right: o, top: n };
132
+ const t = window.innerWidth - k.value - 200, o = `${t > 0 ? t : 0}`, a = `${g.value}`;
133
+ return { right: o, top: a };
134
134
  }), d = C(() => {
135
135
  var t;
136
136
  return (t = l.value) == null ? void 0 : t.name;
@@ -138,17 +138,17 @@ const Q = {
138
138
  var t;
139
139
  return !((t = p.value) != null && t.my);
140
140
  }), y = C(() => {
141
- var t, o, n;
142
- return w.value && (_.value && !A.value || !_.value && !((n = (o = (t = p.value) == null ? void 0 : t.my) == null ? void 0 : o.loans) != null && n.totalCount)) && Z.value === 1;
141
+ var t, o, a;
142
+ return w.value && (_.value && !A.value || !_.value && !((a = (o = (t = p.value) == null ? void 0 : t.my) == null ? void 0 : o.loans) != null && a.totalCount)) && Z.value === 1;
143
143
  }), x = C(() => f.value && v.value && !y.value), j = C(() => Object.values(P.value).reduce((t, o) => t + (o > 0 ? o : 0), 0)), H = C(() => {
144
- var o, n, s;
144
+ var o, a, s;
145
145
  if (c.isCompletingGoal)
146
146
  return `Supporting ${d.value} meets your annual goal!`;
147
147
  if (c.isLoanGoal)
148
148
  return "You’re closer to reaching your annual goal!";
149
149
  if (y.value) {
150
- const a = `Supporting ${d.value} helps`;
151
- return ((o = l.value) == null ? void 0 : o.borrowerCount) > 1 || (n = l.value) != null && n.themes.includes("Social Enterprise") ? `${a} them invest in themselves.` : ((s = l.value) == null ? void 0 : s.gender) === "male" ? `${a} him invest in himself.` : `${a} her invest in herself.`;
150
+ const r = `Supporting ${d.value} helps`;
151
+ return ((o = l.value) == null ? void 0 : o.borrowerCount) > 1 || (a = l.value) != null && a.themes.includes("Social Enterprise") ? `${r} them invest in themselves.` : ((s = l.value) == null ? void 0 : s.gender) === "male" ? `${r} him invest in himself.` : `${r} her invest in herself.`;
152
152
  }
153
153
  if (x.value)
154
154
  return "You’re close to your next achievement!";
@@ -161,16 +161,16 @@ const Q = {
161
161
  o && V(o), i("reset-modal");
162
162
  }, M = () => {
163
163
  const t = document.getElementsByTagName("header")[0], o = (t == null ? void 0 : t.getBoundingClientRect()) ?? null;
164
- let n = [...document.querySelectorAll('[data-testid="header-basket"]')], s = n.find((L) => L == null ? void 0 : L.clientHeight);
165
- s || (n = [...document.querySelectorAll('[data-testid="header-about"]')], s = n.find((L) => L == null ? void 0 : L.clientHeight));
166
- const a = (s == null ? void 0 : s.getBoundingClientRect()) ?? null;
167
- a && (a == null ? void 0 : a.right) !== k.value && (k.value = a == null ? void 0 : a.right), o && (o == null ? void 0 : o.bottom) !== g.value && (g.value = o == null ? void 0 : o.bottom);
164
+ let a = [...document.querySelectorAll('[data-testid="header-basket"]')], s = a.find((L) => L == null ? void 0 : L.clientHeight);
165
+ s || (a = [...document.querySelectorAll('[data-testid="header-about"]')], s = a.find((L) => L == null ? void 0 : L.clientHeight));
166
+ const r = (s == null ? void 0 : s.getBoundingClientRect()) ?? null;
167
+ r && (r == null ? void 0 : r.right) !== k.value && (k.value = r == null ? void 0 : r.right), o && (o == null ? void 0 : o.bottom) !== g.value && (g.value = o == null ? void 0 : o.bottom);
168
168
  }, h = U(M, 50);
169
- return F(r, () => {
170
- r.value && M();
169
+ return F(n, () => {
170
+ n.value && M();
171
171
  }, { immediate: !0 }), O(() => {
172
172
  M(), window.addEventListener("scroll", h), window.addEventListener("resize", h);
173
- }), z(() => {
173
+ }), G(() => {
174
174
  window.removeEventListener("scroll", h), window.removeEventListener("resize", h);
175
175
  }), {
176
176
  modalPosition: q,
@@ -205,27 +205,27 @@ const Q = {
205
205
  key: 2,
206
206
  class: "tw-text-h5"
207
207
  };
208
- function o1(c, i, r, l, p, A) {
208
+ function o1(c, i, n, l, p, A) {
209
209
  const w = E("KvCartPill"), f = E("KvCartModal");
210
- return r.modalVisible ? (u(), D(f, {
210
+ return n.modalVisible ? (u(), z(f, {
211
211
  key: 0,
212
- style: G({
212
+ style: D({
213
213
  "--modal-right": `${l.modalPosition.right}px`,
214
214
  "--modal-top": `${l.modalPosition.top}px`
215
215
  }),
216
216
  class: "cart-modal !tw-top-0",
217
- visible: r.modalVisible,
218
- "photo-path": r.photoPath,
217
+ visible: n.modalVisible,
218
+ "photo-path": n.photoPath,
219
219
  "basket-count": l.basketCount,
220
- "category-name": r.oneLoanAwayCategory,
220
+ "category-name": n.oneLoanAwayCategory,
221
221
  onCartModalClosed: l.closeCartModal
222
222
  }, {
223
223
  content: S(() => [
224
- r.showModalContent || l.isFirstLoan ? (u(), m("div", X, [
224
+ n.showModalContent || l.isFirstLoan ? (u(), m("div", X, [
225
225
  R(w, {
226
226
  class: "!tw-w-full tw-justify-center",
227
227
  "borrower-name": l.borrowerName,
228
- "milestones-number": r.milestonesNumber,
228
+ "milestones-number": n.milestonesNumber,
229
229
  "is-close-next-milestone": l.showOneAway,
230
230
  "custom-message": l.pillMsg
231
231
  }, {
@@ -236,7 +236,7 @@ function o1(c, i, r, l, p, A) {
236
236
  "tw-flex tw-items-center tw-justify-center tw-bg-gray-100 tw-p-0.5 tw-rounded tw-whitespace-nowrap": l.showOneAway
237
237
  })
238
238
  }, [
239
- l.isFirstLoan ? (u(), m("svg", $, i[0] || (i[0] = [
239
+ l.isFirstLoan && !n.isLoanGoal ? (u(), m("svg", $, i[0] || (i[0] = [
240
240
  e("path", {
241
241
  d: "M36.2676 17.5025C34.6519 30.5945 24.9878 35.8229 20.1847 38.0889C20.1496 38.1055 20.1099 38.1043 20.075 38.0873C8.60201 32.516 4.24979 22.9018 3.62911 17.5025C3.34064 14.6558 3.18678 8.5719 3.14406 5.7867C3.14315 5.72754 3.1847 5.67723 3.24194 5.66227C11.6312 3.46948 14.2758 3.52186 20.0937 1.86776C20.1175 1.86099 20.1437 1.86113 20.1673 1.86833C26.6496 3.83905 31.8224 4.23356 36.8613 5.66108C36.9176 5.67702 36.9559 5.72959 36.9546 5.78805C36.8227 11.47 36.4423 15.9605 36.2676 17.5025Z",
242
242
  fill: "#2AA967",
@@ -398,7 +398,7 @@ function o1(c, i, r, l, p, A) {
398
398
  fill: "#757575"
399
399
  }, null, -1)
400
400
  ]))),
401
- l.showOneAway ? (u(), m("div", t1, I(r.oneAwayText), 1)) : b("", !0)
401
+ l.showOneAway ? (u(), m("div", t1, I(n.oneAwayText), 1)) : b("", !0)
402
402
  ], 2)
403
403
  ]),
404
404
  _: 1
@@ -408,7 +408,7 @@ function o1(c, i, r, l, p, A) {
408
408
  _: 1
409
409
  }, 8, ["style", "visible", "photo-path", "basket-count", "category-name", "onCartModalClosed"])) : b("", !0);
410
410
  }
411
- const C1 = /* @__PURE__ */ J(Q, [["render", o1], ["__scopeId", "data-v-5233d12c"]]);
411
+ const C1 = /* @__PURE__ */ J(Q, [["render", o1], ["__scopeId", "data-v-93b3820a"]]);
412
412
  export {
413
413
  C1 as default
414
414
  };
@@ -1 +1 @@
1
- [data-v-0f318c7e] input{height:2rem;border-radius:0;border-top-width:0px;border-right-width:0px;border-left-width:0px;padding:0}[data-v-0f318c7e] input:focus{--tw-border-opacity: 1;border-color:rgba(var(--border-tertiary),var(--tw-border-opacity, 1));box-shadow:none}[data-v-0f318c7e] button>span{min-height:0}[data-v-0f318c7e] button>span>span{padding-top:0;padding-bottom:0;padding-left:.25rem;padding-right:.25rem}
1
+ [data-v-8a6d6ddc] input{height:2rem;border-radius:0;border-top-width:0px;border-right-width:0px;border-left-width:0px;padding:0}[data-v-8a6d6ddc] input:focus{--tw-border-opacity: 1;border-color:rgba(var(--border-tertiary),var(--tw-border-opacity, 1));box-shadow:none}[data-v-8a6d6ddc] button>span{min-height:0}[data-v-8a6d6ddc] button>span>span{padding-top:0;padding-bottom:0;padding-left:.25rem;padding-right:.25rem}
@@ -36,11 +36,11 @@ const h = "add-comment-value", f = "add-comment", m = "hide-input", I = {
36
36
  },
37
37
  emits: [f, m],
38
38
  setup(l, { emit: t }) {
39
- const e = u(""), o = u(null), c = C(() => e.value ? "" : "disabled");
39
+ const e = u(""), o = u(null), d = C(() => e.value ? "" : "disabled");
40
40
  return {
41
41
  ADD_COMMENT_ID: h,
42
42
  addCommentValue: e,
43
- commentButtonState: c,
43
+ commentButtonState: d,
44
44
  cancel: () => {
45
45
  e.value = "", l.isReply && t(m);
46
46
  },
@@ -51,14 +51,15 @@ const h = "add-comment-value", f = "add-comment", m = "hide-input", I = {
51
51
  };
52
52
  }
53
53
  }, K = { class: "tw-flex tw-flex-col" }, T = { class: "tw-flex tw-flex-col md:tw-flex-row md:tw-items-center tw-gap-0.5 md:tw-gap-1" }, A = { class: "tw-flex tw-items-center tw-gap-1" }, B = { class: "data-hj-suppress tw-font-medium" }, M = { class: "tw-flex tw-py-0.5 tw-gap-0.5" };
54
- function S(l, t, e, o, c, v) {
55
- const d = s("kv-user-avatar"), r = s("kv-text-input"), i = s("kv-button");
54
+ function S(l, t, e, o, d, v) {
55
+ const c = s("kv-user-avatar"), r = s("kv-text-input"), i = s("kv-button");
56
56
  return x(), g("div", K, [
57
57
  n("div", T, [
58
58
  n("div", A, [
59
- a(d, {
59
+ a(c, {
60
60
  "lender-name": e.userDisplayName,
61
61
  "lender-image-url": e.userImageUrl,
62
+ class: "tw-w-3 tw-h-3",
62
63
  "is-small": ""
63
64
  }, null, 8, ["lender-name", "lender-image-url"]),
64
65
  n("div", B, y(e.userDisplayName), 1)
@@ -97,7 +98,7 @@ function S(l, t, e, o, c, v) {
97
98
  ])
98
99
  ]);
99
100
  }
100
- const P = /* @__PURE__ */ E(I, [["render", S], ["__scopeId", "data-v-0f318c7e"]]);
101
+ const P = /* @__PURE__ */ E(I, [["render", S], ["__scopeId", "data-v-8a6d6ddc"]]);
101
102
  export {
102
103
  f as ADD_COMMENT_EVENT,
103
104
  h as ADD_COMMENT_ID,
@@ -55,11 +55,11 @@ const $ = "reply-comment", ee = "like-comment", N = "add-reaction", te = {
55
55
  emits: [
56
56
  N
57
57
  ],
58
- setup(g, { emit: s }) {
58
+ setup(h, { emit: s }) {
59
59
  const {
60
60
  comment: e,
61
61
  userPublicId: n
62
- } = B(g), u = y(!1), h = y(null), a = y(), _ = y(!1), b = i(() => {
62
+ } = B(h), u = y(!1), g = y(null), a = y(), _ = y(!1), b = i(() => {
63
63
  var t;
64
64
  return ((t = e == null ? void 0 : e.value) == null ? void 0 : t.text) ?? "";
65
65
  }), w = i(() => {
@@ -79,7 +79,7 @@ const $ = "reply-comment", ee = "like-comment", N = "add-reaction", te = {
79
79
  return ((l = (t = e == null ? void 0 : e.value) == null ? void 0 : t.children) == null ? void 0 : l.like) ?? [];
80
80
  }), R = i(() => E.value.find((t) => t.publicLenderId === n.value)), O = i(() => R.value !== void 0), T = () => {
81
81
  u.value = !u.value, q(() => {
82
- u.value && h.value.$refs.input.focus();
82
+ u.value && g.value.$refs.input.focus();
83
83
  });
84
84
  }, x = (t, l) => {
85
85
  var L;
@@ -109,7 +109,7 @@ const $ = "reply-comment", ee = "like-comment", N = "add-reaction", te = {
109
109
  }), {
110
110
  hideInput: D,
111
111
  showInput: u,
112
- commentsAddRef: h,
112
+ commentsAddRef: g,
113
113
  replyClick: T,
114
114
  addReaction: x,
115
115
  REPLY_COMMENT_EVENT: $,
@@ -141,7 +141,7 @@ const $ = "reply-comment", ee = "like-comment", N = "add-reaction", te = {
141
141
  key: 1,
142
142
  class: "tw-my-1"
143
143
  }, me = { key: 1 };
144
- function de(g, s, e, n, u, h) {
144
+ function de(h, s, e, n, u, g) {
145
145
  const a = v("kv-user-avatar"), _ = v("kv-comments-heart-button"), b = v("kv-comments-reply-button"), w = v("kv-comments-add"), C = v("kv-material-icon"), I = v("kv-comments-list-item", !0);
146
146
  return r(), m("div", null, [
147
147
  f("div", null, [
@@ -149,6 +149,7 @@ function de(g, s, e, n, u, h) {
149
149
  k(a, {
150
150
  "lender-name": n.authorName,
151
151
  "lender-image-url": n.authorImage,
152
+ class: "tw-w-3 tw-h-3",
152
153
  "is-small": ""
153
154
  }, null, 8, ["lender-name", "lender-image-url"]),
154
155
  n.authorName ? (r(), m("p", le, p(n.authorName), 1)) : c("", !0)
@@ -205,7 +206,7 @@ function de(g, s, e, n, u, h) {
205
206
  comment: o,
206
207
  "nest-level": e.nestLevel + 1,
207
208
  onAddReaction: s[3] || (s[3] = (E) => {
208
- g.$emit(n.ADD_REACTION_EVENT, E);
209
+ h.$emit(n.ADD_REACTION_EVENT, E);
209
210
  })
210
211
  }, null, 8, ["user-image-url", "user-display-name", "user-public-id", "comment", "nest-level"])
211
212
  ]))), 128))
@@ -1,4 +1,4 @@
1
- import { openBlock as n, createElementBlock as s, createElementVNode as t, toDisplayString as l } from "vue";
1
+ import { openBlock as n, createElementBlock as s, createElementVNode as e, toDisplayString as c, createCommentVNode as l } from "vue";
2
2
  import r from "../_virtual/_plugin-vue_export-helper.js";
3
3
  const i = {
4
4
  props: {
@@ -7,35 +7,38 @@ const i = {
7
7
  default: 0
8
8
  }
9
9
  }
10
- }, f = {
10
+ }, u = {
11
11
  xmlns: "http://www.w3.org/2000/svg",
12
12
  viewBox: "0 0 24 24"
13
- }, c = { id: "countMask" }, d = {
13
+ }, d = ["id"], a = {
14
14
  x: "12",
15
15
  y: "17",
16
16
  fill: "#000",
17
17
  style: { "font-size": "9px", "font-weight": "631", "text-anchor": "middle" }
18
- };
19
- function u(p, o, e, a, m, _) {
20
- return n(), s("svg", f, [
21
- t("defs", null, [
22
- t("mask", c, [
23
- o[0] || (o[0] = t("rect", {
18
+ }, f = ["mask"];
19
+ function m(_, o, t, h, x, k) {
20
+ return n(), s("svg", u, [
21
+ e("defs", null, [
22
+ t.count > 0 ? (n(), s("mask", {
23
+ key: 0,
24
+ id: `countMask-${t.count}`
25
+ }, [
26
+ o[0] || (o[0] = e("rect", {
24
27
  width: "100%",
25
28
  height: "100%",
26
29
  fill: "#fff"
27
30
  }, null, -1)),
28
- t("text", d, l(e.count), 1)
29
- ])
31
+ e("text", a, c(t.count), 1)
32
+ ], 8, d)) : l("", !0)
30
33
  ]),
31
- o[1] || (o[1] = t("path", {
34
+ e("path", {
32
35
  d: "M12,3A3,3 0 0,1 15,6H9A3,3 0 0,1 12,3M19,6H17A5,5 0 0,0 12,1A5,5 0 0,0 7,6H5C3.89,6 3,6.89 3,8V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V8C21,6.89 20.1,6 19,6Z",
33
36
  fill: "currentColor",
34
- mask: "url(#countMask)"
35
- }, null, -1))
37
+ mask: `url(#countMask-${t.count})`
38
+ }, null, 8, f)
36
39
  ]);
37
40
  }
38
- const h = /* @__PURE__ */ r(i, [["render", u]]);
41
+ const w = /* @__PURE__ */ r(i, [["render", m]]);
39
42
  export {
40
- h as default
43
+ w as default
41
44
  };
@@ -1,11 +1,10 @@
1
- import { toRefs as c, computed as l, resolveComponent as m, openBlock as p, createElementBlock as i, createVNode as _, createElementVNode as d, toDisplayString as v, createTextVNode as u } from "vue";
2
- import w from "./KvUserAvatar.js";
3
- import "./KvInlineActivityCard.css";
4
- import f from "../_virtual/_plugin-vue_export-helper.js";
1
+ import { toRefs as c, computed as l, resolveComponent as m, openBlock as p, createElementBlock as i, createVNode as w, createElementVNode as d, toDisplayString as u, createTextVNode as _ } from "vue";
2
+ import f from "./KvUserAvatar.js";
3
+ import v from "../_virtual/_plugin-vue_export-helper.js";
5
4
  const g = {
6
5
  name: "KvInlineActivityCard",
7
6
  components: {
8
- KvUserAvatar: w
7
+ KvUserAvatar: f
9
8
  },
10
9
  props: {
11
10
  /**
@@ -16,38 +15,38 @@ const g = {
16
15
  default: () => ({})
17
16
  }
18
17
  },
19
- setup(o) {
18
+ setup(s) {
20
19
  const {
21
20
  activity: e
22
- } = c(o), s = l(() => {
21
+ } = c(s), a = l(() => {
23
22
  var t, r;
24
23
  return ((r = (t = e == null ? void 0 : e.value) == null ? void 0 : t.lender) == null ? void 0 : r.name) ?? "";
25
24
  });
26
25
  return {
27
26
  lenderImageUrl: l(() => {
28
- var t, r, a;
29
- return ((a = (r = (t = e == null ? void 0 : e.value) == null ? void 0 : t.lender) == null ? void 0 : r.image) == null ? void 0 : a.url) ?? "";
27
+ var t, r, o;
28
+ return ((o = (r = (t = e == null ? void 0 : e.value) == null ? void 0 : t.lender) == null ? void 0 : r.image) == null ? void 0 : o.url) ?? "";
30
29
  }),
31
- lenderName: s
30
+ lenderName: a
32
31
  };
33
32
  }
34
- }, x = { class: "tw-flex tw-items-center tw-gap-1 tw-py-0.5 tw-px-1 tw-shadow-lg tw-rounded-xs tw-bg-white" }, h = { class: "tw-text-base tw-whitespace-nowrap" }, I = { class: "data-hj-suppress" };
35
- function N(o, e, s, n, t, r) {
36
- const a = m("KvUserAvatar");
33
+ }, x = { class: "tw-flex tw-items-center tw-gap-1 tw-py-0.5 tw-px-1 tw-shadow-lg tw-rounded-xs tw-bg-white" }, h = { class: "tw-text-base tw-whitespace-nowrap" }, N = { class: "data-hj-suppress" };
34
+ function U(s, e, a, n, t, r) {
35
+ const o = m("KvUserAvatar");
37
36
  return p(), i("div", x, [
38
- _(a, {
37
+ w(o, {
39
38
  "lender-image-url": n.lenderImageUrl,
40
39
  "lender-name": n.lenderName,
41
- "is-small": "",
42
- class: "activity-avatar"
40
+ class: "tw-w-4 tw-h-4 tw-flex-shrink-0",
41
+ "is-small": ""
43
42
  }, null, 8, ["lender-image-url", "lender-name"]),
44
43
  d("p", h, [
45
- d("span", I, v(n.lenderName), 1),
46
- e[0] || (e[0] = u(" contributed "))
44
+ d("span", N, u(n.lenderName), 1),
45
+ e[0] || (e[0] = _(" contributed "))
47
46
  ])
48
47
  ]);
49
48
  }
50
- const y = /* @__PURE__ */ f(g, [["render", N], ["__scopeId", "data-v-84a9404c"]]);
49
+ const b = /* @__PURE__ */ v(g, [["render", U]]);
51
50
  export {
52
- y as default
51
+ b as default
53
52
  };
@@ -1,12 +1,11 @@
1
- import { toRefs as F, ref as d, computed as u, onMounted as p, resolveComponent as U, openBlock as n, createElementBlock as o, normalizeClass as r, createElementVNode as s, createBlock as H, normalizeStyle as I, createCommentVNode as y, withDirectives as b, vShow as B, toDisplayString as P } from "vue";
2
- import { isLegacyPlaceholderAvatar as j, randomizedUserAvatarClass as D } from "../utils/imageUtils.js";
3
- import M from "./KvLoadingPlaceholder.js";
4
- import "./KvUserAvatar.css";
5
- import N from "../_virtual/_plugin-vue_export-helper.js";
6
- const V = {
1
+ import { toRefs as B, ref as m, computed as a, onMounted as P, resolveComponent as V, openBlock as i, createElementBlock as c, normalizeClass as b, createElementVNode as r, createCommentVNode as f, withDirectives as N, createVNode as z, vShow as D, normalizeStyle as y, toDisplayString as F } from "vue";
2
+ import { randomizedUserAvatarClass as M, isLegacyPlaceholderAvatar as p } from "../utils/imageUtils.js";
3
+ import S from "./KvLoadingPlaceholder.js";
4
+ import E from "../_virtual/_plugin-vue_export-helper.js";
5
+ const K = {
7
6
  name: "KvUserAvatar",
8
7
  components: {
9
- KvLoadingPlaceholder: M
8
+ KvLoadingPlaceholder: S
10
9
  },
11
10
  props: {
12
11
  /**
@@ -24,115 +23,131 @@ const V = {
24
23
  default: ""
25
24
  },
26
25
  /**
27
- * The image of the lender
26
+ * Whether to render a smaller avatar
28
27
  */
29
28
  isSmall: {
30
29
  type: Boolean,
31
30
  default: !1
31
+ },
32
+ /**
33
+ * Whether to use a css variable for the avatar url before data is loaded
34
+ */
35
+ showCssPlaceholder: {
36
+ type: Boolean,
37
+ default: !1
32
38
  }
33
39
  },
34
- setup(f) {
40
+ setup(w) {
35
41
  const {
36
- lenderName: a,
37
- lenderImageUrl: e,
38
- isSmall: t
39
- } = F(f), i = d(!0), c = d(null), m = d(null), v = u(() => a.value === "" && e.value === "" || a.value === "Anonymous"), S = () => {
40
- const l = t != null && t.value ? "tw-w-3 tw-h-3 tw-text-h4" : "tw-w-6 tw-h-6 tw-text-h2";
41
- return `${D(a.value)} ${l}`;
42
- }, _ = u(() => {
43
- var l;
44
- return ((l = e == null ? void 0 : e.value) == null ? void 0 : l.split("/").pop()) ?? "";
45
- }), C = u(() => {
46
- var l;
47
- return (l = a == null ? void 0 : a.value) == null ? void 0 : l.substring(0, 1).toUpperCase();
42
+ lenderName: t,
43
+ lenderImageUrl: s,
44
+ isSmall: e,
45
+ showCssPlaceholder: d
46
+ } = B(w), u = m(!0), l = m(null), v = m(null), C = a(() => !d.value && t.value === "" && s.value === "" || t.value === "Anonymous"), _ = a(() => {
47
+ const o = e != null && e.value ? "tw-font-sans tw-font-normal" : "tw-font-serif";
48
+ return `${M(t.value)} ${o}`;
49
+ }), A = a(() => e != null && e.value ? "0 0 27 27" : "0 0 27.5 27.5"), x = a(() => {
50
+ var n;
51
+ if (d.value)
52
+ return !0;
53
+ const o = ((n = s == null ? void 0 : s.value) == null ? void 0 : n.split("/").pop()) ?? "";
54
+ return o && !p(o);
55
+ }), I = a(() => {
56
+ var o;
57
+ return (o = t == null ? void 0 : t.value) == null ? void 0 : o.substring(0, 1).toUpperCase();
48
58
  }), g = () => {
49
- i.value = !1;
50
- }, L = (l, w = 1e4) => new Promise((k, x) => {
51
- const A = Date.now() + w, h = () => {
52
- !l || l.complete ? k(l) : Date.now() > A ? x(new Error(`Timeout: ${l.src}`)) : setTimeout(h, 50);
59
+ u.value = !1;
60
+ }, U = (o, n = 1e4) => new Promise((k, H) => {
61
+ const L = Date.now() + n, h = () => {
62
+ !o || o.complete ? k(o) : Date.now() > L ? H(new Error(`Timeout: ${o.src}`)) : setTimeout(h, 50);
53
63
  };
54
64
  h();
55
65
  });
56
- return p(async () => {
57
- const l = c.value;
66
+ return P(async () => {
67
+ const o = l.value;
58
68
  try {
59
- await L(l), g();
60
- } catch (w) {
61
- console.log(w.message);
69
+ await U(o), g();
70
+ } catch (n) {
71
+ console.log(n.message);
62
72
  }
63
73
  }), {
64
- isAnonymousUser: v,
65
- avatarClass: S,
66
- imageFilename: _,
67
- lenderNameFirstLetter: C,
68
- isLegacyPlaceholderAvatar: j,
69
- isLoading: i,
74
+ isAnonymousUser: C,
75
+ avatarClass: _,
76
+ userHasImage: x,
77
+ lenderNameFirstLetter: I,
78
+ letterViewBox: A,
79
+ isLegacyPlaceholderAvatar: p,
80
+ isImageLoading: u,
70
81
  onImgLoad: g,
71
- imageRef: c,
72
- userAvatar: m
82
+ imageRef: l,
83
+ userAvatar: v
73
84
  };
74
85
  }
75
- }, z = { key: 1 }, E = ["src"];
76
- function K(f, a, e, t, i, c) {
77
- const m = U("kv-loading-placeholder");
78
- return n(), o("div", {
86
+ }, R = {
87
+ key: 0,
88
+ class: "tw-h-3/4",
89
+ viewBox: "0 0 25 37",
90
+ fill: "none",
91
+ xmlns: "http://www.w3.org/2000/svg"
92
+ }, T = ["src"], Z = ["viewBox"], j = {
93
+ x: "50%",
94
+ y: "55%",
95
+ "dominant-baseline": "middle",
96
+ "text-anchor": "middle"
97
+ };
98
+ function q(w, t, s, e, d, u) {
99
+ const l = V("kv-loading-placeholder");
100
+ return i(), c("div", {
79
101
  ref: "userAvatar",
80
- class: r(["data-hj-suppress tw-flex", { "tw-w-3": e.isSmall, "tw-w-6": !e.isSmall }])
102
+ class: b(["data-hj-suppress tw-flex tw-items-center tw-justify-center tw-rounded-full tw-overflow-hidden", {
103
+ "tw-bg-brand": e.isAnonymousUser,
104
+ [e.avatarClass]: !e.isAnonymousUser
105
+ }])
81
106
  }, [
82
- t.isAnonymousUser ? (n(), o("div", {
83
- key: 0,
84
- 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 }])
107
+ e.isAnonymousUser ? (i(), c("svg", R, t[1] || (t[1] = [
108
+ r("path", {
109
+ d: "M8.22861 0.875H0.857178V36.3125H8.22861V0.875Z",
110
+ fill: "white"
111
+ }, null, -1),
112
+ r("path", {
113
+ 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",
114
+ fill: "white"
115
+ }, null, -1),
116
+ r("path", {
117
+ 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",
118
+ fill: "white"
119
+ }, null, -1)
120
+ ]))) : f("", !0),
121
+ N(z(l, null, null, 512), [
122
+ [D, !e.isAnonymousUser && e.userHasImage && e.isImageLoading]
123
+ ]),
124
+ !e.isAnonymousUser && e.userHasImage ? (i(), c("div", {
125
+ key: 1,
126
+ class: "tw-w-full tw-h-full",
127
+ style: y(s.showCssPlaceholder ? { display: "var(--user-avatar-display, block)" } : {
128
+ display: e.isImageLoading ? "none" : "block"
129
+ })
85
130
  }, [
86
- (n(), o("svg", {
87
- class: r(["tw-h-full tw-text-brand", { "tw-w-3 tw-h-3": e.isSmall }]),
88
- width: "25",
89
- height: "37",
90
- viewBox: "0 0 25 37",
91
- fill: "none",
92
- xmlns: "http://www.w3.org/2000/svg"
93
- }, a[1] || (a[1] = [
94
- s("path", {
95
- d: "M8.22861 0.875H0.857178V36.3125H8.22861V0.875Z",
96
- fill: "white"
97
- }, null, -1),
98
- s("path", {
99
- 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",
100
- fill: "white"
101
- }, null, -1),
102
- s("path", {
103
- 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",
104
- fill: "white"
105
- }, null, -1)
106
- ]), 2))
107
- ], 2)) : !t.isLegacyPlaceholderAvatar(t.imageFilename) && t.imageFilename ? (n(), o("div", z, [
108
- t.isLoading ? (n(), H(m, {
109
- key: 0,
110
- style: I({
111
- width: e.isSmall ? "1.5rem" : "3rem",
112
- height: e.isSmall ? "1.5rem" : "3rem"
113
- }),
114
- class: "!tw-rounded-full"
115
- }, null, 8, ["style"])) : y("", !0),
116
- b(s("img", {
131
+ r("img", {
117
132
  ref: "imageRef",
118
- src: e.lenderImageUrl,
133
+ src: s.lenderImageUrl,
119
134
  alt: "Image of lender",
120
- class: r(["tw-rounded-full tw-inline-block", { "tw-w-3 tw-h-3": e.isSmall, "tw-w-6 tw-h-6": !e.isSmall }]),
121
- onLoad: a[0] || (a[0] = (v) => t.onImgLoad())
122
- }, null, 42, E), [
123
- [B, !t.isLoading]
124
- ])
125
- ])) : t.isLegacyPlaceholderAvatar(t.imageFilename) || !t.imageFilename ? (n(), o("div", {
135
+ class: "tw-w-full",
136
+ style: y(s.showCssPlaceholder ? { content: "var(--user-avatar)" } : {}),
137
+ onLoad: t[0] || (t[0] = (v) => e.onImgLoad())
138
+ }, null, 44, T)
139
+ ], 4)) : f("", !0),
140
+ !e.isAnonymousUser && !e.userHasImage ? (i(), c("svg", {
126
141
  key: 2,
127
- class: r(["tw-rounded-full tw-inline-flex tw-align-center tw-justify-center", t.avatarClass()])
142
+ class: "tw-w-full tw-h-full",
143
+ fill: "currentColor",
144
+ viewBox: e.letterViewBox
128
145
  }, [
129
- s("span", {
130
- class: r(["tw-self-center", { "adjust-vertical-spacing": !e.isSmall }])
131
- }, P(t.lenderNameFirstLetter), 3)
132
- ], 2)) : y("", !0)
146
+ r("text", j, F(e.lenderNameFirstLetter), 1)
147
+ ], 8, Z)) : f("", !0)
133
148
  ], 2);
134
149
  }
135
- const J = /* @__PURE__ */ N(V, [["render", K], ["__scopeId", "data-v-c9339e78"]]);
150
+ const W = /* @__PURE__ */ E(K, [["render", q]]);
136
151
  export {
137
- J as default
152
+ W as default
138
153
  };
@@ -1 +1 @@
1
- .header-link[data-v-d30fd983]{cursor:pointer;padding-top:1rem;padding-bottom:1rem;--tw-text-opacity: 1;color:rgba(var(--text-primary),var(--tw-text-opacity, 1));text-decoration-line:none}.header-link[data-v-d30fd983]:hover{--tw-text-opacity: 1;color:rgba(var(--text-action),var(--tw-text-opacity, 1));text-decoration-line:none}[data-v-d30fd983] .avatar div:first-child{display:flex}
1
+ .header-link[data-v-c31f1fca]{cursor:pointer;padding-top:1rem;padding-bottom:1rem;--tw-text-opacity: 1;color:rgba(var(--text-primary),var(--tw-text-opacity, 1));text-decoration-line:none}.header-link[data-v-c31f1fca]:hover{--tw-text-opacity: 1;color:rgba(var(--text-action),var(--tw-text-opacity, 1));text-decoration-line:none}