{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "extends": "none",
  "name": "radial-bar-chart",
  "title": "radial-bar-chart",
  "description": "radial-bar-chart",
  "dependencies": [
    "recharts"
  ],
  "registryDependencies": [
    "https://intentui.com/r/chart"
  ],
  "files": [
    {
      "path": "src/components/ui/radial-bar-chart.tsx",
      "content": "\"use client\"\n\nimport { type ComponentProps, type ReactNode, useMemo } from \"react\"\nimport { PolarAngleAxis, RadialBar, RadialBarChart as RadialBarChartPrimitive } from \"recharts\"\nimport {\n  type BaseChartProps,\n  Chart,\n  type ChartConfig,\n  ChartLegend,\n  ChartLegendContent,\n  ChartTooltip,\n  ChartTooltipContent,\n  constructCategoryColors,\n  DEFAULT_COLORS,\n  getColorValue,\n} from \"./chart\"\n\nexport interface RadialBarChartSeries {\n  dataKey: string\n  name?: string\n  radialBarProps?: Omit<ComponentProps<typeof RadialBar>, \"dataKey\" | \"name\">\n}\n\nexport interface RadialBarChartProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n  config: ChartConfig\n  data: Record<string, any>[]\n  dataKey: string\n  nameKey?: string\n  series: RadialBarChartSeries[]\n  colors?: readonly string[]\n  containerHeight?: number\n  legend?: BaseChartProps[\"legend\"]\n  legendProps?: BaseChartProps[\"legendProps\"]\n  tooltip?: boolean | ComponentProps<typeof ChartTooltip>[\"content\"]\n  tooltipProps?: Omit<ComponentProps<typeof ChartTooltip>, \"content\">\n  angleAxisProps?: ComponentProps<typeof PolarAngleAxis>\n  chartProps?: Omit<ComponentProps<typeof RadialBarChartPrimitive>, \"data\">\n  children?: ReactNode\n}\n\nexport function RadialBarChart({\n  config,\n  data,\n  dataKey,\n  nameKey,\n  series,\n  colors = DEFAULT_COLORS,\n  containerHeight = 360,\n  legend = series.length > 1,\n  legendProps,\n  tooltip = true,\n  tooltipProps,\n  angleAxisProps,\n  chartProps,\n  children,\n  ...props\n}: RadialBarChartProps) {\n  const seriesKeys = useMemo(() => series.map((item) => item.dataKey), [series])\n  const categoryColors = useMemo(\n    () => constructCategoryColors(seriesKeys, colors),\n    [seriesKeys, colors]\n  )\n  const usesDataColors = series.length === 1 && typeof series[0]?.radialBarProps?.fill !== \"string\"\n  const chartData = useMemo(() => {\n    if (!usesDataColors) {\n      return data\n    }\n\n    return data.map((item, index) => {\n      if (typeof item.fill === \"string\") {\n        return item\n      }\n\n      const category = nameKey && typeof item[nameKey] === \"string\" ? item[nameKey] : undefined\n\n      return {\n        ...item,\n        fill: getColorValue(\n          (category ? config[category]?.color : undefined) ?? colors[index % colors.length]\n        ),\n      }\n    })\n  }, [colors, config, data, nameKey, usesDataColors])\n  const legendPayload = series.map((item, index) => ({\n    color:\n      typeof item.radialBarProps?.fill === \"string\"\n        ? item.radialBarProps.fill\n        : getColorValue(\n            config[item.dataKey]?.color ??\n              categoryColors.get(item.dataKey) ??\n              colors[index % colors.length]\n          ),\n    dataKey: item.dataKey,\n    type: \"circle\" as const,\n    value: item.name ?? item.dataKey,\n  }))\n\n  return (\n    <Chart\n      config={config}\n      data={chartData}\n      dataKey={dataKey}\n      containerHeight={containerHeight}\n      layout=\"radial\"\n      {...props}\n    >\n      {({ selectedLegend }) => (\n        <RadialBarChartPrimitive data={chartData} {...chartProps}>\n          {angleAxisProps ? (\n            <PolarAngleAxis type=\"number\" tick={false} {...angleAxisProps} />\n          ) : null}\n          {children}\n          {tooltip ? (\n            <ChartTooltip\n              cursor={false}\n              content={\n                typeof tooltip === \"boolean\" ? (\n                  <ChartTooltipContent hideLabel accessibilityLayer />\n                ) : (\n                  tooltip\n                )\n              }\n              {...tooltipProps}\n            />\n          ) : null}\n          {legend ? (\n            <ChartLegend\n              content={\n                typeof legend === \"boolean\"\n                  ? (contentProps) => (\n                      <ChartLegendContent\n                        align={contentProps.align}\n                        verticalAlign={contentProps.verticalAlign}\n                        payload={legendPayload}\n                      />\n                    )\n                  : legend\n              }\n              {...legendProps}\n            />\n          ) : null}\n          {series.map((item, index) => {\n            const fill = usesDataColors\n              ? undefined\n              : getColorValue(\n                  config[item.dataKey]?.color ??\n                    categoryColors.get(item.dataKey) ??\n                    colors[index % colors.length]\n                )\n            const isDimmed = selectedLegend && selectedLegend !== item.dataKey\n            const { fillOpacity = 1, ...radialBarProps } = item.radialBarProps ?? {}\n\n            return (\n              <RadialBar\n                key={item.dataKey}\n                dataKey={item.dataKey}\n                name={item.name ?? item.dataKey}\n                fill={fill}\n                fillOpacity={isDimmed ? 0.12 : fillOpacity}\n                {...radialBarProps}\n              />\n            )\n          })}\n        </RadialBarChartPrimitive>\n      )}\n    </Chart>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}