{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "uploader-vue",
  "title": "Uploader (Vue)",
  "description": "File uploads with progress, cancel and retry.",
  "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/uploader.ts",
      "content": "import {\n  type UploaderListState,\n  type UploaderRootState,\n  type UploadItemState,\n  uploaderPrimitive,\n} from \"@kind-ui/agent-ui/core\";\nimport { FileInput, FileInputDropzone, FileInputTrigger } from \"@ui-sdk/vue/file-input\";\nimport { createParts } from \"@ui-sdk/vue/primitive\";\nimport { Progress, ProgressIndicator, ProgressLabel, ProgressTrack } from \"@ui-sdk/vue/progress\";\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// `onCancel` and `onRetry`, whose presence offers Cancel and Retry, are declared function props instead, which\n// `@cancel` and `@retry` bind. `@files` and `@reject` stay events.\nconst primitive = Object.defineProperty(\n  Object.assign((options: never) => uploaderPrimitive(options), uploaderPrimitive, {\n    options: { ...uploaderPrimitive.options, onCancel: \"action\", onRetry: \"action\" },\n  }),\n  \"name\",\n  { value: uploaderPrimitive.name },\n) as typeof uploaderPrimitive;\n\nconst parts = createParts(primitive, { root: \"div\", list: \"ul\", item: \"li\", action: \"button\" });\n\n/** One upload: the file's name and progress bar, what it's doing, and its action. */\nexport const UploaderItem = defineComponent({\n  name: \"UploaderItem\",\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: { item, detail } }: { state: UploadItemState }) => [\n            h(\"span\", { \"data-icon\": \"\" }),\n            h(Progress, { value: item?.progress ?? null }, () => [\n              h(ProgressLabel, null, () => item?.name),\n              h(ProgressTrack, null, () => h(ProgressIndicator)),\n            ]),\n            h(\"span\", { \"data-detail\": \"\" }, detail),\n            h(parts.Action, { value: props.value }),\n          ],\n        },\n      );\n  },\n});\n\nconst rows = ({ state }: { state: UploaderListState }) =>\n  state.rows.map((row) => h(UploaderItem, { key: row.item.id, value: row.item.id }));\n\nconst children = ({ state: { fileInput } }: { state: UploaderRootState }) => [\n  h(FileInput, fileInput, () =>\n    h(FileInputDropzone, null, () => [\n      h(\"span\", { \"data-upload-icon\": \"\" }),\n      h(\"span\", { \"data-hint\": \"\" }, \"Drop files here, or\"),\n      h(FileInputTrigger, null, () => \"browse\"),\n    ]),\n  ),\n  h(parts.List, null, { default: rows }),\n];\n\n/**\n * A File Input drop zone with a Browse button, then a row per item with its progress, and Cancel or Retry while the\n * host listens to `cancel` or `retry`. Name it with `aria-label`.\n */\nexport const Uploader = defineComponent({\n  name: \"Uploader\",\n  inheritAttrs: false,\n  setup(_, { attrs, slots }) {\n    return () => h(parts.Root, attrs, { ...slots, default: children });\n  },\n}) as unknown as typeof parts.Root;\n",
      "type": "registry:ui",
      "target": "@ui/vue/uploader.ts"
    }
  ],
  "meta": {
    "layer": "vue"
  },
  "type": "registry:ui"
}
