{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "questionnaire-demo",
  "title": "Questionnaire Demo",
  "description": "A worked example of Questionnaire: The questions an agent asks before it starts. One at a time, with single or multiple answers, an open answer alongside them, and required ones it will not move past.",
  "registryDependencies": [
    "https://ui.tinkererslabs.com/r/questionnaire.json"
  ],
  "files": [
    {
      "path": "components/demos/questionnaire-demo.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport {\n  Questionnaire,\n  type Question,\n  type QuestionnaireAnswers,\n} from \"@/registry/default/questionnaire/questionnaire\"\n\nconst questions: Question[] = [\n  {\n    id: \"scope\",\n    prompt: \"Which files should I rename?\",\n    description: \"I found 41 matches across the repository.\",\n    required: true,\n    choices: [\n      { id: \"open\", label: \"Only the file I have open\" },\n      { id: \"src\", label: \"Everything under src\", description: \"38 files\" },\n      { id: \"all\", label: \"Every match\", description: \"41 files\" },\n    ],\n  },\n  {\n    id: \"extras\",\n    prompt: \"Anything to do alongside it?\",\n    multiple: true,\n    freeformPlaceholder: \"Something else…\",\n    choices: [\n      { id: \"tests\", label: \"Update the tests\" },\n      { id: \"imports\", label: \"Fix the imports\" },\n      { id: \"changelog\", label: \"Add a changelog entry\" },\n    ],\n  },\n  {\n    id: \"review\",\n    prompt: \"How should I hand it back?\",\n    required: true,\n    choices: [\n      { id: \"diff\", label: \"Show me the diff first\" },\n      { id: \"commit\", label: \"Commit it on a branch\" },\n    ],\n  },\n]\n\nexport function QuestionnaireDemo() {\n  const [answers, setAnswers] = React.useState<QuestionnaireAnswers>()\n\n  if (answers) {\n    return (\n      <div className=\"grid w-full max-w-md gap-3 text-sm\">\n        <p className=\"font-semibold\">Thanks, that is enough to start.</p>\n        <ul className=\"text-muted-foreground grid gap-1\">\n          {questions.map((question) => (\n            <li key={question.id}>\n              {question.id}:{\" \"}\n              {(answers[question.id] ?? [])\n                .map((value) => value.replace(\"__freeform__\", \"\"))\n                .join(\", \") || \"skipped\"}\n            </li>\n          ))}\n        </ul>\n        <button\n          className=\"restore-button justify-self-start\"\n          type=\"button\"\n          onClick={() => setAnswers(undefined)}\n        >\n          Ask again\n        </button>\n      </div>\n    )\n  }\n\n  return (\n    <Questionnaire\n      className=\"w-full max-w-md\"\n      questions={questions}\n      onSubmit={setAnswers}\n    />\n  )\n}\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}