{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "team-section-v2",
  "title": "Team Section v2",
  "description": "The same team title, description, and portraits as an index. Names sit in a list, and a greyscale portrait slides to the row you hover or reach with the arrow keys.",
  "dependencies": [
    "geist@^1.7.0"
  ],
  "registryDependencies": [
    "https://uiception.com/r/block-media.json"
  ],
  "files": [
    {
      "path": "registry/new-york/blocks/team-section-v2/page.tsx",
      "content": "import TeamSectionV2 from \"./components/team-section-v2\"\n\nexport default function Page() {\n  return <TeamSectionV2 />\n}\n",
      "type": "registry:page",
      "target": "app/team-section-v2/page.tsx"
    },
    {
      "path": "registry/new-york/blocks/team-section-v2/components/team-section-v2.tsx",
      "content": "import { createBlockImage } from \"@/lib/block-media\"\n\nimport { TeamSectionV2Root } from \"./team-section-v2-root\"\nimport { teamFiles, type TeamMember } from \"../lib/config\"\n\nconst blockImage = createBlockImage(\"team-section-v2\")\n\nconst teamMembers: TeamMember[] = teamFiles.map((member, index) => ({\n  id: String(index + 1),\n  name: member.name,\n  title: member.title,\n  avatarSrc: blockImage(member.file),\n}))\n\nexport type TeamSectionV2Props = {\n  members?: TeamMember[]\n}\n\nexport default function TeamSectionV2({\n  members = teamMembers,\n}: TeamSectionV2Props = {}) {\n  return <TeamSectionV2Root members={members} />\n}\n",
      "type": "registry:component",
      "target": "app/team-section-v2/components/team-section-v2.tsx"
    },
    {
      "path": "registry/new-york/blocks/team-section-v2/components/team-section-v2-root.tsx",
      "content": "\"use client\"\n\nimport { GeistPixelCircle } from \"geist/font/pixel\"\nimport Image from \"next/image\"\nimport {\n  useCallback,\n  useLayoutEffect,\n  useRef,\n  useState,\n  type CSSProperties,\n  type KeyboardEvent,\n} from \"react\"\n\nimport { sectionHeader, type TeamMember } from \"../lib/config\"\nimport \"../styles/team-section-v2.css\"\n\ntype TeamSectionV2RootProps = {\n  members: TeamMember[]\n}\n\nfunction optionId(id: string) {\n  return `team-section-v2-option-${id}`\n}\n\nexport function TeamSectionV2Root({ members }: TeamSectionV2RootProps) {\n  const count = members.length\n  const [activeIndex, setActiveIndex] = useState(0)\n  const [previousIndex, setPreviousIndex] = useState(0)\n  const [revealKey, setRevealKey] = useState(0)\n  const [offsetY, setOffsetY] = useState(0)\n  const [motionReady, setMotionReady] = useState(false)\n  const listRef = useRef<HTMLUListElement>(null)\n  const frameRef = useRef<HTMLDivElement>(null)\n  const active = members[activeIndex]\n\n  const measure = useCallback(() => {\n    const list = listRef.current\n    const frame = frameRef.current\n    const row = list?.querySelector<HTMLElement>(\n      `[data-index=\"${activeIndex}\"]`\n    )\n    if (!list || !frame || !row) return\n\n    const listRect = list.getBoundingClientRect()\n    const rowRect = row.getBoundingClientRect()\n    const circle = frame.querySelector<HTMLElement>(\"[data-tsv2-portrait]\")\n    const circleHeight = circle?.offsetHeight ?? frame.offsetHeight\n    const rowCenter = rowRect.top - listRect.top + rowRect.height / 2\n    const raw = rowCenter - circleHeight / 2\n    const sectionRect = list.closest(\"section\")?.getBoundingClientRect()\n    const minY = sectionRect ? sectionRect.top + 32 - listRect.top : raw\n    const next = Math.round(Math.max(raw, minY))\n    setOffsetY((current) => (current === next ? current : next))\n  }, [activeIndex])\n\n  useLayoutEffect(() => {\n    measure()\n    const list = listRef.current\n    const frame = frameRef.current\n    if (!list) return\n    const observer = new ResizeObserver(() => measure())\n    observer.observe(list)\n    if (frame) observer.observe(frame)\n    return () => observer.disconnect()\n  }, [measure])\n\n  useLayoutEffect(() => {\n    const frame = requestAnimationFrame(() => setMotionReady(true))\n    return () => cancelAnimationFrame(frame)\n  }, [])\n\n  function select(index: number) {\n    if (count < 1) return\n    const normalized = ((index % count) + count) % count\n    if (normalized === activeIndex) return\n    setPreviousIndex(activeIndex)\n    setActiveIndex(normalized)\n    setRevealKey((key) => key + 1)\n  }\n\n  function onKeyDown(event: KeyboardEvent<HTMLUListElement>) {\n    if (event.key === \"ArrowDown\") {\n      event.preventDefault()\n      select(activeIndex + 1)\n    } else if (event.key === \"ArrowUp\") {\n      event.preventDefault()\n      select(activeIndex - 1)\n    } else if (event.key === \"Home\") {\n      event.preventDefault()\n      select(0)\n    } else if (event.key === \"End\") {\n      event.preventDefault()\n      select(count - 1)\n    }\n  }\n\n  if (!active) return null\n\n  return (\n    <section aria-label=\"Team\" className=\"pt-16 pb-24 lg:pt-24 lg:pb-36\">\n      <div className=\"mx-auto max-w-6xl px-6\">\n        <header className=\"max-w-xl\">\n          <h2 className=\"text-4xl leading-[1.1] font-medium tracking-[-0.03em] text-foreground lg:text-5xl\">\n            {sectionHeader.title}\n          </h2>\n          <p className=\"mt-4 max-w-md text-[0.9375rem] leading-relaxed text-muted-foreground\">\n            {sectionHeader.description}\n          </p>\n        </header>\n\n        <div className=\"mt-12 grid items-start gap-10 lg:mt-16 lg:grid-cols-[minmax(0,1fr)_16.5rem] lg:gap-x-16\">\n          <ul\n            ref={listRef}\n            role=\"listbox\"\n            aria-label=\"Team members\"\n            aria-activedescendant={optionId(active.id)}\n            tabIndex={0}\n            className=\"border-t border-border outline-none focus-visible:outline-2 focus-visible:outline-offset-8 focus-visible:outline-ring\"\n            onKeyDown={onKeyDown}\n          >\n            {members.map((member, index) => {\n              const selected = index === activeIndex\n              return (\n                <li\n                  key={member.id}\n                  id={optionId(member.id)}\n                  role=\"option\"\n                  aria-selected={selected}\n                  aria-label={`${member.name}, ${member.title}`}\n                  data-index={index}\n                  className=\"flex cursor-pointer items-start border-b border-border py-5\"\n                  onMouseEnter={() => select(index)}\n                  onClick={() => select(index)}\n                >\n                  <span\n                    className={`min-w-0 transition-opacity duration-300 motion-reduce:transition-none ${\n                      selected ? \"opacity-100\" : \"opacity-30\"\n                    }`}\n                  >\n                    <span\n                      className={`${GeistPixelCircle.className} block text-[1.65rem] leading-none font-normal tracking-normal text-foreground lg:text-4xl`}\n                    >\n                      {member.name}\n                    </span>\n                    <span className=\"mt-1.5 block text-sm text-muted-foreground\">\n                      {member.title}\n                    </span>\n                  </span>\n                </li>\n              )\n            })}\n          </ul>\n\n          <div className=\"relative order-first lg:order-0\">\n            <div\n              ref={frameRef}\n              data-ready={motionReady ? \"true\" : \"false\"}\n              style={{ \"--tsv2-y\": `${offsetY}px` } as CSSProperties}\n              className=\"tsv2-frame mx-auto w-full max-w-xs lg:absolute lg:inset-x-0 lg:top-0 lg:max-w-none\"\n            >\n              <Portrait\n                members={members}\n                activeIndex={activeIndex}\n                previousIndex={previousIndex}\n                revealKey={revealKey}\n              />\n              <p className=\"mt-4 text-center lg:hidden\">\n                <span className=\"block text-sm font-medium text-foreground\">\n                  {active.name}\n                </span>\n                <span className=\"mt-0.5 block text-sm text-muted-foreground\">\n                  {active.title}\n                </span>\n              </p>\n            </div>\n          </div>\n        </div>\n      </div>\n    </section>\n  )\n}\n\nfunction Portrait({\n  members,\n  activeIndex,\n  previousIndex,\n  revealKey,\n}: {\n  members: TeamMember[]\n  activeIndex: number\n  previousIndex: number\n  revealKey: number\n}) {\n  return (\n    <div\n      data-tsv2-portrait\n      className=\"relative aspect-square overflow-hidden rounded-full bg-muted ring-1 ring-border\"\n    >\n      {members.map((member, index) => {\n        const active = index === activeIndex\n        const leaving = revealKey > 0 && index === previousIndex && !active\n        return (\n          <Image\n            key={member.id}\n            src={member.avatarSrc}\n            alt=\"\"\n            fill\n            unoptimized\n            sizes=\"280px\"\n            priority={index === 0}\n            draggable={false}\n            className={`object-cover grayscale ${\n              revealKey > 0 && active\n                ? \"tsv2-portrait-in\"\n                : leaving\n                  ? \"tsv2-portrait-out\"\n                  : active\n                    ? \"opacity-100\"\n                    : \"opacity-0\"\n            }`}\n            style={{ zIndex: active ? 2 : leaving ? 1 : 0 }}\n          />\n        )\n      })}\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "app/team-section-v2/components/team-section-v2-root.tsx"
    },
    {
      "path": "registry/new-york/blocks/team-section-v2/lib/config.ts",
      "content": "export type TeamMember = {\n  id: string\n  name: string\n  title: string\n  avatarSrc: string\n}\n\nexport const sectionHeader = {\n  title: \"Who we are\",\n  description:\n    \"Engineers, operators, designers, and data people who build and run Acme every day.\",\n} as const\n\nexport const teamFiles = [\n  { file: \"avatar-1.png\", name: \"Jane Doe\", title: \"VP of Engineering\" },\n  { file: \"avatar-2.png\", name: \"John Doe\", title: \"Director of Operations\" },\n  { file: \"avatar-3.png\", name: \"Jane Smith\", title: \"Chief Product Officer\" },\n  { file: \"avatar-4.png\", name: \"John Smith\", title: \"Head of Autonomy\" },\n  { file: \"avatar-5.png\", name: \"Alex Johnson\", title: \"Staff Data Engineer\" },\n  { file: \"avatar-6.png\", name: \"Sam Wilson\", title: \"SVP of Digital\" },\n] as const\n",
      "type": "registry:lib",
      "target": "app/team-section-v2/lib/config.ts"
    },
    {
      "path": "registry/new-york/blocks/team-section-v2/styles/team-section-v2.css",
      "content": ".tsv2-frame {\n  transition:\n    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),\n    opacity 240ms ease-out;\n}\n\n.tsv2-frame[data-ready=\"false\"] {\n  transition: none;\n}\n\n@media (min-width: 1024px) {\n  .tsv2-frame {\n    transform: translateY(var(--tsv2-y, 0px));\n  }\n\n  /* The server can't measure the active row, so the frame renders at 0px.\n     Keep it hidden until the client has measured and moved it into place. */\n  .tsv2-frame[data-ready=\"false\"] {\n    opacity: 0;\n  }\n}\n\n@keyframes tsv2-portrait-in {\n  from {\n    opacity: 0;\n    transform: scale(1.08);\n  }\n  to {\n    opacity: 1;\n    transform: scale(1);\n  }\n}\n\n@keyframes tsv2-portrait-out {\n  from {\n    opacity: 1;\n    transform: scale(1);\n  }\n  to {\n    opacity: 0;\n    transform: scale(0.94);\n  }\n}\n\n.tsv2-portrait-in {\n  opacity: 1;\n  transform: scale(1);\n  animation: tsv2-portrait-in 560ms cubic-bezier(0.22, 1, 0.36, 1) both;\n}\n\n.tsv2-portrait-out {\n  opacity: 0;\n  transform: scale(0.94);\n  animation: tsv2-portrait-out 420ms cubic-bezier(0.4, 0, 1, 1) both;\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .tsv2-frame,\n  .tsv2-portrait-in,\n  .tsv2-portrait-out {\n    animation: none;\n    transition: none;\n  }\n}\n",
      "type": "registry:file",
      "target": "app/team-section-v2/styles/team-section-v2.css"
    },
    {
      "path": "public/images/blocks/team-section-v2/avatar-1.png.gitkeep",
      "content": "Place your asset here. Same base name, any supported format: jpg, jpeg, png, webp, avif, gif, or svg. Remove the .gitkeep extension from the filename.",
      "type": "registry:file",
      "target": "public/images/blocks/team-section-v2/avatar-1.png.gitkeep"
    },
    {
      "path": "public/images/blocks/team-section-v2/avatar-2.png.gitkeep",
      "content": "Place your asset here. Same base name, any supported format: jpg, jpeg, png, webp, avif, gif, or svg. Remove the .gitkeep extension from the filename.",
      "type": "registry:file",
      "target": "public/images/blocks/team-section-v2/avatar-2.png.gitkeep"
    },
    {
      "path": "public/images/blocks/team-section-v2/avatar-3.png.gitkeep",
      "content": "Place your asset here. Same base name, any supported format: jpg, jpeg, png, webp, avif, gif, or svg. Remove the .gitkeep extension from the filename.",
      "type": "registry:file",
      "target": "public/images/blocks/team-section-v2/avatar-3.png.gitkeep"
    },
    {
      "path": "public/images/blocks/team-section-v2/avatar-4.png.gitkeep",
      "content": "Place your asset here. Same base name, any supported format: jpg, jpeg, png, webp, avif, gif, or svg. Remove the .gitkeep extension from the filename.",
      "type": "registry:file",
      "target": "public/images/blocks/team-section-v2/avatar-4.png.gitkeep"
    },
    {
      "path": "public/images/blocks/team-section-v2/avatar-5.png.gitkeep",
      "content": "Place your asset here. Same base name, any supported format: jpg, jpeg, png, webp, avif, gif, or svg. Remove the .gitkeep extension from the filename.",
      "type": "registry:file",
      "target": "public/images/blocks/team-section-v2/avatar-5.png.gitkeep"
    },
    {
      "path": "public/images/blocks/team-section-v2/avatar-6.png.gitkeep",
      "content": "Place your asset here. Same base name, any supported format: jpg, jpeg, png, webp, avif, gif, or svg. Remove the .gitkeep extension from the filename.",
      "type": "registry:file",
      "target": "public/images/blocks/team-section-v2/avatar-6.png.gitkeep"
    }
  ],
  "type": "registry:block"
}