{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "task",
  "title": "Task",
  "description": "The steps an agent takes for a task, as it takes them, with how many are done.",
  "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/task.tsx",
      "content": "\"use client\";\n\nimport { taskPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/react/primitive\";\nimport type { ComponentProps } from \"react\";\n\nconst parts = createParts(taskPrimitive, {\n  root: \"div\",\n  trigger: \"button\",\n  icon: \"span\",\n  title: \"span\",\n  meta: \"span\",\n  content: \"div\",\n  list: \"ol\",\n  item: \"li\",\n  \"item-icon\": \"span\",\n  \"item-title\": \"span\",\n  \"item-files\": \"span\",\n});\n\nexport type TaskProps = ComponentProps<typeof parts.Root>;\n\n/**\n * The steps an agent takes for one task, as it takes them, with how many are done. Any `children` replace the\n * default trigger and content.\n */\nexport function Task({ children, ...props }: TaskProps) {\n  return <parts.Root {...props}>{children !== undefined ? children : DEFAULT_PARTS}</parts.Root>;\n}\n\nexport const TaskTrigger = parts.Trigger;\nexport const TaskIcon = parts.Icon;\nexport const TaskContent = parts.Content;\nexport const TaskItemIcon = parts.ItemIcon;\n\nexport type TaskTitleProps = ComponentProps<typeof parts.Title>;\n\n/** The `label`, else \"Task\", unless you pass children. */\nexport function TaskTitle({ children = ({ title }) => title, ...props }: TaskTitleProps) {\n  return <parts.Title {...props}>{children}</parts.Title>;\n}\n\nexport type TaskMetaProps = ComponentProps<typeof parts.Meta>;\n\n/** How many items are complete, as \"2 of 5\", unless you pass children. */\nexport function TaskMeta({ children = ({ done, total }) => `${done} of ${total}`, ...props }: TaskMetaProps) {\n  return <parts.Meta {...props}>{children}</parts.Meta>;\n}\n\nexport type TaskListProps = ComponentProps<typeof parts.List>;\n\n/** An item for each of the `items`, unless you pass children. */\nexport function TaskList({\n  children = ({ items }) => items.map((item) => <TaskItem key={item.id} value={item.id} />),\n  ...props\n}: TaskListProps) {\n  return <parts.List {...props}>{children}</parts.List>;\n}\n\nexport type TaskItemProps = ComponentProps<typeof parts.Item>;\n\n/** The item whose `id` is `value`. Without children, it shows the item's mark, title and files. */\nexport function TaskItem({ children, ...props }: TaskItemProps) {\n  return <parts.Item {...props}>{children !== undefined ? children : DEFAULT_ITEM_PARTS}</parts.Item>;\n}\n\nexport type TaskItemTitleProps = ComponentProps<typeof parts.ItemTitle>;\n\n/** The item's `title`, unless you pass children. */\nexport function TaskItemTitle({ children = ({ title }) => title, ...props }: TaskItemTitleProps) {\n  return <parts.ItemTitle {...props}>{children}</parts.ItemTitle>;\n}\n\nexport type TaskItemFilesProps = ComponentProps<typeof parts.ItemFiles>;\n\n/** The item's `files`, each as code, unless you pass children. Rendered only while the item has files. */\nexport function TaskItemFiles({\n  // A step can touch one file twice, so files are keyed by place.\n  children = ({ files }) => files.map((file, index) => <code key={index}>{file}</code>),\n  ...props\n}: TaskItemFilesProps) {\n  return <parts.ItemFiles {...props}>{children}</parts.ItemFiles>;\n}\n\n// Shared, so an update to the items doesn't render the default parts' wrappers again.\nconst DEFAULT_ITEM_PARTS = (\n  <>\n    <TaskItemIcon />\n    <TaskItemTitle />\n    <TaskItemFiles />\n  </>\n);\n\nconst DEFAULT_PARTS = (\n  <>\n    <TaskTrigger>\n      <TaskIcon />\n      <TaskTitle />\n      <TaskMeta />\n    </TaskTrigger>\n    <TaskContent>\n      <TaskList />\n    </TaskContent>\n  </>\n);\n",
      "type": "registry:ui",
      "target": "@ui/task.tsx"
    }
  ],
  "meta": {
    "layer": "react"
  },
  "type": "registry:ui"
}
