{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cash-cycle-ring",
  "type": "registry:component",
  "title": "Cash cycle ring",
  "description": "How long cash is tied up, in one ring. Sample data: a 41-day cash cycle, inventory 46 days, receivables 38 days, payables 43 days.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-cycle-ring"
  ],
  "files": [
    {
      "path": "registry/chartory/components/cash-cycle-ring.tsx",
      "type": "registry:component",
      "target": "components/chartory/cash-cycle-ring.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Cash cycle ring (Chartory chart 098): sizes xs | s | m | l, laid out again from the data at each\n// size; collection \"hearth\" (default) or \"signal\" (with @chartory/signal, Code and Complete). Data in the type's shape (default: the sample). Docs:\n// https://usechartory.com/docs/charts/cash-cycle-ring\nimport { ChartView, type ChartViewProps } from \"@/lib/chartory/charts/chart-view\"\nimport { registerChart } from \"@/lib/chartory/charts/defs\"\nimport { data as sample } from \"@/lib/chartory/charts/types/098-cash-cycle-ring/data\"\nimport { def } from \"@/lib/chartory/charts/types/098-cash-cycle-ring/layout\"\n\nregisterChart(def, sample)\n\nexport type CashCycleRingData = typeof sample\nexport type CashCycleRingProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: CashCycleRingData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: CashCycleRingData[]\n}\n\nexport function CashCycleRing(props: CashCycleRingProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/098-cash-cycle-ring/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/098-cash-cycle-ring/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 098 Cash cycle ring · sample data (Figma chart/098, fintech: working capital days, Q3 2026).\nimport type { CycleRingData } from \"../../plots/cycle-ring\";\n\nexport const data: CycleRingData = {\n  dio: 46,\n  dso: 38,\n  dpo: 43,\n  max: 120,\n  center: [[\"Display/M\", \"41 d\", \"strong\"], [\"Label/Caps\", \"CASH CYCLE\", \"label\"]],\n  rows: [\n    { label: \"Inventory\", tok: \"data/cat-2\", text: \"46 d\" },\n    { label: \"Receivables\", tok: \"data/cat-3\", text: \"38 d\" },\n    { label: \"Payables\", tok: \"data/primary\", text: \"43 d\" },\n  ],\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/098-cash-cycle-ring/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/098-cash-cycle-ring/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 098 Cash cycle ring (Figma chart/098): C.cycleRing; no legend (the side list names the rings). Radius-bound.\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { cycleRing } from \"../../plots/cycle-ring\";\nimport { data } from \"./data\";\n\n/** A later quarter: inventory, receivable and payable days move; the cycle and the side list recomputed. */\nfunction update(d0: unknown, step: number): typeof data {\n  const d = d0 as typeof data;\n  const f = (v: number, i: number) => Math.round(v * (1 + 0.14 * Math.sin(i * 2.1 + step * 1.7 + 0.4)));\n  const dio = f(d.dio, 0), dso = f(d.dso, 1), dpo = f(d.dpo, 2);\n  return {\n    ...d, dio, dso, dpo,\n    center: [[d.center[0][0], dio + dso - dpo + \" d\", d.center[0][2]], d.center[1]],\n    rows: [{ ...d.rows[0], text: dio + \" d\" }, { ...d.rows[1], text: dso + \" d\" }, { ...d.rows[2], text: dpo + \" d\" }],\n  };\n}\n\n/** Hover: one arc (inventory; receivables with the cash-back dot; payables): its days. */\nfunction tip(d0: unknown, g: number): TooltipSpec | null {\n  const d = d0 as typeof data;\n  if (g === 0) return { kind: \"value\", text: `Inventory · ${d.dio} d` };\n  if (g === 1) return { kind: \"value\", text: `Receivables · ${d.dso} d · cash back on day ${d.dio + d.dso}` };\n  if (g === 2) return { kind: \"value\", text: `Payables · ${d.dpo} d` };\n  return null;\n}\n\nexport const def: ChartDef = {\n  no: 98,\n  slug: \"cash-cycle-ring\",\n  legend: null,\n  plot: (K, p, w, d) => cycleRing(K, p, w, (d as typeof data | undefined) ?? data),\n  tip,\n  update,\n  describe: {\n    title: \"Cash conversion cycle, Q3 2026\",\n    summary: `Cash conversion cycle of ${data.dio + data.dso - data.dpo} days: ${data.dio} inventory days plus ${data.dso} receivable days, minus ${data.dpo} payable days.`,\n    table: { head: [\"Component\", \"Days\"], rows: [[\"Inventory\", data.dio], [\"Receivables\", data.dso], [\"Payables\", data.dpo], [\"Cash cycle\", data.dio + data.dso - data.dpo]] },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "flow-between-steps"
  ],
  "meta": {
    "access": "free",
    "no": 98,
    "family": "Flow between steps"
  }
}
