@kiva/kv-components 3.107.0 → 3.107.2

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.
Files changed (177) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/components/.storybook/main.js +85 -0
  3. package/dist/components/.storybook/package.json +3 -0
  4. package/dist/components/.storybook/preview.js +61 -0
  5. package/dist/components/.storybook/tailwind.css +5 -0
  6. package/dist/components/KvAccordionItem.vue +130 -0
  7. package/dist/components/KvActivityRow.vue +33 -0
  8. package/dist/components/KvBorrowerImage.vue +179 -0
  9. package/dist/components/KvButton.vue +287 -0
  10. package/dist/components/KvCarousel.vue +297 -0
  11. package/dist/components/KvCartModal.vue +365 -0
  12. package/dist/components/KvCheckbox.vue +203 -0
  13. package/dist/components/KvChip.vue +54 -0
  14. package/dist/components/KvClassicLoanCard.vue +527 -0
  15. package/dist/components/KvCommentsAdd.vue +135 -0
  16. package/dist/components/KvCommentsContainer.vue +84 -0
  17. package/dist/components/KvCommentsHeartButton.vue +70 -0
  18. package/dist/components/KvCommentsList.vue +68 -0
  19. package/dist/components/KvCommentsListItem.vue +241 -0
  20. package/dist/components/KvCommentsReplyButton.vue +52 -0
  21. package/dist/components/KvContentfulImg.vue +273 -0
  22. package/dist/components/KvCountdownTimer.vue +59 -0
  23. package/dist/components/KvExpandable.vue +84 -0
  24. package/dist/components/KvExpandableQuestion.vue +120 -0
  25. package/dist/components/KvFlag.vue +120 -0
  26. package/dist/components/KvGrid.vue +28 -0
  27. package/dist/components/KvImpactDashboardHeader.vue +40 -0
  28. package/dist/components/KvInlineActivityCard.vue +55 -0
  29. package/dist/components/KvInlineActivityFeed.vue +38 -0
  30. package/dist/components/KvIntroductionLoanCard.vue +446 -0
  31. package/dist/components/KvLendAmountButton.vue +65 -0
  32. package/dist/components/KvLendCta.vue +451 -0
  33. package/dist/components/KvLightbox.vue +334 -0
  34. package/dist/components/KvLineGraph.vue +128 -0
  35. package/dist/components/KvLoadingPlaceholder.vue +38 -0
  36. package/dist/components/KvLoadingSpinner.vue +81 -0
  37. package/dist/components/KvLoanActivities.vue +268 -0
  38. package/dist/components/KvLoanBookmark.vue +39 -0
  39. package/dist/components/KvLoanCallouts.vue +53 -0
  40. package/dist/components/KvLoanProgressGroup.vue +76 -0
  41. package/dist/components/KvLoanTag.vue +88 -0
  42. package/dist/components/KvLoanTeamPick.vue +44 -0
  43. package/dist/components/KvLoanUse.vue +92 -0
  44. package/dist/components/KvMap.vue +599 -0
  45. package/dist/components/KvMaterialIcon.vue +47 -0
  46. package/dist/components/KvPageContainer.vue +15 -0
  47. package/dist/components/KvPagination.vue +198 -0
  48. package/dist/components/KvPieChart.vue +257 -0
  49. package/dist/components/KvPopper.vue +178 -0
  50. package/dist/components/KvProgressBar.vue +149 -0
  51. package/dist/components/KvRadio.vue +198 -0
  52. package/dist/components/KvSelect.vue +114 -0
  53. package/dist/components/KvSideSheet.vue +134 -0
  54. package/dist/components/KvSwitch.vue +143 -0
  55. package/dist/components/KvTab.vue +90 -0
  56. package/dist/components/KvTabPanel.vue +64 -0
  57. package/dist/components/KvTabs.vue +182 -0
  58. package/dist/components/KvTextInput.vue +247 -0
  59. package/dist/components/KvTextLink.vue +138 -0
  60. package/dist/components/KvThemeProvider.vue +122 -0
  61. package/dist/components/KvToast.vue +221 -0
  62. package/dist/components/KvTooltip.vue +168 -0
  63. package/dist/components/KvTreeMapChart.vue +229 -0
  64. package/dist/components/KvUserAvatar.vue +132 -0
  65. package/dist/components/KvVerticalCarousel.vue +156 -0
  66. package/dist/components/KvVotingCard.vue +160 -0
  67. package/dist/components/KvVotingCardV2.vue +154 -0
  68. package/dist/components/KvWideLoanCard.vue +432 -0
  69. package/dist/components/stories/Forms.stories.js +62 -0
  70. package/dist/components/stories/KvAccordionItem.stories.js +24 -0
  71. package/dist/components/stories/KvActivityRow.stories.js +25 -0
  72. package/dist/components/stories/KvBorrowerImage.stories.js +68 -0
  73. package/dist/components/stories/KvButton.stories.js +144 -0
  74. package/dist/components/stories/KvCarousel.stories.js +426 -0
  75. package/dist/components/stories/KvCartModal.stories.js +54 -0
  76. package/dist/components/stories/KvCheckbox.stories.js +163 -0
  77. package/dist/components/stories/KvChip.stories.js +43 -0
  78. package/dist/components/stories/KvClassicLoanCard.stories.js +480 -0
  79. package/dist/components/stories/KvCommentsAdd.stories.js +32 -0
  80. package/dist/components/stories/KvCommentsContainer.stories.js +42 -0
  81. package/dist/components/stories/KvCommentsHeartButton.stories.js +25 -0
  82. package/dist/components/stories/KvCommentsList.stories.js +39 -0
  83. package/dist/components/stories/KvCommentsListItem.stories.js +45 -0
  84. package/dist/components/stories/KvCommentsReplyButton.stories.js +21 -0
  85. package/dist/components/stories/KvContentfulImg.stories.js +196 -0
  86. package/dist/components/stories/KvCountdownTimer.stories.js +30 -0
  87. package/dist/components/stories/KvExpandableQuestion.stories.js +129 -0
  88. package/dist/components/stories/KvFlag.stories.js +36 -0
  89. package/dist/components/stories/KvGrid.stories.js +97 -0
  90. package/dist/components/stories/KvImpactDashboardHeader.stories.js +22 -0
  91. package/dist/components/stories/KvInlineActivityCard.stories.js +69 -0
  92. package/dist/components/stories/KvInlineActivityFeed.stories.js +76 -0
  93. package/dist/components/stories/KvIntroductionLoanCard.stories.js +208 -0
  94. package/dist/components/stories/KvLendAmountButton.stories.js +31 -0
  95. package/dist/components/stories/KvLendCta.stories.js +177 -0
  96. package/dist/components/stories/KvLightbox.stories.js +304 -0
  97. package/dist/components/stories/KvLineGraph.stories.js +52 -0
  98. package/dist/components/stories/KvLoadingPlaceholder.stories.js +17 -0
  99. package/dist/components/stories/KvLoadingSpinner.stories.js +52 -0
  100. package/dist/components/stories/KvLoanActivities.stories.js +104 -0
  101. package/dist/components/stories/KvLoanBookmark.stories.js +22 -0
  102. package/dist/components/stories/KvLoanCallouts.stories.js +22 -0
  103. package/dist/components/stories/KvLoanProgressGroup.stories.js +29 -0
  104. package/dist/components/stories/KvLoanTag.stories.js +61 -0
  105. package/dist/components/stories/KvLoanTeamPick.stories.js +20 -0
  106. package/dist/components/stories/KvLoanUse.stories.js +60 -0
  107. package/dist/components/stories/KvMap.stories.js +121 -0
  108. package/dist/components/stories/KvMaterialIcon.stories.js +201 -0
  109. package/dist/components/stories/KvPageContainer.stories.js +50 -0
  110. package/dist/components/stories/KvPagination.stories.js +70 -0
  111. package/dist/components/stories/KvPieChart.stories.js +47 -0
  112. package/dist/components/stories/KvProgressBar.stories.js +53 -0
  113. package/dist/components/stories/KvRadio.stories.js +140 -0
  114. package/dist/components/stories/KvSelect.stories.js +125 -0
  115. package/dist/components/stories/KvSideSheet.stories.js +50 -0
  116. package/dist/components/stories/KvSwitch.stories.js +66 -0
  117. package/dist/components/stories/KvTabs.stories.js +106 -0
  118. package/dist/components/stories/KvTextInput.stories.js +194 -0
  119. package/dist/components/stories/KvTextLink.stories.js +55 -0
  120. package/dist/components/stories/KvThemeProvider.stories.js +178 -0
  121. package/dist/components/stories/KvToast.stories.js +117 -0
  122. package/dist/components/stories/KvTooltip.stories.js +26 -0
  123. package/dist/components/stories/KvTreeMapChart.stories.js +42 -0
  124. package/dist/components/stories/KvUserAvatar.stories.js +47 -0
  125. package/dist/components/stories/KvVerticalCarousel.stories.js +168 -0
  126. package/dist/components/stories/KvVotingCard.stories.js +33 -0
  127. package/dist/components/stories/KvVotingCardV2.stories.js +89 -0
  128. package/dist/components/stories/KvWideLoanCard.stories.js +292 -0
  129. package/dist/components/stories/StyleguidePrimitives.stories.js +499 -0
  130. package/dist/components/stories/StyleguideProse.stories.js +215 -0
  131. package/dist/data/countries-borders.json +1 -0
  132. package/dist/data/ne_110m_admin_0_countries.json +1 -0
  133. package/dist/utils/Alea.js +9 -0
  134. package/dist/utils/attrs.js +7 -0
  135. package/dist/utils/carousels.js +8 -0
  136. package/dist/{attrs.js → utils/chunk-3HK4G4NT.js} +1 -0
  137. package/dist/{loanCard.js → utils/chunk-55HF2ORX.js} +1 -0
  138. package/dist/{expander.js → utils/chunk-AY3PR5S4.js} +3 -2
  139. package/dist/{carousels.js → utils/chunk-AZPWOFD5.js} +1 -0
  140. package/dist/{printing.js → utils/chunk-B5J5WLAH.js} +1 -0
  141. package/dist/{Alea.js → utils/chunk-GPSH6OPA.js} +2 -1
  142. package/dist/{scrollLock.js → utils/chunk-HIY5IW65.js} +2 -1
  143. package/dist/{treemap.js → utils/chunk-MSMZIN54.js} +1 -0
  144. package/dist/{imageUtils.js → utils/chunk-OXJCCNNW.js} +1 -0
  145. package/dist/{touchEvents.js → utils/chunk-S3MABILA.js} +3 -2
  146. package/dist/{mapUtils.js → utils/chunk-VIGEMAKO.js} +5 -4
  147. package/dist/utils/chunk-YCNMJ4YV.js +37 -0
  148. package/dist/{loanUtils.js → utils/chunk-YFEC5ODJ.js} +7 -6
  149. package/dist/utils/expander.js +9 -0
  150. package/dist/utils/imageUtils.js +9 -0
  151. package/dist/utils/index.cjs +1118 -0
  152. package/dist/utils/index.js +166 -0
  153. package/dist/utils/loanCard.js +9 -0
  154. package/dist/utils/loanUtils.js +23 -0
  155. package/dist/utils/mapUtils.js +15 -0
  156. package/dist/utils/printing.js +9 -0
  157. package/dist/utils/scrollLock.js +13 -0
  158. package/dist/{throttle.js → utils/throttle.js} +1 -0
  159. package/dist/utils/touchEvents.js +11 -0
  160. package/dist/utils/treemap.js +7 -0
  161. package/package.json +11 -7
  162. package/utils/index.js +14 -0
  163. package/index.js +0 -3
  164. /package/dist/{Alea.cjs → utils/Alea.cjs} +0 -0
  165. /package/dist/{attrs.cjs → utils/attrs.cjs} +0 -0
  166. /package/dist/{carousels.cjs → utils/carousels.cjs} +0 -0
  167. /package/dist/{chunk-HV3AUBFT.js → utils/chunk-HV3AUBFT.js} +0 -0
  168. /package/dist/{expander.cjs → utils/expander.cjs} +0 -0
  169. /package/dist/{imageUtils.cjs → utils/imageUtils.cjs} +0 -0
  170. /package/dist/{loanCard.cjs → utils/loanCard.cjs} +0 -0
  171. /package/dist/{loanUtils.cjs → utils/loanUtils.cjs} +0 -0
  172. /package/dist/{mapUtils.cjs → utils/mapUtils.cjs} +0 -0
  173. /package/dist/{printing.cjs → utils/printing.cjs} +0 -0
  174. /package/dist/{scrollLock.cjs → utils/scrollLock.cjs} +0 -0
  175. /package/dist/{throttle.cjs → utils/throttle.cjs} +0 -0
  176. /package/dist/{touchEvents.cjs → utils/touchEvents.cjs} +0 -0
  177. /package/dist/{treemap.cjs → utils/treemap.cjs} +0 -0
@@ -0,0 +1,154 @@
1
+ <template>
2
+ <div
3
+ class="vote_card tw-flex tw-flex-col tw-justify-end"
4
+ :style="cssProps"
5
+ >
6
+ <div
7
+ class="tw-flex-grow-0 tw-text-white"
8
+ >
9
+ <h2 class="tw-italic tw-pb-1">
10
+ {{ title }}
11
+ </h2>
12
+ <p class="tw-pb-1.5">
13
+ {{ truncatedDescription }}
14
+ <a
15
+ v-if="isTruncated"
16
+ class="tw-underline tw-pl-1 tw-text-white tw-cursor-pointer"
17
+ @click="isLightboxOpen = true"
18
+ >read more</a>
19
+ </p>
20
+ <div class="tw-block md:tw-flex tw-justify-between">
21
+ <div
22
+ v-if="showPercentage"
23
+ class="tw-flex tw-items-center tw-w-full tw-max-w-16"
24
+ >
25
+ <kv-progress-bar
26
+ class="tw-flex-grow"
27
+ :aria-label="'Percent of votes for ' + description"
28
+ :value="percentage"
29
+ />
30
+ <div class="tw-ml-2">
31
+ {{ percentage }}%
32
+ </div>
33
+ </div>
34
+ <kv-button
35
+ v-if="showVoteButton"
36
+ variant="secondary"
37
+ class="tw-flex-grow-0 tw-min-w-16 tw-mt-2"
38
+ @click="castVote"
39
+ >
40
+ Vote
41
+ </kv-button>
42
+ </div>
43
+ </div>
44
+ <KvLightbox
45
+ :title="title"
46
+ :visible="isLightboxOpen"
47
+ @lightbox-closed="isLightboxOpen = false"
48
+ >
49
+ <template #header>
50
+ <h3>
51
+ {{ title }}
52
+ </h3>
53
+ </template>
54
+ <p class="tw-pb-1.5">
55
+ {{ description }}
56
+ </p>
57
+ </KvLightbox>
58
+ </div>
59
+ </template>
60
+
61
+ <script>
62
+ import {
63
+ computed,
64
+ ref,
65
+ toRefs,
66
+ } from 'vue-demi';
67
+ import KvProgressBar from './KvProgressBar.vue';
68
+ import KvButton from './KvButton.vue';
69
+ import KvLightbox from './KvLightbox.vue';
70
+
71
+ export default {
72
+ name: 'KvVotingCard',
73
+ components: {
74
+ KvButton,
75
+ KvLightbox,
76
+ KvProgressBar,
77
+ },
78
+ props: {
79
+ title: {
80
+ type: String,
81
+ default: '',
82
+ },
83
+ description: {
84
+ type: String,
85
+ default: '',
86
+ },
87
+ backgroundImageUrl: {
88
+ type: String,
89
+ default: '',
90
+ },
91
+ percentage: {
92
+ type: Number,
93
+ default: 0,
94
+ },
95
+ showVoteButton: {
96
+ type: Boolean,
97
+ default: true,
98
+ },
99
+ showPercentage: {
100
+ type: Boolean,
101
+ default: true,
102
+ },
103
+ },
104
+ emits: [
105
+ 'vote',
106
+ ],
107
+ setup(props, { emit }) {
108
+ const isLightboxOpen = ref(false);
109
+
110
+ const TRUNCATION_LIMIT = 110;
111
+
112
+ const {
113
+ backgroundImageUrl,
114
+ description,
115
+ } = toRefs(props);
116
+
117
+ const cssProps = computed(() => {
118
+ return {
119
+ '--background-image-voting-card': `url(${backgroundImageUrl.value})`,
120
+ };
121
+ });
122
+
123
+ const isTruncated = computed(() => {
124
+ return description?.value && (description?.value.length > TRUNCATION_LIMIT);
125
+ });
126
+
127
+ const truncatedDescription = computed(() => {
128
+ if (isTruncated.value) {
129
+ return `${description.value.substring(0, TRUNCATION_LIMIT)}...`;
130
+ }
131
+ return description.value;
132
+ });
133
+ return {
134
+ cssProps,
135
+ castVote() {
136
+ emit('vote');
137
+ },
138
+ isLightboxOpen,
139
+ isTruncated,
140
+ truncatedDescription,
141
+ };
142
+ },
143
+ };
144
+ </script>
145
+
146
+ <style lang="postcss">
147
+ .vote_card {
148
+ background-image:
149
+ linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 1) 100%),
150
+ var(--background-image-voting-card);
151
+ background-size: cover;
152
+ @apply tw-rounded tw-px-4 tw-pb-4;
153
+ }
154
+ </style>
@@ -0,0 +1,432 @@
1
+ <template>
2
+ <div
3
+ class="
4
+ tw-flex
5
+ tw-flex-row
6
+ tw-flex-wrap
7
+ tw-bg-white
8
+ tw-rounded
9
+ tw-w-full
10
+ tw-pb-1
11
+ tw-p-1
12
+ tw-gap-1
13
+ tw-items-center
14
+ "
15
+ :class="{'tw-pointer-events-none' : isLoading }"
16
+ data-testid="loan-card"
17
+ style="box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);"
18
+ >
19
+ <div
20
+ class="loan-card-active-hover tw-flex-1 tw-min-w-[275px] md:tw-min-w-[320px] md:tw-max-w-[320px]"
21
+ >
22
+ <!-- Borrower image -->
23
+ <kv-loading-placeholder
24
+ v-if="isLoading"
25
+ class="tw-mb-1 tw-w-full tw-rounded"
26
+ :style="{ height: '15rem' }"
27
+ />
28
+ <div
29
+ v-else
30
+ class="tw-relative tw-w-full"
31
+ >
32
+ <component
33
+ :is="tag"
34
+ :to="readMorePath"
35
+ :href="readMorePath"
36
+ class="tw-flex"
37
+ aria-label="Borrower image"
38
+ @click.native="clickReadMore('Photo', $event)"
39
+ >
40
+ <kv-borrower-image
41
+ class="
42
+ tw-relative
43
+ tw-w-full
44
+ tw-bg-black
45
+ tw-rounded
46
+ "
47
+ :alt="`Photo of ${borrowerName}`"
48
+ :aspect-ratio="imageAspectRatio"
49
+ :default-image="{ width: imageDefaultWidth }"
50
+ :hash="imageHash"
51
+ :images="imageSizes"
52
+ :photo-path="photoPath"
53
+ />
54
+
55
+ <div v-if="countryName">
56
+ <p
57
+ class="
58
+ tw-absolute
59
+ tw-bottom-1
60
+ tw-left-1
61
+ tw-text-primary
62
+ tw-bg-white
63
+ tw-rounded
64
+ tw-p-1
65
+ tw-mb-0
66
+ tw-mr-2
67
+ tw-text-h4
68
+ tw-inline-flex
69
+ tw-items-center"
70
+ style="padding: 2px 6px; text-transform: capitalize;"
71
+ >
72
+ <kv-material-icon
73
+ class="tw-h-2 tw-w-2"
74
+ :icon="mdiMapMarker"
75
+ />
76
+ {{ formattedLocation }}
77
+ </p>
78
+ </div>
79
+ </component>
80
+ <kv-loan-bookmark
81
+ v-if="!isVisitor"
82
+ :loan-id="loanId"
83
+ :is-bookmarked="isBookmarked"
84
+ class="tw-absolute tw-right-1"
85
+ style="top: -6px;"
86
+ data-testid="loan-card-bookmark"
87
+ @toggle-bookmark="$emit('toggle-bookmark')"
88
+ />
89
+ </div>
90
+ </div>
91
+
92
+ <div
93
+ class="tw-flex tw-flex-col tw-flex-1 tw-px-1"
94
+ >
95
+ <h3 class="tw-hidden md:tw-inline-block">
96
+ {{ borrowerName }}
97
+ </h3>
98
+ <!-- Loan tag -->
99
+ <component
100
+ :is="tag"
101
+ :to="readMorePath"
102
+ :href="readMorePath"
103
+ class="tw-flex hover:tw-no-underline focus:tw-no-underline"
104
+ aria-label="Loan tag"
105
+ @click.native="clickReadMore('Tag', $event)"
106
+ >
107
+ <kv-loan-tag
108
+ v-if="showTags && !isLoading"
109
+ :loan="loan"
110
+ />
111
+ </component>
112
+
113
+ <component
114
+ :is="tag"
115
+ :to="readMorePath"
116
+ :href="readMorePath"
117
+ class="loan-card-use tw-text-primary"
118
+ aria-label="Loan use"
119
+ @click="clickReadMore('Use')"
120
+ >
121
+ <!-- Loan use -->
122
+ <div class="tw-pt-1">
123
+ <div
124
+ v-if="isLoading"
125
+ class="tw-w-full"
126
+ style="height: 5.5rem;"
127
+ >
128
+ <div
129
+ v-for="(_n, i) in [...Array(4)]"
130
+ :key="i"
131
+ class="tw-h-2 tw-mb-1"
132
+ >
133
+ <kv-loading-placeholder />
134
+ </div>
135
+ </div>
136
+ <div v-else>
137
+ <kv-loan-use
138
+ :use="loanUse"
139
+ :loan-amount="loanAmount"
140
+ :status="loanStatus"
141
+ :borrower-count="loanBorrowerCount"
142
+ :name="borrowerName"
143
+ :distribution-model="distributionModel"
144
+ />
145
+ </div>
146
+ </div>
147
+ </component>
148
+ <!-- Loan call outs -->
149
+ <kv-loading-placeholder
150
+ v-if="isLoading || typeof loanCallouts === 'undefined'"
151
+ class="tw-mt-1.5 tw-mb-1"
152
+ :style="{ width: '60%', height: '1.75rem', 'border-radius': '500rem' }"
153
+ />
154
+
155
+ <kv-loan-callouts
156
+ v-else
157
+ :callouts="loanCallouts"
158
+ class="loan-callouts tw-my-1.5"
159
+ />
160
+
161
+ <div class="tw-flex tw-flex-row tw-justify-between tw-gap-1 md:tw-gap-3 ">
162
+ <!-- Fundraising -->
163
+ <div
164
+ v-if="!hasProgressData"
165
+ class="tw-w-full tw-pt-1 tw-pr-1"
166
+ >
167
+ <kv-loading-placeholder
168
+ class="tw-mb-0.5"
169
+ :style="{ width: '70%', height: '1.3rem' }"
170
+ />
171
+
172
+ <kv-loading-placeholder
173
+ class="tw-rounded"
174
+ :style="{ width: '70%', height: '0.5rem' }"
175
+ />
176
+ </div>
177
+ <component
178
+ :is="tag"
179
+ v-if="unreservedAmount > 0"
180
+ :to="readMorePath"
181
+ :href="readMorePath"
182
+ class="loan-card-progress tw-mt-1 tw-flex-grow"
183
+ aria-label="Loan progress"
184
+ @click.native="clickReadMore('Progress', $event)"
185
+ >
186
+ <kv-loan-progress-group
187
+ id="loanProgress"
188
+ :money-left="`${unreservedAmount}`"
189
+ :progress-percent="fundraisingPercent"
190
+ class="tw-text-black"
191
+ />
192
+ </component>
193
+
194
+ <!-- CTA Button -->
195
+ <kv-loading-placeholder
196
+ v-if="!allDataLoaded"
197
+ class="tw-rounded tw-self-start"
198
+ :style="{ width: '9rem', height: '3rem' }"
199
+ />
200
+
201
+ <kv-lend-cta
202
+ v-else
203
+ :loan="loan"
204
+ :basket-items="basketItems"
205
+ :is-loading="isLoading"
206
+ :is-adding="isAdding"
207
+ :enable-five-dollars-notes="enableFiveDollarsNotes"
208
+ :five-dollars-selected="fiveDollarsSelected"
209
+ :kv-track-function="kvTrackFunction"
210
+ :show-view-loan="showViewLoan"
211
+ :custom-loan-details="customLoanDetails"
212
+ :external-links="externalLinks"
213
+ :route="route"
214
+ :user-balance="userBalance"
215
+ :get-cookie="getCookie"
216
+ :set-cookie="setCookie"
217
+ :enable-huge-amount="enableHugeAmount"
218
+ :is-visitor="isVisitor"
219
+ class="tw-mt-auto tw-self-end"
220
+ :class="{'tw-flex-grow' : unreservedAmount === 0, 'tw-flex-shrink-0' : unreservedAmount > 0}"
221
+ @add-to-basket="$emit('add-to-basket', $event)"
222
+ @show-loan-details="clickReadMore('ViewLoan', $event)"
223
+ />
224
+ </div>
225
+ </div>
226
+ </div>
227
+ </template>
228
+
229
+ <script>
230
+ import { loanCardComputedProperties, loanCardMethods } from '../utils/loanCard';
231
+ import KvLoanUse from './KvLoanUse.vue';
232
+ import KvBorrowerImage from './KvBorrowerImage.vue';
233
+ import KvLoanProgressGroup from './KvLoanProgressGroup.vue';
234
+ import KvLoanCallouts from './KvLoanCallouts.vue';
235
+ import KvLendCta from './KvLendCta.vue';
236
+ import KvLoanBookmark from './KvLoanBookmark.vue';
237
+ import KvLoanTag from './KvLoanTag.vue';
238
+ import KvMaterialIcon from './KvMaterialIcon.vue';
239
+ import KvLoadingPlaceholder from './KvLoadingPlaceholder.vue';
240
+
241
+ export default {
242
+ name: 'KvWideLoanCard',
243
+ components: {
244
+ KvBorrowerImage,
245
+ KvLoadingPlaceholder,
246
+ KvLoanUse,
247
+ KvLoanProgressGroup,
248
+ KvMaterialIcon,
249
+ KvLendCta,
250
+ KvLoanTag,
251
+ KvLoanCallouts,
252
+ KvLoanBookmark,
253
+ },
254
+ props: {
255
+ loanId: {
256
+ type: Number,
257
+ default: undefined,
258
+ },
259
+ loan: {
260
+ type: Object,
261
+ default: null,
262
+ },
263
+ customLoanDetails: {
264
+ type: Boolean,
265
+ default: false,
266
+ },
267
+ showTags: {
268
+ type: Boolean,
269
+ default: false,
270
+ },
271
+ categoryPageName: {
272
+ type: String,
273
+ default: '',
274
+ },
275
+ enableFiveDollarsNotes: {
276
+ type: Boolean,
277
+ default: false,
278
+ },
279
+ isAdding: {
280
+ type: Boolean,
281
+ default: false,
282
+ },
283
+ isVisitor: {
284
+ type: Boolean,
285
+ default: true,
286
+ },
287
+ basketItems: {
288
+ type: Array,
289
+ default: () => ([]),
290
+ },
291
+ isBookmarked: {
292
+ type: Boolean,
293
+ default: false,
294
+ },
295
+ kvTrackFunction: {
296
+ type: Function,
297
+ required: true,
298
+ },
299
+ photoPath: {
300
+ type: String,
301
+ required: true,
302
+ },
303
+ showViewLoan: {
304
+ type: Boolean,
305
+ default: false,
306
+ },
307
+ externalLinks: {
308
+ type: Boolean,
309
+ default: false,
310
+ },
311
+ route: {
312
+ type: Object,
313
+ default: undefined,
314
+ },
315
+ userBalance: {
316
+ type: String,
317
+ default: undefined,
318
+ },
319
+ getCookie: {
320
+ type: Function,
321
+ default: undefined,
322
+ },
323
+ setCookie: {
324
+ type: Function,
325
+ default: undefined,
326
+ },
327
+ fiveDollarsSelected: {
328
+ type: Boolean,
329
+ default: false,
330
+ },
331
+ customCallouts: {
332
+ type: Array,
333
+ default: () => ([]),
334
+ },
335
+ enableHugeAmount: {
336
+ type: Boolean,
337
+ default: false,
338
+ },
339
+ },
340
+ setup(props, { emit }) {
341
+ const {
342
+ allDataLoaded,
343
+ borrowerName,
344
+ city,
345
+ countryName,
346
+ distributionModel,
347
+ formattedLocation,
348
+ fundraisingPercent,
349
+ hasProgressData,
350
+ imageHash,
351
+ isLoading,
352
+ loanAmount,
353
+ loanBorrowerCount,
354
+ loanCallouts,
355
+ loanStatus,
356
+ loanUse,
357
+ mdiMapMarker,
358
+ readMorePath,
359
+ state,
360
+ tag,
361
+ unreservedAmount,
362
+ } = loanCardComputedProperties(props);
363
+
364
+ const {
365
+ clickReadMore,
366
+ } = loanCardMethods(props, emit);
367
+
368
+ return {
369
+ allDataLoaded,
370
+ borrowerName,
371
+ city,
372
+ countryName,
373
+ distributionModel,
374
+ formattedLocation,
375
+ fundraisingPercent,
376
+ hasProgressData,
377
+ imageHash,
378
+ isLoading,
379
+ loanAmount,
380
+ loanBorrowerCount,
381
+ loanCallouts,
382
+ loanStatus,
383
+ loanUse,
384
+ mdiMapMarker,
385
+ readMorePath,
386
+ state,
387
+ tag,
388
+ unreservedAmount,
389
+ clickReadMore,
390
+ };
391
+ },
392
+ computed: {
393
+ cardWidth() {
394
+ return '374px';
395
+ },
396
+ imageAspectRatio() {
397
+ return 1;
398
+ },
399
+ imageDefaultWidth() {
400
+ return 320;
401
+ },
402
+ imageSizes() {
403
+ return [
404
+ { width: this.imageDefaultWidth, viewSize: 1024 },
405
+ { width: this.imageDefaultWidth, viewSize: 768 },
406
+ { width: 416, viewSize: 480 },
407
+ { width: 374, viewSize: 414 },
408
+ { width: 335, viewSize: 375 },
409
+ ];
410
+ },
411
+ },
412
+ };
413
+ </script>
414
+
415
+ <style lang="postcss" scoped>
416
+ /** Shared with KvClassicLoanCard */
417
+ .loan-card-use:hover,
418
+ .loan-card-use:focus {
419
+ @apply tw-text-primary;
420
+ }
421
+ .loan-card-active-hover:hover .loan-card-use {
422
+ @apply tw-underline;
423
+ }
424
+ .loan-card-progress:hover,
425
+ .loan-card-progress:focus {
426
+ @apply tw-no-underline;
427
+ }
428
+ /** Unique to this loan card */
429
+ .loan-callouts >>> div{
430
+ @apply tw-flex-wrap tw-h-auto;
431
+ }
432
+ </style>
@@ -0,0 +1,62 @@
1
+ import KvCheckbox from '../KvCheckbox.vue';
2
+ import KvRadio from '../KvRadio.vue';
3
+ import KvSelect from '../KvSelect.vue';
4
+ import KvSwitch from '../KvSwitch.vue';
5
+ import KvTextInput from '../KvTextInput.vue';
6
+
7
+ import { Multiple as CheckboxDefault } from './KvCheckbox.stories';
8
+ import { Default as RadioDefault } from './KvRadio.stories';
9
+ import { Default as SelectDefault } from './KvSelect.stories';
10
+ import { Default as SwitchDefault } from './KvSwitch.stories';
11
+ import { Default as TextInputDefault } from './KvTextInput.stories';
12
+
13
+ export default {
14
+ title: 'Forms',
15
+ args: {
16
+ checked: false,
17
+ disabled: false,
18
+ placeholder: '',
19
+ valid: true,
20
+ icon: null,
21
+ type: 'text',
22
+ canClear: false,
23
+ value: '',
24
+ },
25
+ };
26
+
27
+ const Template = (args, {
28
+ argTypes,
29
+ }) => ({
30
+ props: Object.keys(argTypes),
31
+ components: {
32
+ KvCheckbox,
33
+ KvRadio,
34
+ KvSelect,
35
+ KvSwitch,
36
+ KvTextInput,
37
+ },
38
+ data: () => ({
39
+ ...CheckboxDefault(args, { argTypes }).data(),
40
+ ...RadioDefault(args, { argTypes }).data(),
41
+ ...SwitchDefault(args, { argTypes }).data(),
42
+ ...SelectDefault(args, { argTypes }).data(),
43
+ ...TextInputDefault(args, { argTypes }).data(),
44
+ }),
45
+ methods: {
46
+ ...CheckboxDefault(args, { argTypes }).methods,
47
+ ...RadioDefault(args, { argTypes }).methods,
48
+ ...SwitchDefault(args, { argTypes }).methods,
49
+ ...SelectDefault(args, { argTypes }).methods,
50
+ ...TextInputDefault(args, { argTypes }).methods,
51
+ },
52
+ template: `
53
+ <div>
54
+ ${CheckboxDefault(args, { argTypes }).template}<br /><br />
55
+ ${RadioDefault(args, { argTypes }).template}<br /><br />
56
+ ${SwitchDefault(args, { argTypes }).template}<br /><br />
57
+ ${SelectDefault(args, { argTypes }).template}<br /><br />
58
+ ${TextInputDefault(args, { argTypes }).template}<br /><br />
59
+ </div>`,
60
+ });
61
+
62
+ export const KitchenSink = Template.bind({});
@@ -0,0 +1,24 @@
1
+ import KvAccordionItem from '../KvAccordionItem.vue';
2
+
3
+ export default {
4
+ title: 'KvAccordionItem',
5
+ component: KvAccordionItem,
6
+ };
7
+
8
+ const DefaultTemplate = () => ({
9
+ components: { KvAccordionItem },
10
+ template: `
11
+ <div style="padding: 20px;">
12
+ <kv-accordion-item id="accordian-test">
13
+ <template #header>
14
+ <h2>Accordion</h2>
15
+ </template>
16
+ <p>
17
+ "Hello, KvAccordion Contents!"
18
+ </p>
19
+ </kv-accordion-item>
20
+ </div>
21
+ `,
22
+ });
23
+
24
+ export const Default = DefaultTemplate.bind({});
@@ -0,0 +1,25 @@
1
+ import KvActivityRow from '../KvActivityRow.vue';
2
+
3
+ export default {
4
+ title: 'KvActivityRow',
5
+ component: KvActivityRow,
6
+ };
7
+
8
+ const activity = {
9
+ lenderName: 'Stephanie',
10
+ lenderImage: 'https://www.development.kiva.org/img/s100/26e15431f51b540f31cd9f011cc54f31.jpg',
11
+ text: 'Stephanie lent $25',
12
+ };
13
+
14
+ const story = (args) => {
15
+ const template = (_args, { argTypes }) => ({
16
+ props: Object.keys(argTypes),
17
+ components: { KvActivityRow },
18
+ template: `<KvActivityRow
19
+ :activity="activity" />`,
20
+ });
21
+ template.args = args;
22
+ return template;
23
+ };
24
+
25
+ export const Default = story({ activity });