{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "funnel-03",
  "description": "A vertical stepper through the stages that calls out the step with the biggest drop-off.",
  "registryDependencies": [
    "card",
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/details.json",
    "https://www.dashboardblocks.com/r/radix/format.json",
    "https://www.dashboardblocks.com/r/radix/funnel.json",
    "https://www.dashboardblocks.com/r/radix/kpi.json",
    "https://www.dashboardblocks.com/r/radix/status-label.json",
    "https://www.dashboardblocks.com/r/radix/tag.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/funnel/funnel-03.tsx",
      "content": "'use client'\n\nimport {\n  BlockStateProvider,\n  BlockStateRows,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport { Details } from '@/registry/components/dashboardblocks/details'\nimport {\n  type FunnelStage,\n  formatRate,\n  getBiggestDropIndex,\n  getFunnelSteps,\n} from '@/registry/components/dashboardblocks/funnel'\nimport { KPIValue } from '@/registry/components/dashboardblocks/kpi'\nimport { StatusLabel } from '@/registry/components/dashboardblocks/status-label'\nimport { Tag } from '@/registry/components/dashboardblocks/tag'\nimport { formatNumber } from '@/registry/lib/dashboardblocks/format'\n\nimport { Card, CardContent } from '@/components/ui/card'\n\ninterface Funnel3Props extends BlockStateProps {\n  description: string\n  /** Leave out, or pass none, to show the empty state. */\n  stages?: FunnelStage[]\n  title: string\n}\n\nconst exampleProps: Funnel3Props = {\n  description: 'New workspaces completing each setup step.',\n  stages: [\n    { label: 'Created workspace', value: 3_640 },\n    { label: 'Invited a teammate', value: 2_510 },\n    { label: 'Connected a data source', value: 1_120 },\n    { label: 'Built first dashboard', value: 890 },\n    { label: 'Shared a dashboard', value: 662 },\n  ],\n  title: 'Onboarding funnel',\n}\n\nconst Funnel3 = (props: Funnel3Props) => {\n  const { description, stages = [], errorMessage, status, title } = props\n  const state = getBlockState(status, stages)\n  const steps = getFunnelSteps(stages)\n  const biggestDrop = getBiggestDropIndex(steps)\n  const last = steps.at(-1)\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={state}>\n      <Card>\n        <CardContent>\n          <section className='@container flex flex-col gap-4'>\n            <header className='flex flex-col gap-0.5'>\n              <h2 className='font-semibold tracking-tight'>{title}</h2>\n              <p className='text-muted-foreground text-sm'>{description}</p>\n            </header>\n            <dl className='flex flex-col gap-1 border-t pt-4'>\n              <dt className='text-muted-foreground text-sm'>Finish every step</dt>\n              <dd>\n                <KPIValue value={last?.fromStart} format={(value) => formatRate(value)} />\n              </dd>\n            </dl>\n            {state === 'loading' && <BlockStateRows rows={5} />}\n            {!state && (\n              <ol className='flex flex-col'>\n                {steps.map((step, index) => {\n                  const isLast = index === steps.length - 1\n                  const isBiggestDrop = index === biggestDrop\n                  return (\n                    <li key={step.label} className='relative flex gap-3 pb-5 last:pb-0'>\n                      {!isLast && (\n                        <span\n                          aria-hidden\n                          className='bg-border absolute top-6 bottom-1 left-2.5 w-px -translate-x-1/2'\n                        />\n                      )}\n                      <Tag className='relative'>\n                        <span className='sr-only'>Step </span>\n                        {index + 1}\n                      </Tag>\n                      <div className='flex min-w-0 flex-1 flex-col gap-1'>\n                        <div className='flex items-baseline justify-between gap-3'>\n                          <span className='text-sm font-medium'>{step.label}</span>\n                          <span className='text-sm font-medium tabular-nums'>\n                            {formatNumber(step.value)}\n                          </span>\n                        </div>\n                        {index > 0 && (\n                          <Details className='text-muted-foreground text-xs tabular-nums'>\n                            {`${formatRate(step.fromPrevious)} of previous step`}\n                            {`${formatNumber(step.dropped)} dropped`}\n                            {isBiggestDrop && (\n                              <StatusLabel variant='text' tone='bad' className='text-xs'>\n                                Biggest drop-off\n                              </StatusLabel>\n                            )}\n                          </Details>\n                        )}\n                      </div>\n                    </li>\n                  )\n                })}\n              </ol>\n            )}\n          </section>\n        </CardContent>\n      </Card>\n    </BlockStateProvider>\n  )\n}\n\nexport { Funnel3, exampleProps as funnel3ExampleProps, type Funnel3Props }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/funnel/funnel-03.tsx"
    }
  ],
  "meta": {
    "shows": "A vertical stepper through the stages that calls out the step with the biggest drop-off.",
    "size": "half",
    "usedWith": [
      "chart-panel-04",
      "data-table-03"
    ],
    "component": "Funnel3",
    "props": "{ description: string; stages?: { label: string; value: number }[]; title: string; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
