{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chat-plan",
  "type": "registry:ui",
  "title": "Chat Plan",
  "description": "A plan an agent proposed, with each step’s progress.",
  "categories": [
    "ai-&-chat"
  ],
  "dependencies": [
    "@hugeicons/core-free-icons@4.4.0",
    "@hugeicons/react@1.1.10"
  ],
  "registryDependencies": [
    "https://sprout.tulipfarm.ai/r/sprout-base.json",
    "https://sprout.tulipfarm.ai/r/spinner.json"
  ],
  "files": [
    {
      "path": "registry/sprout/components/ui/chat-plan.tsx",
      "type": "registry:ui",
      "target": "components/ui/chat-plan.tsx",
      "content": "import type { ComponentProps } from 'react';\nimport { CheckIcon } from '@/lib/sprout/icons/check-icon';\nimport { ClockIcon } from '@/lib/sprout/icons/clock-icon';\nimport { WarningIcon } from '@/lib/sprout/icons/warning-icon';\nimport { cn } from '@/lib/sprout/classes';\nimport { Spinner } from '@/components/ui/spinner';\n\nexport const chatPlanStepStateNames = ['pending', 'running', 'complete', 'error'] as const;\n\nexport type ChatPlanStepState = (typeof chatPlanStepStateNames)[number];\n\nexport type ChatPlanStep = {\n  id: string;\n  title: string;\n  detail?: string | undefined;\n  state: ChatPlanStepState;\n};\n\nexport interface ChatPlanProps extends Omit<ComponentProps<'section'>, 'title' | 'children'> {\n  title: string;\n  steps: readonly ChatPlanStep[];\n}\n\nconst stateLabels: Record<ChatPlanStepState, string> = {\n  pending: 'Not started',\n  running: 'In progress',\n  complete: 'Complete',\n  error: 'Failed',\n};\n\nfunction StepIcon({ state }: { state: ChatPlanStepState }) {\n  if (state === 'running') return <Spinner aria-hidden=\"true\" />;\n  if (state === 'complete') return <CheckIcon size=\"md\" aria-hidden=\"true\" />;\n  if (state === 'error') return <WarningIcon size=\"md\" aria-hidden=\"true\" />;\n  return <ClockIcon size=\"md\" aria-hidden=\"true\" />;\n}\n\nexport function ChatPlan({ title, steps, className, ...props }: ChatPlanProps) {\n  const complete = steps.filter(step => step.state === 'complete').length;\n  return (\n    <section data-slot=\"chat-plan\" aria-label={title} {...props} className={cn('sprout-chat-plan', className)}>\n      <div className=\"sprout-chat-plan-header\">\n        <h4 className=\"sprout-chat-plan-title\">{title}</h4>\n        <span className=\"sprout-chat-plan-count\">\n          {complete} of {steps.length} complete\n        </span>\n      </div>\n      {steps.length === 0 ? (\n        <p className=\"sprout-chat-plan-empty\">No steps have been proposed yet.</p>\n      ) : (\n        <ol className=\"sprout-chat-plan-steps\">\n          {steps.map(step => (\n            <li key={step.id} data-slot=\"chat-plan-step\" data-state={step.state} className=\"sprout-chat-plan-step\">\n              <span key={step.state} className=\"sprout-chat-plan-icon\">\n                <StepIcon state={step.state} />\n              </span>\n              <div className=\"sprout-chat-plan-text\">\n                <p className=\"sprout-chat-plan-step-title\">\n                  {step.title}\n                  <span className=\"sprout-chat-plan-sr-only\">\n                    {' · '}\n                    {stateLabels[step.state]}\n                  </span>\n                </p>\n                {step.detail && <p className=\"sprout-chat-plan-detail\">{step.detail}</p>}\n              </div>\n            </li>\n          ))}\n        </ol>\n      )}\n    </section>\n  );\n}\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/check-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/check-icon.tsx",
      "content": "import { Tick02Icon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const CheckIcon = /* @__PURE__ */ createIcon(glyph, 'CheckIcon');\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/clock-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/clock-icon.tsx",
      "content": "import { Clock01Icon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const ClockIcon = /* @__PURE__ */ createIcon(glyph, 'ClockIcon');\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/create-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/create-icon.tsx",
      "content": "import { HugeiconsIcon, type IconSvgElement } from '@hugeicons/react';\nimport type { ReactElement, Ref, SVGProps } from 'react';\n\nexport const iconSizes = {\n  xs: 12,\n  sm: 14,\n  md: 16,\n  lg: 18,\n  xl: 20,\n  '2xl': 24,\n} as const;\n\nexport type IconSize = keyof typeof iconSizes;\n\nexport const iconStrokeWidth = 1.5;\n\nexport type IconProps = Omit<SVGProps<SVGSVGElement>, 'ref'> & {\n  size?: IconSize | number;\n  ref?: Ref<SVGSVGElement>;\n};\n\nexport type IconComponent = (props: IconProps) => ReactElement;\n\nexport function createIcon(glyph: IconSvgElement, name: string): IconComponent {\n  const Icon = ({ size = '2xl', strokeWidth = iconStrokeWidth, ...props }: IconProps) => (\n    <HugeiconsIcon\n      icon={glyph}\n      size={typeof size === 'number' ? size : iconSizes[size]}\n      strokeWidth={Number(strokeWidth)}\n      {...props}\n    />\n  );\n  Icon.displayName = name;\n  return Icon;\n}\n"
    },
    {
      "path": "registry/sprout/lib/sprout/icons/warning-icon.tsx",
      "type": "registry:lib",
      "target": "lib/sprout/icons/warning-icon.tsx",
      "content": "import { Alert02Icon as glyph } from '@hugeicons/core-free-icons';\nimport { createIcon } from '@/lib/sprout/icons/create-icon';\n\nexport const WarningIcon = /* @__PURE__ */ createIcon(glyph, 'WarningIcon');\n"
    }
  ],
  "css": {
    "@layer components": {
      ".sprout-chat-plan": {
        "box-sizing": "border-box",
        "border": "1px solid var(--sprout-line)",
        "border-radius": "var(--sprout-radius-panel)",
        "width": "100%",
        "min-width": "0",
        "color": "var(--sprout-text)",
        "font-family": "var(--sprout-font)",
        "padding": "16px"
      },
      ".sprout-chat-plan-header": {
        "flex-wrap": "wrap",
        "justify-content": "space-between",
        "align-items": "center",
        "gap": "4px 8px",
        "margin-bottom": "16px",
        "display": "flex"
      },
      ".sprout-chat-plan-title": {
        "min-width": "0",
        "font-size": "var(--sprout-text-sm)",
        "overflow-wrap": "anywhere",
        "margin": "0",
        "font-weight": "500",
        "line-height": "1.25rem"
      },
      ".sprout-chat-plan-count": {
        "color": "var(--sprout-muted)",
        "font-size": "var(--sprout-text-xs)",
        "font-variant-numeric": "tabular-nums",
        "white-space": "nowrap",
        "line-height": "1rem"
      },
      ".sprout-chat-plan-empty": {
        "color": "var(--sprout-muted)",
        "font-size": "var(--sprout-text-sm)",
        "margin": "0",
        "line-height": "1.25rem"
      },
      ".sprout-chat-plan-steps": {
        "gap": "16px",
        "margin": "0",
        "padding": "0",
        "list-style": "none",
        "display": "grid"
      },
      ".sprout-chat-plan-step": {
        "gap": "12px",
        "min-width": "0",
        "display": "flex"
      },
      ".sprout-chat-plan-icon": {
        "width": "16px",
        "height": "20px",
        "color": "var(--sprout-muted)",
        "flex-shrink": "0",
        "justify-content": "center",
        "align-items": "center",
        "display": "inline-flex"
      },
      ".sprout-chat-plan-step[data-state=\"complete\"] .sprout-chat-plan-icon": {
        "color": "var(--sprout-success)"
      },
      ".sprout-chat-plan-step[data-state=\"error\"] .sprout-chat-plan-icon": {
        "color": "var(--sprout-danger)"
      },
      ".sprout-chat-plan-text": {
        "min-width": "0"
      },
      ".sprout-chat-plan-step-title, .sprout-chat-plan-detail": {
        "font-size": "var(--sprout-text-sm)",
        "overflow-wrap": "anywhere",
        "margin": "0",
        "line-height": "1.25rem"
      },
      ".sprout-chat-plan-step-title": {
        "font-weight": "500"
      },
      ".sprout-chat-plan-detail": {
        "color": "var(--sprout-muted)",
        "margin-top": "4px"
      },
      ".sprout-chat-plan-sr-only": {
        "clip-path": "inset(50%)",
        "white-space": "nowrap",
        "border": "0",
        "width": "1px",
        "height": "1px",
        "margin": "-1px",
        "padding": "0",
        "position": "absolute",
        "overflow": "hidden"
      },
      "@media (prefers-reduced-motion: no-preference)": {
        ".sprout-chat-plan-icon": {
          "animation": "sprout-chat-plan-icon-in var(--sprout-motion-normal, .18s) var(--sprout-motion-ease, ease-out)"
        }
      },
      "@keyframes sprout-chat-plan-icon-in": {
        "from": {
          "opacity": "0",
          "scale": ".8"
        }
      }
    }
  },
  "docs": "Docs and examples: https://sprout.tulipfarm.ai/components/chat-plan/",
  "meta": {
    "source": "packages/sprout/src/components/chat-plan.tsx"
  }
}
