@kiva/kv-components 7.6.3 → 8.0.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 (336) hide show
  1. package/.eslintignore +5 -0
  2. package/.github/copilot-instructions.md +11 -0
  3. package/AGENTS.md +184 -0
  4. package/CLAUDE.md +11 -0
  5. package/GEMINI.md +11 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.js +236 -216
  8. package/dist/utils/Alea.d.ts +9 -0
  9. package/dist/utils/Alea.js +23 -23
  10. package/dist/utils/arrayUtils.d.ts +3 -0
  11. package/dist/utils/arrayUtils.js +1 -1
  12. package/dist/utils/attrs.d.ts +6 -0
  13. package/dist/utils/carousels.d.ts +21 -0
  14. package/dist/utils/comparators.d.ts +3 -0
  15. package/dist/utils/comparators.js +20 -6
  16. package/dist/utils/debounce.d.ts +1 -0
  17. package/dist/utils/debounce.js +4 -4
  18. package/dist/utils/event.d.ts +1 -0
  19. package/dist/utils/event.js +7 -0
  20. package/dist/utils/expander.d.ts +14 -0
  21. package/dist/utils/imageUtils.d.ts +11 -0
  22. package/dist/utils/imageUtils.js +12 -12
  23. package/dist/utils/index.d.ts +21 -0
  24. package/dist/utils/loanCard.d.ts +35 -0
  25. package/dist/utils/loanCard.js +2 -2
  26. package/dist/utils/loanSearch/queryParamUtils.d.ts +1 -0
  27. package/dist/utils/loanUtils.d.ts +11 -0
  28. package/dist/utils/loanUtils.js +56 -53
  29. package/dist/utils/mapUtils.d.ts +5 -0
  30. package/dist/utils/markMatches.d.ts +1 -0
  31. package/dist/utils/paramCase.d.ts +1 -0
  32. package/dist/utils/printing.d.ts +2 -0
  33. package/dist/utils/scrollLock.d.ts +4 -0
  34. package/dist/utils/themeUtils.d.ts +12 -0
  35. package/dist/utils/throttle.d.ts +1 -0
  36. package/dist/utils/throttle.js +4 -4
  37. package/dist/utils/touchEvents.d.ts +3 -0
  38. package/dist/utils/touchEvents.js +9 -9
  39. package/dist/utils/treemap.d.ts +16 -0
  40. package/dist/utils/treemap.js +1 -1
  41. package/dist/vue/KvAccordionItem.js +28 -82
  42. package/dist/vue/KvAccordionItem.vue.d.ts +107 -0
  43. package/dist/vue/KvAccordionItem2.js +60 -0
  44. package/dist/vue/KvActivityRow.js +11 -22
  45. package/dist/vue/KvActivityRow.vue.d.ts +66 -0
  46. package/dist/vue/KvActivityRow2.js +16 -0
  47. package/dist/vue/KvAtbModal.css +1 -1
  48. package/dist/vue/KvAtbModal.js +68 -248
  49. package/dist/vue/KvAtbModal.vue.d.ts +359 -0
  50. package/dist/vue/KvAtbModal2.js +186 -0
  51. package/dist/vue/KvBorrowerImage.js +17 -118
  52. package/dist/vue/KvBorrowerImage.vue.d.ts +62 -0
  53. package/dist/vue/KvBorrowerImage2.js +106 -0
  54. package/dist/vue/KvButton.js +20 -164
  55. package/dist/vue/KvButton.vue.d.ts +94 -0
  56. package/dist/vue/KvButton2.js +149 -0
  57. package/dist/vue/KvCardFrame.js +12 -74
  58. package/dist/vue/KvCardFrame.vue.d.ts +86 -0
  59. package/dist/vue/KvCardFrame2.js +67 -0
  60. package/dist/vue/KvCarousel.css +1 -1
  61. package/dist/vue/KvCarousel.js +55 -192
  62. package/dist/vue/KvCarousel.vue.d.ts +135 -0
  63. package/dist/vue/KvCarousel2.js +142 -0
  64. package/dist/vue/KvCartModal.css +1 -1
  65. package/dist/vue/KvCartModal.js +31 -131
  66. package/dist/vue/KvCartModal.vue.d.ts +163 -0
  67. package/dist/vue/KvCartModal2.js +106 -0
  68. package/dist/vue/KvCartPill.js +12 -51
  69. package/dist/vue/KvCartPill.vue.d.ts +52 -0
  70. package/dist/vue/KvCartPill2.js +45 -0
  71. package/dist/vue/KvCheckbox.css +1 -1
  72. package/dist/vue/KvCheckbox.js +30 -126
  73. package/dist/vue/KvCheckbox.vue.d.ts +90 -0
  74. package/dist/vue/KvCheckbox2.js +102 -0
  75. package/dist/vue/KvCheckoutReceipt.css +1 -1
  76. package/dist/vue/KvCheckoutReceipt.js +120 -199
  77. package/dist/vue/KvCheckoutReceipt.vue.d.ts +164 -0
  78. package/dist/vue/KvCheckoutReceipt2.js +85 -0
  79. package/dist/vue/KvChip.js +12 -29
  80. package/dist/vue/KvChip.vue.d.ts +22 -0
  81. package/dist/vue/KvChip2.js +22 -0
  82. package/dist/vue/KvClassicLoanCard.css +1 -1
  83. package/dist/vue/KvClassicLoanCard.js +83 -351
  84. package/dist/vue/KvClassicLoanCard.vue.d.ts +2120 -0
  85. package/dist/vue/KvClassicLoanCard2.js +281 -0
  86. package/dist/vue/KvCommentsAdd.css +1 -1
  87. package/dist/vue/KvCommentsAdd.js +34 -81
  88. package/dist/vue/KvCommentsAdd.vue.d.ts +296 -0
  89. package/dist/vue/KvCommentsAdd2.js +57 -0
  90. package/dist/vue/KvCommentsContainer.js +15 -66
  91. package/dist/vue/KvCommentsContainer.vue.d.ts +954 -0
  92. package/dist/vue/KvCommentsContainer2.js +58 -0
  93. package/dist/vue/KvCommentsHeartButton.css +1 -1
  94. package/dist/vue/KvCommentsHeartButton.js +12 -51
  95. package/dist/vue/KvCommentsHeartButton.vue.d.ts +42 -0
  96. package/dist/vue/KvCommentsHeartButton2.js +44 -0
  97. package/dist/vue/KvCommentsList.js +9 -51
  98. package/dist/vue/KvCommentsList.vue.d.ts +619 -0
  99. package/dist/vue/KvCommentsList2.js +46 -0
  100. package/dist/vue/KvCommentsListItem.js +62 -186
  101. package/dist/vue/KvCommentsListItem.vue.d.ts +571 -0
  102. package/dist/vue/KvCommentsListItem2.js +135 -0
  103. package/dist/vue/KvCommentsReplyButton.css +1 -1
  104. package/dist/vue/KvCommentsReplyButton.js +8 -17
  105. package/dist/vue/KvCommentsReplyButton.vue.d.ts +98 -0
  106. package/dist/vue/KvCommentsReplyButton2.js +13 -0
  107. package/dist/vue/KvCompactLoanCard.css +1 -1
  108. package/dist/vue/KvCompactLoanCard.js +71 -327
  109. package/dist/vue/KvCompactLoanCard.vue.d.ts +1272 -0
  110. package/dist/vue/KvCompactLoanCard2.js +269 -0
  111. package/dist/vue/KvContentfulImg.js +51 -164
  112. package/dist/vue/KvContentfulImg.vue.d.ts +107 -0
  113. package/dist/vue/KvContentfulImg2.js +119 -0
  114. package/dist/vue/KvCountdownTimer.js +8 -28
  115. package/dist/vue/KvCountdownTimer.vue.d.ts +15 -0
  116. package/dist/vue/KvCountdownTimer2.js +26 -0
  117. package/dist/vue/KvDatePicker.js +21 -101
  118. package/dist/vue/KvDatePicker.vue.d.ts +58 -0
  119. package/dist/vue/KvDatePicker2.js +86 -0
  120. package/dist/vue/KvExpandable.js +9 -56
  121. package/dist/vue/KvExpandable.vue.d.ts +53 -0
  122. package/dist/vue/KvExpandable2.js +52 -0
  123. package/dist/vue/KvExpandableQuestion.js +23 -82
  124. package/dist/vue/KvExpandableQuestion.vue.d.ts +124 -0
  125. package/dist/vue/KvExpandableQuestion2.js +65 -0
  126. package/dist/vue/KvFlag.css +1 -1
  127. package/dist/vue/KvFlag.js +16 -617
  128. package/dist/vue/KvFlag.vue.d.ts +66 -0
  129. package/dist/vue/KvFlag2.js +606 -0
  130. package/dist/vue/KvGrid.js +7 -18
  131. package/dist/vue/KvGrid.vue.d.ts +14 -0
  132. package/dist/vue/KvGrid2.js +15 -0
  133. package/dist/vue/KvIconBag.js +12 -18
  134. package/dist/vue/KvIconBag.vue.d.ts +14 -0
  135. package/dist/vue/KvIconBag2.js +11 -0
  136. package/dist/vue/KvImpactDashboardHeader.vue.d.ts +17 -0
  137. package/dist/vue/KvImpactVerticalSelector.js +31 -110
  138. package/dist/vue/KvImpactVerticalSelector.vue.d.ts +278 -0
  139. package/dist/vue/KvImpactVerticalSelector2.js +85 -0
  140. package/dist/vue/KvInlineActivityCard.js +15 -44
  141. package/dist/vue/KvInlineActivityCard.vue.d.ts +71 -0
  142. package/dist/vue/KvInlineActivityCard2.js +35 -0
  143. package/dist/vue/KvInlineActivityFeed.css +1 -1
  144. package/dist/vue/KvInlineActivityFeed.js +11 -23
  145. package/dist/vue/KvInlineActivityFeed.vue.d.ts +85 -0
  146. package/dist/vue/KvInlineActivityFeed2.js +17 -0
  147. package/dist/vue/KvIntroductionLoanCard.css +1 -1
  148. package/dist/vue/KvIntroductionLoanCard.js +111 -309
  149. package/dist/vue/KvIntroductionLoanCard.vue.d.ts +617 -0
  150. package/dist/vue/KvIntroductionLoanCard2.js +209 -0
  151. package/dist/vue/KvLendAmountButton.js +9 -53
  152. package/dist/vue/KvLendAmountButton.vue.d.ts +140 -0
  153. package/dist/vue/KvLendAmountButton2.js +48 -0
  154. package/dist/vue/KvLendCta.css +1 -1
  155. package/dist/vue/KvLendCta.js +150 -530
  156. package/dist/vue/KvLendCta.vue.d.ts +583 -0
  157. package/dist/vue/KvLendCta2.js +387 -0
  158. package/dist/vue/KvLightbox.js +37 -148
  159. package/dist/vue/KvLightbox.vue.d.ts +77 -0
  160. package/dist/vue/KvLightbox2.js +117 -0
  161. package/dist/vue/KvLineGraph.js +25 -58
  162. package/dist/vue/KvLineGraph.vue.d.ts +35 -0
  163. package/dist/vue/KvLineGraph2.js +39 -0
  164. package/dist/vue/KvLoadingPlaceholder.vue.d.ts +2 -0
  165. package/dist/vue/KvLoadingSpinner.js +9 -34
  166. package/dist/vue/KvLoadingSpinner.vue.d.ts +27 -0
  167. package/dist/vue/KvLoadingSpinner2.js +29 -0
  168. package/dist/vue/KvLoanActivities.css +1 -1
  169. package/dist/vue/KvLoanActivities.js +37 -179
  170. package/dist/vue/KvLoanActivities.vue.d.ts +853 -0
  171. package/dist/vue/KvLoanActivities2.js +151 -0
  172. package/dist/vue/KvLoanBookmark.js +14 -40
  173. package/dist/vue/KvLoanBookmark.vue.d.ts +32 -0
  174. package/dist/vue/KvLoanBookmark2.js +32 -0
  175. package/dist/vue/KvLoanCallouts.css +1 -1
  176. package/dist/vue/KvLoanCallouts.js +10 -17
  177. package/dist/vue/KvLoanCallouts.vue.d.ts +18 -0
  178. package/dist/vue/KvLoanCallouts2.js +12 -0
  179. package/dist/vue/KvLoanInfoCard.js +20 -19
  180. package/dist/vue/KvLoanProgressGroup.css +1 -1
  181. package/dist/vue/KvLoanProgressGroup.js +18 -57
  182. package/dist/vue/KvLoanProgressGroup.vue.d.ts +108 -0
  183. package/dist/vue/KvLoanProgressGroup2.js +44 -0
  184. package/dist/vue/KvLoanTag.js +15 -103
  185. package/dist/vue/KvLoanTag.vue.d.ts +46 -0
  186. package/dist/vue/KvLoanTag2.js +94 -0
  187. package/dist/vue/KvLoanTeamPick.vue.d.ts +2 -0
  188. package/dist/vue/KvLoanUse.js +12 -100
  189. package/dist/vue/KvLoanUse.vue.d.ts +120 -0
  190. package/dist/vue/KvLoanUse2.js +95 -0
  191. package/dist/vue/KvLogo.vue.d.ts +2 -0
  192. package/dist/vue/KvMap.js +13 -381
  193. package/dist/vue/KvMap.vue.d.ts +213 -0
  194. package/dist/vue/KvMap2.js +376 -0
  195. package/dist/vue/KvMaterialIcon.js +10 -20
  196. package/dist/vue/KvMaterialIcon.vue.d.ts +14 -0
  197. package/dist/vue/KvMaterialIcon2.js +15 -0
  198. package/dist/vue/KvPageContainer.js +9 -8
  199. package/dist/vue/KvPageContainer.vue.d.ts +2 -0
  200. package/dist/vue/KvPageContainer2.js +4 -0
  201. package/dist/vue/KvPagination.js +38 -138
  202. package/dist/vue/KvPagination.vue.d.ts +107 -0
  203. package/dist/vue/KvPagination2.js +105 -0
  204. package/dist/vue/KvPieChart.css +1 -1
  205. package/dist/vue/KvPieChart.js +49 -128
  206. package/dist/vue/KvPieChart.vue.d.ts +47 -0
  207. package/dist/vue/KvPieChart2.js +85 -0
  208. package/dist/vue/KvPill.js +9 -19
  209. package/dist/vue/KvPill.vue.d.ts +23 -0
  210. package/dist/vue/KvPill2.js +15 -0
  211. package/dist/vue/KvPopper.js +14 -122
  212. package/dist/vue/KvPopper.vue.d.ts +80 -0
  213. package/dist/vue/KvPopper2.js +113 -0
  214. package/dist/vue/KvProgressBar.js +17 -112
  215. package/dist/vue/KvProgressBar.vue.d.ts +70 -0
  216. package/dist/vue/KvProgressBar2.js +101 -0
  217. package/dist/vue/KvPulsingDot.css +1 -1
  218. package/dist/vue/KvPulsingDot.js +11 -25
  219. package/dist/vue/KvPulsingDot.vue.d.ts +23 -0
  220. package/dist/vue/KvPulsingDot2.js +19 -0
  221. package/dist/vue/KvRadio.js +23 -106
  222. package/dist/vue/KvRadio.vue.d.ts +62 -0
  223. package/dist/vue/KvRadio2.js +89 -0
  224. package/dist/vue/KvSecondaryNav.css +1 -1
  225. package/dist/vue/KvSecondaryNav.js +46 -122
  226. package/dist/vue/KvSecondaryNav.vue.d.ts +117 -0
  227. package/dist/vue/KvSecondaryNav2.js +82 -0
  228. package/dist/vue/KvSelect.css +1 -1
  229. package/dist/vue/KvSelect.js +18 -78
  230. package/dist/vue/KvSelect.vue.d.ts +58 -0
  231. package/dist/vue/KvSelect2.js +66 -0
  232. package/dist/vue/KvSideSheet.js +44 -262
  233. package/dist/vue/KvSideSheet.vue.d.ts +136 -0
  234. package/dist/vue/KvSideSheet2.js +224 -0
  235. package/dist/vue/KvSwitch.js +23 -76
  236. package/dist/vue/KvSwitch.vue.d.ts +34 -0
  237. package/dist/vue/KvSwitch2.js +59 -0
  238. package/dist/vue/KvTab.js +15 -57
  239. package/dist/vue/KvTab.vue.d.ts +34 -0
  240. package/dist/vue/KvTab2.js +48 -0
  241. package/dist/vue/KvTabPanel.js +14 -36
  242. package/dist/vue/KvTabPanel.vue.d.ts +14 -0
  243. package/dist/vue/KvTabPanel2.js +28 -0
  244. package/dist/vue/KvTabs.js +21 -75
  245. package/dist/vue/KvTabs.vue.d.ts +22 -0
  246. package/dist/vue/KvTabs2.js +60 -0
  247. package/dist/vue/KvTextInput.js +28 -148
  248. package/dist/vue/KvTextInput.vue.d.ts +105 -0
  249. package/dist/vue/KvTextInput2.js +126 -0
  250. package/dist/vue/KvTextLink.js +13 -76
  251. package/dist/vue/KvTextLink.vue.d.ts +64 -0
  252. package/dist/vue/KvTextLink2.js +68 -0
  253. package/dist/vue/KvThemeProvider.js +8 -59
  254. package/dist/vue/KvThemeProvider.vue.d.ts +23 -0
  255. package/dist/vue/KvThemeProvider2.js +55 -0
  256. package/dist/vue/KvToast.js +32 -69
  257. package/dist/vue/KvToast.vue.d.ts +31 -0
  258. package/dist/vue/KvToast2.js +43 -0
  259. package/dist/vue/KvTooltip.css +1 -1
  260. package/dist/vue/KvTooltip.js +27 -123
  261. package/dist/vue/KvTooltip.vue.d.ts +2 -0
  262. package/dist/vue/KvTooltip2.js +103 -0
  263. package/dist/vue/KvTreeMapChart.css +1 -1
  264. package/dist/vue/KvTreeMapChart.js +28 -156
  265. package/dist/vue/KvTreeMapChart.vue.d.ts +60 -0
  266. package/dist/vue/KvTreeMapChart2.js +133 -0
  267. package/dist/vue/KvUserAvatar.js +28 -110
  268. package/dist/vue/KvUserAvatar.vue.d.ts +55 -0
  269. package/dist/vue/KvUserAvatar2.js +88 -0
  270. package/dist/vue/KvUtilityMenu.js +19 -95
  271. package/dist/vue/KvUtilityMenu.vue.d.ts +104 -0
  272. package/dist/vue/KvUtilityMenu2.js +81 -0
  273. package/dist/vue/KvVerticalCarousel.js +40 -137
  274. package/dist/vue/KvVerticalCarousel.vue.d.ts +90 -0
  275. package/dist/vue/KvVerticalCarousel2.js +103 -0
  276. package/dist/vue/KvVotingCard.css +1 -1
  277. package/dist/vue/KvVotingCard.js +31 -88
  278. package/dist/vue/KvVotingCard.vue.d.ts +249 -0
  279. package/dist/vue/KvVotingCard2.js +63 -0
  280. package/dist/vue/KvVotingCardV2.js +35 -90
  281. package/dist/vue/KvVotingCardV2.vue.d.ts +308 -0
  282. package/dist/vue/KvVotingCardV22.js +61 -0
  283. package/dist/vue/KvWideLoanCard.css +1 -1
  284. package/dist/vue/KvWideLoanCard.js +66 -274
  285. package/dist/vue/KvWideLoanCard.vue.d.ts +1191 -0
  286. package/dist/vue/KvWideLoanCard2.js +220 -0
  287. package/dist/vue/KvWwwHeader/KvHeaderAboutMenu.js +34 -38
  288. package/dist/vue/KvWwwHeader/KvHeaderAboutMenu.vue.d.ts +20 -0
  289. package/dist/vue/KvWwwHeader/KvHeaderAboutMenu2.js +9 -0
  290. package/dist/vue/KvWwwHeader/KvHeaderDropdownLink.js +20 -83
  291. package/dist/vue/KvWwwHeader/KvHeaderDropdownLink.vue.d.ts +91 -0
  292. package/dist/vue/KvWwwHeader/KvHeaderDropdownLink2.js +69 -0
  293. package/dist/vue/KvWwwHeader/KvHeaderLinkBar.css +1 -1
  294. package/dist/vue/KvWwwHeader/KvHeaderLinkBar.js +77 -248
  295. package/dist/vue/KvWwwHeader/KvHeaderLinkBar.vue.d.ts +1071 -0
  296. package/dist/vue/KvWwwHeader/KvHeaderLinkBar2.js +178 -0
  297. package/dist/vue/KvWwwHeader/KvHeaderLogo.js +8 -12
  298. package/dist/vue/KvWwwHeader/KvHeaderLogo.vue.d.ts +4 -0
  299. package/dist/vue/KvWwwHeader/KvHeaderLogo2.js +9 -0
  300. package/dist/vue/KvWwwHeader/KvHeaderMenuLink.vue.d.ts +17 -0
  301. package/dist/vue/KvWwwHeader/KvHeaderMobileMenu.css +1 -1
  302. package/dist/vue/KvWwwHeader/KvHeaderMobileMenu.js +37 -91
  303. package/dist/vue/KvWwwHeader/KvHeaderMobileMenu.vue.d.ts +162 -0
  304. package/dist/vue/KvWwwHeader/KvHeaderMobileMenu2.js +59 -0
  305. package/dist/vue/KvWwwHeader/KvHeaderMyKivaMenu.js +36 -58
  306. package/dist/vue/KvWwwHeader/KvHeaderMyKivaMenu.vue.d.ts +59 -0
  307. package/dist/vue/KvWwwHeader/KvHeaderMyKivaMenu2.js +27 -0
  308. package/dist/vue/KvWwwHeader/KvHeaderTakeActionMenu.js +20 -24
  309. package/dist/vue/KvWwwHeader/KvHeaderTakeActionMenu.vue.d.ts +20 -0
  310. package/dist/vue/KvWwwHeader/KvHeaderTakeActionMenu2.js +9 -0
  311. package/dist/vue/KvWwwHeader/LendMenu/KvLendListMenu.css +1 -1
  312. package/dist/vue/KvWwwHeader/LendMenu/KvLendListMenu.js +105 -181
  313. package/dist/vue/KvWwwHeader/LendMenu/KvLendListMenu.vue.d.ts +319 -0
  314. package/dist/vue/KvWwwHeader/LendMenu/KvLendListMenu2.js +82 -0
  315. package/dist/vue/KvWwwHeader/LendMenu/KvLendMegaMenu.css +1 -1
  316. package/dist/vue/KvWwwHeader/LendMenu/KvLendMegaMenu.js +93 -173
  317. package/dist/vue/KvWwwHeader/LendMenu/KvLendMegaMenu.vue.d.ts +166 -0
  318. package/dist/vue/KvWwwHeader/LendMenu/KvLendMegaMenu2.js +86 -0
  319. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenu.js +17 -157
  320. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenu.vue.d.ts +506 -0
  321. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenu2.js +145 -0
  322. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenuCountryList.css +1 -1
  323. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenuCountryList.js +11 -18
  324. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenuCountryList.vue.d.ts +20 -0
  325. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenuCountryList2.js +12 -0
  326. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenuSearchList.js +10 -16
  327. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenuSearchList.vue.d.ts +20 -0
  328. package/dist/vue/KvWwwHeader/LendMenu/KvLendMenuSearchList2.js +11 -0
  329. package/dist/vue/KvWwwHeader.css +1 -1
  330. package/dist/vue/KvWwwHeader.js +35 -148
  331. package/dist/vue/KvWwwHeader.vue.d.ts +4430 -0
  332. package/dist/vue/KvWwwHeader2.js +119 -0
  333. package/dist/vue/index.d.ts +86 -0
  334. package/package.json +35 -33
  335. package/tsconfig.json +32 -0
  336. package/vite.config.ts +84 -0
package/dist/vue/KvMap.js CHANGED
@@ -1,390 +1,22 @@
1
- import n from "@kiva/kv-tokens";
2
- import { generateMapMarkers as l, animationCoordinator as h, getCountryColor as r } from "../utils/mapUtils.js";
3
- import { openBlock as c, createElementBlock as d, normalizeStyle as m, createElementVNode as p } from "vue";
1
+ import l from "./KvMap2.js";
2
+ import { openBlock as r, createElementBlock as o, normalizeStyle as a, createElementVNode as c } from "vue";
4
3
  import "./KvMap.css";
5
- import u from "../_virtual/_plugin-vue_export-helper.js";
6
- const f = {
7
- name: "KvMap",
8
- props: {
9
- /**
10
- * Aspect Ration for computed map dimensions
11
- * We'll divide the container width by this to determine the height
12
- */
13
- aspectRatio: {
14
- type: Number,
15
- default: 1
16
- },
17
- /**
18
- * Control how quickly the autoZoom occurs
19
- */
20
- autoZoomDelay: {
21
- type: Number,
22
- default: 1500
23
- },
24
- /**
25
- * Set the height to override aspect ratio driven and/or default dimensions
26
- */
27
- height: {
28
- type: Number,
29
- default: null
30
- },
31
- /**
32
- * Setting this initialZoom will zoom the map from initialZoom to zoom when the map enters the viewport
33
- */
34
- initialZoom: {
35
- type: Number,
36
- default: null
37
- },
38
- /**
39
- * Set the center point latitude
40
- */
41
- lat: {
42
- type: Number,
43
- default: null
44
- },
45
- /**
46
- * Set the center point longitude
47
- */
48
- long: {
49
- type: Number,
50
- default: null
51
- },
52
- /**
53
- * Set this if there are more than one map on the page
54
- */
55
- mapId: {
56
- type: Number,
57
- default: 0
58
- },
59
- /**
60
- * Force use of Leaflet
61
- */
62
- useLeaflet: {
63
- type: Boolean,
64
- default: !1
65
- },
66
- /**
67
- * Set the width to override aspect ratio driven and/or default dimensions
68
- */
69
- width: {
70
- type: Number,
71
- default: null
72
- },
73
- /**
74
- * Default zoom level
75
- */
76
- zoomLevel: {
77
- type: Number,
78
- default: 4
79
- },
80
- /**
81
- * Borrower points object.
82
- * If this object is present, the advanced animation will be triggered
83
- * Sample object:
84
- * {
85
- borrowerPoints: [
86
- {
87
- image: 'https://www.kiva.org/img/w80h80fz50/e60a3d61ff052d60991c5d6bbf4a45d3.webp',
88
- location: [-77.032, 38.913],
89
- },
90
- {
91
- image: 'https://www.kiva.org/img/w80h80fz50/6101929097c6e5de48232a4d1ae3b71c.webp',
92
- location: [41.402, 7.160],
93
- },
94
- {
95
- image: 'https://www.kiva.org/img/w80h80fz50/11e018ee3d8b9c5adee459c16a29d264.webp',
96
- location: [-73.356596, 3.501],
97
- },
98
- ],
99
- * }
100
- */
101
- advancedAnimation: {
102
- type: Object,
103
- required: !1,
104
- default: () => ({})
105
- },
106
- /**
107
- * Show the zoom control
108
- */
109
- showZoomControl: {
110
- type: Boolean,
111
- default: !1
112
- },
113
- /**
114
- * Allow dragging of the map
115
- */
116
- allowDragging: {
117
- type: Boolean,
118
- default: !1
119
- },
120
- /**
121
- * Show labels on the map
122
- * Working for leaflet only
123
- */
124
- showLabels: {
125
- type: Boolean,
126
- default: !0
127
- },
128
- /**
129
- * Lender data for the map
130
- * Working for leaflet only
131
- */
132
- countriesData: {
133
- type: Array,
134
- default: () => []
135
- },
136
- /**
137
- * Show fundraising loans
138
- * Working for leaflet only
139
- */
140
- showFundraisingLoans: {
141
- type: Boolean,
142
- default: !1
143
- },
144
- /**
145
- * Show tooltips on fundraising loan circles
146
- * Working for leaflet only
147
- */
148
- showTooltips: {
149
- type: Boolean,
150
- default: !0
151
- },
152
- /**
153
- * Default base color for countries without loans
154
- */
155
- defaultBaseColor: {
156
- type: String,
157
- default: null
158
- }
159
- },
160
- data() {
161
- return {
162
- hasWebGL: !1,
163
- leafletReady: !1,
164
- mapInstance: null,
165
- mapLibreReady: !1,
166
- mapLoaded: !1,
167
- zoomActive: !1,
168
- countriesBorders: {}
169
- };
170
- },
171
- computed: {
172
- mapDimensions() {
173
- var a;
174
- const e = (a = this.$el) == null ? void 0 : a.getBoundingClientRect(), t = e ? `${e.width / this.aspectRatio}px` : "300px", i = e ? `${e.width}px` : "100%";
175
- return {
176
- height: this.height ? `${this.height}px` : t,
177
- width: this.width ? `${this.width}px` : i,
178
- paddingBottom: this.height ? `${this.height}px` : `${100 / this.aspectRatio}%`
179
- };
180
- },
181
- refString() {
182
- return `mapholder${this.mapId}`;
183
- }
184
- },
185
- watch: {
186
- lat(e, t) {
187
- t === null && this.long && !this.mapLibreReady && !this.leafletReady && this.initializeMap();
188
- },
189
- long(e, t) {
190
- t === null && this.lat && !this.mapLibreReady && !this.leafletReady && this.initializeMap();
191
- },
192
- showFundraisingLoans() {
193
- this.mapInstance && (this.mapInstance.remove(), this.initializeLeaflet());
194
- }
195
- },
196
- async mounted() {
197
- this.countriesData && (this.countriesBorders = await import("../data/ne_110m_admin_0_countries.json.js")), !this.mapLibreReady && !this.leafletReady && this.initializeMap();
198
- },
199
- beforeDestroy() {
200
- this.mapInstance && (!this.hasWebGL && !this.leafletReady && this.mapInstance.off(), this.mapInstance.remove()), this.destroyWrapperObserver();
201
- },
202
- methods: {
203
- activateZoom(e = !1) {
204
- const { mapInstance: t, hasWebGL: i, mapLibreReady: a } = this, s = t.getZoom();
205
- if (!e && s === this.zoomLevel || e && s === this.initialZoom) return !1;
206
- this.zoomActive = !0;
207
- const o = window.setTimeout(() => {
208
- i && a ? t.zoomTo(
209
- e ? this.initialZoom : this.zoomLevel,
210
- { duration: 1200 }
211
- ) : t.setZoom(e ? this.initialZoom : this.zoomLevel), clearTimeout(o), this.zoomActive = !1;
212
- }, this.autoZoomDelay);
213
- },
214
- createWrapperObserver() {
215
- var e;
216
- this.wrapperObserver = this.createIntersectionObserver({
217
- targets: [(e = this.$refs) == null ? void 0 : e[this.refString]],
218
- callback: (t) => {
219
- t.forEach((i) => {
220
- var a, s;
221
- i.target === ((a = this.$refs) == null ? void 0 : a[this.refString]) && !this.zoomActive && i.intersectionRatio > 0 && (this.initialZoom !== null && this.activateZoom(), (s = this.advancedAnimation) != null && s.borrowerPoints && this.animateMap());
222
- });
223
- }
224
- });
225
- },
226
- destroyWrapperObserver() {
227
- this.wrapperObserver && this.wrapperObserver.disconnect();
228
- },
229
- checkWebGL() {
230
- if (this.useLeaflet || typeof document > "u") return !1;
231
- const e = document.createElement("canvas"), t = e.getContext("webgl") || e.getContext("experimental-webgl");
232
- return t && t instanceof WebGLRenderingContext ? (this.hasWebGL = !0, !0) : !1;
233
- },
234
- initializeMap() {
235
- const e = document.createElement("script"), t = document.createElement("link");
236
- e.setAttribute("async", !0), e.setAttribute("defer", !0), t.setAttribute("rel", "stylesheet"), this.checkWebGL() ? (e.setAttribute("vmid", `maplibregljs${this.mapId}`), t.setAttribute("vmid", `maplibreglcss${this.mapId}`), e.setAttribute("src", "https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js"), t.setAttribute("href", "https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css"), this.testDelayedGlobalLibrary("maplibregl").then((i) => {
237
- i.loaded && !this.mapLoaded && !this.useLeaflet && this.lat && this.long && (this.initializeMapLibre(), this.mapLibreReady = !0);
238
- })) : (e.setAttribute("vmid", `leafletjs${this.mapId}`), t.setAttribute("vmid", `leaftletcss${this.mapId}`), e.setAttribute("src", "https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"), t.setAttribute("href", "https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"), this.testDelayedGlobalLibrary("L").then((i) => {
239
- i.loaded && !this.mapLoaded && this.lat && this.long && (this.initializeLeaflet(), this.leafletReady = !0);
240
- })), document.head.appendChild(e), document.head.appendChild(t);
241
- },
242
- initializeLeaflet() {
243
- this.mapInstance = L.map(`kv-map-holder-${this.mapId}`, {
244
- center: [this.lat, this.long],
245
- zoom: this.initialZoom || this.zoomLevel,
246
- // todo make props for the following options
247
- dragging: this.allowDragging,
248
- zoomControl: this.showZoomControl,
249
- animate: !0,
250
- scrollWheelZoom: !1,
251
- doubleClickZoom: !1,
252
- attributionControl: !1
253
- });
254
- let e = "https://api.maptiler.com/maps/landscape/{z}/{x}/{y}.png?key=n1Mz5ziX3k6JfdjFe7mx";
255
- this.showLabels && (e = "https://api.maptiler.com/maps/bright/{z}/{x}/{y}.png?key=n1Mz5ziX3k6JfdjFe7mx"), L.tileLayer(e, {
256
- tileSize: 512,
257
- zoomOffset: -1,
258
- minZoom: 1,
259
- crossOrigin: !0
260
- }).addTo(this.mapInstance), this.countriesData.length > 0 && (L.geoJson(
261
- this.getCountriesData(),
262
- {
263
- style: this.countryStyle,
264
- onEachFeature: this.onEachCountryFeature
265
- }
266
- ).addTo(this.mapInstance), this.countriesData.forEach((t) => {
267
- if (t.numLoansFundraising > 0 && this.showFundraisingLoans) {
268
- const i = L.circle([t.lat, t.long], {
269
- color: n.colors.black,
270
- weight: 1,
271
- fillColor: n.colors.brand[900],
272
- fillOpacity: 1,
273
- radius: 13e4
274
- }).addTo(this.mapInstance), a = `Click to see ${t.numLoansFundraising} fundraising loans in ${t.label}`;
275
- i.bindTooltip(a), i.on("click", () => {
276
- this.circleMapClicked(t.isoCode);
277
- });
278
- }
279
- })), this.mapLoaded = !0, this.initialZoom !== null && this.createWrapperObserver();
280
- },
281
- initializeMapLibre() {
282
- let e = "https://api.maptiler.com/maps/landscape/style.json?key=n1Mz5ziX3k6JfdjFe7mx";
283
- this.showLabels && (e = "https://api.maptiler.com/maps/bright/style.json?key=n1Mz5ziX3k6JfdjFe7mx"), this.mapInstance = new maplibregl.Map({
284
- container: `kv-map-holder-${this.mapId}`,
285
- style: e,
286
- center: [this.long, this.lat],
287
- zoom: this.initialZoom || this.zoomLevel,
288
- attributionControl: !1,
289
- dragPan: this.allowDragging,
290
- scrollZoom: !1,
291
- doubleClickZoom: !1,
292
- dragRotate: !1
293
- }), this.showZoomControl && this.mapInstance.addControl(new maplibregl.NavigationControl()), this.mapInstance.on("load", () => {
294
- var t;
295
- this.mapLoaded = !0, (this.initialZoom !== null || (t = this.advancedAnimation) != null && t.borrowerPoints) && this.createWrapperObserver();
296
- });
297
- },
298
- animateMap() {
299
- this.mapInstance.style.stylesheet.layers.forEach((e) => {
300
- e.type === "symbol" && this.mapInstance.removeLayer(e.id);
301
- }), l(this.mapInstance, this.advancedAnimation.borrowerPoints), setTimeout(() => {
302
- h(this.mapInstance, this.advancedAnimation.borrowerPoints).then(() => {
303
- this.mapInstance.dragPan.enable(), this.mapInstance.scrollZoom.enable(), this.mapInstance.scrollZoom.enable(), this.mapInstance.easeTo({
304
- center: [this.long, this.lat],
305
- zoom: this.initialZoom || this.zoomLevel
306
- });
307
- });
308
- }, 500);
309
- },
310
- checkIntersectionObserverSupport() {
311
- return !(typeof window > "u" || !("IntersectionObserver" in window) || !("IntersectionObserverEntry" in window) || !("intersectionRatio" in window.IntersectionObserverEntry.prototype));
312
- },
313
- createIntersectionObserver({ callback: e, options: t, targets: i } = {}) {
314
- if (this.checkIntersectionObserverSupport()) {
315
- const a = new IntersectionObserver(e, t);
316
- return i.forEach((s) => a.observe(s)), a;
317
- }
318
- },
319
- testDelayedGlobalLibrary(e, t = 3e3) {
320
- return new Promise((i, a) => {
321
- typeof window > "u" && a(new Error("window object not available"));
322
- let s;
323
- const o = window.setInterval(() => {
324
- typeof window[e] < "u" && (clearInterval(o), clearTimeout(s), i({ loaded: !0 }));
325
- }, 100);
326
- s = window.setTimeout(() => {
327
- clearInterval(o), clearTimeout(s), i({ loaded: !1 });
328
- }, t);
329
- });
330
- },
331
- getCountriesData() {
332
- const e = this.countriesBorders.features ?? [];
333
- return e.forEach((t, i) => {
334
- const a = this.countriesData.find((s) => s.isoCode === t.properties.iso_a2);
335
- a && (e[i].lenderLoans = a.value, e[i].numLoansFundraising = a.numLoansFundraising);
336
- }), this.countriesBorders;
337
- },
338
- countryStyle(e) {
339
- return {
340
- color: n.colors.white,
341
- // eslint-disable-next-line max-len
342
- fillColor: r(e.lenderLoans, this.countriesData, n, this.defaultBaseColor),
343
- weight: 1,
344
- fillOpacity: 1
345
- };
346
- },
347
- onEachCountryFeature(e, t) {
348
- if (!this.showTooltips) return;
349
- const i = e.lenderLoans ? `${e.lenderLoans} loan${e.lenderLoans > 1 ? "s" : ""}` : "0 loans", a = `${e.properties.name} <br/> ${i}`;
350
- t.bindTooltip(a, {
351
- sticky: !0
352
- }), t.on({
353
- mouseover: this.highlightFeature,
354
- mouseout: this.resetHighlight
355
- });
356
- },
357
- highlightFeature(e) {
358
- e.target.setStyle({
359
- fillColor: n.colors.gray[500]
360
- });
361
- },
362
- resetHighlight(e) {
363
- const t = e.target, { feature: i } = t;
364
- t.setStyle({
365
- // eslint-disable-next-line max-len
366
- fillColor: r(i.lenderLoans, this.countriesData, n, this.defaultBaseColor)
367
- });
368
- },
369
- circleMapClicked(e) {
370
- this.$emit("country-lend-filter", e);
371
- }
372
- }
373
- }, b = ["id"];
374
- function g(e, t, i, a, s, o) {
375
- return c(), d("div", {
4
+ import i from "../_virtual/_plugin-vue_export-helper.js";
5
+ const s = ["id"];
6
+ function n(m, f, t, d, p, e) {
7
+ return r(), o("div", {
376
8
  class: "tw-relative tw-block tw-w-full",
377
- style: m(o.mapDimensions)
9
+ style: a(e.mapDimensions)
378
10
  }, [
379
- p("div", {
380
- id: `kv-map-holder-${i.mapId}`,
381
- ref: o.refString,
11
+ c("div", {
12
+ id: `kv-map-holder-${t.mapId}`,
13
+ ref: e.refString,
382
14
  class: "tw-w-full tw-h-full tw-bg-black",
383
15
  style: { position: "absolute" }
384
- }, null, 8, b)
16
+ }, null, 8, s)
385
17
  ], 4);
386
18
  }
387
- const z = /* @__PURE__ */ u(f, [["render", g]]);
19
+ const v = /* @__PURE__ */ i(l, [["render", n]]);
388
20
  export {
389
- z as default
21
+ v as default
390
22
  };
@@ -0,0 +1,213 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ aspectRatio: {
3
+ type: NumberConstructor;
4
+ default: number;
5
+ };
6
+ autoZoomDelay: {
7
+ type: NumberConstructor;
8
+ default: number;
9
+ };
10
+ height: {
11
+ type: NumberConstructor;
12
+ default: any;
13
+ };
14
+ initialZoom: {
15
+ type: NumberConstructor;
16
+ default: any;
17
+ };
18
+ lat: {
19
+ type: NumberConstructor;
20
+ default: any;
21
+ };
22
+ long: {
23
+ type: NumberConstructor;
24
+ default: any;
25
+ };
26
+ mapId: {
27
+ type: NumberConstructor;
28
+ default: number;
29
+ };
30
+ useLeaflet: {
31
+ type: BooleanConstructor;
32
+ default: boolean;
33
+ };
34
+ width: {
35
+ type: NumberConstructor;
36
+ default: any;
37
+ };
38
+ zoomLevel: {
39
+ type: NumberConstructor;
40
+ default: number;
41
+ };
42
+ advancedAnimation: {
43
+ type: ObjectConstructor;
44
+ required: false;
45
+ default: () => {};
46
+ };
47
+ showZoomControl: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
51
+ allowDragging: {
52
+ type: BooleanConstructor;
53
+ default: boolean;
54
+ };
55
+ showLabels: {
56
+ type: BooleanConstructor;
57
+ default: boolean;
58
+ };
59
+ countriesData: {
60
+ type: ArrayConstructor;
61
+ default: () => any[];
62
+ };
63
+ showFundraisingLoans: {
64
+ type: BooleanConstructor;
65
+ default: boolean;
66
+ };
67
+ showTooltips: {
68
+ type: BooleanConstructor;
69
+ default: boolean;
70
+ };
71
+ defaultBaseColor: {
72
+ type: StringConstructor;
73
+ default: any;
74
+ };
75
+ }>, {}, {
76
+ hasWebGL: boolean;
77
+ leafletReady: boolean;
78
+ mapInstance: any;
79
+ mapLibreReady: boolean;
80
+ mapLoaded: boolean;
81
+ zoomActive: boolean;
82
+ countriesBorders: {};
83
+ }, {
84
+ mapDimensions(): {
85
+ height: string;
86
+ width: string;
87
+ paddingBottom: string;
88
+ };
89
+ refString(): string;
90
+ }, {
91
+ activateZoom(zoomOut?: boolean): false;
92
+ createWrapperObserver(): void;
93
+ destroyWrapperObserver(): void;
94
+ checkWebGL(): boolean;
95
+ initializeMap(): void;
96
+ initializeLeaflet(): void;
97
+ initializeMapLibre(): void;
98
+ animateMap(): void;
99
+ checkIntersectionObserverSupport(): boolean;
100
+ createIntersectionObserver({ callback, options, targets, }?: {
101
+ callback?: any;
102
+ options?: any;
103
+ targets?: Element[];
104
+ }): IntersectionObserver;
105
+ testDelayedGlobalLibrary(library: string, timeout?: number): Promise<{
106
+ loaded: boolean;
107
+ }>;
108
+ getCountriesData(): any;
109
+ countryStyle(feature: any): {
110
+ color: any;
111
+ fillColor: string;
112
+ weight: number;
113
+ fillOpacity: number;
114
+ };
115
+ onEachCountryFeature(feature: any, layer: any): void;
116
+ highlightFeature(e: any): void;
117
+ resetHighlight(e: any): void;
118
+ circleMapClicked(countryIso: any): void;
119
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
120
+ aspectRatio: {
121
+ type: NumberConstructor;
122
+ default: number;
123
+ };
124
+ autoZoomDelay: {
125
+ type: NumberConstructor;
126
+ default: number;
127
+ };
128
+ height: {
129
+ type: NumberConstructor;
130
+ default: any;
131
+ };
132
+ initialZoom: {
133
+ type: NumberConstructor;
134
+ default: any;
135
+ };
136
+ lat: {
137
+ type: NumberConstructor;
138
+ default: any;
139
+ };
140
+ long: {
141
+ type: NumberConstructor;
142
+ default: any;
143
+ };
144
+ mapId: {
145
+ type: NumberConstructor;
146
+ default: number;
147
+ };
148
+ useLeaflet: {
149
+ type: BooleanConstructor;
150
+ default: boolean;
151
+ };
152
+ width: {
153
+ type: NumberConstructor;
154
+ default: any;
155
+ };
156
+ zoomLevel: {
157
+ type: NumberConstructor;
158
+ default: number;
159
+ };
160
+ advancedAnimation: {
161
+ type: ObjectConstructor;
162
+ required: false;
163
+ default: () => {};
164
+ };
165
+ showZoomControl: {
166
+ type: BooleanConstructor;
167
+ default: boolean;
168
+ };
169
+ allowDragging: {
170
+ type: BooleanConstructor;
171
+ default: boolean;
172
+ };
173
+ showLabels: {
174
+ type: BooleanConstructor;
175
+ default: boolean;
176
+ };
177
+ countriesData: {
178
+ type: ArrayConstructor;
179
+ default: () => any[];
180
+ };
181
+ showFundraisingLoans: {
182
+ type: BooleanConstructor;
183
+ default: boolean;
184
+ };
185
+ showTooltips: {
186
+ type: BooleanConstructor;
187
+ default: boolean;
188
+ };
189
+ defaultBaseColor: {
190
+ type: StringConstructor;
191
+ default: any;
192
+ };
193
+ }>> & Readonly<{}>, {
194
+ height: number;
195
+ width: number;
196
+ aspectRatio: number;
197
+ long: number;
198
+ autoZoomDelay: number;
199
+ initialZoom: number;
200
+ lat: number;
201
+ mapId: number;
202
+ useLeaflet: boolean;
203
+ zoomLevel: number;
204
+ advancedAnimation: Record<string, any>;
205
+ showZoomControl: boolean;
206
+ allowDragging: boolean;
207
+ showLabels: boolean;
208
+ countriesData: unknown[];
209
+ showFundraisingLoans: boolean;
210
+ showTooltips: boolean;
211
+ defaultBaseColor: string;
212
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
213
+ export default _default;