{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "split-calendar",
  "type": "registry:component",
  "title": "Split calendar",
  "description": "Money in and out, day by day. Sample data: September cash, biggest in Sep 15 ($164K), biggest out Sep 30 ($178K), 8 quiet days.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-split-cal"
  ],
  "files": [
    {
      "path": "registry/chartory/components/split-calendar.tsx",
      "type": "registry:component",
      "target": "components/chartory/split-calendar.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Split calendar (Chartory chart 100): 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/split-calendar\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/100-split-calendar/data\"\nimport { def } from \"@/lib/chartory/charts/types/100-split-calendar/layout\"\n\nregisterChart(def, sample)\n\nexport type SplitCalendarData = typeof sample\nexport type SplitCalendarProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: SplitCalendarData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: SplitCalendarData[]\n}\n\nexport function SplitCalendar(props: SplitCalendarProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/100-split-calendar/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/100-split-calendar/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 100 Split calendar · sample data (Figma chart/100, fintech: daily cash in / out in $K, September; day 1 is a Tuesday).\nimport type { SplitCalData } from \"../../plots/split-cal\";\n\nexport const data: SplitCalData = {\n  days: [\n    [48, 46], [72, 19], [30, 22], [61, 29], [0, 7], [0, 5], [71, 49], [78, 24], [60, 33], [45, 22], [20, 18], [0, 2], [0, 7], [54, 25], [164, 26],\n    [24, 25], [58, 47], [35, 57], [0, 3], [0, 0], [65, 23], [20, 54], [46, 43], [20, 61], [59, 50], [0, 6], [0, 4], [73, 50], [78, 31], [74, 178],\n  ],\n  start: 1,\n  max: 210,\n  rows: [\n    { label: \"Biggest in\", text: \"Sep 15\", pct: \"$164K\" },\n    { label: \"Biggest out\", text: \"Sep 30\", pct: \"$178K\" },\n    { label: \"Quiet days\", text: \"8\", pct: \"WEEKENDS\" },\n  ],\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/100-split-calendar/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/100-split-calendar/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 100 Split calendar (Figma chart/100): C.splitCal on September's bank feed. Radius-bound (the side list sets the size).\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { splitCal } from \"../../plots/split-cal\";\nimport { data } from \"./data\";\n\nconst sum = (k: 0 | 1) => data.days.reduce((a, d) => a + d[k], 0);\n\nconst MON = \"Sep \";\n/** Another month's feed on the same calendar: amounts move (whole $K, quiet days kept), the side list recomputed. */\nfunction update(d0: unknown, step: number): typeof data {\n  const d = d0 as typeof data;\n  const days = d.days.map(([a, b], i): [number, number] => [a && Math.max(1, Math.min(d.max, Math.round(a * (1 + 0.18 * Math.sin(i * 2.1 + step * 1.7))))), b && Math.max(1, Math.min(d.max, Math.round(b * (1 + 0.18 * Math.sin(i * 1.3 + step * 2.3 + 1)))))]);\n  const big = (k: 0 | 1) => days.reduce((m, x, i) => (x[k] > days[m][k] ? i : m), 0);\n  const bi = big(0), bo = big(1);\n  return {\n    ...d, days,\n    rows: [{ ...d.rows[0], text: MON + (bi + 1), pct: \"$\" + days[bi][0] + \"K\" }, { ...d.rows[1], text: MON + (bo + 1), pct: \"$\" + days[bo][1] + \"K\" }, { ...d.rows[2], text: String(days.filter((x) => !x[0]).length) }],\n  };\n}\n\nconst WD = [\"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\", \"SUN\"];\nconst usd = (v: number) => \"$\" + v + \"K\";\n/** Hover: one day (its in and out triangles): cash in, cash out, the day's net. */\nfunction tip(d0: unknown, g: number): TooltipSpec | null {\n  const d = d0 as typeof data, x = d.days[g];\n  if (!x) return null;\n  const net = x[0] - x[1];\n  return {\n    kind: \"series\", caps: `SEP ${g + 1} · ${WD[(g + d.start) % 7]} · NET ${net < 0 ? \"−\" : \"+\"}${usd(Math.abs(net))}`,\n    rows: [{ label: \"Cash in\", value: usd(x[0]), swatch: \"status/success\" }, { label: \"Cash out\", value: usd(x[1]), swatch: \"status/danger\" }],\n  };\n}\n\nexport const def: ChartDef = {\n  no: 100,\n  slug: \"split-calendar\",\n  legend: [[\"status/success\", \"Cash in\"], [\"status/danger\", \"Cash out\"]],\n  flat: [\"s\"],\n  plot: (K, p, w, d) => splitCal(K, p, w, (d as typeof data | undefined) ?? data),\n  tip,\n  update,\n  describe: {\n    title: \"Daily cash in and out, September\",\n    summary: `Cash in and out per day in September: $${sum(0)}K in, $${sum(1)}K out; the biggest day in is Sep 15 ($164K), the biggest day out Sep 30 ($178K).`,\n    table: { head: [\"Day\", \"In ($K)\", \"Out ($K)\"], rows: data.days.map(([a, b], i) => [`Sep ${i + 1}`, a, b]) },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "schedule-and-status"
  ],
  "meta": {
    "access": "free",
    "no": 100,
    "family": "Schedule and status"
  }
}
