{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "app-onboarding-steps",
  "type": "registry:block",
  "title": "App, step wizard header",
  "description": "A step indicator for a multi-step flow: numbered steps that are done, current or upcoming (aria-current=\"step\", the state also said in words for screen readers), the current step's text, and Back and Continue buttons that move through the steps in place.",
  "categories": [
    "app"
  ],
  "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/kit-app.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/app-onboarding-steps/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/app-onboarding-steps/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, t, req } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60).optional(),\n  title: t(120),\n  description: t(300).optional(),\n  /** Names the list of steps for assistive tech. */\n  stepsLabel: t(40),\n  steps: z.array(z.object({ label: t(30), description: t(200) })).min(3).max(6),\n  /** The label of the step the person is on (matches one of `steps`). */\n  active: t(30),\n  /** Said to assistive tech beside each step; not shown. */\n  status: z.object({ done: t(20), current: t(20), upcoming: t(20) }),\n  back: req(20),\n  next: req(20),\n  finish: t(20),\n});\n\nexport const spec = defineSpec({\n  type: 'app-onboarding-steps',\n  aliases: ['app/onboarding-steps'],\n  name: 'App, step wizard header',\n  category: 'app',\n  role: 'body',\n  description: 'A step indicator for a multi-step flow: numbered steps that are done, current or upcoming (aria-current=\"step\", the state also said in words for screen readers), the current step\\'s text, and Back and Continue buttons that move through the steps in place.',\n  schema,\n  defaults: {\n    \"eyebrow\": \"Name the flow\",\n    \"title\": \"Name the flow\",\n    \"description\": \"Say how many steps there are and when anything is charged.\",\n    \"stepsLabel\": \"Name the steps\",\n    \"steps\": [\n      {\n        \"label\": \"First step\",\n        \"description\": \"Say what to choose in the first step.\"\n      },\n      {\n        \"label\": \"Second step\",\n        \"description\": \"Say what to pick in the second step and what the price covers.\"\n      },\n      {\n        \"label\": \"Third step\",\n        \"description\": \"Say what to tell us in the third step.\"\n      }\n    ],\n    \"active\": \"Second step\",\n    \"status\": {\n      \"done\": \"Done\",\n      \"current\": \"Current step\",\n      \"upcoming\": \"Not started\"\n    },\n    \"back\": \"Back\",\n    \"next\": \"Continue\",\n    \"finish\": \"Finish the flow\"\n  },\n});\n"
    },
    {
      "path": "src/blocks/app-onboarding-steps/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/app-onboarding-steps/index.tsx",
      "content": "import { useId } from 'react';\nimport { Check } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { cn } from '../../lib/utils';\nimport { Button } from '../../ui/button';\nimport { Container, Section, SectionHeader, useEditing } from '../_shared/kit';\nimport { AppPanel, useSynced } from '../_shared/app-kit';\nimport { spec } from './spec';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\n\nfunction AppOnboardingSteps({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  const start = Math.max(0, props.steps.findIndex((s) => s.label === props.active));\n  const [at, setAt] = useSynced(start);\n  const last = at === props.steps.length - 1;\n  return (\n    <Section labelledBy={id}>\n      <Container width=\"narrow\">\n        <SectionHeader id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} />\n        <AppPanel className=\"mt-10 p-6 @xl:p-8\">\n          <span id={`${id}-l`} className=\"sr-only\">\n            <Text path={['stepsLabel']} value={props.stepsLabel} as=\"span\" />\n          </span>\n          <ol aria-labelledby={`${id}-l`} className=\"flex flex-col gap-4 @xl:flex-row @xl:gap-2\">\n            {props.steps.map((s, i) => {\n              const state = i < at ? 'done' : i === at ? 'current' : 'upcoming';\n              return (\n                <li key={i} aria-current={state === 'current' ? 'step' : undefined} className=\"flex flex-1 items-center gap-3 @xl:flex-col @xl:items-start @xl:gap-2\">\n                  <span\n                    aria-hidden\n                    className={cn(\n                      'inline-flex size-8 shrink-0 items-center justify-center rounded-kh-pill border text-kh-small font-semibold tabular-nums',\n                      state === 'done' && 'border-kh-ink bg-kh-ink text-kh-on-ink',\n                      state === 'current' && 'border-kh-accent bg-kh-accent-soft text-kh-accent-ink',\n                      state === 'upcoming' && 'border-kh-line-strong text-kh-muted',\n                    )}\n                  >\n                    {state === 'done' ? <Check className=\"size-4\" /> : i + 1}\n                  </span>\n                  <span className={cn('text-kh-small font-medium', state === 'upcoming' ? 'text-kh-muted' : 'text-kh-ink')}>\n                    <Text path={['steps', i, 'label']} value={s.label} as=\"span\" />\n                    <span className=\"sr-only\">\n                      , <Text path={['status', state]} value={props.status[state]} as=\"span\" />\n                    </span>\n                  </span>\n                </li>\n              );\n            })}\n          </ol>\n          <div aria-live=\"polite\" className=\"mt-6 min-h-16 border-t border-kh-line pt-6\">\n            {props.steps.map((s, i) => (\n              <p key={i} hidden={i !== at && !editing} className=\"text-kh-body text-kh-ink-2\">\n                <Text path={['steps', i, 'description']} value={s.description} as=\"span\" />\n              </p>\n            ))}\n          </div>\n          <div className=\"mt-6 flex flex-wrap justify-end gap-3\">\n            <Button variant=\"ghost\" aria-disabled={at === 0 || undefined} onClick={() => at > 0 && setAt((a) => a - 1)} className=\"aria-disabled:opacity-50\">\n              <Text path={['back']} value={props.back} as=\"span\" />\n            </Button>\n            <Button onClick={() => setAt((a) => Math.min(props.steps.length - 1, a + 1))}>\n              <Text path={[last ? 'finish' : 'next']} value={last ? props.finish : props.next} as=\"span\" />\n            </Button>\n          </div>\n          <div hidden={!editing}>\n            <Text path={[last ? 'next' : 'finish']} value={last ? props.next : props.finish} as=\"p\" />\n          </div>\n        </AppPanel>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(AppOnboardingSteps);\n"
    }
  ]
}
