{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"plan","type":"registry:component","title":"Plan","description":"AI-powered plan component.","files":[{"path":"registry/default/ai-elements/plan.tsx","type":"registry:component","content":"\"use client\";\n\nimport { Button } from \"@/components/ui/button\";\nimport {\n  Card,\n  CardAction,\n  CardContent,\n  CardDescription,\n  CardFooter,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\";\nimport {\n  Collapsible,\n  CollapsibleContent,\n  CollapsibleTrigger,\n} from \"@/components/ui/collapsible\";\nimport { cn } from \"@/lib/utils\";\nimport { ChevronsUpDownIcon } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport { Shimmer } from \"./shimmer\";\n\ntype PlanContextValue = {\n  isStreaming: boolean;\n};\n\nconst PlanContext = createContext<PlanContextValue | null>(null);\n\nconst usePlan = () => {\n  const context = useContext(PlanContext);\n  if (!context) {\n    throw new Error(\"Plan components must be used within Plan\");\n  }\n  return context;\n};\n\nexport type PlanProps = ComponentProps<typeof Collapsible> & {\n  isStreaming?: boolean;\n};\n\nexport const Plan = ({\n  className,\n  isStreaming = false,\n  children,\n  ...props\n}: PlanProps) => (\n  <PlanContext.Provider value={{ isStreaming }}>\n    <Collapsible asChild data-slot=\"plan\" {...props}>\n      <Card className={cn(\"shadow-none\", className)}>{children}</Card>\n    </Collapsible>\n  </PlanContext.Provider>\n);\n\nexport type PlanHeaderProps = ComponentProps<typeof CardHeader>;\n\nexport const PlanHeader = ({ className, ...props }: PlanHeaderProps) => (\n  <CardHeader\n    className={cn(\"flex items-start justify-between\", className)}\n    data-slot=\"plan-header\"\n    {...props}\n  />\n);\n\nexport type PlanTitleProps = Omit<\n  ComponentProps<typeof CardTitle>,\n  \"children\"\n> & {\n  children: string;\n};\n\nexport const PlanTitle = ({ children, ...props }: PlanTitleProps) => {\n  const { isStreaming } = usePlan();\n\n  return (\n    <CardTitle data-slot=\"plan-title\" {...props}>\n      {isStreaming ? <Shimmer>{children}</Shimmer> : children}\n    </CardTitle>\n  );\n};\n\nexport type PlanDescriptionProps = Omit<\n  ComponentProps<typeof CardDescription>,\n  \"children\"\n> & {\n  children: string;\n};\n\nexport const PlanDescription = ({\n  className,\n  children,\n  ...props\n}: PlanDescriptionProps) => {\n  const { isStreaming } = usePlan();\n\n  return (\n    <CardDescription\n      className={cn(\"text-balance\", className)}\n      data-slot=\"plan-description\"\n      {...props}\n    >\n      {isStreaming ? <Shimmer>{children}</Shimmer> : children}\n    </CardDescription>\n  );\n};\n\nexport type PlanActionProps = ComponentProps<typeof CardAction>;\n\nexport const PlanAction = (props: PlanActionProps) => (\n  <CardAction data-slot=\"plan-action\" {...props} />\n);\n\nexport type PlanContentProps = ComponentProps<typeof CardContent>;\n\nexport const PlanContent = (props: PlanContentProps) => (\n  <CollapsibleContent asChild>\n    <CardContent data-slot=\"plan-content\" {...props} />\n  </CollapsibleContent>\n);\n\nexport type PlanFooterProps = ComponentProps<\"div\">;\n\nexport const PlanFooter = (props: PlanFooterProps) => (\n  <CardFooter data-slot=\"plan-footer\" {...props} />\n);\n\nexport type PlanTriggerProps = ComponentProps<typeof CollapsibleTrigger>;\n\nexport const PlanTrigger = ({ className, ...props }: PlanTriggerProps) => (\n  <CollapsibleTrigger asChild>\n    <Button\n      className={cn(\"size-8\", className)}\n      data-slot=\"plan-trigger\"\n      size=\"icon\"\n      variant=\"ghost\"\n      {...props}\n    >\n      <ChevronsUpDownIcon className=\"size-4\" />\n      <span className=\"sr-only\">Toggle plan</span>\n    </Button>\n  </CollapsibleTrigger>\n);\n","target":"components/ai-elements/plan.tsx"}],"dependencies":["lucide-react"],"devDependencies":[],"registryDependencies":["button","card","collapsible","https://registry.ai-sdk.dev/shimmer.json"]}