{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "attachments-solid",
  "title": "Attachments (Solid)",
  "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/solid@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/solid/attachments.tsx",
      "content": "import { type AttachmentsRootState, attachmentsPrimitive } from \"@kind-ui/agent-ui/core\";\nimport type { ComponentProps } from \"@solidjs/web\";\nimport { createParts } from \"@ui-sdk/solid/primitive\";\nimport { For, omit, Show } from \"solid-js\";\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(props: AttachmentsProps) {\n  return <parts.Root {...omit(props, \"children\")}>{props.children ?? ROWS}</parts.Root>;\n}\n\nconst ROWS = (state: AttachmentsRootState) => (\n  <For each={state.rows} keyed={(row) => row.item.id}>\n    {(row) => <Attachment value={row().item.id} />}\n  </For>\n);\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      {(state) => (\n        <>\n          <Show when={state.preview} fallback={<span data-icon=\"\" />}>\n            <img data-preview=\"\" src={state.preview} alt=\"\" />\n          </Show>\n          <span data-name=\"\">{state.item?.name}</span>\n          <span data-detail=\"\">{state.detail}</span>\n          <parts.Remove value={props.value} />\n        </>\n      )}\n    </parts.Item>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/solid/attachments.tsx"
    }
  ],
  "meta": {
    "layer": "solid"
  },
  "type": "registry:ui"
}
