{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "word-cloud-chart",
  "title": "Word Cloud Chart",
  "type": "registry:ui",
  "files": [
    {
      "path": "packages/registry-react/components/charts/word-cloud-chart/WordCloudChart.tsx",
      "content": "'use client'\n\nimport * as React from 'react'\nimport { cn } from '@/lib/utils'\nimport { ChartFrame } from '../shared'\n\n// WordCloudChart — dependency-free frequency-sized words\n// ─────────────────────────────────────────────────────────────────────────\n\nexport interface WordDatum {\n  name: string\n  value: number\n}\n\nexport interface WordCloudChartProps {\n  data: WordDatum[]\n  height?: number | string\n  /** Optional palette override. Defaults to chart-1..5 tokens. */\n  colors?: string[]\n  className?: string\n  /** Accessible name announced for the chart image. Defaults to \"Chart\". */\n  ariaLabel?: string\n}\n\nconst DEFAULT_COLORS = ['var(--chart-1)', 'var(--chart-2)', 'var(--chart-3)', 'var(--chart-4)', 'var(--chart-5)']\n\nexport const WordCloudChart = React.forwardRef<HTMLDivElement, WordCloudChartProps>(\n  ({ data, height = 280, colors = DEFAULT_COLORS, className, ariaLabel }, ref) => {\n    const words = React.useMemo(() => {\n      if (!data.length) return []\n      const vals = data.map((d) => d.value)\n      const min = Math.min(...vals)\n      const max = Math.max(...vals)\n      const span = Math.max(1, max - min)\n      return [...data]\n        .sort((a, b) => b.value - a.value)\n        .map((d, i) => ({\n          ...d,\n          size: 14 + ((d.value - min) / span) * 30,\n          color: colors[i % colors.length],\n          weight: d.value === max ? 700 : d.value >= min + span * 0.66 ? 600 : 500,\n          opacity: 0.55 + ((d.value - min) / span) * 0.45,\n        }))\n    }, [data, colors])\n\n    return (\n      <ChartFrame ref={ref} height={height} className={cn('overflow-hidden', className)} ariaLabel={ariaLabel}>\n        <div className=\"flex h-full w-full flex-wrap items-center justify-center gap-x-4 gap-y-1 p-4\">\n          {words.map((w) => (\n            <span\n              key={w.name}\n              title={`${w.name}: ${w.value}`}\n              style={{\n                fontSize: `${Math.round(w.size)}px`,\n                color: w.color,\n                fontWeight: w.weight,\n                opacity: w.opacity,\n                lineHeight: 1.15,\n              }}\n              className=\"cursor-default transition-transform duration-150 hover:scale-110\"\n            >\n              {w.name}\n            </span>\n          ))}\n        </div>\n      </ChartFrame>\n    )\n  },\n)\nWordCloudChart.displayName = 'WordCloudChart'\n",
      "type": "registry:ui",
      "target": "~/components/ui/charts/word-cloud-chart/WordCloudChart.tsx"
    },
    {
      "path": "packages/registry-react/components/charts/word-cloud-chart/index.ts",
      "content": "export { WordCloudChart, type WordCloudChartProps, type WordDatum } from './WordCloudChart'\n",
      "type": "registry:ui",
      "target": "~/components/ui/charts/word-cloud-chart/index.ts"
    },
    {
      "path": "packages/registry-react/components/charts/shared.tsx",
      "content": "'use client'\n\nimport * as React from 'react'\nimport * as echartsCore from 'echarts/core'\nimport { use } from 'echarts/core'\nimport { CanvasRenderer } from 'echarts/renderers'\nimport {\n  LineChart as EChartsLineChart,\n  BarChart as EChartsBarChart,\n  PieChart as EChartsPieChart,\n  ScatterChart as EChartsScatterChart,\n  EffectScatterChart as EChartsEffectScatter,\n  PictorialBarChart as EChartsPictorialBar,\n  RadarChart as EChartsRadarChart,\n  GaugeChart as EChartsGaugeChart,\n  HeatmapChart as EChartsHeatmap,\n  TreemapChart as EChartsTreemapChart,\n  FunnelChart as EChartsFunnelChart,\n  BoxplotChart as EChartsBoxplotChart,\n  CandlestickChart as EChartsCandlestickChart,\n  CustomChart as EChartsCustomChart,\n  ChordChart as EChartsChordChart,\n  MapChart as EChartsMapChart,\n  GraphChart as EChartsGraphChart,\n  ParallelChart as EChartsParallelChart,\n  SankeyChart as EChartsSankeyChart,\n  SunburstChart as EChartsSunburstChart,\n  ThemeRiverChart,\n  TreeChart as EChartsTreeChart,\n} from 'echarts/charts'\nimport {\n  GridComponent,\n  PolarComponent,\n  TooltipComponent,\n  LegendComponent,\n  MarkLineComponent,\n  MarkAreaComponent,\n  MarkPointComponent,\n  GraphicComponent,\n  RadarComponent,\n  VisualMapComponent,\n  CalendarComponent,\n  DataZoomComponent,\n  ParallelComponent,\n  SingleAxisComponent,\n  TitleComponent,\n} from 'echarts/components'\nimport ReactECharts from 'echarts-for-react/esm/core'\nimport { cn } from '@/lib/utils'\n\nexport function heightToStyle(height: number | string): string {\n  return /^\\d+$/.test(String(height)) ? `${height}px` : String(height)\n}\n\ninterface ChartFrameProps {\n  height: number | string\n  className?: string\n  /** Apply the accessible role/tabindex/focus-ring chrome. Some chart\n   *  wrappers ship a bare `w-full` frame -- pass `false` for those. */\n  focusable?: boolean\n  /** Accessible name for role=\"img\". Defaults to \"Chart\". */\n  ariaLabel?: string\n}\n\n/** Shared `<div>` wrapper around the ECharts canvas. */\nexport const ChartFrame = React.forwardRef<HTMLDivElement, ChartFrameProps & { children: React.ReactNode }>(\n  ({ height, className, focusable = true, ariaLabel, children }, ref) => (\n    <div\n      ref={ref}\n      role=\"img\"\n      aria-label={ariaLabel || 'Chart'}\n      tabIndex={focusable ? 0 : undefined}\n      style={{ height: heightToStyle(height) }}\n      className={\n        focusable\n          ? cn('focus-visible:ring-ring w-full focus-visible:ring-2 focus-visible:outline-none', className)\n          : cn('w-full', className)\n      }\n    >\n      {children}\n    </div>\n  ),\n)\nChartFrame.displayName = 'ChartFrame'\n\n/** ECharts canvas filling its parent frame. */\nexport function EChart({ option }: { option: any }) {\n  return (\n    <ReactECharts\n      echarts={echartsCore as any}\n      option={option}\n      notMerge\n      lazyUpdate\n      style={{ width: '100%', height: '100%' }}\n    />\n  )\n}\n\nexport const echartsCoreModule = echartsCore\n\n// Register every chart type the wrappers need once at module load.\nuse([\n  CanvasRenderer,\n  EChartsLineChart,\n  EChartsBarChart,\n  EChartsPieChart,\n  EChartsScatterChart,\n  EChartsEffectScatter,\n  EChartsPictorialBar,\n  EChartsRadarChart,\n  EChartsGaugeChart,\n  EChartsHeatmap,\n  EChartsTreemapChart,\n  EChartsFunnelChart,\n  EChartsBoxplotChart,\n  EChartsCandlestickChart,\n  EChartsCustomChart,\n  EChartsChordChart,\n  EChartsMapChart,\n  EChartsGraphChart,\n  EChartsParallelChart,\n  EChartsSankeyChart,\n  EChartsSunburstChart,\n  ThemeRiverChart,\n  EChartsTreeChart,\n  GridComponent,\n  PolarComponent,\n  TooltipComponent,\n  LegendComponent,\n  MarkLineComponent,\n  MarkAreaComponent,\n  MarkPointComponent,\n  GraphicComponent,\n  RadarComponent,\n  VisualMapComponent,\n  CalendarComponent,\n  DataZoomComponent,\n  ParallelComponent,\n  SingleAxisComponent,\n  TitleComponent,\n])\n",
      "type": "registry:ui",
      "target": "~/components/ui/charts/shared.tsx"
    }
  ],
  "dependencies": [
    "echarts",
    "echarts-for-react"
  ],
  "devDependencies": [],
  "registryDependencies": [],
  "description": "React mirror of @uipkge/word-cloud-chart — see the Vue registry item for the canonical description.",
  "categories": [
    "chart"
  ]
}