@kiva/kv-components 3.106.0 → 3.107.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.
- package/.eslintrc.cjs +1 -0
- package/CHANGELOG.md +22 -0
- package/dist/components/.storybook/main.js +85 -0
- package/dist/components/.storybook/package.json +3 -0
- package/dist/components/.storybook/preview.js +61 -0
- package/dist/components/.storybook/tailwind.css +5 -0
- package/dist/components/KvAccordionItem.vue +130 -0
- package/dist/components/KvActivityRow.vue +33 -0
- package/dist/components/KvBorrowerImage.vue +179 -0
- package/dist/components/KvButton.vue +287 -0
- package/dist/components/KvCarousel.vue +297 -0
- package/dist/components/KvCartModal.vue +365 -0
- package/dist/components/KvCheckbox.vue +203 -0
- package/dist/components/KvChip.vue +54 -0
- package/dist/components/KvClassicLoanCard.vue +527 -0
- package/dist/components/KvCommentsAdd.vue +135 -0
- package/dist/components/KvCommentsContainer.vue +84 -0
- package/dist/components/KvCommentsHeartButton.vue +70 -0
- package/dist/components/KvCommentsList.vue +68 -0
- package/dist/components/KvCommentsListItem.vue +241 -0
- package/dist/components/KvCommentsReplyButton.vue +52 -0
- package/dist/components/KvContentfulImg.vue +273 -0
- package/dist/components/KvCountdownTimer.vue +59 -0
- package/dist/components/KvExpandable.vue +84 -0
- package/dist/components/KvExpandableQuestion.vue +120 -0
- package/dist/components/KvFlag.vue +120 -0
- package/dist/components/KvGrid.vue +28 -0
- package/dist/components/KvImpactDashboardHeader.vue +40 -0
- package/dist/components/KvInlineActivityCard.vue +55 -0
- package/dist/components/KvInlineActivityFeed.vue +38 -0
- package/dist/components/KvIntroductionLoanCard.vue +446 -0
- package/dist/components/KvLendAmountButton.vue +65 -0
- package/dist/components/KvLendCta.vue +451 -0
- package/dist/components/KvLightbox.vue +334 -0
- package/dist/components/KvLineGraph.vue +128 -0
- package/dist/components/KvLoadingPlaceholder.vue +38 -0
- package/dist/components/KvLoadingSpinner.vue +81 -0
- package/dist/components/KvLoanActivities.vue +268 -0
- package/dist/components/KvLoanBookmark.vue +39 -0
- package/dist/components/KvLoanCallouts.vue +53 -0
- package/dist/components/KvLoanProgressGroup.vue +76 -0
- package/dist/components/KvLoanTag.vue +88 -0
- package/dist/components/KvLoanTeamPick.vue +44 -0
- package/dist/components/KvLoanUse.vue +92 -0
- package/dist/components/KvMap.vue +599 -0
- package/dist/components/KvMaterialIcon.vue +47 -0
- package/dist/components/KvPageContainer.vue +15 -0
- package/dist/components/KvPagination.vue +198 -0
- package/dist/components/KvPieChart.vue +257 -0
- package/dist/components/KvPopper.vue +178 -0
- package/dist/components/KvProgressBar.vue +149 -0
- package/dist/components/KvRadio.vue +198 -0
- package/dist/components/KvSelect.vue +114 -0
- package/dist/components/KvSideSheet.vue +134 -0
- package/dist/components/KvSwitch.vue +143 -0
- package/dist/components/KvTab.vue +90 -0
- package/dist/components/KvTabPanel.vue +64 -0
- package/dist/components/KvTabs.vue +182 -0
- package/dist/components/KvTextInput.vue +247 -0
- package/dist/components/KvTextLink.vue +138 -0
- package/dist/components/KvThemeProvider.vue +122 -0
- package/dist/components/KvToast.vue +221 -0
- package/dist/components/KvTooltip.vue +168 -0
- package/dist/components/KvTreeMapChart.vue +229 -0
- package/dist/components/KvUserAvatar.vue +132 -0
- package/dist/components/KvVerticalCarousel.vue +156 -0
- package/dist/components/KvVotingCard.vue +160 -0
- package/dist/components/KvVotingCardV2.vue +154 -0
- package/dist/components/KvWideLoanCard.vue +432 -0
- package/dist/components/stories/Forms.stories.js +62 -0
- package/dist/components/stories/KvAccordionItem.stories.js +24 -0
- package/dist/components/stories/KvActivityRow.stories.js +25 -0
- package/dist/components/stories/KvBorrowerImage.stories.js +68 -0
- package/dist/components/stories/KvButton.stories.js +144 -0
- package/dist/components/stories/KvCarousel.stories.js +426 -0
- package/dist/components/stories/KvCartModal.stories.js +54 -0
- package/dist/components/stories/KvCheckbox.stories.js +163 -0
- package/dist/components/stories/KvChip.stories.js +43 -0
- package/dist/components/stories/KvClassicLoanCard.stories.js +480 -0
- package/dist/components/stories/KvCommentsAdd.stories.js +32 -0
- package/dist/components/stories/KvCommentsContainer.stories.js +42 -0
- package/dist/components/stories/KvCommentsHeartButton.stories.js +25 -0
- package/dist/components/stories/KvCommentsList.stories.js +39 -0
- package/dist/components/stories/KvCommentsListItem.stories.js +45 -0
- package/dist/components/stories/KvCommentsReplyButton.stories.js +21 -0
- package/dist/components/stories/KvContentfulImg.stories.js +196 -0
- package/dist/components/stories/KvCountdownTimer.stories.js +30 -0
- package/dist/components/stories/KvExpandableQuestion.stories.js +129 -0
- package/dist/components/stories/KvFlag.stories.js +36 -0
- package/dist/components/stories/KvGrid.stories.js +97 -0
- package/dist/components/stories/KvImpactDashboardHeader.stories.js +22 -0
- package/dist/components/stories/KvInlineActivityCard.stories.js +69 -0
- package/dist/components/stories/KvInlineActivityFeed.stories.js +76 -0
- package/dist/components/stories/KvIntroductionLoanCard.stories.js +208 -0
- package/dist/components/stories/KvLendAmountButton.stories.js +31 -0
- package/dist/components/stories/KvLendCta.stories.js +177 -0
- package/dist/components/stories/KvLightbox.stories.js +304 -0
- package/dist/components/stories/KvLineGraph.stories.js +52 -0
- package/dist/components/stories/KvLoadingPlaceholder.stories.js +17 -0
- package/dist/components/stories/KvLoadingSpinner.stories.js +52 -0
- package/dist/components/stories/KvLoanActivities.stories.js +104 -0
- package/dist/components/stories/KvLoanBookmark.stories.js +22 -0
- package/dist/components/stories/KvLoanCallouts.stories.js +22 -0
- package/dist/components/stories/KvLoanProgressGroup.stories.js +29 -0
- package/dist/components/stories/KvLoanTag.stories.js +61 -0
- package/dist/components/stories/KvLoanTeamPick.stories.js +20 -0
- package/dist/components/stories/KvLoanUse.stories.js +60 -0
- package/dist/components/stories/KvMap.stories.js +121 -0
- package/dist/components/stories/KvMaterialIcon.stories.js +201 -0
- package/dist/components/stories/KvPageContainer.stories.js +50 -0
- package/dist/components/stories/KvPagination.stories.js +70 -0
- package/dist/components/stories/KvPieChart.stories.js +47 -0
- package/dist/components/stories/KvProgressBar.stories.js +53 -0
- package/dist/components/stories/KvRadio.stories.js +140 -0
- package/dist/components/stories/KvSelect.stories.js +125 -0
- package/dist/components/stories/KvSideSheet.stories.js +50 -0
- package/dist/components/stories/KvSwitch.stories.js +66 -0
- package/dist/components/stories/KvTabs.stories.js +106 -0
- package/dist/components/stories/KvTextInput.stories.js +194 -0
- package/dist/components/stories/KvTextLink.stories.js +55 -0
- package/dist/components/stories/KvThemeProvider.stories.js +178 -0
- package/dist/components/stories/KvToast.stories.js +117 -0
- package/dist/components/stories/KvTooltip.stories.js +26 -0
- package/dist/components/stories/KvTreeMapChart.stories.js +42 -0
- package/dist/components/stories/KvUserAvatar.stories.js +47 -0
- package/dist/components/stories/KvVerticalCarousel.stories.js +168 -0
- package/dist/components/stories/KvVotingCard.stories.js +33 -0
- package/dist/components/stories/KvVotingCardV2.stories.js +89 -0
- package/dist/components/stories/KvWideLoanCard.stories.js +292 -0
- package/dist/components/stories/StyleguidePrimitives.stories.js +499 -0
- package/dist/components/stories/StyleguideProse.stories.js +215 -0
- package/dist/data/countries-borders.json +1 -0
- package/dist/data/ne_110m_admin_0_countries.json +1 -0
- package/dist/utils/Alea.cjs +87 -0
- package/dist/utils/Alea.js +9 -0
- package/dist/utils/attrs.cjs +50 -0
- package/dist/utils/attrs.js +7 -0
- package/dist/utils/carousels.cjs +184 -0
- package/dist/utils/carousels.js +8 -0
- package/dist/utils/chunk-3HK4G4NT.js +27 -0
- package/dist/utils/chunk-55HF2ORX.js +201 -0
- package/dist/utils/chunk-AY3PR5S4.js +54 -0
- package/dist/utils/chunk-AZPWOFD5.js +148 -0
- package/dist/utils/chunk-B5J5WLAH.js +18 -0
- package/dist/utils/chunk-GPSH6OPA.js +64 -0
- package/dist/utils/chunk-HIY5IW65.js +28 -0
- package/dist/utils/chunk-HV3AUBFT.js +15 -0
- package/dist/utils/chunk-MSMZIN54.js +110 -0
- package/dist/utils/chunk-OXJCCNNW.js +30 -0
- package/dist/utils/chunk-S3MABILA.js +22 -0
- package/dist/utils/chunk-VIGEMAKO.js +249 -0
- package/dist/utils/chunk-YCNMJ4YV.js +37 -0
- package/dist/utils/chunk-YFEC5ODJ.js +129 -0
- package/dist/utils/expander.cjs +78 -0
- package/dist/utils/expander.js +9 -0
- package/dist/utils/imageUtils.cjs +54 -0
- package/dist/utils/imageUtils.js +9 -0
- package/dist/utils/index.cjs +1118 -0
- package/dist/utils/index.js +166 -0
- package/dist/utils/loanCard.cjs +222 -0
- package/dist/utils/loanCard.js +9 -0
- package/dist/utils/loanUtils.cjs +170 -0
- package/dist/utils/loanUtils.js +23 -0
- package/dist/utils/mapUtils.cjs +276 -0
- package/dist/utils/mapUtils.js +15 -0
- package/dist/utils/printing.cjs +42 -0
- package/dist/utils/printing.js +9 -0
- package/dist/utils/scrollLock.cjs +54 -0
- package/dist/utils/scrollLock.js +13 -0
- package/dist/utils/throttle.cjs +38 -0
- package/dist/utils/throttle.js +7 -0
- package/dist/utils/touchEvents.cjs +47 -0
- package/dist/utils/touchEvents.js +11 -0
- package/dist/utils/treemap.cjs +133 -0
- package/dist/utils/treemap.js +7 -0
- package/package.json +12 -4
- package/utils/index.js +14 -0
- package/vue/KvVerticalCarousel.vue +1 -1
- package/index.js +0 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// utils/Alea.js
|
|
20
|
+
var Alea_exports = {};
|
|
21
|
+
__export(Alea_exports, {
|
|
22
|
+
Mash: () => Mash,
|
|
23
|
+
default: () => Alea
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Alea_exports);
|
|
26
|
+
function Mash() {
|
|
27
|
+
let n = 4022871197;
|
|
28
|
+
const mash = function(data) {
|
|
29
|
+
data = data.toString();
|
|
30
|
+
for (let i = 0; i < data.length; i++) {
|
|
31
|
+
n += data.charCodeAt(i);
|
|
32
|
+
let h = 0.02519603282416938 * n;
|
|
33
|
+
n = h >>> 0;
|
|
34
|
+
h -= n;
|
|
35
|
+
h *= n;
|
|
36
|
+
n = h >>> 0;
|
|
37
|
+
h -= n;
|
|
38
|
+
n += h * 4294967296;
|
|
39
|
+
}
|
|
40
|
+
return (n >>> 0) * 23283064365386963e-26;
|
|
41
|
+
};
|
|
42
|
+
mash.version = "Mash 0.9";
|
|
43
|
+
return mash;
|
|
44
|
+
}
|
|
45
|
+
function Alea() {
|
|
46
|
+
return function(args) {
|
|
47
|
+
let s0 = 0;
|
|
48
|
+
let s1 = 0;
|
|
49
|
+
let s2 = 0;
|
|
50
|
+
let c = 1;
|
|
51
|
+
if (args.length === 0) {
|
|
52
|
+
args = [+/* @__PURE__ */ new Date()];
|
|
53
|
+
}
|
|
54
|
+
let mash = Mash();
|
|
55
|
+
s0 = mash(" ");
|
|
56
|
+
s1 = mash(" ");
|
|
57
|
+
s2 = mash(" ");
|
|
58
|
+
for (let i = 0; i < args.length; i++) {
|
|
59
|
+
s0 -= mash(args[i]);
|
|
60
|
+
if (s0 < 0) {
|
|
61
|
+
s0 += 1;
|
|
62
|
+
}
|
|
63
|
+
s1 -= mash(args[i]);
|
|
64
|
+
if (s1 < 0) {
|
|
65
|
+
s1 += 1;
|
|
66
|
+
}
|
|
67
|
+
s2 -= mash(args[i]);
|
|
68
|
+
if (s2 < 0) {
|
|
69
|
+
s2 += 1;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
mash = null;
|
|
73
|
+
const random = function() {
|
|
74
|
+
const t = 2091639 * s0 + c * 23283064365386963e-26;
|
|
75
|
+
s0 = s1;
|
|
76
|
+
s1 = s2;
|
|
77
|
+
return s2 = t - (c = t | 0);
|
|
78
|
+
};
|
|
79
|
+
random.version = "Alea 0.9";
|
|
80
|
+
random.args = args;
|
|
81
|
+
return random;
|
|
82
|
+
}(Array.prototype.slice.call(arguments));
|
|
83
|
+
}
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
Mash
|
|
87
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// utils/attrs.js
|
|
20
|
+
var attrs_exports = {};
|
|
21
|
+
__export(attrs_exports, {
|
|
22
|
+
useAttrs: () => useAttrs
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(attrs_exports);
|
|
25
|
+
function asArray(input) {
|
|
26
|
+
if (!input)
|
|
27
|
+
return [];
|
|
28
|
+
return Array.isArray(input) ? input : [input];
|
|
29
|
+
}
|
|
30
|
+
function useAttrs({ attrs, listeners }, ownEvents = []) {
|
|
31
|
+
const classes = asArray(attrs == null ? void 0 : attrs.class);
|
|
32
|
+
const styles = asArray(attrs == null ? void 0 : attrs.style);
|
|
33
|
+
const inputListeners = listeners ? { ...listeners } : {};
|
|
34
|
+
ownEvents.forEach((event) => {
|
|
35
|
+
delete inputListeners[event];
|
|
36
|
+
});
|
|
37
|
+
const inputAttrs = { ...attrs };
|
|
38
|
+
delete inputAttrs.class;
|
|
39
|
+
delete inputAttrs.style;
|
|
40
|
+
return {
|
|
41
|
+
classes,
|
|
42
|
+
styles,
|
|
43
|
+
inputAttrs,
|
|
44
|
+
inputListeners
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
useAttrs
|
|
50
|
+
});
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// utils/carousels.js
|
|
30
|
+
var carousels_exports = {};
|
|
31
|
+
__export(carousels_exports, {
|
|
32
|
+
carouselUtil: () => carouselUtil
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(carousels_exports);
|
|
35
|
+
var import_vue_demi = require("vue-demi");
|
|
36
|
+
var import_embla_carousel = __toESM(require("embla-carousel"), 1);
|
|
37
|
+
|
|
38
|
+
// utils/throttle.js
|
|
39
|
+
function throttle(func, timeFrame) {
|
|
40
|
+
let lastTime = 0;
|
|
41
|
+
return function t(...args) {
|
|
42
|
+
const now = /* @__PURE__ */ new Date();
|
|
43
|
+
if (now - lastTime >= timeFrame) {
|
|
44
|
+
func(...args);
|
|
45
|
+
lastTime = now;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// utils/carousels.js
|
|
51
|
+
function carouselUtil(props, { emit, slots }, extraEmblaOptions) {
|
|
52
|
+
var _a;
|
|
53
|
+
const {
|
|
54
|
+
emblaOptions,
|
|
55
|
+
slidesToScroll
|
|
56
|
+
} = (0, import_vue_demi.toRefs)(props);
|
|
57
|
+
const rootEl = (0, import_vue_demi.ref)(null);
|
|
58
|
+
const embla = (0, import_vue_demi.ref)(null);
|
|
59
|
+
const slides = (0, import_vue_demi.ref)([]);
|
|
60
|
+
const startIndex = ((_a = emblaOptions.value) == null ? void 0 : _a.startIndex) ?? 0;
|
|
61
|
+
const currentIndex = (0, import_vue_demi.ref)(startIndex);
|
|
62
|
+
const slideIndicatorCount = (0, import_vue_demi.ref)(0);
|
|
63
|
+
const componentSlotKeys = (0, import_vue_demi.computed)(() => {
|
|
64
|
+
const keys = Object.keys(slots);
|
|
65
|
+
return keys;
|
|
66
|
+
});
|
|
67
|
+
const nextIndex = (0, import_vue_demi.computed)(() => {
|
|
68
|
+
const nextSlideIndex = currentIndex.value + 1;
|
|
69
|
+
if (nextSlideIndex < slides.value.length) {
|
|
70
|
+
return nextSlideIndex;
|
|
71
|
+
}
|
|
72
|
+
return 0;
|
|
73
|
+
});
|
|
74
|
+
const previousIndex = (0, import_vue_demi.computed)(() => {
|
|
75
|
+
const previousSlideIndex = currentIndex.value - 1;
|
|
76
|
+
if (previousSlideIndex >= 0) {
|
|
77
|
+
return previousSlideIndex;
|
|
78
|
+
}
|
|
79
|
+
return slides.value.length - 1;
|
|
80
|
+
});
|
|
81
|
+
const goToSlide = (index) => {
|
|
82
|
+
embla.value.scrollTo(index);
|
|
83
|
+
};
|
|
84
|
+
const handleUserInteraction = async (index, interactionType) => {
|
|
85
|
+
if (index !== null && typeof index !== "undefined") {
|
|
86
|
+
await (0, import_vue_demi.nextTick)();
|
|
87
|
+
goToSlide(index);
|
|
88
|
+
}
|
|
89
|
+
emit("interact-carousel", interactionType);
|
|
90
|
+
};
|
|
91
|
+
const slideIndicatorListLength = () => {
|
|
92
|
+
const indicator = embla.value ? embla.value.scrollSnapList().length : 0;
|
|
93
|
+
slideIndicatorCount.value = indicator;
|
|
94
|
+
return indicator;
|
|
95
|
+
};
|
|
96
|
+
const reInitVisible = () => {
|
|
97
|
+
const slidesInView = embla.value.slidesInView(true).length;
|
|
98
|
+
if (slidesInView) {
|
|
99
|
+
embla.value.reInit({
|
|
100
|
+
slidesToScroll: slidesInView,
|
|
101
|
+
inViewThreshold: 0.9
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const reInit = () => {
|
|
106
|
+
embla.value.reInit();
|
|
107
|
+
if (slidesToScroll.value === "visible") {
|
|
108
|
+
reInitVisible();
|
|
109
|
+
}
|
|
110
|
+
slides.value = embla.value.slideNodes();
|
|
111
|
+
slideIndicatorListLength();
|
|
112
|
+
};
|
|
113
|
+
const onCarouselContainerClick = (e) => {
|
|
114
|
+
if (embla.value && !embla.value.clickAllowed()) {
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
e.stopPropagation();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const isAriaHidden = (index) => {
|
|
120
|
+
if (embla.value) {
|
|
121
|
+
return !embla.value.slidesInView(true).includes(index);
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
};
|
|
125
|
+
(0, import_vue_demi.onMounted)(async () => {
|
|
126
|
+
var _a2;
|
|
127
|
+
embla.value = (0, import_embla_carousel.default)(rootEl.value, {
|
|
128
|
+
loop: true,
|
|
129
|
+
containScroll: "trimSnaps",
|
|
130
|
+
inViewThreshold: 0.9,
|
|
131
|
+
align: "start",
|
|
132
|
+
...extraEmblaOptions,
|
|
133
|
+
...emblaOptions.value
|
|
134
|
+
});
|
|
135
|
+
if (slidesToScroll.value === "visible") {
|
|
136
|
+
reInitVisible();
|
|
137
|
+
embla.value.on(
|
|
138
|
+
"resize",
|
|
139
|
+
throttle(() => {
|
|
140
|
+
embla.value.reInit({
|
|
141
|
+
slidesToScroll: embla.value.slidesInView(true).length || "auto",
|
|
142
|
+
inViewThreshold: 0.9
|
|
143
|
+
});
|
|
144
|
+
slides.value = embla.value.slideNodes();
|
|
145
|
+
slideIndicatorListLength();
|
|
146
|
+
}, 250)
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
slides.value = embla.value.slideNodes();
|
|
150
|
+
slideIndicatorListLength();
|
|
151
|
+
(_a2 = embla == null ? void 0 : embla.value) == null ? void 0 : _a2.on("select", () => {
|
|
152
|
+
currentIndex.value = embla.value.selectedScrollSnap();
|
|
153
|
+
(0, import_vue_demi.nextTick)(() => {
|
|
154
|
+
emit("change", currentIndex);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
(0, import_vue_demi.onUnmounted)(async () => {
|
|
159
|
+
var _a2, _b;
|
|
160
|
+
(_a2 = embla == null ? void 0 : embla.value) == null ? void 0 : _a2.off("select");
|
|
161
|
+
(_b = embla == null ? void 0 : embla.value) == null ? void 0 : _b.destroy();
|
|
162
|
+
});
|
|
163
|
+
return {
|
|
164
|
+
rootEl,
|
|
165
|
+
embla,
|
|
166
|
+
slides,
|
|
167
|
+
currentIndex,
|
|
168
|
+
componentSlotKeys,
|
|
169
|
+
nextIndex,
|
|
170
|
+
previousIndex,
|
|
171
|
+
slideIndicatorCount,
|
|
172
|
+
handleUserInteraction,
|
|
173
|
+
goToSlide,
|
|
174
|
+
reInit,
|
|
175
|
+
reInitVisible,
|
|
176
|
+
onCarouselContainerClick,
|
|
177
|
+
isAriaHidden,
|
|
178
|
+
slideIndicatorListLength
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
182
|
+
0 && (module.exports = {
|
|
183
|
+
carouselUtil
|
|
184
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// utils/attrs.js
|
|
2
|
+
function asArray(input) {
|
|
3
|
+
if (!input)
|
|
4
|
+
return [];
|
|
5
|
+
return Array.isArray(input) ? input : [input];
|
|
6
|
+
}
|
|
7
|
+
function useAttrs({ attrs, listeners }, ownEvents = []) {
|
|
8
|
+
const classes = asArray(attrs == null ? void 0 : attrs.class);
|
|
9
|
+
const styles = asArray(attrs == null ? void 0 : attrs.style);
|
|
10
|
+
const inputListeners = listeners ? { ...listeners } : {};
|
|
11
|
+
ownEvents.forEach((event) => {
|
|
12
|
+
delete inputListeners[event];
|
|
13
|
+
});
|
|
14
|
+
const inputAttrs = { ...attrs };
|
|
15
|
+
delete inputAttrs.class;
|
|
16
|
+
delete inputAttrs.style;
|
|
17
|
+
return {
|
|
18
|
+
classes,
|
|
19
|
+
styles,
|
|
20
|
+
inputAttrs,
|
|
21
|
+
inputListeners
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
useAttrs
|
|
27
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
// utils/loanCard.js
|
|
2
|
+
import {
|
|
3
|
+
computed,
|
|
4
|
+
toRefs
|
|
5
|
+
} from "vue-demi";
|
|
6
|
+
import { mdiMapMarker } from "@mdi/js";
|
|
7
|
+
var LSE_LOAN_KEY = "N/A";
|
|
8
|
+
var ECO_FRIENDLY_KEY = "ECO-FRIENDLY";
|
|
9
|
+
var SUSTAINABLE_AG_KEY = "SUSTAINABLE AG";
|
|
10
|
+
var SINGLE_PARENT_KEY = "SINGLE PARENT";
|
|
11
|
+
var REFUGEE_KEY = "REFUGEES/DISPLACED";
|
|
12
|
+
var findCalloutData = (tags, tagName) => (tags == null ? void 0 : tags.find((t) => t.name.replace("#", "").toUpperCase() === tagName.toUpperCase())) ?? {};
|
|
13
|
+
function loanCardComputedProperties(props, hideUnitedStatesText = false) {
|
|
14
|
+
const {
|
|
15
|
+
externalLinks,
|
|
16
|
+
customLoanDetails,
|
|
17
|
+
loanId,
|
|
18
|
+
loan,
|
|
19
|
+
categoryPageName,
|
|
20
|
+
customCallouts
|
|
21
|
+
} = toRefs(props);
|
|
22
|
+
const tag = computed(() => externalLinks.value ? "a" : "router-link");
|
|
23
|
+
const readMorePath = computed(() => customLoanDetails.value ? "" : `/lend/${loanId.value}`);
|
|
24
|
+
const isLoading = computed(() => !loanId.value || !loan.value);
|
|
25
|
+
const borrowerName = computed(() => {
|
|
26
|
+
var _a;
|
|
27
|
+
return ((_a = loan.value) == null ? void 0 : _a.name) || "";
|
|
28
|
+
});
|
|
29
|
+
const countryName = computed(() => {
|
|
30
|
+
var _a, _b, _c;
|
|
31
|
+
return ((_c = (_b = (_a = loan.value) == null ? void 0 : _a.geocode) == null ? void 0 : _b.country) == null ? void 0 : _c.name) || "";
|
|
32
|
+
});
|
|
33
|
+
const countryCode = computed(() => {
|
|
34
|
+
var _a, _b, _c;
|
|
35
|
+
return ((_c = (_b = (_a = loan.value) == null ? void 0 : _a.geocode) == null ? void 0 : _b.country) == null ? void 0 : _c.isoCode) || "";
|
|
36
|
+
});
|
|
37
|
+
const city = computed(() => {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
return ((_b = (_a = loan.value) == null ? void 0 : _a.geocode) == null ? void 0 : _b.city) || "";
|
|
40
|
+
});
|
|
41
|
+
const state = computed(() => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return ((_b = (_a = loan.value) == null ? void 0 : _a.geocode) == null ? void 0 : _b.state) || "";
|
|
44
|
+
});
|
|
45
|
+
const distributionModel = computed(() => {
|
|
46
|
+
var _a;
|
|
47
|
+
return ((_a = loan.value) == null ? void 0 : _a.distributionModel) || "";
|
|
48
|
+
});
|
|
49
|
+
const imageHash = computed(() => {
|
|
50
|
+
var _a, _b;
|
|
51
|
+
return ((_b = (_a = loan.value) == null ? void 0 : _a.image) == null ? void 0 : _b.hash) ?? "";
|
|
52
|
+
});
|
|
53
|
+
const hasProgressData = computed(() => {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
return typeof ((_a = loan.value) == null ? void 0 : _a.unreservedAmount) !== "undefined" && typeof ((_b = loan.value) == null ? void 0 : _b.fundraisingPercent) !== "undefined";
|
|
56
|
+
});
|
|
57
|
+
const allDataLoaded = computed(() => !isLoading.value && hasProgressData.value);
|
|
58
|
+
const fundraisingPercent = computed(() => {
|
|
59
|
+
var _a;
|
|
60
|
+
return ((_a = loan.value) == null ? void 0 : _a.fundraisingPercent) ?? 0;
|
|
61
|
+
});
|
|
62
|
+
const unreservedAmount = computed(() => {
|
|
63
|
+
var _a;
|
|
64
|
+
const stringAmount = ((_a = loan.value) == null ? void 0 : _a.unreservedAmount) ?? "0";
|
|
65
|
+
return Number(stringAmount);
|
|
66
|
+
});
|
|
67
|
+
const formattedLocation = computed(() => {
|
|
68
|
+
if (distributionModel.value === "direct") {
|
|
69
|
+
const countryText = hideUnitedStatesText && countryName.value.toLowerCase() === "united states" ? "" : `, ${countryName.value}`;
|
|
70
|
+
return `${city.value}, ${state.value}${countryText}`;
|
|
71
|
+
}
|
|
72
|
+
if (countryName.value === "Puerto Rico") {
|
|
73
|
+
return `${city.value}, PR`;
|
|
74
|
+
}
|
|
75
|
+
return countryName.value;
|
|
76
|
+
});
|
|
77
|
+
const loanUse = computed(() => {
|
|
78
|
+
var _a;
|
|
79
|
+
return ((_a = loan.value) == null ? void 0 : _a.use) ?? "";
|
|
80
|
+
});
|
|
81
|
+
const loanStatus = computed(() => {
|
|
82
|
+
var _a;
|
|
83
|
+
return ((_a = loan.value) == null ? void 0 : _a.status) ?? "";
|
|
84
|
+
});
|
|
85
|
+
const loanAmount = computed(() => {
|
|
86
|
+
var _a;
|
|
87
|
+
return ((_a = loan.value) == null ? void 0 : _a.loanAmount) ?? "0";
|
|
88
|
+
});
|
|
89
|
+
const loanBorrowerCount = computed(() => {
|
|
90
|
+
var _a;
|
|
91
|
+
return ((_a = loan.value) == null ? void 0 : _a.borrowerCount) ?? 0;
|
|
92
|
+
});
|
|
93
|
+
const loanCallouts = computed(() => {
|
|
94
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
95
|
+
const callouts = [];
|
|
96
|
+
const activityName = ((_b = (_a = loan.value) == null ? void 0 : _a.activity) == null ? void 0 : _b.name) ?? "";
|
|
97
|
+
const activityId = ((_d = (_c = loan.value) == null ? void 0 : _c.activity) == null ? void 0 : _d.id) ?? null;
|
|
98
|
+
const sectorName = ((_f = (_e = loan.value) == null ? void 0 : _e.sector) == null ? void 0 : _f.name) ?? "";
|
|
99
|
+
const sectorId = ((_h = (_g = loan.value) == null ? void 0 : _g.sector) == null ? void 0 : _h.id) ?? null;
|
|
100
|
+
const tags = ((_j = (_i = loan.value) == null ? void 0 : _i.tags) == null ? void 0 : _j.filter((loantag) => loantag.charAt(0) === "#").map((loantag) => loantag.substring(1))) ?? [];
|
|
101
|
+
const themes = ((_k = loan.value) == null ? void 0 : _k.themes) ?? [];
|
|
102
|
+
const categories = {
|
|
103
|
+
ecoFriendly: !!tags.filter((t) => t.toUpperCase() === ECO_FRIENDLY_KEY || t.toUpperCase() === SUSTAINABLE_AG_KEY).length,
|
|
104
|
+
refugeesIdps: !!themes.filter((t) => t.toUpperCase() === REFUGEE_KEY).length,
|
|
105
|
+
singleParents: !!tags.filter((t) => t.toUpperCase() === SINGLE_PARENT_KEY).length
|
|
106
|
+
};
|
|
107
|
+
const isLseLoan = (_m = (_l = loan.value) == null ? void 0 : _l.partnerName) == null ? void 0 : _m.toUpperCase().includes(LSE_LOAN_KEY);
|
|
108
|
+
const tagsData = ((_n = loan.value) == null ? void 0 : _n.tagsData) ?? [];
|
|
109
|
+
const themesData = ((_o = loan.value) == null ? void 0 : _o.themesData) ?? [];
|
|
110
|
+
if (isLseLoan && tags.length) {
|
|
111
|
+
const position = Math.floor(Math.random() * tags.length);
|
|
112
|
+
const p1Tag = tags[position];
|
|
113
|
+
const tagData = findCalloutData(tagsData, p1Tag);
|
|
114
|
+
const id = (tagData == null ? void 0 : tagData.id) ?? null;
|
|
115
|
+
callouts.push({ label: p1Tag, type: "tag", id });
|
|
116
|
+
}
|
|
117
|
+
if (!categoryPageName.value) {
|
|
118
|
+
if (categories.ecoFriendly && !callouts.find((c) => c.label.toUpperCase() === ECO_FRIENDLY_KEY || c.label.toUpperCase() === SUSTAINABLE_AG_KEY)) {
|
|
119
|
+
callouts.push({ label: "Eco-friendly", type: "tag", id: 9 });
|
|
120
|
+
} else if (categories.refugeesIdps) {
|
|
121
|
+
callouts.push({ label: "Refugees and IDPs", type: "attribute", id: 28 });
|
|
122
|
+
} else if (categories.singleParents && !callouts.find((c) => c.label.toUpperCase() === SINGLE_PARENT_KEY)) {
|
|
123
|
+
callouts.push({ label: "Single Parent", type: "tag", id: 17 });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (activityName && activityId && ((_p = categoryPageName.value) == null ? void 0 : _p.toUpperCase()) !== activityName.toUpperCase()) {
|
|
127
|
+
callouts.push({ id: activityId, label: activityName, type: "activity" });
|
|
128
|
+
}
|
|
129
|
+
if (sectorName && sectorId && activityName.toUpperCase() !== sectorName.toUpperCase() && sectorName.toUpperCase() !== ((_q = categoryPageName.value) == null ? void 0 : _q.toUpperCase()) && callouts.length < 2) {
|
|
130
|
+
callouts.push({ id: sectorId, label: sectorName, type: "sector" });
|
|
131
|
+
}
|
|
132
|
+
if (!!tags.length && callouts.length < 2) {
|
|
133
|
+
const position = Math.floor(Math.random() * tags.length);
|
|
134
|
+
const p4Tag = tags[position];
|
|
135
|
+
const tagData = findCalloutData(tagsData, p4Tag);
|
|
136
|
+
const id = (tagData == null ? void 0 : tagData.id) ?? null;
|
|
137
|
+
if (!callouts.filter((c) => c.label.toUpperCase() === p4Tag.toUpperCase()).length) {
|
|
138
|
+
callouts.push({ label: p4Tag, type: "tag", id });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (!!themes.length && callouts.length < 2) {
|
|
142
|
+
const position = Math.floor(Math.random() * themes.length);
|
|
143
|
+
const theme = themes[position];
|
|
144
|
+
const themeData = findCalloutData(themesData, theme);
|
|
145
|
+
const id = (themeData == null ? void 0 : themeData.id) ?? null;
|
|
146
|
+
if (!callouts.filter((c) => c.label.toUpperCase() === theme.toUpperCase()).length && theme.toUpperCase() !== ((_r = categoryPageName.value) == null ? void 0 : _r.toUpperCase())) {
|
|
147
|
+
callouts.push({ label: theme, type: "attribute", id });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (isLseLoan && callouts.length > 1)
|
|
151
|
+
return [callouts.shift()];
|
|
152
|
+
const customTags = ((_s = customCallouts.value) == null ? void 0 : _s.map((c) => ({ label: c }))) ?? [];
|
|
153
|
+
callouts.push(...customTags);
|
|
154
|
+
return callouts;
|
|
155
|
+
});
|
|
156
|
+
return {
|
|
157
|
+
tag,
|
|
158
|
+
readMorePath,
|
|
159
|
+
isLoading,
|
|
160
|
+
borrowerName,
|
|
161
|
+
countryName,
|
|
162
|
+
countryCode,
|
|
163
|
+
city,
|
|
164
|
+
state,
|
|
165
|
+
distributionModel,
|
|
166
|
+
imageHash,
|
|
167
|
+
hasProgressData,
|
|
168
|
+
allDataLoaded,
|
|
169
|
+
fundraisingPercent,
|
|
170
|
+
unreservedAmount,
|
|
171
|
+
formattedLocation,
|
|
172
|
+
loanUse,
|
|
173
|
+
loanStatus,
|
|
174
|
+
loanAmount,
|
|
175
|
+
loanBorrowerCount,
|
|
176
|
+
mdiMapMarker,
|
|
177
|
+
loanCallouts
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function loanCardMethods(props, emit) {
|
|
181
|
+
const {
|
|
182
|
+
loanId,
|
|
183
|
+
customLoanDetails,
|
|
184
|
+
kvTrackFunction
|
|
185
|
+
} = toRefs(props);
|
|
186
|
+
function clickReadMore(target, event) {
|
|
187
|
+
kvTrackFunction.value("Lending", "click-Read more", target, loanId.value);
|
|
188
|
+
if (customLoanDetails.value) {
|
|
189
|
+
event.preventDefault();
|
|
190
|
+
emit("show-loan-details");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
clickReadMore
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export {
|
|
199
|
+
loanCardComputedProperties,
|
|
200
|
+
loanCardMethods
|
|
201
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// utils/expander.js
|
|
2
|
+
function setInitialStyle(el, { property, delay, easing }) {
|
|
3
|
+
el.style.overflow = "hidden";
|
|
4
|
+
el.style.transition = `${property} ${delay}ms ${easing}`;
|
|
5
|
+
}
|
|
6
|
+
function unsetStyles(el, { property }) {
|
|
7
|
+
el.style[property] = null;
|
|
8
|
+
el.style.overflow = null;
|
|
9
|
+
el.style.transition = null;
|
|
10
|
+
}
|
|
11
|
+
function expand(el, {
|
|
12
|
+
easing = "ease",
|
|
13
|
+
delay = 500,
|
|
14
|
+
done = () => {
|
|
15
|
+
},
|
|
16
|
+
from = 0,
|
|
17
|
+
property = "height"
|
|
18
|
+
}) {
|
|
19
|
+
setInitialStyle(el, { property, delay, easing });
|
|
20
|
+
el.style[property] = "auto";
|
|
21
|
+
el.style.display = null;
|
|
22
|
+
const propValue = window.getComputedStyle(el).getPropertyValue(property);
|
|
23
|
+
el.style[property] = from;
|
|
24
|
+
el.addEventListener("transitionend", function listener() {
|
|
25
|
+
unsetStyles(el, { property });
|
|
26
|
+
done();
|
|
27
|
+
el.removeEventListener("transitionend", listener, true);
|
|
28
|
+
}, true);
|
|
29
|
+
void el.offsetWidth;
|
|
30
|
+
el.style[property] = propValue;
|
|
31
|
+
}
|
|
32
|
+
function collapse(el, {
|
|
33
|
+
easing = "ease",
|
|
34
|
+
delay = 500,
|
|
35
|
+
done = () => {
|
|
36
|
+
},
|
|
37
|
+
to = 0,
|
|
38
|
+
property = "height"
|
|
39
|
+
}) {
|
|
40
|
+
setInitialStyle(el, { property, delay, easing });
|
|
41
|
+
el.style[property] = window.getComputedStyle(el).getPropertyValue(property);
|
|
42
|
+
el.addEventListener("transitionend", function listener() {
|
|
43
|
+
unsetStyles(el, { property });
|
|
44
|
+
done();
|
|
45
|
+
el.removeEventListener("transitionend", listener, true);
|
|
46
|
+
}, true);
|
|
47
|
+
void el.offsetWidth;
|
|
48
|
+
el.style[property] = to;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
expand,
|
|
53
|
+
collapse
|
|
54
|
+
};
|