@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.
Files changed (179) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/CHANGELOG.md +22 -0
  3. package/dist/components/.storybook/main.js +85 -0
  4. package/dist/components/.storybook/package.json +3 -0
  5. package/dist/components/.storybook/preview.js +61 -0
  6. package/dist/components/.storybook/tailwind.css +5 -0
  7. package/dist/components/KvAccordionItem.vue +130 -0
  8. package/dist/components/KvActivityRow.vue +33 -0
  9. package/dist/components/KvBorrowerImage.vue +179 -0
  10. package/dist/components/KvButton.vue +287 -0
  11. package/dist/components/KvCarousel.vue +297 -0
  12. package/dist/components/KvCartModal.vue +365 -0
  13. package/dist/components/KvCheckbox.vue +203 -0
  14. package/dist/components/KvChip.vue +54 -0
  15. package/dist/components/KvClassicLoanCard.vue +527 -0
  16. package/dist/components/KvCommentsAdd.vue +135 -0
  17. package/dist/components/KvCommentsContainer.vue +84 -0
  18. package/dist/components/KvCommentsHeartButton.vue +70 -0
  19. package/dist/components/KvCommentsList.vue +68 -0
  20. package/dist/components/KvCommentsListItem.vue +241 -0
  21. package/dist/components/KvCommentsReplyButton.vue +52 -0
  22. package/dist/components/KvContentfulImg.vue +273 -0
  23. package/dist/components/KvCountdownTimer.vue +59 -0
  24. package/dist/components/KvExpandable.vue +84 -0
  25. package/dist/components/KvExpandableQuestion.vue +120 -0
  26. package/dist/components/KvFlag.vue +120 -0
  27. package/dist/components/KvGrid.vue +28 -0
  28. package/dist/components/KvImpactDashboardHeader.vue +40 -0
  29. package/dist/components/KvInlineActivityCard.vue +55 -0
  30. package/dist/components/KvInlineActivityFeed.vue +38 -0
  31. package/dist/components/KvIntroductionLoanCard.vue +446 -0
  32. package/dist/components/KvLendAmountButton.vue +65 -0
  33. package/dist/components/KvLendCta.vue +451 -0
  34. package/dist/components/KvLightbox.vue +334 -0
  35. package/dist/components/KvLineGraph.vue +128 -0
  36. package/dist/components/KvLoadingPlaceholder.vue +38 -0
  37. package/dist/components/KvLoadingSpinner.vue +81 -0
  38. package/dist/components/KvLoanActivities.vue +268 -0
  39. package/dist/components/KvLoanBookmark.vue +39 -0
  40. package/dist/components/KvLoanCallouts.vue +53 -0
  41. package/dist/components/KvLoanProgressGroup.vue +76 -0
  42. package/dist/components/KvLoanTag.vue +88 -0
  43. package/dist/components/KvLoanTeamPick.vue +44 -0
  44. package/dist/components/KvLoanUse.vue +92 -0
  45. package/dist/components/KvMap.vue +599 -0
  46. package/dist/components/KvMaterialIcon.vue +47 -0
  47. package/dist/components/KvPageContainer.vue +15 -0
  48. package/dist/components/KvPagination.vue +198 -0
  49. package/dist/components/KvPieChart.vue +257 -0
  50. package/dist/components/KvPopper.vue +178 -0
  51. package/dist/components/KvProgressBar.vue +149 -0
  52. package/dist/components/KvRadio.vue +198 -0
  53. package/dist/components/KvSelect.vue +114 -0
  54. package/dist/components/KvSideSheet.vue +134 -0
  55. package/dist/components/KvSwitch.vue +143 -0
  56. package/dist/components/KvTab.vue +90 -0
  57. package/dist/components/KvTabPanel.vue +64 -0
  58. package/dist/components/KvTabs.vue +182 -0
  59. package/dist/components/KvTextInput.vue +247 -0
  60. package/dist/components/KvTextLink.vue +138 -0
  61. package/dist/components/KvThemeProvider.vue +122 -0
  62. package/dist/components/KvToast.vue +221 -0
  63. package/dist/components/KvTooltip.vue +168 -0
  64. package/dist/components/KvTreeMapChart.vue +229 -0
  65. package/dist/components/KvUserAvatar.vue +132 -0
  66. package/dist/components/KvVerticalCarousel.vue +156 -0
  67. package/dist/components/KvVotingCard.vue +160 -0
  68. package/dist/components/KvVotingCardV2.vue +154 -0
  69. package/dist/components/KvWideLoanCard.vue +432 -0
  70. package/dist/components/stories/Forms.stories.js +62 -0
  71. package/dist/components/stories/KvAccordionItem.stories.js +24 -0
  72. package/dist/components/stories/KvActivityRow.stories.js +25 -0
  73. package/dist/components/stories/KvBorrowerImage.stories.js +68 -0
  74. package/dist/components/stories/KvButton.stories.js +144 -0
  75. package/dist/components/stories/KvCarousel.stories.js +426 -0
  76. package/dist/components/stories/KvCartModal.stories.js +54 -0
  77. package/dist/components/stories/KvCheckbox.stories.js +163 -0
  78. package/dist/components/stories/KvChip.stories.js +43 -0
  79. package/dist/components/stories/KvClassicLoanCard.stories.js +480 -0
  80. package/dist/components/stories/KvCommentsAdd.stories.js +32 -0
  81. package/dist/components/stories/KvCommentsContainer.stories.js +42 -0
  82. package/dist/components/stories/KvCommentsHeartButton.stories.js +25 -0
  83. package/dist/components/stories/KvCommentsList.stories.js +39 -0
  84. package/dist/components/stories/KvCommentsListItem.stories.js +45 -0
  85. package/dist/components/stories/KvCommentsReplyButton.stories.js +21 -0
  86. package/dist/components/stories/KvContentfulImg.stories.js +196 -0
  87. package/dist/components/stories/KvCountdownTimer.stories.js +30 -0
  88. package/dist/components/stories/KvExpandableQuestion.stories.js +129 -0
  89. package/dist/components/stories/KvFlag.stories.js +36 -0
  90. package/dist/components/stories/KvGrid.stories.js +97 -0
  91. package/dist/components/stories/KvImpactDashboardHeader.stories.js +22 -0
  92. package/dist/components/stories/KvInlineActivityCard.stories.js +69 -0
  93. package/dist/components/stories/KvInlineActivityFeed.stories.js +76 -0
  94. package/dist/components/stories/KvIntroductionLoanCard.stories.js +208 -0
  95. package/dist/components/stories/KvLendAmountButton.stories.js +31 -0
  96. package/dist/components/stories/KvLendCta.stories.js +177 -0
  97. package/dist/components/stories/KvLightbox.stories.js +304 -0
  98. package/dist/components/stories/KvLineGraph.stories.js +52 -0
  99. package/dist/components/stories/KvLoadingPlaceholder.stories.js +17 -0
  100. package/dist/components/stories/KvLoadingSpinner.stories.js +52 -0
  101. package/dist/components/stories/KvLoanActivities.stories.js +104 -0
  102. package/dist/components/stories/KvLoanBookmark.stories.js +22 -0
  103. package/dist/components/stories/KvLoanCallouts.stories.js +22 -0
  104. package/dist/components/stories/KvLoanProgressGroup.stories.js +29 -0
  105. package/dist/components/stories/KvLoanTag.stories.js +61 -0
  106. package/dist/components/stories/KvLoanTeamPick.stories.js +20 -0
  107. package/dist/components/stories/KvLoanUse.stories.js +60 -0
  108. package/dist/components/stories/KvMap.stories.js +121 -0
  109. package/dist/components/stories/KvMaterialIcon.stories.js +201 -0
  110. package/dist/components/stories/KvPageContainer.stories.js +50 -0
  111. package/dist/components/stories/KvPagination.stories.js +70 -0
  112. package/dist/components/stories/KvPieChart.stories.js +47 -0
  113. package/dist/components/stories/KvProgressBar.stories.js +53 -0
  114. package/dist/components/stories/KvRadio.stories.js +140 -0
  115. package/dist/components/stories/KvSelect.stories.js +125 -0
  116. package/dist/components/stories/KvSideSheet.stories.js +50 -0
  117. package/dist/components/stories/KvSwitch.stories.js +66 -0
  118. package/dist/components/stories/KvTabs.stories.js +106 -0
  119. package/dist/components/stories/KvTextInput.stories.js +194 -0
  120. package/dist/components/stories/KvTextLink.stories.js +55 -0
  121. package/dist/components/stories/KvThemeProvider.stories.js +178 -0
  122. package/dist/components/stories/KvToast.stories.js +117 -0
  123. package/dist/components/stories/KvTooltip.stories.js +26 -0
  124. package/dist/components/stories/KvTreeMapChart.stories.js +42 -0
  125. package/dist/components/stories/KvUserAvatar.stories.js +47 -0
  126. package/dist/components/stories/KvVerticalCarousel.stories.js +168 -0
  127. package/dist/components/stories/KvVotingCard.stories.js +33 -0
  128. package/dist/components/stories/KvVotingCardV2.stories.js +89 -0
  129. package/dist/components/stories/KvWideLoanCard.stories.js +292 -0
  130. package/dist/components/stories/StyleguidePrimitives.stories.js +499 -0
  131. package/dist/components/stories/StyleguideProse.stories.js +215 -0
  132. package/dist/data/countries-borders.json +1 -0
  133. package/dist/data/ne_110m_admin_0_countries.json +1 -0
  134. package/dist/utils/Alea.cjs +87 -0
  135. package/dist/utils/Alea.js +9 -0
  136. package/dist/utils/attrs.cjs +50 -0
  137. package/dist/utils/attrs.js +7 -0
  138. package/dist/utils/carousels.cjs +184 -0
  139. package/dist/utils/carousels.js +8 -0
  140. package/dist/utils/chunk-3HK4G4NT.js +27 -0
  141. package/dist/utils/chunk-55HF2ORX.js +201 -0
  142. package/dist/utils/chunk-AY3PR5S4.js +54 -0
  143. package/dist/utils/chunk-AZPWOFD5.js +148 -0
  144. package/dist/utils/chunk-B5J5WLAH.js +18 -0
  145. package/dist/utils/chunk-GPSH6OPA.js +64 -0
  146. package/dist/utils/chunk-HIY5IW65.js +28 -0
  147. package/dist/utils/chunk-HV3AUBFT.js +15 -0
  148. package/dist/utils/chunk-MSMZIN54.js +110 -0
  149. package/dist/utils/chunk-OXJCCNNW.js +30 -0
  150. package/dist/utils/chunk-S3MABILA.js +22 -0
  151. package/dist/utils/chunk-VIGEMAKO.js +249 -0
  152. package/dist/utils/chunk-YCNMJ4YV.js +37 -0
  153. package/dist/utils/chunk-YFEC5ODJ.js +129 -0
  154. package/dist/utils/expander.cjs +78 -0
  155. package/dist/utils/expander.js +9 -0
  156. package/dist/utils/imageUtils.cjs +54 -0
  157. package/dist/utils/imageUtils.js +9 -0
  158. package/dist/utils/index.cjs +1118 -0
  159. package/dist/utils/index.js +166 -0
  160. package/dist/utils/loanCard.cjs +222 -0
  161. package/dist/utils/loanCard.js +9 -0
  162. package/dist/utils/loanUtils.cjs +170 -0
  163. package/dist/utils/loanUtils.js +23 -0
  164. package/dist/utils/mapUtils.cjs +276 -0
  165. package/dist/utils/mapUtils.js +15 -0
  166. package/dist/utils/printing.cjs +42 -0
  167. package/dist/utils/printing.js +9 -0
  168. package/dist/utils/scrollLock.cjs +54 -0
  169. package/dist/utils/scrollLock.js +13 -0
  170. package/dist/utils/throttle.cjs +38 -0
  171. package/dist/utils/throttle.js +7 -0
  172. package/dist/utils/touchEvents.cjs +47 -0
  173. package/dist/utils/touchEvents.js +11 -0
  174. package/dist/utils/treemap.cjs +133 -0
  175. package/dist/utils/treemap.js +7 -0
  176. package/package.json +12 -4
  177. package/utils/index.js +14 -0
  178. package/vue/KvVerticalCarousel.vue +1 -1
  179. package/index.js +0 -3
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <div>
3
+ <kv-comments-add
4
+ v-if="userPublicId"
5
+ :user-image-url="userImageUrl"
6
+ :user-display-name="userDisplayName"
7
+ @add-comment="handleReaction"
8
+ />
9
+ <kv-comments-list
10
+ v-if="comments"
11
+ :user-image-url="userImageUrl"
12
+ :user-display-name="userDisplayName"
13
+ :user-public-id="userPublicId"
14
+ :comments="comments"
15
+ @add-reaction="handleReaction"
16
+ />
17
+ </div>
18
+ </template>
19
+
20
+ <script>
21
+ import KvCommentsAdd from './KvCommentsAdd.vue';
22
+ import KvCommentsList from './KvCommentsList.vue';
23
+
24
+ export const ADD_COMMENT_EVENT = 'add-comment';
25
+ export const ADD_REACTION_EVENT = 'add-reaction';
26
+
27
+ export default {
28
+ name: 'KvCommentsContainer',
29
+ components: {
30
+ KvCommentsAdd,
31
+ KvCommentsList,
32
+ },
33
+ props: {
34
+ /**
35
+ * The full URL for the user image
36
+ */
37
+ userImageUrl: {
38
+ type: String,
39
+ default: '',
40
+ },
41
+ /**
42
+ * The name to display for the user
43
+ */
44
+ userDisplayName: {
45
+ type: String,
46
+ default: '',
47
+ },
48
+ /**
49
+ * The ID for the user
50
+ */
51
+ userPublicId: {
52
+ type: String,
53
+ default: '',
54
+ },
55
+ /**
56
+ * Activity comments
57
+ */
58
+ comments: {
59
+ type: Array,
60
+ default: () => ([]),
61
+ },
62
+ },
63
+ emits: [ADD_REACTION_EVENT],
64
+ setup(_props, { emit }) {
65
+ const handleReaction = (reactionPayload) => {
66
+ let payload;
67
+ if (reactionPayload.value === undefined) {
68
+ payload = {
69
+ reaction: ADD_COMMENT_EVENT,
70
+ id: null,
71
+ isChild: false,
72
+ value: reactionPayload,
73
+ };
74
+ } else {
75
+ payload = reactionPayload;
76
+ }
77
+ emit(ADD_REACTION_EVENT, payload);
78
+ };
79
+ return {
80
+ handleReaction,
81
+ };
82
+ },
83
+ };
84
+ </script>
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <button
3
+ aria-label="Like"
4
+ class="tw-flex tw-flex-col tw-justify-center"
5
+ @click="$emit('click', !isLiked);"
6
+ >
7
+ <kv-material-icon
8
+ :icon="icon"
9
+ :class="classState"
10
+ />
11
+ </button>
12
+ </template>
13
+
14
+ <script>
15
+ import { computed, toRefs } from 'vue-demi';
16
+ import { mdiHeart, mdiHeartOutline } from '@mdi/js';
17
+ import KvMaterialIcon from './KvMaterialIcon.vue';
18
+
19
+ export default {
20
+ name: 'KvCommentsHeartButton',
21
+ components: {
22
+ KvMaterialIcon,
23
+ },
24
+ props: {
25
+ /**
26
+ * Use if small icon is needed
27
+ */
28
+ isSmall: {
29
+ type: Boolean,
30
+ default: false,
31
+ },
32
+ /**
33
+ * Use if icon is liked
34
+ */
35
+ isLiked: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+ },
40
+ emits: [
41
+ 'click',
42
+ ],
43
+ setup(props) {
44
+ const {
45
+ isSmall,
46
+ isLiked,
47
+ } = toRefs(props);
48
+
49
+ const icon = computed(() => (isLiked.value ? mdiHeart : mdiHeartOutline));
50
+
51
+ const classState = computed(() => {
52
+ let className = isSmall.value ? 'tw-w-2.5 tw-h-2.5' : 'tw-w-3 tw-h-3';
53
+ className += isLiked.value ? ' filled' : '';
54
+
55
+ return className;
56
+ });
57
+
58
+ return {
59
+ icon,
60
+ classState,
61
+ };
62
+ },
63
+ };
64
+ </script>
65
+
66
+ <style scoped>
67
+ .filled >>> svg {
68
+ fill: #F60059;
69
+ }
70
+ </style>
@@ -0,0 +1,68 @@
1
+ <template>
2
+ <div>
3
+ <KvCommentsListItem
4
+ v-for="comment in comments"
5
+ :id="comment.id"
6
+ :key="comment.id"
7
+ :comment="comment"
8
+ :user-image-url="userImageUrl"
9
+ :user-display-name="userDisplayName"
10
+ :user-public-id="userPublicId"
11
+ :is-liked="comment.is_liked"
12
+ class="tw-mb-2 tw-not-prose"
13
+ @add-reaction="handleReaction"
14
+ />
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+
20
+ import KvCommentsListItem from './KvCommentsListItem.vue';
21
+
22
+ const ADD_REACTION_EVENT = 'add-reaction';
23
+
24
+ export default {
25
+ name: 'KvCommentsList',
26
+ components: { KvCommentsListItem },
27
+ props: {
28
+ /**
29
+ * The full URL for the user image
30
+ */
31
+ userImageUrl: {
32
+ type: String,
33
+ default: '',
34
+ },
35
+ /**
36
+ * The name to display for the user
37
+ */
38
+ userDisplayName: {
39
+ type: String,
40
+ default: '',
41
+ },
42
+ /**
43
+ * The ID for the user
44
+ */
45
+ userPublicId: {
46
+ type: String,
47
+ default: '',
48
+ },
49
+ /**
50
+ * Activity comments
51
+ */
52
+ comments: {
53
+ type: Array,
54
+ default: () => ([]),
55
+ },
56
+ },
57
+ emits: [ADD_REACTION_EVENT],
58
+ setup(_props, { emit }) {
59
+ const handleReaction = (payload) => {
60
+ emit(ADD_REACTION_EVENT, payload);
61
+ };
62
+
63
+ return {
64
+ handleReaction,
65
+ };
66
+ },
67
+ };
68
+ </script>
@@ -0,0 +1,241 @@
1
+ <template>
2
+ <div>
3
+ <div>
4
+ <div class="tw-flex tw-items-center tw-gap-1">
5
+ <kv-user-avatar
6
+ :lender-name="authorName"
7
+ :lender-image-url="authorImage"
8
+ is-small
9
+ />
10
+ <p
11
+ v-if="authorName"
12
+ class="data-hj-suppress tw-font-medium"
13
+ >
14
+ {{ authorName }}
15
+ </p>
16
+ </div>
17
+ <p>
18
+ {{ commentText }}
19
+ </p>
20
+ </div>
21
+ <div class="tw-flex tw-items-center tw-gap-x-1">
22
+ <div class="tw-flex tw-items-center tw-gap-0.5">
23
+ <kv-comments-heart-button
24
+ :is-small="true"
25
+ :is-liked="isLiked"
26
+ :disabled="!userPublicId"
27
+ @click="addReaction(LIKE_COMMENT_EVENT, $event)"
28
+ />
29
+ <p
30
+ v-if="numberOfLikes"
31
+ data-testid="like-count"
32
+ class="tw-font-medium"
33
+ >
34
+ {{ numberOfLikes }}
35
+ </p>
36
+ </div>
37
+ <kv-comments-reply-button
38
+ v-if="userPublicId && nestLevel === 0"
39
+ @click="replyClick"
40
+ />
41
+ </div>
42
+ <div
43
+ v-if="showInput"
44
+ class="tw-w-full"
45
+ >
46
+ <kv-comments-add
47
+ ref="commentsAddRef"
48
+ :user-image-url="userImageUrl"
49
+ :user-display-name="userDisplayName"
50
+ :is-reply="true"
51
+ class="tw-ml-3"
52
+ @add-comment="addReaction(REPLY_COMMENT_EVENT, $event)"
53
+ @hide-input="hideInput"
54
+ />
55
+ </div>
56
+ <div
57
+ v-if="childComments"
58
+ class="tw-my-1"
59
+ >
60
+ <button
61
+ v-if="numberOfReplies"
62
+ class="tw-ml-3 tw-text-action tw-font-medium tw-mb-1 tw-flex tw-items-center"
63
+ @click="toggleReplies"
64
+ >
65
+ <kv-material-icon
66
+ class="tw-h-2.5 tw-w-2.5 tw-transition tw-transform tw-duration-500 tw-ease"
67
+ :class="{ 'tw-rotate-180' : repliesOpened }"
68
+ :icon="mdiChevronDown"
69
+ />
70
+ {{ numberOfReplies }} {{ numberOfReplies > 1 ? 'replies' : 'reply' }}
71
+ </button>
72
+ <div v-if="repliesOpened">
73
+ <div
74
+ v-for="childComment in childComments"
75
+ :key="childComment.id"
76
+ class="tw-ml-3"
77
+ >
78
+ <kv-comments-list-item
79
+ :user-image-url="userImageUrl"
80
+ :user-display-name="userDisplayName"
81
+ :user-public-id="userPublicId"
82
+ :comment="childComment"
83
+ :nest-level="nestLevel + 1"
84
+ @add-reaction="$emit(ADD_REACTION_EVENT, $event);"
85
+ />
86
+ </div>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ </template>
91
+
92
+ <script>
93
+ import { mdiChevronDown } from '@mdi/js';
94
+ import {
95
+ ref,
96
+ nextTick,
97
+ computed,
98
+ toRefs,
99
+ onMounted,
100
+ inject,
101
+ } from 'vue-demi';
102
+ import KvMaterialIcon from './KvMaterialIcon.vue';
103
+ import KvCommentsReplyButton from './KvCommentsReplyButton.vue';
104
+ import KvCommentsHeartButton from './KvCommentsHeartButton.vue';
105
+ import KvCommentsAdd from './KvCommentsAdd.vue';
106
+ import KvUserAvatar from './KvUserAvatar.vue';
107
+
108
+ export const REPLY_COMMENT_EVENT = 'reply-comment';
109
+ export const LIKE_COMMENT_EVENT = 'like-comment';
110
+ const ADD_REACTION_EVENT = 'add-reaction';
111
+
112
+ export default {
113
+ name: 'KvCommentsListItem',
114
+ components: {
115
+ KvCommentsReplyButton,
116
+ KvCommentsHeartButton,
117
+ KvCommentsAdd,
118
+ KvUserAvatar,
119
+ KvMaterialIcon,
120
+ },
121
+ props: {
122
+ /**
123
+ * The full URL for the user image
124
+ */
125
+ userImageUrl: {
126
+ type: String,
127
+ default: '',
128
+ },
129
+ /**
130
+ * The name to display for the user
131
+ */
132
+ userDisplayName: {
133
+ type: String,
134
+ default: '',
135
+ },
136
+ /**
137
+ * The ID for the user
138
+ */
139
+ userPublicId: {
140
+ type: String,
141
+ default: '',
142
+ },
143
+ /**
144
+ * Activity comment
145
+ */
146
+ comment: {
147
+ type: Object,
148
+ default: () => ({}),
149
+ },
150
+ /**
151
+ * The nest level of the comment
152
+ */
153
+ nestLevel: {
154
+ type: Number,
155
+ default: 0,
156
+ },
157
+ },
158
+ emits: [
159
+ ADD_REACTION_EVENT,
160
+ ],
161
+ setup(props, { emit }) {
162
+ const {
163
+ comment,
164
+ userPublicId,
165
+ } = toRefs(props);
166
+
167
+ const showInput = ref(false);
168
+ const commentsAddRef = ref(null);
169
+ const authorInfo = ref();
170
+ const repliesOpened = ref(false);
171
+
172
+ const commentText = computed(() => comment?.value?.text ?? '');
173
+
174
+ const authorId = computed(() => comment?.value?.publicLenderId ?? '');
175
+ const authorImage = computed(() => authorInfo?.value?.image?.url ?? '');
176
+ const authorName = computed(() => authorInfo?.value?.name ?? '');
177
+
178
+ const childComments = computed(() => comment?.value?.children?.comment ?? null);
179
+ const childLikes = computed(() => (comment?.value?.children?.like ?? []));
180
+ const likedObject = computed(() => childLikes.value.find((l) => l.publicLenderId === userPublicId.value));
181
+ const isLiked = computed(() => likedObject.value !== undefined);
182
+
183
+ const replyClick = () => {
184
+ showInput.value = !showInput.value;
185
+ nextTick(() => {
186
+ if (showInput.value) commentsAddRef.value.$refs.input.focus();
187
+ });
188
+ };
189
+
190
+ const addReaction = (reaction, value) => {
191
+ const payload = {
192
+ reaction,
193
+ id: comment?.value?.id ?? null,
194
+ isChild: true,
195
+ value,
196
+ };
197
+
198
+ emit(ADD_REACTION_EVENT, payload);
199
+ };
200
+
201
+ const hideInput = () => { showInput.value = false; };
202
+
203
+ const numberOfLikes = computed(() => comment?.value?.children?.like?.length ?? 0);
204
+
205
+ const numberOfReplies = computed(() => comment?.value?.children?.comment?.length ?? 0);
206
+
207
+ const toggleReplies = () => { repliesOpened.value = !repliesOpened.value; };
208
+
209
+ // The fetchLenderInfo method must be provided in the parent component
210
+ const fetchLenderInfo = inject('fetchLenderInfo');
211
+
212
+ onMounted(async () => {
213
+ if (authorId.value) {
214
+ const authorData = await fetchLenderInfo(authorId.value);
215
+ authorInfo.value = authorData;
216
+ }
217
+ });
218
+
219
+ return {
220
+ hideInput,
221
+ showInput,
222
+ commentsAddRef,
223
+ replyClick,
224
+ addReaction,
225
+ REPLY_COMMENT_EVENT,
226
+ LIKE_COMMENT_EVENT,
227
+ ADD_REACTION_EVENT,
228
+ commentText,
229
+ authorImage,
230
+ authorName,
231
+ childComments,
232
+ isLiked,
233
+ numberOfLikes,
234
+ numberOfReplies,
235
+ repliesOpened,
236
+ toggleReplies,
237
+ mdiChevronDown,
238
+ };
239
+ },
240
+ };
241
+ </script>
@@ -0,0 +1,52 @@
1
+ <!-- eslint-disable max-len -->
2
+ <template>
3
+ <kv-button
4
+ variant="ghost"
5
+ aria-label="Reply"
6
+ @click="$emit('click')"
7
+ >
8
+ <svg
9
+ width="14"
10
+ height="11"
11
+ viewBox="0 0 14 11"
12
+ fill="none"
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ >
15
+ <path
16
+ d="M2.87502 5.12499L4.91669 7.16666C5.06946 7.31943 5.14585 7.49652 5.14585 7.69791C5.14585 7.8993 5.06946 8.0797 4.91669 8.23911C4.76391 8.38525 4.58683 8.45832 4.38544 8.45832C4.18405 8.45832 4.00696 8.38193 3.85419 8.22916L0.520854 4.89582C0.368076 4.7481 0.291687 4.57575 0.291687 4.37878C0.291687 4.18181 0.368076 4.00693 0.520854 3.85416L3.85419 0.520823C4.00696 0.368045 4.18521 0.291656 4.38892 0.291656C4.59261 0.291656 4.76853 0.368045 4.91669 0.520823C5.06946 0.668976 5.14585 0.8449 5.14585 1.04859C5.14585 1.2523 5.06946 1.43055 4.91669 1.58332L2.87502 3.62499H10C11.1067 3.62499 12.05 4.01499 12.83 4.79499C13.61 5.57499 14 6.51832 14 7.62499V9.87499C14 10.0875 13.9286 10.2656 13.7857 10.4094C13.6427 10.5531 13.4657 10.625 13.2544 10.625C13.0432 10.625 12.8646 10.5531 12.7188 10.4094C12.5729 10.2656 12.5 10.0875 12.5 9.87499V7.62499C12.5 6.93055 12.257 6.34027 11.7709 5.85416C11.2847 5.36805 10.6945 5.12499 10 5.12499H2.87502Z"
17
+ fill="#1C1B1F"
18
+ />
19
+ </svg>
20
+ <span>
21
+ reply
22
+ </span>
23
+ </kv-button>
24
+ </template>
25
+
26
+ <script>
27
+ import KvButton from './KvButton.vue';
28
+
29
+ export default {
30
+ name: 'KvCommentsReplyButton',
31
+ components: {
32
+ KvButton,
33
+ },
34
+ emits: [
35
+ 'click',
36
+ ],
37
+ };
38
+ </script>
39
+
40
+ <style lang="postcss" scoped>
41
+ >>> span {
42
+ @apply tw-min-h-0;
43
+ }
44
+
45
+ >>> span > span {
46
+ @apply tw-py-0 tw-px-0.5 tw-flex tw-items-center;
47
+ }
48
+
49
+ >>> svg {
50
+ @apply tw-mx-0.5;
51
+ }
52
+ </style>