@lobehub/charts 5.7.0 → 5.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/AccuracyBarChart/index.d.mts +62 -0
- package/es/AccuracyBarChart/index.mjs +326 -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 +308 -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 +290 -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 +128 -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 +514 -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 +347 -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 +668 -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 +254 -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 +146 -0
- package/es/DataBars/CategoryBar.mjs.map +1 -0
- package/es/DataBars/DeltaBar.d.mts +16 -0
- package/es/DataBars/DeltaBar.mjs +102 -0
- package/es/DataBars/DeltaBar.mjs.map +1 -0
- package/es/DataBars/MarkerBar.d.mts +19 -0
- package/es/DataBars/MarkerBar.mjs +74 -0
- package/es/DataBars/MarkerBar.mjs.map +1 -0
- package/es/DataBars/ProgressBar.d.mts +15 -0
- package/es/DataBars/ProgressBar.mjs +53 -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 +160 -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 +421 -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 +108 -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 +188 -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 +65 -0
- package/es/Legend/LegendItem.mjs.map +1 -0
- package/es/Legend/ScrollButton.d.mts +11 -0
- package/es/Legend/ScrollButton.mjs +50 -0
- package/es/Legend/ScrollButton.mjs.map +1 -0
- package/es/Legend/index.d.mts +16 -0
- package/es/Legend/index.mjs +152 -0
- package/es/Legend/index.mjs.map +1 -0
- package/es/LineChart/index.d.mts +11 -0
- package/es/LineChart/index.mjs +271 -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 +157 -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 +52 -0
- package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -0
- package/es/ScatterChart/ScatterChartTooltipRow.d.mts +10 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs +36 -0
- package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -0
- package/es/ScatterChart/index.d.mts +58 -0
- package/es/ScatterChart/index.mjs +241 -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 +109 -0
- package/es/SparkChart/SparkAreaChart.mjs.map +1 -0
- package/es/SparkChart/SparkBarChart.d.mts +11 -0
- package/es/SparkChart/SparkBarChart.mjs +69 -0
- package/es/SparkChart/SparkBarChart.mjs.map +1 -0
- package/es/SparkChart/SparkLineChart.d.mts +12 -0
- package/es/SparkChart/SparkLineChart.mjs +73 -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 +52 -0
- package/es/Tracker/TrackerBlock.mjs.map +1 -0
- package/es/Tracker/index.d.mts +21 -0
- package/es/Tracker/index.mjs +69 -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 +27 -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 +51 -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 +50 -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 +22 -4
- package/es/AccuracyBarChart/index.d.ts +0 -60
- package/es/AccuracyBarChart/index.js +0 -454
- 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 -430
- 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 -392
- 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 -174
- 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 -686
- 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 -455
- 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 -857
- 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 -335
- 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 -201
- package/es/DataBars/DeltaBar.d.ts +0 -13
- package/es/DataBars/DeltaBar.js +0 -117
- package/es/DataBars/MarkerBar.d.ts +0 -16
- package/es/DataBars/MarkerBar.js +0 -94
- package/es/DataBars/ProgressBar.d.ts +0 -12
- package/es/DataBars/ProgressBar.js +0 -71
- 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 -232
- 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 -499
- 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 -155
- 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 -227
- 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 -58
- package/es/Legend/ScrollButton.d.ts +0 -9
- package/es/Legend/ScrollButton.js +0 -63
- package/es/Legend/index.d.ts +0 -14
- package/es/Legend/index.js +0 -184
- package/es/Legend/index.mdx +0 -13
- package/es/LineChart/index.d.ts +0 -9
- package/es/LineChart/index.js +0 -388
- 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 -254
- 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 -76
- package/es/ScatterChart/ScatterChartTooltipRow.d.ts +0 -7
- package/es/ScatterChart/ScatterChartTooltipRow.js +0 -40
- package/es/ScatterChart/index.d.ts +0 -56
- package/es/ScatterChart/index.js +0 -342
- 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 -148
- package/es/SparkChart/SparkBarChart.d.ts +0 -9
- package/es/SparkChart/SparkBarChart.js +0 -106
- package/es/SparkChart/SparkLineChart.d.ts +0 -10
- package/es/SparkChart/SparkLineChart.js +0 -110
- 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 -64
- package/es/Tracker/index.d.ts +0 -18
- package/es/Tracker/index.js +0 -105
- 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 -32
- package/es/common/ChartTooltip/ChartTooltipRow.d.ts +0 -8
- package/es/common/ChartTooltip/ChartTooltipRow.js +0 -55
- package/es/common/ChartTooltip/index.d.ts +0 -15
- package/es/common/ChartTooltip/index.js +0 -66
- 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/types/global.d.ts +0 -9
- 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/FunnelChart/index.js
DELETED
|
@@ -1,499 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
5
|
-
var _excluded = ["data", "evolutionGradient", "gradient", "valueFormatter", "calculateFrom", "color", "variant", "showGridLines", "showYAxis", "showXAxis", "showArrow", "xAxisLabel", "yAxisLabel", "yAxisAlign", "showTooltip", "onValueChange", "customTooltip", "noDataText", "rotateLabelX", "barGap", "loading", "width", "height", "className", "style", "yAxisWidth"];
|
|
6
|
-
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; }
|
|
7
|
-
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; }
|
|
8
|
-
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; }
|
|
9
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
-
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); }
|
|
11
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
13
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
23
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
24
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
25
|
-
import { Flexbox } from '@lobehub/ui';
|
|
26
|
-
import { Skeleton } from '@lobehub/ui/base-ui';
|
|
27
|
-
import { useSize } from 'ahooks';
|
|
28
|
-
import { css, cssVar, cx } from 'antd-style';
|
|
29
|
-
import { Fragment, forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
30
|
-
import ArrowRightIcon from "./ArrowRightIcon";
|
|
31
|
-
import ChartTooltip from "../common/ChartTooltip";
|
|
32
|
-
import NoData from "../common/NoData";
|
|
33
|
-
import { useThemeColorRange } from "../hooks/useThemeColorRange";
|
|
34
|
-
import { defaultValueFormatter } from "../utils";
|
|
35
|
-
import { getMaxLabelLength } from "../utils/getMaxLabelLength";
|
|
36
|
-
import { styles } from "./styles";
|
|
37
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
38
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
39
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
40
|
-
var GLOBAL_PADDING = 10;
|
|
41
|
-
var HALF_PADDING = GLOBAL_PADDING / 2;
|
|
42
|
-
var Y_AXIS_LABELS = ['100%', '75%', '50%', '25%', '0%'];
|
|
43
|
-
var validateData = function validateData(data, calculatedFrom) {
|
|
44
|
-
if (data && data.length > 0) {
|
|
45
|
-
if (calculatedFrom === 'previous' && data[0].value <= 0) {
|
|
46
|
-
return "The value of the first item \"".concat(data[0].name, "\" is not greater than 0. This is not allowed when setting the \"calculateFrom\" prop to \"previous\". Please enter a value greater than 0.");
|
|
47
|
-
}
|
|
48
|
-
var _iterator = _createForOfIteratorHelper(data),
|
|
49
|
-
_step;
|
|
50
|
-
try {
|
|
51
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
52
|
-
var item = _step.value;
|
|
53
|
-
if (item.value < 0) {
|
|
54
|
-
return "Item \"".concat(item.name, "\" has a negative value: ").concat(item.value, ". This is not allowed. The value must be greater than or equal to 0.");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
} catch (err) {
|
|
58
|
-
_iterator.e(err);
|
|
59
|
-
} finally {
|
|
60
|
-
_iterator.f();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
};
|
|
65
|
-
var FunnelChart = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
66
|
-
var _tooltip$data, _tooltip$data$name, _tooltip$data2, _tooltip$data$color, _tooltip$data3, _tooltip$data4;
|
|
67
|
-
var themeColorRange = useThemeColorRange();
|
|
68
|
-
var _props$data = props.data,
|
|
69
|
-
data = _props$data === void 0 ? [] : _props$data,
|
|
70
|
-
_props$evolutionGradi = props.evolutionGradient,
|
|
71
|
-
evolutionGradient = _props$evolutionGradi === void 0 ? true : _props$evolutionGradi,
|
|
72
|
-
_props$gradient = props.gradient,
|
|
73
|
-
gradient = _props$gradient === void 0 ? false : _props$gradient,
|
|
74
|
-
_props$valueFormatter = props.valueFormatter,
|
|
75
|
-
valueFormatter = _props$valueFormatter === void 0 ? defaultValueFormatter : _props$valueFormatter,
|
|
76
|
-
_props$calculateFrom = props.calculateFrom,
|
|
77
|
-
calculateFrom = _props$calculateFrom === void 0 ? 'first' : _props$calculateFrom,
|
|
78
|
-
_props$color = props.color,
|
|
79
|
-
color = _props$color === void 0 ? themeColorRange[0] : _props$color,
|
|
80
|
-
_props$variant = props.variant,
|
|
81
|
-
variant = _props$variant === void 0 ? 'base' : _props$variant,
|
|
82
|
-
_props$showGridLines = props.showGridLines,
|
|
83
|
-
showGridLines = _props$showGridLines === void 0 ? true : _props$showGridLines,
|
|
84
|
-
_props$showYAxis = props.showYAxis,
|
|
85
|
-
showYAxis = _props$showYAxis === void 0 ? calculateFrom === 'previous' ? false : true : _props$showYAxis,
|
|
86
|
-
_props$showXAxis = props.showXAxis,
|
|
87
|
-
showXAxis = _props$showXAxis === void 0 ? true : _props$showXAxis,
|
|
88
|
-
_props$showArrow = props.showArrow,
|
|
89
|
-
showArrow = _props$showArrow === void 0 ? true : _props$showArrow,
|
|
90
|
-
_props$xAxisLabel = props.xAxisLabel,
|
|
91
|
-
xAxisLabel = _props$xAxisLabel === void 0 ? '' : _props$xAxisLabel,
|
|
92
|
-
_props$yAxisLabel = props.yAxisLabel,
|
|
93
|
-
yAxisLabel = _props$yAxisLabel === void 0 ? '' : _props$yAxisLabel,
|
|
94
|
-
_props$yAxisAlign = props.yAxisAlign,
|
|
95
|
-
yAxisAlign = _props$yAxisAlign === void 0 ? 'left' : _props$yAxisAlign,
|
|
96
|
-
_props$showTooltip = props.showTooltip,
|
|
97
|
-
showTooltip = _props$showTooltip === void 0 ? true : _props$showTooltip,
|
|
98
|
-
onValueChange = props.onValueChange,
|
|
99
|
-
customTooltip = props.customTooltip,
|
|
100
|
-
noDataText = props.noDataText,
|
|
101
|
-
rotateLabelX = props.rotateLabelX,
|
|
102
|
-
_props$barGap = props.barGap,
|
|
103
|
-
barGap = _props$barGap === void 0 ? '20%' : _props$barGap,
|
|
104
|
-
loading = props.loading,
|
|
105
|
-
_props$width = props.width,
|
|
106
|
-
width = _props$width === void 0 ? '100%' : _props$width,
|
|
107
|
-
_props$height = props.height,
|
|
108
|
-
height = _props$height === void 0 ? 280 : _props$height,
|
|
109
|
-
className = props.className,
|
|
110
|
-
style = props.style,
|
|
111
|
-
yAxisWidth = props.yAxisWidth,
|
|
112
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
113
|
-
var svgRef = useRef(ref);
|
|
114
|
-
var size = useSize(svgRef);
|
|
115
|
-
var tooltipRef = useRef(null);
|
|
116
|
-
var _useState = useState(0),
|
|
117
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
118
|
-
svgWidth = _useState2[0],
|
|
119
|
-
setSvgWidth = _useState2[1];
|
|
120
|
-
var _useState3 = useState(0),
|
|
121
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
122
|
-
svgHeight = _useState4[0],
|
|
123
|
-
setSvgHeight = _useState4[1];
|
|
124
|
-
var _useState5 = useState({
|
|
125
|
-
x: 0,
|
|
126
|
-
y: 0
|
|
127
|
-
}),
|
|
128
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
129
|
-
tooltip = _useState6[0],
|
|
130
|
-
setTooltip = _useState6[1];
|
|
131
|
-
var _useState7 = useState(),
|
|
132
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
133
|
-
activeBar = _useState8[0],
|
|
134
|
-
setActiveBar = _useState8[1];
|
|
135
|
-
var DEFAULT_X_AXIS_HEIGHT = showXAxis && xAxisLabel ? 25 : 15;
|
|
136
|
-
var CustomTooltip = customTooltip;
|
|
137
|
-
var calculatedYAxisWidth = useMemo(function () {
|
|
138
|
-
if (yAxisWidth) return yAxisWidth;
|
|
139
|
-
return getMaxLabelLength({
|
|
140
|
-
data: data,
|
|
141
|
-
index: 'value',
|
|
142
|
-
valueFormatter: valueFormatter
|
|
143
|
-
}) / 4 + (yAxisLabel ? 24 : 0);
|
|
144
|
-
}, [yAxisWidth, data, valueFormatter, yAxisLabel]);
|
|
145
|
-
useEffect(function () {
|
|
146
|
-
var handleResize = function handleResize() {
|
|
147
|
-
setSvgWidth((size === null || size === void 0 ? void 0 : size.width) || 0);
|
|
148
|
-
setSvgHeight((size === null || size === void 0 ? void 0 : size.height) || 0);
|
|
149
|
-
};
|
|
150
|
-
handleResize();
|
|
151
|
-
}, [size]);
|
|
152
|
-
useEffect(function () {
|
|
153
|
-
var handleTooltipOverflows = function handleTooltipOverflows() {
|
|
154
|
-
if (tooltipRef.current) {
|
|
155
|
-
var boundingBox = tooltipRef.current.getBoundingClientRect();
|
|
156
|
-
if (boundingBox.right > window.innerWidth) {
|
|
157
|
-
tooltipRef.current.style.left = "".concat(svgWidth - boundingBox.width, "px");
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
handleTooltipOverflows();
|
|
162
|
-
window.addEventListener('resize', handleTooltipOverflows);
|
|
163
|
-
return function () {
|
|
164
|
-
return window.removeEventListener('resize', handleTooltipOverflows);
|
|
165
|
-
};
|
|
166
|
-
}, [tooltip, svgWidth]);
|
|
167
|
-
var maxValue = useMemo(function () {
|
|
168
|
-
return Math.max.apply(Math, _toConsumableArray(data.map(function (item) {
|
|
169
|
-
return item.value;
|
|
170
|
-
})));
|
|
171
|
-
}, [data]);
|
|
172
|
-
var widthWithoutPadding = svgWidth - GLOBAL_PADDING - calculatedYAxisWidth;
|
|
173
|
-
var gap = useMemo(function () {
|
|
174
|
-
if (typeof barGap === 'number') {
|
|
175
|
-
return barGap;
|
|
176
|
-
} else if (typeof barGap === 'string' && barGap.endsWith('%')) {
|
|
177
|
-
var percentage = Number.parseFloat(barGap.slice(0, -1));
|
|
178
|
-
var totalWidthForGaps = widthWithoutPadding * percentage / 100;
|
|
179
|
-
var numberOfGaps = data.length - 1;
|
|
180
|
-
return totalWidthForGaps / numberOfGaps;
|
|
181
|
-
} else {
|
|
182
|
-
console.error('Invalid barGap value. It must be a number or a percentage string (e.g., "10%").');
|
|
183
|
-
return 30;
|
|
184
|
-
}
|
|
185
|
-
}, [widthWithoutPadding, data.length, barGap]);
|
|
186
|
-
var barWidth = useMemo(function () {
|
|
187
|
-
return (widthWithoutPadding - (data.length - 1) * gap - gap) / data.length;
|
|
188
|
-
}, [widthWithoutPadding, gap, data.length]);
|
|
189
|
-
var realHeight = svgHeight - GLOBAL_PADDING - (showXAxis ? ((rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.xAxisHeight) || DEFAULT_X_AXIS_HEIGHT) + (showXAxis && xAxisLabel ? 30 : 10) : 0);
|
|
190
|
-
var isPreviousCalculation = calculateFrom === 'previous';
|
|
191
|
-
var isVariantCenter = variant === 'center';
|
|
192
|
-
var formattedData = useMemo(function () {
|
|
193
|
-
if (realHeight <= 0) return [];
|
|
194
|
-
return data.reduce(function (acc, item, index) {
|
|
195
|
-
var _prev$value, _prev$barHeight, _prev$barHeight2, _data;
|
|
196
|
-
var prev = acc[index - 1];
|
|
197
|
-
var value = item.value;
|
|
198
|
-
var valueToCompareWith = isPreviousCalculation ? (_prev$value = prev === null || prev === void 0 ? void 0 : prev.value) !== null && _prev$value !== void 0 ? _prev$value : maxValue : maxValue;
|
|
199
|
-
var calculationHeight = isPreviousCalculation ? (_prev$barHeight = prev === null || prev === void 0 ? void 0 : prev.barHeight) !== null && _prev$barHeight !== void 0 ? _prev$barHeight : realHeight : realHeight;
|
|
200
|
-
var normalizedValue = value / valueToCompareWith;
|
|
201
|
-
var barHeight = normalizedValue * calculationHeight;
|
|
202
|
-
var startX = index * (barWidth + gap) + 0.5 * gap;
|
|
203
|
-
var startY = calculationHeight - barHeight + (isPreviousCalculation ? realHeight - ((_prev$barHeight2 = prev === null || prev === void 0 ? void 0 : prev.barHeight) !== null && _prev$barHeight2 !== void 0 ? _prev$barHeight2 : realHeight) : 0);
|
|
204
|
-
var nextValue = (_data = data[index + 1]) === null || _data === void 0 ? void 0 : _data.value;
|
|
205
|
-
var nextNormalizedValue = nextValue / valueToCompareWith;
|
|
206
|
-
var nextBarHeight = nextNormalizedValue * calculationHeight;
|
|
207
|
-
var nextStartX = (index + 1) * (barWidth + gap) + 0.5 * gap;
|
|
208
|
-
acc.push({
|
|
209
|
-
barHeight: barHeight,
|
|
210
|
-
name: item.name,
|
|
211
|
-
nextBarHeight: nextBarHeight,
|
|
212
|
-
nextNormalizedValue: nextNormalizedValue,
|
|
213
|
-
nextStartX: nextStartX,
|
|
214
|
-
nextValue: nextValue,
|
|
215
|
-
normalizedValue: normalizedValue,
|
|
216
|
-
startX: startX,
|
|
217
|
-
startY: startY,
|
|
218
|
-
value: value
|
|
219
|
-
});
|
|
220
|
-
return acc;
|
|
221
|
-
}, []);
|
|
222
|
-
}, [data, realHeight, isPreviousCalculation, barWidth, gap, maxValue]);
|
|
223
|
-
var handleTooltip = function handleTooltip(touch) {
|
|
224
|
-
var _svgRef$current;
|
|
225
|
-
var chartBoundingRect = (_svgRef$current = svgRef.current) === null || _svgRef$current === void 0 ? void 0 : _svgRef$current.getBoundingClientRect();
|
|
226
|
-
if (!chartBoundingRect) return;
|
|
227
|
-
var chartX = chartBoundingRect.x;
|
|
228
|
-
if (formattedData.length === 0) {
|
|
229
|
-
return setTooltip({
|
|
230
|
-
x: 0,
|
|
231
|
-
y: 0
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
var pageX = touch.pageX - chartX - barWidth / 2 - calculatedYAxisWidth - HALF_PADDING;
|
|
235
|
-
var closestBar = formattedData.reduce(function (acc, current) {
|
|
236
|
-
var currentDistance = Math.abs(current.startX - pageX);
|
|
237
|
-
var accDistance = Math.abs(acc.startX - pageX);
|
|
238
|
-
return currentDistance < accDistance ? current : acc;
|
|
239
|
-
}, formattedData[0]); // 提供初始值
|
|
240
|
-
|
|
241
|
-
var closestBarIndex = formattedData.indexOf(closestBar);
|
|
242
|
-
setTooltip({
|
|
243
|
-
data: {
|
|
244
|
-
className: cx(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: ", ";\n color: ", ";\n "])), onValueChange ? 'pointer' : undefined, color !== null && color !== void 0 ? color : cssVar.colorPrimary)),
|
|
245
|
-
color: color !== null && color !== void 0 ? color : cssVar.colorPrimary,
|
|
246
|
-
dataKey: closestBar.name,
|
|
247
|
-
fill: '',
|
|
248
|
-
name: closestBar.name,
|
|
249
|
-
payload: closestBar,
|
|
250
|
-
value: closestBar.value
|
|
251
|
-
},
|
|
252
|
-
index: closestBarIndex,
|
|
253
|
-
x: closestBar.startX,
|
|
254
|
-
y: closestBar.startY
|
|
255
|
-
});
|
|
256
|
-
};
|
|
257
|
-
if (loading || !data) return /*#__PURE__*/_jsx(Skeleton, {
|
|
258
|
-
height: height,
|
|
259
|
-
width: width
|
|
260
|
-
});
|
|
261
|
-
var errorMessage = data ? validateData(data, calculateFrom) : null;
|
|
262
|
-
if (errorMessage) {
|
|
263
|
-
return /*#__PURE__*/_jsx(NoData, {
|
|
264
|
-
noDataText: errorMessage
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
var onBarClick = function onBarClick(data, idx, event) {
|
|
268
|
-
event.stopPropagation();
|
|
269
|
-
if (!onValueChange) return;
|
|
270
|
-
if (idx === (activeBar === null || activeBar === void 0 ? void 0 : activeBar.index)) {
|
|
271
|
-
setActiveBar(undefined);
|
|
272
|
-
onValueChange === null || onValueChange === void 0 || onValueChange(null);
|
|
273
|
-
} else {
|
|
274
|
-
setActiveBar({
|
|
275
|
-
data: data,
|
|
276
|
-
index: idx
|
|
277
|
-
});
|
|
278
|
-
onValueChange === null || onValueChange === void 0 || onValueChange(_objectSpread({
|
|
279
|
-
categoryClicked: data.name,
|
|
280
|
-
eventType: 'bar'
|
|
281
|
-
}, data));
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
|
|
285
|
-
className: className,
|
|
286
|
-
height: height,
|
|
287
|
-
ref: svgRef,
|
|
288
|
-
style: _objectSpread({
|
|
289
|
-
position: 'relative'
|
|
290
|
-
}, style),
|
|
291
|
-
width: width
|
|
292
|
-
}, rest), {}, {
|
|
293
|
-
children: data !== null && data !== void 0 && data.length ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
294
|
-
children: [/*#__PURE__*/_jsxs("svg", {
|
|
295
|
-
onMouseLeave: function onMouseLeave() {
|
|
296
|
-
return setTooltip({
|
|
297
|
-
x: 0,
|
|
298
|
-
y: 0
|
|
299
|
-
});
|
|
300
|
-
},
|
|
301
|
-
onMouseMove: function onMouseMove(e) {
|
|
302
|
-
var fakeTouch = {
|
|
303
|
-
clientX: e.clientX,
|
|
304
|
-
clientY: e.clientY,
|
|
305
|
-
pageX: e.pageX,
|
|
306
|
-
pageY: e.pageY
|
|
307
|
-
};
|
|
308
|
-
handleTooltip(fakeTouch);
|
|
309
|
-
},
|
|
310
|
-
onTouchEnd: function onTouchEnd() {
|
|
311
|
-
return setTooltip({
|
|
312
|
-
x: 0,
|
|
313
|
-
y: 0
|
|
314
|
-
});
|
|
315
|
-
},
|
|
316
|
-
onTouchMove: function onTouchMove(e) {
|
|
317
|
-
var touch = e.touches[0];
|
|
318
|
-
handleTooltip(touch);
|
|
319
|
-
},
|
|
320
|
-
style: {
|
|
321
|
-
height: '100%',
|
|
322
|
-
width: '100%'
|
|
323
|
-
},
|
|
324
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
325
|
-
children: [Y_AXIS_LABELS.map(function (label, index) {
|
|
326
|
-
return /*#__PURE__*/_jsxs(Fragment, {
|
|
327
|
-
children: [showGridLines && /*#__PURE__*/_jsx("line", {
|
|
328
|
-
className: styles.gridLines,
|
|
329
|
-
x1: calculatedYAxisWidth + HALF_PADDING,
|
|
330
|
-
x2: svgWidth - HALF_PADDING,
|
|
331
|
-
y1: index * realHeight / 4 + HALF_PADDING,
|
|
332
|
-
y2: index * realHeight / 4 + HALF_PADDING
|
|
333
|
-
}), /*#__PURE__*/_jsx("text", {
|
|
334
|
-
className: styles.label,
|
|
335
|
-
textAnchor: yAxisAlign === 'left' ? 'start' : 'end',
|
|
336
|
-
x: yAxisAlign === 'left' ? yAxisLabel ? 24 : 0 : calculatedYAxisWidth - 10 + HALF_PADDING,
|
|
337
|
-
y: index * realHeight / 4 + 5 + HALF_PADDING,
|
|
338
|
-
children: label
|
|
339
|
-
})]
|
|
340
|
-
}, "y-axis-".concat(index));
|
|
341
|
-
}), formattedData.map(function (item, index) {
|
|
342
|
-
var _formattedData, _formattedData2;
|
|
343
|
-
return /*#__PURE__*/_jsxs("g", {
|
|
344
|
-
children: [/*#__PURE__*/_jsx("rect", {
|
|
345
|
-
height: realHeight,
|
|
346
|
-
style: {
|
|
347
|
-
fill: tooltip.index === index ? cssVar.colorFillTertiary : 'transparent',
|
|
348
|
-
zIndex: 0
|
|
349
|
-
},
|
|
350
|
-
width: barWidth + gap,
|
|
351
|
-
x: item.startX - gap * 0.5 + HALF_PADDING + calculatedYAxisWidth,
|
|
352
|
-
y: HALF_PADDING
|
|
353
|
-
}), gradient && /*#__PURE__*/_jsx("rect", {
|
|
354
|
-
fill: "url(#base-gradient)",
|
|
355
|
-
height: (realHeight - item.barHeight - (isPreviousCalculation ? realHeight - ((_formattedData = formattedData[index - 1]) === null || _formattedData === void 0 ? void 0 : _formattedData.barHeight) || 0 : 0)) / (isVariantCenter ? 2 : 1),
|
|
356
|
-
style: {
|
|
357
|
-
opacity: activeBar && activeBar.index !== index ? 0.3 : 1
|
|
358
|
-
},
|
|
359
|
-
width: barWidth,
|
|
360
|
-
x: item.startX + HALF_PADDING + calculatedYAxisWidth,
|
|
361
|
-
y: realHeight - (isPreviousCalculation ? ((_formattedData2 = formattedData[index - 1]) === null || _formattedData2 === void 0 ? void 0 : _formattedData2.barHeight) || realHeight : realHeight) + HALF_PADDING
|
|
362
|
-
}), /*#__PURE__*/_jsx("rect", {
|
|
363
|
-
height: item.barHeight,
|
|
364
|
-
onClick: function onClick(e) {
|
|
365
|
-
return onBarClick(item, index, e);
|
|
366
|
-
},
|
|
367
|
-
style: {
|
|
368
|
-
cursor: onValueChange ? 'pointer' : undefined,
|
|
369
|
-
fill: color !== null && color !== void 0 ? color : cssVar.colorPrimary,
|
|
370
|
-
opacity: activeBar && activeBar.index !== index ? 0.3 : 1
|
|
371
|
-
},
|
|
372
|
-
width: barWidth,
|
|
373
|
-
x: item.startX + HALF_PADDING + calculatedYAxisWidth,
|
|
374
|
-
y: (isVariantCenter ? realHeight / 2 - item.barHeight / 2 : item.startY) + HALF_PADDING
|
|
375
|
-
}), gradient && isVariantCenter && /*#__PURE__*/_jsx("rect", {
|
|
376
|
-
fill: "url(#base-gradient-revert)",
|
|
377
|
-
height: (realHeight - item.barHeight) / 2,
|
|
378
|
-
style: {
|
|
379
|
-
opacity: activeBar && activeBar.index !== index ? 0.3 : 1
|
|
380
|
-
},
|
|
381
|
-
width: barWidth,
|
|
382
|
-
x: item.startX + HALF_PADDING + calculatedYAxisWidth,
|
|
383
|
-
y: realHeight / 2 + item.barHeight / 2 + HALF_PADDING
|
|
384
|
-
}), showXAxis && /*#__PURE__*/_jsx("foreignObject", {
|
|
385
|
-
height: (rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.xAxisHeight) || DEFAULT_X_AXIS_HEIGHT,
|
|
386
|
-
transform: rotateLabelX ? "rotate(".concat(rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.angle, ", ").concat(item.startX + barWidth / 2 + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight + ((rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.xAxisHeight) || DEFAULT_X_AXIS_HEIGHT) / 2 + HALF_PADDING + ((rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.verticalShift) || 0), ")") : undefined,
|
|
387
|
-
width: barWidth,
|
|
388
|
-
x: item.startX + HALF_PADDING + calculatedYAxisWidth,
|
|
389
|
-
y: realHeight + HALF_PADDING + 10,
|
|
390
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
391
|
-
className: cx(styles.strongLabel, styles.emphasis),
|
|
392
|
-
title: item.name,
|
|
393
|
-
children: item.name
|
|
394
|
-
})
|
|
395
|
-
})]
|
|
396
|
-
}, "bar-".concat(index));
|
|
397
|
-
}), formattedData.map(function (item, index) {
|
|
398
|
-
return /*#__PURE__*/_jsxs(Fragment, {
|
|
399
|
-
children: [index < data.length - 1 && evolutionGradient && (isVariantCenter ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
400
|
-
children: [/*#__PURE__*/_jsx("polygon", {
|
|
401
|
-
fill: "url(#base-gradient)",
|
|
402
|
-
points: "\n ".concat(item.startX + barWidth + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight / 2 + item.nextBarHeight / 4 + HALF_PADDING, "\n ").concat(item.nextStartX + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight / 2 + item.nextBarHeight / 4 + HALF_PADDING, "\n ").concat(item.nextStartX + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight / 2 - item.nextBarHeight / 2 + HALF_PADDING, "\n ").concat(item.startX + barWidth + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight / 2 - item.barHeight / 2 + HALF_PADDING, "\n "),
|
|
403
|
-
style: {
|
|
404
|
-
opacity: activeBar && activeBar.index !== index ? 0.3 : 1,
|
|
405
|
-
zIndex: 10
|
|
406
|
-
}
|
|
407
|
-
}), /*#__PURE__*/_jsx("polygon", {
|
|
408
|
-
fill: "url(#base-gradient-revert)",
|
|
409
|
-
points: "\n ".concat(item.startX + barWidth + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight / 2 + item.barHeight / 2 + HALF_PADDING, "\n ").concat(item.nextStartX + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight / 2 + item.nextBarHeight / 2 + HALF_PADDING, "\n ").concat(item.nextStartX + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight / 2 - item.nextBarHeight / 4 + HALF_PADDING, "\n ").concat(item.startX + barWidth + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight / 2 - item.nextBarHeight / 4 + HALF_PADDING, "\n "),
|
|
410
|
-
style: {
|
|
411
|
-
opacity: activeBar && activeBar.index !== index ? 0.3 : 1,
|
|
412
|
-
zIndex: 10
|
|
413
|
-
}
|
|
414
|
-
})]
|
|
415
|
-
}) : /*#__PURE__*/_jsx("polygon", {
|
|
416
|
-
fill: "url(#base-gradient)",
|
|
417
|
-
points: "\n ".concat(item.startX + barWidth + HALF_PADDING + calculatedYAxisWidth, ", ").concat(item.startY + HALF_PADDING, "\n ").concat(item.nextStartX + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight - item.nextBarHeight + HALF_PADDING, "\n ").concat(item.nextStartX + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight + HALF_PADDING, "\n ").concat(item.startX + barWidth + HALF_PADDING + calculatedYAxisWidth, ", ").concat(realHeight + HALF_PADDING, "\n "),
|
|
418
|
-
style: {
|
|
419
|
-
opacity: activeBar && activeBar.index !== index ? 0.3 : 1,
|
|
420
|
-
zIndex: 10
|
|
421
|
-
}
|
|
422
|
-
})), index < data.length - 1 && showXAxis && showArrow && gap >= 14 && /*#__PURE__*/_jsx("foreignObject", {
|
|
423
|
-
height: (rotateLabelX === null || rotateLabelX === void 0 ? void 0 : rotateLabelX.xAxisHeight) || DEFAULT_X_AXIS_HEIGHT,
|
|
424
|
-
width: 12,
|
|
425
|
-
x: item.startX + barWidth + HALF_PADDING + calculatedYAxisWidth - 6 + gap / 2,
|
|
426
|
-
y: realHeight + HALF_PADDING + 11,
|
|
427
|
-
children: /*#__PURE__*/_jsx(ArrowRightIcon, {})
|
|
428
|
-
})]
|
|
429
|
-
}, "gradient-".concat(index));
|
|
430
|
-
}), /*#__PURE__*/_jsxs("linearGradient", {
|
|
431
|
-
className: cx(css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n stop {\n stop-color: ", ";\n }\n "])), color !== null && color !== void 0 ? color : cssVar.colorPrimary)),
|
|
432
|
-
id: 'base-gradient',
|
|
433
|
-
x1: "0%",
|
|
434
|
-
x2: "0%",
|
|
435
|
-
y1: "0%",
|
|
436
|
-
y2: "100%",
|
|
437
|
-
children: [/*#__PURE__*/_jsx("stop", {
|
|
438
|
-
offset: "5%",
|
|
439
|
-
stopOpacity: 0.4
|
|
440
|
-
}), /*#__PURE__*/_jsx("stop", {
|
|
441
|
-
offset: "95%",
|
|
442
|
-
stopOpacity: 0
|
|
443
|
-
})]
|
|
444
|
-
}), /*#__PURE__*/_jsxs("linearGradient", {
|
|
445
|
-
className: cx(css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n stop {\n stop-color: ", ";\n }\n "])), color !== null && color !== void 0 ? color : cssVar.colorPrimary)),
|
|
446
|
-
id: 'base-gradient-revert',
|
|
447
|
-
x1: "0%",
|
|
448
|
-
x2: "0%",
|
|
449
|
-
y1: "0%",
|
|
450
|
-
y2: "100%",
|
|
451
|
-
children: [/*#__PURE__*/_jsx("stop", {
|
|
452
|
-
offset: "5%",
|
|
453
|
-
stopOpacity: 0
|
|
454
|
-
}), /*#__PURE__*/_jsx("stop", {
|
|
455
|
-
offset: "95%",
|
|
456
|
-
stopOpacity: 0.4
|
|
457
|
-
})]
|
|
458
|
-
}), showXAxis && xAxisLabel && /*#__PURE__*/_jsx("text", {
|
|
459
|
-
className: cx(styles.strongLabel, styles.emphasis),
|
|
460
|
-
x: svgWidth / 2 + calculatedYAxisWidth / 2,
|
|
461
|
-
y: realHeight + HALF_PADDING + 50,
|
|
462
|
-
children: xAxisLabel
|
|
463
|
-
}), showYAxis && yAxisLabel && /*#__PURE__*/_jsx("text", {
|
|
464
|
-
className: cx(styles.strongLabel, styles.emphasis),
|
|
465
|
-
transform: "rotate(-90, 0, ".concat(realHeight / 2, ")"),
|
|
466
|
-
x: -5,
|
|
467
|
-
y: realHeight / 2 + 10,
|
|
468
|
-
children: yAxisLabel
|
|
469
|
-
})]
|
|
470
|
-
}), showTooltip && /*#__PURE__*/_jsx("div", {
|
|
471
|
-
ref: tooltipRef,
|
|
472
|
-
style: {
|
|
473
|
-
display: tooltip.data ? 'block' : 'none',
|
|
474
|
-
left: tooltip.x + barWidth * 0.66,
|
|
475
|
-
pointerEvents: 'none',
|
|
476
|
-
position: 'absolute',
|
|
477
|
-
top: 0
|
|
478
|
-
},
|
|
479
|
-
tabIndex: -1,
|
|
480
|
-
children: CustomTooltip ? /*#__PURE__*/_jsx(CustomTooltip, {
|
|
481
|
-
active: !!tooltip.data,
|
|
482
|
-
label: (_tooltip$data = tooltip.data) === null || _tooltip$data === void 0 ? void 0 : _tooltip$data.name,
|
|
483
|
-
payload: tooltip.data ? [tooltip.data] : [],
|
|
484
|
-
valueFormatter: valueFormatter
|
|
485
|
-
}) : /*#__PURE__*/_jsx(ChartTooltip, {
|
|
486
|
-
active: !!tooltip.data,
|
|
487
|
-
categoryColors: new Map([[(_tooltip$data$name = (_tooltip$data2 = tooltip.data) === null || _tooltip$data2 === void 0 ? void 0 : _tooltip$data2.name) !== null && _tooltip$data$name !== void 0 ? _tooltip$data$name : '', (_tooltip$data$color = (_tooltip$data3 = tooltip.data) === null || _tooltip$data3 === void 0 ? void 0 : _tooltip$data3.color) !== null && _tooltip$data$color !== void 0 ? _tooltip$data$color : '']]),
|
|
488
|
-
label: ((_tooltip$data4 = tooltip.data) === null || _tooltip$data4 === void 0 ? void 0 : _tooltip$data4.name) || '',
|
|
489
|
-
payload: tooltip.data ? [tooltip.data] : [],
|
|
490
|
-
valueFormatter: valueFormatter
|
|
491
|
-
})
|
|
492
|
-
})]
|
|
493
|
-
}) : /*#__PURE__*/_jsx(NoData, {
|
|
494
|
-
noDataText: noDataText
|
|
495
|
-
})
|
|
496
|
-
}));
|
|
497
|
-
});
|
|
498
|
-
FunnelChart.displayName = 'FunnelChart';
|
|
499
|
-
export default FunnelChart;
|
package/es/FunnelChart/index.mdx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: FunnelChart
|
|
3
|
-
description: A funnel chart illustrates the progression or conversion rates through successive stages of a process.
|
|
4
|
-
category: Charts
|
|
5
|
-
order: 3
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
import DemoIndex from './demos/index.tsx?demo';
|
|
9
|
-
import DemoCalculateFrom from './demos/CalculateFrom.tsx?demo';
|
|
10
|
-
|
|
11
|
-
<Demo of={DemoIndex} layout="bare" />
|
|
12
|
-
|
|
13
|
-
## Usage example with evolution gradient
|
|
14
|
-
|
|
15
|
-
The `calculateFrom` prop controls the referenced value to calculate the drop-off between steps. Here we set it to previous, to always reference the preceding bar as the calculation base. We also set `showArrow` to false.
|
|
16
|
-
|
|
17
|
-
<Demo of={DemoCalculateFrom} />
|
|
18
|
-
|
|
19
|
-
## API
|
|
20
|
-
|
|
21
|
-
<Api name="FunnelChart" />
|
package/es/FunnelChart/styles.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
2
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import { createStaticStyles } from 'antd-style';
|
|
4
|
-
export var styles = createStaticStyles(function (_ref) {
|
|
5
|
-
var css = _ref.css,
|
|
6
|
-
cssVar = _ref.cssVar;
|
|
7
|
-
return {
|
|
8
|
-
emphasis: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n "]))),
|
|
9
|
-
gridLines: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n stroke: ", ";\n stroke-width: 1;\n "])), cssVar.colorBorderSecondary),
|
|
10
|
-
label: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n font-size: 12px;\n line-height: 16px;\n fill: ", ";\n "])), cssVar.colorTextDescription),
|
|
11
|
-
strongLabel: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ", ";\n "])), cssVar.colorTextSecondary)
|
|
12
|
-
};
|
|
13
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type Tooltip = {
|
|
2
|
-
data?: {
|
|
3
|
-
className?: string;
|
|
4
|
-
color?: string;
|
|
5
|
-
dataKey: string;
|
|
6
|
-
fill?: string;
|
|
7
|
-
name: string;
|
|
8
|
-
payload?: any;
|
|
9
|
-
value: number;
|
|
10
|
-
};
|
|
11
|
-
index?: number;
|
|
12
|
-
x: number;
|
|
13
|
-
y: number;
|
|
14
|
-
};
|
|
15
|
-
export type DataT = {
|
|
16
|
-
name: string;
|
|
17
|
-
value: number;
|
|
18
|
-
};
|
|
19
|
-
export type FormattedDataT = DataT & {
|
|
20
|
-
barHeight: number;
|
|
21
|
-
nextBarHeight: number;
|
|
22
|
-
nextNormalizedValue: number;
|
|
23
|
-
nextStartX: number;
|
|
24
|
-
nextValue: number;
|
|
25
|
-
normalizedValue: number;
|
|
26
|
-
startX: number;
|
|
27
|
-
startY: number;
|
|
28
|
-
};
|
package/es/FunnelChart/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import type { Activity, Labels, Week } from "../types/charts";
|
|
3
|
-
interface CalendarProps {
|
|
4
|
-
blockMargin: number;
|
|
5
|
-
blockRadius: number;
|
|
6
|
-
blockSize: number;
|
|
7
|
-
colorScale: string[];
|
|
8
|
-
customTooltip?: (activity: Activity) => ReactNode;
|
|
9
|
-
enableAnimation: boolean;
|
|
10
|
-
labelHeight: number;
|
|
11
|
-
labels: Labels;
|
|
12
|
-
maxLevel: number;
|
|
13
|
-
onValueChange?: (value: Activity) => void;
|
|
14
|
-
showTooltip: boolean;
|
|
15
|
-
weeks: Week[];
|
|
16
|
-
}
|
|
17
|
-
declare const Calendar: import("react").NamedExoticComponent<CalendarProps>;
|
|
18
|
-
export default Calendar;
|