{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "attachment",
  "title": "Attachment",
  "description": "File cards with image previews, upload progress, retry and remove actions, built on UI SDK core.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.9",
    "@ui-sdk/react@0.1.0-beta.9"
  ],
  "registryDependencies": [
    "@keyframery/motion",
    "@keyframery/message-scroller",
    "@keyframery/button"
  ],
  "files": [
    {
      "path": "registry/components/keyframery/core/attachment-core.ts",
      "content": "/* File attachments, as UI SDK primitives. UI SDK ships no attachment (its file input picks files;\n   this shows one that is attached), so these are defined with its core: the same definitions render\n   in React, Vue, Svelte, Solid and web components.\n\n   `attachment` is one file: a named group with its media, title, description, an upload progress\n   line and a row of actions. It plays its entrance when it mounts. `remove()` plays its exit, moves\n   focus to a neighbour if it held focus, then calls `onRemove(value)` so the app can drop it; a\n   listener that cancels keeps it, and it comes back. An action marked `data-action=\"remove\"`\n   inside the actions row calls `remove()`. `attachmentGroup` lines attachments up in a row. */\n\nimport { animateOut, css, definePrimitive, dispatch } from \"@ui-sdk/core\"\n\nimport { enter } from \"@/components/keyframery/core/message-scroller-core\"\n\ntype AttachmentStatus = \"idle\" | \"uploading\" | \"processing\" | \"error\" | \"done\"\n\n/* Not in the shared vocabulary: the person pressed the attachment's remove action. */\ntype AttachmentRemoveReason = \"remove-press\" | \"imperative\"\n\ntype AttachmentOptions = {\n  /** Where the file is: `\"idle\"` (not sent yet), `\"uploading\"`, `\"processing\"`, `\"error\"` or `\"done\"`. */\n  status?: AttachmentStatus\n  /** How much of the upload is done, from 0 to 100. Drawn while uploading. */\n  progress?: number\n  /** `\"default\"`, `\"sm\"` or `\"xs\"`. */\n  size?: \"default\" | \"sm\" | \"xs\"\n  /** `\"horizontal\"`: a chip with the media at the start. `\"vertical\"`: a tile with the media on top. */\n  orientation?: \"horizontal\" | \"vertical\"\n  /** What `onRemove` reports, like the file's id. */\n  value?: string\n  /** Called once the attachment has left, so the app can drop it. Cancel to keep it. */\n  onRemove?: (value: string | undefined, details: { reason: AttachmentRemoveReason; event?: Event; cancel(): void }) => void\n}\n\ntype AttachmentState = {\n  status: AttachmentStatus\n  progress: number\n  size: \"default\" | \"sm\" | \"xs\"\n  orientation: \"horizontal\" | \"vertical\"\n  removing: boolean\n}\n\nconst focusable = \"button:not([disabled]), a[href], input, [tabindex]:not([tabindex='-1'])\"\n\nconst attachment = definePrimitive({\n  name: \"attachment\",\n  options: {\n    status: \"string\",\n    progress: \"number\",\n    size: \"string\",\n    orientation: \"string\",\n    value: \"string\",\n    onRemove: \"callback\",\n  },\n  state: (options: AttachmentOptions): AttachmentState => ({\n    status: options.status ?? \"done\",\n    progress: options.progress ?? 0,\n    size: options.size ?? \"default\",\n    orientation: options.orientation ?? \"horizontal\",\n    removing: false,\n  }),\n  sync: (options) => ({\n    status: options.status ?? \"done\",\n    progress: options.progress ?? 0,\n    size: options.size ?? \"default\",\n    orientation: options.orientation ?? \"horizontal\",\n  }),\n  controlled: [\"status\", \"progress\", \"removing\"],\n  api: (context) => {\n    let stop: (() => void) | undefined\n    context.onDestroy(() => stop?.())\n\n    /* When focus is inside the attachment that leaves, hand it to the next one in its group (or\n       the one before), so a keyboard user can keep removing. */\n    const recoverFocus = (el: HTMLElement) => {\n      if (!el.contains(document.activeElement)) return\n      const group = el.closest(\"[data-slot='attachment-group']\")\n      const all = group ? Array.from(group.querySelectorAll<HTMLElement>(\"[data-slot='attachment']:not([data-removing])\")) : []\n      const at = all.indexOf(el)\n      const next = all.slice(at + 1).find((other) => other !== el) ?? all.slice(0, Math.max(at, 0)).reverse()[0]\n      const target = next?.querySelector<HTMLElement>(focusable)\n      if (target) target.focus()\n      else (document.activeElement as HTMLElement | null)?.blur()\n    }\n\n    return {\n      /** Plays the exit, then calls `onRemove`. */\n      remove(event?: Event) {\n        if (context.store.get().removing) return\n        const finish = () => {\n          const canceled = dispatch(context, \"onRemove\", context.options().value, {\n            reason: event ? \"remove-press\" : \"imperative\",\n            event,\n          })\n          if (canceled) context.store.set({ removing: false })\n        }\n        const el = context.element(\"root\")\n        context.store.set({ removing: true })\n        if (!el) return finish()\n        recoverFocus(el)\n        stop?.()\n        stop = animateOut(el, finish)\n      },\n    }\n  },\n  slots: (slot) => ({\n    root: slot<{}, AttachmentState>({\n      role: \"group\",\n      state: (state) => ({ ...state }),\n      attrs: (state, part) => ({\n        \"aria-labelledby\": `${part.id}-title`,\n        \"aria-describedby\": `${part.id}-description`,\n        \"aria-busy\": state.status === \"uploading\" || state.status === \"processing\" ? \"true\" : undefined,\n        \"data-status\": state.status,\n        \"data-size\": state.size,\n        \"data-orientation\": state.orientation,\n        \"data-removing\": state.removing ? \"\" : undefined,\n        style: css({ \"--attachment-progress\": String(Math.min(100, Math.max(0, state.progress)) / 100) }),\n      }),\n      /* Entrance, and the size the exit collapses from (so the ones after it slide over). */\n      bind: (el) => {\n        enter(el)\n        const measure = () => {\n          el.style.setProperty(\"--attachment-width\", `${el.offsetWidth}px`)\n          el.style.setProperty(\"--attachment-height\", `${el.offsetHeight}px`)\n        }\n        measure()\n        const observer = new ResizeObserver(measure)\n        observer.observe(el)\n        return () => {\n          observer.disconnect()\n        }\n      },\n    }),\n    media: slot<{ variant?: \"icon\" | \"image\" }>({\n      props: { variant: \"string\" },\n      attrs: (_state, part) => ({ \"data-variant\": part.props.variant ?? \"icon\" }),\n    }),\n    content: slot({}),\n    title: slot({\n      attrs: (_state, part) => ({ id: `${part.id}-title` }),\n    }),\n    description: slot({\n      attrs: (_state, part) => ({ id: `${part.id}-description` }),\n    }),\n    /* The upload line. Screen readers hear `aria-busy` on the group instead. */\n    progress: slot({\n      attrs: () => ({ \"aria-hidden\": \"true\" }),\n    }),\n    actions: slot({\n      on: {\n        click: (event, { api }) => {\n          if ((event.target as HTMLElement | null)?.closest(\"[data-action='remove']\")) api.remove(event)\n        },\n      },\n    }),\n    /* A button over the whole attachment, to open or preview it. */\n    trigger: slot({\n      attrs: () => ({ type: \"button\" }),\n    }),\n  }),\n  agent: { actions: [\"remove\"] },\n})\n\nconst attachmentGroup = definePrimitive({\n  name: \"attachment-group\",\n  state: () => ({}),\n  controlled: [],\n  api: () => ({}),\n  slots: (slot) => ({\n    root: slot({}),\n  }),\n  agent: { actions: [] },\n})\n\nexport { attachment, attachmentGroup, type AttachmentOptions, type AttachmentStatus }\n",
      "type": "registry:component",
      "target": "components/keyframery/core/attachment-core.ts"
    },
    {
      "path": "registry/components/keyframery/primitives/attachment.tsx",
      "content": "\"use client\"\n\n/* Animated file attachments, on UI SDK's core. UI SDK ships no attachment, so the behaviour is\n   defined in `@/components/core/attachment` with `definePrimitive` and rendered here; the actions\n   are UI SDK buttons. This file adds motion only. Colours, radii, shadows and spacing stay yours\n   (style `data-status`, `data-size` and `data-orientation`).\n\n   - Pop: a new attachment grows in from 80% with a blur that clears, settling with `ease-pop`.\n   - Leave: `remove()` shrinks and fades it, then closes the gap it leaves, so the attachments\n     after it slide over instead of jumping. Give the group's gap as `--attachment-gap`; in a\n     column, set `--attachment-collapse-x: 0` and `--attachment-collapse-y: 1` so it closes upward.\n   - The upload line fills on a spring as `progress` rises, and fades once the upload is done.\n   - An image sits dimmed and soft while it uploads and clears when it is done. */\n\nimport { createParts, type PartProps } from \"@ui-sdk/react/primitive\"\nimport * as React from \"react\"\n\nimport { attachment, attachmentGroup } from \"@/components/keyframery/core/attachment-core\"\nimport { Button } from \"@/components/keyframery/primitives/button\"\nimport { cn } from \"@/lib/utils\"\n\n/* UI SDK accepts a class name or a function of state; keep both working. */\nfunction withClass<S>(base: string, className: string | ((state: S) => string | undefined) | undefined) {\n  return typeof className === \"function\" ? (state: S) => cn(base, className(state)) : cn(base, className)\n}\n\nconst {\n  Root: AttachmentRoot,\n  Media: AttachmentMediaPart,\n  Content: AttachmentContentPart,\n  Title: AttachmentTitlePart,\n  Description: AttachmentDescriptionPart,\n  Progress: AttachmentProgressPart,\n  Actions: AttachmentActionsPart,\n  Trigger: AttachmentTriggerPart,\n} = createParts(attachment, {\n  root: \"div\",\n  media: \"div\",\n  content: \"div\",\n  title: \"span\",\n  description: \"span\",\n  progress: \"span\",\n  actions: \"div\",\n  trigger: \"button\",\n})\nconst { Root: AttachmentGroupRoot } = createParts(attachmentGroup, { root: \"div\" })\n\nfunction Attachment({ className, ...props }: React.ComponentProps<typeof AttachmentRoot>) {\n  return (\n    <AttachmentRoot\n      className={withClass(\n        cn(\n          \"group/attachment origin-center\",\n          \"[transition:scale_calc(520ms*var(--kf-speed,1))_var(--ease-pop),translate_calc(520ms*var(--kf-speed,1))_var(--ease-spring),opacity_calc(220ms*var(--kf-speed,1))_var(--ease-house),filter_calc(300ms*var(--kf-speed,1))_var(--ease-house)]\",\n          \"data-starting-style:scale-[0.8] data-starting-style:translate-y-1.5 data-starting-style:opacity-0 data-starting-style:blur-[6px] data-starting-style:transition-none\",\n          /* Leave: shrink and fade, then give its room back. */\n          \"data-ending-style:scale-[0.86] data-ending-style:opacity-0 data-ending-style:blur-[4px]\",\n          \"data-ending-style:[margin-inline-end:calc((var(--attachment-width,0px)+var(--attachment-gap,0px))*-1*var(--attachment-collapse-x,1))]\",\n          \"data-ending-style:[margin-block-end:calc((var(--attachment-height,0px)+var(--attachment-gap,0px))*-1*var(--attachment-collapse-y,0))]\",\n          \"data-ending-style:[transition:scale_calc(200ms*var(--kf-speed,1))_var(--ease-house),opacity_calc(180ms*var(--kf-speed,1))_var(--ease-house),filter_calc(180ms*var(--kf-speed,1))_var(--ease-house),margin-inline-end_calc(320ms*var(--kf-speed,1))_var(--ease-house)_calc(90ms*var(--kf-speed,1)),margin-block-end_calc(320ms*var(--kf-speed,1))_var(--ease-house)_calc(90ms*var(--kf-speed,1))]\",\n          \"motion-reduce:[transition:none]!\",\n        ),\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\n/* An image dims and softens while its file uploads, and clears when it is done. */\nfunction AttachmentMedia({ className, ...props }: React.ComponentProps<typeof AttachmentMediaPart>) {\n  return (\n    <AttachmentMediaPart\n      className={withClass(\n        cn(\n          \"data-[variant=image]:[&_img]:transition-[opacity,filter] data-[variant=image]:[&_img]:duration-[calc(420ms*var(--kf-speed,1))] data-[variant=image]:[&_img]:ease-house\",\n          \"group-data-[status=uploading]/attachment:data-[variant=image]:[&_img]:opacity-60 group-data-[status=uploading]/attachment:data-[variant=image]:[&_img]:blur-[2px]\",\n          \"group-data-[status=processing]/attachment:data-[variant=image]:[&_img]:opacity-75\",\n          \"motion-reduce:[&_img]:transition-none!\",\n        ),\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AttachmentContent(props: React.ComponentProps<typeof AttachmentContentPart>) {\n  return <AttachmentContentPart {...props} />\n}\n\nfunction AttachmentTitle(props: React.ComponentProps<typeof AttachmentTitlePart>) {\n  return <AttachmentTitlePart {...props} />\n}\n\nfunction AttachmentDescription(props: React.ComponentProps<typeof AttachmentDescriptionPart>) {\n  return <AttachmentDescriptionPart {...props} />\n}\n\n/* The upload line: fills on a spring to `progress`, fades once the upload is over. */\nfunction AttachmentProgress({ className, ...props }: React.ComponentProps<typeof AttachmentProgressPart>) {\n  return (\n    <AttachmentProgressPart\n      className={withClass(\n        cn(\n          \"origin-left rtl:origin-right [scale:var(--attachment-progress,0)_1]\",\n          \"[transition:scale_calc(620ms*var(--kf-speed,1))_var(--ease-spring),opacity_calc(260ms*var(--kf-speed,1))_var(--ease-house)_calc(200ms*var(--kf-speed,1))]\",\n          \"opacity-0 group-data-[status=uploading]/attachment:opacity-100\",\n          \"motion-reduce:[transition:none]!\",\n        ),\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AttachmentActions(props: React.ComponentProps<typeof AttachmentActionsPart>) {\n  return <AttachmentActionsPart {...props} />\n}\n\n/* One action: a UI SDK button. Mark it `data-action=\"remove\"` to remove the attachment with it,\n   or use `AttachmentRemove`. */\nfunction AttachmentAction(props: React.ComponentProps<typeof Button>) {\n  return <Button data-slot=\"attachment-action\" {...props} />\n}\n\nfunction XIcon() {\n  return (\n    <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n      <path d=\"m4.5 4.5 7 7m0-7-7 7\" />\n    </svg>\n  )\n}\n\n/* The remove action: plays the attachment's exit, then calls its `onRemove`. */\nfunction AttachmentRemove({ children, ...props }: React.ComponentProps<typeof Button>) {\n  return (\n    <AttachmentAction data-action=\"remove\" aria-label=\"Remove\" {...props}>\n      {children ?? <XIcon />}\n    </AttachmentAction>\n  )\n}\n\nfunction AttachmentTrigger(props: PartProps<\"button\">) {\n  return <AttachmentTriggerPart {...props} />\n}\n\nfunction AttachmentGroup({ className, ...props }: React.ComponentProps<typeof AttachmentGroupRoot>) {\n  return <AttachmentGroupRoot className={className} {...props} />\n}\n\nexport {\n  Attachment,\n  AttachmentAction,\n  AttachmentActions,\n  AttachmentContent,\n  AttachmentDescription,\n  AttachmentGroup,\n  AttachmentMedia,\n  AttachmentProgress,\n  AttachmentRemove,\n  AttachmentTitle,\n  AttachmentTrigger,\n}\n",
      "type": "registry:component",
      "target": "components/keyframery/primitives/attachment.tsx"
    },
    {
      "path": "registry/components/keyframery/attachment.tsx",
      "content": "\"use client\"\n\nexport * from \"@/components/keyframery/primitives/attachment\"\n\n/* Theming variables (set on a part or ancestor; absent values preserve the theme):\n   --attachment-face: File surface; default: bg-background.\n   --attachment-ink: File text; default: text-foreground.\n   --attachment-muted: File details; default: text-muted-foreground.\n   --attachment-radius: File corners; default: rounded-[12px].\n   --attachment-font: Filename size; default: text-[13px].\n   --attachment-media-size: Preview size; default: size-10.\n   --attachment-gap: File gap; default: gap-2.5.\n   --attachment-padding: File padding; default: p-1.5.\n*/\n\n/* Styled file attachments: the animated primitive plus the Keyframery look. A file sits on a small\n   sheet with its picture or icon in a well; not sent yet, the hairline is dashed; uploading, a thin\n   line fills along the foot; on error the hairline and icon turn destructive. The actions are\n   Keyframery buttons, so an attachment sits well beside a file input. */\n\nimport * as React from \"react\"\n\nimport {\n  Attachment as AttachmentPrimitive,\n  AttachmentActions as AttachmentActionsPrimitive,\n  AttachmentContent as AttachmentContentPrimitive,\n  AttachmentDescription as AttachmentDescriptionPrimitive,\n  AttachmentGroup as AttachmentGroupPrimitive,\n  AttachmentMedia as AttachmentMediaPrimitive,\n  AttachmentProgress as AttachmentProgressPrimitive,\n  AttachmentTitle as AttachmentTitlePrimitive,\n  AttachmentTrigger as AttachmentTriggerPrimitive,\n} from \"@/components/keyframery/primitives/attachment\"\nimport { Button } from \"@/components/keyframery/button\"\nimport { Speed, type SpeedProps } from \"@/lib/keyframery\"\nimport { cn } from \"@/lib/utils\"\n\n/* UI SDK accepts a class name or a function of state; keep both working. */\nfunction withClass<S>(base: string, className: string | ((state: S) => string | undefined) | undefined) {\n  return typeof className === \"function\" ? (state: S) => cn(base, className(state)) : cn(base, className)\n}\n\nfunction Attachment({ speed, className, children, ...props }: React.ComponentProps<typeof AttachmentPrimitive> & SpeedProps) {\n  return (\n    <Speed speed={speed}>\n      <AttachmentPrimitive\n        className={withClass(\n          cn(\n            \"relative isolate flex w-fit max-w-full min-w-0 shrink-0 overflow-hidden rounded-[var(--attachment-radius,12px)] bg-[var(--attachment-face,var(--background))] text-[color:var(--attachment-ink,var(--foreground))]\",\n            \"shadow-[0_0_0_1px_rgb(0_0_0/0.08),0_1px_2px_rgb(0_0_0/0.05)] dark:bg-[var(--attachment-face,color-mix(in_oklab,var(--accent)_40%,transparent))] dark:shadow-[0_0_0_1px_rgb(255_255_255/0.08)]\",\n            \"has-[>[data-slot=attachment-trigger]:hover]:bg-[color-mix(in_oklab,var(--background),var(--foreground)_3%)]\",\n            \"has-[>[data-slot=attachment-trigger]:focus-visible]:ring-2 has-[>[data-slot=attachment-trigger]:focus-visible]:ring-ring has-[>[data-slot=attachment-trigger]:focus-visible]:ring-offset-2 has-[>[data-slot=attachment-trigger]:focus-visible]:ring-offset-background\",\n            /* Not sent yet: a dashed line instead of the hairline. */\n            \"data-[status=idle]:bg-transparent data-[status=idle]:shadow-none data-[status=idle]:outline data-[status=idle]:outline-1 data-[status=idle]:-outline-offset-1 data-[status=idle]:outline-dashed data-[status=idle]:outline-foreground/20\",\n            \"data-[status=error]:shadow-[0_0_0_1px_color-mix(in_oklab,var(--destructive)_45%,transparent),0_1px_2px_rgb(0_0_0/0.05)]\",\n            /* Sizes and the two shapes. */\n            \"data-[orientation=horizontal]:min-w-44 data-[orientation=horizontal]:items-center\",\n            \"data-[orientation=horizontal]:data-[size=default]:gap-[var(--attachment-gap,0.625rem)] data-[orientation=horizontal]:data-[size=default]:p-[var(--attachment-padding,0.375rem)] data-[orientation=horizontal]:data-[size=default]:pe-2\",\n            \"data-[orientation=horizontal]:data-[size=sm]:gap-2 data-[orientation=horizontal]:data-[size=sm]:p-1 data-[orientation=horizontal]:data-[size=sm]:pe-1.5\",\n            \"data-[size=xs]:min-w-0 data-[size=xs]:gap-1.5 data-[size=xs]:rounded-[9px] data-[size=xs]:p-1 data-[size=xs]:pe-1.5\",\n            \"data-[orientation=vertical]:w-40 data-[orientation=vertical]:data-[size=sm]:w-34 data-[orientation=vertical]:data-[size=xs]:w-28 data-[orientation=vertical]:flex-col data-[orientation=vertical]:gap-2 data-[orientation=vertical]:p-[var(--attachment-padding,0.375rem)] data-[orientation=vertical]:pb-2\",\n          ),\n          className,\n        )}\n        {...props}\n      >\n        {children}\n      </AttachmentPrimitive>\n    </Speed>\n  )\n}\n\n/* The picture or the file-type icon, in a well. */\nfunction AttachmentMedia({ className, ...props }: React.ComponentProps<typeof AttachmentMediaPrimitive>) {\n  return (\n    <AttachmentMediaPrimitive\n      className={withClass(\n        cn(\n          \"relative flex aspect-square size-[var(--attachment-media-size,2.5rem)] shrink-0 items-center justify-center overflow-hidden rounded-[8px] bg-muted text-[color:var(--attachment-muted,var(--muted-foreground))]\",\n          \"shadow-[inset_0_0_0_1px_rgb(0_0_0/0.04)] dark:shadow-[inset_0_0_0_1px_rgb(255_255_255/0.05)]\",\n          \"group-data-[orientation=horizontal]/attachment:group-data-[size=sm]/attachment:size-8 group-data-[size=sm]/attachment:rounded-[7px]\",\n          \"group-data-[orientation=horizontal]/attachment:group-data-[size=xs]/attachment:size-6 group-data-[size=xs]/attachment:rounded-[6px]\",\n          \"group-data-[orientation=vertical]/attachment:size-auto group-data-[orientation=vertical]/attachment:w-full\",\n          \"group-data-[status=error]/attachment:bg-destructive/10 group-data-[status=error]/attachment:text-destructive\",\n          \"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5\",\n          \"data-[variant=image]:[&_img]:size-full data-[variant=image]:[&_img]:object-cover\",\n        ),\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AttachmentContent({ className, ...props }: React.ComponentProps<typeof AttachmentContentPrimitive>) {\n  return (\n    <AttachmentContentPrimitive\n      className={withClass(\"flex max-w-full min-w-0 flex-1 flex-col gap-1 group-data-[orientation=vertical]/attachment:px-1\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction AttachmentTitle({ className, ...props }: React.ComponentProps<typeof AttachmentTitlePrimitive>) {\n  return (\n    <AttachmentTitlePrimitive\n      className={withClass(\n        cn(\n          \"block max-w-full min-w-0 truncate text-[length:var(--attachment-font,13px)] leading-none font-medium\",\n          \"group-data-[size=xs]/attachment:text-[12px]\",\n        ),\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AttachmentDescription({ className, ...props }: React.ComponentProps<typeof AttachmentDescriptionPrimitive>) {\n  return (\n    <AttachmentDescriptionPrimitive\n      className={withClass(\n        cn(\n          \"block max-w-full min-w-0 truncate text-[11.5px] leading-none text-[color:var(--attachment-muted,var(--muted-foreground))] tabular-nums\",\n          \"group-data-[status=error]/attachment:text-destructive group-data-[size=xs]/attachment:hidden\",\n        ),\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\n/* The upload line along the foot. Put it anywhere inside the attachment. */\nfunction AttachmentProgress({ className, ...props }: React.ComponentProps<typeof AttachmentProgressPrimitive>) {\n  return (\n    <AttachmentProgressPrimitive\n      className={withClass(\"pointer-events-none absolute inset-x-0 bottom-0 h-[2px] bg-foreground/70\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction AttachmentActions({ className, ...props }: React.ComponentProps<typeof AttachmentActionsPrimitive>) {\n  return (\n    <AttachmentActionsPrimitive\n      className={withClass(\n        cn(\n          \"relative z-20 flex shrink-0 items-center gap-0.5\",\n          \"group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-2.5 group-data-[orientation=vertical]/attachment:right-2.5\",\n        ),\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\n/* A Keyframery button, ghost and small unless you say otherwise. On a picture tile it sits on a\n   key so it reads over the image. */\nfunction AttachmentAction({\n  variant,\n  size = \"icon-sm\",\n  className,\n  ...props\n}: React.ComponentProps<typeof Button>) {\n  return (\n    <Button\n      data-slot=\"attachment-action\"\n      variant={variant ?? \"ghost\"}\n      size={size}\n      className={withClass(\n        cn(\n          \"text-[color:var(--attachment-muted,var(--muted-foreground))] hover:text-[color:var(--attachment-ink,var(--foreground))]\",\n          \"group-data-[orientation=vertical]/attachment:bg-background/90 group-data-[orientation=vertical]/attachment:text-[color:var(--attachment-ink,var(--foreground))] group-data-[orientation=vertical]/attachment:backdrop-blur-sm\",\n          \"group-data-[orientation=vertical]/attachment:shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_2px_6px_-2px_rgb(0_0_0/0.2)]\",\n          \"group-data-[size=xs]/attachment:size-5 group-data-[size=xs]/attachment:rounded-[6px]\",\n        ),\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction XIcon() {\n  return (\n    <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n      <path d=\"m4.5 4.5 7 7m0-7-7 7\" />\n    </svg>\n  )\n}\n\n/* The remove action: the attachment leaves, then calls its `onRemove`. */\nfunction AttachmentRemove({ children, ...props }: React.ComponentProps<typeof AttachmentAction>) {\n  return (\n    <AttachmentAction data-action=\"remove\" aria-label=\"Remove\" {...props}>\n      {children ?? <XIcon />}\n    </AttachmentAction>\n  )\n}\n\n/* A button over the whole attachment, to open or preview the file. */\nfunction AttachmentTrigger({ className, ...props }: React.ComponentProps<typeof AttachmentTriggerPrimitive>) {\n  return <AttachmentTriggerPrimitive className={withClass(\"absolute inset-0 z-10 cursor-pointer rounded-[inherit] outline-none\", className)} {...props} />\n}\n\n/* A row that scrolls sideways when the files do not fit. */\nfunction AttachmentGroup({ speed, className, ...props }: React.ComponentProps<typeof AttachmentGroupPrimitive> & SpeedProps) {\n  return (\n    <Speed speed={speed}>\n      <AttachmentGroupPrimitive\n        className={withClass(\n          cn(\n            \"flex min-w-0 gap-2 overflow-x-auto overscroll-x-contain p-1 [--attachment-gap:0.5rem] [scrollbar-width:none]\",\n            \"*:data-[slot=attachment]:flex-none\",\n          ),\n          className,\n        )}\n        {...props}\n      />\n    </Speed>\n  )\n}\n\nexport {\n  Attachment,\n  AttachmentAction,\n  AttachmentActions,\n  AttachmentContent,\n  AttachmentDescription,\n  AttachmentGroup,\n  AttachmentMedia,\n  AttachmentProgress,\n  AttachmentRemove,\n  AttachmentTitle,\n  AttachmentTrigger,\n}\n",
      "type": "registry:component",
      "target": "components/keyframery/attachment.tsx"
    }
  ],
  "type": "registry:component"
}