@kiva/kv-components 6.13.2 → 6.14.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.
@@ -1,33 +1,72 @@
1
- import K from "numeral";
2
- import { loanCardComputedProperties as V, loanCardMethods as z } from "../utils/loanCard.js";
3
- import W from "./KvLoanUse.js";
4
- import I from "./KvBorrowerImage.js";
5
- import R from "./KvLoanProgressGroup.js";
6
- import H from "./KvLoanCallouts.js";
7
- import j from "./KvLendCta.js";
8
- import U from "./KvLoanBookmark.js";
9
- import q from "./KvLoanTag.js";
10
- import E from "./KvMaterialIcon.js";
11
- import O from "./KvLoadingPlaceholder.js";
12
- import G from "./KvLoanTeamPick.js";
13
- import J from "./KvLoanActivities.js";
14
- import { resolveComponent as r, openBlock as o, createElementBlock as u, normalizeClass as s, normalizeStyle as Q, createElementVNode as c, createBlock as i, resolveDynamicComponent as k, withCtx as g, createVNode as w, createTextVNode as X, toDisplayString as M, createCommentVNode as f, Fragment as Y, renderList as Z } from "vue";
1
+ import K from "graphql-tag";
2
+ import V from "numeral";
3
+ import { LOAN_CALLOUTS_FRAGMENT as E, LOAN_GEOCODE_FRAGMENT as O, LOAN_PROGRESS_FRAGMENT as G, loanCardComputedProperties as I, loanCardMethods as U } from "../utils/loanCard.js";
4
+ import z, { KV_LOAN_USE_FRAGMENT as W } from "./KvLoanUse.js";
5
+ import H from "./KvBorrowerImage.js";
6
+ import j from "./KvLoanProgressGroup.js";
7
+ import q from "./KvLoanCallouts.js";
8
+ import J, { KV_LEND_CTA_FRAGMENT as Q, KV_LEND_CTA_USER_FRAGMENT as X } from "./KvLendCta.js";
9
+ import Y, { KV_LOAN_BOOKMARK_FRAGMENT as Z } from "./KvLoanBookmark.js";
10
+ import p, { KV_LOAN_TAG_FRAGMENT as $ } from "./KvLoanTag.js";
11
+ import ee from "./KvMaterialIcon.js";
12
+ import te from "./KvLoadingPlaceholder.js";
13
+ import ae from "./KvLoanTeamPick.js";
14
+ import oe, { KV_LOAN_ACTIVITIES_FRAGMENT as ne } from "./KvLoanActivities.js";
15
+ import { resolveComponent as r, openBlock as o, createElementBlock as m, normalizeClass as s, normalizeStyle as le, createElementVNode as c, createBlock as i, resolveDynamicComponent as g, withCtx as k, createVNode as w, createTextVNode as ie, toDisplayString as M, createCommentVNode as f, Fragment as re, renderList as se } from "vue";
15
16
  import "./KvClassicLoanCard.css";
16
- import p from "../_virtual/_plugin-vue_export-helper.js";
17
- const $ = {
17
+ import de from "../_virtual/_plugin-vue_export-helper.js";
18
+ const Ge = K`
19
+ fragment KvClassicLoanCard on LoanBasic {
20
+ id
21
+ image {
22
+ id
23
+ hash # for imageHash
24
+ }
25
+ lenders(limit: 0) {
26
+ totalCount # for lendersNumber
27
+ }
28
+ loanFundraisingInfo {
29
+ id
30
+ fundedAmount # for amountLent
31
+ }
32
+ name # for borrowerName
33
+ ...KvLendCta
34
+ ...KvLoanActivities
35
+ ...KvLoanTag
36
+ ...KvLoanUse
37
+ ...LoanCallouts
38
+ ...LoanGeocode
39
+ ...LoanProgress
40
+ }
41
+ ${Q}
42
+ ${ne}
43
+ ${$}
44
+ ${W}
45
+ ${E}
46
+ ${O}
47
+ ${G}
48
+ `, Ie = K`
49
+ fragment KvClassicLoanCardUser on LoanBasic {
50
+ id
51
+ ...KvLendCtaUser
52
+ ...KvLoanBookmark
53
+ }
54
+ ${X}
55
+ ${Z}
56
+ `, me = {
18
57
  name: "KvClassicLoanCard",
19
58
  components: {
20
- KvBorrowerImage: I,
21
- KvLoadingPlaceholder: O,
22
- KvLoanUse: W,
23
- KvLoanProgressGroup: R,
24
- KvMaterialIcon: E,
25
- KvLendCta: j,
26
- KvLoanTag: q,
27
- KvLoanCallouts: H,
28
- KvLoanBookmark: U,
29
- KvLoanTeamPick: G,
30
- KvLoanActivities: J
59
+ KvBorrowerImage: H,
60
+ KvLoadingPlaceholder: te,
61
+ KvLoanUse: z,
62
+ KvLoanProgressGroup: j,
63
+ KvMaterialIcon: ee,
64
+ KvLendCta: J,
65
+ KvLoanTag: p,
66
+ KvLoanCallouts: q,
67
+ KvLoanBookmark: Y,
68
+ KvLoanTeamPick: ae,
69
+ KvLoanActivities: oe
31
70
  },
32
71
  props: {
33
72
  loanId: {
@@ -155,49 +194,51 @@ const $ = {
155
194
  const {
156
195
  allDataLoaded: e,
157
196
  borrowerName: t,
158
- city: S,
197
+ city: T,
159
198
  countryName: d,
160
- distributionModel: m,
199
+ distributionModel: u,
161
200
  formattedLocation: v,
162
201
  fundraisingPercent: h,
163
202
  hasProgressData: b,
164
203
  imageHash: y,
165
204
  isLoading: _,
166
- loanAmount: C,
167
- loanBorrowerCount: x,
168
- loanCallouts: L,
169
- loanStatus: B,
170
- loanUse: A,
205
+ loanAmount: L,
206
+ loanBorrowerCount: C,
207
+ loanCallouts: A,
208
+ loanStatus: x,
209
+ loanUse: B,
171
210
  mdiMapMarker: n,
172
- readMorePath: P,
173
- state: D,
174
- tag: T,
175
- unreservedAmount: N
176
- } = V(l), {
177
- clickReadMore: F
178
- } = z(l, a);
211
+ readMorePath: N,
212
+ state: S,
213
+ tag: P,
214
+ unreservedAmount: F,
215
+ sharesAvailable: R
216
+ } = I(l), {
217
+ clickReadMore: D
218
+ } = U(l, a);
179
219
  return {
180
220
  allDataLoaded: e,
181
221
  borrowerName: t,
182
- city: S,
222
+ city: T,
183
223
  countryName: d,
184
- distributionModel: m,
224
+ distributionModel: u,
185
225
  formattedLocation: v,
186
226
  fundraisingPercent: h,
187
227
  hasProgressData: b,
188
228
  imageHash: y,
189
229
  isLoading: _,
190
- loanAmount: C,
191
- loanBorrowerCount: x,
192
- loanCallouts: L,
193
- loanStatus: B,
194
- loanUse: A,
230
+ loanAmount: L,
231
+ loanBorrowerCount: C,
232
+ loanCallouts: A,
233
+ loanStatus: x,
234
+ loanUse: B,
195
235
  mdiMapMarker: n,
196
- readMorePath: P,
197
- state: D,
198
- tag: T,
199
- unreservedAmount: N,
200
- clickReadMore: F
236
+ readMorePath: N,
237
+ state: S,
238
+ tag: P,
239
+ unreservedAmount: F,
240
+ sharesAvailable: R,
241
+ clickReadMore: D
201
242
  };
202
243
  },
203
244
  computed: {
@@ -226,47 +267,47 @@ const $ = {
226
267
  amountLent() {
227
268
  var a, e;
228
269
  const l = ((e = (a = this.loan) == null ? void 0 : a.loanFundraisingInfo) == null ? void 0 : e.fundedAmount) ?? 0;
229
- return K(parseFloat(l)).format("$0,0");
270
+ return V(l).format("$0,0");
230
271
  }
231
272
  }
232
- }, ee = { class: "tw-grow" }, te = { class: "loan-card-active-hover" }, ae = {
273
+ }, ue = { class: "tw-grow" }, ce = { class: "loan-card-active-hover" }, we = {
233
274
  key: 1,
234
275
  class: "tw-relative"
235
- }, oe = { key: 0 }, ne = {
276
+ }, fe = { key: 0 }, ge = {
236
277
  class: "tw-absolute tw-bottom-1 tw-left-1 tw-text-primary tw-bg-white tw-rounded tw-p-1 tw-mb-0 tw-mr-2 tw-text-h4 tw-inline-flex tw-items-center",
237
278
  style: { padding: "2px 6px", "text-transform": "capitalize" }
238
- }, le = { class: "tw-mb-1.5 tw-pt-1" }, ie = { key: 1 }, re = {
279
+ }, ke = { class: "tw-mb-1.5 tw-pt-1" }, ve = { key: 1 }, he = {
239
280
  key: 0,
240
281
  class: "tw-w-full tw-pt-1 tw-pr-1"
241
- }, se = {
282
+ }, be = {
242
283
  key: 0,
243
284
  class: "tw-text-center tw-w-full tw-mt-1 tw-font-medium"
244
- }, de = {
285
+ }, ye = {
245
286
  key: 1,
246
287
  class: "tw-pt-1.5"
247
288
  };
248
- function ue(l, a, e, t, S, d) {
249
- const m = r("kv-loading-placeholder"), v = r("kv-borrower-image"), h = r("kv-material-icon"), b = r("kv-loan-team-pick"), y = r("kv-loan-bookmark"), _ = r("kv-loan-tag"), C = r("kv-loan-use"), x = r("kv-loan-callouts"), L = r("kv-loan-progress-group"), B = r("kv-lend-cta"), A = r("KvLoanActivities");
250
- return o(), u("div", {
289
+ function _e(l, a, e, t, T, d) {
290
+ const u = r("kv-loading-placeholder"), v = r("kv-borrower-image"), h = r("kv-material-icon"), b = r("kv-loan-team-pick"), y = r("kv-loan-bookmark"), _ = r("kv-loan-tag"), L = r("kv-loan-use"), C = r("kv-loan-callouts"), A = r("kv-loan-progress-group"), x = r("kv-lend-cta"), B = r("KvLoanActivities");
291
+ return o(), m("div", {
251
292
  class: s(["tw-flex tw-flex-col tw-bg-white tw-rounded tw-w-full tw-pb-1", { "tw-p-1": !e.largeCard, "tw-pointer-events-none": t.isLoading }]),
252
293
  "data-testid": "loan-card",
253
- style: Q([{ "box-shadow": "0 4px 12px rgba(0, 0, 0, 0.08)" }, { minWidth: "230px", maxWidth: d.cardWidth }])
294
+ style: le([{ "box-shadow": "0 4px 12px rgba(0, 0, 0, 0.08)" }, { minWidth: "230px", maxWidth: d.cardWidth }])
254
295
  }, [
255
- c("div", ee, [
256
- c("div", te, [
257
- t.isLoading ? (o(), i(m, {
296
+ c("div", ue, [
297
+ c("div", ce, [
298
+ t.isLoading ? (o(), i(u, {
258
299
  key: 0,
259
300
  class: s(["tw-mb-1 tw-w-full", { "tw-rounded-t tw-rounded-b-none": e.largeCard, "tw-rounded": !e.largeCard }]),
260
301
  style: { height: "15rem" }
261
- }, null, 8, ["class"])) : (o(), u("div", ae, [
262
- (o(), i(k(t.tag), {
302
+ }, null, 8, ["class"])) : (o(), m("div", we, [
303
+ (o(), i(g(t.tag), {
263
304
  to: t.readMorePath,
264
305
  href: t.readMorePath,
265
306
  class: "tw-flex",
266
307
  "aria-label": "Borrower image",
267
308
  onClick: a[0] || (a[0] = (n) => t.clickReadMore("Photo", n))
268
309
  }, {
269
- default: g(() => [
310
+ default: k(() => [
270
311
  w(v, {
271
312
  class: s(["tw-relative tw-w-full tw-bg-black", { "tw-rounded-t": e.largeCard, "tw-rounded": !e.largeCard }]),
272
313
  alt: `Photo of ${t.borrowerName}`,
@@ -276,13 +317,13 @@ function ue(l, a, e, t, S, d) {
276
317
  images: d.imageSizes,
277
318
  "photo-path": e.photoPath
278
319
  }, null, 8, ["class", "alt", "aspect-ratio", "default-image", "hash", "images", "photo-path"]),
279
- t.countryName ? (o(), u("div", oe, [
280
- c("p", ne, [
320
+ t.countryName ? (o(), m("div", fe, [
321
+ c("p", ge, [
281
322
  w(h, {
282
323
  class: "tw-h-2 tw-w-2",
283
324
  icon: t.mdiMapMarker
284
325
  }, null, 8, ["icon"]),
285
- X(" " + M(t.formattedLocation), 1)
326
+ ie(" " + M(t.formattedLocation), 1)
286
327
  ])
287
328
  ])) : f("", !0)
288
329
  ]),
@@ -304,14 +345,14 @@ function ue(l, a, e, t, S, d) {
304
345
  onToggleBookmark: a[1] || (a[1] = (n) => l.$emit("toggle-bookmark"))
305
346
  }, null, 8, ["loan-id", "is-bookmarked"]))
306
347
  ])),
307
- (o(), i(k(t.tag), {
348
+ (o(), i(g(t.tag), {
308
349
  to: t.readMorePath,
309
350
  href: t.readMorePath,
310
351
  class: s(["tw-flex tw-no-underline hover:tw-no-underline focus:tw-no-underline", { "tw-px-1": e.largeCard }]),
311
352
  "aria-label": "Loan tag",
312
353
  onClick: a[2] || (a[2] = (n) => t.clickReadMore("Tag", n))
313
354
  }, {
314
- default: g(() => [
355
+ default: k(() => [
315
356
  e.showTags && !t.isLoading ? (o(), i(_, {
316
357
  key: 0,
317
358
  loan: e.loan
@@ -319,28 +360,28 @@ function ue(l, a, e, t, S, d) {
319
360
  ]),
320
361
  _: 1
321
362
  }, 8, ["to", "href", "class"])),
322
- (o(), i(k(t.tag), {
363
+ (o(), i(g(t.tag), {
323
364
  to: t.readMorePath,
324
365
  href: t.readMorePath,
325
366
  class: "loan-card-use tw-no-underline tw-text-primary",
326
367
  "aria-label": "Loan use",
327
368
  onClick: a[3] || (a[3] = (n) => t.clickReadMore("Use", n))
328
369
  }, {
329
- default: g(() => [
330
- c("div", le, [
331
- t.isLoading ? (o(), u("div", {
370
+ default: k(() => [
371
+ c("div", ke, [
372
+ t.isLoading ? (o(), m("div", {
332
373
  key: 0,
333
374
  class: s(["tw-w-full", { "tw-px-1": e.largeCard }]),
334
375
  style: { height: "5.5rem" }
335
376
  }, [
336
- (o(!0), u(Y, null, Z([...Array(4)], (n, P) => (o(), u("div", {
337
- key: P,
377
+ (o(!0), m(re, null, se([...Array(4)], (n, N) => (o(), m("div", {
378
+ key: N,
338
379
  class: "tw-h-2 tw-mb-1"
339
380
  }, [
340
- w(m)
381
+ w(u)
341
382
  ]))), 128))
342
- ], 2)) : (o(), u("div", ie, [
343
- w(C, {
383
+ ], 2)) : (o(), m("div", ve, [
384
+ w(L, {
344
385
  use: t.loanUse,
345
386
  "loan-amount": t.loanAmount,
346
387
  status: t.loanStatus,
@@ -355,11 +396,11 @@ function ue(l, a, e, t, S, d) {
355
396
  _: 1
356
397
  }, 8, ["to", "href"]))
357
398
  ]),
358
- t.isLoading || typeof t.loanCallouts > "u" ? (o(), i(m, {
399
+ t.isLoading || typeof t.loanCallouts > "u" ? (o(), i(u, {
359
400
  key: 0,
360
401
  class: s(["tw-mt-1.5 tw-mb-1", { "tw-mx-1": e.largeCard }]),
361
402
  style: { width: "60%", height: "1.75rem", "border-radius": "500rem" }
362
- }, null, 8, ["class"])) : (o(), i(x, {
403
+ }, null, 8, ["class"])) : (o(), i(C, {
363
404
  key: 1,
364
405
  callouts: t.loanCallouts,
365
406
  class: s(["tw-mt-1.5", { "tw-px-1": e.largeCard }]),
@@ -369,18 +410,18 @@ function ue(l, a, e, t, S, d) {
369
410
  c("div", {
370
411
  class: s(["tw-flex tw-justify-between tw-mt-2", { "tw-px-1": e.largeCard }])
371
412
  }, [
372
- t.hasProgressData ? f("", !0) : (o(), u("div", re, [
373
- w(m, {
413
+ t.hasProgressData ? f("", !0) : (o(), m("div", he, [
414
+ w(u, {
374
415
  class: "tw-mb-0.5",
375
416
  style: { width: "70%", height: "1.3rem" }
376
417
  }),
377
- w(m, {
418
+ w(u, {
378
419
  class: "tw-rounded",
379
420
  style: { width: "70%", height: "0.5rem" }
380
421
  })
381
422
  ])),
382
423
  c("div", null, [
383
- t.unreservedAmount > 0 ? (o(), i(k(t.tag), {
424
+ t.sharesAvailable ? (o(), i(g(t.tag), {
384
425
  key: 0,
385
426
  to: t.readMorePath,
386
427
  href: t.readMorePath,
@@ -388,10 +429,10 @@ function ue(l, a, e, t, S, d) {
388
429
  "aria-label": "Loan progress",
389
430
  onClick: a[5] || (a[5] = (n) => t.clickReadMore("Progress", n))
390
431
  }, {
391
- default: g(() => [
392
- w(L, {
432
+ default: k(() => [
433
+ w(A, {
393
434
  id: "loanProgress",
394
- "money-left": `${t.unreservedAmount}`,
435
+ "money-left": t.unreservedAmount,
395
436
  "progress-percent": t.fundraisingPercent,
396
437
  class: "tw-text-black"
397
438
  }, null, 8, ["money-left", "progress-percent"])
@@ -399,9 +440,10 @@ function ue(l, a, e, t, S, d) {
399
440
  _: 1
400
441
  }, 8, ["to", "href"])) : f("", !0)
401
442
  ]),
402
- t.allDataLoaded ? (o(), i(B, {
443
+ t.allDataLoaded ? (o(), i(x, {
403
444
  key: 2,
404
445
  loan: e.loan,
446
+ "unreserved-amount": t.unreservedAmount,
405
447
  "basket-items": e.basketItems,
406
448
  "is-loading": t.isLoading,
407
449
  "is-adding": e.isAdding,
@@ -420,22 +462,22 @@ function ue(l, a, e, t, S, d) {
420
462
  "primary-button-text": e.primaryButtonText,
421
463
  "secondary-button-text": e.secondaryButtonText,
422
464
  "secondary-button-handler": e.secondaryButtonHandler,
423
- class: s(["tw-mt-auto", { "tw-w-full": t.unreservedAmount <= 0 }]),
465
+ class: s(["tw-mt-auto", { "tw-w-full": !t.sharesAvailable }]),
424
466
  onAddToBasket: a[6] || (a[6] = (n) => l.$emit("add-to-basket", n)),
425
467
  onShowLoanDetails: a[7] || (a[7] = (n) => t.clickReadMore("ViewLoan", n)),
426
468
  onRemoveFromBasket: a[8] || (a[8] = (n) => l.$emit("remove-from-basket", n))
427
- }, null, 8, ["loan", "basket-items", "is-loading", "is-adding", "enable-five-dollars-notes", "five-dollars-selected", "kv-track-function", "show-view-loan", "custom-loan-details", "external-links", "route", "user-balance", "get-cookie", "set-cookie", "enable-huge-amount", "is-visitor", "primary-button-text", "secondary-button-text", "secondary-button-handler", "class"])) : (o(), i(m, {
469
+ }, null, 8, ["loan", "unreserved-amount", "basket-items", "is-loading", "is-adding", "enable-five-dollars-notes", "five-dollars-selected", "kv-track-function", "show-view-loan", "custom-loan-details", "external-links", "route", "user-balance", "get-cookie", "set-cookie", "enable-huge-amount", "is-visitor", "primary-button-text", "secondary-button-text", "secondary-button-handler", "class"])) : (o(), i(u, {
428
470
  key: 1,
429
471
  class: "tw-rounded tw-self-start",
430
472
  style: { width: "9rem", height: "3rem" }
431
473
  }))
432
474
  ], 2),
433
- e.showContributors && d.lendersNumber && d.amountLent ? (o(), u("div", se, [
475
+ e.showContributors && d.lendersNumber && d.amountLent ? (o(), m("div", be, [
434
476
  c("p", null, M(d.lendersNumber) + " people contributed " + M(d.amountLent), 1)
435
477
  ])) : f("", !0),
436
- e.combinedActivities.length > 0 ? (o(), u("div", de, [
478
+ e.combinedActivities.length > 0 ? (o(), m("div", ye, [
437
479
  a[10] || (a[10] = c("hr", { class: "tw-border-tertiary tw-mb-1 tw-w-5/6 tw-mx-auto" }, null, -1)),
438
- w(A, {
480
+ w(B, {
439
481
  loan: e.loan,
440
482
  "combined-activities": e.combinedActivities,
441
483
  "kv-track-function": e.kvTrackFunction,
@@ -458,7 +500,9 @@ function ue(l, a, e, t, S, d) {
458
500
  ])) : f("", !0)
459
501
  ], 6);
460
502
  }
461
- const Pe = /* @__PURE__ */ p($, [["render", ue], ["__scopeId", "data-v-d014fd7b"]]);
503
+ const Ue = /* @__PURE__ */ de(me, [["render", _e], ["__scopeId", "data-v-fcb027fa"]]);
462
504
  export {
463
- Pe as default
505
+ Ge as KV_CLASSIC_LOAN_CARD_FRAGMENT,
506
+ Ie as KV_CLASSIC_LOAN_CARD_USER_FRAGMET,
507
+ Ue as default
464
508
  };
@@ -1 +1 @@
1
- .loan-callouts[data-v-a9f870f5] span{background-color:transparent!important;--tw-text-opacity: 1;color:rgba(var(--text-action),var(--tw-text-opacity, 1))}.loan-card-use[data-v-a9f870f5]:hover,.loan-card-use[data-v-a9f870f5]:focus{--tw-text-opacity: 1;color:rgba(var(--text-primary),var(--tw-text-opacity, 1))}.loan-card-active-hover:hover .loan-card-use[data-v-a9f870f5],.loan-card-active-hover:hover .loan-card-name[data-v-a9f870f5]{text-decoration-line:underline}.loan-card-progress[data-v-a9f870f5],.loan-card-progress[data-v-a9f870f5]:hover,.loan-card-progress[data-v-a9f870f5]:focus{text-decoration-line:none}.loan-card-name[data-v-a9f870f5]{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;cursor:pointer;overflow:hidden;text-overflow:ellipsis;padding-left:1.5rem;padding-right:1.5rem;padding-top:.5rem}.loan-bookmark[data-v-a9f870f5] button{border-top-left-radius:0!important;border-top-right-radius:0!important}
1
+ .loan-callouts[data-v-4b1d705c] span{background-color:transparent!important;--tw-text-opacity: 1;color:rgba(var(--text-action),var(--tw-text-opacity, 1))}.loan-card-use[data-v-4b1d705c]:hover,.loan-card-use[data-v-4b1d705c]:focus{--tw-text-opacity: 1;color:rgba(var(--text-primary),var(--tw-text-opacity, 1))}.loan-card-active-hover:hover .loan-card-use[data-v-4b1d705c],.loan-card-active-hover:hover .loan-card-name[data-v-4b1d705c]{text-decoration-line:underline}.loan-card-progress[data-v-4b1d705c],.loan-card-progress[data-v-4b1d705c]:hover,.loan-card-progress[data-v-4b1d705c]:focus{text-decoration-line:none}.loan-card-name[data-v-4b1d705c]{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;cursor:pointer;overflow:hidden;text-overflow:ellipsis;padding-left:1.5rem;padding-right:1.5rem;padding-top:.5rem}.loan-bookmark[data-v-4b1d705c] button{border-top-left-radius:0!important;border-top-right-radius:0!important}