@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/common/ChartLegend.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Flexbox } from '@lobehub/ui';
|
|
2
|
-
import { useRef } from 'react';
|
|
3
|
-
import Legend from "../Legend";
|
|
4
|
-
import { useOnWindowResize } from "../hooks/useOnWindowResize";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
var calculateHeight = function calculateHeight(height) {
|
|
7
|
-
return height ? Number(height) + 20 // 20px extra padding
|
|
8
|
-
: 60;
|
|
9
|
-
}; // default height
|
|
10
|
-
|
|
11
|
-
var ChartLegend = function ChartLegend(_ref, categoryColors, setLegendHeight, activeLegend, onClick, enableLegendSlider, customCategories) {
|
|
12
|
-
var payload = _ref.payload;
|
|
13
|
-
var legendRef = useRef(null);
|
|
14
|
-
useOnWindowResize(function () {
|
|
15
|
-
var _legendRef$current;
|
|
16
|
-
setLegendHeight(calculateHeight((_legendRef$current = legendRef.current) === null || _legendRef$current === void 0 ? void 0 : _legendRef$current.clientHeight));
|
|
17
|
-
});
|
|
18
|
-
var filteredPayload = payload.filter(function (item) {
|
|
19
|
-
return item.type !== 'none';
|
|
20
|
-
});
|
|
21
|
-
return /*#__PURE__*/_jsx(Flexbox, {
|
|
22
|
-
align: 'center',
|
|
23
|
-
horizontal: true,
|
|
24
|
-
justify: 'flex-end',
|
|
25
|
-
ref: legendRef,
|
|
26
|
-
children: /*#__PURE__*/_jsx(Legend, {
|
|
27
|
-
activeLegend: activeLegend,
|
|
28
|
-
categories: filteredPayload.map(function (entry) {
|
|
29
|
-
return entry.value;
|
|
30
|
-
}),
|
|
31
|
-
colors: filteredPayload.map(function (entry) {
|
|
32
|
-
return categoryColors.get(entry.value);
|
|
33
|
-
}),
|
|
34
|
-
customCategories: customCategories,
|
|
35
|
-
enableLegendSlider: enableLegendSlider,
|
|
36
|
-
onClickLegendItem: onClick
|
|
37
|
-
})
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
export default ChartLegend;
|
|
@@ -1,31 +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 _excluded = ["children"];
|
|
3
|
-
var _templateObject;
|
|
4
|
-
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; }
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
-
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); }
|
|
9
|
-
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; }
|
|
10
|
-
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; }
|
|
11
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
-
import { Flexbox, createStaticStyles } from '@lobehub/ui';
|
|
13
|
-
import { memo } from 'react';
|
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
export var styles = createStaticStyles(function (_ref) {
|
|
16
|
-
var css = _ref.css,
|
|
17
|
-
cssVar = _ref.cssVar;
|
|
18
|
-
return {
|
|
19
|
-
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n\n width: max-content;\n min-width: 160px;\n border: 1px solid ", ";\n border-radius: ", ";\n\n background: ", ";\n box-shadow: ", ";\n "])), cssVar.colorBorderSecondary, cssVar.borderRadiusLG, cssVar.colorBgElevated, cssVar.boxShadow)
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
export var ChartTooltipFrame = /*#__PURE__*/memo(function (_ref2) {
|
|
23
|
-
var children = _ref2.children,
|
|
24
|
-
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
25
|
-
return /*#__PURE__*/_jsx(Flexbox, _objectSpread(_objectSpread({
|
|
26
|
-
className: styles.container
|
|
27
|
-
}, rest), {}, {
|
|
28
|
-
children: children
|
|
29
|
-
}));
|
|
30
|
-
});
|
|
31
|
-
export default ChartTooltipFrame;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
var _templateObject, _templateObject2;
|
|
2
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import { Flexbox, Icon, Text, createStaticStyles } from '@lobehub/ui';
|
|
4
|
-
import { Circle } from 'lucide-react';
|
|
5
|
-
import { memo } from 'react';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
var styles = createStaticStyles(function (_ref) {
|
|
9
|
-
var css = _ref.css,
|
|
10
|
-
cssVar = _ref.cssVar;
|
|
11
|
-
return {
|
|
12
|
-
number: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex-shrink: 0;\n font-weight: 500;\n white-space: nowrap;\n "]))),
|
|
13
|
-
title: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n "])), cssVar.colorTextSecondary)
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
var ChartTooltipRow = /*#__PURE__*/memo(function (_ref2) {
|
|
17
|
-
var value = _ref2.value,
|
|
18
|
-
name = _ref2.name,
|
|
19
|
-
color = _ref2.color;
|
|
20
|
-
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
21
|
-
align: 'center',
|
|
22
|
-
gap: 32,
|
|
23
|
-
horizontal: true,
|
|
24
|
-
justify: 'space-between',
|
|
25
|
-
width: 'max-content',
|
|
26
|
-
children: [/*#__PURE__*/_jsxs(Flexbox, {
|
|
27
|
-
align: 'center',
|
|
28
|
-
gap: 8,
|
|
29
|
-
horizontal: true,
|
|
30
|
-
width: 'auto',
|
|
31
|
-
children: [/*#__PURE__*/_jsx(Icon, {
|
|
32
|
-
color: color,
|
|
33
|
-
fill: color,
|
|
34
|
-
icon: Circle,
|
|
35
|
-
size: 10
|
|
36
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
37
|
-
className: styles.title,
|
|
38
|
-
ellipsis: true,
|
|
39
|
-
style: {
|
|
40
|
-
margin: 0
|
|
41
|
-
},
|
|
42
|
-
children: name
|
|
43
|
-
})]
|
|
44
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
45
|
-
className: styles.number,
|
|
46
|
-
style: {
|
|
47
|
-
margin: 0
|
|
48
|
-
},
|
|
49
|
-
children: value
|
|
50
|
-
})]
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
export default ChartTooltipRow;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { ValueFormatter } from "../../types/charts";
|
|
3
|
-
export interface ChartTooltipProps {
|
|
4
|
-
active: boolean | undefined;
|
|
5
|
-
categoryColors: Map<string, string>;
|
|
6
|
-
customCategories?: {
|
|
7
|
-
[key: string]: string;
|
|
8
|
-
};
|
|
9
|
-
footer?: ReactNode;
|
|
10
|
-
label: string;
|
|
11
|
-
payload: any;
|
|
12
|
-
valueFormatter: ValueFormatter | ((value: number, name?: string) => string);
|
|
13
|
-
}
|
|
14
|
-
declare const ChartTooltip: ({ active, payload, label, categoryColors, valueFormatter, customCategories, footer, }: ChartTooltipProps) => import("react").JSX.Element | null;
|
|
15
|
-
export default ChartTooltip;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
var _templateObject;
|
|
2
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import { Flexbox, Text, createStaticStyles, cssVar, cx } from '@lobehub/ui';
|
|
4
|
-
import ChartTooltipFrame from "./ChartTooltipFrame";
|
|
5
|
-
import ChartTooltipRow from "./ChartTooltipRow";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
var styles = createStaticStyles(function (_ref) {
|
|
9
|
-
var css = _ref.css,
|
|
10
|
-
cssVar = _ref.cssVar;
|
|
11
|
-
return {
|
|
12
|
-
header: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border-bottom: 1px solid ", ";\n font-weight: 500;\n "])), cssVar.colorBorderSecondary)
|
|
13
|
-
};
|
|
14
|
-
});
|
|
15
|
-
var ChartTooltip = function ChartTooltip(_ref2) {
|
|
16
|
-
var active = _ref2.active,
|
|
17
|
-
payload = _ref2.payload,
|
|
18
|
-
label = _ref2.label,
|
|
19
|
-
categoryColors = _ref2.categoryColors,
|
|
20
|
-
valueFormatter = _ref2.valueFormatter,
|
|
21
|
-
customCategories = _ref2.customCategories,
|
|
22
|
-
footer = _ref2.footer;
|
|
23
|
-
if (active && payload) {
|
|
24
|
-
var filteredPayload = payload.filter(function (item) {
|
|
25
|
-
return item.type !== 'none';
|
|
26
|
-
});
|
|
27
|
-
return /*#__PURE__*/_jsxs(ChartTooltipFrame, {
|
|
28
|
-
children: [/*#__PURE__*/_jsx(Flexbox, {
|
|
29
|
-
className: cx(styles.header),
|
|
30
|
-
paddingBlock: 8,
|
|
31
|
-
paddingInline: 16,
|
|
32
|
-
width: 'auto',
|
|
33
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
34
|
-
ellipsis: true,
|
|
35
|
-
style: {
|
|
36
|
-
margin: 0
|
|
37
|
-
},
|
|
38
|
-
children: label
|
|
39
|
-
})
|
|
40
|
-
}), /*#__PURE__*/_jsx(Flexbox, {
|
|
41
|
-
gap: 4,
|
|
42
|
-
paddingBlock: 8,
|
|
43
|
-
paddingInline: 16,
|
|
44
|
-
style: {
|
|
45
|
-
flexDirection: 'column-reverse',
|
|
46
|
-
marginTop: 4
|
|
47
|
-
},
|
|
48
|
-
width: 'auto',
|
|
49
|
-
children: filteredPayload.map(function (_ref3, idx) {
|
|
50
|
-
var _categoryColors$get;
|
|
51
|
-
var value = _ref3.value,
|
|
52
|
-
name = _ref3.name;
|
|
53
|
-
return /*#__PURE__*/_jsx(ChartTooltipRow, {
|
|
54
|
-
color: (_categoryColors$get = categoryColors.get(name)) !== null && _categoryColors$get !== void 0 ? _categoryColors$get : cssVar.colorPrimary,
|
|
55
|
-
name: (customCategories === null || customCategories === void 0 ? void 0 : customCategories[name]) || name,
|
|
56
|
-
value: valueFormatter(value, name)
|
|
57
|
-
}, "id-".concat(idx));
|
|
58
|
-
})
|
|
59
|
-
}), footer]
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
};
|
|
64
|
-
export default ChartTooltip;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NameType, Payload } from 'recharts/types/component/DefaultTooltipContent';
|
|
2
|
-
import { ScatterChartValueFormatter } from "../ScatterChart";
|
|
3
|
-
import { ValueFormatter } from "../types/charts";
|
|
4
|
-
export type CustomTooltipProps = {
|
|
5
|
-
active: boolean | undefined;
|
|
6
|
-
customCategories?: {
|
|
7
|
-
[key: string]: string;
|
|
8
|
-
};
|
|
9
|
-
label: NameType | undefined;
|
|
10
|
-
payload: Payload<string | number | (string | number)[], string | number>[] | undefined;
|
|
11
|
-
valueFormatter: ValueFormatter | ScatterChartValueFormatter;
|
|
12
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ValueFormatter } from "../types/charts";
|
|
3
|
-
interface CustomYAxisTickProps {
|
|
4
|
-
align: 'left' | 'right';
|
|
5
|
-
anchor?: 'end' | 'middle' | 'start';
|
|
6
|
-
formatter: ValueFormatter;
|
|
7
|
-
payload: {
|
|
8
|
-
value: number;
|
|
9
|
-
};
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
yAxisLabel?: boolean;
|
|
13
|
-
}
|
|
14
|
-
declare const CustomYAxisTick: React.NamedExoticComponent<CustomYAxisTickProps>;
|
|
15
|
-
export default CustomYAxisTick;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { cssVar } from '@lobehub/ui';
|
|
2
|
-
import React, { memo } from 'react';
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
var CustomYAxisTick = /*#__PURE__*/memo(function (_ref) {
|
|
5
|
-
var yAxisLabel = _ref.yAxisLabel,
|
|
6
|
-
x = _ref.x,
|
|
7
|
-
y = _ref.y,
|
|
8
|
-
payload = _ref.payload,
|
|
9
|
-
align = _ref.align,
|
|
10
|
-
formatter = _ref.formatter,
|
|
11
|
-
anchor = _ref.anchor;
|
|
12
|
-
var yAxisLabelWidth = yAxisLabel ? 24 : 0;
|
|
13
|
-
var resolvedTextAnchor = anchor !== null && anchor !== void 0 ? anchor : align === 'left' ? 'start' : 'end';
|
|
14
|
-
return /*#__PURE__*/_jsx("g", {
|
|
15
|
-
transform: "translate(".concat(align === 'left' ? yAxisLabelWidth : x + yAxisLabelWidth, ",").concat(y, ")"),
|
|
16
|
-
children: /*#__PURE__*/_jsx("text", {
|
|
17
|
-
dy: 4,
|
|
18
|
-
fill: cssVar.colorTextDescription,
|
|
19
|
-
fontSize: 12,
|
|
20
|
-
textAnchor: resolvedTextAnchor,
|
|
21
|
-
x: 0,
|
|
22
|
-
y: 0,
|
|
23
|
-
children: formatter(payload.value)
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
export default CustomYAxisTick;
|
package/es/common/NoData.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface NoDataProps {
|
|
3
|
-
className?: string;
|
|
4
|
-
noDataText?: ReactNode | {
|
|
5
|
-
desc: ReactNode;
|
|
6
|
-
title: ReactNode;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
declare const NoData: import("react").NamedExoticComponent<NoDataProps>;
|
|
10
|
-
export default NoData;
|
package/es/common/NoData.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Center, Empty } from '@lobehub/ui';
|
|
2
|
-
import { Inbox } from 'lucide-react';
|
|
3
|
-
import { isValidElement, memo } from 'react';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
var NoData = /*#__PURE__*/memo(function (_ref) {
|
|
6
|
-
var _ref$noDataText = _ref.noDataText,
|
|
7
|
-
noDataText = _ref$noDataText === void 0 ? {
|
|
8
|
-
desc: "There's no data available for your selection.",
|
|
9
|
-
title: 'No Data'
|
|
10
|
-
} : _ref$noDataText,
|
|
11
|
-
className = _ref.className;
|
|
12
|
-
var isReactNodeText = /*#__PURE__*/isValidElement(noDataText);
|
|
13
|
-
return /*#__PURE__*/_jsx(Center, {
|
|
14
|
-
height: '100%',
|
|
15
|
-
width: '100%',
|
|
16
|
-
children: /*#__PURE__*/_jsx(Empty, {
|
|
17
|
-
className: className,
|
|
18
|
-
description: isReactNodeText ? noDataText : noDataText === null || noDataText === void 0 ? void 0 : noDataText.desc,
|
|
19
|
-
icon: Inbox,
|
|
20
|
-
title: isReactNodeText ? undefined : noDataText === null || noDataText === void 0 ? void 0 : noDataText.title
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
export default NoData;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export type { BenchmarkBaseProps, BenchmarkEventProps, BenchmarkFieldKeys, BenchmarkPointShape, BenchmarkRecord, BenchmarkRenderIcon, NormalizedBenchmarkItem, } from './types';
|
|
2
|
-
export { DEFAULT_BENCHMARK_KEYS, defaultBenchmarkAccuracyFormatter, defaultBenchmarkErrorFormatter, defaultBenchmarkValueFormatter, formatBenchmarkAccuracyDisplay, getBenchmarkBarPercent, getBenchmarkIcon, getBenchmarkLabelMetrics, getBenchmarkMaxValue, normalizeBenchmarkData, resolveBenchmarkKeys, splitBenchmarkLabel, } from './utils';
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import type { NoDataProps } from "../NoData";
|
|
3
|
-
import type { ValueFormatter } from "../../types/charts";
|
|
4
|
-
export interface BenchmarkRecord {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
color?: string;
|
|
7
|
-
error?: number;
|
|
8
|
-
highlighted?: boolean;
|
|
9
|
-
href?: string;
|
|
10
|
-
icon?: ReactNode;
|
|
11
|
-
key?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Secondary line-series value (e.g. Pass¹ overall rate)
|
|
14
|
-
*/
|
|
15
|
-
line?: number;
|
|
16
|
-
name?: ReactNode;
|
|
17
|
-
provider?: ReactNode;
|
|
18
|
-
rank?: number;
|
|
19
|
-
score?: number;
|
|
20
|
-
/**
|
|
21
|
-
* Marker shape used by scatter-style charts when no icon is provided
|
|
22
|
-
*/
|
|
23
|
-
shape?: BenchmarkPointShape;
|
|
24
|
-
target?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Place item after a visual separator; line series does not connect into it
|
|
27
|
-
*/
|
|
28
|
-
unranked?: boolean;
|
|
29
|
-
}
|
|
30
|
-
export type BenchmarkPointShape = 'circle' | 'square' | 'diamond' | 'triangle';
|
|
31
|
-
export type BenchmarkRenderIcon = (record: BenchmarkRecord, index: number) => ReactNode;
|
|
32
|
-
export type BenchmarkEventProps = (BenchmarkRecord & {
|
|
33
|
-
eventType: 'bar' | 'row' | 'point';
|
|
34
|
-
value: number;
|
|
35
|
-
}) | null | undefined;
|
|
36
|
-
export interface BenchmarkFieldKeys {
|
|
37
|
-
/**
|
|
38
|
-
* Per-item bar color field
|
|
39
|
-
* @default 'color'
|
|
40
|
-
*/
|
|
41
|
-
colorKey?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Error / uncertainty field (AccuracyBar-style ± display)
|
|
44
|
-
* @default 'error'
|
|
45
|
-
*/
|
|
46
|
-
errorKey?: string;
|
|
47
|
-
/**
|
|
48
|
-
* Icon field; value should be a ReactNode provided by the consumer
|
|
49
|
-
* @default 'icon'
|
|
50
|
-
*/
|
|
51
|
-
iconKey?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Model / entry name field
|
|
54
|
-
* @default 'name'
|
|
55
|
-
*/
|
|
56
|
-
index?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Secondary line-series field
|
|
59
|
-
* @default 'line'
|
|
60
|
-
*/
|
|
61
|
-
lineKey?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Provider / organization field
|
|
64
|
-
* @default 'provider'
|
|
65
|
-
*/
|
|
66
|
-
providerKey?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Numeric score field
|
|
69
|
-
* @default 'score'
|
|
70
|
-
*/
|
|
71
|
-
valueKey?: string;
|
|
72
|
-
}
|
|
73
|
-
export interface BenchmarkBaseProps extends BenchmarkFieldKeys, Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
74
|
-
/**
|
|
75
|
-
* Accuracy-style value formatter (e.g. `52.0%`). Falls back to `valueFormatter`.
|
|
76
|
-
*/
|
|
77
|
-
accuracyFormatter?: (value: number) => string;
|
|
78
|
-
data?: BenchmarkRecord[];
|
|
79
|
-
/**
|
|
80
|
-
* Formats the ± error segment
|
|
81
|
-
* @default (n) => n.toFixed(1)
|
|
82
|
-
*/
|
|
83
|
-
errorFormatter?: (value: number) => string;
|
|
84
|
-
height?: string | number;
|
|
85
|
-
/**
|
|
86
|
-
* Text accent color when an item has `highlighted: true` (does not change bar fill)
|
|
87
|
-
* @default theme.gold
|
|
88
|
-
*/
|
|
89
|
-
highlightColor?: string;
|
|
90
|
-
loading?: boolean;
|
|
91
|
-
noDataText?: NoDataProps['noDataText'];
|
|
92
|
-
onValueChange?: (value: BenchmarkEventProps) => void;
|
|
93
|
-
/**
|
|
94
|
-
* Optional icon renderer that overrides `iconKey`
|
|
95
|
-
*/
|
|
96
|
-
renderIcon?: BenchmarkRenderIcon;
|
|
97
|
-
showAnimation?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Show AccuracyBar-style ± error next to values / error bars
|
|
100
|
-
* @default true
|
|
101
|
-
*/
|
|
102
|
-
showError?: boolean;
|
|
103
|
-
sortOrder?: 'ascending' | 'descending' | 'none';
|
|
104
|
-
valueFormatter?: ValueFormatter;
|
|
105
|
-
width?: string | number;
|
|
106
|
-
}
|
|
107
|
-
export interface NormalizedBenchmarkItem {
|
|
108
|
-
color?: string;
|
|
109
|
-
error?: number;
|
|
110
|
-
highlighted?: boolean;
|
|
111
|
-
href?: string;
|
|
112
|
-
icon?: ReactNode;
|
|
113
|
-
key: string | number;
|
|
114
|
-
lineValue?: number;
|
|
115
|
-
name: ReactNode;
|
|
116
|
-
original: BenchmarkRecord;
|
|
117
|
-
provider?: ReactNode;
|
|
118
|
-
rank: number;
|
|
119
|
-
target?: string;
|
|
120
|
-
unranked?: boolean;
|
|
121
|
-
value: number;
|
|
122
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
-
import { getTextWidth } from "../../utils/getMaxLabelLength";
|
|
8
|
-
export var DEFAULT_BENCHMARK_KEYS = {
|
|
9
|
-
colorKey: 'color',
|
|
10
|
-
errorKey: 'error',
|
|
11
|
-
iconKey: 'icon',
|
|
12
|
-
index: 'name',
|
|
13
|
-
lineKey: 'line',
|
|
14
|
-
providerKey: 'provider',
|
|
15
|
-
valueKey: 'score'
|
|
16
|
-
};
|
|
17
|
-
export var resolveBenchmarkKeys = function resolveBenchmarkKeys() {
|
|
18
|
-
var _keys$colorKey, _keys$errorKey, _keys$iconKey, _keys$index, _keys$lineKey, _keys$providerKey, _keys$valueKey;
|
|
19
|
-
var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20
|
-
return {
|
|
21
|
-
colorKey: (_keys$colorKey = keys.colorKey) !== null && _keys$colorKey !== void 0 ? _keys$colorKey : DEFAULT_BENCHMARK_KEYS.colorKey,
|
|
22
|
-
errorKey: (_keys$errorKey = keys.errorKey) !== null && _keys$errorKey !== void 0 ? _keys$errorKey : DEFAULT_BENCHMARK_KEYS.errorKey,
|
|
23
|
-
iconKey: (_keys$iconKey = keys.iconKey) !== null && _keys$iconKey !== void 0 ? _keys$iconKey : DEFAULT_BENCHMARK_KEYS.iconKey,
|
|
24
|
-
index: (_keys$index = keys.index) !== null && _keys$index !== void 0 ? _keys$index : DEFAULT_BENCHMARK_KEYS.index,
|
|
25
|
-
lineKey: (_keys$lineKey = keys.lineKey) !== null && _keys$lineKey !== void 0 ? _keys$lineKey : DEFAULT_BENCHMARK_KEYS.lineKey,
|
|
26
|
-
providerKey: (_keys$providerKey = keys.providerKey) !== null && _keys$providerKey !== void 0 ? _keys$providerKey : DEFAULT_BENCHMARK_KEYS.providerKey,
|
|
27
|
-
valueKey: (_keys$valueKey = keys.valueKey) !== null && _keys$valueKey !== void 0 ? _keys$valueKey : DEFAULT_BENCHMARK_KEYS.valueKey
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export var getBenchmarkIcon = function getBenchmarkIcon(record, iconKey, renderIcon) {
|
|
31
|
-
var index = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
32
|
-
if (renderIcon) return renderIcon(record, index);
|
|
33
|
-
return record[iconKey];
|
|
34
|
-
};
|
|
35
|
-
export var normalizeBenchmarkData = function normalizeBenchmarkData(_ref) {
|
|
36
|
-
var colorKey = _ref.colorKey,
|
|
37
|
-
data = _ref.data,
|
|
38
|
-
errorKey = _ref.errorKey,
|
|
39
|
-
iconKey = _ref.iconKey,
|
|
40
|
-
index = _ref.index,
|
|
41
|
-
lineKey = _ref.lineKey,
|
|
42
|
-
providerKey = _ref.providerKey,
|
|
43
|
-
renderIcon = _ref.renderIcon,
|
|
44
|
-
_ref$sortOrder = _ref.sortOrder,
|
|
45
|
-
sortOrder = _ref$sortOrder === void 0 ? 'descending' : _ref$sortOrder,
|
|
46
|
-
valueKey = _ref.valueKey;
|
|
47
|
-
var keys = resolveBenchmarkKeys({
|
|
48
|
-
colorKey: colorKey,
|
|
49
|
-
errorKey: errorKey,
|
|
50
|
-
iconKey: iconKey,
|
|
51
|
-
index: index,
|
|
52
|
-
lineKey: lineKey,
|
|
53
|
-
providerKey: providerKey,
|
|
54
|
-
valueKey: valueKey
|
|
55
|
-
});
|
|
56
|
-
var sorted = sortOrder === 'none' ? _toConsumableArray(data) : _toConsumableArray(data).sort(function (a, b) {
|
|
57
|
-
var _a$keys$valueKey, _b$keys$valueKey;
|
|
58
|
-
var aUnranked = Boolean(a.unranked);
|
|
59
|
-
var bUnranked = Boolean(b.unranked);
|
|
60
|
-
if (aUnranked !== bUnranked) return aUnranked ? 1 : -1;
|
|
61
|
-
var aValue = Number((_a$keys$valueKey = a[keys.valueKey]) !== null && _a$keys$valueKey !== void 0 ? _a$keys$valueKey : 0);
|
|
62
|
-
var bValue = Number((_b$keys$valueKey = b[keys.valueKey]) !== null && _b$keys$valueKey !== void 0 ? _b$keys$valueKey : 0);
|
|
63
|
-
return sortOrder === 'ascending' ? aValue - bValue : bValue - aValue;
|
|
64
|
-
});
|
|
65
|
-
return sorted.map(function (record, idx) {
|
|
66
|
-
var _ref2, _record$keys$index, _record$keys$valueKey, _record$keys$lineKey, _record$keys$colorKey, _record$key, _record$keys$provider;
|
|
67
|
-
var name = (_ref2 = (_record$keys$index = record[keys.index]) !== null && _record$keys$index !== void 0 ? _record$keys$index : record.name) !== null && _ref2 !== void 0 ? _ref2 : '';
|
|
68
|
-
var value = Number((_record$keys$valueKey = record[keys.valueKey]) !== null && _record$keys$valueKey !== void 0 ? _record$keys$valueKey : 0);
|
|
69
|
-
var rank = typeof record.rank === 'number' ? record.rank : idx + 1;
|
|
70
|
-
var rawError = record[keys.errorKey];
|
|
71
|
-
var error = rawError === undefined || rawError === null || rawError === '' ? undefined : Number(rawError);
|
|
72
|
-
var rawLine = (_record$keys$lineKey = record[keys.lineKey]) !== null && _record$keys$lineKey !== void 0 ? _record$keys$lineKey : record.line;
|
|
73
|
-
var lineValue = rawLine === undefined || rawLine === null || rawLine === '' ? undefined : Number(rawLine);
|
|
74
|
-
return {
|
|
75
|
-
color: (_record$keys$colorKey = record[keys.colorKey]) !== null && _record$keys$colorKey !== void 0 ? _record$keys$colorKey : record.color,
|
|
76
|
-
error: Number.isFinite(error) ? error : undefined,
|
|
77
|
-
highlighted: Boolean(record.highlighted),
|
|
78
|
-
href: record.href,
|
|
79
|
-
icon: getBenchmarkIcon(record, keys.iconKey, renderIcon, idx),
|
|
80
|
-
key: (_record$key = record.key) !== null && _record$key !== void 0 ? _record$key : name === '' || name === undefined || name === null ? idx : String(name),
|
|
81
|
-
lineValue: Number.isFinite(lineValue) ? lineValue : undefined,
|
|
82
|
-
name: name,
|
|
83
|
-
original: record,
|
|
84
|
-
provider: (_record$keys$provider = record[keys.providerKey]) !== null && _record$keys$provider !== void 0 ? _record$keys$provider : record.provider,
|
|
85
|
-
rank: rank,
|
|
86
|
-
target: record.target,
|
|
87
|
-
unranked: Boolean(record.unranked),
|
|
88
|
-
value: value
|
|
89
|
-
};
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
export var getBenchmarkMaxValue = function getBenchmarkMaxValue(items, maxValue) {
|
|
93
|
-
if (typeof maxValue === 'number') return maxValue;
|
|
94
|
-
return Math.max.apply(Math, _toConsumableArray(items.flatMap(function (item) {
|
|
95
|
-
var _item$lineValue;
|
|
96
|
-
return [item.value, (_item$lineValue = item.lineValue) !== null && _item$lineValue !== void 0 ? _item$lineValue : 0];
|
|
97
|
-
})).concat([0]));
|
|
98
|
-
};
|
|
99
|
-
export var getBenchmarkBarPercent = function getBenchmarkBarPercent(value, maxValue) {
|
|
100
|
-
var minPercent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
|
|
101
|
-
if (maxValue <= 0 || value <= 0) return 0;
|
|
102
|
-
return Math.max(value / maxValue * 100, minPercent);
|
|
103
|
-
};
|
|
104
|
-
export var defaultBenchmarkValueFormatter = function defaultBenchmarkValueFormatter(value) {
|
|
105
|
-
if (Number.isInteger(value)) return String(value);
|
|
106
|
-
return value.toFixed(1);
|
|
107
|
-
};
|
|
108
|
-
export var defaultBenchmarkAccuracyFormatter = function defaultBenchmarkAccuracyFormatter(value) {
|
|
109
|
-
return "".concat(value.toFixed(1), "%");
|
|
110
|
-
};
|
|
111
|
-
export var defaultBenchmarkErrorFormatter = function defaultBenchmarkErrorFormatter(value) {
|
|
112
|
-
return value.toFixed(1);
|
|
113
|
-
};
|
|
114
|
-
export var formatBenchmarkAccuracyDisplay = function formatBenchmarkAccuracyDisplay(_ref3) {
|
|
115
|
-
var accuracyFormatter = _ref3.accuracyFormatter,
|
|
116
|
-
error = _ref3.error,
|
|
117
|
-
_ref3$errorFormatter = _ref3.errorFormatter,
|
|
118
|
-
errorFormatter = _ref3$errorFormatter === void 0 ? defaultBenchmarkErrorFormatter : _ref3$errorFormatter,
|
|
119
|
-
_ref3$showError = _ref3.showError,
|
|
120
|
-
showError = _ref3$showError === void 0 ? true : _ref3$showError,
|
|
121
|
-
value = _ref3.value,
|
|
122
|
-
_ref3$valueFormatter = _ref3.valueFormatter,
|
|
123
|
-
valueFormatter = _ref3$valueFormatter === void 0 ? defaultBenchmarkValueFormatter : _ref3$valueFormatter;
|
|
124
|
-
var formatValue = accuracyFormatter !== null && accuracyFormatter !== void 0 ? accuracyFormatter : valueFormatter;
|
|
125
|
-
var main = formatValue(value);
|
|
126
|
-
if (!showError || error === undefined || error === null || Number.isNaN(error)) {
|
|
127
|
-
return {
|
|
128
|
-
errorText: undefined,
|
|
129
|
-
main: main,
|
|
130
|
-
text: main
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
var errorText = errorFormatter(error);
|
|
134
|
-
return {
|
|
135
|
-
errorText: errorText,
|
|
136
|
-
main: main,
|
|
137
|
-
text: "".concat(main, " \xB1 ").concat(errorText)
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Split a label into lines. Supports `\n` / `\r\n`.
|
|
143
|
-
*/
|
|
144
|
-
export var splitBenchmarkLabel = function splitBenchmarkLabel(label) {
|
|
145
|
-
var text = String(label !== null && label !== void 0 ? label : '');
|
|
146
|
-
if (!text) return [''];
|
|
147
|
-
return text.split(/\r?\n/);
|
|
148
|
-
};
|
|
149
|
-
export var getBenchmarkLabelMetrics = function getBenchmarkLabelMetrics(label) {
|
|
150
|
-
var lines = splitBenchmarkLabel(label);
|
|
151
|
-
var longestWidth = lines.reduce(function (max, line) {
|
|
152
|
-
return Math.max(max, getTextWidth(line));
|
|
153
|
-
}, 0);
|
|
154
|
-
return {
|
|
155
|
-
lineCount: Math.max(lines.length, 1),
|
|
156
|
-
lines: lines,
|
|
157
|
-
longestWidth: longestWidth
|
|
158
|
-
};
|
|
159
|
-
};
|