{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "attachments-vue",
  "title": "Attachments (Vue)",
  "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/vue@0.1.0-beta.17"
  ],
  "registryDependencies": [
    "@kind-ui/agent-ui-setup"
  ],
  "files": [
    {
      "path": "packages/agent-ui/src/vue/attachments.ts",
      "content": "import {\n  type AttachmentState,\n  type AttachmentsRootState,\n  attachmentsPrimitive,\n} from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/vue/primitive\";\nimport { defineComponent, h } from \"vue\";\n\n// `@ui-sdk/vue`'s `createParts` hands the primitive an emitter for every callback, whether or not anything listens, so\n// `onRemove`, whose presence makes the chips removable, is declared a function prop instead, which `@remove` binds.\nconst primitive = Object.defineProperty(\n  Object.assign((options: never) => attachmentsPrimitive(options), attachmentsPrimitive, {\n    options: { ...attachmentsPrimitive.options, onRemove: \"action\" },\n  }),\n  \"name\",\n  { value: attachmentsPrimitive.name },\n) as typeof attachmentsPrimitive;\n\nconst parts = createParts(primitive, { root: \"ul\", item: \"li\", remove: \"span\" });\n\n/** One chip: an image's preview or a file icon, the name, the size or error, and a remove button. */\nexport const Attachment = defineComponent({\n  name: \"Attachment\",\n  inheritAttrs: false,\n  props: { value: { type: String, required: true } },\n  setup(props, { attrs, slots }) {\n    return () =>\n      h(\n        parts.Item,\n        { ...attrs, value: props.value },\n        {\n          ...slots,\n          default: ({ state }: { state: AttachmentState }) => [\n            state.preview\n              ? h(\"img\", { \"data-preview\": \"\", src: state.preview, alt: \"\" })\n              : h(\"span\", { \"data-icon\": \"\" }),\n            h(\"span\", { \"data-name\": \"\" }, state.item?.name),\n            h(\"span\", { \"data-detail\": \"\" }, state.detail),\n            h(parts.Remove, { value: props.value }),\n          ],\n        },\n      );\n  },\n});\n\nconst rows = ({ state }: { state: AttachmentsRootState }) =>\n  state.rows.map((row) => h(Attachment, { key: row.item.id, value: row.item.id }));\n\n/**\n * The `items` as chips, one Tab stop with arrow keys between them. Name it with `aria-label`. Without a default slot,\n * each of its `rows` gets an `Attachment`, so a removed chip fades out. To style the chips, give it a default slot of\n * `{ state }` that renders an `Attachment` per `state.rows` entry, with the item's `id` as its `value`; chips rendered\n * from `items` instead leave at once.\n */\nexport const Attachments = defineComponent({\n  name: \"Attachments\",\n  inheritAttrs: false,\n  setup(_, { attrs, slots }) {\n    return () => h(parts.Root, attrs, { ...slots, default: slots.default ?? rows });\n  },\n}) as unknown as typeof parts.Root;\n",
      "type": "registry:ui",
      "target": "@ui/vue/attachments.ts"
    }
  ],
  "meta": {
    "layer": "vue"
  },
  "type": "registry:ui"
}
