@kiva/kv-components 3.107.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.
Files changed (177) hide show
  1. package/CHANGELOG.md +11 -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 +7 -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,69 @@
1
+ import KvInlineActivityCard from '../KvInlineActivityCard.vue';
2
+
3
+ export default {
4
+ title: 'KvInlineActivityCard',
5
+ component: KvInlineActivityCard,
6
+ };
7
+
8
+ const story = (args) => {
9
+ const template = (templateArgs, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ components: { KvInlineActivityCard },
12
+ setup() { return { args: templateArgs }; },
13
+ template: `
14
+ <div style="max-width: 200px;">
15
+ <KvInlineActivityCard v-bind="args" />
16
+ </div>
17
+ `,
18
+ });
19
+ template.args = args;
20
+ return template;
21
+ };
22
+
23
+ export const Default = story({
24
+ activity: {
25
+ lender: {
26
+ image: {
27
+ url: 'https://www.development.kiva.org/img/s100/26e15431f51b540f31cd9f011cc54f31.jpg',
28
+ },
29
+ name: 'Roger',
30
+ },
31
+ amountLent: '125.00',
32
+ },
33
+ });
34
+
35
+ export const NoImage = story({
36
+ activity: {
37
+ lender: {
38
+ image: {
39
+ url: '',
40
+ },
41
+ name: 'Roger',
42
+ },
43
+ amountLent: '75.00',
44
+ },
45
+ });
46
+
47
+ export const Anonymous = story({
48
+ activity: {
49
+ lender: {
50
+ image: {
51
+ url: 'https://www.development.kiva.org/img/s100/26e15431f51b540f31cd9f011cc54f31.jpg',
52
+ },
53
+ name: 'Anonymous',
54
+ },
55
+ amountLent: '5.00',
56
+ },
57
+ });
58
+
59
+ export const DefaultProfile = story({
60
+ activity: {
61
+ lender: {
62
+ image: {
63
+ url: 'https://www.development.kiva.org/img/s100/4d844ac2c0b77a8a522741b908ea5c32.jpg',
64
+ },
65
+ name: 'Default Profile',
66
+ },
67
+ amountLent: '25.00',
68
+ },
69
+ });
@@ -0,0 +1,76 @@
1
+ import KvInlineActivityFeed from '../KvInlineActivityFeed.vue';
2
+
3
+ const activities = [
4
+ {
5
+ lender: {
6
+ id: 723174,
7
+ name: 'TonyB',
8
+ image: {
9
+ url: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg',
10
+ },
11
+ },
12
+ amountLent: '25.00',
13
+ },
14
+ {
15
+ lender: {
16
+ id: 723174,
17
+ name: 'Roger',
18
+ image: {
19
+ url: '',
20
+ },
21
+ },
22
+ amountLent: '25.00',
23
+ },
24
+ {
25
+ lender: {
26
+ id: 723174,
27
+ name: 'Anonymous',
28
+ image: {
29
+ url: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg',
30
+ },
31
+ },
32
+ amountLent: '25.00',
33
+ },
34
+ {
35
+ lender: {
36
+ id: 723174,
37
+ name: 'Default user',
38
+ image: {
39
+ url: 'https://www-0.development.kiva.org/img/s100/4d844ac2c0b77a8a522741b908ea5c32.jpg',
40
+ },
41
+ },
42
+ amountLent: '25.00',
43
+ },
44
+ {
45
+ lender: {
46
+ id: 723174,
47
+ name: 'Jessica',
48
+ image: {
49
+ url: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg',
50
+ },
51
+ },
52
+ amountLent: '25.00',
53
+ },
54
+ ];
55
+
56
+ export default {
57
+ title: 'KvInlineActivityFeed',
58
+ component: KvInlineActivityFeed,
59
+ };
60
+
61
+ const story = (args) => {
62
+ const template = (templateArgs, { argTypes }) => ({
63
+ props: Object.keys(argTypes),
64
+ components: { KvInlineActivityFeed },
65
+ setup() { return { args: templateArgs }; },
66
+ template: `
67
+ <div style="max-width: 1200px;">
68
+ <KvInlineActivityFeed v-bind="args" />
69
+ </div>
70
+ `,
71
+ });
72
+ template.args = args;
73
+ return template;
74
+ };
75
+
76
+ export const Default = story({ activities });
@@ -0,0 +1,208 @@
1
+ import KvIntroductionLoanCard from '../KvIntroductionLoanCard.vue';
2
+
3
+ export default {
4
+ title: 'KvIntroductionLoanCard',
5
+ component: KvIntroductionLoanCard,
6
+ };
7
+
8
+ const story = (args) => {
9
+ const template = (_args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ components: { KvIntroductionLoanCard },
12
+ template: `
13
+ <div style="width: 600px;">
14
+ <kv-introduction-loan-card
15
+ :loanId="loanId"
16
+ :loan="loan"
17
+ :category-page-name="categoryPageName"
18
+ :custom-callouts="customCallouts"
19
+ :kv-track-function="kvTrackFunction"
20
+ :photo-path="photoPath"
21
+ :is-visitor="isVisitor"
22
+ @show-loan-details="showLoanDetails"
23
+ />
24
+ </div>
25
+ `,
26
+ methods: {
27
+ showLoanDetails() {
28
+ console.log('show-loan-details');
29
+ },
30
+ },
31
+ });
32
+ template.args = args;
33
+ return template;
34
+ };
35
+
36
+ const nextWeek = new Date();
37
+ nextWeek.setDate(new Date().getDate() + 7);
38
+
39
+ const loan = {
40
+ id: 1,
41
+ name: 'Alan',
42
+ geocode: {
43
+ city: 'Lyantonde',
44
+ state: 'Central Region',
45
+ country: {
46
+ isoCode: 'UG',
47
+ name: 'Uganda',
48
+ region: 'Africa',
49
+ __typename: 'Country',
50
+ },
51
+ __typename: 'Geocode',
52
+ },
53
+ image: { hash: '9673d0722a7675b9b8d11f90849d9b44' },
54
+ fundraisingPercent: 0.5,
55
+ unreservedAmount: '500.00',
56
+ use: 'to purchase heifers to increase headcount of cattle and sales of organic milk. The profits from the loan will be used wisely.',
57
+ status: 'fundraising',
58
+ loanAmount: '1000.00',
59
+ borrowerCount: 1,
60
+ activity: {
61
+ id: 61,
62
+ name: 'Dairy',
63
+ __typename: 'Activity',
64
+ },
65
+ sector: {
66
+ id: 1,
67
+ name: 'Agriculture',
68
+ __typename: 'Sector',
69
+ },
70
+ plannedExpirationDate: nextWeek.toISOString(),
71
+ tags: [
72
+ 'user_favorite',
73
+ '#Woman-Owned Business',
74
+ '#Animals',
75
+ '#Repeat Borrower',
76
+ '#Supporting Family',
77
+ '#Eco-friendly',
78
+ '#Single parent',
79
+ ],
80
+ };
81
+
82
+ const kvTrackFunction = () => { };
83
+
84
+ const photoPath = 'https://www-kiva-org.freetls.fastly.net/img/';
85
+
86
+ export const Default = story({
87
+ loanId: loan.id,
88
+ loan,
89
+ kvTrackFunction,
90
+ photoPath,
91
+ });
92
+
93
+ export const Loading = story({
94
+ loanId: loan.id,
95
+ loan: undefined,
96
+ kvTrackFunction,
97
+ photoPath,
98
+ });
99
+
100
+ export const PartialLoading = story({
101
+ loanId: loan.id,
102
+ loan: {
103
+ ...loan,
104
+ unreservedAmount: undefined,
105
+ fundraisingPercent: undefined,
106
+ },
107
+ kvTrackFunction,
108
+ photoPath,
109
+ });
110
+
111
+ export const Matched = story({
112
+ loanId: loan.id,
113
+ loan: {
114
+ ...loan,
115
+ matchingText: 'Ebay',
116
+ matchRatio: 1,
117
+ },
118
+ kvTrackFunction,
119
+ photoPath,
120
+ });
121
+
122
+ export const LseLoan = story({
123
+ loanId: loan.id,
124
+ loan: {
125
+ ...loan,
126
+ partnerName: 'N/A, direct to Novulis',
127
+ },
128
+ kvTrackFunction,
129
+ photoPath,
130
+ });
131
+
132
+ export const AlmostFunded = story({
133
+ loanId: loan.id,
134
+ loan: {
135
+ ...loan,
136
+ loanAmount: '100.00',
137
+ unreservedAmount: '10.00',
138
+ fundraisingPercent: 0.9,
139
+ loanFundraisingInfo: {
140
+ fundedAmount: '90.00',
141
+ reservedAmount: '0.00',
142
+ },
143
+ },
144
+ kvTrackFunction,
145
+ photoPath,
146
+ });
147
+
148
+ const tomorrow = new Date();
149
+ tomorrow.setDate(new Date().getDate() + 1);
150
+
151
+ export const ExpiringSoon = story({
152
+ loanId: loan.id,
153
+ loan: {
154
+ ...loan,
155
+ plannedExpirationDate: tomorrow.toISOString(),
156
+ },
157
+ kvTrackFunction,
158
+ photoPath,
159
+ });
160
+
161
+ export const Funded = story({
162
+ loanId: loan.id,
163
+ loan: {
164
+ ...loan,
165
+ unreservedAmount: '0.00',
166
+ },
167
+ kvTrackFunction,
168
+ photoPath,
169
+ });
170
+
171
+ export const LongName = story({
172
+ loanId: loan.id,
173
+ loan: {
174
+ ...loan,
175
+ name: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
176
+ },
177
+ kvTrackFunction,
178
+ photoPath,
179
+ });
180
+
181
+ export const USLoan = story({
182
+ loanId: loan.id,
183
+ loan: {
184
+ ...loan,
185
+ geocode: {
186
+ city: 'Kittanning',
187
+ state: 'PA',
188
+ country: {
189
+ isoCode: 'US',
190
+ name: 'United States',
191
+ region: 'North America',
192
+ __typename: 'Country',
193
+ },
194
+ __typename: 'Geocode',
195
+ },
196
+ distributionModel: 'direct',
197
+ },
198
+ kvTrackFunction,
199
+ photoPath,
200
+ });
201
+
202
+ export const Bookmark = story({
203
+ loanId: loan.id,
204
+ loan,
205
+ kvTrackFunction,
206
+ photoPath,
207
+ isVisitor: false,
208
+ });
@@ -0,0 +1,31 @@
1
+ import KvLendAmountButton from '../KvLendAmountButton.vue';
2
+
3
+ export default {
4
+ title: 'KvLendAmountButton',
5
+ component: KvLendAmountButton,
6
+ };
7
+
8
+ const story = (args) => {
9
+ const template = (_args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ components: { KvLendAmountButton },
12
+ template: `
13
+ <kv-lend-amount-button
14
+ :loan-id="loanId"
15
+ :show-now="showNow"
16
+ :amount-left="amountLeft"
17
+ :complete-loan="completeLoan"
18
+ />
19
+ `,
20
+ });
21
+ template.args = args;
22
+ return template;
23
+ };
24
+
25
+ export const Default = story();
26
+
27
+ export const ShowNow = story({ showNow: true });
28
+
29
+ export const AmountLeft = story({ amountLeft: 5 });
30
+
31
+ export const CompleteLoan = story({ completeLoan: true });
@@ -0,0 +1,177 @@
1
+ import KvLendCta from '../KvLendCta.vue';
2
+
3
+ export default {
4
+ title: 'KvLendCta',
5
+ component: KvLendCta,
6
+ };
7
+
8
+ const story = (args) => {
9
+ const template = (_args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+ components: { KvLendCta },
12
+ template: `
13
+ <div style="width: 300px;">
14
+ <kv-lend-cta
15
+ :loan="loan"
16
+ :basket-items="basketItems"
17
+ :is-loading="isLoading"
18
+ :is-adding="isAdding"
19
+ :enable-five-dollars-notes="enableFiveDollarsNotes"
20
+ :five-dollars-selected="fiveDollarsSelected"
21
+ :kv-track-function="kvTrackFunction"
22
+ :show-view-loan="showViewLoan"
23
+ :custom-loan-details="customLoanDetails"
24
+ :enable-huge-amount="enableHugeAmount"
25
+ :is-visitor="isVisitor"
26
+ :secondary-button-handler="secondaryButtonHandler"
27
+ :external-links="externalLinks"
28
+ />
29
+ </div>
30
+ `,
31
+ });
32
+ template.args = args;
33
+ return template;
34
+ };
35
+
36
+ const kvTrackFunction = () => { };
37
+
38
+ const secondaryButtonHandler = () => { console.log('secondary button handler'); };
39
+
40
+ export const Loading = story({ isLoading: true, kvTrackFunction });
41
+
42
+ export const Adding = story({ isLoading: false, isAdding: true, kvTrackFunction });
43
+
44
+ export const Basketed = story({
45
+ isLoading: false,
46
+ loan: { id: 1 },
47
+ basketItems: [
48
+ {
49
+ __typename: 'LoanReservation',
50
+ id: 1,
51
+ },
52
+ ],
53
+ kvTrackFunction,
54
+ });
55
+
56
+ export const BasketedWithSecondaryAction = story({
57
+ isLoading: false,
58
+ loan: { id: 1 },
59
+ basketItems: [
60
+ {
61
+ __typename: 'LoanReservation',
62
+ id: 1,
63
+ },
64
+ ],
65
+ externalLinks: true,
66
+ kvTrackFunction,
67
+ secondaryButtonHandler,
68
+ });
69
+
70
+ export const Funded = story({
71
+ isLoading: false,
72
+ loan: { status: 'funded' },
73
+ kvTrackFunction,
74
+ });
75
+
76
+ export const NonActionable = story({
77
+ isLoading: false,
78
+ loan: { status: 'refunded' },
79
+ kvTrackFunction,
80
+ });
81
+
82
+ export const Dropdown = story({
83
+ isLoading: false,
84
+ loan: {
85
+ id: 1,
86
+ unreservedAmount: '150.00',
87
+ },
88
+ kvTrackFunction,
89
+ });
90
+
91
+ export const HugeAmount = story({
92
+ isLoading: false,
93
+ loan: {
94
+ id: 1,
95
+ unreservedAmount: '12850.00',
96
+ },
97
+ kvTrackFunction,
98
+ enableHugeAmount: true,
99
+ isVisitor: false,
100
+ });
101
+
102
+ export const HugeAmountUnder1000 = story({
103
+ isLoading: false,
104
+ loan: {
105
+ id: 1,
106
+ unreservedAmount: '850.00',
107
+ },
108
+ kvTrackFunction,
109
+ enableHugeAmount: true,
110
+ isVisitor: false,
111
+ });
112
+
113
+ export const FiveDollar = story({
114
+ isLoading: false,
115
+ loan: {
116
+ id: 1,
117
+ unreservedAmount: '150.00',
118
+ },
119
+ enableFiveDollarsNotes: true,
120
+ kvTrackFunction,
121
+ });
122
+
123
+ export const FiveDollarsSelected = story({
124
+ isLoading: false,
125
+ loan: {
126
+ id: 1,
127
+ unreservedAmount: '150.00',
128
+ },
129
+ enableFiveDollarsNotes: true,
130
+ fiveDollarsSelected: true,
131
+ kvTrackFunction,
132
+ });
133
+
134
+ export const LessThan25 = story({
135
+ isLoading: false,
136
+ loan: {
137
+ id: 1,
138
+ unreservedAmount: '20.00',
139
+ },
140
+ kvTrackFunction,
141
+ });
142
+
143
+ export const Non25Increments = story({
144
+ isLoading: false,
145
+ loan: {
146
+ id: 1,
147
+ unreservedAmount: '30.00',
148
+ },
149
+ kvTrackFunction,
150
+ });
151
+
152
+ export const LendAgain = story({
153
+ isLoading: false,
154
+ loan: {
155
+ id: 1,
156
+ unreservedAmount: '150.00',
157
+ userProperties: { lentTo: true },
158
+ },
159
+ kvTrackFunction,
160
+ });
161
+
162
+ export const ViewLoan = story({
163
+ isLoading: false,
164
+ loan: {
165
+ id: 1,
166
+ unreservedAmount: '150.00',
167
+ },
168
+ kvTrackFunction,
169
+ showViewLoan: true,
170
+ });
171
+
172
+ export const ViewLoanFunded = story({
173
+ isLoading: false,
174
+ loan: { status: 'funded' },
175
+ kvTrackFunction,
176
+ showViewLoan: true,
177
+ });