{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "attachment",
  "title": "Attachment",
  "description": "Astro attachment parts for file and image previews with upload state and actions.",
  "dependencies": [
    "class-variance-authority",
    "cn"
  ],
  "registryDependencies": [
    "@gnostic/button"
  ],
  "files": [
    {
      "path": "packages/ui/src/components/ui/attachment/attachment-action.astro",
      "content": "---\n/**\n * Icon or text action on an attachment. Renders a ghost {@link Button} by default.\n */\nimport type { ComponentProps } from \"astro/types\"\n\nimport { cn } from \"cn\"\nimport { Button } from \"../button/index.ts\"\nimport type { AttachmentActionProps } from \"./types.ts\"\n\ntype Props = ComponentProps<typeof Button> & AttachmentActionProps\n\nconst {\n  class: className,\n  variant = \"ghost\",\n  size = \"icon-xs\",\n  ...props\n} = Astro.props\n---\n\n<Button\n  data-slot=\"attachment-action\"\n  variant={variant}\n  size={size}\n  class={cn(className)}\n  {...props}\n>\n  <slot />\n</Button>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment-action.astro"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/attachment-actions.astro",
      "content": "---\n/**\n * Aligns one or more attachment actions at the end of the card.\n */\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"cn\"\n\ntype Props = HTMLAttributes<\"div\">\n\nconst { class: className, ...props } = Astro.props\n---\n\n<div\n  data-slot=\"attachment-actions\"\n  class={cn(\"group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 relative z-20 group-data-[orientation=vertical]/attachment:gap-1 flex shrink-0 items-center\", className)}\n  {...props}\n>\n  <slot />\n</div>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment-actions.astro"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/attachment-content.astro",
      "content": "---\n/**\n * Groups the attachment title and description.\n */\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"cn\"\n\ntype Props = HTMLAttributes<\"div\">\n\nconst { class: className, ...props } = Astro.props\n---\n\n<div\n  data-slot=\"attachment-content\"\n  class={cn(\"leading-tight group-data-[orientation=vertical]/attachment:px-1 max-w-full min-w-0 flex-1\", className)}\n  {...props}\n>\n  <slot />\n</div>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment-content.astro"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/attachment-description.astro",
      "content": "---\n/**\n * Secondary metadata for an attachment, such as type, size, or status text.\n */\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"cn\"\n\ntype Props = HTMLAttributes<\"span\">\n\nconst { class: className, ...props } = Astro.props\n---\n\n<span\n  data-slot=\"attachment-description\"\n  class={cn(\n    \"mt-0.5 text-xs block max-w-full min-w-0 truncate text-muted-foreground group-data-[state=error]/attachment:text-destructive/80\",\n    className,\n  )}\n  {...props}\n>\n  <slot />\n</span>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment-description.astro"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/attachment-group.astro",
      "content": "---\n/**\n * Horizontally scrollable row of attachments with snap points and edge fade.\n */\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"cn\"\n\ntype Props = HTMLAttributes<\"div\">\n\nconst { class: className, ...props } = Astro.props\n---\n\n<div\n  data-slot=\"attachment-group\"\n  class={cn(\n    \"gap-3 scroll-px-1 py-1 flex min-w-0 scroll-fade-x snap-x snap-mandatory scrollbar-none overflow-x-auto overscroll-x-contain *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start\",\n    className,\n  )}\n  {...props}\n>\n  <slot />\n</div>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment-group.astro"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/attachment-media.astro",
      "content": "---\n/**\n * Media slot for an icon, spinner, or image preview on an attachment.\n */\nimport type { HTMLAttributes } from \"astro/types\"\nimport type { VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"cn\"\n\nimport { attachmentMediaVariants } from \"./attachment-variants.ts\"\nimport type { AttachmentMediaProps } from \"./types.ts\"\n\ntype Props = HTMLAttributes<\"div\"> &\n  AttachmentMediaProps &\n  VariantProps<typeof attachmentMediaVariants>\n\nconst { class: className, variant = \"icon\", ...props } = Astro.props\n---\n\n<div\n  data-slot=\"attachment-media\"\n  data-variant={variant}\n  class={cn(attachmentMediaVariants({ variant }), className)}\n  {...props}\n>\n  <slot />\n</div>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment-media.astro"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/attachment-title.astro",
      "content": "---\n/**\n * Primary label for an attachment, usually the file name.\n * Shimmers while the root attachment is uploading or processing.\n */\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"cn\"\n\ntype Props = HTMLAttributes<\"span\">\n\nconst { class: className, ...props } = Astro.props\n---\n\n<span\n  data-slot=\"attachment-title\"\n  class={cn(\n    \"font-medium block max-w-full min-w-0 truncate group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer\",\n    className,\n  )}\n  {...props}\n>\n  <slot />\n</span>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment-title.astro"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/attachment-trigger.astro",
      "content": "---\n/**\n * Full-card control behind attachment actions. Use `as` for a link or other element.\n */\nimport type { HTMLAttributes } from \"astro/types\"\nimport type { HTMLTag, Polymorphic } from \"astro/types\"\n\nimport { cn } from \"cn\"\n\ntype Props<T extends HTMLTag = \"button\"> = Polymorphic<{ as: T }> &\n  HTMLAttributes<T>\n\nconst {\n  as: Tag = \"href\" in Astro.props ? \"a\" : \"button\",\n  class: className,\n  ...props\n} = Astro.props\n\nconst elementProps: Record<string, unknown> = { ...props }\nelementProps.type = Tag === \"button\" ? elementProps.type || \"button\" : undefined\n---\n\n<Tag\n  data-slot=\"attachment-trigger\"\n  class={cn(\"absolute inset-0 z-10 outline-none\", className)}\n  {...elementProps}\n>\n  <slot />\n</Tag>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment-trigger.astro"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/attachment-variants.ts",
      "content": "import { cva } from 'class-variance-authority'\n\n/** Root attachment layout, size, and orientation recipes. */\nexport const attachmentVariants = cva(\"relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-2xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/30 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed group/attachment\", {\n    defaultVariants: {\n        orientation: 'horizontal',\n        size: 'default',\n    },\n    variants: {\n        orientation: {\n            horizontal: \"min-w-40 items-center\",\n            vertical: \"w-24 has-data-[slot=attachment-content]:w-30 flex-col\",\n        },\n        size: {\n            default: \"gap-2 has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2 text-sm\",\n            sm: \"gap-2.5 has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5 text-xs\",\n            xs: \"gap-1.5 has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1 text-xs rounded-xl\",\n        },\n    },\n})\n\n/** Media slot recipes for icon and image attachments. */\nexport const attachmentMediaVariants = cva(\n    \"bg-muted text-foreground w-10 rounded-lg group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md [&_svg:not([class*='size-'])]:size-4 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5 group-data-[orientation=vertical]/attachment:w-full group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive relative flex aspect-square shrink-0 items-center justify-center overflow-hidden [&_svg]:pointer-events-none\",\n    {\n        defaultVariants: {\n            variant: 'icon',\n        },\n        variants: {\n            variant: {\n                icon: '',\n                image: \"opacity-60 group-data-[state=idle]/attachment:opacity-100 group-data-[state=done]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover\",\n            },\n        },\n    },\n)\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment-variants.ts"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/attachment.astro",
      "content": "---\n/**\n * Root container for a file or image attachment.\n * Compose media, content, actions, and an optional full-card trigger inside it.\n *\n * @see https://ui.shadcn.com/docs/components/base/attachment\n */\nimport type { HTMLAttributes } from \"astro/types\"\n\nimport { cn } from \"cn\"\n\nimport { attachmentVariants } from \"./attachment-variants.ts\"\nimport type { AttachmentProps } from \"./types.ts\"\n\ntype Props = HTMLAttributes<\"div\"> & AttachmentProps\n\nconst {\n  class: className,\n  state = \"done\",\n  size = \"default\",\n  orientation = \"horizontal\",\n  ...props\n} = Astro.props\n---\n\n<div\n  data-slot=\"attachment\"\n  data-state={state}\n  data-size={size}\n  data-orientation={orientation}\n  class={cn(attachmentVariants({ orientation, size }), className)}\n  {...props}\n>\n  <slot />\n</div>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/attachment.astro"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/index.ts",
      "content": "/** Attachment parts follow https://ui.shadcn.com/docs/components/base/attachment */\nexport { default as Attachment } from './attachment.astro'\nexport { default as AttachmentAction } from './attachment-action.astro'\nexport { default as AttachmentActions } from './attachment-actions.astro'\nexport { default as AttachmentContent } from './attachment-content.astro'\nexport { default as AttachmentDescription } from './attachment-description.astro'\nexport { default as AttachmentGroup } from './attachment-group.astro'\nexport { default as AttachmentMedia } from './attachment-media.astro'\nexport { default as AttachmentTitle } from './attachment-title.astro'\nexport { default as AttachmentTrigger } from './attachment-trigger.astro'\n\nexport type {\n    AttachmentActionProps,\n    AttachmentMediaProps,\n    AttachmentProps,\n    AttachmentState,\n} from './types.ts'\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/index.ts"
    },
    {
      "path": "packages/ui/src/components/ui/attachment/types.ts",
      "content": "import type { ButtonProps } from '../button/types.ts'\n\n/** Upload lifecycle state for an attachment card. */\nexport type AttachmentState =\n    | 'idle'\n    | 'uploading'\n    | 'processing'\n    | 'error'\n    | 'done'\n\n/**\n * Props for the root attachment container.\n * HTML attributes such as `class` and `id` pass through on the element.\n */\nexport interface AttachmentProps {\n    /**\n     * Upload state. Drives border treatment and title shimmer while in progress.\n     *\n     * @default done\n     */\n    state?: AttachmentState\n    /**\n     * Attachment density.\n     *\n     * @default default\n     */\n    size?: 'default' | 'sm' | 'xs'\n    /**\n     * Lay media beside or above the text content.\n     *\n     * @default horizontal\n     */\n    orientation?: 'horizontal' | 'vertical'\n}\n\n/**\n * Props for the attachment media slot.\n * HTML attributes such as `class` pass through on the element.\n */\nexport interface AttachmentMediaProps {\n    /**\n     * Whether the slot holds an icon or an image preview.\n     *\n     * @default icon\n     */\n    variant?: 'icon' | 'image'\n}\n\n/**\n * Props for an attachment action control.\n * Button attributes such as `aria-label`, `variant`, and `disabled` pass through.\n */\nexport interface AttachmentActionProps {\n    /**\n     * Button size for the icon action.\n     *\n     * @default icon-xs\n     */\n    size?: ButtonProps['size']\n}\n",
      "type": "registry:file",
      "target": "~/src/components/ui/attachment/types.ts"
    }
  ],
  "meta": {
    "framework": "astro",
    "source": "@gnostic/ui",
    "testedDependencies": {
      "class-variance-authority": "^0.7.1",
      "cn": "0.5.2"
    }
  },
  "docs": "https://ui.gnosticai.com/components/attachment",
  "categories": [
    "ui"
  ],
  "type": "registry:ui"
}
