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