From 6125b2821f73d7f74f05a9b6f270ac54a51ca654 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 16 Oct 2026 08:55:33 +0000 Subject: [PATCH 1/5] feat(apollo-vertex): update chart for Recharts 3 Pull the current shadcn new-york-v4 chart, which types tooltip content with DefaultTooltipContentProps and legend content with DefaultLegendContentProps. Pin recharts to 3.8.0 to match that component. --- packages/apollo-vertex/package.json | 4 +- packages/apollo-vertex/registry.json | 2 +- .../apollo-vertex/registry/chart/chart.tsx | 140 +++++++++++------ pnpm-lock.yaml | 148 ++++++++++++++++-- 4 files changed, 232 insertions(+), 62 deletions(-) diff --git a/packages/apollo-vertex/package.json b/packages/apollo-vertex/package.json index 52def91279..d8c1dc879d 100644 --- a/packages/apollo-vertex/package.json +++ b/packages/apollo-vertex/package.json @@ -112,7 +112,7 @@ "react-error-boundary": "^6.0.0", "react-i18next": "^16.5.4 || ^17.0.0", "react-markdown": "^10.1.0", - "recharts": "^2.15.4", + "recharts": "^3.8.0", "remark-breaks": "^4.0.0", "remark-gfm": "^4.0.1", "tailwindcss": "^4.0.0" @@ -160,7 +160,7 @@ "react-error-boundary": "^6.0.0", "react-i18next": "^17.0.15", "react-markdown": "^10.1.0", - "recharts": "2.15.4", + "recharts": "3.8.0", "remark-breaks": "^4.0.0", "remark-gfm": "^4.0.1", "tailwindcss": "^4.1.17", diff --git a/packages/apollo-vertex/registry.json b/packages/apollo-vertex/registry.json index f211814906..a73ef6c403 100644 --- a/packages/apollo-vertex/registry.json +++ b/packages/apollo-vertex/registry.json @@ -1723,7 +1723,7 @@ "type": "registry:ui", "title": "Chart", "description": "Beautiful charts using Recharts with consistent theming.", - "dependencies": ["recharts@2.15.4", "lucide-react"], + "dependencies": ["recharts@3.8.0", "lucide-react"], "files": [{ "path": "registry/chart/chart.tsx", "type": "registry:ui" }] }, { diff --git a/packages/apollo-vertex/registry/chart/chart.tsx b/packages/apollo-vertex/registry/chart/chart.tsx index 044390d0e1..934025d6f8 100644 --- a/packages/apollo-vertex/registry/chart/chart.tsx +++ b/packages/apollo-vertex/registry/chart/chart.tsx @@ -7,16 +7,23 @@ import { cn } from "@/lib/utils"; // Format: { THEME_NAME: CSS_SELECTOR } const THEMES = { light: "", dark: ".dark" } as const; +const THEME_SELECTORS: Array<[keyof typeof THEMES, string]> = [ + ["light", THEMES.light], + ["dark", THEMES.dark], +]; -export type ChartConfig = { - [k in string]: { +const INITIAL_DIMENSION = { width: 320, height: 200 } as const; + +export type ChartConfig = Record< + string, + { label?: React.ReactNode; icon?: React.ComponentType; } & ( | { color?: string; theme?: never } | { color?: never; theme: Record } - ); -}; + ) +>; type ChartContextProps = { config: ChartConfig; @@ -39,12 +46,17 @@ function ChartContainer({ className, children, config, + initialDimension = INITIAL_DIMENSION, ...props }: React.ComponentProps<"div"> & { config: ChartConfig; children: React.ComponentProps< typeof RechartsPrimitive.ResponsiveContainer >["children"]; + initialDimension?: { + width: number; + height: number; + }; }) { const uniqueId = React.useId(); const chartId = `chart-${id ?? uniqueId.replaceAll(":", "")}`; @@ -55,13 +67,15 @@ function ChartContainer({ data-slot="chart" data-chart={chartId} className={cn( - "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", + "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden", className, )} {...props} > - + {children} @@ -82,10 +96,8 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {