{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "frosted-app-icons",
  "title": "Frosted App Icons",
  "description": "A home-screen card of frosted-glass app icons over drifting colour: a soft light follows the pointer behind the glass, icons lift with a specular highlight that tracks the cursor, opening an app ripples it and pops its unread badge, and a frosted dock sits underneath.",
  "dependencies": [
    "lucide-react",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/frosted-app-icons/frosted-app-icons.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Calendar, Camera, CloudSun, Compass, Image as ImageIcon, Mail, Map as MapIcon, MessageCircle, Music, NotebookPen, Settings, Timer, Wallet, Phone, Globe, Podcast, type LucideIcon } 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 interface FrostedApp {\n  id: string;\n  label: string;\n  icon: LucideIcon;\n  /** Colour washed into the glass behind the glyph. */\n  tint: string;\n  /** Unread count shown as a badge; cleared when the app is opened. */\n  badge?: number;\n}\n\nexport type FrostedAppIconsTheme = \"dark\" | \"light\";\n\nexport interface FrostedAppIconsProps extends Omit<React.ComponentPropsWithoutRef<\"div\">, \"children\" | \"onSelect\"> {\n  apps?: FrostedApp[];\n  dock?: FrostedApp[];\n  /** Colours of the light blobs drifting behind the glass. */\n  colors?: [string, string, string];\n  /** Clock shown in the status row; pass null to hide the row. */\n  time?: string | null;\n  /** Light that follows the pointer behind the glass. */\n  followLight?: boolean;\n  theme?: FrostedAppIconsTheme;\n  onOpen?: (app: FrostedApp) => void;\n}\n\nconst APPS: FrostedApp[] = [\n  { id: \"mail\", label: \"Mail\", icon: Mail, tint: \"#5aa9ff\", badge: 3 },\n  { id: \"calendar\", label: \"Calendar\", icon: Calendar, tint: \"#ff6b6b\" },\n  { id: \"photos\", label: \"Photos\", icon: ImageIcon, tint: \"#ffb347\" },\n  { id: \"camera\", label: \"Camera\", icon: Camera, tint: \"#9aa3b2\" },\n  { id: \"maps\", label: \"Maps\", icon: MapIcon, tint: \"#4cd59a\" },\n  { id: \"weather\", label: \"Weather\", icon: CloudSun, tint: \"#62c7ff\" },\n  { id: \"notes\", label: \"Notes\", icon: NotebookPen, tint: \"#ffd84d\" },\n  { id: \"wallet\", label: \"Wallet\", icon: Wallet, tint: \"#2f2f3a\" },\n  { id: \"music\", label: \"Music\", icon: Music, tint: \"#ff5c8a\", badge: 1 },\n  { id: \"podcasts\", label: \"Podcasts\", icon: Podcast, tint: \"#b779ff\" },\n  { id: \"compass\", label: \"Compass\", icon: Compass, tint: \"#e9e9ef\" },\n  { id: \"timer\", label: \"Timer\", icon: Timer, tint: \"#ff9d4d\" },\n];\nconst DOCK: FrostedApp[] = [\n  { id: \"phone\", label: \"Phone\", icon: Phone, tint: \"#47d16c\", badge: 2 },\n  { id: \"messages\", label: \"Messages\", icon: MessageCircle, tint: \"#4fd36a\", badge: 12 },\n  { id: \"browser\", label: \"Browser\", icon: Globe, tint: \"#4b9bff\" },\n  { id: \"settings\", label: \"Settings\", icon: Settings, tint: \"#a1a7b3\" },\n];\n\nconst KEYFRAMES = `\n@keyframes fai-drift-a { 0%,100% { transform: translate(-10%, -6%) scale(1); } 50% { transform: translate(14%, 10%) scale(1.15); } }\n@keyframes fai-drift-b { 0%,100% { transform: translate(8%, 12%) scale(1.1); } 50% { transform: translate(-12%, -8%) scale(0.95); } }\n@keyframes fai-drift-c { 0%,100% { transform: translate(0%, 0%) scale(1); } 50% { transform: translate(-8%, 14%) scale(1.2); } }\n@keyframes fai-launch { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }\n@keyframes fai-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(0); opacity: 0; } }\n`;\n\nfunction AppIcon({ app, size, badge, light, showLabel, onOpen }: { app: FrostedApp; size: number; badge: number; light: boolean; showLabel: boolean; onOpen: () => void }) {\n  const ref = React.useRef<HTMLButtonElement>(null);\n  const [launches, setLaunches] = React.useState(0);\n  const [clearing, setClearing] = React.useState(false);\n  const Icon = app.icon;\n  // Once the parent has cleared the count, the next badge (if any) should appear normally again.\n  if (badge === 0 && clearing) setClearing(false);\n  const radius = Math.round(size * 0.27);\n\n  return (\n    <div className=\"flex flex-col items-center gap-1.5\">\n      <button\n        ref={ref}\n        type=\"button\"\n        aria-label={badge ? `${app.label}, ${badge} new` : app.label}\n        onPointerMove={(event) => {\n          const r = event.currentTarget.getBoundingClientRect();\n          event.currentTarget.style.setProperty(\"--mx\", `${((event.clientX - r.left) / r.width) * 100}%`);\n          event.currentTarget.style.setProperty(\"--my\", `${((event.clientY - r.top) / r.height) * 100}%`);\n        }}\n        onClick={() => {\n          setLaunches((n) => n + 1);\n          if (badge) setClearing(true);\n          onOpen();\n        }}\n        className={cn(\n          \"group/app relative flex cursor-pointer items-center justify-center outline-none\",\n          \"transition-transform duration-300 ease-[cubic-bezier(.2,.8,.2,1)] hover:-translate-y-1 hover:scale-[1.06] focus-visible:-translate-y-1 focus-visible:scale-[1.06] active:scale-[0.93] motion-reduce:transition-none\",\n          \"focus-visible:ring-2 focus-visible:ring-white/80 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent\",\n        )}\n        style={{ width: size, height: size, borderRadius: radius }}\n      >\n        {/* Drop shadow on its own layer: Safari draws shadows of backdrop-filtered elements unreliably. */}\n        <span\n          aria-hidden=\"true\"\n          className=\"absolute inset-0\"\n          style={{ borderRadius: radius, boxShadow: light ? \"0 10px 24px -12px rgba(30,30,60,.35)\" : \"0 12px 26px -14px rgba(0,0,0,.7)\" }}\n        />\n        {/* Frosted glass: blur what's behind, wash in the app's tint with a glow rising from the bottom, add a\n            lit top edge. Everything is painted on this one layer, with nothing overflowing it: Safari clips the\n            children of a backdrop-filtered element to its rectangle, not its rounded corners. */}\n        <span\n          aria-hidden=\"true\"\n          className=\"absolute inset-0\"\n          style={{\n            borderRadius: radius,\n            background: light\n              ? `radial-gradient(90% 70% at 50% 115%, ${app.tint}66, transparent 70%), linear-gradient(160deg, rgba(255,255,255,.72), rgba(255,255,255,.38)), ${app.tint}22`\n              : `radial-gradient(90% 70% at 50% 115%, ${app.tint}99, transparent 70%), linear-gradient(160deg, rgba(255,255,255,.22), rgba(255,255,255,.06)), ${app.tint}26`,\n            backdropFilter: \"blur(16px) saturate(170%)\",\n            WebkitBackdropFilter: \"blur(16px) saturate(170%)\",\n            boxShadow: light ? \"inset 0 1px 0 rgba(255,255,255,.95), inset 0 0 0 1px rgba(255,255,255,.55)\" : \"inset 0 1px 0 rgba(255,255,255,.45), inset 0 0 0 1px rgba(255,255,255,.14)\",\n          }}\n        />\n        {/* Specular highlight that follows the pointer across the glass; it carries its own rounded corners. */}\n        <span\n          aria-hidden=\"true\"\n          className=\"absolute inset-0 opacity-0 transition-opacity duration-300 group-hover/app:opacity-100\"\n          style={{ borderRadius: radius, background: \"radial-gradient(circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,.6), transparent 55%)\" }}\n        />\n        <Icon size={Math.round(size * 0.44)} strokeWidth={1.7} className=\"relative drop-shadow-[0_1px_2px_rgba(0,0,0,.25)]\" style={{ color: light ? \"#1d1d24\" : \"#ffffff\" }} aria-hidden=\"true\" />\n        {/* Launch ring: a fresh element per click, so quick repeats each get their own ripple. */}\n        {launches > 0 && (\n          <span\n            key={launches}\n            aria-hidden=\"true\"\n            className=\"pointer-events-none absolute inset-0 motion-reduce:hidden\"\n            style={{ borderRadius: radius, boxShadow: `0 0 0 2px ${light ? \"rgba(30,30,40,.5)\" : \"rgba(255,255,255,.75)\"}`, animation: \"fai-launch 600ms cubic-bezier(.2,.8,.2,1) forwards\" }}\n          />\n        )}\n        {badge > 0 && (\n          <span\n            aria-hidden=\"true\"\n            className=\"absolute -top-1.5 -right-1.5 flex h-5 min-w-5 items-center justify-center rounded-full bg-[#ff3b30] px-1.5 text-[11px] leading-none font-semibold text-white shadow-[0_2px_6px_rgba(255,59,48,.45)]\"\n            style={clearing ? { animation: \"fai-pop 380ms cubic-bezier(.3,.7,.3,1) forwards\" } : undefined}\n          >\n            {badge > 99 ? \"99+\" : badge}\n          </span>\n        )}\n      </button>\n      {showLabel && (\n        <span className=\"max-w-full truncate text-[11px] font-medium\" style={{ color: light ? \"#22222b\" : \"rgba(255,255,255,.88)\", textShadow: light ? \"none\" : \"0 1px 3px rgba(0,0,0,.4)\" }}>\n          {app.label}\n        </span>\n      )}\n    </div>\n  );\n}\n\nexport function FrostedAppIcons({\n  apps = APPS,\n  dock = DOCK,\n  colors,\n  time = \"9:41\",\n  followLight = true,\n  theme = \"dark\",\n  onOpen,\n  className,\n  style,\n  ...props\n}: FrostedAppIconsProps) {\n  const light = theme === \"light\";\n  const [c1, c2, c3] = colors ?? (light ? [\"#ffb4a8\", \"#a9c7ff\", \"#c9f2c7\"] : [\"#ff6a3d\", \"#7a3cff\", \"#00c2ff\"]);\n  const lightRef = React.useRef<HTMLDivElement>(null);\n  // Badges live here so opening an app (or a dock app) clears its count.\n  const [badges, setBadges] = React.useState<Record<string, number>>(() => Object.fromEntries([...apps, ...dock].map((a) => [a.id, a.badge ?? 0])));\n  const [opened, setOpened] = React.useState<string | null>(null);\n\n  const open = (app: FrostedApp) => {\n    setOpened(app.label);\n    // Let the badge pop before it is removed from the tree.\n    window.setTimeout(() => setBadges((b) => ({ ...b, [app.id]: 0 })), 380);\n    onOpen?.(app);\n  };\n\n  return (\n    <div\n      className={cn(\"relative isolate w-full max-w-[400px] overflow-hidden rounded-[34px] select-none\", className)}\n      style={{ background: light ? \"#eef0f6\" : \"#0b0b14\", ...style }}\n      onPointerMove={(event) => {\n        if (!followLight || event.pointerType !== \"mouse\" || !lightRef.current) return;\n        const r = event.currentTarget.getBoundingClientRect();\n        const scale = r.width / event.currentTarget.offsetWidth || 1;\n        lightRef.current.style.transform = `translate(${(event.clientX - r.left) / scale - 110}px, ${(event.clientY - r.top) / scale - 110}px)`;\n        lightRef.current.style.opacity = \"1\";\n      }}\n      onPointerLeave={() => {\n        if (lightRef.current) lightRef.current.style.opacity = \"0\";\n      }}\n      {...props}\n    >\n      <style>{KEYFRAMES}</style>\n      {/* Wallpaper: three slow blobs and a soft light under the pointer, all seen through the glass. */}\n      <div aria-hidden=\"true\" className=\"absolute inset-0 -z-10 overflow-hidden\">\n        <div className=\"absolute -top-16 -left-20 size-72 rounded-full opacity-90 blur-3xl motion-safe:animate-[fai-drift-a_16s_ease-in-out_infinite]\" style={{ background: c1 }} />\n        <div className=\"absolute top-1/3 -right-24 size-80 rounded-full opacity-80 blur-3xl motion-safe:animate-[fai-drift-b_19s_ease-in-out_infinite]\" style={{ background: c2 }} />\n        <div className=\"absolute -bottom-24 left-6 size-72 rounded-full opacity-80 blur-3xl motion-safe:animate-[fai-drift-c_22s_ease-in-out_infinite]\" style={{ background: c3 }} />\n        <div\n          ref={lightRef}\n          className=\"absolute top-0 left-0 size-[220px] rounded-full opacity-0 blur-2xl transition-[opacity,transform] duration-500 ease-out\"\n          style={{ background: light ? \"radial-gradient(circle, rgba(255,255,255,.95), transparent 70%)\" : \"radial-gradient(circle, rgba(255,255,255,.55), transparent 70%)\" }}\n        />\n        <div className=\"absolute inset-0\" style={{ background: light ? \"rgba(255,255,255,.18)\" : \"rgba(5,5,12,.25)\" }} />\n      </div>\n\n      {time !== null && (\n        <div className=\"flex items-center justify-between px-7 pt-5 text-[13px] font-semibold\" style={{ color: light ? \"#1d1d24\" : \"#fff\" }}>\n          <span className=\"tabular-nums\">{time}</span>\n          <span aria-hidden=\"true\" className=\"flex items-center gap-1.5\">\n            <span className=\"flex items-end gap-[2px]\">\n              {[4, 6, 8, 10].map((h) => (\n                <span key={h} className=\"w-[3px] rounded-[1px]\" style={{ height: h, background: \"currentColor\" }} />\n              ))}\n            </span>\n            <span className=\"relative h-[11px] w-[22px] rounded-[3px] border border-current p-[1.5px] opacity-90\">\n              <span className=\"block h-full w-[70%] rounded-[1px]\" style={{ background: \"currentColor\" }} />\n            </span>\n          </span>\n        </div>\n      )}\n\n      <div role=\"group\" aria-label=\"Apps\" className=\"grid grid-cols-4 gap-x-3 gap-y-4 px-6 pt-6 pb-6\">\n        {apps.map((app) => (\n          <AppIcon key={app.id} app={app} size={60} badge={badges[app.id] ?? 0} light={light} showLabel onOpen={() => open(app)} />\n        ))}\n      </div>\n\n      {dock.length > 0 && (\n        <div className=\"px-3.5 pb-3.5\">\n          <div\n            role=\"group\"\n            aria-label=\"Dock\"\n            className=\"flex justify-around rounded-[28px] px-3 py-3\"\n            style={{\n              background: light ? \"rgba(255,255,255,.4)\" : \"rgba(255,255,255,.1)\",\n              backdropFilter: \"blur(24px) saturate(160%)\",\n              WebkitBackdropFilter: \"blur(24px) saturate(160%)\",\n              boxShadow: light ? \"inset 0 1px 0 rgba(255,255,255,.9), inset 0 0 0 1px rgba(255,255,255,.5)\" : \"inset 0 1px 0 rgba(255,255,255,.25), inset 0 0 0 1px rgba(255,255,255,.08)\",\n            }}\n          >\n            {dock.map((app) => (\n              <AppIcon key={app.id} app={app} size={56} badge={badges[app.id] ?? 0} light={light} showLabel={false} onOpen={() => open(app)} />\n            ))}\n          </div>\n        </div>\n      )}\n      <p aria-live=\"polite\" className=\"sr-only\">\n        {opened ? `Opened ${opened}` : \"\"}\n      </p>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}