@lobehub/charts 5.6.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 +23 -5
  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 -448
  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 -850
  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 -200
  280. package/es/DataBars/DeltaBar.d.ts +0 -13
  281. package/es/DataBars/DeltaBar.js +0 -116
  282. package/es/DataBars/MarkerBar.d.ts +0 -16
  283. package/es/DataBars/MarkerBar.js +0 -93
  284. package/es/DataBars/ProgressBar.d.ts +0 -12
  285. package/es/DataBars/ProgressBar.js +0 -70
  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 -226
  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 -63
  360. package/es/Tracker/index.d.ts +0 -18
  361. package/es/Tracker/index.js +0 -104
  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 -41
  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
@@ -0,0 +1,19 @@
1
+ import { DeltaTypes } from "../types/charts.mjs";
2
+ //#region src/utils/index.ts
3
+ const defaultValueFormatter = String;
4
+ const sumNumericArray = (arr) => arr.reduce((prefixSum, num) => prefixSum + num, 0);
5
+ const isOnSeverSide = typeof document === "undefined" || typeof window === "undefined";
6
+ const mapInputsToDeltaType = (deltaType, isIncreasePositive) => {
7
+ if (isIncreasePositive || deltaType === DeltaTypes.Unchanged) return deltaType;
8
+ switch (deltaType) {
9
+ case DeltaTypes.Increase: return DeltaTypes.Decrease;
10
+ case DeltaTypes.ModerateIncrease: return DeltaTypes.ModerateDecrease;
11
+ case DeltaTypes.Decrease: return DeltaTypes.Increase;
12
+ case DeltaTypes.ModerateDecrease: return DeltaTypes.ModerateIncrease;
13
+ }
14
+ return "";
15
+ };
16
+ //#endregion
17
+ export { defaultValueFormatter, isOnSeverSide, mapInputsToDeltaType, sumNumericArray };
18
+
19
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["import { DeltaTypes, ValueFormatter } from '@/types/charts';\n\nexport const defaultValueFormatter: ValueFormatter = String;\n\nexport const sumNumericArray = (arr: number[]) =>\n arr.reduce((prefixSum, num) => prefixSum + num, 0);\n\nexport const isOnSeverSide = typeof document === 'undefined' || typeof window === 'undefined';\n\nexport const mapInputsToDeltaType = (deltaType: string, isIncreasePositive: boolean): string => {\n if (isIncreasePositive || deltaType === DeltaTypes.Unchanged) {\n return deltaType;\n }\n switch (deltaType) {\n case DeltaTypes.Increase: {\n return DeltaTypes.Decrease;\n }\n case DeltaTypes.ModerateIncrease: {\n return DeltaTypes.ModerateDecrease;\n }\n case DeltaTypes.Decrease: {\n return DeltaTypes.Increase;\n }\n case DeltaTypes.ModerateDecrease: {\n return DeltaTypes.ModerateIncrease;\n }\n }\n return '';\n};\n"],"mappings":";;AAEA,MAAa,wBAAwC;AAErD,MAAa,mBAAmB,QAC9B,IAAI,QAAQ,WAAW,QAAQ,YAAY,KAAK,CAAC;AAEnD,MAAa,gBAAgB,OAAO,aAAa,eAAe,OAAO,WAAW;AAElF,MAAa,wBAAwB,WAAmB,uBAAwC;CAC9F,IAAI,sBAAsB,cAAc,WAAW,WACjD,OAAO;CAET,QAAQ,WAAR;EACE,KAAK,WAAW,UACd,OAAO,WAAW;EAEpB,KAAK,WAAW,kBACd,OAAO,WAAW;EAEpB,KAAK,WAAW,UACd,OAAO,WAAW;EAEpB,KAAK,WAAW,kBACd,OAAO,WAAW;CAEtB;CACA,OAAO;AACT"}
@@ -1 +1,4 @@
1
+ //#region src/utils/theme.d.ts
1
2
  export declare function createTheme(input?: string[], size?: number): string[];
3
+ //#endregion
4
+ //# sourceMappingURL=theme.d.mts.map
@@ -0,0 +1,33 @@
1
+ import chroma from "chroma-js";
2
+ //#region src/utils/theme.ts
3
+ const isstringScale = (colors, size) => {
4
+ const invalidstring = colors.find((color) => !chroma.valid(color));
5
+ if (invalidstring) throw new Error(`Invalid color "${String(invalidstring)}" passed. All CSS color formats are accepted.`);
6
+ return colors.length === size;
7
+ };
8
+ const createstringScale = (colors, size) => {
9
+ return chroma.scale(colors).mode("lch").colors(size);
10
+ };
11
+ const validateTheme = (input, size) => {
12
+ if (typeof input !== "object" || input === void 0) throw new Error(`The theme object must contain at least 2 or ${size} colors respectively.`);
13
+ if (input) {
14
+ const { length } = input;
15
+ if (length !== 2 && length !== size) throw new Error(`theme must contain exactly 2 or ${size} colors, ${length} passed.`);
16
+ }
17
+ };
18
+ const createDefaultTheme = (size) => {
19
+ return createstringScale(["hsl(0, 0%, 20%)", "hsl(0, 0%, 92%)"], size);
20
+ };
21
+ function createTheme(input, size = 5) {
22
+ const defaultTheme = createDefaultTheme(size);
23
+ if (input) {
24
+ validateTheme(input, size);
25
+ const theme = input ?? defaultTheme;
26
+ return isstringScale(theme, size) ? theme : createstringScale(theme, size);
27
+ }
28
+ return defaultTheme;
29
+ }
30
+ //#endregion
31
+ export { createTheme };
32
+
33
+ //# sourceMappingURL=theme.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.mjs","names":[],"sources":["../../src/utils/theme.ts"],"sourcesContent":["import chroma from 'chroma-js';\n\nconst isstringScale = (colors: Array<unknown>, size: number) => {\n const invalidstring = colors.find((color) => !chroma.valid(color));\n\n if (invalidstring) {\n throw new Error(\n `Invalid color \"${String(invalidstring)}\" passed. All CSS color formats are accepted.`,\n );\n }\n\n return colors.length === size;\n};\n\nconst createstringScale = (colors: [from: string, to: string], size: number): string[] => {\n return chroma.scale(colors).mode('lch').colors(size);\n};\n\nconst validateTheme = (input: string[], size: number) => {\n if (typeof input !== 'object' || input === undefined) {\n throw new Error(`The theme object must contain at least 2 or ${size} colors respectively.`);\n }\n\n if (input) {\n const { length } = input;\n if (length !== 2 && length !== size) {\n throw new Error(`theme must contain exactly 2 or ${size} colors, ${length} passed.`);\n }\n }\n};\n\nconst createDefaultTheme = (size: number): string[] => {\n return createstringScale(['hsl(0, 0%, 20%)', 'hsl(0, 0%, 92%)'], size);\n};\n\nexport function createTheme(input?: string[], size: number = 5): string[] {\n const defaultTheme = createDefaultTheme(size);\n\n if (input) {\n validateTheme(input, size);\n\n const theme = input ?? defaultTheme;\n\n // @ts-ignore\n return isstringScale(theme, size) ? theme : createstringScale(theme, size);\n }\n\n return defaultTheme;\n}\n"],"mappings":";;AAEA,MAAM,iBAAiB,QAAwB,SAAiB;CAC9D,MAAM,gBAAgB,OAAO,MAAM,UAAU,CAAC,OAAO,MAAM,KAAK,CAAC;CAEjE,IAAI,eACF,MAAM,IAAI,MACR,kBAAkB,OAAO,aAAa,EAAE,8CAC1C;CAGF,OAAO,OAAO,WAAW;AAC3B;AAEA,MAAM,qBAAqB,QAAoC,SAA2B;CACxF,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,OAAO,IAAI;AACrD;AAEA,MAAM,iBAAiB,OAAiB,SAAiB;CACvD,IAAI,OAAO,UAAU,YAAY,UAAU,KAAA,GACzC,MAAM,IAAI,MAAM,+CAA+C,KAAK,sBAAsB;CAG5F,IAAI,OAAO;EACT,MAAM,EAAE,WAAW;EACnB,IAAI,WAAW,KAAK,WAAW,MAC7B,MAAM,IAAI,MAAM,mCAAmC,KAAK,WAAW,OAAO,SAAS;CAEvF;AACF;AAEA,MAAM,sBAAsB,SAA2B;CACrD,OAAO,kBAAkB,CAAC,mBAAmB,iBAAiB,GAAG,IAAI;AACvE;AAEA,SAAgB,YAAY,OAAkB,OAAe,GAAa;CACxE,MAAM,eAAe,mBAAmB,IAAI;CAE5C,IAAI,OAAO;EACT,cAAc,OAAO,IAAI;EAEzB,MAAM,QAAQ,SAAS;EAGvB,OAAO,cAAc,OAAO,IAAI,IAAI,QAAQ,kBAAkB,OAAO,IAAI;CAC3E;CAEA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/charts",
3
- "version": "5.6.0",
3
+ "version": "5.7.1",
4
4
  "description": "React modern charts components built on recharts",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -19,9 +19,27 @@
19
19
  "sideEffects": [
20
20
  "**/*.css"
21
21
  ],
22
- "main": "es/index.js",
23
- "module": "es/index.js",
24
- "types": "es/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./es/index.d.mts",
25
+ "import": "./es/index.mjs",
26
+ "default": "./es/index.mjs"
27
+ },
28
+ "./es/*.js": {
29
+ "types": "./es/*.d.mts",
30
+ "import": "./es/*.mjs",
31
+ "default": "./es/*.mjs"
32
+ },
33
+ "./es/*": {
34
+ "types": "./es/*/index.d.mts",
35
+ "import": "./es/*/index.mjs",
36
+ "default": "./es/*/index.mjs"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "main": "es/index.mjs",
41
+ "module": "es/index.mjs",
42
+ "types": "es/index.d.mts",
25
43
  "files": [
26
44
  "es"
27
45
  ],
@@ -36,7 +54,7 @@
36
54
  "recharts": "^2.15.4"
37
55
  },
38
56
  "peerDependencies": {
39
- "@lobehub/ui": "^4.3.3",
57
+ "@lobehub/ui": "^5.54.0",
40
58
  "antd": "^6.1.1",
41
59
  "react": "^19.0.0",
42
60
  "react-dom": "^19.0.0"
@@ -1,60 +0,0 @@
1
- /// <reference types="react" />
2
- import BaseChartProps from "../common/BaseChartProps";
3
- export interface AccuracyBarChartProps extends Omit<BaseChartProps, 'categories'> {
4
- /**
5
- * Custom accuracy formatter
6
- */
7
- accuracyFormatter?: (value: number) => string;
8
- /**
9
- * Gap between bar categories
10
- */
11
- barCategoryGap?: string | number;
12
- /**
13
- * Single data category key (e.g., 'accuracy')
14
- * @default 'accuracy'
15
- */
16
- category?: string;
17
- /**
18
- * Color scheme for accuracy levels
19
- * @default 'gradient'
20
- */
21
- colorScheme?: 'gradient' | 'threshold' | 'uniform';
22
- /**
23
- * Error value formatter used in tooltip when displaying value±error
24
- */
25
- errorFormatter?: (value: number) => string;
26
- /**
27
- * Error bar data key (e.g., 'error', 'stdDev')
28
- */
29
- errorKey?: string;
30
- /**
31
- * Chart layout orientation
32
- * @default 'vertical'
33
- */
34
- layout?: 'vertical' | 'horizontal';
35
- /**
36
- * Show error bars on the right side
37
- * @default true
38
- */
39
- showErrorBars?: boolean;
40
- /**
41
- * Show accuracy value on the left side
42
- * @default true
43
- */
44
- showLeftValue?: boolean;
45
- /**
46
- * Show accuracy percentage on bars
47
- * @default true
48
- */
49
- showPercentage?: boolean;
50
- /**
51
- * Threshold values for color coding (only used with 'threshold' colorScheme)
52
- */
53
- thresholds?: {
54
- excellent?: number;
55
- fair?: number;
56
- good?: number;
57
- };
58
- }
59
- declare const AccuracyBarChart: import("react").ForwardRefExoticComponent<AccuracyBarChartProps & import("react").RefAttributes<HTMLDivElement>>;
60
- export default AccuracyBarChart;
@@ -1,454 +0,0 @@
1
- 'use client';
2
-
3
- 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); }
4
- var _templateObject;
5
- var _excluded = ["data", "category", "customCategories", "index", "yAxisAlign", "colors", "valueFormatter", "xAxisLabelFormatter", "layout", "startEndOnly", "animationDuration", "showAnimation", "showXAxis", "showYAxis", "yAxisWidth", "intervalType", "showTooltip", "showLegend", "showGridLines", "autoMinValue", "minValue", "maxValue", "allowDecimals", "noDataText", "onValueChange", "enableLegendSlider", "showPercentage", "customTooltip", "rotateLabelX", "barCategoryGap", "tickGap", "loading", "xAxisLabel", "yAxisLabel", "className", "width", "height", "style", "showErrorBars", "errorFormatter", "errorKey", "accuracyFormatter"];
6
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
7
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
11
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
- 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."); }
14
- 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); }
15
- 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; }
16
- 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; } }
17
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
- import { Flexbox, Skeleton } from '@lobehub/ui';
21
- import { css, cssVar, cx } from 'antd-style';
22
- import { forwardRef, useMemo, useState } from 'react';
23
- import { Bar, CartesianGrid, ErrorBar, Label, LabelList, Legend, BarChart as ReChartsBarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
24
- import ChartLegend from "../common/ChartLegend";
25
- import ChartTooltip from "../common/ChartTooltip";
26
- import CustomYAxisTick from "../common/CustomYAxisTick";
27
- import NoData from "../common/NoData";
28
- import { constructCategoryColors, deepEqual, getYAxisDomain } from "../common/utils";
29
- import { useThemeColorRange } from "../hooks/useThemeColorRange";
30
- import { defaultValueFormatter } from "../utils";
31
- import { getMaxLabelLength, getTextWidth } from "../utils/getMaxLabelLength";
32
- import { styles } from "./styles";
33
- import { jsx as _jsx } from "react/jsx-runtime";
34
- import { jsxs as _jsxs } from "react/jsx-runtime";
35
- import { Fragment as _Fragment } from "react/jsx-runtime";
36
- var AccuracyBarChart = /*#__PURE__*/forwardRef(function (props, ref) {
37
- var _categoryColors$get;
38
- var themeColorRange = useThemeColorRange();
39
- var _props$data = props.data,
40
- data = _props$data === void 0 ? [] : _props$data,
41
- _props$category = props.category,
42
- category = _props$category === void 0 ? 'accuracy' : _props$category,
43
- customCategories = props.customCategories,
44
- index = props.index,
45
- _props$yAxisAlign = props.yAxisAlign,
46
- yAxisAlign = _props$yAxisAlign === void 0 ? 'left' : _props$yAxisAlign,
47
- _props$colors = props.colors,
48
- colors = _props$colors === void 0 ? themeColorRange : _props$colors,
49
- _props$valueFormatter = props.valueFormatter,
50
- valueFormatter = _props$valueFormatter === void 0 ? defaultValueFormatter : _props$valueFormatter,
51
- _props$xAxisLabelForm = props.xAxisLabelFormatter,
52
- xAxisLabelFormatter = _props$xAxisLabelForm === void 0 ? defaultValueFormatter : _props$xAxisLabelForm,
53
- _props$layout = props.layout,
54
- layout = _props$layout === void 0 ? 'vertical' : _props$layout,
55
- _props$startEndOnly = props.startEndOnly,
56
- startEndOnly = _props$startEndOnly === void 0 ? false : _props$startEndOnly,
57
- _props$animationDurat = props.animationDuration,
58
- animationDuration = _props$animationDurat === void 0 ? 900 : _props$animationDurat,
59
- _props$showAnimation = props.showAnimation,
60
- showAnimation = _props$showAnimation === void 0 ? false : _props$showAnimation,
61
- _props$showXAxis = props.showXAxis,
62
- showXAxis = _props$showXAxis === void 0 ? true : _props$showXAxis,
63
- _props$showYAxis = props.showYAxis,
64
- showYAxis = _props$showYAxis === void 0 ? true : _props$showYAxis,
65
- yAxisWidth = props.yAxisWidth,
66
- _props$intervalType = props.intervalType,
67
- intervalType = _props$intervalType === void 0 ? 'equidistantPreserveStart' : _props$intervalType,
68
- _props$showTooltip = props.showTooltip,
69
- showTooltip = _props$showTooltip === void 0 ? true : _props$showTooltip,
70
- _props$showLegend = props.showLegend,
71
- showLegend = _props$showLegend === void 0 ? false : _props$showLegend,
72
- _props$showGridLines = props.showGridLines,
73
- showGridLines = _props$showGridLines === void 0 ? true : _props$showGridLines,
74
- _props$autoMinValue = props.autoMinValue,
75
- autoMinValue = _props$autoMinValue === void 0 ? true : _props$autoMinValue,
76
- _props$minValue = props.minValue,
77
- minValue = _props$minValue === void 0 ? 0 : _props$minValue,
78
- _props$maxValue = props.maxValue,
79
- maxValue = _props$maxValue === void 0 ? 100 : _props$maxValue,
80
- _props$allowDecimals = props.allowDecimals,
81
- allowDecimals = _props$allowDecimals === void 0 ? true : _props$allowDecimals,
82
- noDataText = props.noDataText,
83
- onValueChange = props.onValueChange,
84
- _props$enableLegendSl = props.enableLegendSlider,
85
- enableLegendSlider = _props$enableLegendSl === void 0 ? false : _props$enableLegendSl,
86
- _props$showPercentage = props.showPercentage,
87
- showPercentage = _props$showPercentage === void 0 ? true : _props$showPercentage,
88
- customTooltip = props.customTooltip,
89
- rotateLabelX = props.rotateLabelX,
90
- _props$barCategoryGap = props.barCategoryGap,
91
- barCategoryGap = _props$barCategoryGap === void 0 ? '20%' : _props$barCategoryGap,
92
- _props$tickGap = props.tickGap,
93
- tickGap = _props$tickGap === void 0 ? 5 : _props$tickGap,
94
- loading = props.loading,
95
- xAxisLabel = props.xAxisLabel,
96
- yAxisLabel = props.yAxisLabel,
97
- className = props.className,
98
- _props$width = props.width,
99
- width = _props$width === void 0 ? '100%' : _props$width,
100
- _props$height = props.height,
101
- height = _props$height === void 0 ? 400 : _props$height,
102
- style = props.style,
103
- _props$showErrorBars = props.showErrorBars,
104
- showErrorBars = _props$showErrorBars === void 0 ? true : _props$showErrorBars,
105
- _props$errorFormatter = props.errorFormatter,
106
- errorFormatter = _props$errorFormatter === void 0 ? function (value) {
107
- return value.toFixed(1);
108
- } : _props$errorFormatter,
109
- _props$errorKey = props.errorKey,
110
- errorKey = _props$errorKey === void 0 ? 'error' : _props$errorKey,
111
- _props$accuracyFormat = props.accuracyFormatter,
112
- accuracyFormatter = _props$accuracyFormat === void 0 ? function (value) {
113
- return "".concat(value.toFixed(1), "%");
114
- } : _props$accuracyFormat,
115
- rest = _objectWithoutProperties(props, _excluded);
116
- var _useState = useState(),
117
- _useState2 = _slicedToArray(_useState, 2),
118
- activeBar = _useState2[0],
119
- setActiveBar = _useState2[1];
120
- var _useState3 = useState(),
121
- _useState4 = _slicedToArray(_useState3, 2),
122
- activeLegend = _useState4[0],
123
- setActiveLegend = _useState4[1];
124
- var _useState5 = useState(60),
125
- _useState6 = _slicedToArray(_useState5, 2),
126
- legendHeight = _useState6[0],
127
- setLegendHeight = _useState6[1];
128
- var calculatedYAxisWidth = useMemo(function () {
129
- if (yAxisWidth) return yAxisWidth;
130
- return getMaxLabelLength({
131
- data: data,
132
- index: index,
133
- layout: layout,
134
- valueFormatter: xAxisLabelFormatter
135
- });
136
- }, [yAxisWidth, layout, data, xAxisLabelFormatter, index]);
137
- if (loading || !data) return /*#__PURE__*/_jsx(Skeleton.Block, {
138
- active: true,
139
- height: height,
140
- width: width
141
- });
142
- var CustomTooltip = customTooltip;
143
- var paddingValue = !showXAxis && !showYAxis ? 0 : 20;
144
- var categoryColors = constructCategoryColors([category], colors);
145
- var hasOnValueChange = !!onValueChange;
146
- var onBarClick = function onBarClick(data, idx, event) {
147
- event.stopPropagation();
148
- if (!onValueChange) return;
149
- if (deepEqual(activeBar, _objectSpread(_objectSpread({}, data.payload), {}, {
150
- value: data.value
151
- }))) {
152
- setActiveLegend(undefined);
153
- setActiveBar(undefined);
154
- onValueChange === null || onValueChange === void 0 || onValueChange(null);
155
- } else {
156
- var _data$tooltipPayload, _data$tooltipPayload2;
157
- setActiveLegend((_data$tooltipPayload = data.tooltipPayload) === null || _data$tooltipPayload === void 0 || (_data$tooltipPayload = _data$tooltipPayload[0]) === null || _data$tooltipPayload === void 0 ? void 0 : _data$tooltipPayload.dataKey);
158
- setActiveBar(_objectSpread(_objectSpread({}, data.payload), {}, {
159
- value: data.value
160
- }));
161
- onValueChange === null || onValueChange === void 0 || onValueChange(_objectSpread({
162
- categoryClicked: (_data$tooltipPayload2 = data.tooltipPayload) === null || _data$tooltipPayload2 === void 0 || (_data$tooltipPayload2 = _data$tooltipPayload2[0]) === null || _data$tooltipPayload2 === void 0 ? void 0 : _data$tooltipPayload2.dataKey,
163
- eventType: 'bar'
164
- }, data.payload));
165
- }
166
- };
167
- var onCategoryClick = function onCategoryClick(dataKey) {
168
- if (!hasOnValueChange) return;
169
- if (dataKey === activeLegend && !activeBar) {
170
- setActiveLegend(undefined);
171
- onValueChange === null || onValueChange === void 0 || onValueChange(null);
172
- } else {
173
- setActiveLegend(dataKey);
174
- onValueChange === null || onValueChange === void 0 || onValueChange({
175
- categoryClicked: dataKey,
176
- eventType: 'category'
177
- });
178
- }
179
- setActiveBar(undefined);
180
- };
181
- var yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);
182
-
183
- // Custom accuracy formatter for display
184
- var displayFormatter = accuracyFormatter || valueFormatter;
185
- return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
186
- className: className,
187
- height: height,
188
- ref: ref,
189
- style: _objectSpread({
190
- position: 'relative'
191
- }, style),
192
- width: width
193
- }, rest), {}, {
194
- children: /*#__PURE__*/_jsx(ResponsiveContainer, {
195
- children: data !== null && data !== void 0 && data.length ? /*#__PURE__*/_jsxs(ReChartsBarChart, {
196
- barCategoryGap: barCategoryGap,
197
- data: data,
198
- layout: layout === 'vertical' ? 'vertical' : 'horizontal',
199
- margin: {
200
- bottom: xAxisLabel ? 30 : undefined,
201
- left: yAxisLabel ? 20 : undefined,
202
- right: showErrorBars && layout === 'vertical' ? 40 : yAxisLabel ? 5 : undefined,
203
- top: 5
204
- },
205
- onClick: hasOnValueChange && (activeLegend || activeBar) ? function () {
206
- setActiveBar(undefined);
207
- setActiveLegend(undefined);
208
- onValueChange === null || onValueChange === void 0 || onValueChange(null);
209
- } : undefined,
210
- children: [showGridLines ? /*#__PURE__*/_jsx(CartesianGrid, {
211
- className: styles.gridLines,
212
- horizontal: layout !== 'vertical',
213
- vertical: layout === 'vertical'
214
- }) : undefined, layout === 'vertical' ? /*#__PURE__*/_jsx(XAxis, {
215
- allowDecimals: allowDecimals,
216
- angle: rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.angle,
217
- axisLine: false,
218
- className: styles.label,
219
- domain: yAxisDomain,
220
- dy: rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.verticalShift,
221
- fill: "",
222
- hide: !showXAxis,
223
- minTickGap: tickGap,
224
- stroke: "",
225
- tick: {
226
- transform: 'translate(-3, 0)'
227
- },
228
- tickFormatter: displayFormatter,
229
- tickLine: false,
230
- type: "number",
231
- children: xAxisLabel && /*#__PURE__*/_jsx(Label, {
232
- className: cx(styles.strongLabel, styles.emphasis),
233
- offset: -20,
234
- position: "insideBottom",
235
- style: {
236
- fill: cssVar.colorTextSecondary,
237
- fontWeight: 500,
238
- textAnchor: 'middle'
239
- },
240
- children: xAxisLabel
241
- })
242
- }) : /*#__PURE__*/_jsx(XAxis, {
243
- angle: rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.angle,
244
- axisLine: false,
245
- className: styles.label,
246
- dataKey: index,
247
- dy: rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.verticalShift,
248
- fill: "",
249
- hide: !showXAxis,
250
- interval: startEndOnly ? 'preserveStartEnd' : intervalType,
251
- minTickGap: tickGap,
252
- padding: {
253
- left: paddingValue,
254
- right: paddingValue
255
- },
256
- stroke: "",
257
- tick: {
258
- transform: 'translate(0, 6)'
259
- },
260
- tickFormatter: xAxisLabelFormatter,
261
- tickLine: false,
262
- ticks: startEndOnly ? [data[0][index], data.at(-1)[index]] : undefined,
263
- children: xAxisLabel && /*#__PURE__*/_jsx(Label, {
264
- className: cx(styles.strongLabel, styles.emphasis),
265
- offset: -20,
266
- position: "insideBottom",
267
- style: {
268
- fill: cssVar.colorTextSecondary,
269
- fontWeight: 500,
270
- textAnchor: 'middle'
271
- },
272
- children: xAxisLabel
273
- })
274
- }), layout === 'vertical' ? /*#__PURE__*/_jsx(YAxis, {
275
- axisLine: false,
276
- className: styles.label,
277
- dataKey: index,
278
- fill: "",
279
- hide: !showYAxis,
280
- interval: "preserveStartEnd",
281
- stroke: "",
282
- tick: function tick(props) {
283
- return /*#__PURE__*/_jsx(CustomYAxisTick, _objectSpread(_objectSpread({}, props), {}, {
284
- align: yAxisAlign,
285
- formatter: xAxisLabelFormatter,
286
- textAnchor: yAxisAlign === 'left' ? 'start' : 'end',
287
- yAxisLabel: Boolean(yAxisLabel)
288
- }));
289
- },
290
- tickFormatter: xAxisLabelFormatter,
291
- tickLine: false,
292
- ticks: startEndOnly ? [data[0][index], data.at(-1)[index]] : undefined,
293
- type: "category",
294
- width: calculatedYAxisWidth,
295
- children: yAxisLabel && /*#__PURE__*/_jsx(Label, {
296
- angle: -90,
297
- className: styles.emphasis,
298
- offset: -15,
299
- position: "insideLeft",
300
- style: {
301
- fill: cssVar.colorTextSecondary,
302
- fontWeight: 500,
303
- textAnchor: 'middle'
304
- },
305
- children: yAxisLabel
306
- })
307
- }) : /*#__PURE__*/_jsx(YAxis, {
308
- allowDecimals: allowDecimals,
309
- axisLine: false,
310
- className: styles.label,
311
- domain: yAxisDomain,
312
- fill: "",
313
- hide: !showYAxis,
314
- stroke: "",
315
- tick: function tick(props) {
316
- return /*#__PURE__*/_jsx(CustomYAxisTick, _objectSpread(_objectSpread({}, props), {}, {
317
- align: yAxisAlign,
318
- formatter: displayFormatter,
319
- textAnchor: yAxisAlign === 'left' ? 'start' : 'end',
320
- yAxisLabel: Boolean(yAxisLabel)
321
- }));
322
- },
323
- tickFormatter: displayFormatter,
324
- tickLine: false,
325
- type: "number",
326
- width: calculatedYAxisWidth,
327
- children: yAxisLabel && /*#__PURE__*/_jsx(Label, {
328
- angle: -90,
329
- className: styles.emphasis,
330
- offset: -15,
331
- position: "insideLeft",
332
- style: {
333
- fill: cssVar.colorTextSecondary,
334
- fontWeight: 500,
335
- textAnchor: 'middle'
336
- },
337
- children: yAxisLabel
338
- })
339
- }), /*#__PURE__*/_jsx(Tooltip, {
340
- content: showTooltip ? function (_ref) {
341
- var active = _ref.active,
342
- payload = _ref.payload,
343
- label = _ref.label;
344
- return CustomTooltip ? /*#__PURE__*/_jsx(CustomTooltip, {
345
- active: active,
346
- customCategories: customCategories,
347
- label: label,
348
- payload: payload === null || payload === void 0 ? void 0 : payload.map(function (payloadItem) {
349
- var record = data.find(function (item) {
350
- return item[index] === label;
351
- });
352
- var errVal = record === null || record === void 0 ? void 0 : record[errorKey];
353
- var combined = errVal === undefined || errVal === null ? accuracyFormatter(Number(payloadItem.value)) : "".concat(accuracyFormatter(Number(payloadItem.value)), " \xB1 ").concat(errorFormatter(Number(errVal)));
354
- return _objectSpread(_objectSpread({}, payloadItem), {}, {
355
- formattedValue: combined
356
- });
357
- }),
358
- valueFormatter: displayFormatter
359
- }) : /*#__PURE__*/_jsx(ChartTooltip, {
360
- active: active,
361
- categoryColors: categoryColors,
362
- customCategories: customCategories,
363
- label: label,
364
- payload: payload,
365
- valueFormatter: function valueFormatter(val) {
366
- var record = data.find(function (item) {
367
- return item[index] === label;
368
- });
369
- var errVal = record === null || record === void 0 ? void 0 : record[errorKey];
370
- if (!showErrorBars || errVal === undefined || errVal === null) return accuracyFormatter(Number(val));
371
- return /*#__PURE__*/_jsxs(_Fragment, {
372
- children: [accuracyFormatter(Number(val)), /*#__PURE__*/_jsxs("span", {
373
- style: {
374
- color: cssVar.colorTextSecondary
375
- },
376
- children: [' ', "\xB1 ", errorFormatter(Number(errVal))]
377
- })]
378
- });
379
- }
380
- });
381
- } : undefined,
382
- cursor: {
383
- fill: cssVar.colorFillTertiary
384
- },
385
- isAnimationActive: false,
386
- position: {
387
- y: 0
388
- },
389
- wrapperStyle: {
390
- outline: 'none'
391
- }
392
- }), showLegend ? /*#__PURE__*/_jsx(Legend, {
393
- content: function content(_ref2) {
394
- var payload = _ref2.payload;
395
- return ChartLegend({
396
- payload: payload
397
- }, categoryColors, setLegendHeight, activeLegend, hasOnValueChange ? function (clickedLegendItem) {
398
- return onCategoryClick(clickedLegendItem);
399
- } : undefined, enableLegendSlider, customCategories);
400
- },
401
- height: legendHeight,
402
- verticalAlign: "top"
403
- }) : undefined, /*#__PURE__*/_jsxs(Bar, {
404
- animationDuration: animationDuration,
405
- className: cx(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n fill: ", ";\n "])), (_categoryColors$get = categoryColors.get(category)) !== null && _categoryColors$get !== void 0 ? _categoryColors$get : cssVar.colorPrimary)),
406
- dataKey: category,
407
- fill: '',
408
- isAnimationActive: showAnimation,
409
- name: category,
410
- onClick: onBarClick,
411
- style: {
412
- cursor: onValueChange ? 'pointer' : undefined
413
- },
414
- type: "linear",
415
- children: [showPercentage && layout === 'vertical' ? /*#__PURE__*/_jsx(LabelList, {
416
- content: function content(labelProps) {
417
- var lx = labelProps.x,
418
- ly = labelProps.y,
419
- lh = labelProps.height,
420
- lw = labelProps.width,
421
- value = labelProps.value;
422
- if (lx === null || lx === undefined || ly === null || ly === undefined || lh === null || lh === undefined || lw === null || lw === undefined) return null;
423
- var text = accuracyFormatter(Number(value !== null && value !== void 0 ? value : 0));
424
- var textWidth = getTextWidth(text);
425
- var horizontalPadding = 16; // 8px left padding + 8px safe space
426
- if (Number(lw) <= textWidth + horizontalPadding) return null;
427
- return /*#__PURE__*/_jsx("text", {
428
- className: styles.percentageLabel,
429
- dominantBaseline: "central",
430
- style: {
431
- fill: cssVar.colorTextLightSolid
432
- },
433
- x: Number(lx) + 8,
434
- y: Number(ly) + Number(lh) / 2,
435
- children: text
436
- });
437
- },
438
- dataKey: category,
439
- offset: 8,
440
- position: "insideLeft"
441
- }) : null, showErrorBars ? /*#__PURE__*/_jsx(ErrorBar, {
442
- dataKey: errorKey,
443
- direction: layout === 'vertical' ? 'x' : 'y',
444
- stroke: cssVar.colorTextSecondary
445
- }) : null]
446
- }, category)]
447
- }) : /*#__PURE__*/_jsx(NoData, {
448
- noDataText: noDataText
449
- })
450
- })
451
- }));
452
- });
453
- AccuracyBarChart.displayName = 'AccuracyBarChart';
454
- export default AccuracyBarChart;