@lobehub/charts 6.0.0-beta.1 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (404) hide show
  1. package/README.md +83 -72
  2. package/es/AccuracyBarChart/index.d.mts +62 -0
  3. package/es/AccuracyBarChart/index.mjs +324 -0
  4. package/es/AccuracyBarChart/index.mjs.map +1 -0
  5. package/es/AccuracyBarChart/styles.d.mts +14 -0
  6. package/es/AccuracyBarChart/styles.mjs +71 -0
  7. package/es/AccuracyBarChart/styles.mjs.map +1 -0
  8. package/es/AreaChart/index.d.mts +13 -0
  9. package/es/AreaChart/index.mjs +306 -0
  10. package/es/AreaChart/index.mjs.map +1 -0
  11. package/es/AreaChart/styles.d.mts +9 -0
  12. package/es/AreaChart/styles.mjs +28 -0
  13. package/es/AreaChart/styles.mjs.map +1 -0
  14. package/es/BarChart/index.d.mts +11 -0
  15. package/es/BarChart/index.mjs +288 -0
  16. package/es/BarChart/index.mjs.map +1 -0
  17. package/es/BarChart/{renderShape.d.ts → renderShape.d.mts} +3 -1
  18. package/es/BarChart/renderShape.mjs +28 -0
  19. package/es/BarChart/renderShape.mjs.map +1 -0
  20. package/es/BarChart/styles.d.mts +9 -0
  21. package/es/BarChart/styles.mjs +28 -0
  22. package/es/BarChart/styles.mjs.map +1 -0
  23. package/es/BarList/index.d.mts +32 -0
  24. package/es/BarList/index.mjs +126 -0
  25. package/es/BarList/index.mjs.map +1 -0
  26. package/es/BarList/styles.d.mts +13 -0
  27. package/es/BarList/styles.mjs +63 -0
  28. package/es/BarList/styles.mjs.map +1 -0
  29. package/es/BenchmarkColumnChart/index.d.mts +144 -0
  30. package/es/BenchmarkColumnChart/index.mjs +512 -0
  31. package/es/BenchmarkColumnChart/index.mjs.map +1 -0
  32. package/es/BenchmarkColumnChart/styles.d.mts +19 -0
  33. package/es/BenchmarkColumnChart/styles.mjs +129 -0
  34. package/es/BenchmarkColumnChart/styles.mjs.map +1 -0
  35. package/es/BenchmarkRankingChart/index.d.mts +91 -0
  36. package/es/BenchmarkRankingChart/index.mjs +345 -0
  37. package/es/BenchmarkRankingChart/index.mjs.map +1 -0
  38. package/es/BenchmarkRankingChart/styles.d.mts +36 -0
  39. package/es/BenchmarkRankingChart/styles.mjs +265 -0
  40. package/es/BenchmarkRankingChart/styles.mjs.map +1 -0
  41. package/es/BenchmarkScatterChart/index.d.mts +148 -0
  42. package/es/BenchmarkScatterChart/index.mjs +666 -0
  43. package/es/BenchmarkScatterChart/index.mjs.map +1 -0
  44. package/es/BenchmarkScatterChart/styles.d.mts +28 -0
  45. package/es/BenchmarkScatterChart/styles.mjs +193 -0
  46. package/es/BenchmarkScatterChart/styles.mjs.map +1 -0
  47. package/es/BenchmarkScatterChart/{utils.d.ts → utils.d.mts} +32 -29
  48. package/es/BenchmarkScatterChart/utils.mjs +214 -0
  49. package/es/BenchmarkScatterChart/utils.mjs.map +1 -0
  50. package/es/ComposedChart/index.d.mts +6 -0
  51. package/es/ComposedChart/index.mjs +252 -0
  52. package/es/ComposedChart/index.mjs.map +1 -0
  53. package/es/ComposedChart/styles.d.mts +9 -0
  54. package/es/ComposedChart/styles.mjs +28 -0
  55. package/es/ComposedChart/styles.mjs.map +1 -0
  56. package/es/ComposedChart/types.d.mts +71 -0
  57. package/es/ComposedChart/types.mjs +0 -0
  58. package/es/DataBars/CategoryBar.d.mts +17 -0
  59. package/es/DataBars/CategoryBar.mjs +144 -0
  60. package/es/DataBars/CategoryBar.mjs.map +1 -0
  61. package/es/DataBars/DeltaBar.d.mts +16 -0
  62. package/es/DataBars/DeltaBar.mjs +100 -0
  63. package/es/DataBars/DeltaBar.mjs.map +1 -0
  64. package/es/DataBars/MarkerBar.d.mts +19 -0
  65. package/es/DataBars/MarkerBar.mjs +72 -0
  66. package/es/DataBars/MarkerBar.mjs.map +1 -0
  67. package/es/DataBars/ProgressBar.d.mts +15 -0
  68. package/es/DataBars/ProgressBar.mjs +51 -0
  69. package/es/DataBars/ProgressBar.mjs.map +1 -0
  70. package/es/DataBars/index.d.mts +5 -0
  71. package/es/DataBars/index.mjs +5 -0
  72. package/es/DataBars/styles.d.mts +10 -0
  73. package/es/DataBars/styles.mjs +31 -0
  74. package/es/DataBars/styles.mjs.map +1 -0
  75. package/es/DonutChart/DonutChartTooltip.d.mts +14 -0
  76. package/es/DonutChart/DonutChartTooltip.mjs +25 -0
  77. package/es/DonutChart/DonutChartTooltip.mjs.map +1 -0
  78. package/es/DonutChart/index.d.mts +33 -0
  79. package/es/DonutChart/index.mjs +158 -0
  80. package/es/DonutChart/index.mjs.map +1 -0
  81. package/es/DonutChart/inputParser.d.mts +5 -0
  82. package/es/DonutChart/inputParser.mjs +8 -0
  83. package/es/DonutChart/inputParser.mjs.map +1 -0
  84. package/es/DonutChart/renderInactiveShape.d.mts +4 -0
  85. package/es/DonutChart/renderInactiveShape.mjs +22 -0
  86. package/es/DonutChart/renderInactiveShape.mjs.map +1 -0
  87. package/es/DonutChart/styles.d.mts +9 -0
  88. package/es/DonutChart/styles.mjs +28 -0
  89. package/es/DonutChart/styles.mjs.map +1 -0
  90. package/es/FunnelChart/ArrowRightIcon.d.mts +8 -0
  91. package/es/FunnelChart/ArrowRightIcon.mjs +14 -0
  92. package/es/FunnelChart/ArrowRightIcon.mjs.map +1 -0
  93. package/es/FunnelChart/index.d.mts +21 -0
  94. package/es/FunnelChart/index.mjs +419 -0
  95. package/es/FunnelChart/index.mjs.map +1 -0
  96. package/es/FunnelChart/styles.d.mts +9 -0
  97. package/es/FunnelChart/styles.mjs +28 -0
  98. package/es/FunnelChart/styles.mjs.map +1 -0
  99. package/es/FunnelChart/types.d.mts +31 -0
  100. package/es/FunnelChart/types.mjs +0 -0
  101. package/es/Heatmaps/Calendar.d.mts +21 -0
  102. package/es/Heatmaps/Calendar.mjs +107 -0
  103. package/es/Heatmaps/Calendar.mjs.map +1 -0
  104. package/es/Heatmaps/ChartLabels.d.mts +17 -0
  105. package/es/Heatmaps/ChartLabels.mjs +84 -0
  106. package/es/Heatmaps/ChartLabels.mjs.map +1 -0
  107. package/es/Heatmaps/Footer.d.mts +24 -0
  108. package/es/Heatmaps/Footer.mjs +81 -0
  109. package/es/Heatmaps/Footer.mjs.map +1 -0
  110. package/es/Heatmaps/index.d.mts +31 -0
  111. package/es/Heatmaps/index.mjs +186 -0
  112. package/es/Heatmaps/index.mjs.map +1 -0
  113. package/es/Heatmaps/styles.d.mts +10 -0
  114. package/es/Heatmaps/styles.mjs +47 -0
  115. package/es/Heatmaps/styles.mjs.map +1 -0
  116. package/es/Legend/LegendItem.d.mts +12 -0
  117. package/es/Legend/LegendItem.mjs +63 -0
  118. package/es/Legend/LegendItem.mjs.map +1 -0
  119. package/es/Legend/ScrollButton.d.mts +11 -0
  120. package/es/Legend/ScrollButton.mjs +49 -0
  121. package/es/Legend/ScrollButton.mjs.map +1 -0
  122. package/es/Legend/index.d.mts +16 -0
  123. package/es/Legend/index.mjs +151 -0
  124. package/es/Legend/index.mjs.map +1 -0
  125. package/es/LineChart/index.d.mts +11 -0
  126. package/es/LineChart/index.mjs +269 -0
  127. package/es/LineChart/index.mjs.map +1 -0
  128. package/es/LineChart/styles.d.mts +9 -0
  129. package/es/LineChart/styles.mjs +28 -0
  130. package/es/LineChart/styles.mjs.map +1 -0
  131. package/es/RadarChart/index.d.mts +27 -0
  132. package/es/RadarChart/index.mjs +155 -0
  133. package/es/RadarChart/index.mjs.map +1 -0
  134. package/es/RadarChart/styles.d.mts +8 -0
  135. package/es/RadarChart/styles.mjs +23 -0
  136. package/es/RadarChart/styles.mjs.map +1 -0
  137. package/es/ScatterChart/ScatterChartTooltip.d.mts +19 -0
  138. package/es/ScatterChart/ScatterChartTooltip.mjs +50 -0
  139. package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -0
  140. package/es/ScatterChart/ScatterChartTooltipRow.d.mts +10 -0
  141. package/es/ScatterChart/ScatterChartTooltipRow.mjs +34 -0
  142. package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -0
  143. package/es/ScatterChart/index.d.mts +58 -0
  144. package/es/ScatterChart/index.mjs +239 -0
  145. package/es/ScatterChart/index.mjs.map +1 -0
  146. package/es/ScatterChart/{renderShape.d.ts → renderShape.d.mts} +4 -1
  147. package/es/ScatterChart/renderShape.mjs +18 -0
  148. package/es/ScatterChart/renderShape.mjs.map +1 -0
  149. package/es/ScatterChart/styles.d.mts +9 -0
  150. package/es/ScatterChart/styles.mjs +28 -0
  151. package/es/ScatterChart/styles.mjs.map +1 -0
  152. package/es/SparkChart/SparkAreaChart.d.mts +14 -0
  153. package/es/SparkChart/SparkAreaChart.mjs +107 -0
  154. package/es/SparkChart/SparkAreaChart.mjs.map +1 -0
  155. package/es/SparkChart/SparkBarChart.d.mts +11 -0
  156. package/es/SparkChart/SparkBarChart.mjs +67 -0
  157. package/es/SparkChart/SparkBarChart.mjs.map +1 -0
  158. package/es/SparkChart/SparkLineChart.d.mts +12 -0
  159. package/es/SparkChart/SparkLineChart.mjs +71 -0
  160. package/es/SparkChart/SparkLineChart.mjs.map +1 -0
  161. package/es/SparkChart/index.d.mts +4 -0
  162. package/es/SparkChart/index.mjs +4 -0
  163. package/es/Tracker/TrackerBlock.d.mts +11 -0
  164. package/es/Tracker/TrackerBlock.mjs +50 -0
  165. package/es/Tracker/TrackerBlock.mjs.map +1 -0
  166. package/es/Tracker/index.d.mts +21 -0
  167. package/es/Tracker/index.mjs +67 -0
  168. package/es/Tracker/index.mjs.map +1 -0
  169. package/es/Tracker/styles.d.mts +8 -0
  170. package/es/Tracker/styles.mjs +24 -0
  171. package/es/Tracker/styles.mjs.map +1 -0
  172. package/es/common/BaseAnimationTimingProps.d.mts +10 -0
  173. package/es/common/BaseAnimationTimingProps.mjs +0 -0
  174. package/es/common/BaseChartProps.d.mts +61 -0
  175. package/es/common/BaseChartProps.mjs +0 -0
  176. package/es/common/BaseSparkChartProps.d.mts +17 -0
  177. package/es/common/BaseSparkChartProps.mjs +0 -0
  178. package/es/common/ChartLegend.d.mts +8 -0
  179. package/es/common/ChartLegend.mjs +32 -0
  180. package/es/common/ChartLegend.mjs.map +1 -0
  181. package/es/common/ChartTooltip/ChartTooltipFrame.d.mts +8 -0
  182. package/es/common/ChartTooltip/ChartTooltipFrame.mjs +26 -0
  183. package/es/common/ChartTooltip/ChartTooltipFrame.mjs.map +1 -0
  184. package/es/common/ChartTooltip/ChartTooltipRow.d.mts +10 -0
  185. package/es/common/ChartTooltip/ChartTooltipRow.mjs +49 -0
  186. package/es/common/ChartTooltip/ChartTooltipRow.mjs.map +1 -0
  187. package/es/common/ChartTooltip/index.d.mts +18 -0
  188. package/es/common/ChartTooltip/index.mjs +48 -0
  189. package/es/common/ChartTooltip/index.mjs.map +1 -0
  190. package/es/common/CustomTooltipProps.d.mts +15 -0
  191. package/es/common/CustomTooltipProps.mjs +0 -0
  192. package/es/common/CustomYAxisTick.d.mts +18 -0
  193. package/es/common/CustomYAxisTick.mjs +24 -0
  194. package/es/common/CustomYAxisTick.mjs.map +1 -0
  195. package/es/common/NoData.d.mts +13 -0
  196. package/es/common/NoData.mjs +25 -0
  197. package/es/common/NoData.mjs.map +1 -0
  198. package/es/common/benchmark/index.d.mts +3 -0
  199. package/es/common/benchmark/{index.js → index.mjs} +1 -1
  200. package/es/common/benchmark/types.d.mts +125 -0
  201. package/es/common/benchmark/types.mjs +0 -0
  202. package/es/common/benchmark/{utils.d.ts → utils.d.mts} +38 -36
  203. package/es/common/benchmark/utils.mjs +115 -0
  204. package/es/common/benchmark/utils.mjs.map +1 -0
  205. package/es/common/{utils.d.ts → utils.d.mts} +3 -0
  206. package/es/common/utils.mjs +36 -0
  207. package/es/common/utils.mjs.map +1 -0
  208. package/es/hooks/useOnWindowResize.d.mts +6 -0
  209. package/es/hooks/useOnWindowResize.mjs +18 -0
  210. package/es/hooks/useOnWindowResize.mjs.map +1 -0
  211. package/es/hooks/usePrefersReducedMotion.d.mts +4 -0
  212. package/es/hooks/usePrefersReducedMotion.mjs +24 -0
  213. package/es/hooks/usePrefersReducedMotion.mjs.map +1 -0
  214. package/es/hooks/useThemeColorRange.d.mts +4 -0
  215. package/es/hooks/useThemeColorRange.mjs +28 -0
  216. package/es/hooks/useThemeColorRange.mjs.map +1 -0
  217. package/es/index.d.mts +34 -0
  218. package/es/index.mjs +28 -0
  219. package/es/types/{charts.d.ts → charts.d.mts} +26 -26
  220. package/es/types/charts.mjs +12 -0
  221. package/es/types/charts.mjs.map +1 -0
  222. package/es/utils/{calendar.d.ts → calendar.d.mts} +21 -18
  223. package/es/utils/calendar.mjs +154 -0
  224. package/es/utils/calendar.mjs.map +1 -0
  225. package/es/utils/getMaxLabelLength.d.mts +13 -0
  226. package/es/utils/getMaxLabelLength.mjs +48 -0
  227. package/es/utils/getMaxLabelLength.mjs.map +1 -0
  228. package/es/utils/{index.d.ts → index.d.mts} +4 -1
  229. package/es/utils/index.mjs +19 -0
  230. package/es/utils/index.mjs.map +1 -0
  231. package/es/utils/{theme.d.ts → theme.d.mts} +3 -0
  232. package/es/utils/theme.mjs +33 -0
  233. package/es/utils/theme.mjs.map +1 -0
  234. package/package.json +144 -5
  235. package/es/AccuracyBarChart/index.d.ts +0 -60
  236. package/es/AccuracyBarChart/index.js +0 -452
  237. package/es/AccuracyBarChart/index.mdx +0 -52
  238. package/es/AccuracyBarChart/styles.d.ts +0 -11
  239. package/es/AccuracyBarChart/styles.js +0 -18
  240. package/es/AreaChart/index.d.ts +0 -11
  241. package/es/AreaChart/index.js +0 -428
  242. package/es/AreaChart/index.mdx +0 -49
  243. package/es/AreaChart/styles.d.ts +0 -6
  244. package/es/AreaChart/styles.js +0 -13
  245. package/es/BarChart/index.d.ts +0 -9
  246. package/es/BarChart/index.js +0 -390
  247. package/es/BarChart/index.mdx +0 -73
  248. package/es/BarChart/renderShape.js +0 -34
  249. package/es/BarChart/styles.d.ts +0 -6
  250. package/es/BarChart/styles.js +0 -13
  251. package/es/BarList/index.d.ts +0 -29
  252. package/es/BarList/index.js +0 -172
  253. package/es/BarList/index.mdx +0 -34
  254. package/es/BarList/styles.d.ts +0 -10
  255. package/es/BarList/styles.js +0 -18
  256. package/es/BenchmarkColumnChart/index.d.ts +0 -140
  257. package/es/BenchmarkColumnChart/index.js +0 -684
  258. package/es/BenchmarkColumnChart/index.mdx +0 -66
  259. package/es/BenchmarkColumnChart/styles.d.ts +0 -16
  260. package/es/BenchmarkColumnChart/styles.js +0 -23
  261. package/es/BenchmarkRankingChart/index.d.ts +0 -87
  262. package/es/BenchmarkRankingChart/index.js +0 -453
  263. package/es/BenchmarkRankingChart/index.mdx +0 -59
  264. package/es/BenchmarkRankingChart/styles.d.ts +0 -33
  265. package/es/BenchmarkRankingChart/styles.js +0 -41
  266. package/es/BenchmarkScatterChart/index.d.ts +0 -145
  267. package/es/BenchmarkScatterChart/index.js +0 -855
  268. package/es/BenchmarkScatterChart/index.mdx +0 -61
  269. package/es/BenchmarkScatterChart/styles.d.ts +0 -25
  270. package/es/BenchmarkScatterChart/styles.js +0 -33
  271. package/es/BenchmarkScatterChart/utils.js +0 -353
  272. package/es/ComposedChart/index.d.ts +0 -5
  273. package/es/ComposedChart/index.js +0 -333
  274. package/es/ComposedChart/index.mdx +0 -43
  275. package/es/ComposedChart/styles.d.ts +0 -6
  276. package/es/ComposedChart/styles.js +0 -13
  277. package/es/ComposedChart/types.d.ts +0 -68
  278. package/es/ComposedChart/types.js +0 -1
  279. package/es/DataBars/CategoryBar.d.ts +0 -15
  280. package/es/DataBars/CategoryBar.js +0 -199
  281. package/es/DataBars/DeltaBar.d.ts +0 -13
  282. package/es/DataBars/DeltaBar.js +0 -115
  283. package/es/DataBars/MarkerBar.d.ts +0 -16
  284. package/es/DataBars/MarkerBar.js +0 -92
  285. package/es/DataBars/ProgressBar.d.ts +0 -12
  286. package/es/DataBars/ProgressBar.js +0 -69
  287. package/es/DataBars/index.d.ts +0 -4
  288. package/es/DataBars/index.js +0 -4
  289. package/es/DataBars/index.mdx +0 -36
  290. package/es/DataBars/styles.d.ts +0 -7
  291. package/es/DataBars/styles.js +0 -14
  292. package/es/DonutChart/DonutChartTooltip.d.ts +0 -11
  293. package/es/DonutChart/DonutChartTooltip.js +0 -26
  294. package/es/DonutChart/index.d.ts +0 -31
  295. package/es/DonutChart/index.js +0 -230
  296. package/es/DonutChart/index.mdx +0 -48
  297. package/es/DonutChart/inputParser.d.ts +0 -2
  298. package/es/DonutChart/inputParser.js +0 -9
  299. package/es/DonutChart/renderInactiveShape.d.ts +0 -2
  300. package/es/DonutChart/renderInactiveShape.js +0 -27
  301. package/es/DonutChart/styles.d.ts +0 -6
  302. package/es/DonutChart/styles.js +0 -13
  303. package/es/FunnelChart/ArrowRightIcon.d.ts +0 -5
  304. package/es/FunnelChart/ArrowRightIcon.js +0 -22
  305. package/es/FunnelChart/index.d.ts +0 -19
  306. package/es/FunnelChart/index.js +0 -497
  307. package/es/FunnelChart/index.mdx +0 -21
  308. package/es/FunnelChart/styles.d.ts +0 -6
  309. package/es/FunnelChart/styles.js +0 -13
  310. package/es/FunnelChart/types.d.ts +0 -28
  311. package/es/FunnelChart/types.js +0 -1
  312. package/es/Heatmaps/Calendar.d.ts +0 -18
  313. package/es/Heatmaps/Calendar.js +0 -154
  314. package/es/Heatmaps/ChartLabels.d.ts +0 -15
  315. package/es/Heatmaps/ChartLabels.js +0 -106
  316. package/es/Heatmaps/Footer.d.ts +0 -22
  317. package/es/Heatmaps/Footer.js +0 -105
  318. package/es/Heatmaps/index.d.ts +0 -28
  319. package/es/Heatmaps/index.js +0 -225
  320. package/es/Heatmaps/index.mdx +0 -70
  321. package/es/Heatmaps/styles.d.ts +0 -7
  322. package/es/Heatmaps/styles.js +0 -14
  323. package/es/Legend/LegendItem.d.ts +0 -10
  324. package/es/Legend/LegendItem.js +0 -56
  325. package/es/Legend/ScrollButton.d.ts +0 -9
  326. package/es/Legend/ScrollButton.js +0 -62
  327. package/es/Legend/index.d.ts +0 -14
  328. package/es/Legend/index.js +0 -183
  329. package/es/Legend/index.mdx +0 -13
  330. package/es/LineChart/index.d.ts +0 -9
  331. package/es/LineChart/index.js +0 -386
  332. package/es/LineChart/index.mdx +0 -49
  333. package/es/LineChart/styles.d.ts +0 -6
  334. package/es/LineChart/styles.js +0 -13
  335. package/es/RadarChart/index.d.ts +0 -24
  336. package/es/RadarChart/index.js +0 -252
  337. package/es/RadarChart/index.mdx +0 -52
  338. package/es/RadarChart/styles.d.ts +0 -5
  339. package/es/RadarChart/styles.js +0 -12
  340. package/es/ScatterChart/ScatterChartTooltip.d.ts +0 -16
  341. package/es/ScatterChart/ScatterChartTooltip.js +0 -74
  342. package/es/ScatterChart/ScatterChartTooltipRow.d.ts +0 -7
  343. package/es/ScatterChart/ScatterChartTooltipRow.js +0 -38
  344. package/es/ScatterChart/index.d.ts +0 -56
  345. package/es/ScatterChart/index.js +0 -340
  346. package/es/ScatterChart/index.mdx +0 -49
  347. package/es/ScatterChart/renderShape.js +0 -18
  348. package/es/ScatterChart/styles.d.ts +0 -6
  349. package/es/ScatterChart/styles.js +0 -13
  350. package/es/SparkChart/SparkAreaChart.d.ts +0 -12
  351. package/es/SparkChart/SparkAreaChart.js +0 -146
  352. package/es/SparkChart/SparkBarChart.d.ts +0 -9
  353. package/es/SparkChart/SparkBarChart.js +0 -104
  354. package/es/SparkChart/SparkLineChart.d.ts +0 -10
  355. package/es/SparkChart/SparkLineChart.js +0 -108
  356. package/es/SparkChart/index.d.ts +0 -3
  357. package/es/SparkChart/index.js +0 -3
  358. package/es/SparkChart/index.mdx +0 -29
  359. package/es/Tracker/TrackerBlock.d.ts +0 -8
  360. package/es/Tracker/TrackerBlock.js +0 -62
  361. package/es/Tracker/index.d.ts +0 -18
  362. package/es/Tracker/index.js +0 -103
  363. package/es/Tracker/index.mdx +0 -41
  364. package/es/Tracker/styles.d.ts +0 -5
  365. package/es/Tracker/styles.js +0 -12
  366. package/es/common/BaseAnimationTimingProps.d.ts +0 -7
  367. package/es/common/BaseAnimationTimingProps.js +0 -1
  368. package/es/common/BaseChartProps.d.ts +0 -58
  369. package/es/common/BaseChartProps.js +0 -1
  370. package/es/common/BaseSparkChartProps.d.ts +0 -14
  371. package/es/common/BaseSparkChartProps.js +0 -1
  372. package/es/common/ChartLegend.d.ts +0 -5
  373. package/es/common/ChartLegend.js +0 -40
  374. package/es/common/ChartTooltip/ChartTooltipFrame.d.ts +0 -6
  375. package/es/common/ChartTooltip/ChartTooltipFrame.js +0 -31
  376. package/es/common/ChartTooltip/ChartTooltipRow.d.ts +0 -8
  377. package/es/common/ChartTooltip/ChartTooltipRow.js +0 -53
  378. package/es/common/ChartTooltip/index.d.ts +0 -15
  379. package/es/common/ChartTooltip/index.js +0 -64
  380. package/es/common/CustomTooltipProps.d.ts +0 -12
  381. package/es/common/CustomTooltipProps.js +0 -1
  382. package/es/common/CustomYAxisTick.d.ts +0 -15
  383. package/es/common/CustomYAxisTick.js +0 -27
  384. package/es/common/NoData.d.ts +0 -10
  385. package/es/common/NoData.js +0 -24
  386. package/es/common/benchmark/index.d.ts +0 -2
  387. package/es/common/benchmark/types.d.ts +0 -122
  388. package/es/common/benchmark/types.js +0 -1
  389. package/es/common/benchmark/utils.js +0 -159
  390. package/es/common/utils.js +0 -85
  391. package/es/hooks/useOnWindowResize.d.ts +0 -3
  392. package/es/hooks/useOnWindowResize.js +0 -15
  393. package/es/hooks/usePrefersReducedMotion.d.ts +0 -1
  394. package/es/hooks/usePrefersReducedMotion.js +0 -28
  395. package/es/hooks/useThemeColorRange.d.ts +0 -1
  396. package/es/hooks/useThemeColorRange.js +0 -8
  397. package/es/index.d.ts +0 -24
  398. package/es/index.js +0 -22
  399. package/es/types/charts.js +0 -8
  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,10 @@
1
+ //#region src/Heatmaps/styles.d.ts
2
+ export declare const styles: {
3
+ calendar: string;
4
+ container: string;
5
+ footer: string;
6
+ legendColors: string;
7
+ scrollContainer: string;
8
+ };
9
+ //#endregion
10
+ //# sourceMappingURL=styles.d.mts.map
@@ -0,0 +1,47 @@
1
+ import { createStaticStyles } from "@lobehub/ui";
2
+ //#region src/Heatmaps/styles.ts
3
+ const styles = createStaticStyles(({ css, cssVar }) => ({
4
+ calendar: css`
5
+ overflow: visible;
6
+ display: block;
7
+
8
+ text {
9
+ fill: currentcolor;
10
+ }
11
+ `,
12
+ container: css`
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: 8px;
16
+
17
+ width: max-content;
18
+ max-width: 100%;
19
+
20
+ rect {
21
+ stroke: ${cssVar.colorFillTertiary};
22
+ stroke-width: 1px;
23
+ shape-rendering: geometricprecision;
24
+ }
25
+ `,
26
+ footer: css`
27
+ display: flex;
28
+ flex-wrap: wrap;
29
+ gap: 4px 16px;
30
+ white-space: nowrap;
31
+ `,
32
+ legendColors: css`
33
+ display: flex;
34
+ gap: 3px;
35
+ align-items: center;
36
+ margin-left: auto;
37
+ `,
38
+ scrollContainer: css`
39
+ overflow: auto hidden;
40
+ max-width: 100%;
41
+ padding-block: 2px;
42
+ `
43
+ }));
44
+ //#endregion
45
+ export { styles };
46
+
47
+ //# sourceMappingURL=styles.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.mjs","names":[],"sources":["../../src/Heatmaps/styles.ts"],"sourcesContent":["import { createStaticStyles } from '@lobehub/ui';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n calendar: css`\n overflow: visible;\n display: block;\n\n text {\n fill: currentcolor;\n }\n `,\n container: css`\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n width: max-content;\n max-width: 100%;\n\n rect {\n stroke: ${cssVar.colorFillTertiary};\n stroke-width: 1px;\n shape-rendering: geometricprecision;\n }\n `,\n footer: css`\n display: flex;\n flex-wrap: wrap;\n gap: 4px 16px;\n white-space: nowrap;\n `,\n legendColors: css`\n display: flex;\n gap: 3px;\n align-items: center;\n margin-left: auto;\n `,\n scrollContainer: css`\n overflow: auto hidden;\n max-width: 100%;\n padding-block: 2px;\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,UAAU,GAAG;;;;;;;;CAQb,WAAW,GAAG;;;;;;;;;gBASA,OAAO,kBAAkB;;;;;CAKvC,QAAQ,GAAG;;;;;;CAMX,cAAc,GAAG;;;;;;CAMjB,iBAAiB,GAAG;;;;;AAKtB,EAAE"}
@@ -0,0 +1,12 @@
1
+ //#region src/Legend/LegendItem.d.ts
2
+ export interface LegendItemProps {
3
+ activeLegend?: string;
4
+ color: string;
5
+ label: string;
6
+ name: string;
7
+ onClick?: (name: string, color: string) => void;
8
+ }
9
+ declare const LegendItem: import("react").NamedExoticComponent<LegendItemProps>;
10
+ //#endregion
11
+ export { LegendItem as default };
12
+ //# sourceMappingURL=LegendItem.d.mts.map
@@ -0,0 +1,63 @@
1
+ import { Flexbox, Icon, Text, createStaticStyles, cssVar, cx } from "@lobehub/ui";
2
+ import { memo } from "react";
3
+ import { Circle } from "lucide-react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/Legend/LegendItem.tsx
6
+ const styles = createStaticStyles(({ css }) => ({
7
+ container: css`
8
+ display: inline-flex;
9
+ align-items: center;
10
+
11
+ border-radius: ${cssVar.borderRadius};
12
+
13
+ color: ${cssVar.colorTextDescription};
14
+ white-space: nowrap;
15
+ `,
16
+ hasOnValueChange: css`
17
+ transition: all 0.25s ${cssVar.motionEaseInOut};
18
+
19
+ &:hover {
20
+ color: ${cssVar.colorTextSecondary};
21
+ background: ${cssVar.colorFillTertiary};
22
+ }
23
+ `,
24
+ itemContent: css`
25
+ font-size: 12px;
26
+ color: inherit;
27
+ `
28
+ }));
29
+ const LegendItem = memo(({ label, name, color, onClick, activeLegend }) => {
30
+ const hasOnValueChange = !!onClick;
31
+ return /* @__PURE__ */ jsxs(Flexbox, {
32
+ className: cx(styles.container, hasOnValueChange && styles.hasOnValueChange),
33
+ gap: 6,
34
+ horizontal: true,
35
+ onClick: (e) => {
36
+ e.stopPropagation();
37
+ onClick?.(name, color);
38
+ },
39
+ paddingBlock: 2,
40
+ paddingInline: 8,
41
+ style: { cursor: hasOnValueChange ? "pointer" : "default" },
42
+ children: [/* @__PURE__ */ jsx(Icon, {
43
+ color,
44
+ fill: color,
45
+ icon: Circle,
46
+ size: 10,
47
+ style: { opacity: activeLegend && activeLegend !== name ? .4 : 1 }
48
+ }), /* @__PURE__ */ jsx(Text, {
49
+ className: styles.itemContent,
50
+ ellipsis: true,
51
+ style: {
52
+ color: activeLegend && activeLegend === name ? cssVar.colorTextSecondary : void 0,
53
+ margin: 0,
54
+ opacity: activeLegend && activeLegend !== name ? .4 : 1
55
+ },
56
+ children: label
57
+ })]
58
+ });
59
+ });
60
+ //#endregion
61
+ export { LegendItem as default };
62
+
63
+ //# sourceMappingURL=LegendItem.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LegendItem.mjs","names":[],"sources":["../../src/Legend/LegendItem.tsx"],"sourcesContent":["import { Flexbox, Icon, Text, createStaticStyles, cssVar, cx } from '@lobehub/ui';\nimport { Circle } from 'lucide-react';\nimport { memo } from 'react';\n\nconst styles = createStaticStyles(({ css }) => ({\n container: css`\n display: inline-flex;\n align-items: center;\n\n border-radius: ${cssVar.borderRadius};\n\n color: ${cssVar.colorTextDescription};\n white-space: nowrap;\n `,\n hasOnValueChange: css`\n transition: all 0.25s ${cssVar.motionEaseInOut};\n\n &:hover {\n color: ${cssVar.colorTextSecondary};\n background: ${cssVar.colorFillTertiary};\n }\n `,\n itemContent: css`\n font-size: 12px;\n color: inherit;\n `,\n}));\n\nexport interface LegendItemProps {\n activeLegend?: string;\n color: string;\n label: string;\n name: string;\n onClick?: (name: string, color: string) => void;\n}\n\nconst LegendItem = memo<LegendItemProps>(({ label, name, color, onClick, activeLegend }) => {\n const hasOnValueChange = !!onClick;\n\n return (\n <Flexbox\n className={cx(styles.container, hasOnValueChange && styles.hasOnValueChange)}\n gap={6}\n horizontal\n onClick={(e) => {\n e.stopPropagation();\n onClick?.(name, color);\n }}\n paddingBlock={2}\n paddingInline={8}\n style={{\n cursor: hasOnValueChange ? 'pointer' : 'default',\n }}\n >\n <Icon\n color={color}\n fill={color}\n icon={Circle}\n size={10}\n style={{\n opacity: activeLegend && activeLegend !== name ? 0.4 : 1,\n }}\n />\n <Text\n className={styles.itemContent}\n ellipsis\n style={{\n color: activeLegend && activeLegend === name ? cssVar.colorTextSecondary : undefined,\n margin: 0,\n opacity: activeLegend && activeLegend !== name ? 0.4 : 1,\n }}\n >\n {label}\n </Text>\n </Flexbox>\n );\n});\n\nexport default LegendItem;\n"],"mappings":";;;;;AAIA,MAAM,SAAS,oBAAoB,EAAE,WAAW;CAC9C,WAAW,GAAG;;;;qBAIK,OAAO,aAAa;;aAE5B,OAAO,qBAAqB;;;CAGvC,kBAAkB,GAAG;4BACK,OAAO,gBAAgB;;;eAGpC,OAAO,mBAAmB;oBACrB,OAAO,kBAAkB;;;CAG3C,aAAa,GAAG;;;;AAIlB,EAAE;AAUF,MAAM,aAAa,MAAuB,EAAE,OAAO,MAAM,OAAO,SAAS,mBAAmB;CAC1F,MAAM,mBAAmB,CAAC,CAAC;CAE3B,OACE,qBAAC,SAAD;EACE,WAAW,GAAG,OAAO,WAAW,oBAAoB,OAAO,gBAAgB;EAC3E,KAAK;EACL,YAAA;EACA,UAAU,MAAM;GACd,EAAE,gBAAgB;GAClB,UAAU,MAAM,KAAK;EACvB;EACA,cAAc;EACd,eAAe;EACf,OAAO,EACL,QAAQ,mBAAmB,YAAY,UACzC;EAZF,UAAA,CAcE,oBAAC,MAAD;GACS;GACP,MAAM;GACN,MAAM;GACN,MAAM;GACN,OAAO,EACL,SAAS,gBAAgB,iBAAiB,OAAO,KAAM,EACzD;EACD,CAAA,GACD,oBAAC,MAAD;GACE,WAAW,OAAO;GAClB,UAAA;GACA,OAAO;IACL,OAAO,gBAAgB,iBAAiB,OAAO,OAAO,qBAAqB,KAAA;IAC3E,QAAQ;IACR,SAAS,gBAAgB,iBAAiB,OAAO,KAAM;GACzD;GAEC,UAAA;EACG,CAAA,CACC;;AAEb,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { LucideIcon } from "lucide-react";
2
+ //#region src/Legend/ScrollButton.d.ts
3
+ export interface ScrollButtonProps {
4
+ disabled?: boolean;
5
+ icon: LucideIcon;
6
+ onClick?: () => void;
7
+ }
8
+ declare const ScrollButton: import("react").NamedExoticComponent<ScrollButtonProps>;
9
+ //#endregion
10
+ export { ScrollButton as default };
11
+ //# sourceMappingURL=ScrollButton.d.mts.map
@@ -0,0 +1,49 @@
1
+ import { Button, Icon } from "@lobehub/ui";
2
+ import { memo, useEffect, useRef, useState } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ //#region src/Legend/ScrollButton.tsx
5
+ const ScrollButton = memo(({ icon, onClick, disabled }) => {
6
+ const [isPressed, setIsPressed] = useState(false);
7
+ const intervalRef = useRef(null);
8
+ useEffect(() => {
9
+ if (isPressed) intervalRef.current = setInterval(() => {
10
+ onClick?.();
11
+ }, 300);
12
+ else clearInterval(intervalRef.current);
13
+ return () => clearInterval(intervalRef.current);
14
+ }, [isPressed, onClick]);
15
+ useEffect(() => {
16
+ if (disabled) {
17
+ clearInterval(intervalRef.current);
18
+ setIsPressed(false);
19
+ }
20
+ }, [disabled]);
21
+ return /* @__PURE__ */ jsx(Button, {
22
+ disabled,
23
+ icon: /* @__PURE__ */ jsx(Icon, {
24
+ className: "w-full",
25
+ icon
26
+ }),
27
+ onClick: (e) => {
28
+ e.stopPropagation();
29
+ onClick?.();
30
+ },
31
+ onMouseDown: (e) => {
32
+ e.stopPropagation();
33
+ setIsPressed(true);
34
+ },
35
+ onMouseUp: (e) => {
36
+ e.stopPropagation();
37
+ setIsPressed(false);
38
+ },
39
+ size: "small",
40
+ style: {
41
+ height: 24,
42
+ width: 24
43
+ }
44
+ });
45
+ });
46
+ //#endregion
47
+ export { ScrollButton as default };
48
+
49
+ //# sourceMappingURL=ScrollButton.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScrollButton.mjs","names":[],"sources":["../../src/Legend/ScrollButton.tsx"],"sourcesContent":["import { Button, Icon } from '@lobehub/ui';\nimport { LucideIcon } from 'lucide-react';\nimport { memo, useEffect, useRef, useState } from 'react';\n\nexport interface ScrollButtonProps {\n disabled?: boolean;\n icon: LucideIcon;\n onClick?: () => void;\n}\n\nconst ScrollButton = memo<ScrollButtonProps>(({ icon, onClick, disabled }) => {\n const [isPressed, setIsPressed] = useState(false);\n const intervalRef = useRef<any | null>(null);\n\n useEffect(() => {\n if (isPressed) {\n intervalRef.current = setInterval(() => {\n onClick?.();\n }, 300);\n } else {\n clearInterval(intervalRef.current as any);\n }\n return () => clearInterval(intervalRef.current as any);\n }, [isPressed, onClick]);\n\n useEffect(() => {\n if (disabled) {\n clearInterval(intervalRef.current as any);\n setIsPressed(false);\n }\n }, [disabled]);\n\n return (\n <Button\n disabled={disabled}\n icon={<Icon className={'w-full'} icon={icon} />}\n onClick={(e) => {\n e.stopPropagation();\n onClick?.();\n }}\n onMouseDown={(e) => {\n e.stopPropagation();\n setIsPressed(true);\n }}\n onMouseUp={(e) => {\n e.stopPropagation();\n setIsPressed(false);\n }}\n size={'small'}\n style={{\n height: 24,\n width: 24,\n }}\n />\n );\n});\n\nexport default ScrollButton;\n"],"mappings":";;;;AAUA,MAAM,eAAe,MAAyB,EAAE,MAAM,SAAS,eAAe;CAC5E,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAChD,MAAM,cAAc,OAAmB,IAAI;CAE3C,gBAAgB;EACd,IAAI,WACF,YAAY,UAAU,kBAAkB;GACtC,UAAU;EACZ,GAAG,GAAG;OAEN,cAAc,YAAY,OAAc;EAE1C,aAAa,cAAc,YAAY,OAAc;CACvD,GAAG,CAAC,WAAW,OAAO,CAAC;CAEvB,gBAAgB;EACd,IAAI,UAAU;GACZ,cAAc,YAAY,OAAc;GACxC,aAAa,KAAK;EACpB;CACF,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,oBAAC,QAAD;EACY;EACV,MAAM,oBAAC,MAAD;GAAM,WAAW;GAAgB;EAAO,CAAA;EAC9C,UAAU,MAAM;GACd,EAAE,gBAAgB;GAClB,UAAU;EACZ;EACA,cAAc,MAAM;GAClB,EAAE,gBAAgB;GAClB,aAAa,IAAI;EACnB;EACA,YAAY,MAAM;GAChB,EAAE,gBAAgB;GAClB,aAAa,KAAK;EACpB;EACA,MAAM;EACN,OAAO;GACL,QAAQ;GACR,OAAO;EACT;CACD,CAAA;AAEL,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { FlexboxProps } from "@lobehub/ui";
2
+ //#region src/Legend/index.d.ts
3
+ export interface LegendProps extends FlexboxProps {
4
+ activeLegend?: string;
5
+ categories: string[];
6
+ colors?: string[];
7
+ customCategories?: {
8
+ [key: string]: string;
9
+ };
10
+ enableLegendSlider?: boolean;
11
+ onClickLegendItem?: (category: string, color: string) => void;
12
+ }
13
+ declare const Legend: import("react").ForwardRefExoticComponent<Omit<LegendProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
14
+ //#endregion
15
+ export { Legend as default };
16
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1,151 @@
1
+ import { useThemeColorRange } from "../hooks/useThemeColorRange.mjs";
2
+ import LegendItem from "./LegendItem.mjs";
3
+ import ScrollButton from "./ScrollButton.mjs";
4
+ import { Flexbox, createStaticStyles, cx } from "@lobehub/ui";
5
+ import { forwardRef, useCallback, useEffect, useRef, useState } from "react";
6
+ import { ChevronLeft, ChevronRight } from "lucide-react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/Legend/index.tsx
9
+ const styles = createStaticStyles(({ css }) => ({
10
+ container: css`
11
+ position: relative;
12
+ overflow: hidden;
13
+ `,
14
+ enableLegendSlider: css`
15
+ scrollbar-width: none;
16
+
17
+ overflow: auto;
18
+ align-items: center;
19
+
20
+ padding-right: 48px;
21
+ padding-left: 16px;
22
+ `,
23
+ scrollButtons: css`
24
+ top: 0;
25
+ right: 0;
26
+ bottom: 0;
27
+ `
28
+ }));
29
+ const Legend = forwardRef((props, ref) => {
30
+ const themeColorRange = useThemeColorRange();
31
+ const { customCategories, categories, colors = themeColorRange, className, onClickLegendItem, activeLegend, enableLegendSlider = false, ...rest } = props;
32
+ const scrollableRef = useRef(null);
33
+ const scrollButtonsRef = useRef(null);
34
+ const [hasScroll, setHasScroll] = useState(null);
35
+ const [isKeyDowned, setIsKeyDowned] = useState(null);
36
+ const intervalRef = useRef(null);
37
+ const checkScroll = useCallback(() => {
38
+ const scrollable = scrollableRef?.current;
39
+ if (!scrollable) return;
40
+ const hasLeftScroll = scrollable.scrollLeft > 0;
41
+ const hasRightScroll = scrollable.scrollWidth - scrollable.clientWidth > scrollable.scrollLeft;
42
+ setHasScroll({
43
+ left: hasLeftScroll,
44
+ right: hasRightScroll
45
+ });
46
+ }, [setHasScroll]);
47
+ const scrollToTest = useCallback((direction) => {
48
+ const element = scrollableRef?.current;
49
+ const scrollButtons = scrollButtonsRef?.current;
50
+ const width = element?.clientWidth ?? 0;
51
+ const scrollButtonsWith = scrollButtons?.clientWidth ?? 0;
52
+ if (element && enableLegendSlider) {
53
+ element.scrollTo({
54
+ behavior: "smooth",
55
+ left: direction === "left" ? element.scrollLeft - width + scrollButtonsWith : element.scrollLeft + width - scrollButtonsWith
56
+ });
57
+ setTimeout(() => {
58
+ checkScroll();
59
+ }, 400);
60
+ }
61
+ }, [enableLegendSlider, checkScroll]);
62
+ useEffect(() => {
63
+ const keyDownHandler = (key) => {
64
+ if (key === "ArrowLeft") scrollToTest("left");
65
+ else if (key === "ArrowRight") scrollToTest("right");
66
+ };
67
+ if (isKeyDowned) {
68
+ keyDownHandler(isKeyDowned);
69
+ intervalRef.current = setInterval(() => {
70
+ keyDownHandler(isKeyDowned);
71
+ }, 300);
72
+ } else clearInterval(intervalRef.current);
73
+ return () => clearInterval(intervalRef.current);
74
+ }, [isKeyDowned, scrollToTest]);
75
+ const keyDown = (e) => {
76
+ e.stopPropagation();
77
+ if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
78
+ e.preventDefault();
79
+ setIsKeyDowned(e.key);
80
+ }
81
+ };
82
+ const keyUp = (e) => {
83
+ e.stopPropagation();
84
+ setIsKeyDowned(null);
85
+ };
86
+ useEffect(() => {
87
+ const scrollable = scrollableRef?.current;
88
+ if (enableLegendSlider) {
89
+ checkScroll();
90
+ scrollable?.addEventListener("keydown", keyDown);
91
+ scrollable?.addEventListener("keyup", keyUp);
92
+ }
93
+ return () => {
94
+ scrollable?.removeEventListener("keydown", keyDown);
95
+ scrollable?.removeEventListener("keyup", keyUp);
96
+ };
97
+ }, [checkScroll, enableLegendSlider]);
98
+ return /* @__PURE__ */ jsxs(Flexbox, {
99
+ className: cx(styles.container, className),
100
+ gap: 8,
101
+ horizontal: true,
102
+ ref,
103
+ ...rest,
104
+ children: [/* @__PURE__ */ jsx(Flexbox, {
105
+ className: cx(enableLegendSlider && (hasScroll?.right || hasScroll?.left) && styles.enableLegendSlider),
106
+ flex: 1,
107
+ height: "100%",
108
+ horizontal: true,
109
+ ref: scrollableRef,
110
+ style: { overflow: "hidden" },
111
+ tabIndex: 0,
112
+ wrap: enableLegendSlider ? "nowrap" : "wrap",
113
+ children: categories.map((category, idx) => /* @__PURE__ */ jsx(LegendItem, {
114
+ activeLegend,
115
+ color: colors[idx % colors.length],
116
+ label: customCategories?.[category] || category,
117
+ name: category,
118
+ onClick: onClickLegendItem
119
+ }, `item-${idx}`))
120
+ }), enableLegendSlider && (hasScroll?.right || hasScroll?.left) ? /* @__PURE__ */ jsxs(Flexbox, {
121
+ align: "center",
122
+ className: styles.scrollButtons,
123
+ flex: "none",
124
+ gap: 4,
125
+ height: "100%",
126
+ horizontal: true,
127
+ justify: "center",
128
+ ref: scrollButtonsRef,
129
+ children: [/* @__PURE__ */ jsx(ScrollButton, {
130
+ disabled: !hasScroll?.left,
131
+ icon: ChevronLeft,
132
+ onClick: () => {
133
+ setIsKeyDowned(null);
134
+ scrollToTest("left");
135
+ }
136
+ }), /* @__PURE__ */ jsx(ScrollButton, {
137
+ disabled: !hasScroll?.right,
138
+ icon: ChevronRight,
139
+ onClick: () => {
140
+ setIsKeyDowned(null);
141
+ scrollToTest("right");
142
+ }
143
+ })]
144
+ }) : null]
145
+ });
146
+ });
147
+ Legend.displayName = "Legend";
148
+ //#endregion
149
+ export { Legend as default };
150
+
151
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/Legend/index.tsx"],"sourcesContent":["import { Flexbox, FlexboxProps, createStaticStyles, cx } from '@lobehub/ui';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\n\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\n\nimport LegendItem from './LegendItem';\nimport ScrollButton from './ScrollButton';\n\nconst styles = createStaticStyles(({ css }) => ({\n container: css`\n position: relative;\n overflow: hidden;\n `,\n enableLegendSlider: css`\n scrollbar-width: none;\n\n overflow: auto;\n align-items: center;\n\n padding-right: 48px;\n padding-left: 16px;\n `,\n scrollButtons: css`\n top: 0;\n right: 0;\n bottom: 0;\n `,\n}));\n\nexport interface LegendProps extends FlexboxProps {\n activeLegend?: string;\n categories: string[];\n colors?: string[];\n customCategories?: {\n [key: string]: string;\n };\n enableLegendSlider?: boolean;\n onClickLegendItem?: (category: string, color: string) => void;\n}\n\ntype HasScrollProps = {\n left: boolean;\n right: boolean;\n};\n\nconst Legend = forwardRef<HTMLDivElement, LegendProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n customCategories,\n categories,\n colors = themeColorRange,\n className,\n onClickLegendItem,\n activeLegend,\n enableLegendSlider = false,\n ...rest\n } = props;\n const scrollableRef = useRef<HTMLInputElement>(null);\n const scrollButtonsRef = useRef<HTMLDivElement>(null);\n\n const [hasScroll, setHasScroll] = useState<HasScrollProps | null>(null);\n const [isKeyDowned, setIsKeyDowned] = useState<string | null>(null);\n const intervalRef = useRef<any | null>(null);\n\n const checkScroll = useCallback(() => {\n const scrollable = scrollableRef?.current;\n if (!scrollable) return;\n\n const hasLeftScroll = scrollable.scrollLeft > 0;\n const hasRightScroll = scrollable.scrollWidth - scrollable.clientWidth > scrollable.scrollLeft;\n\n setHasScroll({ left: hasLeftScroll, right: hasRightScroll });\n }, [setHasScroll]); // dependencies are listed here in the array\n\n const scrollToTest = useCallback(\n (direction: 'left' | 'right') => {\n const element = scrollableRef?.current;\n const scrollButtons = scrollButtonsRef?.current;\n const width = element?.clientWidth ?? 0;\n const scrollButtonsWith = scrollButtons?.clientWidth ?? 0;\n\n if (element && enableLegendSlider) {\n element.scrollTo({\n behavior: 'smooth',\n left:\n direction === 'left'\n ? element.scrollLeft - width + scrollButtonsWith\n : element.scrollLeft + width - scrollButtonsWith,\n });\n setTimeout(() => {\n checkScroll();\n }, 400);\n }\n },\n [enableLegendSlider, checkScroll],\n );\n\n useEffect(() => {\n const keyDownHandler = (key: string) => {\n if (key === 'ArrowLeft') {\n scrollToTest('left');\n } else if (key === 'ArrowRight') {\n scrollToTest('right');\n }\n };\n if (isKeyDowned) {\n keyDownHandler(isKeyDowned);\n intervalRef.current = setInterval(() => {\n keyDownHandler(isKeyDowned);\n }, 300);\n } else {\n clearInterval(intervalRef.current as any);\n }\n return () => clearInterval(intervalRef.current as any);\n }, [isKeyDowned, scrollToTest]);\n\n const keyDown = (e: KeyboardEvent) => {\n e.stopPropagation();\n if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {\n e.preventDefault();\n setIsKeyDowned(e.key);\n }\n };\n const keyUp = (e: KeyboardEvent) => {\n e.stopPropagation();\n setIsKeyDowned(null);\n };\n\n useEffect(() => {\n const scrollable = scrollableRef?.current;\n if (enableLegendSlider) {\n checkScroll();\n\n scrollable?.addEventListener('keydown', keyDown);\n scrollable?.addEventListener('keyup', keyUp);\n }\n\n return () => {\n scrollable?.removeEventListener('keydown', keyDown);\n scrollable?.removeEventListener('keyup', keyUp);\n };\n }, [checkScroll, enableLegendSlider]);\n\n // @ts-ignore\n return (\n <Flexbox className={cx(styles.container, className)} gap={8} horizontal ref={ref} {...rest}>\n <Flexbox\n className={cx(\n enableLegendSlider && (hasScroll?.right || hasScroll?.left) && styles.enableLegendSlider,\n )}\n flex={1}\n height={'100%'}\n horizontal\n ref={scrollableRef}\n style={{ overflow: 'hidden' }}\n tabIndex={0}\n wrap={enableLegendSlider ? 'nowrap' : 'wrap'}\n >\n {categories.map((category, idx) => (\n <LegendItem\n activeLegend={activeLegend}\n color={colors[idx % colors.length]}\n key={`item-${idx}`}\n label={customCategories?.[category] || category}\n name={category}\n onClick={onClickLegendItem}\n />\n ))}\n </Flexbox>\n {enableLegendSlider && (hasScroll?.right || hasScroll?.left) ? (\n <Flexbox\n align={'center'}\n className={styles.scrollButtons}\n flex={'none'}\n gap={4}\n height={'100%'}\n horizontal\n justify={'center'}\n ref={scrollButtonsRef}\n >\n <ScrollButton\n disabled={!hasScroll?.left}\n icon={ChevronLeft}\n onClick={() => {\n setIsKeyDowned(null);\n scrollToTest('left');\n }}\n />\n <ScrollButton\n disabled={!hasScroll?.right}\n icon={ChevronRight}\n onClick={() => {\n setIsKeyDowned(null);\n scrollToTest('right');\n }}\n />\n </Flexbox>\n ) : null}\n </Flexbox>\n );\n});\n\nLegend.displayName = 'Legend';\n\nexport default Legend;\n"],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ import { CurveType } from "../types/charts.mjs";
2
+ import BaseChartProps from "../common/BaseChartProps.mjs";
3
+ //#region src/LineChart/index.d.ts
4
+ export interface LineChartProps extends BaseChartProps {
5
+ connectNulls?: boolean;
6
+ curveType?: CurveType;
7
+ }
8
+ declare const LineChart: import("react").ForwardRefExoticComponent<LineChartProps & import("react").RefAttributes<HTMLDivElement>>;
9
+ //#endregion
10
+ export { LineChart as default };
11
+ //# sourceMappingURL=index.d.mts.map