{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "video-playlist-now-playing",
  "title": "Video Playlist Now Playing",
  "description": "Use this when a page plays one video at a time from a list: a stage with the current video and a peeking row of cards whose pressed state shows what is playing.",
  "registryDependencies": [
    "@tealmac/carousel-peek"
  ],
  "files": [
    {
      "path": "registry/patterns/video-playlist-now-playing/video-playlist-now-playing.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\nimport { CarouselPeek } from \"@/components/ui/carousel-peek\"\n\nexport interface PlaylistVideo {\n  id: string\n  title: string\n  /** For example \"4:32\". */\n  duration: string\n  description: string\n  poster: React.ReactNode\n}\n\nexport interface VideoPlaylistNowPlayingProps {\n  videos: PlaylistVideo[]\n  label: string\n  defaultId?: string\n  onSelect?: (video: PlaylistVideo) => void\n  className?: string\n}\n\nexport function VideoPlaylistNowPlaying({\n  videos,\n  label,\n  defaultId,\n  onSelect,\n  className,\n}: VideoPlaylistNowPlayingProps) {\n  const [id, setId] = React.useState(defaultId ?? videos[0]?.id)\n  const current = videos.find((video) => video.id === id) ?? videos[0]\n  if (!current) return null\n\n  return (\n    <div className={cn(\"grid gap-4\", className)}>\n      <div>\n        <div className=\"overflow-hidden rounded-xl\">{current.poster}</div>\n        <div aria-live=\"polite\" className=\"mt-3\">\n          <h3 className=\"font-semibold\">{current.title}</h3>\n          <p className=\"text-muted-foreground text-sm\">{current.description}</p>\n        </div>\n      </div>\n      <CarouselPeek\n        label={label}\n        slideClassName=\"basis-[60%] @md:basis-[34%]\"\n        items={videos.map((video) => ({\n          id: video.id,\n          label: video.title,\n          content: (\n            <button\n              type=\"button\"\n              aria-pressed={video.id === current.id}\n              onClick={() => {\n                setId(video.id)\n                onSelect?.(video)\n              }}\n              className=\"group focus-visible:ring-ring/50 block w-full rounded-lg text-start focus-visible:ring-[3px] focus-visible:outline-none\"\n            >\n              <span className=\"group-aria-pressed:border-primary relative block overflow-hidden rounded-lg border-2 border-transparent\">\n                {video.poster}\n                <span\n                  aria-hidden\n                  className=\"absolute end-2 bottom-2 rounded bg-black/75 px-1.5 py-0.5 text-xs text-white tabular-nums\"\n                >\n                  {video.duration}\n                </span>\n              </span>\n              <span className=\"mt-1.5 block text-sm font-medium\">\n                {video.title}\n                <span className=\"sr-only\">{`, ${video.duration}`}</span>\n              </span>\n            </button>\n          ),\n        }))}\n      />\n    </div>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}