{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "freight-scale",
  "title": "Freight scale",
  "description": "Weigh a pallet, tare the scale, and add crates to measure their net weight.",
  "registryDependencies": [
    "https://www.cyberspec.dev/r/recipe-layout.json",
    "https://www.cyberspec.dev/r/button.json",
    "https://www.cyberspec.dev/r/readout.json",
    "https://www.cyberspec.dev/r/stepper.json"
  ],
  "files": [
    {
      "path": "registry/cyber/recipes/freight-scale.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport { Button } from \"@/registry/cyber/ui/button\"\nimport { Readout } from \"@/registry/cyber/ui/readout\"\nimport { Stepper } from \"@/registry/cyber/ui/stepper\"\nimport \"./recipe-layout.css\"\n\nconst palletKg = 18\nconst crateKg = 24\n\nexport default function FreightScale() {\n  const [crates, setCrates] = useState<number | null>(3)\n  const [tare, setTare] = useState(0)\n  const count = Math.max(0, Math.min(9, Math.trunc(crates ?? 0)))\n  const gross = palletKg + count * crateKg\n  return (\n    <div className=\"sink-stack\">\n      <div className=\"sink-between\" style={{ background: \"var(--cy-void)\", borderBottom: \"2px solid var(--cy-line-ctl)\", padding: 12 }}>\n        <Readout label={tare ? \"Net weight\" : \"Gross weight\"} value={gross - tare} unit=\"kg\" size=\"lg\" />\n        <svg viewBox=\"0 0 108 80\" aria-hidden=\"true\" style={{ width: 95, height: 70 }}>\n          <g fill=\"var(--cy-signal-fill)\" stroke=\"var(--cy-signal)\" strokeWidth=\"1.3\">\n            {Array.from({ length: count }, (_, i) => (\n              <g key={i} transform={`translate(${9 + (i % 3) * 29} ${44 - Math.floor(i / 3) * 19})`}>\n                <rect width=\"26\" height=\"17\" /><path d=\"M2 15 24 2M2 2l22 13\" opacity=\".5\" />\n              </g>\n            ))}\n          </g>\n          <path fill=\"var(--cy-ink-mute)\" d=\"M4 63h94v5H4zm6 7h14v5H10zm33 0h15v5H43zm35 0h14v5H78z\" />\n        </svg>\n      </div>\n      <Stepper label=\"Crates on pallet\" value={crates} min={0} max={9} step={1}\n        onValueChange={setCrates} hint={`Pallet ${palletKg} kg · Each crate ${crateKg} kg`} />\n      <div className=\"sink-between\">\n        <Button size=\"sm\" onClick={() => setTare(tare ? 0 : gross)}>{tare ? \"Clear tare\" : \"Tare scale\"}</Button>\n        <span className=\"sink-note\" role=\"status\">Tare weight · {tare} kg</span>\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "@components/recipes/freight-scale.tsx"
    }
  ],
  "categories": [
    "recipe",
    "transit"
  ],
  "type": "registry:component"
}
