{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shipment-journey",
  "type": "registry:component",
  "title": "Shipment journey",
  "description": "One shipment, stage by stage. Sample data: one shipment, picked up Oct 1, delivered Oct 14 (ETA), by warehouse, sea, customs and road.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-journey"
  ],
  "files": [
    {
      "path": "registry/chartory/components/shipment-journey.tsx",
      "type": "registry:component",
      "target": "components/chartory/shipment-journey.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Shipment journey (Chartory chart 096): 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/shipment-journey\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/096-shipment-journey/data\"\nimport { def } from \"@/lib/chartory/charts/types/096-shipment-journey/layout\"\n\nregisterChart(def, sample)\n\nexport type ShipmentJourneyData = typeof sample\nexport type ShipmentJourneyProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: ShipmentJourneyData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: ShipmentJourneyData[]\n}\n\nexport function ShipmentJourney(props: ShipmentJourneyProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/096-shipment-journey/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/096-shipment-journey/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 096 Shipment journey · sample data (Figma chart/096, logistics: shipment 4471 Shanghai → Leeds, days from Oct 1).\nimport type { JourneyData } from \"../../plots/journey\";\n\nexport const data: JourneyData = {\n  t0: 0,\n  t1: 14,\n  now: 9.4,\n  phases: [[0, 1, \"data/cat-2\"], [1, 7, \"data/primary\"], [7, 9, \"status/warning\"], [9, 9.4, \"data/cat-3\"]],\n  xl: [[0, \"OCT 1\"], [7, \"OCT 8\"], [14, \"OCT 15\"]],\n  events: [\n    { t: 0, label: \"Picked up\", date: \"OCT 1\", up: true },\n    { t: 1, label: \"Sailed\", date: \"OCT 2\", up: false },\n    { t: 7, label: \"At port\", date: \"OCT 8\", up: true },\n    { t: 9, label: \"Cleared\", date: \"OCT 10\", up: false },\n    { t: 12, label: \"Out for delivery\", date: \"OCT 13 · ETA\", up: true },\n    { t: 13.5, label: \"Delivered\", date: \"OCT 14 · ETA\", up: false },\n  ],\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/096-shipment-journey/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/096-shipment-journey/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 096 Shipment journey (Figma chart/096): C.journey on shipment 4471, legend = the transport phases.\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { journey } from \"../../plots/journey\";\nimport { data } from \"./data\";\n\nconst PHASE = [\"Warehouse\", \"Sea\", \"Customs\", \"Road\"];\n\n/** Later today and the next days: the shipment moves on by road (now advances, still before out for delivery). */\nfunction update(d0: unknown, step: number): typeof data {\n  const d = d0 as typeof data;\n  const now = +(d.now + 0.8 * step).toFixed(1);\n  return { ...d, now, phases: d.phases.map((p, i): [number, number, string] => (i === d.phases.length - 1 ? [p[0], now, p[2]] : p)) };\n}\n\n/** Hover: one event (stem, dot, name and date): its date, done or expected. */\nfunction tip(d0: unknown, g: number): TooltipSpec | null {\n  const d = d0 as typeof data, e = d.events[g];\n  if (!e) return null;\n  const date = e.date.replace(\" · ETA\", \"\").replace(/^(\\w)(\\w+)/, (_, a: string, b: string) => a + b.toLowerCase());\n  return { kind: \"value\", text: `${e.label} · ${date} · ${e.t <= d.now ? \"done\" : \"ETA\"}` };\n}\n\nexport const def: ChartDef = {\n  no: 96,\n  slug: \"shipment-journey\",\n  legend: [[\"data/cat-2\", \"Warehouse\"], [\"data/primary\", \"Sea\"], [\"status/warning\", \"Customs\"], [\"data/cat-3\", \"Road\"]],\n  plot: (K, p, w, d) => journey(K, p, w, (d as typeof data | undefined) ?? data),\n  tip,\n  update,\n  describe: {\n    title: \"Shipment 4471 journey\",\n    summary: `Shipment from Oct 1, now on day ${data.now} of ${data.t1}: ${data.phases.map(([a, b], i) => `${PHASE[i]} ${+(b - a).toFixed(1)} d`).join(\", \")}; out for delivery Oct 13 and delivered Oct 14 are estimates.`,\n    table: { head: [\"Event\", \"Date\", \"Status\"], rows: data.events.map((e) => [e.label, e.date.replace(\" · ETA\", \"\"), e.t <= data.now ? \"Done\" : \"Expected\"]) },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "flow-between-steps"
  ],
  "meta": {
    "access": "free",
    "no": 96,
    "family": "Flow between steps"
  }
}
