@lobehub/charts 5.7.0 → 5.7.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 (404) hide show
  1. package/es/AccuracyBarChart/index.d.mts +62 -0
  2. package/es/AccuracyBarChart/index.mjs +326 -0
  3. package/es/AccuracyBarChart/index.mjs.map +1 -0
  4. package/es/AccuracyBarChart/styles.d.mts +14 -0
  5. package/es/AccuracyBarChart/styles.mjs +71 -0
  6. package/es/AccuracyBarChart/styles.mjs.map +1 -0
  7. package/es/AreaChart/index.d.mts +13 -0
  8. package/es/AreaChart/index.mjs +308 -0
  9. package/es/AreaChart/index.mjs.map +1 -0
  10. package/es/AreaChart/styles.d.mts +9 -0
  11. package/es/AreaChart/styles.mjs +28 -0
  12. package/es/AreaChart/styles.mjs.map +1 -0
  13. package/es/BarChart/index.d.mts +11 -0
  14. package/es/BarChart/index.mjs +290 -0
  15. package/es/BarChart/index.mjs.map +1 -0
  16. package/es/BarChart/{renderShape.d.ts → renderShape.d.mts} +3 -1
  17. package/es/BarChart/renderShape.mjs +28 -0
  18. package/es/BarChart/renderShape.mjs.map +1 -0
  19. package/es/BarChart/styles.d.mts +9 -0
  20. package/es/BarChart/styles.mjs +28 -0
  21. package/es/BarChart/styles.mjs.map +1 -0
  22. package/es/BarList/index.d.mts +32 -0
  23. package/es/BarList/index.mjs +128 -0
  24. package/es/BarList/index.mjs.map +1 -0
  25. package/es/BarList/styles.d.mts +13 -0
  26. package/es/BarList/styles.mjs +63 -0
  27. package/es/BarList/styles.mjs.map +1 -0
  28. package/es/BenchmarkColumnChart/index.d.mts +144 -0
  29. package/es/BenchmarkColumnChart/index.mjs +514 -0
  30. package/es/BenchmarkColumnChart/index.mjs.map +1 -0
  31. package/es/BenchmarkColumnChart/styles.d.mts +19 -0
  32. package/es/BenchmarkColumnChart/styles.mjs +129 -0
  33. package/es/BenchmarkColumnChart/styles.mjs.map +1 -0
  34. package/es/BenchmarkRankingChart/index.d.mts +91 -0
  35. package/es/BenchmarkRankingChart/index.mjs +347 -0
  36. package/es/BenchmarkRankingChart/index.mjs.map +1 -0
  37. package/es/BenchmarkRankingChart/styles.d.mts +36 -0
  38. package/es/BenchmarkRankingChart/styles.mjs +265 -0
  39. package/es/BenchmarkRankingChart/styles.mjs.map +1 -0
  40. package/es/BenchmarkScatterChart/index.d.mts +148 -0
  41. package/es/BenchmarkScatterChart/index.mjs +668 -0
  42. package/es/BenchmarkScatterChart/index.mjs.map +1 -0
  43. package/es/BenchmarkScatterChart/styles.d.mts +28 -0
  44. package/es/BenchmarkScatterChart/styles.mjs +193 -0
  45. package/es/BenchmarkScatterChart/styles.mjs.map +1 -0
  46. package/es/BenchmarkScatterChart/{utils.d.ts → utils.d.mts} +32 -29
  47. package/es/BenchmarkScatterChart/utils.mjs +214 -0
  48. package/es/BenchmarkScatterChart/utils.mjs.map +1 -0
  49. package/es/ComposedChart/index.d.mts +6 -0
  50. package/es/ComposedChart/index.mjs +254 -0
  51. package/es/ComposedChart/index.mjs.map +1 -0
  52. package/es/ComposedChart/styles.d.mts +9 -0
  53. package/es/ComposedChart/styles.mjs +28 -0
  54. package/es/ComposedChart/styles.mjs.map +1 -0
  55. package/es/ComposedChart/types.d.mts +71 -0
  56. package/es/ComposedChart/types.mjs +0 -0
  57. package/es/DataBars/CategoryBar.d.mts +17 -0
  58. package/es/DataBars/CategoryBar.mjs +146 -0
  59. package/es/DataBars/CategoryBar.mjs.map +1 -0
  60. package/es/DataBars/DeltaBar.d.mts +16 -0
  61. package/es/DataBars/DeltaBar.mjs +102 -0
  62. package/es/DataBars/DeltaBar.mjs.map +1 -0
  63. package/es/DataBars/MarkerBar.d.mts +19 -0
  64. package/es/DataBars/MarkerBar.mjs +74 -0
  65. package/es/DataBars/MarkerBar.mjs.map +1 -0
  66. package/es/DataBars/ProgressBar.d.mts +15 -0
  67. package/es/DataBars/ProgressBar.mjs +53 -0
  68. package/es/DataBars/ProgressBar.mjs.map +1 -0
  69. package/es/DataBars/index.d.mts +5 -0
  70. package/es/DataBars/index.mjs +5 -0
  71. package/es/DataBars/styles.d.mts +10 -0
  72. package/es/DataBars/styles.mjs +31 -0
  73. package/es/DataBars/styles.mjs.map +1 -0
  74. package/es/DonutChart/DonutChartTooltip.d.mts +14 -0
  75. package/es/DonutChart/DonutChartTooltip.mjs +25 -0
  76. package/es/DonutChart/DonutChartTooltip.mjs.map +1 -0
  77. package/es/DonutChart/index.d.mts +33 -0
  78. package/es/DonutChart/index.mjs +160 -0
  79. package/es/DonutChart/index.mjs.map +1 -0
  80. package/es/DonutChart/inputParser.d.mts +5 -0
  81. package/es/DonutChart/inputParser.mjs +8 -0
  82. package/es/DonutChart/inputParser.mjs.map +1 -0
  83. package/es/DonutChart/renderInactiveShape.d.mts +4 -0
  84. package/es/DonutChart/renderInactiveShape.mjs +22 -0
  85. package/es/DonutChart/renderInactiveShape.mjs.map +1 -0
  86. package/es/DonutChart/styles.d.mts +9 -0
  87. package/es/DonutChart/styles.mjs +28 -0
  88. package/es/DonutChart/styles.mjs.map +1 -0
  89. package/es/FunnelChart/ArrowRightIcon.d.mts +8 -0
  90. package/es/FunnelChart/ArrowRightIcon.mjs +14 -0
  91. package/es/FunnelChart/ArrowRightIcon.mjs.map +1 -0
  92. package/es/FunnelChart/index.d.mts +21 -0
  93. package/es/FunnelChart/index.mjs +421 -0
  94. package/es/FunnelChart/index.mjs.map +1 -0
  95. package/es/FunnelChart/styles.d.mts +9 -0
  96. package/es/FunnelChart/styles.mjs +28 -0
  97. package/es/FunnelChart/styles.mjs.map +1 -0
  98. package/es/FunnelChart/types.d.mts +31 -0
  99. package/es/FunnelChart/types.mjs +0 -0
  100. package/es/Heatmaps/Calendar.d.mts +21 -0
  101. package/es/Heatmaps/Calendar.mjs +108 -0
  102. package/es/Heatmaps/Calendar.mjs.map +1 -0
  103. package/es/Heatmaps/ChartLabels.d.mts +17 -0
  104. package/es/Heatmaps/ChartLabels.mjs +84 -0
  105. package/es/Heatmaps/ChartLabels.mjs.map +1 -0
  106. package/es/Heatmaps/Footer.d.mts +24 -0
  107. package/es/Heatmaps/Footer.mjs +81 -0
  108. package/es/Heatmaps/Footer.mjs.map +1 -0
  109. package/es/Heatmaps/index.d.mts +31 -0
  110. package/es/Heatmaps/index.mjs +188 -0
  111. package/es/Heatmaps/index.mjs.map +1 -0
  112. package/es/Heatmaps/styles.d.mts +10 -0
  113. package/es/Heatmaps/styles.mjs +47 -0
  114. package/es/Heatmaps/styles.mjs.map +1 -0
  115. package/es/Legend/LegendItem.d.mts +12 -0
  116. package/es/Legend/LegendItem.mjs +65 -0
  117. package/es/Legend/LegendItem.mjs.map +1 -0
  118. package/es/Legend/ScrollButton.d.mts +11 -0
  119. package/es/Legend/ScrollButton.mjs +50 -0
  120. package/es/Legend/ScrollButton.mjs.map +1 -0
  121. package/es/Legend/index.d.mts +16 -0
  122. package/es/Legend/index.mjs +152 -0
  123. package/es/Legend/index.mjs.map +1 -0
  124. package/es/LineChart/index.d.mts +11 -0
  125. package/es/LineChart/index.mjs +271 -0
  126. package/es/LineChart/index.mjs.map +1 -0
  127. package/es/LineChart/styles.d.mts +9 -0
  128. package/es/LineChart/styles.mjs +28 -0
  129. package/es/LineChart/styles.mjs.map +1 -0
  130. package/es/RadarChart/index.d.mts +27 -0
  131. package/es/RadarChart/index.mjs +157 -0
  132. package/es/RadarChart/index.mjs.map +1 -0
  133. package/es/RadarChart/styles.d.mts +8 -0
  134. package/es/RadarChart/styles.mjs +23 -0
  135. package/es/RadarChart/styles.mjs.map +1 -0
  136. package/es/ScatterChart/ScatterChartTooltip.d.mts +19 -0
  137. package/es/ScatterChart/ScatterChartTooltip.mjs +52 -0
  138. package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -0
  139. package/es/ScatterChart/ScatterChartTooltipRow.d.mts +10 -0
  140. package/es/ScatterChart/ScatterChartTooltipRow.mjs +36 -0
  141. package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -0
  142. package/es/ScatterChart/index.d.mts +58 -0
  143. package/es/ScatterChart/index.mjs +241 -0
  144. package/es/ScatterChart/index.mjs.map +1 -0
  145. package/es/ScatterChart/{renderShape.d.ts → renderShape.d.mts} +4 -1
  146. package/es/ScatterChart/renderShape.mjs +18 -0
  147. package/es/ScatterChart/renderShape.mjs.map +1 -0
  148. package/es/ScatterChart/styles.d.mts +9 -0
  149. package/es/ScatterChart/styles.mjs +28 -0
  150. package/es/ScatterChart/styles.mjs.map +1 -0
  151. package/es/SparkChart/SparkAreaChart.d.mts +14 -0
  152. package/es/SparkChart/SparkAreaChart.mjs +109 -0
  153. package/es/SparkChart/SparkAreaChart.mjs.map +1 -0
  154. package/es/SparkChart/SparkBarChart.d.mts +11 -0
  155. package/es/SparkChart/SparkBarChart.mjs +69 -0
  156. package/es/SparkChart/SparkBarChart.mjs.map +1 -0
  157. package/es/SparkChart/SparkLineChart.d.mts +12 -0
  158. package/es/SparkChart/SparkLineChart.mjs +73 -0
  159. package/es/SparkChart/SparkLineChart.mjs.map +1 -0
  160. package/es/SparkChart/index.d.mts +4 -0
  161. package/es/SparkChart/index.mjs +4 -0
  162. package/es/Tracker/TrackerBlock.d.mts +11 -0
  163. package/es/Tracker/TrackerBlock.mjs +52 -0
  164. package/es/Tracker/TrackerBlock.mjs.map +1 -0
  165. package/es/Tracker/index.d.mts +21 -0
  166. package/es/Tracker/index.mjs +69 -0
  167. package/es/Tracker/index.mjs.map +1 -0
  168. package/es/Tracker/styles.d.mts +8 -0
  169. package/es/Tracker/styles.mjs +24 -0
  170. package/es/Tracker/styles.mjs.map +1 -0
  171. package/es/common/BaseAnimationTimingProps.d.mts +10 -0
  172. package/es/common/BaseAnimationTimingProps.mjs +0 -0
  173. package/es/common/BaseChartProps.d.mts +61 -0
  174. package/es/common/BaseChartProps.mjs +0 -0
  175. package/es/common/BaseSparkChartProps.d.mts +17 -0
  176. package/es/common/BaseSparkChartProps.mjs +0 -0
  177. package/es/common/ChartLegend.d.mts +8 -0
  178. package/es/common/ChartLegend.mjs +32 -0
  179. package/es/common/ChartLegend.mjs.map +1 -0
  180. package/es/common/ChartTooltip/ChartTooltipFrame.d.mts +8 -0
  181. package/es/common/ChartTooltip/ChartTooltipFrame.mjs +27 -0
  182. package/es/common/ChartTooltip/ChartTooltipFrame.mjs.map +1 -0
  183. package/es/common/ChartTooltip/ChartTooltipRow.d.mts +10 -0
  184. package/es/common/ChartTooltip/ChartTooltipRow.mjs +51 -0
  185. package/es/common/ChartTooltip/ChartTooltipRow.mjs.map +1 -0
  186. package/es/common/ChartTooltip/index.d.mts +18 -0
  187. package/es/common/ChartTooltip/index.mjs +50 -0
  188. package/es/common/ChartTooltip/index.mjs.map +1 -0
  189. package/es/common/CustomTooltipProps.d.mts +15 -0
  190. package/es/common/CustomTooltipProps.mjs +0 -0
  191. package/es/common/CustomYAxisTick.d.mts +18 -0
  192. package/es/common/CustomYAxisTick.mjs +24 -0
  193. package/es/common/CustomYAxisTick.mjs.map +1 -0
  194. package/es/common/NoData.d.mts +13 -0
  195. package/es/common/NoData.mjs +25 -0
  196. package/es/common/NoData.mjs.map +1 -0
  197. package/es/common/benchmark/index.d.mts +3 -0
  198. package/es/common/benchmark/{index.js → index.mjs} +1 -1
  199. package/es/common/benchmark/types.d.mts +125 -0
  200. package/es/common/benchmark/types.mjs +0 -0
  201. package/es/common/benchmark/{utils.d.ts → utils.d.mts} +38 -36
  202. package/es/common/benchmark/utils.mjs +115 -0
  203. package/es/common/benchmark/utils.mjs.map +1 -0
  204. package/es/common/{utils.d.ts → utils.d.mts} +3 -0
  205. package/es/common/utils.mjs +36 -0
  206. package/es/common/utils.mjs.map +1 -0
  207. package/es/hooks/useOnWindowResize.d.mts +6 -0
  208. package/es/hooks/useOnWindowResize.mjs +18 -0
  209. package/es/hooks/useOnWindowResize.mjs.map +1 -0
  210. package/es/hooks/usePrefersReducedMotion.d.mts +4 -0
  211. package/es/hooks/usePrefersReducedMotion.mjs +24 -0
  212. package/es/hooks/usePrefersReducedMotion.mjs.map +1 -0
  213. package/es/hooks/useThemeColorRange.d.mts +4 -0
  214. package/es/hooks/useThemeColorRange.mjs +28 -0
  215. package/es/hooks/useThemeColorRange.mjs.map +1 -0
  216. package/es/index.d.mts +34 -0
  217. package/es/index.mjs +28 -0
  218. package/es/types/{charts.d.ts → charts.d.mts} +26 -26
  219. package/es/types/charts.mjs +12 -0
  220. package/es/types/charts.mjs.map +1 -0
  221. package/es/utils/{calendar.d.ts → calendar.d.mts} +21 -18
  222. package/es/utils/calendar.mjs +154 -0
  223. package/es/utils/calendar.mjs.map +1 -0
  224. package/es/utils/getMaxLabelLength.d.mts +13 -0
  225. package/es/utils/getMaxLabelLength.mjs +48 -0
  226. package/es/utils/getMaxLabelLength.mjs.map +1 -0
  227. package/es/utils/{index.d.ts → index.d.mts} +4 -1
  228. package/es/utils/index.mjs +19 -0
  229. package/es/utils/index.mjs.map +1 -0
  230. package/es/utils/{theme.d.ts → theme.d.mts} +3 -0
  231. package/es/utils/theme.mjs +33 -0
  232. package/es/utils/theme.mjs.map +1 -0
  233. package/package.json +22 -4
  234. package/es/AccuracyBarChart/index.d.ts +0 -60
  235. package/es/AccuracyBarChart/index.js +0 -454
  236. package/es/AccuracyBarChart/index.mdx +0 -52
  237. package/es/AccuracyBarChart/styles.d.ts +0 -11
  238. package/es/AccuracyBarChart/styles.js +0 -18
  239. package/es/AreaChart/index.d.ts +0 -11
  240. package/es/AreaChart/index.js +0 -430
  241. package/es/AreaChart/index.mdx +0 -49
  242. package/es/AreaChart/styles.d.ts +0 -6
  243. package/es/AreaChart/styles.js +0 -13
  244. package/es/BarChart/index.d.ts +0 -9
  245. package/es/BarChart/index.js +0 -392
  246. package/es/BarChart/index.mdx +0 -73
  247. package/es/BarChart/renderShape.js +0 -34
  248. package/es/BarChart/styles.d.ts +0 -6
  249. package/es/BarChart/styles.js +0 -13
  250. package/es/BarList/index.d.ts +0 -29
  251. package/es/BarList/index.js +0 -174
  252. package/es/BarList/index.mdx +0 -34
  253. package/es/BarList/styles.d.ts +0 -10
  254. package/es/BarList/styles.js +0 -18
  255. package/es/BenchmarkColumnChart/index.d.ts +0 -140
  256. package/es/BenchmarkColumnChart/index.js +0 -686
  257. package/es/BenchmarkColumnChart/index.mdx +0 -66
  258. package/es/BenchmarkColumnChart/styles.d.ts +0 -16
  259. package/es/BenchmarkColumnChart/styles.js +0 -23
  260. package/es/BenchmarkRankingChart/index.d.ts +0 -87
  261. package/es/BenchmarkRankingChart/index.js +0 -455
  262. package/es/BenchmarkRankingChart/index.mdx +0 -59
  263. package/es/BenchmarkRankingChart/styles.d.ts +0 -33
  264. package/es/BenchmarkRankingChart/styles.js +0 -41
  265. package/es/BenchmarkScatterChart/index.d.ts +0 -145
  266. package/es/BenchmarkScatterChart/index.js +0 -857
  267. package/es/BenchmarkScatterChart/index.mdx +0 -61
  268. package/es/BenchmarkScatterChart/styles.d.ts +0 -25
  269. package/es/BenchmarkScatterChart/styles.js +0 -33
  270. package/es/BenchmarkScatterChart/utils.js +0 -353
  271. package/es/ComposedChart/index.d.ts +0 -5
  272. package/es/ComposedChart/index.js +0 -335
  273. package/es/ComposedChart/index.mdx +0 -43
  274. package/es/ComposedChart/styles.d.ts +0 -6
  275. package/es/ComposedChart/styles.js +0 -13
  276. package/es/ComposedChart/types.d.ts +0 -68
  277. package/es/ComposedChart/types.js +0 -1
  278. package/es/DataBars/CategoryBar.d.ts +0 -15
  279. package/es/DataBars/CategoryBar.js +0 -201
  280. package/es/DataBars/DeltaBar.d.ts +0 -13
  281. package/es/DataBars/DeltaBar.js +0 -117
  282. package/es/DataBars/MarkerBar.d.ts +0 -16
  283. package/es/DataBars/MarkerBar.js +0 -94
  284. package/es/DataBars/ProgressBar.d.ts +0 -12
  285. package/es/DataBars/ProgressBar.js +0 -71
  286. package/es/DataBars/index.d.ts +0 -4
  287. package/es/DataBars/index.js +0 -4
  288. package/es/DataBars/index.mdx +0 -36
  289. package/es/DataBars/styles.d.ts +0 -7
  290. package/es/DataBars/styles.js +0 -14
  291. package/es/DonutChart/DonutChartTooltip.d.ts +0 -11
  292. package/es/DonutChart/DonutChartTooltip.js +0 -26
  293. package/es/DonutChart/index.d.ts +0 -31
  294. package/es/DonutChart/index.js +0 -232
  295. package/es/DonutChart/index.mdx +0 -48
  296. package/es/DonutChart/inputParser.d.ts +0 -2
  297. package/es/DonutChart/inputParser.js +0 -9
  298. package/es/DonutChart/renderInactiveShape.d.ts +0 -2
  299. package/es/DonutChart/renderInactiveShape.js +0 -27
  300. package/es/DonutChart/styles.d.ts +0 -6
  301. package/es/DonutChart/styles.js +0 -13
  302. package/es/FunnelChart/ArrowRightIcon.d.ts +0 -5
  303. package/es/FunnelChart/ArrowRightIcon.js +0 -22
  304. package/es/FunnelChart/index.d.ts +0 -19
  305. package/es/FunnelChart/index.js +0 -499
  306. package/es/FunnelChart/index.mdx +0 -21
  307. package/es/FunnelChart/styles.d.ts +0 -6
  308. package/es/FunnelChart/styles.js +0 -13
  309. package/es/FunnelChart/types.d.ts +0 -28
  310. package/es/FunnelChart/types.js +0 -1
  311. package/es/Heatmaps/Calendar.d.ts +0 -18
  312. package/es/Heatmaps/Calendar.js +0 -155
  313. package/es/Heatmaps/ChartLabels.d.ts +0 -15
  314. package/es/Heatmaps/ChartLabels.js +0 -106
  315. package/es/Heatmaps/Footer.d.ts +0 -22
  316. package/es/Heatmaps/Footer.js +0 -105
  317. package/es/Heatmaps/index.d.ts +0 -28
  318. package/es/Heatmaps/index.js +0 -227
  319. package/es/Heatmaps/index.mdx +0 -70
  320. package/es/Heatmaps/styles.d.ts +0 -7
  321. package/es/Heatmaps/styles.js +0 -14
  322. package/es/Legend/LegendItem.d.ts +0 -10
  323. package/es/Legend/LegendItem.js +0 -58
  324. package/es/Legend/ScrollButton.d.ts +0 -9
  325. package/es/Legend/ScrollButton.js +0 -63
  326. package/es/Legend/index.d.ts +0 -14
  327. package/es/Legend/index.js +0 -184
  328. package/es/Legend/index.mdx +0 -13
  329. package/es/LineChart/index.d.ts +0 -9
  330. package/es/LineChart/index.js +0 -388
  331. package/es/LineChart/index.mdx +0 -49
  332. package/es/LineChart/styles.d.ts +0 -6
  333. package/es/LineChart/styles.js +0 -13
  334. package/es/RadarChart/index.d.ts +0 -24
  335. package/es/RadarChart/index.js +0 -254
  336. package/es/RadarChart/index.mdx +0 -52
  337. package/es/RadarChart/styles.d.ts +0 -5
  338. package/es/RadarChart/styles.js +0 -12
  339. package/es/ScatterChart/ScatterChartTooltip.d.ts +0 -16
  340. package/es/ScatterChart/ScatterChartTooltip.js +0 -76
  341. package/es/ScatterChart/ScatterChartTooltipRow.d.ts +0 -7
  342. package/es/ScatterChart/ScatterChartTooltipRow.js +0 -40
  343. package/es/ScatterChart/index.d.ts +0 -56
  344. package/es/ScatterChart/index.js +0 -342
  345. package/es/ScatterChart/index.mdx +0 -49
  346. package/es/ScatterChart/renderShape.js +0 -18
  347. package/es/ScatterChart/styles.d.ts +0 -6
  348. package/es/ScatterChart/styles.js +0 -13
  349. package/es/SparkChart/SparkAreaChart.d.ts +0 -12
  350. package/es/SparkChart/SparkAreaChart.js +0 -148
  351. package/es/SparkChart/SparkBarChart.d.ts +0 -9
  352. package/es/SparkChart/SparkBarChart.js +0 -106
  353. package/es/SparkChart/SparkLineChart.d.ts +0 -10
  354. package/es/SparkChart/SparkLineChart.js +0 -110
  355. package/es/SparkChart/index.d.ts +0 -3
  356. package/es/SparkChart/index.js +0 -3
  357. package/es/SparkChart/index.mdx +0 -29
  358. package/es/Tracker/TrackerBlock.d.ts +0 -8
  359. package/es/Tracker/TrackerBlock.js +0 -64
  360. package/es/Tracker/index.d.ts +0 -18
  361. package/es/Tracker/index.js +0 -105
  362. package/es/Tracker/index.mdx +0 -41
  363. package/es/Tracker/styles.d.ts +0 -5
  364. package/es/Tracker/styles.js +0 -12
  365. package/es/common/BaseAnimationTimingProps.d.ts +0 -7
  366. package/es/common/BaseAnimationTimingProps.js +0 -1
  367. package/es/common/BaseChartProps.d.ts +0 -58
  368. package/es/common/BaseChartProps.js +0 -1
  369. package/es/common/BaseSparkChartProps.d.ts +0 -14
  370. package/es/common/BaseSparkChartProps.js +0 -1
  371. package/es/common/ChartLegend.d.ts +0 -5
  372. package/es/common/ChartLegend.js +0 -40
  373. package/es/common/ChartTooltip/ChartTooltipFrame.d.ts +0 -6
  374. package/es/common/ChartTooltip/ChartTooltipFrame.js +0 -32
  375. package/es/common/ChartTooltip/ChartTooltipRow.d.ts +0 -8
  376. package/es/common/ChartTooltip/ChartTooltipRow.js +0 -55
  377. package/es/common/ChartTooltip/index.d.ts +0 -15
  378. package/es/common/ChartTooltip/index.js +0 -66
  379. package/es/common/CustomTooltipProps.d.ts +0 -12
  380. package/es/common/CustomTooltipProps.js +0 -1
  381. package/es/common/CustomYAxisTick.d.ts +0 -15
  382. package/es/common/CustomYAxisTick.js +0 -27
  383. package/es/common/NoData.d.ts +0 -10
  384. package/es/common/NoData.js +0 -24
  385. package/es/common/benchmark/index.d.ts +0 -2
  386. package/es/common/benchmark/types.d.ts +0 -122
  387. package/es/common/benchmark/types.js +0 -1
  388. package/es/common/benchmark/utils.js +0 -159
  389. package/es/common/utils.js +0 -85
  390. package/es/hooks/useOnWindowResize.d.ts +0 -3
  391. package/es/hooks/useOnWindowResize.js +0 -15
  392. package/es/hooks/usePrefersReducedMotion.d.ts +0 -1
  393. package/es/hooks/usePrefersReducedMotion.js +0 -28
  394. package/es/hooks/useThemeColorRange.d.ts +0 -1
  395. package/es/hooks/useThemeColorRange.js +0 -8
  396. package/es/index.d.ts +0 -24
  397. package/es/index.js +0 -22
  398. package/es/types/charts.js +0 -8
  399. package/es/types/global.d.ts +0 -9
  400. package/es/utils/calendar.js +0 -199
  401. package/es/utils/getMaxLabelLength.d.ts +0 -10
  402. package/es/utils/getMaxLabelLength.js +0 -110
  403. package/es/utils/index.js +0 -32
  404. package/es/utils/theme.js +0 -40
@@ -1,85 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
9
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
11
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
- export var constructCategoryColors = function constructCategoryColors(categories, colors) {
14
- var categoryColors = new Map();
15
- var _iterator = _createForOfIteratorHelper(categories.entries()),
16
- _step;
17
- try {
18
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
19
- var _step$value = _slicedToArray(_step.value, 2),
20
- idx = _step$value[0],
21
- category = _step$value[1];
22
- categoryColors.set(category, colors[idx % colors.length]);
23
- }
24
- } catch (err) {
25
- _iterator.e(err);
26
- } finally {
27
- _iterator.f();
28
- }
29
- return categoryColors;
30
- };
31
- export var getYAxisDomain = function getYAxisDomain(autoMinValue, minValue, maxValue) {
32
- return [autoMinValue ? 'auto' : minValue !== null && minValue !== void 0 ? minValue : 0, maxValue !== null && maxValue !== void 0 ? maxValue : 'auto'];
33
- };
34
- export var constructCategories = function constructCategories(data, color) {
35
- if (!color) {
36
- return [];
37
- }
38
- var categories = new Set();
39
- var _iterator2 = _createForOfIteratorHelper(data),
40
- _step2;
41
- try {
42
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
43
- var datum = _step2.value;
44
- categories.add(datum[color]);
45
- }
46
- } catch (err) {
47
- _iterator2.e(err);
48
- } finally {
49
- _iterator2.f();
50
- }
51
- return _toConsumableArray(categories);
52
- };
53
- export var deepEqual = function deepEqual(obj1, obj2) {
54
- if (obj1 === obj2) return true;
55
- if (_typeof(obj1) !== 'object' || _typeof(obj2) !== 'object' || obj1 === null || obj2 === null) return false;
56
- var keys1 = Object.keys(obj1);
57
- var keys2 = Object.keys(obj2);
58
- if (keys1.length !== keys2.length) return false;
59
- for (var _i = 0, _keys = keys1; _i < _keys.length; _i++) {
60
- var key = _keys[_i];
61
- if (!keys2.includes(key) || !deepEqual(obj1[key], obj2[key])) return false;
62
- }
63
- return true;
64
- };
65
- export var hasOnlyOneValueForThisKey = function hasOnlyOneValueForThisKey(array, keyToCheck) {
66
- var val = [];
67
- var _iterator3 = _createForOfIteratorHelper(array),
68
- _step3;
69
- try {
70
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
71
- var obj = _step3.value;
72
- if (Object.prototype.hasOwnProperty.call(obj, keyToCheck)) {
73
- val.push(obj[keyToCheck]);
74
- if (val.length > 1) {
75
- return false;
76
- }
77
- }
78
- }
79
- } catch (err) {
80
- _iterator3.e(err);
81
- } finally {
82
- _iterator3.f();
83
- }
84
- return true;
85
- };
@@ -1,3 +0,0 @@
1
- export declare const useOnWindowResize: (handler: {
2
- (): void;
3
- }) => void;
@@ -1,15 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { isOnSeverSide } from "../utils";
3
- export var useOnWindowResize = function useOnWindowResize(handler) {
4
- useEffect(function () {
5
- if (isOnSeverSide) return;
6
- var handleResize = function handleResize() {
7
- handler();
8
- };
9
- handleResize();
10
- window.addEventListener('resize', handleResize);
11
- return function () {
12
- return window.removeEventListener('resize', handleResize);
13
- };
14
- }, [handler]);
15
- };
@@ -1 +0,0 @@
1
- export declare const usePrefersReducedMotion: () => boolean;
@@ -1,28 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import { useEffect, useState } from 'react';
8
- import { isOnSeverSide } from "../utils";
9
- var query = '(prefers-reduced-motion: reduce)';
10
- export var usePrefersReducedMotion = function usePrefersReducedMotion() {
11
- var _useState = useState(true),
12
- _useState2 = _slicedToArray(_useState, 2),
13
- prefersReducedMotion = _useState2[0],
14
- setPrefersReducedMotion = _useState2[1];
15
- useEffect(function () {
16
- if (isOnSeverSide) return;
17
- var mediaQuery = window.matchMedia(query);
18
- setPrefersReducedMotion(mediaQuery.matches);
19
- var onChange = function onChange(event) {
20
- setPrefersReducedMotion(event.matches);
21
- };
22
- mediaQuery.addEventListener('change', onChange);
23
- return function () {
24
- mediaQuery.removeEventListener('change', onChange);
25
- };
26
- }, []);
27
- return prefersReducedMotion;
28
- };
@@ -1 +0,0 @@
1
- export declare const useThemeColorRange: () => string[];
@@ -1,8 +0,0 @@
1
- import { useTheme } from 'antd-style';
2
- import { useMemo } from 'react';
3
- export var useThemeColorRange = function useThemeColorRange() {
4
- var theme = useTheme();
5
- return useMemo(function () {
6
- return [theme.geekblue, theme.gold, theme.green, theme.cyan, theme.purple, theme.red, theme.volcano, theme.gray, theme.geekblue7, theme.gold7, theme.green7, theme.cyan7, theme.purple7, theme.red7, theme.volcano7, theme.gray7];
7
- }, [theme]);
8
- };
package/es/index.d.ts DELETED
@@ -1,24 +0,0 @@
1
- export { default as AccuracyBarChart, type AccuracyBarChartProps } from './AccuracyBarChart';
2
- export { default as AreaChart, type AreaChartProps } from './AreaChart';
3
- export { default as BarChart, type BarChartProps } from './BarChart';
4
- export { type Bar, default as BarList, type BarListProps } from './BarList';
5
- export { default as BenchmarkColumnChart, type BenchmarkColumnChartProps, } from './BenchmarkColumnChart';
6
- export { default as BenchmarkRankingChart, type BenchmarkRankingChartProps, } from './BenchmarkRankingChart';
7
- export { default as BenchmarkScatterChart, type BenchmarkScatterChartProps, type BenchmarkScatterMetric, } from './BenchmarkScatterChart';
8
- export type { BenchmarkEventProps, BenchmarkFieldKeys, BenchmarkPointShape, BenchmarkRecord, BenchmarkRenderIcon, } from './common/benchmark';
9
- export { default as ChartTooltip, type ChartTooltipProps } from './common/ChartTooltip';
10
- export { default as ChartTooltipFrame } from './common/ChartTooltip/ChartTooltipFrame';
11
- export { default as ChartTooltipRow } from './common/ChartTooltip/ChartTooltipRow';
12
- export { default as ComposedChart, type ComposedChartProps, type SeriesItem, type YAxisConfig, } from './ComposedChart';
13
- export * from './DataBars';
14
- export { default as DonutChart, type DonutChartProps } from './DonutChart';
15
- export { default as FunnelChart, type FunnelChartProps } from './FunnelChart';
16
- export { default as Heatmaps, type HeatmapsProps } from './Heatmaps';
17
- export { default as Legend, type LegendProps } from './Legend';
18
- export { default as LineChart, type LineChartProps } from './LineChart';
19
- export { default as RadarChart, type RadarChartProps } from './RadarChart';
20
- export { default as ScatterChart, type ScatterChartProps } from './ScatterChart';
21
- export * from './SparkChart';
22
- export { default as Tracker, type TrackerProps } from './Tracker';
23
- export type * from './types/charts';
24
- export { useThemeColorRange } from "./hooks/useThemeColorRange";
package/es/index.js DELETED
@@ -1,22 +0,0 @@
1
- export { default as AccuracyBarChart } from "./AccuracyBarChart";
2
- export { default as AreaChart } from "./AreaChart";
3
- export { default as BarChart } from "./BarChart";
4
- export { default as BarList } from "./BarList";
5
- export { default as BenchmarkColumnChart } from "./BenchmarkColumnChart";
6
- export { default as BenchmarkRankingChart } from "./BenchmarkRankingChart";
7
- export { default as BenchmarkScatterChart } from "./BenchmarkScatterChart";
8
- export { default as ChartTooltip } from "./common/ChartTooltip";
9
- export { default as ChartTooltipFrame } from "./common/ChartTooltip/ChartTooltipFrame";
10
- export { default as ChartTooltipRow } from "./common/ChartTooltip/ChartTooltipRow";
11
- export { default as ComposedChart } from "./ComposedChart";
12
- export * from "./DataBars";
13
- export { default as DonutChart } from "./DonutChart";
14
- export { default as FunnelChart } from "./FunnelChart";
15
- export { default as Heatmaps } from "./Heatmaps";
16
- export { default as Legend } from "./Legend";
17
- export { default as LineChart } from "./LineChart";
18
- export { default as RadarChart } from "./RadarChart";
19
- export { default as ScatterChart } from "./ScatterChart";
20
- export * from "./SparkChart";
21
- export { default as Tracker } from "./Tracker";
22
- export { useThemeColorRange } from "./hooks/useThemeColorRange";
@@ -1,8 +0,0 @@
1
- var deltaTypeValues = ['increase', 'moderateIncrease', 'decrease', 'moderateDecrease', 'unchanged'];
2
- export var DeltaTypes = {
3
- Decrease: 'decrease',
4
- Increase: 'increase',
5
- ModerateDecrease: 'moderateDecrease',
6
- ModerateIncrease: 'moderateIncrease',
7
- Unchanged: 'unchanged'
8
- };
@@ -1,9 +0,0 @@
1
- import type { LobeCustomStylish, LobeCustomToken } from '@lobehub/ui';
2
- import 'antd-style';
3
-
4
- declare module 'antd-style' {
5
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
6
- export interface CustomToken extends LobeCustomToken {}
7
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
8
- export interface CustomStylish extends LobeCustomStylish {}
9
- }
@@ -1,199 +0,0 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
- import { differenceInCalendarDays, eachDayOfInterval, endOfYear, formatISO, getDay, getMonth, nextDay, parseISO, startOfYear, subWeeks } from 'date-fns';
8
- import { isOnSeverSide } from "./index";
9
- export var DEFAULT_MONTH_LABELS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
10
- export var DEFAULT_LABELS = {
11
- legend: {
12
- less: 'Less',
13
- more: 'More'
14
- },
15
- months: DEFAULT_MONTH_LABELS,
16
- tooltip: '{{count}} activities on {{date}}',
17
- totalCount: '{{count}} activities in {{year}}',
18
- weekdays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
19
- };
20
- var fillHoles = function fillHoles(activities) {
21
- if (activities.length === 0) {
22
- return [];
23
- }
24
- var calendar = new Map(activities.map(function (a) {
25
- return [a.date, a];
26
- }));
27
- var firstActivity = activities[0];
28
- var lastActivity = activities.at(-1);
29
- return eachDayOfInterval({
30
- end: parseISO(lastActivity.date),
31
- start: parseISO(firstActivity.date)
32
- }).map(function (day) {
33
- var date = formatISO(day, {
34
- representation: 'date'
35
- });
36
- if (calendar.has(date)) {
37
- return calendar.get(date);
38
- }
39
- return {
40
- count: 0,
41
- date: date,
42
- level: 0
43
- };
44
- });
45
- };
46
- var calcTextDimensions = function calcTextDimensions(text, fontSize) {
47
- if (isOnSeverSide) return;
48
- if (fontSize < 1) {
49
- throw new RangeError('fontSize must be positive');
50
- }
51
- if (text.length === 0) {
52
- return {
53
- height: 0,
54
- width: 0
55
- };
56
- }
57
- var namespace = 'http://www.w3.org/2000/svg';
58
- var svg = document.createElementNS(namespace, 'svg');
59
- svg.style.position = 'absolute';
60
- svg.style.visibility = 'hidden';
61
- svg.style.fontFamily = window.getComputedStyle(document.body).fontFamily;
62
- svg.style.fontSize = "".concat(fontSize, "px");
63
- var textNode = document.createElementNS(namespace, 'text');
64
- textNode.textContent = text;
65
- svg.append(textNode);
66
- document.body.append(svg);
67
- var boundingBox = textNode.getBBox();
68
- svg.remove();
69
- return {
70
- height: boundingBox.height,
71
- width: boundingBox.width
72
- };
73
- };
74
- export var groupByWeeks = function groupByWeeks(activities) {
75
- var weekStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
76
- if (activities.length === 0) {
77
- return [];
78
- }
79
- var normalizedActivities = fillHoles(activities);
80
-
81
- // Determine the first date of the calendar. If the first date is not the
82
- // set start weekday, the selected weekday one week earlier is used.
83
- var firstActivity = normalizedActivities[0];
84
- var firstDate = parseISO(firstActivity.date);
85
- var firstCalendarDate = getDay(firstDate) === weekStart ? firstDate : subWeeks(nextDay(firstDate, weekStart), 1);
86
-
87
- // To correctly group activities by week, it is necessary to left-pad the list
88
- // because the first date might not be set start weekday.
89
- var paddedActivities = [].concat(_toConsumableArray(Array.from({
90
- length: differenceInCalendarDays(firstDate, firstCalendarDate)
91
- }).fill(null)), _toConsumableArray(normalizedActivities));
92
- var numberOfWeeks = Math.ceil(paddedActivities.length / 7);
93
-
94
- // Finally, group activities by week
95
- return Array.from({
96
- length: numberOfWeeks
97
- }).fill(null).map(function (_, weekIndex) {
98
- return paddedActivities.slice(weekIndex * 7, weekIndex * 7 + 7);
99
- });
100
- };
101
- export var getMonthLabels = function getMonthLabels(weeks) {
102
- var monthNames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_MONTH_LABELS;
103
- return weeks.reduce(function (labels, week, weekIndex) {
104
- var firstActivity = week.filter(Boolean).find(function (activity) {
105
- return activity !== undefined;
106
- });
107
- if (!firstActivity) {
108
- throw new Error("Unexpected error: Week ".concat(weekIndex + 1, " is empty: [").concat(week, "]."));
109
- }
110
- var month = monthNames[getMonth(parseISO(firstActivity.date))];
111
- if (!month) {
112
- var monthName = new Date(firstActivity.date).toLocaleString('en-US', {
113
- month: 'short'
114
- });
115
- throw new Error("Unexpected error: undefined month label for ".concat(monthName, "."));
116
- }
117
- var prevLabel = labels.at(-1);
118
- if (weekIndex === 0 || !prevLabel || prevLabel.label !== month) {
119
- return [].concat(_toConsumableArray(labels), [{
120
- label: month,
121
- weekIndex: weekIndex
122
- }]);
123
- }
124
- return labels;
125
- }, []).filter(function (_ref, index, labels) {
126
- var weekIndex = _ref.weekIndex;
127
- // Labels should only be shown if there is "enough" space (data).
128
- // This is a naive implementation that does not take the block size,
129
- // font size, etc. into account.
130
- var minWeeks = 3;
131
-
132
- // Skip the first month label if there is not enough space to the next one.
133
- if (index === 0) {
134
- return labels[1] && labels[1].weekIndex - weekIndex >= minWeeks;
135
- }
136
-
137
- // Skip the last month label if there is not enough data in that month
138
- // to avoid overflowing the calendar on the right.
139
- if (index === labels.length - 1) {
140
- return weeks.slice(weekIndex).length >= minWeeks;
141
- }
142
- return true;
143
- });
144
- };
145
- export var generateEmptyData = function generateEmptyData() {
146
- var year = new Date().getFullYear();
147
- var days = eachDayOfInterval({
148
- end: new Date(year, 11, 31),
149
- start: new Date(year, 0, 1)
150
- });
151
- return days.map(function (date) {
152
- return {
153
- count: 0,
154
- date: formatISO(date, {
155
- representation: 'date'
156
- }),
157
- level: 0
158
- };
159
- });
160
- };
161
- export var generateTestData = function generateTestData(args) {
162
- var _args$interval;
163
- var maxCount = 20;
164
- var maxLevel = args.maxLevel ? Math.max(1, args.maxLevel) : 4;
165
- var now = new Date();
166
- var days = eachDayOfInterval((_args$interval = args.interval) !== null && _args$interval !== void 0 ? _args$interval : {
167
- end: endOfYear(now),
168
- start: startOfYear(now)
169
- });
170
- return days.map(function (date) {
171
- // The random activity count is shifted by up to 80% towards zero.
172
- var c = Math.round(Math.random() * maxCount - Math.random() * (0.8 * maxCount));
173
- var count = Math.max(0, c);
174
- var level = Math.ceil(count / maxCount * maxLevel);
175
- return {
176
- count: count,
177
- date: formatISO(date, {
178
- representation: 'date'
179
- }),
180
- level: level
181
- };
182
- });
183
- };
184
- export var maxWeekdayLabelLength = function maxWeekdayLabelLength(firstWeek, weekStart, labels, fontSize) {
185
- if (isOnSeverSide) return 0;
186
- if (labels.length !== 7) {
187
- throw new Error('Exactly 7 labels, one for each weekday must be passed.');
188
- }
189
- return firstWeek.reduce(function (maxLength, _, index) {
190
- if (index % 2 !== 0) {
191
- var dayIndex = (index + weekStart) % 7;
192
- var label = labels[dayIndex];
193
- // @ts-ignore
194
- var curLength = Math.ceil(calcTextDimensions(label, fontSize).width);
195
- return Math.max(maxLength, curLength);
196
- }
197
- return maxLength;
198
- }, 0);
199
- };
@@ -1,10 +0,0 @@
1
- import { ValueFormatter } from "../types/charts";
2
- export declare const getTextWidth: (text: string) => number;
3
- export declare const getMaxLabelLength: ({ data, valueFormatter, index, layout, margin, isScatterChart, }: {
4
- data: Array<Record<string, any>>;
5
- index: string;
6
- isScatterChart?: boolean | undefined;
7
- layout?: "horizontal" | "vertical" | undefined;
8
- margin?: number | undefined;
9
- valueFormatter?: ValueFormatter | undefined;
10
- }) => number;
@@ -1,110 +0,0 @@
1
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
- import { defaultValueFormatter, isOnSeverSide } from "./index";
5
- export var getTextWidth = function getTextWidth(text) {
6
- if (isOnSeverSide) return 0;
7
-
8
- // 创建临时 span 元素
9
- var span = document.createElement('span');
10
-
11
- // 设置样式使其不可见
12
- span.style.fontSize = '12px';
13
- span.style.position = 'absolute';
14
- span.style.visibility = 'hidden';
15
- span.style.whiteSpace = 'nowrap';
16
-
17
- // 设置文本内容
18
- span.textContent = text;
19
-
20
- // 添加到 body
21
- document.body.append(span);
22
-
23
- // 获取宽度
24
- var width = span.getBoundingClientRect().width;
25
-
26
- // 移除临时元素
27
- span.remove();
28
- return width;
29
- };
30
- export var getMaxLabelLength = function getMaxLabelLength(_ref) {
31
- var data = _ref.data,
32
- _ref$valueFormatter = _ref.valueFormatter,
33
- valueFormatter = _ref$valueFormatter === void 0 ? defaultValueFormatter : _ref$valueFormatter,
34
- index = _ref.index,
35
- _ref$layout = _ref.layout,
36
- layout = _ref$layout === void 0 ? 'horizontal' : _ref$layout,
37
- _ref$margin = _ref.margin,
38
- margin = _ref$margin === void 0 ? 24 : _ref$margin,
39
- isScatterChart = _ref.isScatterChart;
40
- var maxLength = 0;
41
- var maxLabel = '';
42
- if (isScatterChart) {
43
- var _iterator = _createForOfIteratorHelper(data),
44
- _step;
45
- try {
46
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
47
- var item = _step.value;
48
- var formattedValue = valueFormatter(item[index]);
49
- if (formattedValue.length > maxLength) {
50
- maxLength = formattedValue.length;
51
- maxLabel = formattedValue;
52
- }
53
- }
54
- } catch (err) {
55
- _iterator.e(err);
56
- } finally {
57
- _iterator.f();
58
- }
59
- } else if (layout === 'vertical') {
60
- var _iterator2 = _createForOfIteratorHelper(data),
61
- _step2;
62
- try {
63
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
64
- var _item = _step2.value;
65
- if (_item[index].length > maxLength) {
66
- maxLength = _item[index].length;
67
- maxLabel = _item[index];
68
- }
69
- }
70
- } catch (err) {
71
- _iterator2.e(err);
72
- } finally {
73
- _iterator2.f();
74
- }
75
- } else {
76
- var _iterator3 = _createForOfIteratorHelper(data),
77
- _step3;
78
- try {
79
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
80
- var _item2 = _step3.value;
81
- var categories = Object.keys(_item2).filter(function (key) {
82
- return key !== index;
83
- });
84
- var _iterator4 = _createForOfIteratorHelper(categories),
85
- _step4;
86
- try {
87
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
88
- var category = _step4.value;
89
- var value = _item2[category];
90
- if (value === undefined) continue; // Skip null or undefined values
91
- var _formattedValue = valueFormatter(value);
92
- if (_formattedValue.length > maxLength) {
93
- maxLength = _formattedValue.length;
94
- maxLabel = _formattedValue;
95
- }
96
- }
97
- } catch (err) {
98
- _iterator4.e(err);
99
- } finally {
100
- _iterator4.f();
101
- }
102
- }
103
- } catch (err) {
104
- _iterator3.e(err);
105
- } finally {
106
- _iterator3.f();
107
- }
108
- }
109
- return getTextWidth(maxLabel) + margin;
110
- };
package/es/utils/index.js DELETED
@@ -1,32 +0,0 @@
1
- import { DeltaTypes } from "../types/charts";
2
- export var defaultValueFormatter = String;
3
- export var sumNumericArray = function sumNumericArray(arr) {
4
- return arr.reduce(function (prefixSum, num) {
5
- return prefixSum + num;
6
- }, 0);
7
- };
8
- export var isOnSeverSide = typeof document === 'undefined' || typeof window === 'undefined';
9
- export var mapInputsToDeltaType = function mapInputsToDeltaType(deltaType, isIncreasePositive) {
10
- if (isIncreasePositive || deltaType === DeltaTypes.Unchanged) {
11
- return deltaType;
12
- }
13
- switch (deltaType) {
14
- case DeltaTypes.Increase:
15
- {
16
- return DeltaTypes.Decrease;
17
- }
18
- case DeltaTypes.ModerateIncrease:
19
- {
20
- return DeltaTypes.ModerateDecrease;
21
- }
22
- case DeltaTypes.Decrease:
23
- {
24
- return DeltaTypes.Increase;
25
- }
26
- case DeltaTypes.ModerateDecrease:
27
- {
28
- return DeltaTypes.ModerateIncrease;
29
- }
30
- }
31
- return '';
32
- };
package/es/utils/theme.js DELETED
@@ -1,40 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- import chroma from 'chroma-js';
3
- var isstringScale = function isstringScale(colors, size) {
4
- var invalidstring = colors.find(function (color) {
5
- return !chroma.valid(color);
6
- });
7
- if (invalidstring) {
8
- throw new Error("Invalid color \"".concat(String(invalidstring), "\" passed. All CSS color formats are accepted."));
9
- }
10
- return colors.length === size;
11
- };
12
- var createstringScale = function createstringScale(colors, size) {
13
- return chroma.scale(colors).mode('lch').colors(size);
14
- };
15
- var validateTheme = function validateTheme(input, size) {
16
- if (_typeof(input) !== 'object' || input === undefined) {
17
- throw new Error("The theme object must contain at least 2 or ".concat(size, " colors respectively."));
18
- }
19
- if (input) {
20
- var length = input.length;
21
- if (length !== 2 && length !== size) {
22
- throw new Error("theme must contain exactly 2 or ".concat(size, " colors, ").concat(length, " passed."));
23
- }
24
- }
25
- };
26
- var createDefaultTheme = function createDefaultTheme(size) {
27
- return createstringScale(['hsl(0, 0%, 20%)', 'hsl(0, 0%, 92%)'], size);
28
- };
29
- export function createTheme(input) {
30
- var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
31
- var defaultTheme = createDefaultTheme(size);
32
- if (input) {
33
- validateTheme(input, size);
34
- var theme = input !== null && input !== void 0 ? input : defaultTheme;
35
-
36
- // @ts-ignore
37
- return isstringScale(theme, size) ? theme : createstringScale(theme, size);
38
- }
39
- return defaultTheme;
40
- }