@kiva/kv-components 6.13.2 → 6.14.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,29 +1,65 @@
1
- import D from "numeral";
2
- import { loanCardComputedProperties as W, loanCardMethods as I } from "../utils/loanCard.js";
3
- import R from "./KvLoanBookmark.js";
4
- import V from "./KvLoanUse.js";
5
- import j from "./KvBorrowerImage.js";
6
- import T from "./KvLoanProgressGroup.js";
7
- import U from "./KvLoanCallouts.js";
8
- import q from "./KvLoanTag.js";
9
- import E from "./KvMaterialIcon.js";
10
- import H from "./KvLoadingPlaceholder.js";
11
- import O from "./KvFlag.js";
12
- import { resolveComponent as m, openBlock as t, createElementBlock as d, normalizeClass as L, normalizeStyle as G, createElementVNode as c, createBlock as a, resolveDynamicComponent as f, withCtx as h, createVNode as s, Suspense as J, createTextVNode as Q, toDisplayString as P, createCommentVNode as u, Fragment as X, renderList as Y } from "vue";
1
+ import A from "graphql-tag";
2
+ import E from "numeral";
3
+ import { LOAN_CALLOUTS_FRAGMENT as I, LOAN_GEOCODE_FRAGMENT as G, LOAN_PROGRESS_FRAGMENT as U, loanCardComputedProperties as V, loanCardMethods as z } from "../utils/loanCard.js";
4
+ import W, { KV_LOAN_BOOKMARK_FRAGMENT as M } from "./KvLoanBookmark.js";
5
+ import j, { KV_LOAN_USE_FRAGMENT as q } from "./KvLoanUse.js";
6
+ import H from "./KvBorrowerImage.js";
7
+ import J from "./KvLoanProgressGroup.js";
8
+ import Q from "./KvLoanCallouts.js";
9
+ import X, { KV_LOAN_TAG_FRAGMENT as Y } from "./KvLoanTag.js";
10
+ import Z from "./KvMaterialIcon.js";
11
+ import $ from "./KvLoadingPlaceholder.js";
12
+ import ee from "./KvFlag.js";
13
+ import { resolveComponent as m, openBlock as t, createElementBlock as s, normalizeClass as x, normalizeStyle as te, createElementVNode as c, createBlock as a, resolveDynamicComponent as f, withCtx as h, createVNode as d, Suspense as oe, createTextVNode as ae, toDisplayString as N, createCommentVNode as u, Fragment as re, renderList as ne } from "vue";
13
14
  import "./KvIntroductionLoanCard.css";
14
- import Z from "../_virtual/_plugin-vue_export-helper.js";
15
- const $ = {
15
+ import le from "../_virtual/_plugin-vue_export-helper.js";
16
+ const Se = A`
17
+ fragment KvIntroductionLoanCard on LoanBasic {
18
+ id
19
+ image {
20
+ id
21
+ hash # for imageHash
22
+ }
23
+ lenders(limit: 0) {
24
+ totalCount # for lendersNumber
25
+ }
26
+ loanFundraisingInfo {
27
+ id
28
+ fundedAmount # for amountLent
29
+ }
30
+ name # for borrowerName
31
+ status # for isFunded
32
+ ...KvLoanBookmark
33
+ ...KvLoanTag
34
+ ...KvLoanUse
35
+ ...LoanCallouts
36
+ ...LoanGeocode
37
+ ...LoanProgress
38
+ }
39
+ ${M}
40
+ ${Y}
41
+ ${q}
42
+ ${I}
43
+ ${G}
44
+ ${U}
45
+ `, De = A`
46
+ fragment KvIntroductionLoanCardUser on LoanBasic {
47
+ id
48
+ ...KvLoanBookmark
49
+ }
50
+ ${M}
51
+ `, ie = {
16
52
  name: "KvIntroductionLoanCard",
17
53
  components: {
18
- KvBorrowerImage: j,
19
- KvLoadingPlaceholder: H,
20
- KvLoanUse: V,
21
- KvLoanProgressGroup: T,
22
- KvMaterialIcon: E,
23
- KvLoanTag: q,
24
- KvLoanCallouts: U,
25
- KvFlag: O,
26
- KvLoanBookmark: R
54
+ KvBorrowerImage: H,
55
+ KvLoadingPlaceholder: $,
56
+ KvLoanUse: j,
57
+ KvLoanProgressGroup: J,
58
+ KvMaterialIcon: Z,
59
+ KvLoanTag: X,
60
+ KvLoanCallouts: Q,
61
+ KvFlag: ee,
62
+ KvLoanBookmark: W
27
63
  },
28
64
  props: {
29
65
  loanId: {
@@ -87,24 +123,25 @@ const $ = {
87
123
  countryName: w,
88
124
  countryCode: l,
89
125
  distributionModel: g,
90
- formattedLocation: y,
126
+ formattedLocation: _,
91
127
  fundraisingPercent: k,
92
- hasProgressData: v,
93
- imageHash: _,
128
+ hasProgressData: y,
129
+ imageHash: v,
94
130
  isLoading: b,
95
- loanAmount: p,
131
+ loanAmount: L,
96
132
  loanBorrowerCount: r,
97
- loanCallouts: x,
98
- loanStatus: M,
99
- loanUse: B,
100
- mdiMapMarker: N,
101
- readMorePath: A,
133
+ loanCallouts: p,
134
+ loanStatus: P,
135
+ loanUse: K,
136
+ mdiMapMarker: R,
137
+ readMorePath: B,
102
138
  state: F,
103
- tag: K,
104
- unreservedAmount: S
105
- } = W(n, !0), {
106
- clickReadMore: z
107
- } = I(n, o);
139
+ tag: O,
140
+ unreservedAmount: T,
141
+ sharesAvailable: S
142
+ } = V(n, !0), {
143
+ clickReadMore: D
144
+ } = z(n, o);
108
145
  return {
109
146
  allDataLoaded: i,
110
147
  borrowerName: e,
@@ -112,22 +149,23 @@ const $ = {
112
149
  countryName: w,
113
150
  countryCode: l,
114
151
  distributionModel: g,
115
- formattedLocation: y,
152
+ formattedLocation: _,
116
153
  fundraisingPercent: k,
117
- hasProgressData: v,
118
- imageHash: _,
154
+ hasProgressData: y,
155
+ imageHash: v,
119
156
  isLoading: b,
120
- loanAmount: p,
157
+ loanAmount: L,
121
158
  loanBorrowerCount: r,
122
- loanCallouts: x,
123
- loanStatus: M,
124
- loanUse: B,
125
- mdiMapMarker: N,
126
- readMorePath: A,
159
+ loanCallouts: p,
160
+ loanStatus: P,
161
+ loanUse: K,
162
+ mdiMapMarker: R,
163
+ readMorePath: B,
127
164
  state: F,
128
- tag: K,
129
- unreservedAmount: S,
130
- clickReadMore: z
165
+ tag: O,
166
+ unreservedAmount: T,
167
+ sharesAvailable: S,
168
+ clickReadMore: D
131
169
  };
132
170
  },
133
171
  computed: {
@@ -152,49 +190,49 @@ const $ = {
152
190
  amountLent() {
153
191
  var o, i;
154
192
  const n = ((i = (o = this.loan) == null ? void 0 : o.loanFundraisingInfo) == null ? void 0 : i.fundedAmount) ?? 0;
155
- return D(parseFloat(n)).format("$0,0");
193
+ return E(n).format("$0,0");
156
194
  },
157
195
  isFunded() {
158
196
  var n;
159
- return ((n = this.loan) == null ? void 0 : n.status) === "funded" || parseFloat(this.unreservedAmount) === 0;
197
+ return ((n = this.loan) == null ? void 0 : n.status) === "funded" || this.hasProgressData && !this.sharesAvailable;
160
198
  }
161
199
  }
162
- }, ee = { class: "tw-grow" }, te = { class: "loan-card-active-hover" }, oe = {
200
+ }, se = { class: "tw-grow" }, de = { class: "loan-card-active-hover" }, me = {
163
201
  key: 1,
164
202
  style: { height: "11rem" },
165
203
  class: "tw-relative tw-overflow-hidden"
166
- }, ae = { key: 0 }, re = {
204
+ }, ce = { key: 0 }, ue = {
167
205
  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 !tw-capitalize",
168
206
  style: { padding: "2px 6px" }
169
- }, ne = {
207
+ }, we = {
170
208
  key: 3,
171
209
  class: "tw-flex tw-justify-center tw-gap-2"
172
- }, le = {
210
+ }, he = {
173
211
  key: 0,
174
212
  class: "tw-w-full",
175
213
  style: { height: "5.5rem" }
176
- }, ie = { key: 1 }, de = { class: "tw-px-2" }, se = {
214
+ }, fe = { key: 1 }, ge = { class: "tw-px-2" }, _e = {
177
215
  key: 0,
178
216
  class: "tw-w-full tw-pr-1"
179
- }, me = { class: "tw-flex tw-justify-between" }, ce = {
217
+ }, ke = { class: "tw-flex tw-justify-between" }, ye = {
180
218
  key: 2,
181
219
  class: "tw-bg-eco-green-1 tw-text-action tw-text-center tw-py-1.5",
182
220
  style: { "font-weight": "bold", "font-size": "13px", "border-radius": "8px" }
183
221
  };
184
- function ue(n, o, i, e, C, w) {
185
- const l = m("kv-loading-placeholder"), g = m("kv-borrower-image"), y = m("kv-flag"), k = m("kv-loan-bookmark"), v = m("kv-loan-callouts"), _ = m("kv-loan-use"), b = m("kv-loan-progress-group"), p = m("kv-loan-tag");
186
- return t(), d("div", {
187
- class: L(["tw-flex tw-flex-col tw-bg-white tw-rounded tw-w-full tw-pb-2", { "tw-pointer-events-none": e.isLoading }]),
222
+ function ve(n, o, i, e, C, w) {
223
+ const l = m("kv-loading-placeholder"), g = m("kv-borrower-image"), _ = m("kv-flag"), k = m("kv-loan-bookmark"), y = m("kv-loan-callouts"), v = m("kv-loan-use"), b = m("kv-loan-progress-group"), L = m("kv-loan-tag");
224
+ return t(), s("div", {
225
+ class: x(["tw-flex tw-flex-col tw-bg-white tw-rounded tw-w-full tw-pb-2", { "tw-pointer-events-none": e.isLoading }]),
188
226
  "data-testid": "loan-card",
189
- style: G([{ "box-shadow": "0px 4px 8px 0px rgba(0, 0, 0, 0.38)" }, { minWidth: "230px", maxWidth: w.cardWidth }])
227
+ style: te([{ "box-shadow": "0px 4px 8px 0px rgba(0, 0, 0, 0.38)" }, { minWidth: "230px", maxWidth: w.cardWidth }])
190
228
  }, [
191
- c("div", ee, [
192
- c("div", te, [
229
+ c("div", se, [
230
+ c("div", de, [
193
231
  e.isLoading ? (t(), a(l, {
194
232
  key: 0,
195
233
  class: "tw-w-full tw-rounded-t",
196
234
  style: { height: "11rem" }
197
- })) : (t(), d("div", oe, [
235
+ })) : (t(), s("div", me, [
198
236
  (t(), a(f(e.tag), {
199
237
  to: e.readMorePath,
200
238
  href: e.readMorePath,
@@ -203,7 +241,7 @@ function ue(n, o, i, e, C, w) {
203
241
  onClick: o[0] || (o[0] = (r) => e.clickReadMore("Photo", r))
204
242
  }, {
205
243
  default: h(() => [
206
- s(g, {
244
+ d(g, {
207
245
  class: "tw-relative tw-w-full tw-bg-black tw-rounded-t borrower-image",
208
246
  alt: `Photo of ${e.borrowerName}`,
209
247
  "aspect-ratio": w.imageAspectRatio,
@@ -212,11 +250,11 @@ function ue(n, o, i, e, C, w) {
212
250
  images: w.imageSizes,
213
251
  "photo-path": i.photoPath
214
252
  }, null, 8, ["alt", "aspect-ratio", "default-image", "hash", "images", "photo-path"]),
215
- e.countryName ? (t(), d("div", ae, [
216
- c("p", re, [
217
- (t(), a(J, null, {
253
+ e.countryName ? (t(), s("div", ce, [
254
+ c("p", ue, [
255
+ (t(), a(oe, null, {
218
256
  default: h(() => [
219
- s(y, {
257
+ d(_, {
220
258
  class: "tw-ml-0.5 tw-mr-1",
221
259
  country: e.countryCode,
222
260
  name: e.countryName,
@@ -226,7 +264,7 @@ function ue(n, o, i, e, C, w) {
226
264
  ]),
227
265
  _: 1
228
266
  })),
229
- Q(" " + P(e.formattedLocation), 1)
267
+ ae(" " + N(e.formattedLocation), 1)
230
268
  ])
231
269
  ])) : u("", !0)
232
270
  ]),
@@ -255,13 +293,13 @@ function ue(n, o, i, e, C, w) {
255
293
  }, {
256
294
  default: h(() => [
257
295
  c("h3", {
258
- class: L(["loan-card-name", { "tw-text-center": e.borrowerName.length < 20 }]),
296
+ class: x(["loan-card-name", { "tw-text-center": e.borrowerName.length < 20 }]),
259
297
  style: { "font-size": "28px" }
260
- }, P(e.borrowerName), 3)
298
+ }, N(e.borrowerName), 3)
261
299
  ]),
262
300
  _: 1
263
301
  }, 8, ["to", "href"])),
264
- e.isLoading ? (t(), d("div", ne, [
302
+ e.isLoading ? (t(), s("div", we, [
265
303
  e.isLoading || typeof e.loanCallouts > "u" ? (t(), a(l, {
266
304
  key: 0,
267
305
  class: "tw-mt-0.5 tw-mb-1",
@@ -286,7 +324,7 @@ function ue(n, o, i, e, C, w) {
286
324
  onClick: o[3] || (o[3] = (r) => e.clickReadMore("Tag", r))
287
325
  }, {
288
326
  default: h(() => [
289
- s(v, {
327
+ d(y, {
290
328
  callouts: e.loanCallouts,
291
329
  "add-bg-color": !1,
292
330
  class: "loan-callouts"
@@ -303,17 +341,17 @@ function ue(n, o, i, e, C, w) {
303
341
  }, {
304
342
  default: h(() => [
305
343
  c("div", {
306
- class: L(["tw-pt-0.5 tw-px-2", { "tw-mb-1.5": !e.isLoading }])
344
+ class: x(["tw-pt-0.5 tw-px-2", { "tw-mb-1.5": !e.isLoading }])
307
345
  }, [
308
- e.isLoading ? (t(), d("div", le, [
309
- (t(!0), d(X, null, Y([...Array(3)], (r, x) => (t(), d("div", {
310
- key: x,
346
+ e.isLoading ? (t(), s("div", he, [
347
+ (t(!0), s(re, null, ne([...Array(3)], (r, p) => (t(), s("div", {
348
+ key: p,
311
349
  class: "tw-h-2 tw-mb-1"
312
350
  }, [
313
- s(l)
351
+ d(l)
314
352
  ]))), 128))
315
- ])) : (t(), d("div", ie, [
316
- s(_, {
353
+ ])) : (t(), s("div", fe, [
354
+ d(v, {
317
355
  use: e.loanUse,
318
356
  "loan-amount": e.loanAmount,
319
357
  status: e.loanStatus,
@@ -330,25 +368,25 @@ function ue(n, o, i, e, C, w) {
330
368
  }, 8, ["to", "href"]))
331
369
  ])
332
370
  ]),
333
- c("div", de, [
334
- e.hasProgressData ? u("", !0) : (t(), d("div", se, [
335
- c("div", me, [
336
- s(l, {
371
+ c("div", ge, [
372
+ e.hasProgressData ? u("", !0) : (t(), s("div", _e, [
373
+ c("div", ke, [
374
+ d(l, {
337
375
  class: "tw-mb-0.5",
338
376
  style: { width: "20%", height: "1.3rem" }
339
377
  }),
340
- s(l, {
378
+ d(l, {
341
379
  class: "tw-mb-0.5",
342
380
  style: { width: "20%", height: "1.3rem" }
343
381
  })
344
382
  ]),
345
- s(l, {
383
+ d(l, {
346
384
  class: "tw-rounded",
347
385
  style: { width: "100%", height: "0.5rem" }
348
386
  })
349
387
  ])),
350
388
  c("div", null, [
351
- e.unreservedAmount > 0 ? (t(), a(f(e.tag), {
389
+ e.sharesAvailable ? (t(), a(f(e.tag), {
352
390
  key: 0,
353
391
  to: e.readMorePath,
354
392
  href: e.readMorePath,
@@ -357,10 +395,10 @@ function ue(n, o, i, e, C, w) {
357
395
  onClick: o[5] || (o[5] = (r) => e.clickReadMore("Progress", r))
358
396
  }, {
359
397
  default: h(() => [
360
- s(b, {
398
+ d(b, {
361
399
  id: "loanProgress",
362
- "money-left": `${e.unreservedAmount}`,
363
- "amount-goal": `${e.loanAmount}`,
400
+ "money-left": e.unreservedAmount,
401
+ "amount-goal": e.loanAmount,
364
402
  "progress-percent": e.fundraisingPercent,
365
403
  class: "tw-text-secondary"
366
404
  }, null, 8, ["money-left", "amount-goal", "progress-percent"])
@@ -372,7 +410,7 @@ function ue(n, o, i, e, C, w) {
372
410
  key: 1,
373
411
  class: "tw-rounded tw-mx-auto tw-mt-2",
374
412
  style: { width: "9rem", height: "1rem" }
375
- })) : w.isFunded ? (t(), d("div", ce, " 🎉 Fully funded! ")) : (t(), a(p, {
413
+ })) : w.isFunded ? (t(), s("div", ye, " 🎉 Fully funded! ")) : (t(), a(L, {
376
414
  key: 3,
377
415
  loan: i.loan,
378
416
  "use-expanded-styles": !0,
@@ -382,7 +420,9 @@ function ue(n, o, i, e, C, w) {
382
420
  ])
383
421
  ], 6);
384
422
  }
385
- const Me = /* @__PURE__ */ Z($, [["render", ue], ["__scopeId", "data-v-a9f870f5"]]);
423
+ const Ee = /* @__PURE__ */ le(ie, [["render", ve], ["__scopeId", "data-v-4b1d705c"]]);
386
424
  export {
387
- Me as default
425
+ Se as KV_INTRODUCTION_LOAN_CARD_FRAGMENT,
426
+ De as KV_INTRODUCTION_LOAN_CARD_USER_FRAGMENT,
427
+ Ee as default
388
428
  };
@@ -1 +1 @@
1
- .amountDropdownWrapper[data-v-6049057c] select{border-radius:14px 0 0 14px}.lend-again[data-v-6049057c] span{padding-left:0;padding-right:0;padding-left:.5rem;padding-right:.5rem}.lendButtonWrapper[data-v-6049057c] span:first-child{border-radius:0 14px 14px 0}.filtered-dropdown[data-v-6049057c] select{cursor:pointer;border-radius:.875rem;border-width:2px;font-weight:500}.unselected-dropdown[data-v-6049057c] select{--tw-border-opacity: 1;border-color:rgb(158 158 158 / var(--tw-border-opacity, 1))}.selected-dropdown[data-v-6049057c] select{--tw-border-opacity: 1;border-color:rgb(34 56 41 / var(--tw-border-opacity, 1))}.preset-option[data-v-6049057c] span.tw-w-full:first-child{border-width:2px;--tw-border-opacity: 1;border-color:rgb(158 158 158 / var(--tw-border-opacity, 1))}.selected-option[data-v-6049057c] span.tw-w-full:first-child{--tw-border-opacity: 1;border-color:rgba(var(--border-action),var(--tw-border-opacity, 1))}
1
+ .amountDropdownWrapper[data-v-1ac5c3c8] select{border-radius:14px 0 0 14px}.lend-again[data-v-1ac5c3c8] span{padding-left:0;padding-right:0;padding-left:.5rem;padding-right:.5rem}.lendButtonWrapper[data-v-1ac5c3c8] span:first-child{border-radius:0 14px 14px 0}.filtered-dropdown[data-v-1ac5c3c8] select{cursor:pointer;border-radius:.875rem;border-width:2px;font-weight:500}.unselected-dropdown[data-v-1ac5c3c8] select{--tw-border-opacity: 1;border-color:rgb(158 158 158 / var(--tw-border-opacity, 1))}.selected-dropdown[data-v-1ac5c3c8] select{--tw-border-opacity: 1;border-color:rgb(34 56 41 / var(--tw-border-opacity, 1))}.preset-option[data-v-1ac5c3c8] span.tw-w-full:first-child{border-width:2px;--tw-border-opacity: 1;border-color:rgb(158 158 158 / var(--tw-border-opacity, 1))}.selected-option[data-v-1ac5c3c8] span.tw-w-full:first-child{--tw-border-opacity: 1;border-color:rgba(var(--border-action),var(--tw-border-opacity, 1))}