{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "extends": "none",
  "name": "line-chart",
  "title": "line-chart",
  "description": "line-chart",
  "dependencies": [
    "recharts"
  ],
  "registryDependencies": [
    "https://intentui.com/r/chart"
  ],
  "files": [
    {
      "path": "src/components/ui/line-chart.tsx",
      "content": "'use client'\n\nimport { useMemo } from 'react'\nimport { Line, LineChart as LineChartPrimitive, type LineProps } from 'recharts'\nimport {\n  type BaseChartProps,\n  CartesianGrid,\n  Chart,\n  ChartLegend,\n  ChartLegendContent,\n  ChartTooltip,\n  ChartTooltipContent,\n  constructCategoryColors,\n  DEFAULT_COLORS,\n  getColorValue,\n  valueToPercent,\n  XAxis,\n  YAxis,\n} from './chart'\n\nexport interface LineChartProps extends BaseChartProps {\n  connectNulls?: boolean\n  lineProps?: LineProps\n  chartProps?: Omit<React.ComponentProps<typeof LineChartPrimitive>, 'data' | 'stackOffset'>\n}\n\nexport function LineChart({\n  data = [],\n  dataKey,\n  colors = DEFAULT_COLORS,\n  connectNulls = false,\n  type = 'default',\n  config,\n  children,\n\n  // Components\n  tooltip = true,\n  tooltipProps,\n\n  legend = true,\n  legendProps,\n\n  intervalType = 'equidistantPreserveStart',\n\n  valueFormatter = (value: number) => value.toString(),\n\n  // XAxis\n  displayEdgeLabelsOnly = false,\n  xAxisProps,\n  hideXAxis = false,\n\n  // YAxis\n  yAxisProps,\n  hideYAxis = false,\n\n  hideGridLines = false,\n  chartProps,\n  lineProps,\n  ...props\n}: LineChartProps) {\n  const configKeys = useMemo(() => Object.keys(config), [config])\n  const categoryColors = useMemo(\n    () => constructCategoryColors(configKeys, colors),\n    [configKeys, colors]\n  )\n\n  const configEntries = useMemo(() => Object.entries(config), [config])\n\n  return (\n    <Chart config={config} data={data} dataKey={dataKey} {...props}>\n      {({ onLegendSelect, selectedLegend }) => (\n        <LineChartPrimitive\n          onClick={() => {\n            onLegendSelect(null)\n          }}\n          data={data}\n          margin={{\n            bottom: 0,\n            left: 0,\n            right: 0,\n            top: 5,\n          }}\n          stackOffset={type === 'percent' ? 'expand' : undefined}\n          {...chartProps}\n        >\n          {!hideGridLines && <CartesianGrid strokeDasharray=\"4 4\" />}\n          <XAxis\n            hide={hideXAxis}\n            displayEdgeLabelsOnly={displayEdgeLabelsOnly}\n            intervalType={intervalType}\n            {...xAxisProps}\n          />\n          <YAxis\n            hide={hideYAxis}\n            tickFormatter={type === 'percent' ? valueToPercent : valueFormatter}\n            {...yAxisProps}\n          />\n\n          {legend && (\n            <ChartLegend\n              content={typeof legend === 'boolean' ? <ChartLegendContent /> : legend}\n              {...legendProps}\n            />\n          )}\n\n          {tooltip && (\n            <ChartTooltip\n              content={\n                typeof tooltip === 'boolean' ? <ChartTooltipContent accessibilityLayer /> : tooltip\n              }\n              {...tooltipProps}\n            />\n          )}\n\n          {!children\n            ? configEntries.map(([category, values]) => {\n                const strokeOpacity = selectedLegend && selectedLegend !== category ? 0.1 : 1\n                const color = getColorValue(values.color || categoryColors.get(category))\n\n                return (\n                  <Line\n                    key={category}\n                    dot={false}\n                    name={category}\n                    type=\"linear\"\n                    dataKey={category}\n                    stroke={color}\n                    style={\n                      {\n                        strokeOpacity,\n                        strokeWidth: 2,\n                        '--line-color': color,\n                      } as React.CSSProperties\n                    }\n                    strokeLinejoin=\"round\"\n                    strokeLinecap=\"round\"\n                    connectNulls={connectNulls}\n                    {...lineProps}\n                  />\n                )\n              })\n            : children}\n        </LineChartPrimitive>\n      )}\n    </Chart>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}