@kiva/kv-components 10.4.1 → 10.5.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,209 +1,235 @@
1
- import D from "./KvWideLoanCard2.js";
2
- import { KV_WIDE_LOAN_CARD_FRAGMENT as ee, KV_WIDE_LOAN_CARD_USER_FRAGMENT as te } from "./KvWideLoanCard2.js";
3
- import { resolveComponent as i, openBlock as o, createElementBlock as r, normalizeClass as f, createElementVNode as s, createBlock as n, resolveDynamicComponent as k, withCtx as m, createVNode as d, toDisplayString as h, createTextVNode as N, createCommentVNode as w, Fragment as R, renderList as V } from "vue";
4
- import "./KvWideLoanCard.css";
5
- import B from "../_virtual/_plugin-vue_export-helper.js";
6
- const T = { class: "loan-card-active-hover tw-flex-1 tw-min-w-[275px] md:tw-min-w-[320px] md:tw-max-w-[320px]" }, E = {
7
- key: 1,
8
- class: "tw-relative tw-w-full"
9
- }, I = { key: 0 }, S = {
10
- class: "tw-absolute tw-bottom-1 tw-left-1 tw-text-primary tw-bg-white tw-rounded tw-p-1 tw-mb-0 tw-text-label tw-flex tw-items-center tw-h-3",
11
- style: { padding: "2px 6px", "text-transform": "capitalize", "max-width": "calc(100% - 1rem)" }
12
- }, F = ["id"], W = { class: "tw-flex tw-flex-col tw-flex-1 tw-px-1" }, z = { class: "tw-hidden md:tw-inline-block tw-text-title" }, K = { class: "tw-pt-1" }, U = {
13
- key: 0,
14
- class: "tw-w-full",
15
- style: { height: "5.5rem" }
16
- }, G = { key: 1 }, O = { class: "tw-flex tw-flex-row tw-justify-between tw-gap-1 md:tw-gap-3" }, j = {
17
- key: 0,
18
- class: "tw-w-full tw-pt-1 tw-pr-1"
1
+ import o from "graphql-tag";
2
+ import { LOAN_CALLOUTS_FRAGMENT as M, LOAN_GEOCODE_FRAGMENT as R, LOAN_PROGRESS_FRAGMENT as B, loanCardComputedProperties as S, loanCardMethods as k, useLocationTruncation as w } from "../utils/loanCard.js";
3
+ import O from "./KvLoanUse2.js";
4
+ import D from "./KvBorrowerImage.js";
5
+ import F from "./KvLoanProgressGroup.js";
6
+ import G from "./KvLoanCallouts.js";
7
+ import b from "./KvLendCta2.js";
8
+ import P from "./KvLoanBookmark2.js";
9
+ import U from "./KvLoanTag2.js";
10
+ import V from "./KvMaterialIcon.js";
11
+ import W from "./KvLoadingPlaceholder.js";
12
+ import $ from "./KvTooltip.js";
13
+ import { KV_LEND_CTA_FRAGMENT as z, KV_LEND_CTA_USER_FRAGMENT as I } from "./KvLendCta.js";
14
+ import { KV_LOAN_TAG_FRAGMENT as q } from "./KvLoanTag.js";
15
+ import { KV_LOAN_USE_FRAGMENT as x } from "./KvLoanUse.js";
16
+ import { KV_LOAN_BOOKMARK_FRAGMENT as H } from "./KvLoanBookmark.js";
17
+ const me = o`
18
+ fragment KvWideLoanCard on LoanBasic {
19
+ id
20
+ image {
21
+ id
22
+ hash # for imageHash
23
+ }
24
+ name # for borrowerName
25
+ ...KvLendCta
26
+ ...KvLoanTag
27
+ ...KvLoanUse
28
+ ...LoanCallouts
29
+ ...LoanGeocode
30
+ ...LoanProgress
31
+ }
32
+ ${z}
33
+ ${q}
34
+ ${x}
35
+ ${M}
36
+ ${R}
37
+ ${B}
38
+ `, ue = o`
39
+ fragment KvWideLoanCardUser on LoanBasic {
40
+ id
41
+ ...KvLendCtaUser
42
+ ...KvLoanBookmark
43
+ }
44
+ ${I}
45
+ ${H}
46
+ `, fe = {
47
+ name: "KvWideLoanCard",
48
+ components: {
49
+ KvBorrowerImage: D,
50
+ KvLoadingPlaceholder: W,
51
+ KvLoanUse: O,
52
+ KvLoanProgressGroup: F,
53
+ KvMaterialIcon: V,
54
+ KvLendCta: b,
55
+ KvLoanTag: U,
56
+ KvLoanCallouts: G,
57
+ KvLoanBookmark: P,
58
+ KvTooltip: $
59
+ },
60
+ props: {
61
+ loanId: {
62
+ type: Number,
63
+ default: void 0
64
+ },
65
+ loan: {
66
+ type: Object,
67
+ default: null
68
+ },
69
+ customLoanDetails: {
70
+ type: Boolean,
71
+ default: !1
72
+ },
73
+ showTags: {
74
+ type: Boolean,
75
+ default: !1
76
+ },
77
+ categoryPageName: {
78
+ type: String,
79
+ default: ""
80
+ },
81
+ enableFiveDollarsNotes: {
82
+ type: Boolean,
83
+ default: !1
84
+ },
85
+ isAdding: {
86
+ type: Boolean,
87
+ default: !1
88
+ },
89
+ isVisitor: {
90
+ type: Boolean,
91
+ default: !0
92
+ },
93
+ basketItems: {
94
+ type: Array,
95
+ default: () => []
96
+ },
97
+ isBookmarked: {
98
+ type: Boolean,
99
+ default: !1
100
+ },
101
+ kvTrackFunction: {
102
+ type: Function,
103
+ required: !0
104
+ },
105
+ photoPath: {
106
+ type: String,
107
+ required: !0
108
+ },
109
+ showViewLoan: {
110
+ type: Boolean,
111
+ default: !1
112
+ },
113
+ externalLinks: {
114
+ type: Boolean,
115
+ default: !1
116
+ },
117
+ route: {
118
+ type: Object,
119
+ default: void 0
120
+ },
121
+ userBalance: {
122
+ type: String,
123
+ default: void 0
124
+ },
125
+ getCookie: {
126
+ type: Function,
127
+ default: void 0
128
+ },
129
+ setCookie: {
130
+ type: Function,
131
+ default: void 0
132
+ },
133
+ fiveDollarsSelected: {
134
+ type: Boolean,
135
+ default: !1
136
+ },
137
+ customCallouts: {
138
+ type: Array,
139
+ default: () => []
140
+ },
141
+ customHref: {
142
+ type: String,
143
+ default: ""
144
+ },
145
+ enableMultiMatching: {
146
+ type: Boolean,
147
+ default: !1
148
+ }
149
+ },
150
+ emits: [
151
+ "toggle-bookmark",
152
+ "add-to-basket"
153
+ ],
154
+ setup(e, { emit: a }) {
155
+ const {
156
+ allDataLoaded: t,
157
+ borrowerName: r,
158
+ city: i,
159
+ countryName: n,
160
+ distributionModel: l,
161
+ formattedLocation: d,
162
+ fundraisingPercent: s,
163
+ hasProgressData: m,
164
+ imageHash: u,
165
+ isLoading: f,
166
+ loanAmount: p,
167
+ loanBorrowerCount: c,
168
+ loanCallouts: L,
169
+ loanStatus: g,
170
+ loanUse: v,
171
+ mdiMapMarker: _,
172
+ readMorePath: A,
173
+ state: y,
174
+ tag: K,
175
+ unreservedAmount: N,
176
+ sharesAvailable: h
177
+ } = S(e), {
178
+ clickReadMore: C
179
+ } = k(e, a), {
180
+ locationRef: T,
181
+ isLocationTruncated: E
182
+ } = w();
183
+ return {
184
+ allDataLoaded: t,
185
+ borrowerName: r,
186
+ city: i,
187
+ countryName: n,
188
+ distributionModel: l,
189
+ formattedLocation: d,
190
+ fundraisingPercent: s,
191
+ hasProgressData: m,
192
+ imageHash: u,
193
+ isLoading: f,
194
+ loanAmount: p,
195
+ loanBorrowerCount: c,
196
+ loanCallouts: L,
197
+ loanStatus: g,
198
+ loanUse: v,
199
+ mdiMapMarker: _,
200
+ readMorePath: A,
201
+ state: y,
202
+ tag: K,
203
+ unreservedAmount: N,
204
+ sharesAvailable: h,
205
+ clickReadMore: C,
206
+ locationRef: T,
207
+ isLocationTruncated: E
208
+ };
209
+ },
210
+ computed: {
211
+ cardWidth() {
212
+ return "374px";
213
+ },
214
+ imageAspectRatio() {
215
+ return 1;
216
+ },
217
+ imageDefaultWidth() {
218
+ return 320;
219
+ },
220
+ imageSizes() {
221
+ return [
222
+ { width: this.imageDefaultWidth, viewSize: 1024 },
223
+ { width: this.imageDefaultWidth, viewSize: 768 },
224
+ { width: 416, viewSize: 480 },
225
+ { width: 374, viewSize: 414 },
226
+ { width: 335, viewSize: 375 }
227
+ ];
228
+ }
229
+ }
19
230
  };
20
- function H(_, a, t, e, q, g) {
21
- const c = i("kv-loading-placeholder"), v = i("kv-borrower-image"), u = i("kv-material-icon"), b = i("kv-tooltip"), x = i("kv-loan-bookmark"), y = i("kv-loan-tag"), L = i("kv-loan-use"), M = i("kv-loan-callouts"), C = i("kv-loan-progress-group"), A = i("kv-lend-cta");
22
- return o(), r("div", {
23
- class: f(["tw-flex tw-flex-row tw-flex-wrap tw-bg-white tw-rounded tw-w-full tw-pb-1 tw-p-1 tw-gap-1 tw-items-center", { "tw-pointer-events-none": e.isLoading }]),
24
- "data-testid": "loan-card",
25
- style: { "box-shadow": "0 4px 12px rgba(0, 0, 0, 0.08)" }
26
- }, [
27
- s("div", T, [
28
- e.isLoading ? (o(), n(c, {
29
- key: 0,
30
- class: "tw-mb-1 tw-w-full tw-rounded",
31
- style: { height: "15rem" }
32
- })) : (o(), r("div", E, [
33
- (o(), n(k(e.tag), {
34
- to: e.readMorePath,
35
- href: e.readMorePath,
36
- class: "tw-flex",
37
- "aria-label": "Borrower image",
38
- onClick: a[0] || (a[0] = (l) => e.clickReadMore("Photo", l))
39
- }, {
40
- default: m(() => [
41
- d(v, {
42
- class: "tw-relative tw-w-full tw-bg-black tw-rounded-sm tw-bg-clip-content",
43
- alt: `Photo of ${e.borrowerName}`,
44
- "aspect-ratio": g.imageAspectRatio,
45
- "default-image": { width: g.imageDefaultWidth },
46
- hash: e.imageHash,
47
- images: g.imageSizes,
48
- "photo-path": t.photoPath
49
- }, null, 8, ["alt", "aspect-ratio", "default-image", "hash", "images", "photo-path"]),
50
- e.countryName ? (o(), r("div", I, [
51
- s("p", S, [
52
- d(u, {
53
- class: "tw-h-2 tw-w-2 tw-flex-shrink-0",
54
- icon: e.mdiMapMarker
55
- }, null, 8, ["icon"]),
56
- s("span", {
57
- id: `loan-location-${t.loanId}`,
58
- ref: "locationRef",
59
- class: "tw-truncate tw-min-w-0",
60
- style: { "margin-top": "0.125rem" }
61
- }, h(e.formattedLocation), 9, F),
62
- e.isLocationTruncated ? (o(), n(b, {
63
- key: 0,
64
- controller: `loan-location-${t.loanId}`,
65
- "max-width": "250px"
66
- }, {
67
- default: m(() => [
68
- N(h(e.formattedLocation), 1)
69
- ]),
70
- _: 1
71
- }, 8, ["controller"])) : w("", !0)
72
- ])
73
- ])) : w("", !0)
74
- ]),
75
- _: 1
76
- }, 8, ["to", "href"])),
77
- t.isVisitor ? w("", !0) : (o(), n(x, {
78
- key: 0,
79
- "loan-id": t.loanId,
80
- "is-bookmarked": t.isBookmarked,
81
- class: "tw-absolute tw-right-1",
82
- style: { top: "-6px" },
83
- "data-testid": "loan-card-bookmark",
84
- onToggleBookmark: a[1] || (a[1] = (l) => _.$emit("toggle-bookmark"))
85
- }, null, 8, ["loan-id", "is-bookmarked"]))
86
- ]))
87
- ]),
88
- s("div", W, [
89
- s("h3", z, h(e.borrowerName), 1),
90
- (o(), n(k(e.tag), {
91
- to: e.readMorePath,
92
- href: e.readMorePath,
93
- class: "tw-flex tw-no-underline hover:tw-no-underline focus:tw-no-underline",
94
- "aria-label": "Loan tag",
95
- onClick: a[2] || (a[2] = (l) => e.clickReadMore("Tag", l))
96
- }, {
97
- default: m(() => [
98
- t.showTags && !e.isLoading ? (o(), n(y, {
99
- key: 0,
100
- loan: t.loan,
101
- "enable-multi-matching": t.enableMultiMatching
102
- }, null, 8, ["loan", "enable-multi-matching"])) : w("", !0)
103
- ]),
104
- _: 1
105
- }, 8, ["to", "href"])),
106
- (o(), n(k(e.tag), {
107
- to: e.readMorePath,
108
- href: e.readMorePath,
109
- class: "loan-card-use tw-no-underline tw-text-primary",
110
- "aria-label": "Loan use",
111
- onClick: a[3] || (a[3] = (l) => e.clickReadMore("Use", l))
112
- }, {
113
- default: m(() => [
114
- s("div", K, [
115
- e.isLoading ? (o(), r("div", U, [
116
- (o(!0), r(R, null, V([...Array(4)], (l, P) => (o(), r("div", {
117
- key: P,
118
- class: "tw-h-2 tw-mb-1"
119
- }, [
120
- d(c)
121
- ]))), 128))
122
- ])) : (o(), r("div", G, [
123
- d(L, {
124
- use: e.loanUse,
125
- "loan-amount": e.loanAmount,
126
- status: e.loanStatus,
127
- "borrower-count": e.loanBorrowerCount,
128
- name: e.borrowerName,
129
- "distribution-model": e.distributionModel
130
- }, null, 8, ["use", "loan-amount", "status", "borrower-count", "name", "distribution-model"])
131
- ]))
132
- ])
133
- ]),
134
- _: 1
135
- }, 8, ["to", "href"])),
136
- e.isLoading || typeof e.loanCallouts > "u" ? (o(), n(c, {
137
- key: 0,
138
- class: "tw-mt-1.5 tw-mb-1",
139
- style: { width: "60%", height: "1.75rem", "border-radius": "500rem" }
140
- })) : (o(), n(M, {
141
- key: 1,
142
- callouts: e.loanCallouts,
143
- class: "loan-callouts tw-my-1.5"
144
- }, null, 8, ["callouts"])),
145
- s("div", O, [
146
- e.hasProgressData ? w("", !0) : (o(), r("div", j, [
147
- d(c, {
148
- class: "tw-mb-0.5",
149
- style: { width: "70%", height: "1.3rem" }
150
- }),
151
- d(c, {
152
- class: "tw-rounded",
153
- style: { width: "70%", height: "0.5rem" }
154
- })
155
- ])),
156
- e.sharesAvailable ? (o(), n(k(e.tag), {
157
- key: 1,
158
- to: e.readMorePath,
159
- href: e.readMorePath,
160
- class: "loan-card-progress tw-mt-1 tw-flex-grow",
161
- "aria-label": "Loan progress",
162
- onClick: a[4] || (a[4] = (l) => e.clickReadMore("Progress", l))
163
- }, {
164
- default: m(() => [
165
- d(C, {
166
- id: "loanProgress",
167
- "money-left": e.unreservedAmount,
168
- "progress-percent": e.fundraisingPercent,
169
- class: "tw-text-black"
170
- }, null, 8, ["money-left", "progress-percent"])
171
- ]),
172
- _: 1
173
- }, 8, ["to", "href"])) : w("", !0),
174
- e.allDataLoaded ? (o(), n(A, {
175
- key: 3,
176
- loan: t.loan,
177
- "unreserved-amount": e.unreservedAmount,
178
- "basket-items": t.basketItems,
179
- "is-loading": e.isLoading,
180
- "is-adding": t.isAdding,
181
- "enable-five-dollars-notes": t.enableFiveDollarsNotes,
182
- "five-dollars-selected": t.fiveDollarsSelected,
183
- "kv-track-function": t.kvTrackFunction,
184
- "show-view-loan": t.showViewLoan,
185
- "custom-loan-details": t.customLoanDetails,
186
- "external-links": t.externalLinks,
187
- route: t.route,
188
- "user-balance": t.userBalance,
189
- "get-cookie": t.getCookie,
190
- "set-cookie": t.setCookie,
191
- "is-visitor": t.isVisitor,
192
- class: f(["tw-mt-auto tw-self-end", { "tw-flex-grow": !e.sharesAvailable, "tw-flex-shrink-0": e.sharesAvailable }]),
193
- onAddToBasket: a[5] || (a[5] = (l) => _.$emit("add-to-basket", l)),
194
- onShowLoanDetails: a[6] || (a[6] = (l) => e.clickReadMore("ViewLoan", l))
195
- }, 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", "is-visitor", "class"])) : (o(), n(c, {
196
- key: 2,
197
- class: "tw-rounded tw-self-start",
198
- style: { width: "9rem", height: "3rem" }
199
- }))
200
- ])
201
- ])
202
- ], 2);
203
- }
204
- const Z = /* @__PURE__ */ B(D, [["render", H], ["__scopeId", "data-v-de4628d8"]]);
205
231
  export {
206
- ee as KV_WIDE_LOAN_CARD_FRAGMENT,
207
- te as KV_WIDE_LOAN_CARD_USER_FRAGMENT,
208
- Z as default
232
+ me as KV_WIDE_LOAN_CARD_FRAGMENT,
233
+ ue as KV_WIDE_LOAN_CARD_USER_FRAGMENT,
234
+ fe as default
209
235
  };