{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "approval-flow",
  "type": "registry:component",
  "title": "Approval Flow",
  "description": "A multi-stage submission and approval chain.",
  "author": "Stepperize",
  "dependencies": [
    "@stepperize/react",
    "lucide-react"
  ],
  "registryDependencies": [],
  "categories": [
    "async"
  ],
  "meta": {
    "capabilities": [
      "navigation"
    ],
    "level": "intermediate",
    "tags": [
      "approval",
      "workflow",
      "review",
      "chain"
    ]
  },
  "files": [
    {
      "path": "components/stepperize/approval-flow.tsx",
      "type": "registry:component",
      "target": "components/stepperize/approval-flow.tsx",
      "content": "\"use client\";\n\nimport { defineStepper } from \"@stepperize/react\";\nimport { Check, Clock } from \"lucide-react\";\nimport { useState } from \"react\";\n\nconst { Stepper } = defineStepper([\n\t{ id: \"submitted\", title: \"Submitted\" },\n\t{ id: \"manager\", title: \"Manager\" },\n\t{ id: \"finance\", title: \"Finance\" },\n\t{ id: \"approved\", title: \"Approved\" },\n]);\n\nexport function ApprovalFlowBlock() {\n\tconst [acknowledged, setAcknowledged] = useState(false);\n\n\treturn (\n\t\t<Stepper.Root\n\t\t\tlinear\n\t\t\tclassName=\"w-full max-w-md rounded-xl border bg-background p-6 shadow-sm\"\n\t\t>\n\t\t\t{({ stepper }) => (\n\t\t\t\t<>\n\t\t\t\t\t<div className=\"mb-5 flex items-center justify-between\">\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<p className=\"text-sm font-semibold\">Expense #2043</p>\n\t\t\t\t\t\t\t<p className=\"text-xs text-muted-foreground\">$1,250 · Travel</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"rounded-full bg-chart-3/15 px-2.5 py-1 text-xs font-medium text-chart-3 data-[done=true]:bg-chart-2/15 data-[done=true]:text-chart-2\"\n\t\t\t\t\t\t\tdata-done={stepper.isLast}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{stepper.isLast ? \"Approved\" : \"Pending\"}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<Stepper.List className=\"flex items-start\">\n\t\t\t\t\t\t<Stepper.Items>\n\t\t\t\t\t\t\t{(step, index) => (\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tkey={step.id}\n\t\t\t\t\t\t\t\t\tclassName=\"flex flex-1 items-start last:flex-none\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Stepper.Item\n\t\t\t\t\t\t\t\t\t\tstep={step.id}\n\t\t\t\t\t\t\t\t\t\tclassName=\"flex flex-col items-center gap-1.5\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Stepper.Indicator className=\"group grid size-9 place-items-center rounded-full border-2 transition-colors data-[status=active]:border-chart-3 data-[status=active]:text-chart-3 data-[status=previous]:border-chart-2 data-[status=previous]:bg-chart-2 data-[status=previous]:text-white data-[status=upcoming]:border-border data-[status=upcoming]:text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t<Check className=\"hidden size-4 group-data-[status=previous]:block\" />\n\t\t\t\t\t\t\t\t\t\t\t<Clock className=\"hidden size-4 group-data-[status=active]:block\" />\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"text-xs font-semibold group-data-[status=active]:hidden group-data-[status=previous]:hidden\">\n\t\t\t\t\t\t\t\t\t\t\t\t{index + 1}\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</Stepper.Indicator>\n\t\t\t\t\t\t\t\t\t\t<Stepper.Title className=\"text-[11px] font-medium\" />\n\t\t\t\t\t\t\t\t\t</Stepper.Item>\n\t\t\t\t\t\t\t\t\t{index < stepper.count - 1 && (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"mx-1 mt-4.5 h-0.5 flex-1 rounded bg-border data-[done=true]:bg-chart-2\"\n\t\t\t\t\t\t\t\t\t\t\tdata-done={index < stepper.index}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</Stepper.Items>\n\t\t\t\t\t</Stepper.List>\n\n\t\t\t\t\t<Stepper.Content\n\t\t\t\t\t\tstep={stepper.current.id}\n\t\t\t\t\t\tclassName=\"mt-5 rounded-lg border bg-muted/30 p-3 text-sm text-muted-foreground\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{acknowledged\n\t\t\t\t\t\t\t? \"Approval acknowledged. The reimbursement is queued for payout.\"\n\t\t\t\t\t\t\t: stepper.isLast\n\t\t\t\t\t\t\t\t? \"All approvals collected. Reimbursement scheduled.\"\n\t\t\t\t\t\t\t\t: `Waiting on ${stepper.current.title} approval.`}\n\t\t\t\t\t</Stepper.Content>\n\n\t\t\t\t\t<Stepper.Actions className=\"mt-5 flex gap-2\">\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={() => stepper.prev()}\n\t\t\t\t\t\t\tdisabled={!stepper.canPrev}\n\t\t\t\t\t\t\tclassName=\"inline-flex h-9 items-center rounded-lg border bg-background px-4 text-sm font-medium transition-colors hover:bg-muted disabled:pointer-events-none disabled:opacity-50\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tSend back\n\t\t\t\t\t\t</button>\n\t\t\t\t\t\t{acknowledged ? (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\tsetAcknowledged(false);\n\t\t\t\t\t\t\t\t\tstepper.reset();\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tclassName=\"inline-flex h-9 flex-1 items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tRestart flow\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t) : stepper.isLast ? (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tonClick={() => setAcknowledged(true)}\n\t\t\t\t\t\t\t\tclassName=\"inline-flex h-9 flex-1 items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tAcknowledge approval\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Stepper.Next className=\"inline-flex h-9 flex-1 items-center justify-center rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-50\">\n\t\t\t\t\t\t\t\tApprove\n\t\t\t\t\t\t\t</Stepper.Next>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Stepper.Actions>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</Stepper.Root>\n\t);\n}\n\nexport default ApprovalFlowBlock;\n"
    }
  ]
}
