@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,276 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/mapUtils.js
20
+ var mapUtils_exports = {};
21
+ __export(mapUtils_exports, {
22
+ animationCoordinator: () => animationCoordinator,
23
+ generateMapMarkers: () => generateMapMarkers,
24
+ getCoordinatesBetween: () => getCoordinatesBetween,
25
+ getCountryColor: () => getCountryColor,
26
+ getLoansIntervals: () => getLoansIntervals
27
+ });
28
+ module.exports = __toCommonJS(mapUtils_exports);
29
+ function getRandomInRange(from, to, fixed) {
30
+ return (Math.random() * (to - from) + from).toFixed(fixed) * 1;
31
+ }
32
+ var randomCoordinates = Array.from(
33
+ { length: 20 },
34
+ () => [getRandomInRange(-180, 180, 3), getRandomInRange(-90, 90, 3)]
35
+ );
36
+ var mapColors = [
37
+ 100,
38
+ 300,
39
+ 500,
40
+ 650,
41
+ 800,
42
+ 1e3
43
+ ];
44
+ function getCoordinatesBetween(startCoordinates, endCoordinates, numberOfSteps) {
45
+ if (!startCoordinates || !endCoordinates || !numberOfSteps || numberOfSteps < 1 || !Array.isArray(startCoordinates) || !Array.isArray(endCoordinates) || startCoordinates.length !== 2 || endCoordinates.length !== 2) {
46
+ return [];
47
+ }
48
+ const diffX = endCoordinates[0] - startCoordinates[0];
49
+ const diffY = endCoordinates[1] - startCoordinates[1];
50
+ const sfX = diffX / numberOfSteps;
51
+ const sfY = diffY / numberOfSteps;
52
+ let i = 0;
53
+ let j = 0;
54
+ const lineCoordinates = [];
55
+ while (Math.abs(i) < Math.abs(diffX) || Math.abs(j) < Math.abs(diffY)) {
56
+ lineCoordinates.push([startCoordinates[0] + i, startCoordinates[1] + j]);
57
+ if (Math.abs(i) < Math.abs(diffX)) {
58
+ i += sfX;
59
+ }
60
+ if (Math.abs(j) < Math.abs(diffY)) {
61
+ j += sfY;
62
+ }
63
+ }
64
+ lineCoordinates[lineCoordinates.length - 1] = [endCoordinates[0], endCoordinates[1]];
65
+ return lineCoordinates;
66
+ }
67
+ function animateLines(mapInstance, originPoints, endPoint) {
68
+ const speedFactor = 100;
69
+ return new Promise((resolve) => {
70
+ mapInstance.addSource("endpoint", {
71
+ type: "geojson",
72
+ data: {
73
+ type: "Point",
74
+ coordinates: [
75
+ endPoint[0],
76
+ endPoint[1]
77
+ ]
78
+ }
79
+ });
80
+ const lineFlight = (startCoordinates, endCoordinates, index, lastLine = false) => {
81
+ const lineCoordinates = getCoordinatesBetween(startCoordinates, endCoordinates, speedFactor);
82
+ let animationCounter = 0;
83
+ const geojson = {
84
+ type: "FeatureCollection",
85
+ features: [{
86
+ type: "Feature",
87
+ geometry: {
88
+ type: "LineString",
89
+ coordinates: []
90
+ }
91
+ }]
92
+ };
93
+ mapInstance.addSource(`startPoint${index}`, {
94
+ type: "geojson",
95
+ data: {
96
+ type: "Point",
97
+ coordinates: [
98
+ startCoordinates[0],
99
+ startCoordinates[1]
100
+ ]
101
+ }
102
+ });
103
+ mapInstance.addLayer({
104
+ id: `line-animation${index}`,
105
+ type: "line",
106
+ source: {
107
+ type: "geojson",
108
+ data: geojson
109
+ },
110
+ layout: {
111
+ "line-cap": "round",
112
+ "line-join": "round"
113
+ },
114
+ paint: {
115
+ "line-color": "#277056",
116
+ "line-width": 2
117
+ }
118
+ });
119
+ const animateLine = () => {
120
+ if (animationCounter < lineCoordinates.length) {
121
+ geojson.features[0].geometry.coordinates.push(lineCoordinates[animationCounter]);
122
+ mapInstance.getSource(`line-animation${index}`).setData(geojson);
123
+ requestAnimationFrame(animateLine);
124
+ animationCounter += 1;
125
+ } else {
126
+ const coord = geojson.features[0].geometry.coordinates;
127
+ coord.shift();
128
+ coord.shift();
129
+ if (coord.length > 0) {
130
+ geojson.features[0].geometry.coordinates = coord;
131
+ mapInstance.getSource(`line-animation${index}`).setData(geojson);
132
+ requestAnimationFrame(animateLine);
133
+ } else {
134
+ mapInstance.removeLayer(`line-animation${index}`);
135
+ mapInstance.removeSource(`line-animation${index}`);
136
+ mapInstance.removeSource(`startPoint${index}`);
137
+ if (lastLine) {
138
+ mapInstance.removeSource("endpoint");
139
+ resolve();
140
+ }
141
+ }
142
+ }
143
+ };
144
+ animateLine();
145
+ };
146
+ originPoints.forEach((coordinate, index) => {
147
+ lineFlight(coordinate, endPoint, index, index === originPoints.length - 1);
148
+ });
149
+ });
150
+ }
151
+ function generateMapMarkers(mapInstance, borrowerPoints) {
152
+ const geojson = {
153
+ type: "FeatureCollection"
154
+ };
155
+ geojson.features = borrowerPoints.map((borrower) => ({
156
+ type: "Feature",
157
+ properties: {
158
+ message: "test",
159
+ image: borrower.image,
160
+ iconSize: [80, 80]
161
+ },
162
+ geometry: {
163
+ type: "Point",
164
+ coordinates: borrower.location
165
+ }
166
+ }));
167
+ geojson.features.forEach((marker) => {
168
+ const el = document.createElement("div");
169
+ el.className = "map-marker";
170
+ el.style.backgroundImage = `url(${marker.properties.image})`;
171
+ el.style.width = `${marker.properties.iconSize[0]}px`;
172
+ el.style.height = `${marker.properties.iconSize[1]}px`;
173
+ new maplibregl.Marker({ element: el }).setLngLat(marker.geometry.coordinates).addTo(mapInstance);
174
+ });
175
+ }
176
+ function animationCoordinator(mapInstance, borrowerPoints) {
177
+ return new Promise((resolve) => {
178
+ const destinationPoints = borrowerPoints.map((borrower) => borrower.location);
179
+ const totalNumberOfPoints = destinationPoints.length;
180
+ let currentPointIndex = 0;
181
+ const flyToPoint = (index) => {
182
+ mapInstance.flyTo({
183
+ // These options control the ending camera position: centered at
184
+ // the target, at zoom level 9, and north up.
185
+ center: destinationPoints[index],
186
+ zoom: 4,
187
+ bearing: 0,
188
+ // These options control the flight curve, making it move
189
+ // slowly and zoom out almost completely before starting
190
+ // to pan.
191
+ speed: 0.9,
192
+ // make the flying slow
193
+ curve: 1,
194
+ // change the speed at which it zooms out
195
+ // This can be any easing function: it takes a number between
196
+ // 0 and 1 and returns another number between 0 and 1.
197
+ easing(t) {
198
+ return t;
199
+ },
200
+ // this animation is considered essential with respect to prefers-reduced-motion
201
+ essential: true
202
+ }, { flyEnd: true });
203
+ };
204
+ mapInstance.on("moveend", (event) => {
205
+ if (event.flyEnd === true) {
206
+ animateLines(mapInstance, randomCoordinates, destinationPoints[currentPointIndex]).then(() => {
207
+ if (currentPointIndex < totalNumberOfPoints - 1) {
208
+ currentPointIndex += 1;
209
+ flyToPoint(currentPointIndex);
210
+ } else {
211
+ resolve();
212
+ }
213
+ });
214
+ }
215
+ });
216
+ flyToPoint(currentPointIndex);
217
+ });
218
+ }
219
+ var getLoansIntervals = (min, max, nbIntervals) => {
220
+ const size = Math.floor((max - min) / nbIntervals);
221
+ const result = [];
222
+ if (size <= 0)
223
+ return [[min, max]];
224
+ for (let i = 0; i < nbIntervals; i += 1) {
225
+ let inf = min + i * size;
226
+ let sup = inf + size < max ? inf + size : max;
227
+ if (i > 0) {
228
+ inf += 1 * i;
229
+ sup += 1 * i;
230
+ }
231
+ if (i > 0 && sup > max) {
232
+ sup = max;
233
+ }
234
+ if (i === nbIntervals - 1) {
235
+ if (sup < max || sup > max)
236
+ sup = max;
237
+ }
238
+ result.push([inf, sup]);
239
+ if (sup >= max)
240
+ break;
241
+ }
242
+ return result;
243
+ };
244
+ var getCountryColor = (lenderLoans, countriesData, kvTokensPrimitives) => {
245
+ const loanCountsArray = [];
246
+ countriesData.forEach((country) => {
247
+ loanCountsArray.push(country.value);
248
+ });
249
+ const maxNumLoansToOneCountry = Math.max(...loanCountsArray);
250
+ const intervals = getLoansIntervals(1, maxNumLoansToOneCountry, 6);
251
+ if (intervals.length === 1) {
252
+ const [inf, sup] = intervals[0];
253
+ for (let i = 0; i < sup; i += 1) {
254
+ const loansNumber = i + 1;
255
+ if (lenderLoans && lenderLoans >= loansNumber && lenderLoans < loansNumber + 1) {
256
+ return kvTokensPrimitives.colors.brand[mapColors[i]];
257
+ }
258
+ }
259
+ } else {
260
+ for (let i = 0; i < intervals.length; i += 1) {
261
+ const [inf, sup] = intervals[i];
262
+ if (lenderLoans && lenderLoans >= inf && lenderLoans <= sup) {
263
+ return kvTokensPrimitives.colors.brand[mapColors[i]];
264
+ }
265
+ }
266
+ }
267
+ return kvTokensPrimitives.colors.gray[300];
268
+ };
269
+ // Annotate the CommonJS export names for ESM import in node:
270
+ 0 && (module.exports = {
271
+ animationCoordinator,
272
+ generateMapMarkers,
273
+ getCoordinatesBetween,
274
+ getCountryColor,
275
+ getLoansIntervals
276
+ });
@@ -0,0 +1,15 @@
1
+ import {
2
+ animationCoordinator,
3
+ generateMapMarkers,
4
+ getCoordinatesBetween,
5
+ getCountryColor,
6
+ getLoansIntervals
7
+ } from "./chunk-VIGEMAKO.js";
8
+ import "./chunk-YCNMJ4YV.js";
9
+ export {
10
+ animationCoordinator,
11
+ generateMapMarkers,
12
+ getCoordinatesBetween,
13
+ getCountryColor,
14
+ getLoansIntervals
15
+ };
@@ -0,0 +1,42 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/printing.js
20
+ var printing_exports = {};
21
+ __export(printing_exports, {
22
+ lockPrintSingleEl: () => lockPrintSingleEl,
23
+ unlockPrintSingleEl: () => unlockPrintSingleEl
24
+ });
25
+ module.exports = __toCommonJS(printing_exports);
26
+ function lockPrintSingleEl(domNode) {
27
+ if (typeof window !== "undefined" && domNode) {
28
+ document.body.classList.add("print:tw-invisible", "print:tw-overflow-hidden");
29
+ domNode.classList.add("print:tw-visible", "print:tw-overflow-auto");
30
+ }
31
+ }
32
+ function unlockPrintSingleEl(domNode) {
33
+ if (typeof window !== "undefined" && domNode) {
34
+ document.body.classList.remove("print:tw-invisible", "print:tw-overflow-hidden");
35
+ domNode.classList.remove("print:tw-visible", "print:tw-overflow-auto");
36
+ }
37
+ }
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ lockPrintSingleEl,
41
+ unlockPrintSingleEl
42
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ lockPrintSingleEl,
3
+ unlockPrintSingleEl
4
+ } from "./chunk-B5J5WLAH.js";
5
+ import "./chunk-YCNMJ4YV.js";
6
+ export {
7
+ lockPrintSingleEl,
8
+ unlockPrintSingleEl
9
+ };
@@ -0,0 +1,54 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/scrollLock.js
20
+ var scrollLock_exports = {};
21
+ __export(scrollLock_exports, {
22
+ lockScroll: () => lockScroll,
23
+ lockScrollSmallOnly: () => lockScrollSmallOnly,
24
+ unlockScroll: () => unlockScroll,
25
+ unlockScrollSmallOnly: () => unlockScrollSmallOnly
26
+ });
27
+ module.exports = __toCommonJS(scrollLock_exports);
28
+ function lockScroll() {
29
+ if (typeof window !== "undefined") {
30
+ document.body.style.overflow = "hidden";
31
+ }
32
+ }
33
+ function unlockScroll() {
34
+ if (typeof window !== "undefined") {
35
+ document.body.style.overflow = null;
36
+ }
37
+ }
38
+ function lockScrollSmallOnly() {
39
+ if (typeof window !== "undefined") {
40
+ document.body.classList.add("tw-overflow-hidden", "md:tw-overflow-auto");
41
+ }
42
+ }
43
+ function unlockScrollSmallOnly() {
44
+ if (typeof window !== "undefined") {
45
+ document.body.classList.remove("tw-overflow-hidden", "md:tw-overflow-auto");
46
+ }
47
+ }
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ lockScroll,
51
+ lockScrollSmallOnly,
52
+ unlockScroll,
53
+ unlockScrollSmallOnly
54
+ });
@@ -0,0 +1,13 @@
1
+ import {
2
+ lockScroll,
3
+ lockScrollSmallOnly,
4
+ unlockScroll,
5
+ unlockScrollSmallOnly
6
+ } from "./chunk-HIY5IW65.js";
7
+ import "./chunk-YCNMJ4YV.js";
8
+ export {
9
+ lockScroll,
10
+ lockScrollSmallOnly,
11
+ unlockScroll,
12
+ unlockScrollSmallOnly
13
+ };
@@ -0,0 +1,38 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/throttle.js
20
+ var throttle_exports = {};
21
+ __export(throttle_exports, {
22
+ throttle: () => throttle
23
+ });
24
+ module.exports = __toCommonJS(throttle_exports);
25
+ function throttle(func, timeFrame) {
26
+ let lastTime = 0;
27
+ return function t(...args) {
28
+ const now = /* @__PURE__ */ new Date();
29
+ if (now - lastTime >= timeFrame) {
30
+ func(...args);
31
+ lastTime = now;
32
+ }
33
+ };
34
+ }
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ throttle
38
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ throttle
3
+ } from "./chunk-HV3AUBFT.js";
4
+ import "./chunk-YCNMJ4YV.js";
5
+ export {
6
+ throttle
7
+ };
@@ -0,0 +1,47 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/touchEvents.js
20
+ var touchEvents_exports = {};
21
+ __export(touchEvents_exports, {
22
+ isTargetElement: () => isTargetElement,
23
+ offBodyTouchstart: () => offBodyTouchstart,
24
+ onBodyTouchstart: () => onBodyTouchstart
25
+ });
26
+ module.exports = __toCommonJS(touchEvents_exports);
27
+ function onBodyTouchstart(handler) {
28
+ [...document.body.children].forEach((child) => child.addEventListener("touchstart", handler));
29
+ }
30
+ function offBodyTouchstart(handler) {
31
+ [...document.body.children].forEach((child) => child.removeEventListener("touchstart", handler));
32
+ }
33
+ function isTargetElement(event, elements) {
34
+ const els = Array.isArray(elements) ? elements : [elements];
35
+ for (let i = 0; i < els.length; i += 1) {
36
+ if (els[i] === event.target || els[i].contains(event.target)) {
37
+ return true;
38
+ }
39
+ }
40
+ return false;
41
+ }
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ isTargetElement,
45
+ offBodyTouchstart,
46
+ onBodyTouchstart
47
+ });
@@ -0,0 +1,11 @@
1
+ import {
2
+ isTargetElement,
3
+ offBodyTouchstart,
4
+ onBodyTouchstart
5
+ } from "./chunk-S3MABILA.js";
6
+ import "./chunk-YCNMJ4YV.js";
7
+ export {
8
+ isTargetElement,
9
+ offBodyTouchstart,
10
+ onBodyTouchstart
11
+ };
@@ -0,0 +1,133 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // utils/treemap.js
20
+ var treemap_exports = {};
21
+ __export(treemap_exports, {
22
+ getTreemap: () => getTreemap
23
+ });
24
+ module.exports = __toCommonJS(treemap_exports);
25
+ var getMaximum = (array) => Math.max(...array);
26
+ var getMinimum = (array) => Math.min(...array);
27
+ var sumReducer = (acc, cur) => acc + cur;
28
+ var roundValue = (number) => Math.max(Math.round(number * 100) / 100, 0);
29
+ var validateArguments = ({ data, width, height }) => {
30
+ if (!width || typeof width !== "number" || width < 0) {
31
+ throw new Error("You need to specify the width of your treemap");
32
+ }
33
+ if (!height || typeof height !== "number" || height < 0) {
34
+ throw new Error("You need to specify the height of your treemap");
35
+ }
36
+ if (!data || !Array.isArray(data) || data.length === 0 || !data.every((dataPoint) => Object.prototype.hasOwnProperty.call(dataPoint, "value") && typeof dataPoint.value === "number" && dataPoint.value >= 0 && !Number.isNaN(dataPoint.value))) {
37
+ throw new Error("You data must be in this format [{ value: 1 }, { value: 2 }], 'value' being a positive number");
38
+ }
39
+ };
40
+ function getTreemap({ data, width, height }) {
41
+ let Rectangle = {};
42
+ let initialData = [];
43
+ function worstRatio(row, width2) {
44
+ const sum = row.reduce(sumReducer, 0);
45
+ const rowMax = getMaximum(row);
46
+ const rowMin = getMinimum(row);
47
+ return Math.max(width2 ** 2 * rowMax / sum ** 2, sum ** 2 / (width2 ** 2 * rowMin));
48
+ }
49
+ const getMinWidth = () => {
50
+ if (Rectangle.totalHeight ** 2 > Rectangle.totalWidth ** 2) {
51
+ return { value: Rectangle.totalWidth, vertical: false };
52
+ }
53
+ return { value: Rectangle.totalHeight, vertical: true };
54
+ };
55
+ const layoutRow = (row, width2, vertical) => {
56
+ const rowHeight = row.reduce(sumReducer, 0) / width2;
57
+ row.forEach((rowItem) => {
58
+ const rowWidth = rowItem / rowHeight;
59
+ const { xBeginning } = Rectangle;
60
+ const { yBeginning } = Rectangle;
61
+ let data2;
62
+ if (vertical) {
63
+ data2 = {
64
+ x: xBeginning,
65
+ y: yBeginning,
66
+ width: rowHeight,
67
+ height: rowWidth,
68
+ data: initialData[Rectangle.data.length]
69
+ };
70
+ Rectangle.yBeginning += rowWidth;
71
+ } else {
72
+ data2 = {
73
+ x: xBeginning,
74
+ y: yBeginning,
75
+ width: rowWidth,
76
+ height: rowHeight,
77
+ data: initialData[Rectangle.data.length]
78
+ };
79
+ Rectangle.xBeginning += rowWidth;
80
+ }
81
+ Rectangle.data.push(data2);
82
+ });
83
+ if (vertical) {
84
+ Rectangle.xBeginning += rowHeight;
85
+ Rectangle.yBeginning -= width2;
86
+ Rectangle.totalWidth -= rowHeight;
87
+ } else {
88
+ Rectangle.xBeginning -= width2;
89
+ Rectangle.yBeginning += rowHeight;
90
+ Rectangle.totalHeight -= rowHeight;
91
+ }
92
+ };
93
+ const layoutLastRow = (rows, children, width2) => {
94
+ const { vertical } = getMinWidth();
95
+ layoutRow(rows, width2, vertical);
96
+ layoutRow(children, width2, vertical);
97
+ };
98
+ const squarify = (children, row, width2) => {
99
+ if (children.length === 1) {
100
+ return layoutLastRow(row, children, width2);
101
+ }
102
+ const rowWithChild = [...row, children[0]];
103
+ if (row.length === 0 || worstRatio(row, width2) >= worstRatio(rowWithChild, width2)) {
104
+ children.shift();
105
+ return squarify(children, rowWithChild, width2);
106
+ }
107
+ layoutRow(row, width2, getMinWidth().vertical);
108
+ return squarify(children, [], getMinWidth().value);
109
+ };
110
+ validateArguments({ data, width, height });
111
+ Rectangle = {
112
+ data: [],
113
+ xBeginning: 0,
114
+ yBeginning: 0,
115
+ totalWidth: width,
116
+ totalHeight: height
117
+ };
118
+ initialData = data;
119
+ const totalValue = data.map((dataPoint) => dataPoint.value).reduce(sumReducer, 0);
120
+ const dataScaled = data.map((dataPoint) => dataPoint.value * height * width / totalValue);
121
+ squarify(dataScaled, [], getMinWidth().value);
122
+ return Rectangle.data.map((dataPoint) => ({
123
+ ...dataPoint,
124
+ x: roundValue(dataPoint.x),
125
+ y: roundValue(dataPoint.y),
126
+ width: roundValue(dataPoint.width),
127
+ height: roundValue(dataPoint.height)
128
+ }));
129
+ }
130
+ // Annotate the CommonJS export names for ESM import in node:
131
+ 0 && (module.exports = {
132
+ getTreemap
133
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ getTreemap
3
+ } from "./chunk-MSMZIN54.js";
4
+ import "./chunk-YCNMJ4YV.js";
5
+ export {
6
+ getTreemap
7
+ };