{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "report-steps",
  "type": "registry:block",
  "title": "Report, steps",
  "description": "Steps for the reader to do, in order: the next one open and loud with a button to where it happens, what it unlocks and its time; done steps fold to one line, later ones are small. Done sends the step's words to the seat that owns it (the report kit's answer relay), Later today sends nothing, Skip sends a note.",
  "categories": [
    "report"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/button.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/input.json",
    "https://ui.klarhimmel.com/r/kit-form.json",
    "https://ui.klarhimmel.com/r/kit-report.json",
    "https://ui.klarhimmel.com/r/report-decisions.json"
  ],
  "files": [
    {
      "path": "src/blocks/report-steps/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/report-steps/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, t } from '../_shared/schema';\n\nconst schema = z.object({\n  title: t(100),\n  lead: t(400),\n  items: z.array(z.object({\n    /** The action, one imperative sentence: the card's heading. */\n    action: z.string().min(1).max(240),\n    /** Where it happens, as an https address: a button that opens it in a new tab. */\n    href: t(300),\n    /** Where it happens, said in words when there is no address (a cmux workspace: \"Klar Portal workspace\"). */\n    where: t(120),\n    /** What moves when it is done. */\n    unlocks: t(400),\n    /** Minutes, as a whole number written as text. */\n    time: t(6),\n    /** The exact words the owning seat receives when Done is pressed (the answer's text, choice Done). */\n    says: t(200),\n    /** The address (docs/answer-contract.md), as on a decision card; `seat` is the step's Owner. Without an id the step is only shown. */\n    id: t(80),\n    version: t(6),\n    seat: t(60),\n    repo: t(80),\n    session: t(80),\n    askedAt: t(40),\n  })).min(1).max(12),\n});\n\nexport const spec = defineSpec({\n  type: 'report-steps',\n  aliases: ['report/steps'],\n  name: 'Report, steps',\n  category: 'report',\n  role: 'body',\n  description: 'Steps for the reader to do, in order: the next one open and loud with a button to where it happens, what it unlocks and its time; done steps fold to one line, later ones are small. Done sends the step\\'s words to the seat that owns it (the report kit\\'s answer relay), Later today sends nothing, Skip sends a note.',\n  schema,\n  defaults: {\n    title: 'Name the sequence',\n    lead: '',\n    items: [\n      { action: 'Say the first step, as an action', href: 'https://studio.example.com/', where: '', unlocks: 'Say what is unlocked when it is done', time: '5', says: 'Say what Done sends', id: 'Steps-20261025-sample-1', version: '1', seat: 'Name the owner', repo: 'studio', session: '', askedAt: '2026-10-25T07:30:00Z' },\n      { action: 'Say the second step, as an action', href: '', where: 'Say where it happens in words', unlocks: 'Say what is unlocked', time: '3', says: 'Say what Done sends', id: 'Steps-20261025-sample-2', version: '1', seat: 'Name the owner', repo: 'builder', session: '', askedAt: '2026-10-25T07:30:00Z' },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/report-steps/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/report-steps/index.tsx",
      "content": "import { useId } from 'react';\nimport { Check, ExternalLink } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { ButtonLink, Button } from '../../ui/button';\nimport { Textarea } from '../../ui/input';\nimport { useFormProps } from '../_shared/form-kit';\nimport { ReportSection, ReportTitle } from '../_shared/report-kit';\nimport { answerLine } from '../report-decisions';\nimport { spec } from './spec';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\ntype Item = Props['items'][number];\n\nconst DOT = 'size-2.5 shrink-0 rounded-kh-pill border border-kh-line-strong bg-kh-surface data-[state=answered]:bg-kh-accent data-[state=answered]:border-kh-accent data-[state=applied]:bg-kh-ink data-[state=applied]:border-kh-ink';\n// A step's state is set on its card (data-kh-step-state): current (open and loud), later (small: action and time), done (one line).\n// The page renders the first step current; report-answer.js moves it as answers come back.\nconst OPEN_ONLY = 'group-data-[kh-step-state=done]:hidden group-data-[kh-step-state=later]:hidden';\n\n/**\n * The step's answers. Findings from the walk (root 10-25 08:2x, Felix mid-walk) go with Done or Skip as the answer text after the Says\n * words, so the owning seat gets the trigger and the notes in one message; the draft is kept on this device until it is sent. Skip\n * needs a line of findings (why). No option is recommended and nothing defaults (root 10-25 08:5x): the order of the steps is the\n * recommendation. report-answer.js makes them send.\n */\nfunction StepForm({ d }: { d: Item }) {\n  const form = useFormProps({});\n  const notes = useId();\n  return (\n    <form {...form} data-kh-form className=\"mt-5 flex flex-col gap-3\">\n      <div>\n        <label htmlFor={notes} className=\"mb-1.5 block text-kh-small font-medium\">Findings from the walk</label>\n        <Textarea id={notes} name=\"text\" rows={3} data-kh-findings />\n      </div>\n      <div className=\"flex flex-col gap-2 @md:flex-row\">\n        <Button type=\"submit\" name=\"kh-choice\" value=\"Done\" variant=\"secondary\" data-kh-send hidden className=\"w-full @md:w-auto\">Done</Button>\n        <Button type=\"submit\" name=\"kh-choice\" value=\"Skip\" variant=\"ghost\" data-kh-skip hidden className=\"w-full @md:w-auto\">Skip</Button>\n      </div>\n      <p data-kh-status hidden role=\"status\" aria-live=\"polite\" className=\"flex min-w-0 items-center gap-2 text-kh-small text-kh-muted\">\n        <span data-kh-dot data-state=\"open\" aria-hidden className={DOT} />\n        <span data-kh-label className=\"min-w-0 [overflow-wrap:anywhere]\" />\n      </p>\n      <details data-kh-copy className=\"text-kh-small text-kh-muted\">\n        <summary className=\"min-h-6 cursor-pointer rounded-kh-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--kh-focus)\">Answer by copying</summary>\n        <p className=\"mt-2\">Copy this line and paste it to the agent that owns the step.</p>\n        <code data-kh-line className=\"mt-1 block rounded-kh-sm bg-kh-surface-2 p-2 font-kh-mono text-kh-caption text-kh-ink [overflow-wrap:anywhere]\">{answerLine(d, 'Done', d.says)}</code>\n      </details>\n    </form>\n  );\n}\n\n/** Where: an https address is a full-width button to it (new tab); otherwise the place in words. */\nfunction Where({ d, i }: { d: Item; i: number }) {\n  if (/^https:\\/\\/\\S+$/i.test(d.href)) {\n    return (\n      <ButtonLink href={d.href} target=\"_blank\" rel=\"noopener noreferrer\" variant=\"primary\" size=\"lg\" className=\"mt-4 w-full @md:w-auto\" iconEnd={<ExternalLink aria-hidden className=\"size-4\" />}>\n        Open {d.href.replace(/^https:\\/\\//i, '').replace(/\\/$/, '')}\n      </ButtonLink>\n    );\n  }\n  if (!d.where) return null;\n  return <p className=\"mt-4 text-kh-body\">In the <Text path={['items', i, 'where']} value={d.where} as=\"span\" className=\"font-medium\" /></p>;\n}\n\nfunction ReportSteps({ props }: BlockProps<Props>) {\n  const id = useId();\n  const n = props.items.length;\n  return (\n    <ReportSection labelledBy={id}>\n      <div className=\"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1\">\n        <div className=\"min-w-0\"><ReportTitle id={id} title={props.title} lead={props.lead} /></div>\n        <p data-kh-progress data-total={n} className=\"text-kh-small font-medium tabular-nums text-kh-muted\">0 of {n} done</p>\n      </div>\n      <ol className=\"mt-6 flex flex-col gap-3\">\n        {props.items.map((d, i) => (\n          <li\n            key={i}\n            {...(d.id ? { 'data-kh-decision': '', 'data-kh-step': '', 'data-id': d.id, 'data-version': d.version || '1', 'data-seat': d.seat, 'data-repo': d.repo, 'data-session': d.session, 'data-default': '', 'data-says': d.says, 'data-asked-at': d.askedAt } : {})}\n            data-kh-step-state={i === 0 ? 'current' : 'later'}\n            data-time={d.time || undefined}\n            className=\"group rounded-kh-xl border border-kh-line bg-kh-surface p-4 data-[kh-step-state=current]:border-kh-ink data-[kh-step-state=current]:p-5 data-[kh-step-state=done]:bg-transparent data-[kh-step-state=done]:py-3 @xl:data-[kh-step-state=current]:p-6 print:break-inside-avoid\"\n          >\n            <div className=\"flex items-start gap-3\">\n              <span aria-hidden className=\"mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-kh-pill bg-(--kh-bubble) text-kh-small font-semibold tabular-nums text-kh-ink group-data-[kh-step-state=current]:bg-kh-ink group-data-[kh-step-state=current]:text-kh-canvas\">\n                <span className=\"group-data-[kh-step-state=done]:hidden\">{i + 1}</span>\n                <Check className=\"hidden size-4 group-data-[kh-step-state=done]:block\" />\n              </span>\n              <div className=\"min-w-0 flex-1\">\n                <h3 className=\"text-kh-body font-medium [overflow-wrap:anywhere] group-data-[kh-step-state=current]:text-kh-heading group-data-[kh-step-state=current]:font-semibold group-data-[kh-step-state=done]:text-kh-muted\">\n                  <span className=\"sr-only\">Step {i + 1}. </span>\n                  <Text path={['items', i, 'action']} value={d.action} as=\"span\" rich />\n                </h3>\n                <p data-kh-step-note className=\"text-kh-small text-kh-muted empty:hidden\">{i === 0 || !d.time ? '' : `${d.time} min`}</p>\n              </div>\n            </div>\n            <div className={`@xl:ml-10 ${OPEN_ONLY}`}>\n              <Where d={d} i={i} />\n              {d.unlocks && <p className=\"mt-4 text-kh-body\"><span className=\"font-medium\">Unlocks: </span><Text path={['items', i, 'unlocks']} value={d.unlocks} as=\"span\" rich /></p>}\n              {d.time && <p className=\"mt-1 text-kh-small text-kh-muted\">About {d.time} min</p>}\n              {d.says && <p className=\"mt-1 text-kh-small text-kh-muted\">Done tells {d.seat || 'the seat'}: <q><Text path={['items', i, 'says']} value={d.says} as=\"span\" /></q></p>}\n              {d.id && <StepForm d={d} />}\n            </div>\n          </li>\n        ))}\n      </ol>\n    </ReportSection>\n  );\n}\n\nexport default withHeadingLevel(ReportSteps);\n"
    }
  ]
}
