{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "plan",
  "title": "Plan",
  "description": "The steps an agent plans to take, with a progress bar and an Accept button.",
  "dependencies": [
    "@kind-ui/agent-ui@0.9.0",
    "@ui-sdk/core@0.1.0-beta.17",
    "@ui-sdk/react@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/react/plan.tsx",
      "content": "\"use client\";\n\nimport { planPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/react/primitive\";\nimport { Progress, ProgressIndicator, ProgressLabel, ProgressTrack } from \"@ui-sdk/react/progress\";\nimport type { ComponentProps } from \"react\";\n\nconst parts = createParts(planPrimitive, {\n  root: \"div\",\n  trigger: \"button\",\n  icon: \"span\",\n  title: \"span\",\n  meta: \"span\",\n  content: \"div\",\n  progress: \"div\",\n  list: \"ol\",\n  item: \"li\",\n  \"item-icon\": \"span\",\n  \"item-title\": \"span\",\n  \"item-description\": \"span\",\n  accept: \"button\",\n  outcome: \"div\",\n  \"outcome-icon\": \"span\",\n});\n\nexport type PlanProps = ComponentProps<typeof parts.Root>;\n\n/**\n * The steps an agent plans to take, with how many are done and, while `onAccept` is set, an Accept button that\n * \"Accepted\" replaces. Any `children` replace the default parts.\n */\nexport function Plan({ children, ...props }: PlanProps) {\n  return <parts.Root {...props}>{children !== undefined ? children : DEFAULT_PARTS}</parts.Root>;\n}\n\nexport const PlanTrigger = parts.Trigger;\nexport const PlanIcon = parts.Icon;\nexport const PlanContent = parts.Content;\nexport const PlanItemIcon = parts.ItemIcon;\nexport const PlanOutcomeIcon = parts.OutcomeIcon;\n\nexport type PlanTitleProps = ComponentProps<typeof parts.Title>;\n\n/** The `label`, else \"Plan\", unless you pass children. */\nexport function PlanTitle({ children = ({ title }) => title, ...props }: PlanTitleProps) {\n  return <parts.Title {...props}>{children}</parts.Title>;\n}\n\nexport type PlanMetaProps = ComponentProps<typeof parts.Meta>;\n\n/** How many items are done, as \"3 of 5\", unless you pass children. */\nexport function PlanMeta({ children = ({ done, total }) => `${done} of ${total}`, ...props }: PlanMetaProps) {\n  return <parts.Meta {...props}>{children}</parts.Meta>;\n}\n\nexport type PlanProgressProps = ComponentProps<typeof parts.Progress>;\n\n/**\n * A UI SDK Progress of the items done, labeled \"3 of 5 steps\", unless you pass children. Not in the default parts,\n * whose meta says the same.\n */\nexport function PlanProgress({\n  children = ({ value, label }) => (\n    <Progress value={value}>\n      <ProgressLabel>{label}</ProgressLabel>\n      <ProgressTrack>\n        <ProgressIndicator />\n      </ProgressTrack>\n    </Progress>\n  ),\n  ...props\n}: PlanProgressProps) {\n  return <parts.Progress {...props}>{children}</parts.Progress>;\n}\n\nexport type PlanListProps = ComponentProps<typeof parts.List>;\n\n/** An item for each of the `items`, unless you pass children. */\nexport function PlanList({\n  children = ({ items }) => items.map((item) => <PlanItem key={item.id} value={item.id} />),\n  ...props\n}: PlanListProps) {\n  return <parts.List {...props}>{children}</parts.List>;\n}\n\nexport type PlanItemProps = ComponentProps<typeof parts.Item>;\n\n/** The item whose `id` is `value`. Without children, it shows the item's mark, title and description. */\nexport function PlanItem({ children, ...props }: PlanItemProps) {\n  return <parts.Item {...props}>{children !== undefined ? children : DEFAULT_ITEM_PARTS}</parts.Item>;\n}\n\nexport type PlanItemTitleProps = ComponentProps<typeof parts.ItemTitle>;\n\n/** The item's `title`, unless you pass children. */\nexport function PlanItemTitle({ children = ({ title }) => title, ...props }: PlanItemTitleProps) {\n  return <parts.ItemTitle {...props}>{children}</parts.ItemTitle>;\n}\n\nexport type PlanItemDescriptionProps = ComponentProps<typeof parts.ItemDescription>;\n\n/** The item's `description`, unless you pass children. Rendered only while the item has one. */\nexport function PlanItemDescription({\n  children = ({ description }) => description,\n  ...props\n}: PlanItemDescriptionProps) {\n  return <parts.ItemDescription {...props}>{children}</parts.ItemDescription>;\n}\n\nexport type PlanAcceptProps = ComponentProps<typeof parts.Accept>;\n\n/**\n * Calls `onAccept`. Reads \"Accept plan\", with a running mark while pending, unless you pass children. Rendered only\n * while `onAccept` is set and the plan isn't accepted.\n */\nexport function PlanAccept({ children = ACCEPT, ...props }: PlanAcceptProps) {\n  return <parts.Accept {...props}>{children}</parts.Accept>;\n}\n\nexport type PlanOutcomeProps = ComponentProps<typeof parts.Outcome>;\n\n/** \"Accepted\" with a complete mark, in Accept's place once the plan is accepted, unless you pass children. */\nexport function PlanOutcome({ children = OUTCOME, ...props }: PlanOutcomeProps) {\n  return <parts.Outcome {...props}>{children}</parts.Outcome>;\n}\n\nconst ACCEPT = (\n  <>\n    <span data-kind-pending-mark=\"\" data-status-mark=\"\" data-status=\"running\" aria-hidden=\"true\" />\n    Accept plan\n  </>\n);\n\nconst OUTCOME = (\n  <>\n    <PlanOutcomeIcon />\n    Accepted\n  </>\n);\n\n// Shared, so an update to the items doesn't render the default parts' wrappers again.\nconst DEFAULT_ITEM_PARTS = (\n  <>\n    <PlanItemIcon />\n    <PlanItemTitle />\n    <PlanItemDescription />\n  </>\n);\n\nconst DEFAULT_PARTS = (\n  <>\n    <PlanTrigger>\n      <PlanIcon />\n      <PlanTitle />\n      <PlanMeta />\n    </PlanTrigger>\n    <PlanContent>\n      <PlanList />\n    </PlanContent>\n    <PlanAccept />\n    <PlanOutcome />\n  </>\n);\n",
      "type": "registry:ui",
      "target": "@ui/plan.tsx"
    }
  ],
  "meta": {
    "layer": "react"
  },
  "type": "registry:ui"
}
