{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "attachments",
  "title": "Attachments",
  "description": "A removable list of attached files.",
  "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/attachments.tsx",
      "content": "\"use client\";\n\nimport { type AttachmentsRootState, attachmentsPrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/react/primitive\";\nimport type { ComponentProps } from \"react\";\n\nconst parts = createParts(attachmentsPrimitive, { root: \"ul\", item: \"li\", remove: \"span\" });\n\nexport type AttachmentsProps = ComponentProps<typeof parts.Root>;\n\n/**\n * The `items` as chips, one Tab stop with arrow keys between them. Name it with `aria-label`. Without children, each\n * of its `rows` gets an `Attachment`, so a removed chip fades out. To style the chips, pass a function of `{ rows }`\n * that renders an `Attachment` per row, with the item's `id` as its `value`; chips rendered from `items` instead\n * leave at once.\n */\nexport function Attachments({ children = ROWS, ...props }: AttachmentsProps) {\n  return <parts.Root {...props}>{children}</parts.Root>;\n}\n\nconst ROWS = ({ rows }: AttachmentsRootState) =>\n  rows.map((row) => <Attachment key={row.item.id} value={row.item.id} />);\n\n/** One chip: an image's preview or a file icon, the name, the size or error, and a remove button. */\nexport function Attachment(props: Omit<ComponentProps<typeof parts.Item>, \"children\">) {\n  return (\n    <parts.Item {...props}>\n      {({ item, preview, detail }) => (\n        <>\n          {preview ? <img data-preview=\"\" src={preview} alt=\"\" /> : <span data-icon=\"\" />}\n          <span data-name=\"\">{item?.name}</span>\n          <span data-detail=\"\">{detail}</span>\n          <parts.Remove value={props.value} />\n        </>\n      )}\n    </parts.Item>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/attachments.tsx"
    }
  ],
  "meta": {
    "layer": "react"
  },
  "type": "registry:ui"
}
