The Open Standard for Generative UI
Enhance ChartContainer styling by allowing custom styles to be passed through props. Updated the style object to merge existing theme variables with any additional styles provided, improving flexibility in chart component customization. (#181)
Ankit Dascfe046877f29
diff --git a/js/packages/react-ui/src/components/Charts/Charts.tsx b/js/packages/react-ui/src/components/Charts/Charts.tsxindex d3ef81787..e29b855b4 100644--- a/js/packages/react-ui/src/components/Charts/Charts.tsx+++ b/js/packages/react-ui/src/components/Charts/Charts.tsx@@ -126,7 +126,7 @@ const ChartContainer = forwardRef<"children">;}->(({ id, className, children, config, rechartsProps, ...props }, ref) => {+>(({ id, className, children, config, rechartsProps, style, ...props }, ref) => {const uniqueId = useId();const chartId = `crayon-chart-${id || uniqueId.replace(/:/g, "")}`;const { theme } = useTheme();@@ -137,11 +137,13 @@ const ChartContainer = forwardRef<data-chart={chartId}ref={ref}className={clsx("crayon-chart-container", className)}- style={{- // @ts-expect-error- "--crayon-container-fills": theme.containerFills,- "--crayon-primary-text": theme.primaryText,- }}+ style={+ {+ "--crayon-container-fills": theme.containerFills,+ "--crayon-primary-text": theme.primaryText,+ ...style,+ } as React.CSSProperties+ }{...props}><ChartStyle id={chartId} config={config} />