({ id, config }: { id: string; config: ChartConfig })
| 59 | ChartContainer.displayName = "Chart"; |
| 60 | |
| 61 | const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { |
| 62 | const colorConfig = Object.entries(config).filter(([_, config]) => config.theme || config.color); |
| 63 | |
| 64 | if (!colorConfig.length) { |
| 65 | return null; |
| 66 | } |
| 67 | |
| 68 | return ( |
| 69 | <style |
| 70 | dangerouslySetInnerHTML={{ |
| 71 | __html: Object.entries(THEMES) |
| 72 | .map( |
| 73 | ([theme, prefix]) => ` |
| 74 | ${prefix} [data-chart=${id}] { |
| 75 | ${colorConfig |
| 76 | .map(([key, itemConfig]) => { |
| 77 | const color = itemConfig.theme?.[theme as keyof typeof itemConfig.theme] || itemConfig.color; |
| 78 | return color ? ` --color-${key}: ${color};` : null; |
| 79 | }) |
| 80 | .join("\n")} |
| 81 | } |
| 82 | `, |
| 83 | ) |
| 84 | .join("\n"), |
| 85 | }} |
| 86 | /> |
| 87 | ); |
| 88 | }; |
| 89 | |
| 90 | const ChartTooltip = RechartsPrimitive.Tooltip; |
| 91 |
nothing calls this directly
no outgoing calls
no test coverage detected