@lobehub/charts 5.7.2 → 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.
Files changed (107) hide show
  1. package/README.md +3 -3
  2. package/es/AccuracyBarChart/index.mjs +1 -3
  3. package/es/AccuracyBarChart/index.mjs.map +1 -1
  4. package/es/AccuracyBarChart/styles.mjs +1 -1
  5. package/es/AccuracyBarChart/styles.mjs.map +1 -1
  6. package/es/AreaChart/index.mjs +1 -3
  7. package/es/AreaChart/index.mjs.map +1 -1
  8. package/es/AreaChart/styles.mjs +1 -1
  9. package/es/AreaChart/styles.mjs.map +1 -1
  10. package/es/BarChart/index.mjs +1 -3
  11. package/es/BarChart/index.mjs.map +1 -1
  12. package/es/BarChart/styles.mjs +1 -1
  13. package/es/BarChart/styles.mjs.map +1 -1
  14. package/es/BarList/index.mjs +1 -3
  15. package/es/BarList/index.mjs.map +1 -1
  16. package/es/BarList/styles.mjs +1 -1
  17. package/es/BarList/styles.mjs.map +1 -1
  18. package/es/BenchmarkColumnChart/index.mjs +1 -3
  19. package/es/BenchmarkColumnChart/index.mjs.map +1 -1
  20. package/es/BenchmarkColumnChart/styles.mjs +1 -1
  21. package/es/BenchmarkColumnChart/styles.mjs.map +1 -1
  22. package/es/BenchmarkRankingChart/index.mjs +1 -3
  23. package/es/BenchmarkRankingChart/index.mjs.map +1 -1
  24. package/es/BenchmarkRankingChart/styles.mjs +1 -1
  25. package/es/BenchmarkRankingChart/styles.mjs.map +1 -1
  26. package/es/BenchmarkScatterChart/index.mjs +1 -3
  27. package/es/BenchmarkScatterChart/index.mjs.map +1 -1
  28. package/es/BenchmarkScatterChart/styles.mjs +1 -1
  29. package/es/BenchmarkScatterChart/styles.mjs.map +1 -1
  30. package/es/ComposedChart/index.mjs +1 -3
  31. package/es/ComposedChart/index.mjs.map +1 -1
  32. package/es/ComposedChart/styles.mjs +1 -1
  33. package/es/ComposedChart/styles.mjs.map +1 -1
  34. package/es/DataBars/CategoryBar.mjs +1 -3
  35. package/es/DataBars/CategoryBar.mjs.map +1 -1
  36. package/es/DataBars/DeltaBar.mjs +1 -3
  37. package/es/DataBars/DeltaBar.mjs.map +1 -1
  38. package/es/DataBars/MarkerBar.mjs +1 -3
  39. package/es/DataBars/MarkerBar.mjs.map +1 -1
  40. package/es/DataBars/ProgressBar.mjs +1 -3
  41. package/es/DataBars/ProgressBar.mjs.map +1 -1
  42. package/es/DataBars/styles.mjs +1 -1
  43. package/es/DataBars/styles.mjs.map +1 -1
  44. package/es/DonutChart/index.mjs +1 -3
  45. package/es/DonutChart/index.mjs.map +1 -1
  46. package/es/DonutChart/styles.mjs +1 -1
  47. package/es/DonutChart/styles.mjs.map +1 -1
  48. package/es/FunnelChart/index.mjs +1 -3
  49. package/es/FunnelChart/index.mjs.map +1 -1
  50. package/es/FunnelChart/styles.mjs +1 -1
  51. package/es/FunnelChart/styles.mjs.map +1 -1
  52. package/es/Heatmaps/Calendar.mjs +1 -2
  53. package/es/Heatmaps/Calendar.mjs.map +1 -1
  54. package/es/Heatmaps/ChartLabels.mjs +1 -1
  55. package/es/Heatmaps/ChartLabels.mjs.map +1 -1
  56. package/es/Heatmaps/Footer.mjs +1 -1
  57. package/es/Heatmaps/Footer.mjs.map +1 -1
  58. package/es/Heatmaps/index.mjs +1 -3
  59. package/es/Heatmaps/index.mjs.map +1 -1
  60. package/es/Heatmaps/styles.mjs +1 -1
  61. package/es/Heatmaps/styles.mjs.map +1 -1
  62. package/es/Legend/LegendItem.mjs +1 -3
  63. package/es/Legend/LegendItem.mjs.map +1 -1
  64. package/es/Legend/ScrollButton.mjs +1 -2
  65. package/es/Legend/ScrollButton.mjs.map +1 -1
  66. package/es/Legend/index.mjs +1 -2
  67. package/es/Legend/index.mjs.map +1 -1
  68. package/es/LineChart/index.mjs +1 -3
  69. package/es/LineChart/index.mjs.map +1 -1
  70. package/es/LineChart/styles.mjs +1 -1
  71. package/es/LineChart/styles.mjs.map +1 -1
  72. package/es/RadarChart/index.mjs +1 -3
  73. package/es/RadarChart/index.mjs.map +1 -1
  74. package/es/RadarChart/styles.mjs +1 -1
  75. package/es/RadarChart/styles.mjs.map +1 -1
  76. package/es/ScatterChart/ScatterChartTooltip.mjs +1 -3
  77. package/es/ScatterChart/ScatterChartTooltip.mjs.map +1 -1
  78. package/es/ScatterChart/ScatterChartTooltipRow.mjs +1 -3
  79. package/es/ScatterChart/ScatterChartTooltipRow.mjs.map +1 -1
  80. package/es/ScatterChart/index.mjs +1 -3
  81. package/es/ScatterChart/index.mjs.map +1 -1
  82. package/es/ScatterChart/styles.mjs +1 -1
  83. package/es/ScatterChart/styles.mjs.map +1 -1
  84. package/es/SparkChart/SparkAreaChart.mjs +1 -3
  85. package/es/SparkChart/SparkAreaChart.mjs.map +1 -1
  86. package/es/SparkChart/SparkBarChart.mjs +1 -3
  87. package/es/SparkChart/SparkBarChart.mjs.map +1 -1
  88. package/es/SparkChart/SparkLineChart.mjs +1 -3
  89. package/es/SparkChart/SparkLineChart.mjs.map +1 -1
  90. package/es/Tracker/TrackerBlock.mjs +1 -3
  91. package/es/Tracker/TrackerBlock.mjs.map +1 -1
  92. package/es/Tracker/index.mjs +1 -3
  93. package/es/Tracker/index.mjs.map +1 -1
  94. package/es/Tracker/styles.mjs +1 -1
  95. package/es/Tracker/styles.mjs.map +1 -1
  96. package/es/common/ChartTooltip/ChartTooltipFrame.mjs +1 -2
  97. package/es/common/ChartTooltip/ChartTooltipFrame.mjs.map +1 -1
  98. package/es/common/ChartTooltip/ChartTooltipRow.mjs +1 -3
  99. package/es/common/ChartTooltip/ChartTooltipRow.mjs.map +1 -1
  100. package/es/common/ChartTooltip/index.mjs +1 -3
  101. package/es/common/ChartTooltip/index.mjs.map +1 -1
  102. package/es/common/CustomYAxisTick.mjs +1 -1
  103. package/es/common/CustomYAxisTick.mjs.map +1 -1
  104. package/es/hooks/useThemeColorRange.d.mts +1 -1
  105. package/es/hooks/useThemeColorRange.mjs +1 -1
  106. package/es/hooks/useThemeColorRange.mjs.map +1 -1
  107. package/package.json +6 -9
@@ -8,9 +8,7 @@ import NoData from "../common/NoData.mjs";
8
8
  import { constructCategoryColors, getYAxisDomain, hasOnlyOneValueForThisKey } from "../common/utils.mjs";
9
9
  import { getMaxLabelLength } from "../utils/getMaxLabelLength.mjs";
10
10
  import { styles } from "./styles.mjs";
11
- import { Flexbox } from "@lobehub/ui";
12
- import { Skeleton } from "@lobehub/ui/base-ui";
13
- import { css, cssVar, cx } from "antd-style";
11
+ import { Flexbox, Skeleton, css, cssVar, cx } from "@lobehub/ui";
14
12
  import { Fragment, forwardRef, useMemo, useState } from "react";
15
13
  import { CartesianGrid, Dot, Label, Legend, Line, LineChart as LineChart$1, ResponsiveContainer, Tooltip as Tooltip$1, XAxis, YAxis } from "recharts";
16
14
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["ReChartsLineChart","Tooltip"],"sources":["../../src/LineChart/index.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox } from '@lobehub/ui';\nimport { Skeleton } from '@lobehub/ui/base-ui';\nimport { css, cssVar, cx } from 'antd-style';\nimport { Fragment, MouseEvent, forwardRef, useMemo, useState } from 'react';\nimport {\n CartesianGrid,\n Dot,\n Label,\n Legend,\n Line,\n LineChart as ReChartsLineChart,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseChartProps from '@/common/BaseChartProps';\nimport ChartLegend from '@/common/ChartLegend';\nimport ChartTooltip from '@/common/ChartTooltip';\nimport CustomYAxisTick from '@/common/CustomYAxisTick';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain, hasOnlyOneValueForThisKey } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport { CurveType } from '@/types/charts';\nimport { defaultValueFormatter } from '@/utils';\nimport { getMaxLabelLength } from '@/utils/getMaxLabelLength';\n\nimport { styles } from './styles';\n\nexport interface LineChartProps extends BaseChartProps {\n connectNulls?: boolean;\n curveType?: CurveType;\n}\n\ninterface ActiveDot {\n dataKey?: string;\n index?: number;\n}\n\nconst LineChart = forwardRef<HTMLDivElement, LineChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n categories = [],\n index,\n colors = themeColorRange,\n valueFormatter = defaultValueFormatter,\n xAxisLabelFormatter = defaultValueFormatter,\n startEndOnly = false,\n showXAxis = true,\n showYAxis = true,\n yAxisWidth,\n intervalType = 'equidistantPreserveStart',\n animationDuration = 900,\n showAnimation = false,\n yAxisAlign = 'left',\n showTooltip = true,\n showLegend = true,\n showGridLines = true,\n autoMinValue = false,\n curveType = 'linear',\n minValue,\n maxValue,\n connectNulls = false,\n allowDecimals = true,\n noDataText,\n className,\n onValueChange,\n enableLegendSlider = false,\n customTooltip,\n rotateLabelX,\n tickGap = 5,\n xAxisLabel,\n yAxisLabel,\n yAxisDomain: yAxisDomainOverride,\n width = '100%',\n height = 280,\n style,\n customCategories,\n loading,\n ...rest\n } = props;\n const [legendHeight, setLegendHeight] = useState(60);\n const [activeDot, setActiveDot] = useState<ActiveDot | undefined>();\n const [activeLegend, setActiveLegend] = useState<string | undefined>();\n const calculatedYAxisWidth: number | string = useMemo(() => {\n if (yAxisWidth) return yAxisWidth;\n return getMaxLabelLength({ data, index, margin: 16, valueFormatter });\n }, [yAxisWidth, data, valueFormatter, index]);\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const CustomTooltip = customTooltip;\n const paddingValue = !showXAxis && !showYAxis ? 0 : 20;\n const categoryColors = constructCategoryColors(categories, colors);\n const yAxisDomain = (yAxisDomainOverride ??\n getYAxisDomain(autoMinValue, minValue, maxValue)) as AxisDomain;\n const hasOnValueChange = !!onValueChange;\n\n const onDotClick = (itemData: any, event: MouseEvent) => {\n event.stopPropagation();\n\n if (!hasOnValueChange) return;\n if (\n (itemData.index === activeDot?.index && itemData.dataKey === activeDot?.dataKey) ||\n (hasOnlyOneValueForThisKey(data, itemData.dataKey) &&\n activeLegend &&\n activeLegend === itemData.dataKey)\n ) {\n setActiveLegend(undefined);\n setActiveDot(undefined);\n onValueChange?.(null);\n } else {\n setActiveLegend(itemData.dataKey);\n setActiveDot({\n dataKey: itemData.dataKey,\n index: itemData.index,\n });\n onValueChange?.({\n categoryClicked: itemData.dataKey,\n eventType: 'dot',\n ...itemData.payload,\n });\n }\n };\n\n const onCategoryClick = (dataKey: string) => {\n if (!hasOnValueChange) return;\n if (\n (dataKey === activeLegend && !activeDot) ||\n (hasOnlyOneValueForThisKey(data, dataKey) && activeDot && activeDot.dataKey === dataKey)\n ) {\n setActiveLegend(undefined);\n onValueChange?.(null);\n } else {\n setActiveLegend(dataKey);\n onValueChange?.({\n categoryClicked: dataKey,\n eventType: 'category',\n });\n }\n setActiveDot(undefined);\n };\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsLineChart\n data={data}\n margin={{\n bottom: xAxisLabel ? 30 : undefined,\n left: yAxisLabel ? 20 : undefined,\n right: yAxisLabel ? 5 : undefined,\n top: 5,\n }}\n onClick={\n hasOnValueChange && (activeLegend || activeDot)\n ? () => {\n setActiveDot(undefined);\n setActiveLegend(undefined);\n onValueChange?.(null);\n }\n : undefined\n }\n >\n {showGridLines ? (\n <CartesianGrid className={styles.gridLines} horizontal={true} vertical={false} />\n ) : undefined}\n <XAxis\n angle={rotateLabelX?.angle}\n axisLine={false}\n className={styles.label}\n dataKey={index}\n dy={rotateLabelX?.verticalShift}\n fill=\"\"\n hide={!showXAxis}\n interval={startEndOnly ? 'preserveStartEnd' : intervalType}\n minTickGap={tickGap}\n padding={{ left: paddingValue, right: paddingValue }}\n stroke=\"\"\n tick={{ transform: 'translate(0, 6)' }}\n tickFormatter={xAxisLabelFormatter}\n tickLine={false}\n ticks={startEndOnly ? [data[0][index], data.at(-1)[index]] : undefined}\n >\n {xAxisLabel && (\n <Label\n className={cx(styles.strongLabel, styles.emphasis)}\n offset={-20}\n position=\"insideBottom\"\n >\n {xAxisLabel}\n </Label>\n )}\n </XAxis>\n <YAxis\n allowDecimals={allowDecimals}\n axisLine={false}\n className={styles.label}\n domain={yAxisDomain as AxisDomain}\n fill=\"\"\n hide={!showYAxis}\n stroke=\"\"\n tick={(props) => (\n <CustomYAxisTick\n {...props}\n align={yAxisAlign}\n formatter={valueFormatter}\n textAnchor={yAxisAlign === 'left' ? 'start' : 'end'}\n yAxisLabel={Boolean(yAxisLabel)}\n />\n )}\n tickFormatter={valueFormatter}\n tickLine={false}\n type=\"number\"\n width={calculatedYAxisWidth}\n >\n {yAxisLabel && (\n <Label\n angle={-90}\n className={cx(styles.strongLabel, styles.emphasis)}\n offset={-15}\n position=\"insideLeft\"\n style={{ textAnchor: 'middle' }}\n >\n {yAxisLabel}\n </Label>\n )}\n </YAxis>\n <Tooltip\n content={\n showTooltip\n ? ({ active, payload, label }) =>\n CustomTooltip ? (\n <CustomTooltip\n active={active}\n customCategories={customCategories}\n label={label}\n payload={payload?.map((payloadItem: any) => ({\n ...payloadItem,\n color: categoryColors.get(payloadItem.dataKey) ?? cssVar.colorPrimary,\n }))}\n valueFormatter={valueFormatter}\n />\n ) : (\n <ChartTooltip\n active={active}\n categoryColors={categoryColors}\n customCategories={customCategories}\n label={label}\n payload={payload}\n valueFormatter={valueFormatter}\n />\n )\n : undefined\n }\n cursor={{ stroke: cssVar.colorTextSecondary, strokeWidth: 1 }}\n isAnimationActive={false}\n position={{ y: 0 }}\n wrapperStyle={{ outline: 'none' }}\n />\n\n {showLegend ? (\n <Legend\n content={({ payload }) =>\n ChartLegend(\n { payload },\n categoryColors,\n setLegendHeight,\n activeLegend,\n hasOnValueChange\n ? (clickedLegendItem: string) => onCategoryClick(clickedLegendItem)\n : undefined,\n enableLegendSlider,\n customCategories,\n )\n }\n height={legendHeight}\n verticalAlign=\"top\"\n />\n ) : undefined}\n {categories.map((category) => (\n <Line\n activeDot={(props: any) => {\n const {\n dotCx,\n dotCy,\n stroke,\n strokeLinecap,\n strokeLinejoin,\n strokeWidth,\n dataKey,\n } = props;\n return (\n <Dot\n className={cx(css`\n fill: ${categoryColors.get(dataKey) ?? cssVar.colorPrimary};\n `)}\n cx={dotCx}\n cy={dotCy}\n fill=\"\"\n onClick={(dotProps: any, event) => onDotClick(props, event)}\n r={5}\n stroke={stroke}\n strokeLinecap={strokeLinecap}\n strokeLinejoin={strokeLinejoin}\n strokeWidth={strokeWidth}\n />\n );\n }}\n animationDuration={animationDuration}\n className={cx(css`\n stroke: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n connectNulls={connectNulls}\n dataKey={category}\n dot={(props: any) => {\n const {\n stroke,\n strokeLinecap,\n strokeLinejoin,\n strokeWidth,\n cx: dotCx,\n cy: dotCy,\n dataKey,\n index,\n } = props;\n\n if (\n (hasOnlyOneValueForThisKey(data, category) &&\n !(activeDot || (activeLegend && activeLegend !== category))) ||\n (activeDot?.index === index && activeDot?.dataKey === category)\n ) {\n return (\n <Dot\n className={cx(css`\n fill: ${categoryColors.get(dataKey) ?? cssVar.colorPrimary};\n `)}\n cx={dotCx}\n cy={dotCy}\n fill=\"\"\n key={index}\n r={5}\n stroke={stroke}\n strokeLinecap={strokeLinecap}\n strokeLinejoin={strokeLinejoin}\n strokeWidth={strokeWidth}\n />\n );\n }\n return <Fragment key={index} />;\n }}\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stroke=\"\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeOpacity={activeDot || (activeLegend && activeLegend !== category) ? 0.3 : 1}\n strokeWidth={2}\n type={curveType}\n />\n ))}\n {onValueChange\n ? categories.map((category) => (\n <Line\n connectNulls={connectNulls}\n dataKey={category}\n fill=\"transparent\"\n key={category}\n legendType=\"none\"\n name={category}\n onClick={(props: any, event) => {\n event.stopPropagation();\n const { name } = props;\n onCategoryClick(name);\n }}\n stroke=\"transparent\"\n strokeOpacity={0}\n strokeWidth={12}\n style={{\n cursor: 'pointer',\n }}\n tooltipType=\"none\"\n type={curveType}\n />\n ))\n : undefined}\n </ReChartsLineChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nLineChart.displayName = 'LineChart';\n\nexport default LineChart;\n"],"mappings":";;;;;;;;;;;;;;;;;AA2CA,MAAM,YAAY,YAA4C,OAAO,QAAQ;CAC3E,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,OAAO,CAAC,GACR,aAAa,CAAC,GACd,OACA,SAAS,iBACT,iBAAiB,uBACjB,sBAAsB,uBACtB,eAAe,OACf,YAAY,MACZ,YAAY,MACZ,YACA,eAAe,4BACf,oBAAoB,KACpB,gBAAgB,OAChB,aAAa,QACb,cAAc,MACd,aAAa,MACb,gBAAgB,MAChB,eAAe,OACf,YAAY,UACZ,UACA,UACA,eAAe,OACf,gBAAgB,MAChB,YACA,WACA,eACA,qBAAqB,OACrB,eACA,cACA,UAAU,GACV,YACA,YACA,aAAa,qBACb,QAAQ,QACR,SAAS,KACT,OACA,kBACA,SACA,GAAG,SACD;CACJ,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CACnD,MAAM,CAAC,WAAW,gBAAgB,SAAgC;CAClE,MAAM,CAAC,cAAc,mBAAmB,SAA6B;CACrE,MAAM,uBAAwC,cAAc;EAC1D,IAAI,YAAY,OAAO;EACvB,OAAO,kBAAkB;GAAE;GAAM;GAAO,QAAQ;GAAI;EAAe,CAAC;CACtE,GAAG;EAAC;EAAY;EAAM;EAAgB;CAAK,CAAC;CAE5C,IAAI,WAAW,CAAC,MAAM,OAAO,oBAAC,UAAD;EAAkB;EAAe;CAAQ,CAAA;CAEtE,MAAM,gBAAgB;CACtB,MAAM,eAAe,CAAC,aAAa,CAAC,YAAY,IAAI;CACpD,MAAM,iBAAiB,wBAAwB,YAAY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K;OACO;OACC;OACH;MACd,GANM,KAMN;MAGL,OAAO,oBAAC,UAAD,CAAuB,GAAR,KAAQ;KAChC;KACA,mBAAmB;KAEnB,MAAM;KACN,QAAO;KACP,eAAc;KACd,gBAAe;KACf,eAAe,aAAc,gBAAgB,iBAAiB,WAAY,KAAM;KAChF,aAAa;KACb,MAAM;IACP,GARM,QAQN,CACF;IACA,gBACG,WAAW,KAAK,aACd,oBAAC,MAAD;KACgB;KACd,SAAS;KACT,MAAK;KAEL,YAAW;KACX,MAAM;KACN,UAAU,OAAY,UAAU;MAC9B,MAAM,gBAAgB;MACtB,MAAM,EAAE,SAAS;MACjB,gBAAgB,IAAI;KACtB;KACA,QAAO;KACP,eAAe;KACf,aAAa;KACb,OAAO,EACL,QAAQ,UACV;KACA,aAAY;KACZ,MAAM;IACP,GAhBM,QAgBN,CACF,IACD,KAAA;GACa;EAEnB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,UAAU,cAAc"}
1
+ {"version":3,"file":"index.mjs","names":["ReChartsLineChart","Tooltip"],"sources":["../../src/LineChart/index.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, Skeleton, css, cssVar, cx } from '@lobehub/ui';\nimport { Fragment, MouseEvent, forwardRef, useMemo, useState } from 'react';\nimport {\n CartesianGrid,\n Dot,\n Label,\n Legend,\n Line,\n LineChart as ReChartsLineChart,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseChartProps from '@/common/BaseChartProps';\nimport ChartLegend from '@/common/ChartLegend';\nimport ChartTooltip from '@/common/ChartTooltip';\nimport CustomYAxisTick from '@/common/CustomYAxisTick';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain, hasOnlyOneValueForThisKey } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport { CurveType } from '@/types/charts';\nimport { defaultValueFormatter } from '@/utils';\nimport { getMaxLabelLength } from '@/utils/getMaxLabelLength';\n\nimport { styles } from './styles';\n\nexport interface LineChartProps extends BaseChartProps {\n connectNulls?: boolean;\n curveType?: CurveType;\n}\n\ninterface ActiveDot {\n dataKey?: string;\n index?: number;\n}\n\nconst LineChart = forwardRef<HTMLDivElement, LineChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n categories = [],\n index,\n colors = themeColorRange,\n valueFormatter = defaultValueFormatter,\n xAxisLabelFormatter = defaultValueFormatter,\n startEndOnly = false,\n showXAxis = true,\n showYAxis = true,\n yAxisWidth,\n intervalType = 'equidistantPreserveStart',\n animationDuration = 900,\n showAnimation = false,\n yAxisAlign = 'left',\n showTooltip = true,\n showLegend = true,\n showGridLines = true,\n autoMinValue = false,\n curveType = 'linear',\n minValue,\n maxValue,\n connectNulls = false,\n allowDecimals = true,\n noDataText,\n className,\n onValueChange,\n enableLegendSlider = false,\n customTooltip,\n rotateLabelX,\n tickGap = 5,\n xAxisLabel,\n yAxisLabel,\n yAxisDomain: yAxisDomainOverride,\n width = '100%',\n height = 280,\n style,\n customCategories,\n loading,\n ...rest\n } = props;\n const [legendHeight, setLegendHeight] = useState(60);\n const [activeDot, setActiveDot] = useState<ActiveDot | undefined>();\n const [activeLegend, setActiveLegend] = useState<string | undefined>();\n const calculatedYAxisWidth: number | string = useMemo(() => {\n if (yAxisWidth) return yAxisWidth;\n return getMaxLabelLength({ data, index, margin: 16, valueFormatter });\n }, [yAxisWidth, data, valueFormatter, index]);\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const CustomTooltip = customTooltip;\n const paddingValue = !showXAxis && !showYAxis ? 0 : 20;\n const categoryColors = constructCategoryColors(categories, colors);\n const yAxisDomain = (yAxisDomainOverride ??\n getYAxisDomain(autoMinValue, minValue, maxValue)) as AxisDomain;\n const hasOnValueChange = !!onValueChange;\n\n const onDotClick = (itemData: any, event: MouseEvent) => {\n event.stopPropagation();\n\n if (!hasOnValueChange) return;\n if (\n (itemData.index === activeDot?.index && itemData.dataKey === activeDot?.dataKey) ||\n (hasOnlyOneValueForThisKey(data, itemData.dataKey) &&\n activeLegend &&\n activeLegend === itemData.dataKey)\n ) {\n setActiveLegend(undefined);\n setActiveDot(undefined);\n onValueChange?.(null);\n } else {\n setActiveLegend(itemData.dataKey);\n setActiveDot({\n dataKey: itemData.dataKey,\n index: itemData.index,\n });\n onValueChange?.({\n categoryClicked: itemData.dataKey,\n eventType: 'dot',\n ...itemData.payload,\n });\n }\n };\n\n const onCategoryClick = (dataKey: string) => {\n if (!hasOnValueChange) return;\n if (\n (dataKey === activeLegend && !activeDot) ||\n (hasOnlyOneValueForThisKey(data, dataKey) && activeDot && activeDot.dataKey === dataKey)\n ) {\n setActiveLegend(undefined);\n onValueChange?.(null);\n } else {\n setActiveLegend(dataKey);\n onValueChange?.({\n categoryClicked: dataKey,\n eventType: 'category',\n });\n }\n setActiveDot(undefined);\n };\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsLineChart\n data={data}\n margin={{\n bottom: xAxisLabel ? 30 : undefined,\n left: yAxisLabel ? 20 : undefined,\n right: yAxisLabel ? 5 : undefined,\n top: 5,\n }}\n onClick={\n hasOnValueChange && (activeLegend || activeDot)\n ? () => {\n setActiveDot(undefined);\n setActiveLegend(undefined);\n onValueChange?.(null);\n }\n : undefined\n }\n >\n {showGridLines ? (\n <CartesianGrid className={styles.gridLines} horizontal={true} vertical={false} />\n ) : undefined}\n <XAxis\n angle={rotateLabelX?.angle}\n axisLine={false}\n className={styles.label}\n dataKey={index}\n dy={rotateLabelX?.verticalShift}\n fill=\"\"\n hide={!showXAxis}\n interval={startEndOnly ? 'preserveStartEnd' : intervalType}\n minTickGap={tickGap}\n padding={{ left: paddingValue, right: paddingValue }}\n stroke=\"\"\n tick={{ transform: 'translate(0, 6)' }}\n tickFormatter={xAxisLabelFormatter}\n tickLine={false}\n ticks={startEndOnly ? [data[0][index], data.at(-1)[index]] : undefined}\n >\n {xAxisLabel && (\n <Label\n className={cx(styles.strongLabel, styles.emphasis)}\n offset={-20}\n position=\"insideBottom\"\n >\n {xAxisLabel}\n </Label>\n )}\n </XAxis>\n <YAxis\n allowDecimals={allowDecimals}\n axisLine={false}\n className={styles.label}\n domain={yAxisDomain as AxisDomain}\n fill=\"\"\n hide={!showYAxis}\n stroke=\"\"\n tick={(props) => (\n <CustomYAxisTick\n {...props}\n align={yAxisAlign}\n formatter={valueFormatter}\n textAnchor={yAxisAlign === 'left' ? 'start' : 'end'}\n yAxisLabel={Boolean(yAxisLabel)}\n />\n )}\n tickFormatter={valueFormatter}\n tickLine={false}\n type=\"number\"\n width={calculatedYAxisWidth}\n >\n {yAxisLabel && (\n <Label\n angle={-90}\n className={cx(styles.strongLabel, styles.emphasis)}\n offset={-15}\n position=\"insideLeft\"\n style={{ textAnchor: 'middle' }}\n >\n {yAxisLabel}\n </Label>\n )}\n </YAxis>\n <Tooltip\n content={\n showTooltip\n ? ({ active, payload, label }) =>\n CustomTooltip ? (\n <CustomTooltip\n active={active}\n customCategories={customCategories}\n label={label}\n payload={payload?.map((payloadItem: any) => ({\n ...payloadItem,\n color: categoryColors.get(payloadItem.dataKey) ?? cssVar.colorPrimary,\n }))}\n valueFormatter={valueFormatter}\n />\n ) : (\n <ChartTooltip\n active={active}\n categoryColors={categoryColors}\n customCategories={customCategories}\n label={label}\n payload={payload}\n valueFormatter={valueFormatter}\n />\n )\n : undefined\n }\n cursor={{ stroke: cssVar.colorTextSecondary, strokeWidth: 1 }}\n isAnimationActive={false}\n position={{ y: 0 }}\n wrapperStyle={{ outline: 'none' }}\n />\n\n {showLegend ? (\n <Legend\n content={({ payload }) =>\n ChartLegend(\n { payload },\n categoryColors,\n setLegendHeight,\n activeLegend,\n hasOnValueChange\n ? (clickedLegendItem: string) => onCategoryClick(clickedLegendItem)\n : undefined,\n enableLegendSlider,\n customCategories,\n )\n }\n height={legendHeight}\n verticalAlign=\"top\"\n />\n ) : undefined}\n {categories.map((category) => (\n <Line\n activeDot={(props: any) => {\n const {\n dotCx,\n dotCy,\n stroke,\n strokeLinecap,\n strokeLinejoin,\n strokeWidth,\n dataKey,\n } = props;\n return (\n <Dot\n className={cx(css`\n fill: ${categoryColors.get(dataKey) ?? cssVar.colorPrimary};\n `)}\n cx={dotCx}\n cy={dotCy}\n fill=\"\"\n onClick={(dotProps: any, event) => onDotClick(props, event)}\n r={5}\n stroke={stroke}\n strokeLinecap={strokeLinecap}\n strokeLinejoin={strokeLinejoin}\n strokeWidth={strokeWidth}\n />\n );\n }}\n animationDuration={animationDuration}\n className={cx(css`\n stroke: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n connectNulls={connectNulls}\n dataKey={category}\n dot={(props: any) => {\n const {\n stroke,\n strokeLinecap,\n strokeLinejoin,\n strokeWidth,\n cx: dotCx,\n cy: dotCy,\n dataKey,\n index,\n } = props;\n\n if (\n (hasOnlyOneValueForThisKey(data, category) &&\n !(activeDot || (activeLegend && activeLegend !== category))) ||\n (activeDot?.index === index && activeDot?.dataKey === category)\n ) {\n return (\n <Dot\n className={cx(css`\n fill: ${categoryColors.get(dataKey) ?? cssVar.colorPrimary};\n `)}\n cx={dotCx}\n cy={dotCy}\n fill=\"\"\n key={index}\n r={5}\n stroke={stroke}\n strokeLinecap={strokeLinecap}\n strokeLinejoin={strokeLinejoin}\n strokeWidth={strokeWidth}\n />\n );\n }\n return <Fragment key={index} />;\n }}\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stroke=\"\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeOpacity={activeDot || (activeLegend && activeLegend !== category) ? 0.3 : 1}\n strokeWidth={2}\n type={curveType}\n />\n ))}\n {onValueChange\n ? categories.map((category) => (\n <Line\n connectNulls={connectNulls}\n dataKey={category}\n fill=\"transparent\"\n key={category}\n legendType=\"none\"\n name={category}\n onClick={(props: any, event) => {\n event.stopPropagation();\n const { name } = props;\n onCategoryClick(name);\n }}\n stroke=\"transparent\"\n strokeOpacity={0}\n strokeWidth={12}\n style={{\n cursor: 'pointer',\n }}\n tooltipType=\"none\"\n type={curveType}\n />\n ))\n : undefined}\n </ReChartsLineChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nLineChart.displayName = 'LineChart';\n\nexport default LineChart;\n"],"mappings":";;;;;;;;;;;;;;;AAyCA,MAAM,YAAY,YAA4C,OAAO,QAAQ;CAC3E,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,OAAO,CAAC,GACR,aAAa,CAAC,GACd,OACA,SAAS,iBACT,iBAAiB,uBACjB,sBAAsB,uBACtB,eAAe,OACf,YAAY,MACZ,YAAY,MACZ,YACA,eAAe,4BACf,oBAAoB,KACpB,gBAAgB,OAChB,aAAa,QACb,cAAc,MACd,aAAa,MACb,gBAAgB,MAChB,eAAe,OACf,YAAY,UACZ,UACA,UACA,eAAe,OACf,gBAAgB,MAChB,YACA,WACA,eACA,qBAAqB,OACrB,eACA,cACA,UAAU,GACV,YACA,YACA,aAAa,qBACb,QAAQ,QACR,SAAS,KACT,OACA,kBACA,SACA,GAAG,SACD;CACJ,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CACnD,MAAM,CAAC,WAAW,gBAAgB,SAAgC;CAClE,MAAM,CAAC,cAAc,mBAAmB,SAA6B;CACrE,MAAM,uBAAwC,cAAc;EAC1D,IAAI,YAAY,OAAO;EACvB,OAAO,kBAAkB;GAAE;GAAM;GAAO,QAAQ;GAAI;EAAe,CAAC;CACtE,GAAG;EAAC;EAAY;EAAM;EAAgB;CAAK,CAAC;CAE5C,IAAI,WAAW,CAAC,MAAM,OAAO,oBAAC,UAAD;EAAkB;EAAe;CAAQ,CAAA;CAEtE,MAAM,gBAAgB;CACtB,MAAM,eAA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O,aAAa;yBAC5D;OACD,IAAI;OACJ,IAAI;OACJ,MAAK;OAEL,GAAG;OACK;OACO;OACC;OACH;MACd,GANM,KAMN;MAGL,OAAO,oBAAC,UAAD,CAAuB,GAAR,KAAQ;KAChC;KACA,mBAAmB;KAEnB,MAAM;KACN,QAAO;KACP,eAAc;KACd,gBAAe;KACf,eAAe,aAAc,gBAAgB,iBAAiB,WAAY,KAAM;KAChF,aAAa;KACb,MAAM;IACP,GARM,QAQN,CACF;IACA,gBACG,WAAW,KAAK,aACd,oBAAC,MAAD;KACgB;KACd,SAAS;KACT,MAAK;KAEL,YAAW;KACX,MAAM;KACN,UAAU,OAAY,UAAU;MAC9B,MAAM,gBAAgB;MACtB,MAAM,EAAE,SAAS;MACjB,gBAAgB,IAAI;KACtB;KACA,QAAO;KACP,eAAe;KACf,aAAa;KACb,OAAO,EACL,QAAQ,UACV;KACA,aAAY;KACZ,MAAM;IACP,GAhBM,QAgBN,CACF,IACD,KAAA;GACa;EAEnB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,UAAU,cAAc"}
@@ -1,4 +1,4 @@
1
- import { createStaticStyles } from "antd-style";
1
+ import { createStaticStyles } from "@lobehub/ui";
2
2
  //#region src/LineChart/styles.ts
3
3
  const styles = createStaticStyles(({ css, cssVar }) => ({
4
4
  emphasis: css`
@@ -1 +1 @@
1
- {"version":3,"file":"styles.mjs","names":[],"sources":["../../src/LineChart/styles.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n emphasis: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n gridLines: css`\n stroke: ${cssVar.colorBorderSecondary};\n stroke-width: 1;\n `,\n label: css`\n font-size: 12px;\n line-height: 16px;\n fill: ${cssVar.colorTextDescription};\n `,\n strongLabel: css`\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ${cssVar.colorTextSecondary};\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,UAAU,GAAG;;;;;CAKb,WAAW,GAAG;cACF,OAAO,qBAAqB;;;CAGxC,OAAO,GAAG;;;YAGA,OAAO,qBAAqB;;CAEtC,aAAa,GAAG;;;;YAIN,OAAO,mBAAmB;;AAEtC,EAAE"}
1
+ {"version":3,"file":"styles.mjs","names":[],"sources":["../../src/LineChart/styles.ts"],"sourcesContent":["import { createStaticStyles } from '@lobehub/ui';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n emphasis: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n gridLines: css`\n stroke: ${cssVar.colorBorderSecondary};\n stroke-width: 1;\n `,\n label: css`\n font-size: 12px;\n line-height: 16px;\n fill: ${cssVar.colorTextDescription};\n `,\n strongLabel: css`\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ${cssVar.colorTextSecondary};\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,UAAU,GAAG;;;;;CAKb,WAAW,GAAG;cACF,OAAO,qBAAqB;;;CAGxC,OAAO,GAAG;;;YAGA,OAAO,qBAAqB;;CAEtC,aAAa,GAAG;;;;YAIN,OAAO,mBAAmB;;AAEtC,EAAE"}
@@ -6,9 +6,7 @@ import ChartTooltip from "../common/ChartTooltip/index.mjs";
6
6
  import NoData from "../common/NoData.mjs";
7
7
  import { constructCategoryColors, getYAxisDomain } from "../common/utils.mjs";
8
8
  import { styles } from "./styles.mjs";
9
- import { Flexbox } from "@lobehub/ui";
10
- import { Skeleton } from "@lobehub/ui/base-ui";
11
- import { cssVar } from "antd-style";
9
+ import { Flexbox, Skeleton, cssVar } from "@lobehub/ui";
12
10
  import { forwardRef, useState } from "react";
13
11
  import { Legend, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart as RadarChart$1, ResponsiveContainer, Tooltip as Tooltip$1 } from "recharts";
14
12
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["ReChartsRadarChart","Tooltip"],"sources":["../../src/RadarChart/index.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox } from '@lobehub/ui';\nimport { Skeleton } from '@lobehub/ui/base-ui';\nimport { cssVar } from 'antd-style';\nimport { ReactNode, forwardRef, useState } from 'react';\nimport {\n Legend,\n PolarAngleAxis,\n PolarGrid,\n PolarRadiusAxis,\n Radar,\n RadarChart as ReChartsRadarChart,\n ResponsiveContainer,\n Tooltip,\n} from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseChartProps from '@/common/BaseChartProps';\nimport ChartLegend from '@/common/ChartLegend';\nimport ChartTooltip from '@/common/ChartTooltip';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport { defaultValueFormatter } from '@/utils';\n\nimport { styles } from './styles';\n\nexport interface RadarChartProps extends BaseChartProps {\n /**\n * Format angle-axis labels. Receives the index value and the matching data row.\n * Can return a string or ReactNode (e.g. colored `<tspan>`).\n */\n angleAxisLabelFormatter?: (value: string | number, payload?: Record<string, any>) => ReactNode;\n /**\n * When true, series after the first are rendered at `secondaryOpacity`.\n * @default true\n */\n dimSecondarySeries?: boolean;\n fillOpacity?: number;\n /**\n * Opacity applied to series after the first when `dimSecondarySeries` is enabled.\n * @default 0.25\n */\n secondaryOpacity?: number;\n shape?: 'polygon' | 'circle';\n showRadiusAxis?: boolean;\n}\n\nconst RadarChart = forwardRef<HTMLDivElement, RadarChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n categories = [],\n customCategories,\n index,\n colors = themeColorRange,\n valueFormatter = defaultValueFormatter,\n animationDuration = 900,\n showAnimation = false,\n showTooltip = true,\n showLegend = true,\n showGridLines = true,\n autoMinValue = false,\n minValue,\n maxValue,\n allowDecimals = true,\n noDataText,\n onValueChange,\n enableLegendSlider = false,\n customTooltip,\n loading,\n className,\n width = '100%',\n height = 280,\n style,\n shape = 'polygon',\n fillOpacity = 0.33,\n showRadiusAxis = false,\n dimSecondarySeries = true,\n secondaryOpacity = 0.25,\n angleAxisLabelFormatter,\n xAxisLabelFormatter,\n yAxisDomain: yAxisDomainOverride,\n ...rest\n } = props;\n\n const [activeLegend, setActiveLegend] = useState<string | undefined>();\n const [legendHeight, setLegendHeight] = useState(60);\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const CustomTooltip = customTooltip;\n const categoryColors = constructCategoryColors(categories, colors);\n const hasOnValueChange = !!onValueChange;\n const yAxisDomain = (yAxisDomainOverride ??\n getYAxisDomain(autoMinValue, minValue, maxValue)) as AxisDomain;\n\n const onCategoryClick = (dataKey: string) => {\n if (!hasOnValueChange) return;\n if (dataKey === activeLegend) {\n setActiveLegend(undefined);\n onValueChange?.(null);\n } else {\n setActiveLegend(dataKey);\n onValueChange?.({\n categoryClicked: dataKey,\n eventType: 'category',\n });\n }\n };\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsRadarChart\n data={data}\n margin={{ bottom: 10, left: 10, right: 10, top: 10 }}\n onClick={\n hasOnValueChange && activeLegend\n ? () => {\n setActiveLegend(undefined);\n onValueChange?.(null);\n }\n : undefined\n }\n >\n {showGridLines ? (\n <PolarGrid\n className={styles.gridLines}\n fill=\"none\"\n gridType={shape}\n stroke={cssVar.colorBorderSecondary}\n />\n ) : undefined}\n <PolarAngleAxis\n axisLine={false}\n className={styles.label}\n dataKey={index}\n tick={(tickProps: any) => {\n const { x, y, textAnchor, payload: tickPayload } = tickProps;\n const value = tickPayload?.value;\n const row = data.find((item) => item[index] === value);\n let content: ReactNode = value;\n if (angleAxisLabelFormatter) {\n content = angleAxisLabelFormatter(value, row);\n } else if (xAxisLabelFormatter) {\n content = xAxisLabelFormatter(value);\n }\n return (\n <text\n className=\"recharts-polar-angle-axis-tick-value\"\n fill={cssVar.colorTextDescription}\n fontSize={12}\n textAnchor={textAnchor}\n x={x}\n y={y}\n >\n {content}\n </text>\n );\n }}\n tickLine={false}\n />\n <PolarRadiusAxis\n allowDecimals={allowDecimals}\n axisLine={false}\n className={styles.radiusLabel}\n domain={yAxisDomain}\n stroke={cssVar.colorTextQuaternary}\n tick={showRadiusAxis}\n tickFormatter={valueFormatter}\n tickLine={false}\n />\n {showTooltip ? (\n <Tooltip\n content={({ active, payload, label }) =>\n CustomTooltip ? (\n <CustomTooltip\n active={active}\n customCategories={customCategories}\n label={label}\n payload={payload?.map((payloadItem: any) => ({\n ...payloadItem,\n color: categoryColors.get(payloadItem.dataKey) ?? cssVar.colorPrimary,\n }))}\n valueFormatter={valueFormatter}\n />\n ) : (\n <ChartTooltip\n active={active}\n categoryColors={categoryColors}\n customCategories={customCategories}\n label={label}\n payload={payload}\n valueFormatter={valueFormatter}\n />\n )\n }\n isAnimationActive={false}\n wrapperStyle={{ outline: 'none' }}\n />\n ) : undefined}\n {showLegend ? (\n <Legend\n content={({ payload }) =>\n ChartLegend(\n { payload: payload?.slice().reverse() },\n categoryColors,\n setLegendHeight,\n activeLegend,\n hasOnValueChange\n ? (clickedLegendItem: string) => onCategoryClick(clickedLegendItem)\n : undefined,\n enableLegendSlider,\n customCategories,\n )\n }\n height={legendHeight}\n verticalAlign=\"top\"\n />\n ) : undefined}\n {/* Render later categories first so earlier ones (e.g. A) paint on top */}\n {[...categories].reverse().map((category) => {\n const isInactive = Boolean(activeLegend && activeLegend !== category);\n const isSecondary = dimSecondarySeries && category !== categories[0];\n const seriesFillOpacity = isSecondary ? fillOpacity * secondaryOpacity : fillOpacity;\n const seriesStrokeOpacity = isSecondary ? secondaryOpacity : 1;\n const color = categoryColors.get(category) ?? cssVar.colorPrimary;\n return (\n <Radar\n animationDuration={animationDuration}\n dataKey={category}\n fill={color}\n fillOpacity={isInactive ? seriesFillOpacity * 0.3 : seriesFillOpacity}\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stroke={color}\n strokeOpacity={isInactive ? seriesStrokeOpacity * 0.3 : seriesStrokeOpacity}\n strokeWidth={2}\n style={{\n cursor: onValueChange ? 'pointer' : undefined,\n }}\n />\n );\n })}\n </ReChartsRadarChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nRadarChart.displayName = 'RadarChart';\n\nexport default RadarChart;\n"],"mappings":";;;;;;;;;;;;;;;AAiDA,MAAM,aAAa,YAA6C,OAAO,QAAQ;CAC7E,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,OAAO,CAAC,GACR,aAAa,CAAC,GACd,kBACA,OACA,SAAS,iBACT,iBAAiB,uBACjB,oBAAoB,KACpB,gBAAgB,OAChB,cAAc,MACd,aAAa,MACb,gBAAgB,MAChB,eAAe,OACf,UACA,UACA,gBAAgB,MAChB,YACA,eACA,qBAAqB,OACrB,eACA,SACA,WACA,QAAQ,QACR,SAAS,KACT,OACA,QAAQ,WACR,cAAc,KACd,iBAAiB,OACjB,qBAAqB,MACrB,mBAAmB,KACnB,yBACA,qBACA,aAAa,qBACb,GAAG,SACD;CAEJ,MAAM,CAAC,cAAc,mBAAmB,SAA6B;CACrE,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CAEnD,IAAI,WAAW,CAAC,MAAM,OAAO,oBAAC,UAAD;EAAkB;EAAe;CAAQ,CAAA;CAEtE,MAAM,gBAAgB;CACtB,MAAM,iBAAiB,wBAAwB,YAAY,MAAM;CACjE,MAAM,mBAAmB,CAAC,CAAC;CAC3B,MAAM,cAAe,uBACnB,eAAe,cAAc,UAAU,QAAQ;CAEjD,MAAM,mBAAmB,YAAoB;EAC3C,IAAI,CAAC,kBAAkB;EACvB,IAAI,YAAY,cAAc;G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MACX;MACP,SAAS,SAAS,KAAK,iBAAsB;OAC3C,GAAG;OACH,OAAO,eAAe,IAAI,YAAY,OAAO,KAAK,OAAO;MAC3D,EAAE;MACc;KACjB,CAAA,IAED,oBAAC,cAAD;MACU;MACQ;MACE;MACX;MACE;MACO;KACjB,CAAA;KAGL,mBAAmB;KACnB,cAAc,EAAE,SAAS,OAAO;IACjC,CAAA,IACC,KAAA;IACH,aACC,oBAAC,QAAD;KACE,UAAU,EAAE,cACV,YACE,EAAE,SAAS,SAAS,MAAM,CAAC,CAAC,QAAQ,EAAE,GACtC,gBACA,iBACA,cACA,oBACK,sBAA8B,gBAAgB,iBAAiB,IAChE,KAAA,GACJ,oBACA,gBACF;KAEF,QAAQ;KACR,eAAc;IACf,CAAA,IACC,KAAA;IAEH,CAAC,GAAG,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,aAAa;KAC3C,MAAM,aAAa,QAAQ,gBAAgB,iBAAiB,QAAQ;KACpE,MAAM,cAAc,sBAAsB,aAAa,WAAW;KAClE,MAAM,oBAAoB,cAAc,cAAc,mBAAmB;KACzE,MAAM,sBAAsB,cAAc,mBAAmB;KAC7D,MAAM,QAAQ,eAAe,IAAI,QAAQ,KAAK,OAAO;KACrD,OACE,oBAAC,OAAD;MACqB;MACnB,SAAS;MACT,MAAM;MACN,aAAa,aAAa,oBAAoB,KAAM;MACpD,mBAAmB;MAEnB,MAAM;MACN,QAAQ;MACR,eAAe,aAAa,sBAAsB,KAAM;MACxD,aAAa;MACb,OAAO,EACL,QAAQ,gBAAgB,YAAY,KAAA,EACtC;KACD,GARM,QAQN;IAEL,CAAC;GACiB;EAEpB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,WAAW,cAAc"}
1
+ {"version":3,"file":"index.mjs","names":["ReChartsRadarChart","Tooltip"],"sources":["../../src/RadarChart/index.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, Skeleton, cssVar } from '@lobehub/ui';\nimport { ReactNode, forwardRef, useState } from 'react';\nimport {\n Legend,\n PolarAngleAxis,\n PolarGrid,\n PolarRadiusAxis,\n Radar,\n RadarChart as ReChartsRadarChart,\n ResponsiveContainer,\n Tooltip,\n} from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseChartProps from '@/common/BaseChartProps';\nimport ChartLegend from '@/common/ChartLegend';\nimport ChartTooltip from '@/common/ChartTooltip';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport { defaultValueFormatter } from '@/utils';\n\nimport { styles } from './styles';\n\nexport interface RadarChartProps extends BaseChartProps {\n /**\n * Format angle-axis labels. Receives the index value and the matching data row.\n * Can return a string or ReactNode (e.g. colored `<tspan>`).\n */\n angleAxisLabelFormatter?: (value: string | number, payload?: Record<string, any>) => ReactNode;\n /**\n * When true, series after the first are rendered at `secondaryOpacity`.\n * @default true\n */\n dimSecondarySeries?: boolean;\n fillOpacity?: number;\n /**\n * Opacity applied to series after the first when `dimSecondarySeries` is enabled.\n * @default 0.25\n */\n secondaryOpacity?: number;\n shape?: 'polygon' | 'circle';\n showRadiusAxis?: boolean;\n}\n\nconst RadarChart = forwardRef<HTMLDivElement, RadarChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n categories = [],\n customCategories,\n index,\n colors = themeColorRange,\n valueFormatter = defaultValueFormatter,\n animationDuration = 900,\n showAnimation = false,\n showTooltip = true,\n showLegend = true,\n showGridLines = true,\n autoMinValue = false,\n minValue,\n maxValue,\n allowDecimals = true,\n noDataText,\n onValueChange,\n enableLegendSlider = false,\n customTooltip,\n loading,\n className,\n width = '100%',\n height = 280,\n style,\n shape = 'polygon',\n fillOpacity = 0.33,\n showRadiusAxis = false,\n dimSecondarySeries = true,\n secondaryOpacity = 0.25,\n angleAxisLabelFormatter,\n xAxisLabelFormatter,\n yAxisDomain: yAxisDomainOverride,\n ...rest\n } = props;\n\n const [activeLegend, setActiveLegend] = useState<string | undefined>();\n const [legendHeight, setLegendHeight] = useState(60);\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const CustomTooltip = customTooltip;\n const categoryColors = constructCategoryColors(categories, colors);\n const hasOnValueChange = !!onValueChange;\n const yAxisDomain = (yAxisDomainOverride ??\n getYAxisDomain(autoMinValue, minValue, maxValue)) as AxisDomain;\n\n const onCategoryClick = (dataKey: string) => {\n if (!hasOnValueChange) return;\n if (dataKey === activeLegend) {\n setActiveLegend(undefined);\n onValueChange?.(null);\n } else {\n setActiveLegend(dataKey);\n onValueChange?.({\n categoryClicked: dataKey,\n eventType: 'category',\n });\n }\n };\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsRadarChart\n data={data}\n margin={{ bottom: 10, left: 10, right: 10, top: 10 }}\n onClick={\n hasOnValueChange && activeLegend\n ? () => {\n setActiveLegend(undefined);\n onValueChange?.(null);\n }\n : undefined\n }\n >\n {showGridLines ? (\n <PolarGrid\n className={styles.gridLines}\n fill=\"none\"\n gridType={shape}\n stroke={cssVar.colorBorderSecondary}\n />\n ) : undefined}\n <PolarAngleAxis\n axisLine={false}\n className={styles.label}\n dataKey={index}\n tick={(tickProps: any) => {\n const { x, y, textAnchor, payload: tickPayload } = tickProps;\n const value = tickPayload?.value;\n const row = data.find((item) => item[index] === value);\n let content: ReactNode = value;\n if (angleAxisLabelFormatter) {\n content = angleAxisLabelFormatter(value, row);\n } else if (xAxisLabelFormatter) {\n content = xAxisLabelFormatter(value);\n }\n return (\n <text\n className=\"recharts-polar-angle-axis-tick-value\"\n fill={cssVar.colorTextDescription}\n fontSize={12}\n textAnchor={textAnchor}\n x={x}\n y={y}\n >\n {content}\n </text>\n );\n }}\n tickLine={false}\n />\n <PolarRadiusAxis\n allowDecimals={allowDecimals}\n axisLine={false}\n className={styles.radiusLabel}\n domain={yAxisDomain}\n stroke={cssVar.colorTextQuaternary}\n tick={showRadiusAxis}\n tickFormatter={valueFormatter}\n tickLine={false}\n />\n {showTooltip ? (\n <Tooltip\n content={({ active, payload, label }) =>\n CustomTooltip ? (\n <CustomTooltip\n active={active}\n customCategories={customCategories}\n label={label}\n payload={payload?.map((payloadItem: any) => ({\n ...payloadItem,\n color: categoryColors.get(payloadItem.dataKey) ?? cssVar.colorPrimary,\n }))}\n valueFormatter={valueFormatter}\n />\n ) : (\n <ChartTooltip\n active={active}\n categoryColors={categoryColors}\n customCategories={customCategories}\n label={label}\n payload={payload}\n valueFormatter={valueFormatter}\n />\n )\n }\n isAnimationActive={false}\n wrapperStyle={{ outline: 'none' }}\n />\n ) : undefined}\n {showLegend ? (\n <Legend\n content={({ payload }) =>\n ChartLegend(\n { payload: payload?.slice().reverse() },\n categoryColors,\n setLegendHeight,\n activeLegend,\n hasOnValueChange\n ? (clickedLegendItem: string) => onCategoryClick(clickedLegendItem)\n : undefined,\n enableLegendSlider,\n customCategories,\n )\n }\n height={legendHeight}\n verticalAlign=\"top\"\n />\n ) : undefined}\n {/* Render later categories first so earlier ones (e.g. A) paint on top */}\n {[...categories].reverse().map((category) => {\n const isInactive = Boolean(activeLegend && activeLegend !== category);\n const isSecondary = dimSecondarySeries && category !== categories[0];\n const seriesFillOpacity = isSecondary ? fillOpacity * secondaryOpacity : fillOpacity;\n const seriesStrokeOpacity = isSecondary ? secondaryOpacity : 1;\n const color = categoryColors.get(category) ?? cssVar.colorPrimary;\n return (\n <Radar\n animationDuration={animationDuration}\n dataKey={category}\n fill={color}\n fillOpacity={isInactive ? seriesFillOpacity * 0.3 : seriesFillOpacity}\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stroke={color}\n strokeOpacity={isInactive ? seriesStrokeOpacity * 0.3 : seriesStrokeOpacity}\n strokeWidth={2}\n style={{\n cursor: onValueChange ? 'pointer' : undefined,\n }}\n />\n );\n })}\n </ReChartsRadarChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nRadarChart.displayName = 'RadarChart';\n\nexport default RadarChart;\n"],"mappings":";;;;;;;;;;;;;AA+CA,MAAM,aAAa,YAA6C,OAAO,QAAQ;CAC7E,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,OAAO,CAAC,GACR,aAAa,CAAC,GACd,kBACA,OACA,SAAS,iBACT,iBAAiB,uBACjB,oBAAoB,KACpB,gBAAgB,OAChB,cAAc,MACd,aAAa,MACb,gBAAgB,MAChB,eAAe,OACf,UACA,UACA,gBAAgB,MAChB,YACA,eACA,qBAAqB,OACrB,eACA,SACA,WACA,QAAQ,QACR,SAAS,KACT,OACA,QAAQ,WACR,cAAc,KACd,iBAAiB,OACjB,qBAAqB,MACrB,mBAAmB,KACnB,yBACA,qBACA,aAAa,qBACb,GAAG,SACD;CAEJ,MAAM,CAAC,cAAc,mBAAmB,SAA6B;CACrE,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CAEnD,IAAI,WAAW,CAAC,MAAM,OAAO,oBAAC,UAAD;EAAkB;EAAe;CAAQ,CAAA;CAEtE,MAAM,gBAAgB;CACtB,MAAM,iBAAiB,wBAAwB,YAAY,MAAM;CACjE,MAAM,mBAAmB,CAAC,CAAC;CAC3B,MAAM,cAAe,uBACnB,eAAe,cAAc,UAAU,QAAQ;CAEjD,MAAM,mBAAmB,YAAoB;EAC3C,IAAI,CAAC,kBAAkB;EACvB,IAAI,YAAY,cAAc;GAC5B,gBAAgB,KAAA,CAAS;GACzB,gBAAgB,IAAI;EACtB,OAAO;GACL,gBAAgB,OAAO;GACvB,gBAAgB;IACd,iBAAiB;IACjB,WAAW;GACb,CAAC;EACH;CACF;CAEA,OACE,oBAAC,SAAD;EACa;EACH;EACH;EACL,OAAO;GAAE,UAAU;GAAY,GAAG;EAAM;EACjC;EACP,GAAI;EAEJ,UAAA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,KAAA;IACH,aACC,oBAAC,QAAD;KACE,UAAU,EAAE,cACV,YACE,EAAE,SAAS,SAAS,MAAM,CAAC,CAAC,QAAQ,EAAE,GACtC,gBACA,iBACA,cACA,oBACK,sBAA8B,gBAAgB,iBAAiB,IAChE,KAAA,GACJ,oBACA,gBACF;KAEF,QAAQ;KACR,eAAc;IACf,CAAA,IACC,KAAA;IAEH,CAAC,GAAG,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,aAAa;KAC3C,MAAM,aAAa,QAAQ,gBAAgB,iBAAiB,QAAQ;KACpE,MAAM,cAAc,sBAAsB,aAAa,WAAW;KAClE,MAAM,oBAAoB,cAAc,cAAc,mBAAmB;KACzE,MAAM,sBAAsB,cAAc,mBAAmB;KAC7D,MAAM,QAAQ,eAAe,IAAI,QAAQ,KAAK,OAAO;KACrD,OACE,oBAAC,OAAD;MACqB;MACnB,SAAS;MACT,MAAM;MACN,aAAa,aAAa,oBAAoB,KAAM;MACpD,mBAAmB;MAEnB,MAAM;MACN,QAAQ;MACR,eAAe,aAAa,sBAAsB,KAAM;MACxD,aAAa;MACb,OAAO,EACL,QAAQ,gBAAgB,YAAY,KAAA,EACtC;KACD,GARM,QAQN;IAEL,CAAC;GACiB;EAEpB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,WAAW,cAAc"}
@@ -1,4 +1,4 @@
1
- import { createStaticStyles } from "antd-style";
1
+ import { createStaticStyles } from "@lobehub/ui";
2
2
  //#region src/RadarChart/styles.ts
3
3
  const styles = createStaticStyles(({ css, cssVar }) => ({
4
4
  gridLines: css`
@@ -1 +1 @@
1
- {"version":3,"file":"styles.mjs","names":[],"sources":["../../src/RadarChart/styles.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n gridLines: css`\n fill: none;\n stroke: ${cssVar.colorBorderSecondary};\n stroke-width: 1;\n `,\n label: css`\n font-size: 12px;\n line-height: 16px;\n fill: ${cssVar.colorTextDescription};\n `,\n radiusLabel: css`\n font-size: 12px;\n line-height: 16px;\n fill: ${cssVar.colorTextQuaternary};\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,WAAW,GAAG;;cAEF,OAAO,qBAAqB;;;CAGxC,OAAO,GAAG;;;YAGA,OAAO,qBAAqB;;CAEtC,aAAa,GAAG;;;YAGN,OAAO,oBAAoB;;AAEvC,EAAE"}
1
+ {"version":3,"file":"styles.mjs","names":[],"sources":["../../src/RadarChart/styles.ts"],"sourcesContent":["import { createStaticStyles } from '@lobehub/ui';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n gridLines: css`\n fill: none;\n stroke: ${cssVar.colorBorderSecondary};\n stroke-width: 1;\n `,\n label: css`\n font-size: 12px;\n line-height: 16px;\n fill: ${cssVar.colorTextDescription};\n `,\n radiusLabel: css`\n font-size: 12px;\n line-height: 16px;\n fill: ${cssVar.colorTextQuaternary};\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,WAAW,GAAG;;cAEF,OAAO,qBAAqB;;;CAGxC,OAAO,GAAG;;;YAGA,OAAO,qBAAqB;;CAEtC,aAAa,GAAG;;;YAGN,OAAO,oBAAoB;;AAEvC,EAAE"}
@@ -1,9 +1,7 @@
1
1
  import { defaultValueFormatter } from "../utils/index.mjs";
2
2
  import { ChartTooltipFrame } from "../common/ChartTooltip/ChartTooltipFrame.mjs";
3
3
  import ChartTooltipRow from "./ScatterChartTooltipRow.mjs";
4
- import { Flexbox, Icon } from "@lobehub/ui";
5
- import { Text } from "@lobehub/ui/base-ui";
6
- import { createStaticStyles, cssVar, cx } from "antd-style";
4
+ import { Flexbox, Icon, Text, createStaticStyles, cssVar, cx } from "@lobehub/ui";
7
5
  import { memo } from "react";
8
6
  import { Circle } from "lucide-react";
9
7
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"ScatterChartTooltip.mjs","names":["ScatterChartTooltipRow"],"sources":["../../src/ScatterChart/ScatterChartTooltip.tsx"],"sourcesContent":["import { Flexbox, Icon } from '@lobehub/ui';\nimport { Text } from '@lobehub/ui/base-ui';\nimport { createStaticStyles, cssVar, cx } from 'antd-style';\nimport { Circle } from 'lucide-react';\nimport React, { memo } from 'react';\n\nimport { ChartTooltipFrame } from '@/common/ChartTooltip/ChartTooltipFrame';\nimport { ScatterChartValueFormatter } from '@/types/charts';\nimport { defaultValueFormatter } from '@/utils';\n\nimport ScatterChartTooltipRow from './ScatterChartTooltipRow';\n\nconst styles = createStaticStyles(({ css }) => ({\n header: css`\n border-bottom: 1px solid ${cssVar.colorBorderSecondary};\n font-weight: 500;\n `,\n}));\n\nexport interface ScatterChartTooltipProps {\n active: boolean | undefined;\n axis: any;\n category?: string;\n categoryColors: Map<string, string>;\n customCategories?: {\n [key: string]: string;\n };\n label: string;\n payload: any;\n valueFormatter: ScatterChartValueFormatter;\n}\n\nconst ScatterChartTooltip = memo<ScatterChartTooltipProps>(\n ({\n customCategories,\n label,\n active,\n payload,\n valueFormatter,\n axis,\n category,\n categoryColors,\n }) => {\n const color = category\n ? (categoryColors.get(payload?.[0]?.payload[category]) ?? cssVar.colorPrimary)\n : cssVar.colorPrimary;\n if (active && payload) {\n return (\n <ChartTooltipFrame>\n <Flexbox\n align={'center'}\n className={cx(styles.header)}\n gap={8}\n horizontal\n paddingBlock={8}\n paddingInline={16}\n >\n <Icon color={color} fill={color} icon={Circle} size={10} />\n <Text ellipsis style={{ margin: 0 }}>\n {label}\n </Text>\n </Flexbox>\n <Flexbox gap={4} paddingBlock={8} paddingInline={16} style={{ marginTop: 4 }}>\n {payload.map(({ value, name }: { name: string; value: number }, idx: number) => {\n const valueFormatterKey = Object.keys(axis).find((key) => axis[key] === name) ?? '';\n const valueFormatterFn =\n valueFormatter[valueFormatterKey as keyof ScatterChartValueFormatter] ??\n defaultValueFormatter;\n return (\n <ScatterChartTooltipRow\n key={`id-${idx}`}\n name={customCategories?.[name] || name}\n value={valueFormatter && valueFormatterFn ? valueFormatterFn(value) : `${value}`}\n />\n );\n })}\n </Flexbox>\n </ChartTooltipFrame>\n );\n }\n return null;\n },\n);\n\nexport default ScatterChartTooltip;\n"],"mappings":";;;;;;;;;;AAYA,MAAM,SAAS,oBAAoB,EAAE,WAAW,EAC9C,QAAQ,GAAG;+BACkB,OAAO,qBAAqB;;IAG3D,EAAE;AAeF,MAAM,sBAAsB,MACzB,EACC,kBACA,OACA,QACA,SACA,gBACA,MACA,UACA,qBACI;CACJ,MAAM,QAAQ,WACT,eAAe,IAAI,UAAU,EAAE,EAAE,QAAQ,SAAS,KAAK,OAAO,eAC/D,OAAO;CACX,IAAI,UAAU,SACZ,OACE,qBAAC,mBAAD,EAAA,UAAA,CACE,qBAAC,SAAD;EACE,OAAO;EACP,WAAW,GAAG,OAAO,MAAM;EAC3B,KAAK;EACL,YAAA;EACA,cAAc;EACd,eAAe;EANjB,UAAA,CAQE,oBAAC,MAAD;GAAa;GAAO,MAAM;GAAO,MAAM;GAAQ,MAAM;EAAK,CAAA,GAC1D,oBAAC,MAAD;GAAM,UAAA;GAAS,OAAO,EAAE,QAAQ,EAAE;GAC/B,UAAA;EACG,CAAA,CACC;CACT,CAAA,GAAA,oBAAC,SAAD;EAAS,KAAK;EAAG,cAAc;EAAG,eAAe;EAAI,OAAO,EAAE,WAAW,EAAE;EACxE,UAAA,QAAQ,KAAK,EAAE,OAAO,QAAyC,QAAgB;GAE9E,MAAM,mBACJ,eAFwB,OAAO,KAAK,IAAI,CAAC,CAAC,MAAM,QAAQ,KAAK,SAAS,IAAI,KAAK,OAG/E;GACF,OACE,oBAACA,iBAAD;IAEE,MAAM,mBAAmB,SAAS;IAClC,OAAO,kBAAkB,mBAAmB,iBAAiB,KAAK,IAAI,GAAG;GAC1E,GAHM,MAAM,KAGZ;EAEL,CAAC;CACM,CAAA,CACQ,EAAA,CAAA;CAGvB,OAAO;AACT,CACF"}
1
+ {"version":3,"file":"ScatterChartTooltip.mjs","names":["ScatterChartTooltipRow"],"sources":["../../src/ScatterChart/ScatterChartTooltip.tsx"],"sourcesContent":["import { Flexbox, Icon, Text, createStaticStyles, cssVar, cx } from '@lobehub/ui';\nimport { Circle } from 'lucide-react';\nimport React, { memo } from 'react';\n\nimport { ChartTooltipFrame } from '@/common/ChartTooltip/ChartTooltipFrame';\nimport { ScatterChartValueFormatter } from '@/types/charts';\nimport { defaultValueFormatter } from '@/utils';\n\nimport ScatterChartTooltipRow from './ScatterChartTooltipRow';\n\nconst styles = createStaticStyles(({ css }) => ({\n header: css`\n border-bottom: 1px solid ${cssVar.colorBorderSecondary};\n font-weight: 500;\n `,\n}));\n\nexport interface ScatterChartTooltipProps {\n active: boolean | undefined;\n axis: any;\n category?: string;\n categoryColors: Map<string, string>;\n customCategories?: {\n [key: string]: string;\n };\n label: string;\n payload: any;\n valueFormatter: ScatterChartValueFormatter;\n}\n\nconst ScatterChartTooltip = memo<ScatterChartTooltipProps>(\n ({\n customCategories,\n label,\n active,\n payload,\n valueFormatter,\n axis,\n category,\n categoryColors,\n }) => {\n const color = category\n ? (categoryColors.get(payload?.[0]?.payload[category]) ?? cssVar.colorPrimary)\n : cssVar.colorPrimary;\n if (active && payload) {\n return (\n <ChartTooltipFrame>\n <Flexbox\n align={'center'}\n className={cx(styles.header)}\n gap={8}\n horizontal\n paddingBlock={8}\n paddingInline={16}\n >\n <Icon color={color} fill={color} icon={Circle} size={10} />\n <Text ellipsis style={{ margin: 0 }}>\n {label}\n </Text>\n </Flexbox>\n <Flexbox gap={4} paddingBlock={8} paddingInline={16} style={{ marginTop: 4 }}>\n {payload.map(({ value, name }: { name: string; value: number }, idx: number) => {\n const valueFormatterKey = Object.keys(axis).find((key) => axis[key] === name) ?? '';\n const valueFormatterFn =\n valueFormatter[valueFormatterKey as keyof ScatterChartValueFormatter] ??\n defaultValueFormatter;\n return (\n <ScatterChartTooltipRow\n key={`id-${idx}`}\n name={customCategories?.[name] || name}\n value={valueFormatter && valueFormatterFn ? valueFormatterFn(value) : `${value}`}\n />\n );\n })}\n </Flexbox>\n </ChartTooltipFrame>\n );\n }\n return null;\n },\n);\n\nexport default ScatterChartTooltip;\n"],"mappings":";;;;;;;;AAUA,MAAM,SAAS,oBAAoB,EAAE,WAAW,EAC9C,QAAQ,GAAG;+BACkB,OAAO,qBAAqB;;IAG3D,EAAE;AAeF,MAAM,sBAAsB,MACzB,EACC,kBACA,OACA,QACA,SACA,gBACA,MACA,UACA,qBACI;CACJ,MAAM,QAAQ,WACT,eAAe,IAAI,UAAU,EAAE,EAAE,QAAQ,SAAS,KAAK,OAAO,eAC/D,OAAO;CACX,IAAI,UAAU,SACZ,OACE,qBAAC,mBAAD,EAAA,UAAA,CACE,qBAAC,SAAD;EACE,OAAO;EACP,WAAW,GAAG,OAAO,MAAM;EAC3B,KAAK;EACL,YAAA;EACA,cAAc;EACd,eAAe;EANjB,UAAA,CAQE,oBAAC,MAAD;GAAa;GAAO,MAAM;GAAO,MAAM;GAAQ,MAAM;EAAK,CAAA,GAC1D,oBAAC,MAAD;GAAM,UAAA;GAAS,OAAO,EAAE,QAAQ,EAAE;GAC/B,UAAA;EACG,CAAA,CACC;CACT,CAAA,GAAA,oBAAC,SAAD;EAAS,KAAK;EAAG,cAAc;EAAG,eAAe;EAAI,OAAO,EAAE,WAAW,EAAE;EACxE,UAAA,QAAQ,KAAK,EAAE,OAAO,QAAyC,QAAgB;GAE9E,MAAM,mBACJ,eAFwB,OAAO,KAAK,IAAI,CAAC,CAAC,MAAM,QAAQ,KAAK,SAAS,IAAI,KAAK,OAG/E;GACF,OACE,oBAACA,iBAAD;IAEE,MAAM,mBAAmB,SAAS;IAClC,OAAO,kBAAkB,mBAAmB,iBAAiB,KAAK,IAAI,GAAG;GAC1E,GAHM,MAAM,KAGZ;EAEL,CAAC;CACM,CAAA,CACQ,EAAA,CAAA;CAGvB,OAAO;AACT,CACF"}
@@ -1,6 +1,4 @@
1
- import { Flexbox } from "@lobehub/ui";
2
- import { Text } from "@lobehub/ui/base-ui";
3
- import { createStaticStyles, cssVar } from "antd-style";
1
+ import { Flexbox, Text, createStaticStyles, cssVar } from "@lobehub/ui";
4
2
  import { memo } from "react";
5
3
  import { jsx, jsxs } from "react/jsx-runtime";
6
4
  //#region src/ScatterChart/ScatterChartTooltipRow.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"ScatterChartTooltipRow.mjs","names":[],"sources":["../../src/ScatterChart/ScatterChartTooltipRow.tsx"],"sourcesContent":["import { Flexbox } from '@lobehub/ui';\nimport { Text } from '@lobehub/ui/base-ui';\nimport { createStaticStyles, cssVar } from 'antd-style';\nimport React, { memo } from 'react';\n\nconst styles = createStaticStyles(({ css }) => ({\n number: css`\n font-weight: 500;\n `,\n title: css`\n color: ${cssVar.colorTextSecondary};\n `,\n}));\n\nexport interface ChartTooltipRowProps {\n name: string;\n value: string;\n}\n\nconst ChartTooltipRow = memo<ChartTooltipRowProps>(({ value, name }) => {\n return (\n <Flexbox align={'center'} gap={32} horizontal justify={'space-between'}>\n <Text className={styles.title} ellipsis style={{ margin: 0 }}>\n {name}\n </Text>\n <Text className={styles.number} style={{ margin: 0 }}>\n {value}\n </Text>\n </Flexbox>\n );\n});\n\nexport default ChartTooltipRow;\n"],"mappings":";;;;;;AAKA,MAAM,SAAS,oBAAoB,EAAE,WAAW;CAC9C,QAAQ,GAAG;;;CAGX,OAAO,GAAG;aACC,OAAO,mBAAmB;;AAEvC,EAAE;AAOF,MAAM,kBAAkB,MAA4B,EAAE,OAAO,WAAW;CACtE,OACE,qBAAC,SAAD;EAAS,OAAO;EAAU,KAAK;EAAI,YAAA;EAAW,SAAS;EAAvD,UAAA,CACE,oBAAC,MAAD;GAAM,WAAW,OAAO;GAAO,UAAA;GAAS,OAAO,EAAE,QAAQ,EAAE;GACxD,UAAA;EACG,CAAA,GACN,oBAAC,MAAD;GAAM,WAAW,OAAO;GAAQ,OAAO,EAAE,QAAQ,EAAE;GAChD,UAAA;EACG,CAAA,CACC;;AAEb,CAAC"}
1
+ {"version":3,"file":"ScatterChartTooltipRow.mjs","names":[],"sources":["../../src/ScatterChart/ScatterChartTooltipRow.tsx"],"sourcesContent":["import { Flexbox, Text, createStaticStyles, cssVar } from '@lobehub/ui';\nimport React, { memo } from 'react';\n\nconst styles = createStaticStyles(({ css }) => ({\n number: css`\n font-weight: 500;\n `,\n title: css`\n color: ${cssVar.colorTextSecondary};\n `,\n}));\n\nexport interface ChartTooltipRowProps {\n name: string;\n value: string;\n}\n\nconst ChartTooltipRow = memo<ChartTooltipRowProps>(({ value, name }) => {\n return (\n <Flexbox align={'center'} gap={32} horizontal justify={'space-between'}>\n <Text className={styles.title} ellipsis style={{ margin: 0 }}>\n {name}\n </Text>\n <Text className={styles.number} style={{ margin: 0 }}>\n {value}\n </Text>\n </Flexbox>\n );\n});\n\nexport default ChartTooltipRow;\n"],"mappings":";;;;AAGA,MAAM,SAAS,oBAAoB,EAAE,WAAW;CAC9C,QAAQ,GAAG;;;CAGX,OAAO,GAAG;aACC,OAAO,mBAAmB;;AAEvC,EAAE;AAOF,MAAM,kBAAkB,MAA4B,EAAE,OAAO,WAAW;CACtE,OACE,qBAAC,SAAD;EAAS,OAAO;EAAU,KAAK;EAAI,YAAA;EAAW,SAAS;EAAvD,UAAA,CACE,oBAAC,MAAD;GAAM,WAAW,OAAO;GAAO,UAAA;GAAS,OAAO,EAAE,QAAQ,EAAE;GACxD,UAAA;EACG,CAAA,GACN,oBAAC,MAAD;GAAM,WAAW,OAAO;GAAQ,OAAO,EAAE,QAAQ,EAAE;GAChD,UAAA;EACG,CAAA,CACC;;AAEb,CAAC"}
@@ -9,9 +9,7 @@ import { getMaxLabelLength } from "../utils/getMaxLabelLength.mjs";
9
9
  import { renderShape } from "./renderShape.mjs";
10
10
  import ScatterChartTooltip from "./ScatterChartTooltip.mjs";
11
11
  import { styles } from "./styles.mjs";
12
- import { Flexbox } from "@lobehub/ui";
13
- import { Skeleton } from "@lobehub/ui/base-ui";
14
- import { css, cssVar, cx } from "antd-style";
12
+ import { Flexbox, Skeleton, css, cssVar, cx } from "@lobehub/ui";
15
13
  import { forwardRef, useMemo, useState } from "react";
16
14
  import { CartesianGrid, Label, Legend, ResponsiveContainer, Scatter, ScatterChart as ScatterChart$1, Tooltip as Tooltip$1, XAxis, YAxis, ZAxis } from "recharts";
17
15
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["ReChartsScatterChart","Tooltip"],"sources":["../../src/ScatterChart/index.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox } from '@lobehub/ui';\nimport { Skeleton } from '@lobehub/ui/base-ui';\nimport { css, cssVar, cx } from 'antd-style';\nimport { ComponentType, HTMLAttributes, MouseEvent, forwardRef, useMemo, useState } from 'react';\nimport {\n CartesianGrid,\n Label,\n Legend,\n ScatterChart as ReChartsScatterChart,\n ResponsiveContainer,\n Scatter,\n Tooltip,\n XAxis,\n YAxis,\n ZAxis,\n} from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport { renderShape } from '@/ScatterChart/renderShape';\nimport ChartLegend from '@/common/ChartLegend';\nimport { CustomTooltipProps } from '@/common/CustomTooltipProps';\nimport CustomYAxisTick from '@/common/CustomYAxisTick';\nimport {\n constructCategories,\n constructCategoryColors,\n deepEqual,\n getYAxisDomain,\n} from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport type { EventProps } from '@/types/charts';\nimport { IntervalType, ValueFormatter } from '@/types/charts';\nimport { defaultValueFormatter } from '@/utils';\nimport { getMaxLabelLength } from '@/utils/getMaxLabelLength';\n\nimport BaseAnimationTimingProps from '../common/BaseAnimationTimingProps';\nimport NoData, { type NoDataProps } from '../common/NoData';\nimport ScatterChartTooltip from './ScatterChartTooltip';\nimport { styles } from './styles';\n\nexport type ScatterChartValueFormatter = {\n size?: ValueFormatter;\n x?: ValueFormatter;\n y?: ValueFormatter;\n};\n\nexport interface ScatterChartProps\n extends BaseAnimationTimingProps, HTMLAttributes<HTMLDivElement> {\n allowDecimals?: boolean;\n autoMinXValue?: boolean;\n autoMinYValue?: boolean;\n category: string;\n colors?: string[];\n customCategories?: {\n [key: string]: string;\n };\n customTooltip?: ComponentType<CustomTooltipProps>;\n data: any[];\n enableLegendSlider?: boolean;\n intervalType?: IntervalType;\n loading?: boolean;\n maxXValue?: number;\n maxYValue?: number;\n minXValue?: number;\n minYValue?: number;\n noDataText?: NoDataProps['noDataText'];\n onValueChange?: (value: EventProps) => void;\n rotateLabelX?: {\n angle: number;\n verticalShift: number;\n xAxisHeight: number;\n };\n showGridLines?: boolean;\n showLegend?: boolean;\n showOpacity?: boolean;\n showTooltip?: boolean;\n showXAxis?: boolean;\n showYAxis?: boolean;\n size?: string;\n sizeRange?: number[];\n startEndOnly?: boolean;\n tickGap?: number;\n valueFormatter?: ScatterChartValueFormatter;\n x: string;\n xAxisLabel?: string;\n y: string;\n yAxisAlign?: 'left' | 'right';\n yAxisLabel?: string;\n yAxisWidth?: number;\n}\n\nconst ScatterChart = forwardRef<HTMLDivElement, ScatterChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n x,\n y,\n size,\n category,\n colors = themeColorRange,\n showOpacity = false,\n yAxisAlign = 'left',\n sizeRange = [1, 1000],\n valueFormatter = {\n size: defaultValueFormatter,\n x: defaultValueFormatter,\n y: defaultValueFormatter,\n },\n startEndOnly = false,\n showXAxis = true,\n showYAxis = true,\n yAxisWidth,\n intervalType = 'equidistantPreserveStart',\n animationDuration = 900,\n showAnimation = false,\n showTooltip = true,\n showLegend = true,\n loading,\n showGridLines = true,\n autoMinXValue = false,\n minXValue,\n maxXValue,\n autoMinYValue = false,\n minYValue,\n maxYValue,\n allowDecimals = true,\n noDataText,\n onValueChange,\n customTooltip,\n rotateLabelX,\n className,\n enableLegendSlider = false,\n tickGap = 5,\n xAxisLabel,\n yAxisLabel,\n width = '100%',\n height = 280,\n style,\n customCategories,\n ...rest\n } = props;\n\n const [legendHeight, setLegendHeight] = useState(60);\n const [activeNode, setActiveNode] = useState<any | undefined>();\n const [activeLegend, setActiveLegend] = useState<string | undefined>();\n const calculatedYAxisWidth: number | string = useMemo(() => {\n if (yAxisWidth) return yAxisWidth;\n return getMaxLabelLength({\n data,\n index: y,\n isScatterChart: true,\n margin: 0,\n valueFormatter: valueFormatter?.y,\n });\n }, [yAxisWidth, data, valueFormatter, y]);\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const CustomTooltip = customTooltip;\n const hasOnValueChange = !!onValueChange;\n\n const onNodeClick = (data: any, index: number, event: MouseEvent) => {\n event.stopPropagation();\n if (!hasOnValueChange) return;\n if (deepEqual(activeNode, data.node)) {\n setActiveLegend(undefined);\n setActiveNode(undefined);\n onValueChange?.(null);\n } else {\n setActiveNode(data.node);\n setActiveLegend(data.payload[category]);\n onValueChange?.({\n categoryClicked: data.payload[category],\n eventType: 'bubble',\n ...data.payload,\n });\n }\n };\n\n const onCategoryClick = (dataKey: string) => {\n if (!hasOnValueChange) return;\n if (dataKey === activeLegend && !activeNode) {\n setActiveLegend(undefined);\n onValueChange?.(null);\n } else {\n setActiveLegend(dataKey);\n onValueChange?.({\n categoryClicked: dataKey,\n eventType: 'category',\n });\n }\n setActiveNode(undefined);\n };\n\n const categories = constructCategories(data, category);\n const categoryColors = constructCategoryColors(categories, colors);\n\n //maybe rename getYAxisDomain to getAxisDomain\n const xAxisDomain = getYAxisDomain(autoMinXValue, minXValue, maxXValue);\n const yAxisDomain = getYAxisDomain(autoMinYValue, minYValue, maxYValue);\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsScatterChart\n margin={{\n bottom: xAxisLabel ? 20 : undefined,\n left: 20,\n right: 20,\n top: 5,\n }}\n onClick={\n hasOnValueChange && (activeLegend || activeNode)\n ? () => {\n setActiveNode(undefined);\n setActiveLegend(undefined);\n onValueChange?.(null);\n }\n : undefined\n }\n >\n {showGridLines ? (\n <CartesianGrid className={styles.gridLines} horizontal={true} vertical={true} />\n ) : null}\n {x ? (\n <XAxis\n allowDataOverflow={true}\n angle={rotateLabelX?.angle}\n axisLine={false}\n className={styles.label}\n dataKey={x}\n domain={xAxisDomain as AxisDomain}\n dy={rotateLabelX?.verticalShift}\n fill=\"\"\n hide={!showXAxis}\n interval={startEndOnly ? 'preserveStartEnd' : intervalType}\n minTickGap={tickGap}\n name={x}\n stroke=\"\"\n tick={{ transform: 'translate(0, 6)' }}\n tickFormatter={valueFormatter.x}\n tickLine={false}\n ticks={startEndOnly ? [data[0][x], data.at(-1)[x]] : undefined}\n type=\"number\"\n >\n {xAxisLabel && (\n <Label\n className={cx(styles.strongLabel, styles.emphasis)}\n offset={-20}\n position=\"insideBottom\"\n >\n {xAxisLabel}\n </Label>\n )}\n </XAxis>\n ) : null}\n {y ? (\n <YAxis\n allowDataOverflow={true}\n allowDecimals={allowDecimals}\n axisLine={false}\n className={styles.label}\n dataKey={y}\n domain={yAxisDomain as AxisDomain}\n fill=\"\"\n hide={!showYAxis}\n name={y}\n stroke=\"\"\n tick={(props) => (\n <CustomYAxisTick\n {...props}\n align={yAxisAlign}\n formatter={valueFormatter.y}\n textAnchor={yAxisAlign === 'left' ? 'start' : 'end'}\n yAxisLabel={Boolean(yAxisLabel)}\n />\n )}\n tickFormatter={valueFormatter.y}\n tickLine={false}\n type=\"number\"\n width={calculatedYAxisWidth}\n >\n {yAxisLabel && (\n <Label\n angle={-90}\n className={cx(styles.strongLabel, styles.emphasis)}\n offset={-15}\n position=\"insideLeft\"\n style={{ textAnchor: 'middle' }}\n >\n {yAxisLabel}\n </Label>\n )}\n </YAxis>\n ) : null}\n <Tooltip\n content={\n showTooltip\n ? ({ active, payload, label }) => {\n const color = category ? payload?.[0]?.payload?.[category] : label;\n return CustomTooltip ? (\n <CustomTooltip\n active={active}\n customCategories={customCategories}\n label={color}\n payload={payload?.map((payloadItem) => ({\n ...payloadItem,\n color: categoryColors.get(color) ?? cssVar.colorPrimary,\n }))}\n valueFormatter={valueFormatter}\n />\n ) : (\n <ScatterChartTooltip\n active={active}\n axis={{ size: size, x: x, y: y }}\n category={category}\n categoryColors={categoryColors}\n customCategories={customCategories}\n label={color}\n payload={payload}\n valueFormatter={valueFormatter}\n />\n );\n }\n : undefined\n }\n cursor={{ stroke: cssVar.colorTextSecondary, strokeWidth: 1 }}\n isAnimationActive={false}\n wrapperStyle={{ outline: 'none' }}\n />\n {size ? <ZAxis dataKey={size} name={size} range={sizeRange} type=\"number\" /> : null}\n {categories.map((cat) => {\n return (\n <Scatter\n animationDuration={animationDuration}\n className={cx(\n css`\n fill: ${categoryColors.get(cat) ?? cssVar.colorPrimary};\n `,\n showOpacity &&\n css`\n stroke: ${categoryColors.get(cat) ?? cssVar.colorPrimary};\n `,\n )}\n data={category ? data.filter((d) => d[category] === cat) : data}\n fill={`url(#${categoryColors.get(cat)})`}\n fillOpacity={showOpacity ? 0.7 : 1}\n isAnimationActive={showAnimation}\n key={cat}\n name={cat}\n onClick={onNodeClick}\n shape={(props: any) => renderShape(props, activeNode, activeLegend)}\n style={{\n cursor: onValueChange ? 'pointer' : undefined,\n }}\n />\n );\n })}\n {showLegend ? (\n <Legend\n content={({ payload }) =>\n ChartLegend(\n { payload },\n categoryColors,\n setLegendHeight,\n activeLegend,\n hasOnValueChange\n ? (clickedLegendItem: string) => onCategoryClick(clickedLegendItem)\n : undefined,\n enableLegendSlider,\n customCategories,\n )\n }\n height={legendHeight}\n verticalAlign=\"top\"\n />\n ) : undefined}\n </ReChartsScatterChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nScatterChart.displayName = 'ScatterChart';\n\nexport default ScatterChart;\n"],"mappings":";;;;;;;;;;;;;;;;;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AQ,OAAO;MAAoB,aAAa;KAAE;KAC5D,mBAAmB;KACnB,cAAc,EAAE,SAAS,OAAO;IACjC,CAAA;IACA,OAAO,oBAAC,OAAD;KAAO,SAAS;KAAM,MAAM;KAAM,OAAO;KAAW,MAAK;IAAU,CAAA,IAAI;IAC9E,WAAW,KAAK,QAAQ;KACvB,OACE,oBAAC,SAAD;MACqB;MACnB,WAAW,GACT,GAAG;8BACO,eAAe,IAAI,GAAG,KAAK,OAAO,aAAa;uBAEzD,eACE,GAAG;kCACS,eAAe,IAAI,GAAG,KAAK,OAAO,aAAa;uBAE/D;MACA,MAAM,WAAW,KAAK,QAAQ,MAAM,EAAE,cAAc,GAAG,IAAI;MAC3D,MAAM,QAAQ,eAAe,IAAI,GAAG,EAAE;MACtC,aAAa,cAAc,KAAM;MACjC,mBAAmB;MAEnB,MAAM;MACN,SAAS;MACT,QAAQ,UAAe,YAAY,OAAO,YAAY,YAAY;MAClE,OAAO,EACL,QAAQ,gBAAgB,YAAY,KAAA,EACtC;KACD,GAPM,GAON;IAEL,CAAC;IACA,aACC,oBAAC,QAAD;KACE,UAAU,EAAE,cACV,YACE,EAAE,QAAQ,GACV,gBACA,iBACA,cACA,oBACK,sBAA8B,gBAAgB,iBAAiB,IAChE,KAAA,GACJ,oBACA,gBACF;KAEF,QAAQ;KACR,eAAc;IACf,CAAA,IACC,KAAA;GACgB;EAEtB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,aAAa,cAAc"}
1
+ {"version":3,"file":"index.mjs","names":["ReChartsScatterChart","Tooltip"],"sources":["../../src/ScatterChart/index.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, Skeleton, css, cssVar, cx } from '@lobehub/ui';\nimport { ComponentType, HTMLAttributes, MouseEvent, forwardRef, useMemo, useState } from 'react';\nimport {\n CartesianGrid,\n Label,\n Legend,\n ScatterChart as ReChartsScatterChart,\n ResponsiveContainer,\n Scatter,\n Tooltip,\n XAxis,\n YAxis,\n ZAxis,\n} from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport { renderShape } from '@/ScatterChart/renderShape';\nimport ChartLegend from '@/common/ChartLegend';\nimport { CustomTooltipProps } from '@/common/CustomTooltipProps';\nimport CustomYAxisTick from '@/common/CustomYAxisTick';\nimport {\n constructCategories,\n constructCategoryColors,\n deepEqual,\n getYAxisDomain,\n} from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport type { EventProps } from '@/types/charts';\nimport { IntervalType, ValueFormatter } from '@/types/charts';\nimport { defaultValueFormatter } from '@/utils';\nimport { getMaxLabelLength } from '@/utils/getMaxLabelLength';\n\nimport BaseAnimationTimingProps from '../common/BaseAnimationTimingProps';\nimport NoData, { type NoDataProps } from '../common/NoData';\nimport ScatterChartTooltip from './ScatterChartTooltip';\nimport { styles } from './styles';\n\nexport type ScatterChartValueFormatter = {\n size?: ValueFormatter;\n x?: ValueFormatter;\n y?: ValueFormatter;\n};\n\nexport interface ScatterChartProps\n extends BaseAnimationTimingProps, HTMLAttributes<HTMLDivElement> {\n allowDecimals?: boolean;\n autoMinXValue?: boolean;\n autoMinYValue?: boolean;\n category: string;\n colors?: string[];\n customCategories?: {\n [key: string]: string;\n };\n customTooltip?: ComponentType<CustomTooltipProps>;\n data: any[];\n enableLegendSlider?: boolean;\n intervalType?: IntervalType;\n loading?: boolean;\n maxXValue?: number;\n maxYValue?: number;\n minXValue?: number;\n minYValue?: number;\n noDataText?: NoDataProps['noDataText'];\n onValueChange?: (value: EventProps) => void;\n rotateLabelX?: {\n angle: number;\n verticalShift: number;\n xAxisHeight: number;\n };\n showGridLines?: boolean;\n showLegend?: boolean;\n showOpacity?: boolean;\n showTooltip?: boolean;\n showXAxis?: boolean;\n showYAxis?: boolean;\n size?: string;\n sizeRange?: number[];\n startEndOnly?: boolean;\n tickGap?: number;\n valueFormatter?: ScatterChartValueFormatter;\n x: string;\n xAxisLabel?: string;\n y: string;\n yAxisAlign?: 'left' | 'right';\n yAxisLabel?: string;\n yAxisWidth?: number;\n}\n\nconst ScatterChart = forwardRef<HTMLDivElement, ScatterChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n x,\n y,\n size,\n category,\n colors = themeColorRange,\n showOpacity = false,\n yAxisAlign = 'left',\n sizeRange = [1, 1000],\n valueFormatter = {\n size: defaultValueFormatter,\n x: defaultValueFormatter,\n y: defaultValueFormatter,\n },\n startEndOnly = false,\n showXAxis = true,\n showYAxis = true,\n yAxisWidth,\n intervalType = 'equidistantPreserveStart',\n animationDuration = 900,\n showAnimation = false,\n showTooltip = true,\n showLegend = true,\n loading,\n showGridLines = true,\n autoMinXValue = false,\n minXValue,\n maxXValue,\n autoMinYValue = false,\n minYValue,\n maxYValue,\n allowDecimals = true,\n noDataText,\n onValueChange,\n customTooltip,\n rotateLabelX,\n className,\n enableLegendSlider = false,\n tickGap = 5,\n xAxisLabel,\n yAxisLabel,\n width = '100%',\n height = 280,\n style,\n customCategories,\n ...rest\n } = props;\n\n const [legendHeight, setLegendHeight] = useState(60);\n const [activeNode, setActiveNode] = useState<any | undefined>();\n const [activeLegend, setActiveLegend] = useState<string | undefined>();\n const calculatedYAxisWidth: number | string = useMemo(() => {\n if (yAxisWidth) return yAxisWidth;\n return getMaxLabelLength({\n data,\n index: y,\n isScatterChart: true,\n margin: 0,\n valueFormatter: valueFormatter?.y,\n });\n }, [yAxisWidth, data, valueFormatter, y]);\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const CustomTooltip = customTooltip;\n const hasOnValueChange = !!onValueChange;\n\n const onNodeClick = (data: any, index: number, event: MouseEvent) => {\n event.stopPropagation();\n if (!hasOnValueChange) return;\n if (deepEqual(activeNode, data.node)) {\n setActiveLegend(undefined);\n setActiveNode(undefined);\n onValueChange?.(null);\n } else {\n setActiveNode(data.node);\n setActiveLegend(data.payload[category]);\n onValueChange?.({\n categoryClicked: data.payload[category],\n eventType: 'bubble',\n ...data.payload,\n });\n }\n };\n\n const onCategoryClick = (dataKey: string) => {\n if (!hasOnValueChange) return;\n if (dataKey === activeLegend && !activeNode) {\n setActiveLegend(undefined);\n onValueChange?.(null);\n } else {\n setActiveLegend(dataKey);\n onValueChange?.({\n categoryClicked: dataKey,\n eventType: 'category',\n });\n }\n setActiveNode(undefined);\n };\n\n const categories = constructCategories(data, category);\n const categoryColors = constructCategoryColors(categories, colors);\n\n //maybe rename getYAxisDomain to getAxisDomain\n const xAxisDomain = getYAxisDomain(autoMinXValue, minXValue, maxXValue);\n const yAxisDomain = getYAxisDomain(autoMinYValue, minYValue, maxYValue);\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsScatterChart\n margin={{\n bottom: xAxisLabel ? 20 : undefined,\n left: 20,\n right: 20,\n top: 5,\n }}\n onClick={\n hasOnValueChange && (activeLegend || activeNode)\n ? () => {\n setActiveNode(undefined);\n setActiveLegend(undefined);\n onValueChange?.(null);\n }\n : undefined\n }\n >\n {showGridLines ? (\n <CartesianGrid className={styles.gridLines} horizontal={true} vertical={true} />\n ) : null}\n {x ? (\n <XAxis\n allowDataOverflow={true}\n angle={rotateLabelX?.angle}\n axisLine={false}\n className={styles.label}\n dataKey={x}\n domain={xAxisDomain as AxisDomain}\n dy={rotateLabelX?.verticalShift}\n fill=\"\"\n hide={!showXAxis}\n interval={startEndOnly ? 'preserveStartEnd' : intervalType}\n minTickGap={tickGap}\n name={x}\n stroke=\"\"\n tick={{ transform: 'translate(0, 6)' }}\n tickFormatter={valueFormatter.x}\n tickLine={false}\n ticks={startEndOnly ? [data[0][x], data.at(-1)[x]] : undefined}\n type=\"number\"\n >\n {xAxisLabel && (\n <Label\n className={cx(styles.strongLabel, styles.emphasis)}\n offset={-20}\n position=\"insideBottom\"\n >\n {xAxisLabel}\n </Label>\n )}\n </XAxis>\n ) : null}\n {y ? (\n <YAxis\n allowDataOverflow={true}\n allowDecimals={allowDecimals}\n axisLine={false}\n className={styles.label}\n dataKey={y}\n domain={yAxisDomain as AxisDomain}\n fill=\"\"\n hide={!showYAxis}\n name={y}\n stroke=\"\"\n tick={(props) => (\n <CustomYAxisTick\n {...props}\n align={yAxisAlign}\n formatter={valueFormatter.y}\n textAnchor={yAxisAlign === 'left' ? 'start' : 'end'}\n yAxisLabel={Boolean(yAxisLabel)}\n />\n )}\n tickFormatter={valueFormatter.y}\n tickLine={false}\n type=\"number\"\n width={calculatedYAxisWidth}\n >\n {yAxisLabel && (\n <Label\n angle={-90}\n className={cx(styles.strongLabel, styles.emphasis)}\n offset={-15}\n position=\"insideLeft\"\n style={{ textAnchor: 'middle' }}\n >\n {yAxisLabel}\n </Label>\n )}\n </YAxis>\n ) : null}\n <Tooltip\n content={\n showTooltip\n ? ({ active, payload, label }) => {\n const color = category ? payload?.[0]?.payload?.[category] : label;\n return CustomTooltip ? (\n <CustomTooltip\n active={active}\n customCategories={customCategories}\n label={color}\n payload={payload?.map((payloadItem) => ({\n ...payloadItem,\n color: categoryColors.get(color) ?? cssVar.colorPrimary,\n }))}\n valueFormatter={valueFormatter}\n />\n ) : (\n <ScatterChartTooltip\n active={active}\n axis={{ size: size, x: x, y: y }}\n category={category}\n categoryColors={categoryColors}\n customCategories={customCategories}\n label={color}\n payload={payload}\n valueFormatter={valueFormatter}\n />\n );\n }\n : undefined\n }\n cursor={{ stroke: cssVar.colorTextSecondary, strokeWidth: 1 }}\n isAnimationActive={false}\n wrapperStyle={{ outline: 'none' }}\n />\n {size ? <ZAxis dataKey={size} name={size} range={sizeRange} type=\"number\" /> : null}\n {categories.map((cat) => {\n return (\n <Scatter\n animationDuration={animationDuration}\n className={cx(\n css`\n fill: ${categoryColors.get(cat) ?? cssVar.colorPrimary};\n `,\n showOpacity &&\n css`\n stroke: ${categoryColors.get(cat) ?? cssVar.colorPrimary};\n `,\n )}\n data={category ? data.filter((d) => d[category] === cat) : data}\n fill={`url(#${categoryColors.get(cat)})`}\n fillOpacity={showOpacity ? 0.7 : 1}\n isAnimationActive={showAnimation}\n key={cat}\n name={cat}\n onClick={onNodeClick}\n shape={(props: any) => renderShape(props, activeNode, activeLegend)}\n style={{\n cursor: onValueChange ? 'pointer' : undefined,\n }}\n />\n );\n })}\n {showLegend ? (\n <Legend\n content={({ payload }) =>\n ChartLegend(\n { payload },\n categoryColors,\n setLegendHeight,\n activeLegend,\n hasOnValueChange\n ? (clickedLegendItem: string) => onCategoryClick(clickedLegendItem)\n : undefined,\n enableLegendSlider,\n customCategories,\n )\n }\n height={legendHeight}\n verticalAlign=\"top\"\n />\n ) : undefined}\n </ReChartsScatterChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nScatterChart.displayName = 'ScatterChart';\n\nexport default ScatterChart;\n"],"mappings":";;;;;;;;;;;;;;;;AA0FA,MAAM,eAAe,YAA+C,OAAO,QAAQ;CACjF,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,OAAO,CAAC,GACR,GACA,GACA,MACA,UACA,SAAS,iBACT,cAAc,OACd,aAAa,QACb,YAAY,CAAC,GAAG,GAAI,GACpB,iBAAiB;EACf,MAAM;EACN,GAAG;EACH,GAAG;CACL,GACA,eAAe,OACf,YAAY,MACZ,YAAY,MACZ,YACA,eAAe,4BACf,oBAAoB,KACpB,gBAAgB,OAChB,cAAc,MACd,aAAa,MACb,SACA,gBAAgB,MAChB,gBAAgB,OAChB,WACA,WACA,gBAAgB,OAChB,WACA,WACA,gBAAgB,MAChB,YACA,eACA,eACA,cACA,WACA,qBAAqB,OACrB,UAAU,GACV,YACA,YACA,QAAQ,QACR,SAAS,KACT,OACA,kBACA,GAAG,SACD;CAEJ,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CACnD,MAAM,CAAC,YAAY,iBAAiB,SAA0B;CAC9D,MAAM,CAAC,cAAc,mBAAmB,S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EL,CAAC;IACA,aACC,oBAAC,QAAD;KACE,UAAU,EAAE,cACV,YACE,EAAE,QAAQ,GACV,gBACA,iBACA,cACA,oBACK,sBAA8B,gBAAgB,iBAAiB,IAChE,KAAA,GACJ,oBACA,gBACF;KAEF,QAAQ;KACR,eAAc;IACf,CAAA,IACC,KAAA;GACgB;EAEtB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,aAAa,cAAc"}
@@ -1,4 +1,4 @@
1
- import { createStaticStyles } from "antd-style";
1
+ import { createStaticStyles } from "@lobehub/ui";
2
2
  //#region src/ScatterChart/styles.ts
3
3
  const styles = createStaticStyles(({ css, cssVar }) => ({
4
4
  emphasis: css`
@@ -1 +1 @@
1
- {"version":3,"file":"styles.mjs","names":[],"sources":["../../src/ScatterChart/styles.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n emphasis: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n gridLines: css`\n stroke: ${cssVar.colorBorderSecondary};\n stroke-width: 1;\n `,\n label: css`\n font-size: 12px;\n line-height: 16px;\n fill: ${cssVar.colorTextDescription};\n `,\n strongLabel: css`\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ${cssVar.colorTextSecondary};\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,UAAU,GAAG;;;;;CAKb,WAAW,GAAG;cACF,OAAO,qBAAqB;;;CAGxC,OAAO,GAAG;;;YAGA,OAAO,qBAAqB;;CAEtC,aAAa,GAAG;;;;YAIN,OAAO,mBAAmB;;AAEtC,EAAE"}
1
+ {"version":3,"file":"styles.mjs","names":[],"sources":["../../src/ScatterChart/styles.ts"],"sourcesContent":["import { createStaticStyles } from '@lobehub/ui';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n emphasis: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n gridLines: css`\n stroke: ${cssVar.colorBorderSecondary};\n stroke-width: 1;\n `,\n label: css`\n font-size: 12px;\n line-height: 16px;\n fill: ${cssVar.colorTextDescription};\n `,\n strongLabel: css`\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ${cssVar.colorTextSecondary};\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,UAAU,GAAG;;;;;CAKb,WAAW,GAAG;cACF,OAAO,qBAAqB;;;CAGxC,OAAO,GAAG;;;YAGA,OAAO,qBAAqB;;CAEtC,aAAa,GAAG;;;;YAIN,OAAO,mBAAmB;;AAEtC,EAAE"}
@@ -2,9 +2,7 @@
2
2
  import { useThemeColorRange } from "../hooks/useThemeColorRange.mjs";
3
3
  import NoData from "../common/NoData.mjs";
4
4
  import { constructCategoryColors, getYAxisDomain } from "../common/utils.mjs";
5
- import { Flexbox } from "@lobehub/ui";
6
- import { Skeleton } from "@lobehub/ui/base-ui";
7
- import { css, cssVar, cx } from "antd-style";
5
+ import { Flexbox, Skeleton, css, cssVar, cx } from "@lobehub/ui";
8
6
  import { forwardRef } from "react";
9
7
  import { Area, AreaChart, ResponsiveContainer, XAxis, YAxis } from "recharts";
10
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"SparkAreaChart.mjs","names":["ReChartsAreaChart"],"sources":["../../src/SparkChart/SparkAreaChart.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox } from '@lobehub/ui';\nimport { Skeleton } from '@lobehub/ui/base-ui';\nimport { css, cssVar, cx } from 'antd-style';\nimport { forwardRef } from 'react';\nimport { Area, AreaChart as ReChartsAreaChart, ResponsiveContainer, XAxis, YAxis } from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseSparkChartProps from '@/common/BaseSparkChartProps';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport { CurveType } from '@/types/charts';\n\nexport interface SparkAreaChartProps extends BaseSparkChartProps {\n connectNulls?: boolean;\n curveType?: CurveType;\n loading?: boolean;\n showGradient?: boolean;\n stack?: boolean;\n}\n\nconst SparkAreaChart = forwardRef<HTMLDivElement, SparkAreaChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n\n const {\n data = [],\n categories = [],\n index,\n stack = false,\n colors = themeColorRange,\n showAnimation = false,\n animationDuration = 900,\n showGradient = true,\n curveType = 'linear',\n connectNulls = false,\n noDataText = <div />,\n autoMinValue = false,\n loading,\n minValue,\n maxValue,\n className,\n width = 112,\n height = 48,\n style,\n ...rest\n } = props;\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const categoryColors = constructCategoryColors(categories, colors);\n const yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsAreaChart data={data} margin={{ bottom: 1, left: 1, right: 1, top: 1 }}>\n <YAxis domain={yAxisDomain as AxisDomain} hide />\n <XAxis dataKey={index} hide />\n {categories.map((category) => {\n return (\n <defs key={category}>\n {showGradient ? (\n <linearGradient\n className={cx(css`\n color: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n id={categoryColors.get(category)}\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"1\"\n >\n <stop offset=\"5%\" stopColor=\"currentColor\" stopOpacity={0.4} />\n <stop offset=\"95%\" stopColor=\"currentColor\" stopOpacity={0} />\n </linearGradient>\n ) : (\n <linearGradient\n className={cx(css`\n color: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n id={categoryColors.get(category)}\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"1\"\n >\n <stop stopColor=\"currentColor\" stopOpacity={0.3} />\n </linearGradient>\n )}\n </defs>\n );\n })}\n {categories.map((category) => (\n <Area\n animationDuration={animationDuration}\n className={cx(css`\n stroke: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n connectNulls={connectNulls}\n dataKey={category}\n dot={false}\n fill={`url(#${categoryColors.get(category)})`}\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stackId={stack ? 'a' : undefined}\n stroke=\"\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeOpacity={1}\n strokeWidth={2}\n type={curveType}\n />\n ))}\n </ReChartsAreaChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nSparkAreaChart.displayName = 'AreaChart';\n\nexport default SparkAreaChart;\n"],"mappings":";;;;;;;;;;;AAuBA,MAAM,iBAAiB,YAAiD,OAAO,QAAQ;CACrF,MAAM,kBAAkB,mBAAmB;CAE3C,MAAM,EACJ,OAAO,CAAC,GACR,aAAa,CAAC,GACd,OACA,QAAQ,OACR,SAAS,iBACT,gBAAgB,OAChB,oBAAoB,KACpB,eAAe,MACf,YAAY,UACZ,eAAe,OACf,aAAa,oBAAC,OAAD,CAAM,CAAA,GACnB,eAAe,OACf,SACA,UACA,UACA,WACA,QAAQ,KACR,SAAS,IACT,OACA,GAAG,SACD;CAEJ,IAAI,WAAW,CAAC,MAAM,OAAO,oBAAC,UAAD;EAAkB;EAAe;CAAQ,CAAA;CAEtE,MAAM,iBAAiB,wBAAwB,YAAY,MAAM;CACjE,MAAM,cAAc,eAAe,cAAc,UAAU,QAAQ;CAEnE,OACE,oBAAC,SAAD;EACa;EACH;EACH;EACL,OAAO;GAAE,UAAU;GAAY,GAAG;EAAM;EACjC;EACP,GAAI;EAEJ,UAAA,oBAAC,qBAAD,EAAA,UACG,MAAM,SACL,qBAACA,WAAD;GAAyB;GAAM,QAAQ;IAAE,QAAQ;IAAG,MAAM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A;CACd,CAAA;AAEb,CAAC;AAED,eAAe,cAAc"}
1
+ {"version":3,"file":"SparkAreaChart.mjs","names":["ReChartsAreaChart"],"sources":["../../src/SparkChart/SparkAreaChart.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, Skeleton, css, cssVar, cx } from '@lobehub/ui';\nimport { forwardRef } from 'react';\nimport { Area, AreaChart as ReChartsAreaChart, ResponsiveContainer, XAxis, YAxis } from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseSparkChartProps from '@/common/BaseSparkChartProps';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport { CurveType } from '@/types/charts';\n\nexport interface SparkAreaChartProps extends BaseSparkChartProps {\n connectNulls?: boolean;\n curveType?: CurveType;\n loading?: boolean;\n showGradient?: boolean;\n stack?: boolean;\n}\n\nconst SparkAreaChart = forwardRef<HTMLDivElement, SparkAreaChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n\n const {\n data = [],\n categories = [],\n index,\n stack = false,\n colors = themeColorRange,\n showAnimation = false,\n animationDuration = 900,\n showGradient = true,\n curveType = 'linear',\n connectNulls = false,\n noDataText = <div />,\n autoMinValue = false,\n loading,\n minValue,\n maxValue,\n className,\n width = 112,\n height = 48,\n style,\n ...rest\n } = props;\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const categoryColors = constructCategoryColors(categories, colors);\n const yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsAreaChart data={data} margin={{ bottom: 1, left: 1, right: 1, top: 1 }}>\n <YAxis domain={yAxisDomain as AxisDomain} hide />\n <XAxis dataKey={index} hide />\n {categories.map((category) => {\n return (\n <defs key={category}>\n {showGradient ? (\n <linearGradient\n className={cx(css`\n color: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n id={categoryColors.get(category)}\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"1\"\n >\n <stop offset=\"5%\" stopColor=\"currentColor\" stopOpacity={0.4} />\n <stop offset=\"95%\" stopColor=\"currentColor\" stopOpacity={0} />\n </linearGradient>\n ) : (\n <linearGradient\n className={cx(css`\n color: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n id={categoryColors.get(category)}\n x1=\"0\"\n x2=\"0\"\n y1=\"0\"\n y2=\"1\"\n >\n <stop stopColor=\"currentColor\" stopOpacity={0.3} />\n </linearGradient>\n )}\n </defs>\n );\n })}\n {categories.map((category) => (\n <Area\n animationDuration={animationDuration}\n className={cx(css`\n stroke: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n connectNulls={connectNulls}\n dataKey={category}\n dot={false}\n fill={`url(#${categoryColors.get(category)})`}\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stackId={stack ? 'a' : undefined}\n stroke=\"\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeOpacity={1}\n strokeWidth={2}\n type={curveType}\n />\n ))}\n </ReChartsAreaChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nSparkAreaChart.displayName = 'AreaChart';\n\nexport default SparkAreaChart;\n"],"mappings":";;;;;;;;;AAqBA,MAAM,iBAAiB,YAAiD,OAAO,QAAQ;CACrF,MAAM,kBAAkB,mBAAmB;CAE3C,MAAM,EACJ,OAAO,CAAC,GACR,aAAa,CAAC,GACd,OACA,QAAQ,OACR,SAAS,iBACT,gBAAgB,OAChB,oBAAoB,KACpB,eAAe,MACf,YAAY,UACZ,eAAe,OACf,aAAa,oBAAC,OAAD,CAAM,CAAA,GACnB,eAAe,OACf,SACA,UACA,UACA,WACA,QAAQ,KACR,SAAS,IACT,OACA,GAAG,SACD;CAEJ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B;KACnB,WAAW,GAAG,GAAG;4BACL,eAAe,IAAI,QAAQ,KAAK,OAAO,aAAa;iBAC/D;KACa;KACd,SAAS;KACT,KAAK;KACL,MAAM,QAAQ,eAAe,IAAI,QAAQ,EAAE;KAC3C,mBAAmB;KAEnB,MAAM;KACN,SAAS,QAAQ,MAAM,KAAA;KACvB,QAAO;KACP,eAAc;KACd,gBAAe;KACf,eAAe;KACf,aAAa;KACb,MAAM;IACP,GATM,QASN,CACF;GACgB;EAEnB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,eAAe,cAAc"}
@@ -2,9 +2,7 @@
2
2
  import { useThemeColorRange } from "../hooks/useThemeColorRange.mjs";
3
3
  import NoData from "../common/NoData.mjs";
4
4
  import { constructCategoryColors, getYAxisDomain } from "../common/utils.mjs";
5
- import { Flexbox } from "@lobehub/ui";
6
- import { Skeleton } from "@lobehub/ui/base-ui";
7
- import { css, cssVar, cx } from "antd-style";
5
+ import { Flexbox, Skeleton, css, cssVar, cx } from "@lobehub/ui";
8
6
  import { forwardRef } from "react";
9
7
  import { Bar, BarChart, ResponsiveContainer, XAxis, YAxis } from "recharts";
10
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"SparkBarChart.mjs","names":["ReChartsBarChart"],"sources":["../../src/SparkChart/SparkBarChart.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox } from '@lobehub/ui';\nimport { Skeleton } from '@lobehub/ui/base-ui';\nimport { css, cssVar, cx } from 'antd-style';\nimport { forwardRef } from 'react';\nimport { Bar, BarChart as ReChartsBarChart, ResponsiveContainer, XAxis, YAxis } from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseSparkChartProps from '@/common/BaseSparkChartProps';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\n\nexport interface SparkBarChartProps extends BaseSparkChartProps {\n loading?: boolean;\n relative?: boolean;\n stack?: boolean;\n}\n\nconst SparkBarChart = forwardRef<HTMLDivElement, SparkBarChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n categories = [],\n index,\n colors = themeColorRange,\n stack = false,\n relative = false,\n animationDuration = 900,\n showAnimation = false,\n noDataText = <div />,\n loading,\n autoMinValue = false,\n minValue,\n maxValue,\n className,\n width = 112,\n height = 48,\n style,\n ...rest\n } = props;\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const categoryColors = constructCategoryColors(categories, colors);\n const yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsBarChart\n data={data}\n margin={{ bottom: 0, left: -1.5, right: -1.5, top: 0 }}\n stackOffset={relative ? 'expand' : 'none'}\n >\n <YAxis domain={yAxisDomain as AxisDomain} hide />\n <XAxis dataKey={index} hide />\n {categories.map((category) => (\n <Bar\n animationDuration={animationDuration}\n className={cx(css`\n fill: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n dataKey={category}\n fill=\"\"\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stackId={stack || relative ? 'a' : undefined}\n type=\"linear\"\n />\n ))}\n </ReChartsBarChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nSparkBarChart.displayName = 'SparkBarChart';\n\nexport default SparkBarChart;\n"],"mappings":";;;;;;;;;;;AAoBA,MAAM,gBAAgB,YAAgD,OAAO,QAAQ;CACnF,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,OAAO,CAAC,GACR,aAAa,CAAC,GACd,OACA,SAAS,iBACT,QAAQ,OACR,WAAW,OACX,oBAAoB,KACpB,gBAAgB,OAChB,aAAa,oBAAC,OAAD,CAAM,CAAA,GACnB,SACA,eAAe,OACf,UACA,UACA,WACA,QAAQ,KACR,SAAS,IACT,OACA,GAAG,SACD;CAEJ,IAAI,WAAW,CAAC,MAAM,OAAO,oBAAC,UAAD;EAAkB;EAAe;CAAQ,CAAA;CAEtE,MAAM,iBAAiB,wBAAwB,YAAY,MAAM;CACjE,MAAM,cAAc,eAAe,cAAc,UAAU,QAAQ;CAEnE,OACE,oBAAC,SAAD;EACa;EACH;EACH;EACL,OAAO;GAAE,UAAU;GAAY,GAAG;EAAM;EACjC;EACP,GAAI;EAEJ,UAAA,oBAAC,qBAAD,EAAA,UACG,MAAM,SACL,qBAACA,UAAD;GACQ;GACN,QAAQ;IAAE,QAAQ;IAAG,MAAM;IAAM,OAAO;IAAM,KAAK;GAAE;GACrD,aAAa,WAAW,WAAW;GAHrC,UAAA;IAKE,oBAAC,OAAD;KAAO,QAAQ;KAA2B,MAAA;IAAM,CAAA;IAChD,oBAAC,OAAD;KAAO,SAAS;KAAO,MAAA;IAAM,CAAA;IAC5B,WAAW,KAAK,aACf,oBAAC,KAAD;KACqB;KACnB,WAAW,GAAG,GAAG;0BACP,eAAe,IAAI,QAAQ,KAAK,OAAO,aAAa;iBAC7D;KACD,SAAS;KACT,MAAK;KACL,mBAAmB;KAEnB,MAAM;KACN,SAAS,SAAS,WAAW,MAAM,KAAA;KACnC,MAAK;IACN,GAJM,QAIN,CACF;GACe;EAElB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,cAAc,cAAc"}
1
+ {"version":3,"file":"SparkBarChart.mjs","names":["ReChartsBarChart"],"sources":["../../src/SparkChart/SparkBarChart.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, Skeleton, css, cssVar, cx } from '@lobehub/ui';\nimport { forwardRef } from 'react';\nimport { Bar, BarChart as ReChartsBarChart, ResponsiveContainer, XAxis, YAxis } from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseSparkChartProps from '@/common/BaseSparkChartProps';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\n\nexport interface SparkBarChartProps extends BaseSparkChartProps {\n loading?: boolean;\n relative?: boolean;\n stack?: boolean;\n}\n\nconst SparkBarChart = forwardRef<HTMLDivElement, SparkBarChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n categories = [],\n index,\n colors = themeColorRange,\n stack = false,\n relative = false,\n animationDuration = 900,\n showAnimation = false,\n noDataText = <div />,\n loading,\n autoMinValue = false,\n minValue,\n maxValue,\n className,\n width = 112,\n height = 48,\n style,\n ...rest\n } = props;\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const categoryColors = constructCategoryColors(categories, colors);\n const yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsBarChart\n data={data}\n margin={{ bottom: 0, left: -1.5, right: -1.5, top: 0 }}\n stackOffset={relative ? 'expand' : 'none'}\n >\n <YAxis domain={yAxisDomain as AxisDomain} hide />\n <XAxis dataKey={index} hide />\n {categories.map((category) => (\n <Bar\n animationDuration={animationDuration}\n className={cx(css`\n fill: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n dataKey={category}\n fill=\"\"\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stackId={stack || relative ? 'a' : undefined}\n type=\"linear\"\n />\n ))}\n </ReChartsBarChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nSparkBarChart.displayName = 'SparkBarChart';\n\nexport default SparkBarChart;\n"],"mappings":";;;;;;;;;AAkBA,MAAM,gBAA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js";
3
3
  import NoData from "../common/NoData.mjs";
4
4
  import { constructCategoryColors, getYAxisDomain } from "../common/utils.mjs";
5
- import { Flexbox } from "@lobehub/ui";
6
- import { Skeleton } from "@lobehub/ui/base-ui";
7
- import { css, cssVar, cx } from "antd-style";
5
+ import { Flexbox, Skeleton, css, cssVar, cx } from "@lobehub/ui";
8
6
  import { forwardRef } from "react";
9
7
  import { Line, LineChart, ResponsiveContainer, XAxis, YAxis } from "recharts";
10
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -1 +1 @@
1
- {"version":3,"file":"SparkLineChart.mjs","names":["ReChartsLineChart"],"sources":["../../src/SparkChart/SparkLineChart.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox } from '@lobehub/ui';\nimport { Skeleton } from '@lobehub/ui/base-ui';\nimport { css, cssVar, cx } from 'antd-style';\nimport { forwardRef } from 'react';\nimport { Line, LineChart as ReChartsLineChart, ResponsiveContainer, XAxis, YAxis } from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseSparkChartProps from '@/common/BaseSparkChartProps';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport { CurveType } from '@/types/charts';\n\nexport interface SparkLineChartProps extends BaseSparkChartProps {\n connectNulls?: boolean;\n curveType?: CurveType;\n loading?: boolean;\n}\n\nconst SparkLineChart = forwardRef<HTMLDivElement, SparkLineChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n categories = [],\n index,\n colors = themeColorRange,\n animationDuration = 900,\n showAnimation = false,\n curveType = 'linear',\n connectNulls = false,\n noDataText = <div />,\n autoMinValue = false,\n minValue,\n maxValue,\n className,\n width = 112,\n height = 48,\n style,\n loading,\n ...rest\n } = props;\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const categoryColors = constructCategoryColors(categories, colors);\n const yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsLineChart data={data} margin={{ bottom: 1, left: 1, right: 1, top: 1 }}>\n <YAxis domain={yAxisDomain as AxisDomain} hide />\n <XAxis dataKey={index} hide />\n {categories.map((category) => (\n <Line\n animationDuration={animationDuration}\n className={cx(css`\n stroke: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n connectNulls={connectNulls}\n dataKey={category}\n dot={false}\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stroke=\"\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeOpacity={1}\n strokeWidth={2}\n type={curveType}\n />\n ))}\n </ReChartsLineChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nSparkLineChart.displayName = 'SparkLineChart';\n\nexport default SparkLineChart;\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,iBAAiB,YAAiD,OAAO,QAAQ;CACrF,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,OAAO,CAAC,GACR,aAAa,CAAC,GACd,OACA,SAAS,iBACT,oBAAoB,KACpB,gBAAgB,OAChB,YAAY,UACZ,eAAe,OACf,aAAa,oBAAC,OAAD,CAAM,CAAA,GACnB,eAAe,OACf,UACA,UACA,WACA,QAAQ,KACR,SAAS,IACT,OACA,SACA,GAAG,SACD;CAEJ,IAAI,WAAW,CAAC,MAAM,OAAO,oBAAC,UAAD;EAAkB;EAAe;CAAQ,CAAA;CAEtE,MAAM,iBAAiB,wBAAwB,YAAY,MAAM;CACjE,MAAM,cAAc,eAAe,cAAc,UAAU,QAAQ;CAEnE,OACE,oBAAC,SAAD;EACa;EACH;EACH;EACL,OAAO;GAAE,UAAU;GAAY,GAAG;EAAM;EACjC;EACP,GAAI;EAEJ,UAAA,oBAAC,qBAAD,EAAA,UACG,MAAM,SACL,qBAACA,WAAD;GAAyB;GAAM,QAAQ;IAAE,QAAQ;IAAG,MAAM;IAAG,OAAO;IAAG,KAAK;GAAE;GAA9E,UAAA;IACE,oBAAC,OAAD;KAAO,QAAQ;KAA2B,MAAA;IAAM,CAAA;IAChD,oBAAC,OAAD;KAAO,SAAS;KAAO,MAAA;IAAM,CAAA;IAC5B,WAAW,KAAK,aACf,oBAAC,MAAD;KACqB;KACnB,WAAW,GAAG,GAAG;4BACL,eAAe,IAAI,QAAQ,KAAK,OAAO,aAAa;iBAC/D;KACa;KACd,SAAS;KACT,KAAK;KACL,mBAAmB;KAEnB,MAAM;KACN,QAAO;KACP,eAAc;KACd,gBAAe;KACf,eAAe;KACf,aAAa;KACb,MAAM;IACP,GARM,QAQN,CACF;GACgB;EAEnB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,eAAe,cAAc"}
1
+ {"version":3,"file":"SparkLineChart.mjs","names":["ReChartsLineChart"],"sources":["../../src/SparkChart/SparkLineChart.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, Skeleton, css, cssVar, cx } from '@lobehub/ui';\nimport { forwardRef } from 'react';\nimport { Line, LineChart as ReChartsLineChart, ResponsiveContainer, XAxis, YAxis } from 'recharts';\nimport { AxisDomain } from 'recharts/types/util/types';\n\nimport BaseSparkChartProps from '@/common/BaseSparkChartProps';\nimport NoData from '@/common/NoData';\nimport { constructCategoryColors, getYAxisDomain } from '@/common/utils';\nimport { useThemeColorRange } from '@/hooks/useThemeColorRange';\nimport { CurveType } from '@/types/charts';\n\nexport interface SparkLineChartProps extends BaseSparkChartProps {\n connectNulls?: boolean;\n curveType?: CurveType;\n loading?: boolean;\n}\n\nconst SparkLineChart = forwardRef<HTMLDivElement, SparkLineChartProps>((props, ref) => {\n const themeColorRange = useThemeColorRange();\n const {\n data = [],\n categories = [],\n index,\n colors = themeColorRange,\n animationDuration = 900,\n showAnimation = false,\n curveType = 'linear',\n connectNulls = false,\n noDataText = <div />,\n autoMinValue = false,\n minValue,\n maxValue,\n className,\n width = 112,\n height = 48,\n style,\n loading,\n ...rest\n } = props;\n\n if (loading || !data) return <Skeleton height={height} width={width} />;\n\n const categoryColors = constructCategoryColors(categories, colors);\n const yAxisDomain = getYAxisDomain(autoMinValue, minValue, maxValue);\n\n return (\n <Flexbox\n className={className}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <ResponsiveContainer>\n {data?.length ? (\n <ReChartsLineChart data={data} margin={{ bottom: 1, left: 1, right: 1, top: 1 }}>\n <YAxis domain={yAxisDomain as AxisDomain} hide />\n <XAxis dataKey={index} hide />\n {categories.map((category) => (\n <Line\n animationDuration={animationDuration}\n className={cx(css`\n stroke: ${categoryColors.get(category) ?? cssVar.colorPrimary};\n `)}\n connectNulls={connectNulls}\n dataKey={category}\n dot={false}\n isAnimationActive={showAnimation}\n key={category}\n name={category}\n stroke=\"\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeOpacity={1}\n strokeWidth={2}\n type={curveType}\n />\n ))}\n </ReChartsLineChart>\n ) : (\n <NoData noDataText={noDataText} />\n )}\n </ResponsiveContainer>\n </Flexbox>\n );\n});\n\nSparkLineChart.displayName = 'SparkLineChart';\n\nexport default SparkLineChart;\n"],"mappings":";;;;;;;;;AAmBA,MAAM,iBAAiB,YAAiD,OAAO,QAAQ;CACrF,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,OAAO,CAAC,GACR,aAAa,CAAC,GACd,OACA,SAAS,iBACT,oBAAoB,KACpB,gBAAgB,OAChB,YAAY,UACZ,eAAe,OACf,aAAa,oBAAC,OAAD,CAAM,CAAA,GACnB,eAAe,OACf,UACA,UACA,WACA,QAAQ,KACR,SAAS,IACT,OACA,SACA,GAAG,SACD;CAEJ,IAAI,WAAW,CAAC,MAAM,OAAO,oBAAC,UAAD;EAAkB;EAAe;CAAQ,CAAA;CAEtE,MAAM,iBAAiB,wBAAwB,YAAY,MAAM;CACjE,MAAM,cAAc,eAAe,cAAc,UAAU,QAAQ;CAEnE,OACE,oBAAC,SAAD;EACa;EACH;EACH;EACL,OAAO;GAAE,UAAU;GAAY,GAAG;EAAM;EACjC;EACP,GAAI;EAEJ,UAAA,oBAAC,qBAAD,EAAA,UACG,MAAM,SACL,qBAACA,WAAD;GAAyB;GAAM,QAAQ;IAAE,QAAQ;IAAG,MAAM;IAAG,OAAO;IAAG,KAAK;GAAE;GAA9E,UAAA;IACE,oBAAC,OAAD;KAAO,QAAQ;KAA2B,MAAA;IAAM,CAAA;IAChD,oBAAC,OAAD;KAAO,SAAS;KAAO,MAAA;IAAM,CAAA;IAC5B,WAAW,KAAK,aACf,oBAAC,MAAD;KACqB;KACnB,WAAW,GAAG,GAAG;4BACL,eAAe,IAAI,QAAQ,KAAK,OAAO,aAAa;iBAC/D;KACa;KACd,SAAS;KACT,KAAK;KACL,mBAAmB;KAEnB,MAAM;KACN,QAAO;KACP,eAAc;KACd,gBAAe;KACf,eAAe;KACf,aAAa;KACb,MAAM;IACP,GARM,QAQN,CACF;GACgB;EAEnB,CAAA,IAAA,oBAAC,QAAD,EAAoB,WAAa,CAAA,EAEhB,CAAA;CACd,CAAA;AAEb,CAAC;AAED,eAAe,cAAc"}
@@ -1,7 +1,5 @@
1
1
  "use client";
2
- import { Flexbox } from "@lobehub/ui";
3
- import { Tooltip } from "@lobehub/ui/base-ui";
4
- import { createStaticStyles, cssVar } from "antd-style";
2
+ import { Flexbox, Tooltip, createStaticStyles, cssVar } from "@lobehub/ui";
5
3
  import { forwardRef, useMemo } from "react";
6
4
  import { jsx } from "react/jsx-runtime";
7
5
  //#region src/Tracker/TrackerBlock.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"TrackerBlock.mjs","names":[],"sources":["../../src/Tracker/TrackerBlock.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, FlexboxProps } from '@lobehub/ui';\nimport { Tooltip } from '@lobehub/ui/base-ui';\nimport { createStaticStyles, cssVar } from 'antd-style';\nimport { ReactNode, forwardRef, useMemo } from 'react';\n\nconst styles = createStaticStyles(({ css }) => ({\n block: css`\n background: ${cssVar.colorFill};\n\n &:first-child {\n border-top-left-radius: ${cssVar.borderRadiusSM};\n border-bottom-left-radius: ${cssVar.borderRadiusSM};\n }\n\n &:last-child {\n border-top-right-radius: ${cssVar.borderRadiusSM};\n border-bottom-right-radius: ${cssVar.borderRadiusSM};\n }\n\n &:hover {\n opacity: 0.5;\n }\n `,\n}));\n\nexport interface TrackerBlockProps {\n color?: 'success' | 'warning' | 'error' | string;\n key?: string | number;\n tooltip?: ReactNode;\n}\n\nconst TrackerBlock = forwardRef<HTMLDivElement, TrackerBlockProps & FlexboxProps>(\n ({ color, tooltip, width, style, ...rest }, ref) => {\n const blockColor = useMemo(() => {\n switch (color) {\n case 'success': {\n return cssVar.colorSuccess;\n }\n case 'warning': {\n return cssVar.colorWarning;\n }\n case 'error': {\n return cssVar.colorError;\n }\n default: {\n return color;\n }\n }\n }, [color]);\n\n return (\n <Tooltip title={tooltip}>\n <Flexbox\n className={styles.block}\n height={'100%'}\n ref={ref}\n style={{ background: blockColor, ...style }}\n width={width || '100%'}\n {...rest}\n />\n </Tooltip>\n );\n },\n);\n\nexport default TrackerBlock;\n"],"mappings":";;;;;;;AAOA,MAAM,SAAS,oBAAoB,EAAE,WAAW,EAC9C,OAAO,GAAG;kBACM,OAAO,UAAU;;;gCAGH,OAAO,eAAe;mCACnB,OAAO,eAAe;;;;iCAIxB,OAAO,eAAe;oCACnB,OAAO,eAAe;;;;;;IAO1D,EAAE;AAQF,MAAM,eAAe,YAClB,EAAE,OAAO,SAAS,OAAO,OAAO,GAAG,QAAQ,QAAQ;CAClD,MAAM,aAAa,cAAc;EAC/B,QAAQ,OAAR;GACE,KAAK,WACH,OAAO,OAAO;GAEhB,KAAK,WACH,OAAO,OAAO;GAEhB,KAAK,SACH,OAAO,OAAO;GAEhB,SACE,OAAO;EAEX;CACF,GAAG,CAAC,KAAK,CAAC;CAEV,OACE,oBAAC,SAAD;EAAS,OAAO;EACd,UAAA,oBAAC,SAAD;GACE,WAAW,OAAO;GAClB,QAAQ;GACH;GACL,OAAO;IAAE,YAAY;IAAY,GAAG;GAAM;GAC1C,OAAO,SAAS;GAChB,GAAI;EACL,CAAA;CACM,CAAA;AAEb,CACF"}
1
+ {"version":3,"file":"TrackerBlock.mjs","names":[],"sources":["../../src/Tracker/TrackerBlock.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, FlexboxProps, Tooltip, createStaticStyles, cssVar } from '@lobehub/ui';\nimport { ReactNode, forwardRef, useMemo } from 'react';\n\nconst styles = createStaticStyles(({ css }) => ({\n block: css`\n background: ${cssVar.colorFill};\n\n &:first-child {\n border-top-left-radius: ${cssVar.borderRadiusSM};\n border-bottom-left-radius: ${cssVar.borderRadiusSM};\n }\n\n &:last-child {\n border-top-right-radius: ${cssVar.borderRadiusSM};\n border-bottom-right-radius: ${cssVar.borderRadiusSM};\n }\n\n &:hover {\n opacity: 0.5;\n }\n `,\n}));\n\nexport interface TrackerBlockProps {\n color?: 'success' | 'warning' | 'error' | string;\n key?: string | number;\n tooltip?: ReactNode;\n}\n\nconst TrackerBlock = forwardRef<HTMLDivElement, TrackerBlockProps & FlexboxProps>(\n ({ color, tooltip, width, style, ...rest }, ref) => {\n const blockColor = useMemo(() => {\n switch (color) {\n case 'success': {\n return cssVar.colorSuccess;\n }\n case 'warning': {\n return cssVar.colorWarning;\n }\n case 'error': {\n return cssVar.colorError;\n }\n default: {\n return color;\n }\n }\n }, [color]);\n\n return (\n <Tooltip title={tooltip}>\n <Flexbox\n className={styles.block}\n height={'100%'}\n ref={ref}\n style={{ background: blockColor, ...style }}\n width={width || '100%'}\n {...rest}\n />\n </Tooltip>\n );\n },\n);\n\nexport default TrackerBlock;\n"],"mappings":";;;;;AAKA,MAAM,SAAS,oBAAoB,EAAE,WAAW,EAC9C,OAAO,GAAG;kBACM,OAAO,UAAU;;;gCAGH,OAAO,eAAe;mCACnB,OAAO,eAAe;;;;iCAIxB,OAAO,eAAe;oCACnB,OAAO,eAAe;;;;;;IAO1D,EAAE;AAQF,MAAM,eAAe,YAClB,EAAE,OAAO,SAAS,OAAO,OAAO,GAAG,QAAQ,QAAQ;CAClD,MAAM,aAAa,cAAc;EAC/B,QAAQ,OAAR;GACE,KAAK,WACH,OAAO,OAAO;GAEhB,KAAK,WACH,OAAO,OAAO;GAEhB,KAAK,SACH,OAAO,OAAO;GAEhB,SACE,OAAO;EAEX;CACF,GAAG,CAAC,KAAK,CAAC;CAEV,OACE,oBAAC,SAAD;EAAS,OAAO;EACd,UAAA,oBAAC,SAAD;GACE,WAAW,OAAO;GAClB,QAAQ;GACH;GACL,OAAO;IAAE,YAAY;IAAY,GAAG;GAAM;GAC1C,OAAO,SAAS;GAChB,GAAI;EACL,CAAA;CACM,CAAA;AAEb,CACF"}
@@ -1,9 +1,7 @@
1
1
  "use client";
2
2
  import TrackerBlock from "./TrackerBlock.mjs";
3
3
  import { styles } from "./styles.mjs";
4
- import { Flexbox } from "@lobehub/ui";
5
- import { TooltipGroup } from "@lobehub/ui/base-ui";
6
- import { cx } from "antd-style";
4
+ import { Flexbox, TooltipGroup, cx } from "@lobehub/ui";
7
5
  import { forwardRef } from "react";
8
6
  import { jsx, jsxs } from "react/jsx-runtime";
9
7
  //#region src/Tracker/index.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/Tracker/index.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, FlexboxProps } from '@lobehub/ui';\nimport { TooltipGroup } from '@lobehub/ui/base-ui';\nimport { cx } from 'antd-style';\nimport { ReactNode, forwardRef } from 'react';\n\nimport TrackerBlock, { TrackerBlockProps } from './TrackerBlock';\nimport { styles } from './styles';\n\ninterface DataItem extends TrackerBlockProps {\n [key: string]: any;\n}\n\nexport interface TrackerProps extends FlexboxProps {\n blockGap?: number | string;\n blockHeight?: number | string;\n blockWidth?: number | string;\n customTooltip?: (payload: DataItem) => ReactNode;\n data: DataItem[];\n leftLabel?: ReactNode;\n onValueChange?: (payload: DataItem) => void;\n rightLabel?: ReactNode;\n}\n\nconst Tracker = forwardRef<HTMLDivElement, TrackerProps>((props, ref) => {\n const {\n data = [],\n className,\n height,\n width = 'fit-content',\n blockWidth = 12,\n blockHeight = 40,\n blockGap = 4,\n customTooltip,\n onValueChange,\n leftLabel,\n rightLabel,\n style,\n ...rest\n } = props;\n\n const content = (\n <TooltipGroup>\n {data.map((item, idx) => (\n <TrackerBlock\n color={item.color}\n height={blockHeight}\n key={item.key ?? idx}\n onClick={() => onValueChange?.(item)}\n style={{\n cursor: onValueChange ? 'pointer' : 'default',\n }}\n tooltip={customTooltip ? customTooltip(item) : item.tooltip}\n width={blockWidth}\n />\n ))}\n </TooltipGroup>\n );\n\n if (leftLabel || rightLabel) {\n return (\n <Flexbox\n className={className}\n gap={8}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <Flexbox align={'center'} horizontal justify={'space-between'} width={'100%'}>\n <div className={cx(styles.strongLabel, styles.emphasis)}>{leftLabel}</div>\n <div className={cx(styles.label, styles.emphasis)} style={{ textAlign: 'right' }}>\n {rightLabel}\n </div>\n </Flexbox>\n <Flexbox align={'center'} gap={blockGap} height={blockHeight} horizontal width={'100%'}>\n {content}\n </Flexbox>\n </Flexbox>\n );\n }\n\n return (\n <Flexbox\n align={'center'}\n className={className}\n gap={blockGap}\n height={height || blockHeight}\n horizontal\n ref={ref}\n width={width}\n {...rest}\n >\n {content}\n </Flexbox>\n );\n});\n\nTracker.displayName = 'Tracker';\n\nexport default Tracker;\n"],"mappings":";;;;;;;;;AAyBA,MAAM,UAAU,YAA0C,OAAO,QAAQ;CACvE,MAAM,EACJ,OAAO,CAAC,GACR,WACA,QACA,QAAQ,eACR,aAAa,IACb,cAAc,IACd,WAAW,GACX,eACA,eACA,WACA,YACA,OACA,GAAG,SACD;CAEJ,MAAM,UACJ,oBAAC,cAAD,EAAA,UACG,KAAK,KAAK,MAAM,QACf,oBAAC,cAAD;EACE,OAAO,KAAK;EACZ,QAAQ;EAER,eAAe,gBAAgB,IAAI;EACnC,OAAO,EACL,QAAQ,gBAAgB,YAAY,UACtC;EACA,SAAS,gBAAgB,cAAc,IAAI,IAAI,KAAK;EACpD,OAAO;CACR,GAPM,KAAK,OAAO,GAOlB,CACF,EACW,CAAA;CAGhB,IAAI,aAAa,YACf,OACE,qBAAC,SAAD;EACa;EACX,KAAK;EACG;EACH;EACL,OAAO;GAAE,UAAU;GAAY,GAAG;EAAM;EACjC;EACP,GAAI;EAPN,UAAA,CASE,qBAAC,SAAD;GAAS,OAAO;GAAU,YAAA;GAAW,SAAS;GAAiB,OAAO;GAAtE,UAAA,CACE,oBAAC,OAAD;IAAK,WAAW,GAAG,OAAO,aAAa,OAAO,QAAQ;IAAI,UAAA;GAAe,CAAA,GACzE,oBAAC,OAAD;IAAK,WAAW,GAAG,OAAO,OAAO,OAAO,QAAQ;IAAG,OAAO,EAAE,WAAW,QAAQ;IAC5E,UAAA;GACE,CAAA,CACE;EACT,CAAA,GAAA,oBAAC,SAAD;GAAS,OAAO;GAAU,KAAK;GAAU,QAAQ;GAAa,YAAA;GAAW,OAAO;GAC7E,UAAA;EACM,CAAA,CACF;;CAIb,OACE,oBAAC,SAAD;EACE,OAAO;EACI;EACX,KAAK;EACL,QAAQ,UAAU;EAClB,YAAA;EACK;EACE;EACP,GAAI;EAEH,UAAA;CACM,CAAA;AAEb,CAAC;AAED,QAAQ,cAAc"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/Tracker/index.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox, FlexboxProps, TooltipGroup, cx } from '@lobehub/ui';\nimport { ReactNode, forwardRef } from 'react';\n\nimport TrackerBlock, { TrackerBlockProps } from './TrackerBlock';\nimport { styles } from './styles';\n\ninterface DataItem extends TrackerBlockProps {\n [key: string]: any;\n}\n\nexport interface TrackerProps extends FlexboxProps {\n blockGap?: number | string;\n blockHeight?: number | string;\n blockWidth?: number | string;\n customTooltip?: (payload: DataItem) => ReactNode;\n data: DataItem[];\n leftLabel?: ReactNode;\n onValueChange?: (payload: DataItem) => void;\n rightLabel?: ReactNode;\n}\n\nconst Tracker = forwardRef<HTMLDivElement, TrackerProps>((props, ref) => {\n const {\n data = [],\n className,\n height,\n width = 'fit-content',\n blockWidth = 12,\n blockHeight = 40,\n blockGap = 4,\n customTooltip,\n onValueChange,\n leftLabel,\n rightLabel,\n style,\n ...rest\n } = props;\n\n const content = (\n <TooltipGroup>\n {data.map((item, idx) => (\n <TrackerBlock\n color={item.color}\n height={blockHeight}\n key={item.key ?? idx}\n onClick={() => onValueChange?.(item)}\n style={{\n cursor: onValueChange ? 'pointer' : 'default',\n }}\n tooltip={customTooltip ? customTooltip(item) : item.tooltip}\n width={blockWidth}\n />\n ))}\n </TooltipGroup>\n );\n\n if (leftLabel || rightLabel) {\n return (\n <Flexbox\n className={className}\n gap={8}\n height={height}\n ref={ref}\n style={{ position: 'relative', ...style }}\n width={width}\n {...rest}\n >\n <Flexbox align={'center'} horizontal justify={'space-between'} width={'100%'}>\n <div className={cx(styles.strongLabel, styles.emphasis)}>{leftLabel}</div>\n <div className={cx(styles.label, styles.emphasis)} style={{ textAlign: 'right' }}>\n {rightLabel}\n </div>\n </Flexbox>\n <Flexbox align={'center'} gap={blockGap} height={blockHeight} horizontal width={'100%'}>\n {content}\n </Flexbox>\n </Flexbox>\n );\n }\n\n return (\n <Flexbox\n align={'center'}\n className={className}\n gap={blockGap}\n height={height || blockHeight}\n horizontal\n ref={ref}\n width={width}\n {...rest}\n >\n {content}\n </Flexbox>\n );\n});\n\nTracker.displayName = 'Tracker';\n\nexport default Tracker;\n"],"mappings":";;;;;;;AAuBA,MAAM,UAAU,YAA0C,OAAO,QAAQ;CACvE,MAAM,EACJ,OAAO,CAAC,GACR,WACA,QACA,QAAQ,eACR,aAAa,IACb,cAAc,IACd,WAAW,GACX,eACA,eACA,WACA,YACA,OACA,GAAG,SACD;CAEJ,MAAM,UACJ,oBAAC,cAAD,EAAA,UACG,KAAK,KAAK,MAAM,QACf,oBAAC,cAAD;EACE,OAAO,KAAK;EACZ,QAAQ;EAER,eAAe,gBAAgB,IAAI;EACnC,OAAO,EACL,QAAQ,gBAAgB,YAAY,UACtC;EACA,SAAS,gBAAgB,cAAc,IAAI,IAAI,KAAK;EACpD,OAAO;CACR,GAPM,KAAK,OAAO,GAOlB,CACF,EACW,CAAA;CAGhB,IAAI,aAAa,YACf,OACE,qBAAC,SAAD;EACa;EACX,KAAK;EACG;EACH;EACL,OAAO;GAAE,UAAU;GAAY,GAAG;EAAM;EACjC;EACP,GAAI;EAPN,UAAA,CASE,qBAAC,SAAD;GAAS,OAAO;GAAU,YAAA;GAAW,SAAS;GAAiB,OAAO;GAAtE,UAAA,CACE,oBAAC,OAAD;IAAK,WAAW,GAAG,OAAO,aAAa,OAAO,QAAQ;IAAI,UAAA;GAAe,CAAA,GACzE,oBAAC,OAAD;IAAK,WAAW,GAAG,OAAO,OAAO,OAAO,QAAQ;IAAG,OAAO,EAAE,WAAW,QAAQ;IAC5E,UAAA;GACE,CAAA,CACE;EACT,CAAA,GAAA,oBAAC,SAAD;GAAS,OAAO;GAAU,KAAK;GAAU,QAAQ;GAAa,YAAA;GAAW,OAAO;GAC7E,UAAA;EACM,CAAA,CACF;;CAIb,OACE,oBAAC,SAAD;EACE,OAAO;EACI;EACX,KAAK;EACL,QAAQ,UAAU;EAClB,YAAA;EACK;EACE;EACP,GAAI;EAEH,UAAA;CACM,CAAA;AAEb,CAAC;AAED,QAAQ,cAAc"}
@@ -1,4 +1,4 @@
1
- import { createStaticStyles } from "antd-style";
1
+ import { createStaticStyles } from "@lobehub/ui";
2
2
  //#region src/Tracker/styles.ts
3
3
  const styles = createStaticStyles(({ css, cssVar }) => ({
4
4
  emphasis: css`
@@ -1 +1 @@
1
- {"version":3,"file":"styles.mjs","names":[],"sources":["../../src/Tracker/styles.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n emphasis: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n label: css`\n font-size: 12px;\n line-height: 16px;\n color: ${cssVar.colorTextDescription};\n `,\n strongLabel: css`\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ${cssVar.colorTextSecondary};\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,UAAU,GAAG;;;;;CAKb,OAAO,GAAG;;;aAGC,OAAO,qBAAqB;;CAEvC,aAAa,GAAG;;;;YAIN,OAAO,mBAAmB;;AAEtC,EAAE"}
1
+ {"version":3,"file":"styles.mjs","names":[],"sources":["../../src/Tracker/styles.ts"],"sourcesContent":["import { createStaticStyles } from '@lobehub/ui';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n emphasis: css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n label: css`\n font-size: 12px;\n line-height: 16px;\n color: ${cssVar.colorTextDescription};\n `,\n strongLabel: css`\n font-size: 12px;\n font-weight: 500;\n line-height: 16px;\n fill: ${cssVar.colorTextSecondary};\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,UAAU,GAAG;;;;;CAKb,OAAO,GAAG;;;aAGC,OAAO,qBAAqB;;CAEvC,aAAa,GAAG;;;;YAIN,OAAO,mBAAmB;;AAEtC,EAAE"}
@@ -1,5 +1,4 @@
1
- import { Flexbox } from "@lobehub/ui";
2
- import { createStaticStyles } from "antd-style";
1
+ import { Flexbox, createStaticStyles } from "@lobehub/ui";
3
2
  import { memo } from "react";
4
3
  import { jsx } from "react/jsx-runtime";
5
4
  //#region src/common/ChartTooltip/ChartTooltipFrame.tsx