@lobehub/charts 6.0.0-beta.1 → 6.0.0
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.
- package/README.md +3 -3
- package/es/AccuracyBarChart/index.d.mts +62 -0
- package/es/AccuracyBarChart/index.mjs +324 -0
- package/es/AccuracyBarChart/index.mjs.map +1 -0
- package/es/AccuracyBarChart/styles.d.mts +14 -0
- package/es/AccuracyBarChart/styles.mjs +71 -0
- package/es/AccuracyBarChart/styles.mjs.map +1 -0
- package/es/AreaChart/index.d.mts +13 -0
- package/es/AreaChart/index.mjs +306 -0
- package/es/AreaChart/index.mjs.map +1 -0
- package/es/AreaChart/styles.d.mts +9 -0
- package/es/AreaChart/styles.mjs +28 -0
- package/es/AreaChart/styles.mjs.map +1 -0
- package/es/BarChart/index.d.mts +11 -0
- package/es/BarChart/index.mjs +288 -0
- package/es/BarChart/index.mjs.map +1 -0
- package/es/BarChart/{renderShape.d.ts → renderShape.d.mts} +3 -1
- package/es/BarChart/renderShape.mjs +28 -0
- package/es/BarChart/renderShape.mjs.map +1 -0
- package/es/BarChart/styles.d.mts +9 -0
- package/es/BarChart/styles.mjs +28 -0
- package/es/BarChart/styles.mjs.map +1 -0
- package/es/BarList/index.d.mts +32 -0
- package/es/BarList/index.mjs +126 -0
- package/es/BarList/index.mjs.map +1 -0
- package/es/BarList/styles.d.mts +13 -0
- package/es/BarList/styles.mjs +63 -0
- package/es/BarList/styles.mjs.map +1 -0
- package/es/BenchmarkColumnChart/index.d.mts +144 -0
- package/es/BenchmarkColumnChart/index.mjs +512 -0
- package/es/BenchmarkColumnChart/index.mjs.map +1 -0
- package/es/BenchmarkColumnChart/styles.d.mts +19 -0
- package/es/BenchmarkColumnChart/styles.mjs +129 -0
- package/es/BenchmarkColumnChart/styles.mjs.map +1 -0
- package/es/BenchmarkRankingChart/index.d.mts +91 -0
- package/es/BenchmarkRankingChart/index.mjs +345 -0
- package/es/BenchmarkRankingChart/index.mjs.map +1 -0
- package/es/BenchmarkRankingChart/styles.d.mts +36 -0
- package/es/BenchmarkRankingChart/styles.mjs +265 -0
- package/es/BenchmarkRankingChart/styles.mjs.map +1 -0
- package/es/BenchmarkScatterChart/index.d.mts +148 -0
- package/es/BenchmarkScatterChart/index.mjs +666 -0
- package/es/BenchmarkScatterChart/index.mjs.map +1 -0
- package/es/BenchmarkScatterChart/styles.d.mts +28 -0
- package/es/BenchmarkScatterChart/styles.mjs +193 -0
- package/es/BenchmarkScatterChart/styles.mjs.map +1 -0
- package/es/BenchmarkScatterChart/{utils.d.ts → utils.d.mts} +32 -29
- package/es/BenchmarkScatterChart/utils.mjs +214 -0
- package/es/BenchmarkScatterChart/utils.mjs.map +1 -0
- package/es/ComposedChart/index.d.mts +6 -0
- package/es/ComposedChart/index.mjs +252 -0
- package/es/ComposedChart/index.mjs.map +1 -0
- package/es/ComposedChart/styles.d.mts +9 -0
- package/es/ComposedChart/styles.mjs +28 -0
- package/es/ComposedChart/styles.mjs.map +1 -0
- package/es/ComposedChart/types.d.mts +71 -0
- package/es/ComposedChart/types.mjs +0 -0
- package/es/DataBars/CategoryBar.d.mts +17 -0
- package/es/DataBars/CategoryBar.mjs +144 -0
- package/es/DataBars/CategoryBar.mjs.map +1 -0
- package/es/DataBars/DeltaBar.d.mts +16 -0
- package/es/DataBars/DeltaBar.mjs +100 -0
- package/es/DataBars/DeltaBar.mjs.map +1 -0
- package/es/DataBars/MarkerBar.d.mts +19 -0
- package/es/DataBars/MarkerBar.mjs +72 -0
- package/es/DataBars/MarkerBar.mjs.map +1 -0
- package/es/DataBars/ProgressBar.d.mts +15 -0
- package/es/DataBars/ProgressBar.mjs +51 -0
- package/es/DataBars/ProgressBar.mjs.map +1 -0
- package/es/DataBars/index.d.mts +5 -0
- package/es/DataBars/index.mjs +5 -0
- package/es/DataBars/styles.d.mts +10 -0
- package/es/DataBars/styles.mjs +31 -0
- package/es/DataBars/styles.mjs.map +1 -0
- package/es/DonutChart/DonutChartTooltip.d.mts +14 -0
- package/es/DonutChart/DonutChartTooltip.mjs +25 -0
- package/es/DonutChart/DonutChartTooltip.mjs.map +1 -0
- package/es/DonutChart/index.d.mts +33 -0
- package/es/DonutChart/index.mjs +158 -0
- package/es/DonutChart/index.mjs.map +1 -0
- package/es/DonutChart/inputParser.d.mts +5 -0
- package/es/DonutChart/inputParser.mjs +8 -0
- package/es/DonutChart/inputParser.mjs.map +1 -0
- package/es/DonutChart/renderInactiveShape.d.mts +4 -0
- package/es/DonutChart/renderInactiveShape.mjs +22 -0
- package/es/DonutChart/renderInactiveShape.mjs.map +1 -0
- package/es/DonutChart/styles.d.mts +9 -0
- package/es/DonutChart/styles.mjs +28 -0
- package/es/DonutChart/styles.mjs.map +1 -0
- package/es/FunnelChart/ArrowRightIcon.d.mts +8 -0
- package/es/FunnelChart/ArrowRightIcon.mjs +14 -0
- package/es/FunnelChart/ArrowRightIcon.mjs.map +1 -0
- package/es/FunnelChart/index.d.mts +21 -0
- package/es/FunnelChart/index.mjs +419 -0
- package/es/FunnelChart/index.mjs.map +1 -0
- package/es/FunnelChart/styles.d.mts +9 -0
- package/es/FunnelChart/styles.mjs +28 -0
- package/es/FunnelChart/styles.mjs.map +1 -0
- package/es/FunnelChart/types.d.mts +31 -0
- package/es/FunnelChart/types.mjs +0 -0
- package/es/Heatmaps/Calendar.d.mts +21 -0
- package/es/Heatmaps/Calendar.mjs +107 -0
- package/es/Heatmaps/Calendar.mjs.map +1 -0
- package/es/Heatmaps/ChartLabels.d.mts +17 -0
- package/es/Heatmaps/ChartLabels.mjs +84 -0
- package/es/Heatmaps/ChartLabels.mjs.map +1 -0
- package/es/Heatmaps/Footer.d.mts +24 -0
- package/es/Heatmaps/Footer.mjs +81 -0
- package/es/Heatmaps/Footer.mjs.map +1 -0
- package/es/Heatmaps/index.d.mts +31 -0
- package/es/Heatmaps/index.mjs +186 -0
- package/es/Heatmaps/index.mjs.map +1 -0
- package/es/Heatmaps/styles.d.mts +10 -0
- package/es/Heatmaps/styles.mjs +47 -0
- package/es/Heatmaps/styles.mjs.map +1 -0
- package/es/Legend/LegendItem.d.mts +12 -0
- package/es/Legend/LegendItem.mjs +63 -0
- package/es/Legend/LegendItem.mjs.map +1 -0
- package/es/Legend/ScrollButton.d.mts +11 -0
- package/es/Legend/ScrollButton.mjs +49 -0
- package/es/Legend/ScrollButton.mjs.map +1 -0
- package/es/Legend/index.d.mts +16 -0
- package/es/Legend/index.mjs +151 -0
- package/es/Legend/index.mjs.map +1 -0
- package/es/LineChart/index.d.mts +11 -0
- package/es/LineChart/index.mjs +269 -0
- package/es/LineChart/index.mjs.map +1 -0
- package/es/LineChart/styles.d.mts +9 -0
- package/es/LineChart/styles.mjs +28 -0
- package/es/LineChart/styles.mjs.map +1 -0
- package/es/RadarChart/index.d.mts +27 -0
- package/es/RadarChart/index.mjs +155 -0
- package/es/RadarChart/index.mjs.map +1 -0
- package/es/RadarChart/styles.d.mts +8 -0
- package/es/RadarChart/styles.mjs +23 -0
- package/es/RadarChart/styles.mjs.map +1 -0
- package/es/ScatterChart/ScatterChartTooltip.d.mts +19 -0
- package/es/ScatterChart/ScatterChartTooltip.mjs +50 -0
- package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -0
- package/es/ScatterChart/ScatterChartTooltipRow.d.mts +10 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs +34 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -0
- package/es/ScatterChart/index.d.mts +58 -0
- package/es/ScatterChart/index.mjs +239 -0
- package/es/ScatterChart/index.mjs.map +1 -0
- package/es/ScatterChart/{renderShape.d.ts → renderShape.d.mts} +4 -1
- package/es/ScatterChart/renderShape.mjs +18 -0
- package/es/ScatterChart/renderShape.mjs.map +1 -0
- package/es/ScatterChart/styles.d.mts +9 -0
- package/es/ScatterChart/styles.mjs +28 -0
- package/es/ScatterChart/styles.mjs.map +1 -0
- package/es/SparkChart/SparkAreaChart.d.mts +14 -0
- package/es/SparkChart/SparkAreaChart.mjs +107 -0
- package/es/SparkChart/SparkAreaChart.mjs.map +1 -0
- package/es/SparkChart/SparkBarChart.d.mts +11 -0
- package/es/SparkChart/SparkBarChart.mjs +67 -0
- package/es/SparkChart/SparkBarChart.mjs.map +1 -0
- package/es/SparkChart/SparkLineChart.d.mts +12 -0
- package/es/SparkChart/SparkLineChart.mjs +71 -0
- package/es/SparkChart/SparkLineChart.mjs.map +1 -0
- package/es/SparkChart/index.d.mts +4 -0
- package/es/SparkChart/index.mjs +4 -0
- package/es/Tracker/TrackerBlock.d.mts +11 -0
- package/es/Tracker/TrackerBlock.mjs +50 -0
- package/es/Tracker/TrackerBlock.mjs.map +1 -0
- package/es/Tracker/index.d.mts +21 -0
- package/es/Tracker/index.mjs +67 -0
- package/es/Tracker/index.mjs.map +1 -0
- package/es/Tracker/styles.d.mts +8 -0
- package/es/Tracker/styles.mjs +24 -0
- package/es/Tracker/styles.mjs.map +1 -0
- package/es/common/BaseAnimationTimingProps.d.mts +10 -0
- package/es/common/BaseAnimationTimingProps.mjs +0 -0
- package/es/common/BaseChartProps.d.mts +61 -0
- package/es/common/BaseChartProps.mjs +0 -0
- package/es/common/BaseSparkChartProps.d.mts +17 -0
- package/es/common/BaseSparkChartProps.mjs +0 -0
- package/es/common/ChartLegend.d.mts +8 -0
- package/es/common/ChartLegend.mjs +32 -0
- package/es/common/ChartLegend.mjs.map +1 -0
- package/es/common/ChartTooltip/ChartTooltipFrame.d.mts +8 -0
- package/es/common/ChartTooltip/ChartTooltipFrame.mjs +26 -0
- package/es/common/ChartTooltip/ChartTooltipFrame.mjs.map +1 -0
- package/es/common/ChartTooltip/ChartTooltipRow.d.mts +10 -0
- package/es/common/ChartTooltip/ChartTooltipRow.mjs +49 -0
- package/es/common/ChartTooltip/ChartTooltipRow.mjs.map +1 -0
- package/es/common/ChartTooltip/index.d.mts +18 -0
- package/es/common/ChartTooltip/index.mjs +48 -0
- package/es/common/ChartTooltip/index.mjs.map +1 -0
- package/es/common/CustomTooltipProps.d.mts +15 -0
- package/es/common/CustomTooltipProps.mjs +0 -0
- package/es/common/CustomYAxisTick.d.mts +18 -0
- package/es/common/CustomYAxisTick.mjs +24 -0
- package/es/common/CustomYAxisTick.mjs.map +1 -0
- package/es/common/NoData.d.mts +13 -0
- package/es/common/NoData.mjs +25 -0
- package/es/common/NoData.mjs.map +1 -0
- package/es/common/benchmark/index.d.mts +3 -0
- package/es/common/benchmark/{index.js → index.mjs} +1 -1
- package/es/common/benchmark/types.d.mts +125 -0
- package/es/common/benchmark/types.mjs +0 -0
- package/es/common/benchmark/{utils.d.ts → utils.d.mts} +38 -36
- package/es/common/benchmark/utils.mjs +115 -0
- package/es/common/benchmark/utils.mjs.map +1 -0
- package/es/common/{utils.d.ts → utils.d.mts} +3 -0
- package/es/common/utils.mjs +36 -0
- package/es/common/utils.mjs.map +1 -0
- package/es/hooks/useOnWindowResize.d.mts +6 -0
- package/es/hooks/useOnWindowResize.mjs +18 -0
- package/es/hooks/useOnWindowResize.mjs.map +1 -0
- package/es/hooks/usePrefersReducedMotion.d.mts +4 -0
- package/es/hooks/usePrefersReducedMotion.mjs +24 -0
- package/es/hooks/usePrefersReducedMotion.mjs.map +1 -0
- package/es/hooks/useThemeColorRange.d.mts +4 -0
- package/es/hooks/useThemeColorRange.mjs +28 -0
- package/es/hooks/useThemeColorRange.mjs.map +1 -0
- package/es/index.d.mts +34 -0
- package/es/index.mjs +28 -0
- package/es/types/{charts.d.ts → charts.d.mts} +26 -26
- package/es/types/charts.mjs +12 -0
- package/es/types/charts.mjs.map +1 -0
- package/es/utils/{calendar.d.ts → calendar.d.mts} +21 -18
- package/es/utils/calendar.mjs +154 -0
- package/es/utils/calendar.mjs.map +1 -0
- package/es/utils/getMaxLabelLength.d.mts +13 -0
- package/es/utils/getMaxLabelLength.mjs +48 -0
- package/es/utils/getMaxLabelLength.mjs.map +1 -0
- package/es/utils/{index.d.ts → index.d.mts} +4 -1
- package/es/utils/index.mjs +19 -0
- package/es/utils/index.mjs.map +1 -0
- package/es/utils/{theme.d.ts → theme.d.mts} +3 -0
- package/es/utils/theme.mjs +33 -0
- package/es/utils/theme.mjs.map +1 -0
- package/package.json +144 -5
- package/es/AccuracyBarChart/index.d.ts +0 -60
- package/es/AccuracyBarChart/index.js +0 -452
- package/es/AccuracyBarChart/index.mdx +0 -52
- package/es/AccuracyBarChart/styles.d.ts +0 -11
- package/es/AccuracyBarChart/styles.js +0 -18
- package/es/AreaChart/index.d.ts +0 -11
- package/es/AreaChart/index.js +0 -428
- package/es/AreaChart/index.mdx +0 -49
- package/es/AreaChart/styles.d.ts +0 -6
- package/es/AreaChart/styles.js +0 -13
- package/es/BarChart/index.d.ts +0 -9
- package/es/BarChart/index.js +0 -390
- package/es/BarChart/index.mdx +0 -73
- package/es/BarChart/renderShape.js +0 -34
- package/es/BarChart/styles.d.ts +0 -6
- package/es/BarChart/styles.js +0 -13
- package/es/BarList/index.d.ts +0 -29
- package/es/BarList/index.js +0 -172
- package/es/BarList/index.mdx +0 -34
- package/es/BarList/styles.d.ts +0 -10
- package/es/BarList/styles.js +0 -18
- package/es/BenchmarkColumnChart/index.d.ts +0 -140
- package/es/BenchmarkColumnChart/index.js +0 -684
- package/es/BenchmarkColumnChart/index.mdx +0 -66
- package/es/BenchmarkColumnChart/styles.d.ts +0 -16
- package/es/BenchmarkColumnChart/styles.js +0 -23
- package/es/BenchmarkRankingChart/index.d.ts +0 -87
- package/es/BenchmarkRankingChart/index.js +0 -453
- package/es/BenchmarkRankingChart/index.mdx +0 -59
- package/es/BenchmarkRankingChart/styles.d.ts +0 -33
- package/es/BenchmarkRankingChart/styles.js +0 -41
- package/es/BenchmarkScatterChart/index.d.ts +0 -145
- package/es/BenchmarkScatterChart/index.js +0 -855
- package/es/BenchmarkScatterChart/index.mdx +0 -61
- package/es/BenchmarkScatterChart/styles.d.ts +0 -25
- package/es/BenchmarkScatterChart/styles.js +0 -33
- package/es/BenchmarkScatterChart/utils.js +0 -353
- package/es/ComposedChart/index.d.ts +0 -5
- package/es/ComposedChart/index.js +0 -333
- package/es/ComposedChart/index.mdx +0 -43
- package/es/ComposedChart/styles.d.ts +0 -6
- package/es/ComposedChart/styles.js +0 -13
- package/es/ComposedChart/types.d.ts +0 -68
- package/es/ComposedChart/types.js +0 -1
- package/es/DataBars/CategoryBar.d.ts +0 -15
- package/es/DataBars/CategoryBar.js +0 -199
- package/es/DataBars/DeltaBar.d.ts +0 -13
- package/es/DataBars/DeltaBar.js +0 -115
- package/es/DataBars/MarkerBar.d.ts +0 -16
- package/es/DataBars/MarkerBar.js +0 -92
- package/es/DataBars/ProgressBar.d.ts +0 -12
- package/es/DataBars/ProgressBar.js +0 -69
- package/es/DataBars/index.d.ts +0 -4
- package/es/DataBars/index.js +0 -4
- package/es/DataBars/index.mdx +0 -36
- package/es/DataBars/styles.d.ts +0 -7
- package/es/DataBars/styles.js +0 -14
- package/es/DonutChart/DonutChartTooltip.d.ts +0 -11
- package/es/DonutChart/DonutChartTooltip.js +0 -26
- package/es/DonutChart/index.d.ts +0 -31
- package/es/DonutChart/index.js +0 -230
- package/es/DonutChart/index.mdx +0 -48
- package/es/DonutChart/inputParser.d.ts +0 -2
- package/es/DonutChart/inputParser.js +0 -9
- package/es/DonutChart/renderInactiveShape.d.ts +0 -2
- package/es/DonutChart/renderInactiveShape.js +0 -27
- package/es/DonutChart/styles.d.ts +0 -6
- package/es/DonutChart/styles.js +0 -13
- package/es/FunnelChart/ArrowRightIcon.d.ts +0 -5
- package/es/FunnelChart/ArrowRightIcon.js +0 -22
- package/es/FunnelChart/index.d.ts +0 -19
- package/es/FunnelChart/index.js +0 -497
- package/es/FunnelChart/index.mdx +0 -21
- package/es/FunnelChart/styles.d.ts +0 -6
- package/es/FunnelChart/styles.js +0 -13
- package/es/FunnelChart/types.d.ts +0 -28
- package/es/FunnelChart/types.js +0 -1
- package/es/Heatmaps/Calendar.d.ts +0 -18
- package/es/Heatmaps/Calendar.js +0 -154
- package/es/Heatmaps/ChartLabels.d.ts +0 -15
- package/es/Heatmaps/ChartLabels.js +0 -106
- package/es/Heatmaps/Footer.d.ts +0 -22
- package/es/Heatmaps/Footer.js +0 -105
- package/es/Heatmaps/index.d.ts +0 -28
- package/es/Heatmaps/index.js +0 -225
- package/es/Heatmaps/index.mdx +0 -70
- package/es/Heatmaps/styles.d.ts +0 -7
- package/es/Heatmaps/styles.js +0 -14
- package/es/Legend/LegendItem.d.ts +0 -10
- package/es/Legend/LegendItem.js +0 -56
- package/es/Legend/ScrollButton.d.ts +0 -9
- package/es/Legend/ScrollButton.js +0 -62
- package/es/Legend/index.d.ts +0 -14
- package/es/Legend/index.js +0 -183
- package/es/Legend/index.mdx +0 -13
- package/es/LineChart/index.d.ts +0 -9
- package/es/LineChart/index.js +0 -386
- package/es/LineChart/index.mdx +0 -49
- package/es/LineChart/styles.d.ts +0 -6
- package/es/LineChart/styles.js +0 -13
- package/es/RadarChart/index.d.ts +0 -24
- package/es/RadarChart/index.js +0 -252
- package/es/RadarChart/index.mdx +0 -52
- package/es/RadarChart/styles.d.ts +0 -5
- package/es/RadarChart/styles.js +0 -12
- package/es/ScatterChart/ScatterChartTooltip.d.ts +0 -16
- package/es/ScatterChart/ScatterChartTooltip.js +0 -74
- package/es/ScatterChart/ScatterChartTooltipRow.d.ts +0 -7
- package/es/ScatterChart/ScatterChartTooltipRow.js +0 -38
- package/es/ScatterChart/index.d.ts +0 -56
- package/es/ScatterChart/index.js +0 -340
- package/es/ScatterChart/index.mdx +0 -49
- package/es/ScatterChart/renderShape.js +0 -18
- package/es/ScatterChart/styles.d.ts +0 -6
- package/es/ScatterChart/styles.js +0 -13
- package/es/SparkChart/SparkAreaChart.d.ts +0 -12
- package/es/SparkChart/SparkAreaChart.js +0 -146
- package/es/SparkChart/SparkBarChart.d.ts +0 -9
- package/es/SparkChart/SparkBarChart.js +0 -104
- package/es/SparkChart/SparkLineChart.d.ts +0 -10
- package/es/SparkChart/SparkLineChart.js +0 -108
- package/es/SparkChart/index.d.ts +0 -3
- package/es/SparkChart/index.js +0 -3
- package/es/SparkChart/index.mdx +0 -29
- package/es/Tracker/TrackerBlock.d.ts +0 -8
- package/es/Tracker/TrackerBlock.js +0 -62
- package/es/Tracker/index.d.ts +0 -18
- package/es/Tracker/index.js +0 -103
- package/es/Tracker/index.mdx +0 -41
- package/es/Tracker/styles.d.ts +0 -5
- package/es/Tracker/styles.js +0 -12
- package/es/common/BaseAnimationTimingProps.d.ts +0 -7
- package/es/common/BaseAnimationTimingProps.js +0 -1
- package/es/common/BaseChartProps.d.ts +0 -58
- package/es/common/BaseChartProps.js +0 -1
- package/es/common/BaseSparkChartProps.d.ts +0 -14
- package/es/common/BaseSparkChartProps.js +0 -1
- package/es/common/ChartLegend.d.ts +0 -5
- package/es/common/ChartLegend.js +0 -40
- package/es/common/ChartTooltip/ChartTooltipFrame.d.ts +0 -6
- package/es/common/ChartTooltip/ChartTooltipFrame.js +0 -31
- package/es/common/ChartTooltip/ChartTooltipRow.d.ts +0 -8
- package/es/common/ChartTooltip/ChartTooltipRow.js +0 -53
- package/es/common/ChartTooltip/index.d.ts +0 -15
- package/es/common/ChartTooltip/index.js +0 -64
- package/es/common/CustomTooltipProps.d.ts +0 -12
- package/es/common/CustomTooltipProps.js +0 -1
- package/es/common/CustomYAxisTick.d.ts +0 -15
- package/es/common/CustomYAxisTick.js +0 -27
- package/es/common/NoData.d.ts +0 -10
- package/es/common/NoData.js +0 -24
- package/es/common/benchmark/index.d.ts +0 -2
- package/es/common/benchmark/types.d.ts +0 -122
- package/es/common/benchmark/types.js +0 -1
- package/es/common/benchmark/utils.js +0 -159
- package/es/common/utils.js +0 -85
- package/es/hooks/useOnWindowResize.d.ts +0 -3
- package/es/hooks/useOnWindowResize.js +0 -15
- package/es/hooks/usePrefersReducedMotion.d.ts +0 -1
- package/es/hooks/usePrefersReducedMotion.js +0 -28
- package/es/hooks/useThemeColorRange.d.ts +0 -1
- package/es/hooks/useThemeColorRange.js +0 -8
- package/es/index.d.ts +0 -24
- package/es/index.js +0 -22
- package/es/types/charts.js +0 -8
- package/es/utils/calendar.js +0 -199
- package/es/utils/getMaxLabelLength.d.ts +0 -10
- package/es/utils/getMaxLabelLength.js +0 -110
- package/es/utils/index.js +0 -32
- package/es/utils/theme.js +0 -40
package/es/Heatmaps/Calendar.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _templateObject;
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
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; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
-
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); }
|
|
8
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
9
|
-
import { Tooltip, keyframes } from '@lobehub/ui';
|
|
10
|
-
import isEqual from 'fast-deep-equal';
|
|
11
|
-
import { memo, useMemo } from 'react';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
// Move keyframes outside component to avoid recreation on each render
|
|
15
|
-
var loadingAnimation = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n fill: var(--lobe-heatmaps-loading);\n }\n 50% {\n fill: var(--lobe-heatmaps-loading-active);\n }\n 100% {\n fill: var(--lobe-heatmaps-loading);\n }\n"])));
|
|
16
|
-
|
|
17
|
-
// Helper function to generate tooltip title (moved outside component)
|
|
18
|
-
var getTooltipTitle = function getTooltipTitle(activity, customTooltip, labels) {
|
|
19
|
-
if (customTooltip) {
|
|
20
|
-
return customTooltip(activity);
|
|
21
|
-
}
|
|
22
|
-
if (labels !== null && labels !== void 0 && labels.tooltip) {
|
|
23
|
-
return labels.tooltip.replace('{{count}}', String(activity.count)).replace('{{date}}', String(activity.date));
|
|
24
|
-
}
|
|
25
|
-
return "".concat(activity.count, " activities on ").concat(activity.date);
|
|
26
|
-
};
|
|
27
|
-
// Memoized block component - only re-renders when its own props change
|
|
28
|
-
var CalendarBlock = /*#__PURE__*/memo(function (_ref) {
|
|
29
|
-
var activity = _ref.activity,
|
|
30
|
-
blockSize = _ref.blockSize,
|
|
31
|
-
blockRadius = _ref.blockRadius,
|
|
32
|
-
color = _ref.color,
|
|
33
|
-
labelHeight = _ref.labelHeight,
|
|
34
|
-
blockMargin = _ref.blockMargin,
|
|
35
|
-
dayIndex = _ref.dayIndex,
|
|
36
|
-
enableAnimation = _ref.enableAnimation,
|
|
37
|
-
animationDelay = _ref.animationDelay,
|
|
38
|
-
onValueChange = _ref.onValueChange,
|
|
39
|
-
showTooltip = _ref.showTooltip,
|
|
40
|
-
customTooltip = _ref.customTooltip,
|
|
41
|
-
labels = _ref.labels;
|
|
42
|
-
var style = useMemo(function () {
|
|
43
|
-
return _objectSpread({
|
|
44
|
-
cursor: onValueChange ? 'pointer' : undefined
|
|
45
|
-
}, enableAnimation && {
|
|
46
|
-
animation: "".concat(loadingAnimation, " 1.75s ease-in-out infinite"),
|
|
47
|
-
animationDelay: "".concat(animationDelay, "ms")
|
|
48
|
-
});
|
|
49
|
-
}, [enableAnimation, animationDelay, onValueChange]);
|
|
50
|
-
var y = labelHeight + (blockSize + blockMargin) * dayIndex;
|
|
51
|
-
var tooltipTitle = useMemo(function () {
|
|
52
|
-
return getTooltipTitle(activity, customTooltip, labels);
|
|
53
|
-
}, [activity, customTooltip, labels]);
|
|
54
|
-
var block = /*#__PURE__*/_jsx("rect", {
|
|
55
|
-
"data-date": activity.date,
|
|
56
|
-
"data-level": activity.level,
|
|
57
|
-
fill: color,
|
|
58
|
-
height: blockSize,
|
|
59
|
-
onClick: onValueChange ? function () {
|
|
60
|
-
return onValueChange(activity);
|
|
61
|
-
} : undefined,
|
|
62
|
-
rx: blockRadius,
|
|
63
|
-
ry: blockRadius,
|
|
64
|
-
style: style,
|
|
65
|
-
width: blockSize,
|
|
66
|
-
x: 0,
|
|
67
|
-
y: y
|
|
68
|
-
});
|
|
69
|
-
return showTooltip ? /*#__PURE__*/_jsx(Tooltip, {
|
|
70
|
-
title: tooltipTitle,
|
|
71
|
-
children: block
|
|
72
|
-
}) : block;
|
|
73
|
-
}, isEqual);
|
|
74
|
-
CalendarBlock.displayName = 'CalendarBlock';
|
|
75
|
-
// Memoized week component - only re-renders when its own week data changes
|
|
76
|
-
var CalendarWeek = /*#__PURE__*/memo(function (_ref2) {
|
|
77
|
-
var week = _ref2.week,
|
|
78
|
-
weekIndex = _ref2.weekIndex,
|
|
79
|
-
blockMargin = _ref2.blockMargin,
|
|
80
|
-
blockRadius = _ref2.blockRadius,
|
|
81
|
-
blockSize = _ref2.blockSize,
|
|
82
|
-
colorScale = _ref2.colorScale,
|
|
83
|
-
customTooltip = _ref2.customTooltip,
|
|
84
|
-
enableAnimation = _ref2.enableAnimation,
|
|
85
|
-
labelHeight = _ref2.labelHeight,
|
|
86
|
-
labels = _ref2.labels,
|
|
87
|
-
maxLevel = _ref2.maxLevel,
|
|
88
|
-
onValueChange = _ref2.onValueChange,
|
|
89
|
-
showTooltip = _ref2.showTooltip;
|
|
90
|
-
return /*#__PURE__*/_jsx("g", {
|
|
91
|
-
transform: "translate(".concat((blockSize + blockMargin) * weekIndex, ", 0)"),
|
|
92
|
-
children: week.map(function (activity, dayIndex) {
|
|
93
|
-
if (!activity) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
if (activity.level < 0 || activity.level > maxLevel) {
|
|
97
|
-
throw new RangeError("Provided activity level ".concat(activity.level, " for ").concat(activity.date, " is out of range. It must be between 0 and ").concat(maxLevel, "."));
|
|
98
|
-
}
|
|
99
|
-
var animationDelay = weekIndex * 20 + dayIndex * 20;
|
|
100
|
-
var color = colorScale[activity.level];
|
|
101
|
-
return /*#__PURE__*/_jsx(CalendarBlock, {
|
|
102
|
-
activity: activity,
|
|
103
|
-
animationDelay: animationDelay,
|
|
104
|
-
blockMargin: blockMargin,
|
|
105
|
-
blockRadius: blockRadius,
|
|
106
|
-
blockSize: blockSize,
|
|
107
|
-
color: color,
|
|
108
|
-
customTooltip: customTooltip,
|
|
109
|
-
dayIndex: dayIndex,
|
|
110
|
-
enableAnimation: enableAnimation,
|
|
111
|
-
labelHeight: labelHeight,
|
|
112
|
-
labels: labels,
|
|
113
|
-
onValueChange: onValueChange,
|
|
114
|
-
showTooltip: showTooltip
|
|
115
|
-
}, activity.date);
|
|
116
|
-
})
|
|
117
|
-
});
|
|
118
|
-
}, isEqual);
|
|
119
|
-
CalendarWeek.displayName = 'CalendarWeek';
|
|
120
|
-
var Calendar = /*#__PURE__*/memo(function (_ref3) {
|
|
121
|
-
var weeks = _ref3.weeks,
|
|
122
|
-
maxLevel = _ref3.maxLevel,
|
|
123
|
-
enableAnimation = _ref3.enableAnimation,
|
|
124
|
-
colorScale = _ref3.colorScale,
|
|
125
|
-
blockSize = _ref3.blockSize,
|
|
126
|
-
blockRadius = _ref3.blockRadius,
|
|
127
|
-
blockMargin = _ref3.blockMargin,
|
|
128
|
-
labelHeight = _ref3.labelHeight,
|
|
129
|
-
showTooltip = _ref3.showTooltip,
|
|
130
|
-
customTooltip = _ref3.customTooltip,
|
|
131
|
-
labels = _ref3.labels,
|
|
132
|
-
onValueChange = _ref3.onValueChange;
|
|
133
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
134
|
-
children: weeks.map(function (week, weekIndex) {
|
|
135
|
-
return /*#__PURE__*/_jsx(CalendarWeek, {
|
|
136
|
-
blockMargin: blockMargin,
|
|
137
|
-
blockRadius: blockRadius,
|
|
138
|
-
blockSize: blockSize,
|
|
139
|
-
colorScale: colorScale,
|
|
140
|
-
customTooltip: customTooltip,
|
|
141
|
-
enableAnimation: enableAnimation,
|
|
142
|
-
labelHeight: labelHeight,
|
|
143
|
-
labels: labels,
|
|
144
|
-
maxLevel: maxLevel,
|
|
145
|
-
onValueChange: onValueChange,
|
|
146
|
-
showTooltip: showTooltip,
|
|
147
|
-
week: week,
|
|
148
|
-
weekIndex: weekIndex
|
|
149
|
-
}, weekIndex);
|
|
150
|
-
})
|
|
151
|
-
});
|
|
152
|
-
}, isEqual);
|
|
153
|
-
Calendar.displayName = 'Calendar';
|
|
154
|
-
export default Calendar;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { Labels, Week } from "../types/charts";
|
|
3
|
-
interface ChartLabelsProps {
|
|
4
|
-
blockMargin: number;
|
|
5
|
-
blockSize: number;
|
|
6
|
-
hideMonthLabels: boolean;
|
|
7
|
-
labelHeight: number;
|
|
8
|
-
labelMargin: number;
|
|
9
|
-
labels: Labels;
|
|
10
|
-
showWeekdayLabels: boolean;
|
|
11
|
-
weekStart: number;
|
|
12
|
-
weeks: Week[];
|
|
13
|
-
}
|
|
14
|
-
declare const ChartLabels: import("react").NamedExoticComponent<ChartLabelsProps>;
|
|
15
|
-
export default ChartLabels;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { cx } from '@lobehub/ui';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
|
-
import { memo, useMemo } from 'react';
|
|
4
|
-
import { getMonthLabels } from "../utils/calendar";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
// Simple component - ChartLabels already memoized, so this doesn't need memo
|
|
9
|
-
var WeekdayLabels = function WeekdayLabels(_ref) {
|
|
10
|
-
var blockMargin = _ref.blockMargin,
|
|
11
|
-
blockSize = _ref.blockSize,
|
|
12
|
-
firstWeek = _ref.firstWeek,
|
|
13
|
-
labelHeight = _ref.labelHeight,
|
|
14
|
-
labelMargin = _ref.labelMargin,
|
|
15
|
-
weekStart = _ref.weekStart,
|
|
16
|
-
weekdays = _ref.weekdays;
|
|
17
|
-
var labels = useMemo(function () {
|
|
18
|
-
var maxLength = Math.floor((blockSize * 7 + blockMargin * 6) / 12);
|
|
19
|
-
return firstWeek.map(function (_, index) {
|
|
20
|
-
if (index % 2 === 0) return null;
|
|
21
|
-
var dayIndex = (index + weekStart) % 7;
|
|
22
|
-
var label = (weekdays === null || weekdays === void 0 ? void 0 : weekdays[dayIndex]) || '';
|
|
23
|
-
var truncatedLabel = label.length > maxLength ? label.slice(0, maxLength) + '...' : label;
|
|
24
|
-
return {
|
|
25
|
-
dayIndex: dayIndex,
|
|
26
|
-
index: index,
|
|
27
|
-
label: truncatedLabel,
|
|
28
|
-
y: labelHeight + (blockSize + blockMargin) * index + blockSize / 2
|
|
29
|
-
};
|
|
30
|
-
}).filter(function (item) {
|
|
31
|
-
return item !== null;
|
|
32
|
-
});
|
|
33
|
-
}, [firstWeek, weekStart, blockSize, blockMargin, labelHeight, weekdays]);
|
|
34
|
-
if (labels.length === 0) return null;
|
|
35
|
-
return /*#__PURE__*/_jsx("g", {
|
|
36
|
-
className: cx('legend-weekday'),
|
|
37
|
-
children: labels.map(function (item) {
|
|
38
|
-
return /*#__PURE__*/_jsx("text", {
|
|
39
|
-
dominantBaseline: "middle",
|
|
40
|
-
textAnchor: "end",
|
|
41
|
-
x: -labelMargin,
|
|
42
|
-
y: item.y,
|
|
43
|
-
children: item.label
|
|
44
|
-
}, item.index);
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
WeekdayLabels.displayName = 'WeekdayLabels';
|
|
49
|
-
// Simple component - ChartLabels already memoized, so this doesn't need memo
|
|
50
|
-
var MonthLabels = function MonthLabels(_ref2) {
|
|
51
|
-
var blockMargin = _ref2.blockMargin,
|
|
52
|
-
blockSize = _ref2.blockSize,
|
|
53
|
-
monthNames = _ref2.monthNames,
|
|
54
|
-
weeks = _ref2.weeks;
|
|
55
|
-
var labels = useMemo(function () {
|
|
56
|
-
if (weeks.length === 0) return [];
|
|
57
|
-
return getMonthLabels(weeks, monthNames);
|
|
58
|
-
}, [weeks, monthNames]);
|
|
59
|
-
var maxLength = useMemo(function () {
|
|
60
|
-
return Math.floor((blockSize * 4 + blockMargin * 3) / 12);
|
|
61
|
-
}, [blockSize, blockMargin]);
|
|
62
|
-
if (labels.length === 0) return null;
|
|
63
|
-
return /*#__PURE__*/_jsx("g", {
|
|
64
|
-
className: cx('legend-month'),
|
|
65
|
-
children: labels.map(function (_ref3) {
|
|
66
|
-
var label = _ref3.label,
|
|
67
|
-
weekIndex = _ref3.weekIndex;
|
|
68
|
-
var truncatedLabel = label.length > maxLength ? label.slice(0, maxLength) + '...' : label;
|
|
69
|
-
return /*#__PURE__*/_jsx("text", {
|
|
70
|
-
dominantBaseline: "hanging",
|
|
71
|
-
x: (blockSize + blockMargin) * weekIndex,
|
|
72
|
-
children: truncatedLabel
|
|
73
|
-
}, weekIndex);
|
|
74
|
-
})
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
MonthLabels.displayName = 'MonthLabels';
|
|
78
|
-
var ChartLabels = /*#__PURE__*/memo(function (_ref4) {
|
|
79
|
-
var labels = _ref4.labels,
|
|
80
|
-
blockSize = _ref4.blockSize,
|
|
81
|
-
labelHeight = _ref4.labelHeight,
|
|
82
|
-
blockMargin = _ref4.blockMargin,
|
|
83
|
-
labelMargin = _ref4.labelMargin,
|
|
84
|
-
showWeekdayLabels = _ref4.showWeekdayLabels,
|
|
85
|
-
hideMonthLabels = _ref4.hideMonthLabels,
|
|
86
|
-
weeks = _ref4.weeks,
|
|
87
|
-
weekStart = _ref4.weekStart;
|
|
88
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
89
|
-
children: [showWeekdayLabels && weeks[0] && /*#__PURE__*/_jsx(WeekdayLabels, {
|
|
90
|
-
blockMargin: blockMargin,
|
|
91
|
-
blockSize: blockSize,
|
|
92
|
-
firstWeek: weeks[0],
|
|
93
|
-
labelHeight: labelHeight,
|
|
94
|
-
labelMargin: labelMargin,
|
|
95
|
-
weekStart: weekStart,
|
|
96
|
-
weekdays: labels.weekdays
|
|
97
|
-
}), !hideMonthLabels && /*#__PURE__*/_jsx(MonthLabels, {
|
|
98
|
-
blockMargin: blockMargin,
|
|
99
|
-
blockSize: blockSize,
|
|
100
|
-
monthNames: labels.months,
|
|
101
|
-
weeks: weeks
|
|
102
|
-
})]
|
|
103
|
-
});
|
|
104
|
-
}, isEqual);
|
|
105
|
-
ChartLabels.displayName = 'ChartLabels';
|
|
106
|
-
export default ChartLabels;
|
package/es/Heatmaps/Footer.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
interface FooterProps {
|
|
3
|
-
blockRadius: number;
|
|
4
|
-
blockSize: number;
|
|
5
|
-
colorScale: string[];
|
|
6
|
-
hideColorLegend?: boolean;
|
|
7
|
-
hideTotalCount?: boolean;
|
|
8
|
-
labels: {
|
|
9
|
-
legend: {
|
|
10
|
-
less: string;
|
|
11
|
-
more: string;
|
|
12
|
-
};
|
|
13
|
-
totalCount?: string;
|
|
14
|
-
};
|
|
15
|
-
loading: boolean;
|
|
16
|
-
maxLevel: number;
|
|
17
|
-
totalCount: number;
|
|
18
|
-
weekdayLabelOffset?: number;
|
|
19
|
-
year: number;
|
|
20
|
-
}
|
|
21
|
-
declare const Footer: import("react").NamedExoticComponent<FooterProps>;
|
|
22
|
-
export default Footer;
|
package/es/Heatmaps/Footer.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { cx } from '@lobehub/ui';
|
|
2
|
-
import isEqual from 'fast-deep-equal';
|
|
3
|
-
import { memo, useMemo } from 'react';
|
|
4
|
-
import { styles } from "./styles";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
// Simple component - memo not needed as props are primitives and component is lightweight
|
|
8
|
-
var TotalCount = function TotalCount(_ref) {
|
|
9
|
-
var totalCount = _ref.totalCount,
|
|
10
|
-
year = _ref.year,
|
|
11
|
-
totalCountText = _ref.totalCountText;
|
|
12
|
-
var text = useMemo(function () {
|
|
13
|
-
if (totalCountText) {
|
|
14
|
-
return totalCountText.replace('{{count}}', String(totalCount)).replace('{{year}}', String(year));
|
|
15
|
-
}
|
|
16
|
-
return "".concat(totalCount, " activities in ").concat(year);
|
|
17
|
-
}, [totalCountText, totalCount, year]);
|
|
18
|
-
return /*#__PURE__*/_jsx("div", {
|
|
19
|
-
className: cx('count'),
|
|
20
|
-
children: text
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
TotalCount.displayName = 'TotalCount';
|
|
24
|
-
// Simple component - Footer already memoized, so this doesn't need memo
|
|
25
|
-
var ColorLegend = function ColorLegend(_ref2) {
|
|
26
|
-
var blockSize = _ref2.blockSize,
|
|
27
|
-
blockRadius = _ref2.blockRadius,
|
|
28
|
-
colorScale = _ref2.colorScale,
|
|
29
|
-
maxLevel = _ref2.maxLevel,
|
|
30
|
-
lessLabel = _ref2.lessLabel,
|
|
31
|
-
moreLabel = _ref2.moreLabel;
|
|
32
|
-
var colorLevels = useMemo(function () {
|
|
33
|
-
return Array.from({
|
|
34
|
-
length: maxLevel + 1
|
|
35
|
-
}, function (_, level) {
|
|
36
|
-
return level;
|
|
37
|
-
});
|
|
38
|
-
}, [maxLevel]);
|
|
39
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
40
|
-
className: cx('legend-colors', styles.legendColors),
|
|
41
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
42
|
-
style: {
|
|
43
|
-
marginRight: '0.4em'
|
|
44
|
-
},
|
|
45
|
-
children: lessLabel
|
|
46
|
-
}), colorLevels.map(function (level) {
|
|
47
|
-
return /*#__PURE__*/_jsx("svg", {
|
|
48
|
-
height: blockSize,
|
|
49
|
-
width: blockSize,
|
|
50
|
-
children: /*#__PURE__*/_jsx("rect", {
|
|
51
|
-
fill: colorScale[level],
|
|
52
|
-
height: blockSize,
|
|
53
|
-
rx: blockRadius,
|
|
54
|
-
ry: blockRadius,
|
|
55
|
-
width: blockSize
|
|
56
|
-
})
|
|
57
|
-
}, level);
|
|
58
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
59
|
-
style: {
|
|
60
|
-
marginLeft: '0.4em'
|
|
61
|
-
},
|
|
62
|
-
children: moreLabel
|
|
63
|
-
})]
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
ColorLegend.displayName = 'ColorLegend';
|
|
67
|
-
var Footer = /*#__PURE__*/memo(function (_ref3) {
|
|
68
|
-
var hideTotalCount = _ref3.hideTotalCount,
|
|
69
|
-
hideColorLegend = _ref3.hideColorLegend,
|
|
70
|
-
weekdayLabelOffset = _ref3.weekdayLabelOffset,
|
|
71
|
-
loading = _ref3.loading,
|
|
72
|
-
labels = _ref3.labels,
|
|
73
|
-
year = _ref3.year,
|
|
74
|
-
maxLevel = _ref3.maxLevel,
|
|
75
|
-
blockSize = _ref3.blockSize,
|
|
76
|
-
colorScale = _ref3.colorScale,
|
|
77
|
-
blockRadius = _ref3.blockRadius,
|
|
78
|
-
totalCount = _ref3.totalCount;
|
|
79
|
-
// Memoize footer style
|
|
80
|
-
var footerStyle = useMemo(function () {
|
|
81
|
-
return {
|
|
82
|
-
marginLeft: weekdayLabelOffset
|
|
83
|
-
};
|
|
84
|
-
}, [weekdayLabelOffset]);
|
|
85
|
-
return /*#__PURE__*/_jsxs("footer", {
|
|
86
|
-
className: cx('footer', styles.footer),
|
|
87
|
-
style: footerStyle,
|
|
88
|
-
children: [loading && /*#__PURE__*/_jsx("div", {
|
|
89
|
-
children: "\xA0"
|
|
90
|
-
}), !loading && !hideTotalCount && /*#__PURE__*/_jsx(TotalCount, {
|
|
91
|
-
totalCount: totalCount,
|
|
92
|
-
totalCountText: labels.totalCount,
|
|
93
|
-
year: year
|
|
94
|
-
}), !loading && !hideColorLegend && /*#__PURE__*/_jsx(ColorLegend, {
|
|
95
|
-
blockRadius: blockRadius,
|
|
96
|
-
blockSize: blockSize,
|
|
97
|
-
colorScale: colorScale,
|
|
98
|
-
lessLabel: labels.legend.less,
|
|
99
|
-
maxLevel: maxLevel,
|
|
100
|
-
moreLabel: labels.legend.more
|
|
101
|
-
})]
|
|
102
|
-
});
|
|
103
|
-
}, isEqual);
|
|
104
|
-
Footer.displayName = 'Footer';
|
|
105
|
-
export default Footer;
|
package/es/Heatmaps/index.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { FlexboxProps } from '@lobehub/ui';
|
|
2
|
-
import type { Day as WeekDay } from 'date-fns';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
import { NoDataProps } from "../common/NoData";
|
|
5
|
-
import type { Activity, Labels } from "../types/charts";
|
|
6
|
-
export interface HeatmapsProps extends FlexboxProps {
|
|
7
|
-
blockMargin?: number;
|
|
8
|
-
blockRadius?: number;
|
|
9
|
-
blockSize?: number;
|
|
10
|
-
colors?: string[];
|
|
11
|
-
customTooltip?: (activity: Activity) => ReactNode;
|
|
12
|
-
data: Array<Activity>;
|
|
13
|
-
fontSize?: number;
|
|
14
|
-
hideColorLegend?: boolean;
|
|
15
|
-
hideMonthLabels?: boolean;
|
|
16
|
-
hideTotalCount?: boolean;
|
|
17
|
-
labels?: Labels;
|
|
18
|
-
loading?: boolean;
|
|
19
|
-
maxLevel?: number;
|
|
20
|
-
noDataText?: NoDataProps['noDataText'];
|
|
21
|
-
onValueChange?: (value: Activity) => void;
|
|
22
|
-
showTooltip?: boolean;
|
|
23
|
-
showWeekdayLabels?: boolean;
|
|
24
|
-
totalCount?: number;
|
|
25
|
-
weekStart?: WeekDay;
|
|
26
|
-
}
|
|
27
|
-
declare const Heatmaps: import("react").ForwardRefExoticComponent<Omit<HeatmapsProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
|
-
export default Heatmaps;
|
package/es/Heatmaps/index.js
DELETED
|
@@ -1,225 +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 _excluded = ["data", "blockMargin", "blockRadius", "blockSize", "onValueChange", "fontSize", "hideColorLegend", "hideMonthLabels", "hideTotalCount", "labels", "maxLevel", "loading", "showTooltip", "customTooltip", "showWeekdayLabels", "style", "colors", "totalCount", "weekStart", "className", "noDataText"];
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
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; }
|
|
8
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
11
|
-
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; }
|
|
12
|
-
import { Flexbox, TooltipGroup, cx, useTheme, useThemeMode } from '@lobehub/ui';
|
|
13
|
-
import { getYear, parseISO } from 'date-fns';
|
|
14
|
-
import { forwardRef, useMemo } from 'react';
|
|
15
|
-
import NoData from "../common/NoData";
|
|
16
|
-
import { usePrefersReducedMotion } from "../hooks/usePrefersReducedMotion";
|
|
17
|
-
import { isOnSeverSide } from "../utils";
|
|
18
|
-
import { DEFAULT_LABELS, generateEmptyData, groupByWeeks, maxWeekdayLabelLength } from "../utils/calendar";
|
|
19
|
-
import { createTheme } from "../utils/theme";
|
|
20
|
-
import Calendar from "./Calendar";
|
|
21
|
-
import ChartLabels from "./ChartLabels";
|
|
22
|
-
import Footer from "./Footer";
|
|
23
|
-
import { styles } from "./styles";
|
|
24
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
var LABEL_MARGIN = 8;
|
|
27
|
-
var Heatmaps = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
28
|
-
var data = props.data,
|
|
29
|
-
_props$blockMargin = props.blockMargin,
|
|
30
|
-
blockMargin = _props$blockMargin === void 0 ? 4 : _props$blockMargin,
|
|
31
|
-
_props$blockRadius = props.blockRadius,
|
|
32
|
-
blockRadius = _props$blockRadius === void 0 ? 2 : _props$blockRadius,
|
|
33
|
-
_props$blockSize = props.blockSize,
|
|
34
|
-
blockSize = _props$blockSize === void 0 ? 12 : _props$blockSize,
|
|
35
|
-
onValueChange = props.onValueChange,
|
|
36
|
-
_props$fontSize = props.fontSize,
|
|
37
|
-
fontSize = _props$fontSize === void 0 ? 12 : _props$fontSize,
|
|
38
|
-
_props$hideColorLegen = props.hideColorLegend,
|
|
39
|
-
hideColorLegend = _props$hideColorLegen === void 0 ? false : _props$hideColorLegen,
|
|
40
|
-
_props$hideMonthLabel = props.hideMonthLabels,
|
|
41
|
-
hideMonthLabels = _props$hideMonthLabel === void 0 ? false : _props$hideMonthLabel,
|
|
42
|
-
_props$hideTotalCount = props.hideTotalCount,
|
|
43
|
-
hideTotalCount = _props$hideTotalCount === void 0 ? false : _props$hideTotalCount,
|
|
44
|
-
labelsProp = props.labels,
|
|
45
|
-
_props$maxLevel = props.maxLevel,
|
|
46
|
-
maxLevel = _props$maxLevel === void 0 ? Math.max(1, props.maxLevel || 4) : _props$maxLevel,
|
|
47
|
-
_props$loading = props.loading,
|
|
48
|
-
loading = _props$loading === void 0 ? false : _props$loading,
|
|
49
|
-
_props$showTooltip = props.showTooltip,
|
|
50
|
-
showTooltip = _props$showTooltip === void 0 ? true : _props$showTooltip,
|
|
51
|
-
customTooltip = props.customTooltip,
|
|
52
|
-
_props$showWeekdayLab = props.showWeekdayLabels,
|
|
53
|
-
showWeekdayLabels = _props$showWeekdayLab === void 0 ? false : _props$showWeekdayLab,
|
|
54
|
-
_props$style = props.style,
|
|
55
|
-
style = _props$style === void 0 ? {} : _props$style,
|
|
56
|
-
colors = props.colors,
|
|
57
|
-
totalCountProp = props.totalCount,
|
|
58
|
-
_props$weekStart = props.weekStart,
|
|
59
|
-
weekStart = _props$weekStart === void 0 ? 0 : _props$weekStart,
|
|
60
|
-
className = props.className,
|
|
61
|
-
noDataText = props.noDataText,
|
|
62
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
63
|
-
var activities = useMemo(function () {
|
|
64
|
-
if (loading) return generateEmptyData();
|
|
65
|
-
return data.map(function (item) {
|
|
66
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
67
|
-
level: item.level > maxLevel ? maxLevel : item.level
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
}, [data, maxLevel, loading]);
|
|
71
|
-
var _useThemeMode = useThemeMode(),
|
|
72
|
-
isDarkMode = _useThemeMode.isDarkMode;
|
|
73
|
-
var theme = useTheme();
|
|
74
|
-
|
|
75
|
-
// Note: defaultColors must use theme (actual color values) instead of cssVar
|
|
76
|
-
// because createTheme() uses chroma.valid() which requires actual color values, not CSS variables
|
|
77
|
-
var defaultColors = useMemo(function () {
|
|
78
|
-
switch (maxLevel) {
|
|
79
|
-
case 1:
|
|
80
|
-
{
|
|
81
|
-
return [theme.colorFillSecondary, isDarkMode ? theme.lime8 : theme.green8];
|
|
82
|
-
}
|
|
83
|
-
case 2:
|
|
84
|
-
{
|
|
85
|
-
return [theme.colorFillSecondary, isDarkMode ? theme.lime4 : theme.green4, isDarkMode ? theme.lime8 : theme.green8];
|
|
86
|
-
}
|
|
87
|
-
case 3:
|
|
88
|
-
{
|
|
89
|
-
return [theme.colorFillSecondary, isDarkMode ? theme.lime3 : theme.green3, isDarkMode ? theme.lime6 : theme.green6, isDarkMode ? theme.lime9 : theme.green9];
|
|
90
|
-
}
|
|
91
|
-
case 4:
|
|
92
|
-
{
|
|
93
|
-
return [theme.colorFillSecondary, isDarkMode ? theme.lime2 : theme.green2, isDarkMode ? theme.lime4 : theme.green4, isDarkMode ? theme.lime6 : theme.green6, isDarkMode ? theme.lime8 : theme.green8];
|
|
94
|
-
}
|
|
95
|
-
default:
|
|
96
|
-
{
|
|
97
|
-
return [theme.colorFillSecondary, theme.colorSuccess];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}, [theme, isDarkMode, maxLevel]);
|
|
101
|
-
var useAnimation = !usePrefersReducedMotion();
|
|
102
|
-
|
|
103
|
-
// Memoize weeks calculation - expensive operation
|
|
104
|
-
var weeks = useMemo(function () {
|
|
105
|
-
if (activities.length === 0) return [];
|
|
106
|
-
return groupByWeeks(activities, weekStart);
|
|
107
|
-
}, [activities, weekStart]);
|
|
108
|
-
|
|
109
|
-
// Memoize color scale calculation
|
|
110
|
-
var colorScale = useMemo(function () {
|
|
111
|
-
return createTheme(colors || defaultColors, maxLevel + 1);
|
|
112
|
-
}, [colors, defaultColors, maxLevel]);
|
|
113
|
-
|
|
114
|
-
// Memoize year calculation
|
|
115
|
-
var year = useMemo(function () {
|
|
116
|
-
if (activities.length === 0) return new Date().getFullYear();
|
|
117
|
-
var firstActivity = activities[0];
|
|
118
|
-
return getYear(parseISO(firstActivity.date));
|
|
119
|
-
}, [activities]);
|
|
120
|
-
|
|
121
|
-
// Memoize labels object merge
|
|
122
|
-
var labels = useMemo(function () {
|
|
123
|
-
return Object.assign({}, DEFAULT_LABELS, labelsProp);
|
|
124
|
-
}, [labelsProp]);
|
|
125
|
-
|
|
126
|
-
// Memoize label height calculation
|
|
127
|
-
var labelHeight = useMemo(function () {
|
|
128
|
-
return hideMonthLabels ? 0 : fontSize + LABEL_MARGIN;
|
|
129
|
-
}, [hideMonthLabels, fontSize]);
|
|
130
|
-
|
|
131
|
-
// Memoize weekday label offset calculation
|
|
132
|
-
var weekdayLabelOffset = useMemo(function () {
|
|
133
|
-
if (!showWeekdayLabels || weeks.length === 0) return undefined;
|
|
134
|
-
var firstWeek = weeks[0];
|
|
135
|
-
return maxWeekdayLabelLength(firstWeek, weekStart, labels.weekdays, fontSize) + LABEL_MARGIN;
|
|
136
|
-
}, [showWeekdayLabels, weeks, weekStart, labels.weekdays, fontSize]);
|
|
137
|
-
|
|
138
|
-
// Memoize dimensions calculation
|
|
139
|
-
var dimensions = useMemo(function () {
|
|
140
|
-
return {
|
|
141
|
-
height: labelHeight + (blockSize + blockMargin) * 7 - blockMargin,
|
|
142
|
-
width: weeks.length * (blockSize + blockMargin) - blockMargin
|
|
143
|
-
};
|
|
144
|
-
}, [labelHeight, blockSize, blockMargin, weeks.length]);
|
|
145
|
-
var width = dimensions.width,
|
|
146
|
-
height = dimensions.height;
|
|
147
|
-
|
|
148
|
-
// Memoize total count calculation
|
|
149
|
-
var totalCount = useMemo(function () {
|
|
150
|
-
if (typeof totalCountProp === 'number') return totalCountProp;
|
|
151
|
-
return activities.reduce(function (sum, activity) {
|
|
152
|
-
return sum + activity.count;
|
|
153
|
-
}, 0);
|
|
154
|
-
}, [totalCountProp, activities]);
|
|
155
|
-
|
|
156
|
-
// Memoize container styles
|
|
157
|
-
var containerStyles = useMemo(function () {
|
|
158
|
-
var zeroColor = colorScale[0];
|
|
159
|
-
return _objectSpread({
|
|
160
|
-
fontSize: fontSize
|
|
161
|
-
}, useAnimation && _defineProperty(_defineProperty({}, "--lobe-heatmaps-loading", zeroColor), "--lobe-heatmaps-loading-active", theme.colorFill));
|
|
162
|
-
}, [fontSize, useAnimation, colorScale, theme.colorFill]);
|
|
163
|
-
if (activities.length === 0) return /*#__PURE__*/_jsx(NoData, {
|
|
164
|
-
noDataText: noDataText
|
|
165
|
-
});
|
|
166
|
-
if (showWeekdayLabels && isOnSeverSide) return null;
|
|
167
|
-
return /*#__PURE__*/_jsx(TooltipGroup, {
|
|
168
|
-
children: /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
|
|
169
|
-
className: cx(styles.container, className),
|
|
170
|
-
ref: ref,
|
|
171
|
-
style: _objectSpread(_objectSpread({}, style), containerStyles)
|
|
172
|
-
}, rest), {}, {
|
|
173
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
174
|
-
className: styles.scrollContainer,
|
|
175
|
-
children: /*#__PURE__*/_jsxs("svg", {
|
|
176
|
-
className: styles.calendar,
|
|
177
|
-
height: height,
|
|
178
|
-
style: {
|
|
179
|
-
marginLeft: weekdayLabelOffset
|
|
180
|
-
},
|
|
181
|
-
viewBox: "0 0 ".concat(width, " ").concat(height),
|
|
182
|
-
width: width,
|
|
183
|
-
children: [!loading && !showWeekdayLabels && hideMonthLabels ? undefined : /*#__PURE__*/_jsx(ChartLabels, {
|
|
184
|
-
blockMargin: blockMargin,
|
|
185
|
-
blockSize: blockSize,
|
|
186
|
-
hideMonthLabels: hideMonthLabels,
|
|
187
|
-
labelHeight: labelHeight,
|
|
188
|
-
labelMargin: LABEL_MARGIN,
|
|
189
|
-
labels: labels,
|
|
190
|
-
showWeekdayLabels: showWeekdayLabels,
|
|
191
|
-
weekStart: weekStart,
|
|
192
|
-
weeks: weeks
|
|
193
|
-
}), /*#__PURE__*/_jsx(Calendar, {
|
|
194
|
-
blockMargin: blockMargin,
|
|
195
|
-
blockRadius: blockRadius,
|
|
196
|
-
blockSize: blockSize,
|
|
197
|
-
colorScale: colorScale,
|
|
198
|
-
customTooltip: customTooltip,
|
|
199
|
-
enableAnimation: loading && useAnimation,
|
|
200
|
-
labelHeight: labelHeight,
|
|
201
|
-
labels: labels,
|
|
202
|
-
maxLevel: maxLevel,
|
|
203
|
-
onValueChange: onValueChange,
|
|
204
|
-
showTooltip: showTooltip,
|
|
205
|
-
weeks: weeks
|
|
206
|
-
})]
|
|
207
|
-
})
|
|
208
|
-
}), hideTotalCount && hideColorLegend ? undefined : /*#__PURE__*/_jsx(Footer, {
|
|
209
|
-
blockRadius: blockRadius,
|
|
210
|
-
blockSize: blockSize,
|
|
211
|
-
colorScale: colorScale,
|
|
212
|
-
hideColorLegend: hideColorLegend,
|
|
213
|
-
hideTotalCount: hideTotalCount,
|
|
214
|
-
labels: labels,
|
|
215
|
-
loading: loading,
|
|
216
|
-
maxLevel: maxLevel,
|
|
217
|
-
totalCount: totalCount,
|
|
218
|
-
weekdayLabelOffset: weekdayLabelOffset,
|
|
219
|
-
year: year
|
|
220
|
-
})]
|
|
221
|
-
}))
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
Heatmaps.displayName = 'Heatmaps';
|
|
225
|
-
export default Heatmaps;
|