{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "image-box",
  "title": "Image Box",
  "description": "An image box for stories, projects and services in three layouts (stacked, overlay, split), with an image that drifts toward the pointer, a drawn title underline, a sliding arrow, a description that opens on hover in the overlay layout and the whole card as one accessible link.",
  "dependencies": [
    "lucide-react",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/image-box/image-box.tsx",
      "content": "\"use client\";\n/* eslint-disable @next/next/no-img-element -- Registry components work in any React app. */\n\nimport * as React from \"react\";\nimport { ArrowRight } from \"lucide-react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type ImageBoxLayout = \"stacked\" | \"overlay\" | \"split\";\nexport type ImageBoxTheme = \"dark\" | \"light\";\n\nexport interface ImageBoxProps extends Omit<React.ComponentPropsWithoutRef<\"article\">, \"title\"> {\n  image?: string;\n  imageAlt?: string;\n  /** Small tag shown above the title, e.g. a category. */\n  tag?: string;\n  /** Mono detail on the right of the tag row, e.g. \"6 min read\". */\n  meta?: string;\n  title?: string;\n  description?: string;\n  href?: string;\n  linkLabel?: string;\n  layout?: ImageBoxLayout;\n  /** Image width / height. Ignored by the overlay layout, which uses the card's own ratio. */\n  imageRatio?: number;\n  /** Card width / height for the overlay layout. */\n  overlayRatio?: number;\n  /** How far the image drifts toward the pointer, in px. 0 turns it off. */\n  parallax?: number;\n  radius?: number;\n  theme?: ImageBoxTheme;\n}\n\nfunction palette(theme: ImageBoxTheme, radius: number): React.CSSProperties & Record<`--${string}`, string> {\n  const light = theme === \"light\";\n  return {\n    \"--ib-surface\": light ? \"#ffffff\" : \"#121212\",\n    \"--ib-line\": light ? \"#e4e4e1\" : \"#262626\",\n    \"--ib-ink\": light ? \"#141414\" : \"#f4f4f2\",\n    \"--ib-muted\": light ? \"#6b6b6b\" : \"#8f8f8f\",\n    \"--ib-radius\": `${radius}px`,\n    color: \"var(--ib-ink)\",\n    fontFamily: \"inherit\",\n  };\n}\n\nexport function ImageBox({\n  image = \"/demo/19.webp\",\n  imageAlt = \"\",\n  tag = \"Interiors\",\n  meta = \"6 min read\",\n  title = \"Notes on daylight\",\n  description = \"How we plan an interior shoot around the sun: which rooms to start in, when to wait, and why we never fight a window.\",\n  href = \"#\",\n  linkLabel = \"Read story\",\n  layout = \"stacked\",\n  imageRatio = 4 / 3,\n  overlayRatio = 3 / 4,\n  parallax = 8,\n  radius = 18,\n  theme = \"dark\",\n  className,\n  style,\n  onPointerMove,\n  onPointerLeave,\n  ...props\n}: ImageBoxProps) {\n  const mediaRef = React.useRef<HTMLDivElement>(null);\n  const titleId = React.useId();\n\n  // Pointer position in -1..1 is written to CSS variables, so the drift needs no re-render.\n  const move = (event: React.PointerEvent<HTMLElement>) => {\n    onPointerMove?.(event);\n    const media = mediaRef.current;\n    if (!media || !parallax || event.pointerType !== \"mouse\") return;\n    const rect = event.currentTarget.getBoundingClientRect();\n    media.style.setProperty(\"--ib-x\", (((event.clientX - rect.left) / rect.width) * 2 - 1).toFixed(3));\n    media.style.setProperty(\"--ib-y\", (((event.clientY - rect.top) / rect.height) * 2 - 1).toFixed(3));\n  };\n  const leave = (event: React.PointerEvent<HTMLElement>) => {\n    onPointerLeave?.(event);\n    mediaRef.current?.style.setProperty(\"--ib-x\", \"0\");\n    mediaRef.current?.style.setProperty(\"--ib-y\", \"0\");\n  };\n\n  const overlay = layout === \"overlay\";\n  const split = layout === \"split\";\n\n  const media = (\n    <div\n      className={cn(\n        \"relative overflow-hidden bg-[var(--ib-line)]\",\n        overlay ? \"absolute inset-0\" : \"rounded-[var(--ib-radius)]\",\n        split && \"rounded-[calc(var(--ib-radius)-6px)]\",\n      )}\n      style={overlay ? undefined : { aspectRatio: imageRatio }}\n    >\n      <div\n        ref={mediaRef}\n        className=\"absolute -inset-[var(--ib-bleed)] transition-transform duration-500 ease-out group-hover/ib:scale-[1.05] motion-reduce:transition-none\"\n        style={{\n          [\"--ib-bleed\" as string]: `${parallax + 2}px`,\n          transform: `translate3d(calc(var(--ib-x, 0) * ${-parallax}px), calc(var(--ib-y, 0) * ${-parallax}px), 0)`,\n        }}\n      >\n        <img src={image} alt={imageAlt} draggable={false} loading=\"lazy\" decoding=\"async\" className=\"h-full w-full object-cover\" />\n      </div>\n      {overlay && <div aria-hidden=\"true\" className=\"absolute inset-0 bg-gradient-to-t from-black/85 via-black/25 to-black/5 transition-opacity duration-500 group-hover/ib:opacity-95\" />}\n    </div>\n  );\n\n  const tagRow = (tag || meta) && (\n    <div className={cn(\"flex items-center justify-between gap-3\", overlay && \"text-white\")}>\n      {tag && <span className={cn(\"rounded-full border px-2.5 py-1 text-[11px] leading-none\", overlay ? \"border-white/30 bg-black/20 backdrop-blur-md\" : \"border-[var(--ib-line)]\")}>{tag}</span>}\n      {meta && <span className={cn(\"font-mono text-[10.5px]\", overlay ? \"text-white/70\" : \"text-[var(--ib-muted)]\")}>{meta}</span>}\n    </div>\n  );\n\n  // The title link stretches over the whole card (after:inset-0), so the card is one link for screen readers.\n  const heading = (\n    <h3 id={titleId} className={cn(\"text-[20px] leading-[1.2] font-medium tracking-[-0.015em]\", overlay && \"text-white\")}>\n      <a\n        href={href}\n        className=\"bg-[linear-gradient(currentColor,currentColor)] bg-[length:0%_1px] bg-left-bottom bg-no-repeat pb-0.5 transition-[background-size] duration-500 ease-out outline-none group-hover/ib:bg-[length:100%_1px] after:absolute after:inset-0 after:z-10 after:rounded-[var(--ib-radius)] focus-visible:after:ring-2 focus-visible:after:ring-[var(--ib-ink)] focus-visible:after:ring-offset-2 focus-visible:after:ring-offset-transparent\"\n      >\n        {title}\n      </a>\n    </h3>\n  );\n\n  const link = linkLabel && (\n    <span aria-hidden=\"true\" className={cn(\"inline-flex items-center gap-2 text-[13px] font-medium\", overlay ? \"text-white\" : \"text-[var(--ib-ink)]\")}>\n      {linkLabel}\n      <span className={cn(\"flex size-6 items-center justify-center rounded-full transition-transform duration-300 ease-out group-hover/ib:translate-x-1\", overlay ? \"bg-white text-black\" : \"bg-[var(--ib-ink)] text-[var(--ib-surface)]\")}>\n        <ArrowRight size={13} />\n      </span>\n    </span>\n  );\n\n  return (\n    <article\n      aria-labelledby={titleId}\n      className={cn(\n        \"group/ib @container relative isolate w-full min-w-0\",\n        overlay && \"overflow-hidden rounded-[var(--ib-radius)]\",\n        split && \"rounded-[var(--ib-radius)] border border-[var(--ib-line)] bg-[var(--ib-surface)] p-2\",\n        className,\n      )}\n      style={{ ...palette(theme, radius), ...(overlay ? { aspectRatio: overlayRatio } : null), ...style }}\n      onPointerMove={move}\n      onPointerLeave={leave}\n      {...props}\n    >\n      {overlay ? (\n        <>\n          {media}\n          <div className=\"absolute inset-0 flex flex-col justify-between p-5\">\n            {tagRow}\n            <div>\n              {heading}\n              {/* 0fr → 1fr grid rows: the description slides open on hover or keyboard focus without measuring it. */}\n              <div className=\"grid grid-rows-[0fr] transition-[grid-template-rows] duration-500 ease-out group-focus-within/ib:grid-rows-[1fr] group-hover/ib:grid-rows-[1fr] [@media(pointer:coarse)]:grid-rows-[1fr]\">\n                <div className=\"overflow-hidden\">\n                  {description && <p className=\"pt-2.5 text-[13px] leading-relaxed text-white/75\">{description}</p>}\n                  <div className=\"pt-4\">{link}</div>\n                </div>\n              </div>\n            </div>\n          </div>\n        </>\n      ) : (\n        <div className={cn(\"h-full\", split ? \"grid gap-2 @min-[520px]:grid-cols-[minmax(0,0.9fr)_minmax(0,1fr)]\" : \"flex flex-col\")}>\n          {media}\n          <div className={cn(\"flex flex-1 flex-col\", split ? \"p-4 @min-[520px]:p-6\" : \"pt-4\")}>\n            {tagRow}\n            <div className=\"mt-4\">{heading}</div>\n            {description && <p className=\"mt-2 line-clamp-3 text-[13.5px] leading-relaxed text-[var(--ib-muted)]\">{description}</p>}\n            {link && <div className={cn(\"mt-auto pt-5\", split && \"@min-[520px]:pt-6\")}>{link}</div>}\n          </div>\n        </div>\n      )}\n    </article>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}