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