{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "generated-image",
  "title": "Generated Image",
  "description": "An image the agent is making, from progress and a blurred preview to the image, which opens full size.",
  "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/generated-image.tsx",
      "content": "\"use client\";\n\nimport { generatedImagePrimitive } from \"@kind-ui/agent-ui/core\";\nimport { createParts } from \"@ui-sdk/react/primitive\";\nimport {\n  Progress,\n  ProgressIndicator,\n  ProgressLabel,\n  ProgressTrack,\n  ProgressValue,\n} from \"@ui-sdk/react/progress\";\nimport type { ComponentProps } from \"react\";\n\nconst parts = createParts(generatedImagePrimitive, {\n  root: \"div\",\n  frame: \"div\",\n  preview: \"img\",\n  progress: \"div\",\n  image: \"img\",\n  error: \"div\",\n  trigger: \"button\",\n  download: \"button\",\n  backdrop: \"div\",\n  content: \"div\",\n  \"full-image\": \"img\",\n  title: \"h2\",\n  close: \"button\",\n});\n\nexport type GeneratedImageProps = ComponentProps<typeof parts.Root>;\n\n/**\n * An image the agent is making: a frame of the image's shape that shows its progress and a blurred preview, then\n * the image, which opens full size. Any `children` replace the frame and the full size view.\n */\nexport function GeneratedImage({ children = DEFAULT_PARTS, ...props }: GeneratedImageProps) {\n  return <parts.Root {...props}>{children}</parts.Root>;\n}\n\nexport type GeneratedImageFrameProps = ComponentProps<typeof parts.Frame>;\n\n/** Keeps the image's shape in every phase. Holds the preview, progress, image, error, trigger and Download. */\nexport function GeneratedImageFrame({ children = DEFAULT_FRAME, ...props }: GeneratedImageFrameProps) {\n  return <parts.Frame {...props}>{children}</parts.Frame>;\n}\n\n/** The `preview`, blurred and sharpening with `progress`, while the image is on its way. */\nexport const GeneratedImagePreview = parts.Preview;\n\nexport type GeneratedImageProgressProps = ComponentProps<typeof parts.Progress>;\n\n/**\n * A UI SDK Progress, read as a quiet corner label like \"Creating image · 42%\" until the image loads, unless you pass\n * children.\n */\nexport function GeneratedImageProgress({\n  children = ({ value, label }) => (\n    <Progress value={value}>\n      <ProgressLabel>{label}</ProgressLabel>\n      <ProgressValue />\n      <ProgressTrack>\n        <ProgressIndicator />\n      </ProgressTrack>\n    </Progress>\n  ),\n  ...props\n}: GeneratedImageProgressProps) {\n  return <parts.Progress {...props}>{children}</parts.Progress>;\n}\n\n/** The image at `src`, which fades in once it loads. */\nexport const GeneratedImageImage = parts.Image;\n\nexport type GeneratedImageErrorProps = ComponentProps<typeof parts.Error>;\n\n/** What went wrong, under a muted image glyph, unless you pass children. */\nexport function GeneratedImageError({\n  children = ({ message }) => message,\n  ...props\n}: GeneratedImageErrorProps) {\n  return <parts.Error {...props}>{children}</parts.Error>;\n}\n\n/** \"View full size\": covers the loaded image and opens it in a dialog. */\nexport const GeneratedImageTrigger = parts.Trigger;\n\n/** Calls `onDownload`. Rendered while it's set and the image is loaded. */\nexport const GeneratedImageDownload = parts.Download;\n\n/** Dims the page behind the full size view. */\nexport const GeneratedImageBackdrop = parts.Backdrop;\n\nexport type GeneratedImageDialogProps = ComponentProps<typeof parts.Content>;\n\n/** The full size view: the image, its `alt` as the title, Download and Close, unless you pass children. */\nexport function GeneratedImageDialog({ children = DEFAULT_DIALOG, ...props }: GeneratedImageDialogProps) {\n  return <parts.Content {...props}>{children}</parts.Content>;\n}\n\n/** The image at full size, inside the dialog. */\nexport const GeneratedImageFullImage = parts.FullImage;\n\nexport type GeneratedImageTitleProps = ComponentProps<typeof parts.Title>;\n\n/** The `alt`, unless you pass children. Names the dialog. */\nexport function GeneratedImageTitle({ children = ({ alt }) => alt, ...props }: GeneratedImageTitleProps) {\n  return <parts.Title {...props}>{children}</parts.Title>;\n}\n\nexport type GeneratedImageCloseProps = ComponentProps<typeof parts.Close>;\n\n/** Closes the dialog and returns focus to the trigger. \"Close\", unless you pass children. */\nexport function GeneratedImageClose({ children = \"Close\", ...props }: GeneratedImageCloseProps) {\n  return <parts.Close {...props}>{children}</parts.Close>;\n}\n\n// Shared, so an update doesn't render the default parts' wrappers again.\nconst DEFAULT_FRAME = (\n  <>\n    <GeneratedImagePreview />\n    <GeneratedImageImage />\n    <GeneratedImageProgress />\n    <GeneratedImageError />\n    <GeneratedImageTrigger />\n    <GeneratedImageDownload />\n  </>\n);\n\nconst DEFAULT_DIALOG = (\n  <>\n    <GeneratedImageFullImage />\n    <div data-generated-image-actions=\"\">\n      <GeneratedImageTitle />\n      <GeneratedImageDownload>Download</GeneratedImageDownload>\n      <GeneratedImageClose />\n    </div>\n  </>\n);\n\nconst DEFAULT_PARTS = (\n  <>\n    <GeneratedImageFrame />\n    <GeneratedImageBackdrop />\n    <GeneratedImageDialog />\n  </>\n);\n",
      "type": "registry:ui",
      "target": "@ui/generated-image.tsx"
    }
  ],
  "meta": {
    "layer": "react"
  },
  "type": "registry:ui"
}
