{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "weather-widget",
  "title": "Weather Widget",
  "author": "VenusUI",
  "description": "A weather widget with a live sky: turning sun rays, drifting clouds, falling rain or snow, and twinkling stars.",
  "dependencies": [
    "lucide-react"
  ],
  "files": [
    {
      "path": "registry/default/ui/weather-widget.tsx",
      "content": "import * as React from \"react\"\nimport { Cloud, CloudRain, CloudSnow, Moon, Sun, type LucideIcon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport type WeatherCondition = \"sunny\" | \"cloudy\" | \"rain\" | \"snow\" | \"night\"\n\ninterface ForecastDay {\n  day: string\n  condition: WeatherCondition\n  high: number\n  low: number\n}\n\ninterface WeatherWidgetProps extends React.ComponentProps<\"section\"> {\n  city: string\n  condition: WeatherCondition\n  temperature: number\n  high: number\n  low: number\n  /** Short description, e.g. \"Light rain\". Defaults to a description of the condition. */\n  summary?: string\n  forecast?: ForecastDay[]\n}\n\nconst SKY: Record<WeatherCondition, string> = {\n  sunny: \"from-sky-500 via-sky-400 to-sky-300\",\n  cloudy: \"from-slate-500 via-slate-400 to-slate-300\",\n  rain: \"from-slate-700 via-slate-600 to-slate-500\",\n  snow: \"from-slate-400 via-slate-300 to-blue-200\",\n  night: \"from-indigo-950 via-indigo-900 to-violet-900\",\n}\n\nconst LABEL: Record<WeatherCondition, string> = {\n  sunny: \"Sunny\",\n  cloudy: \"Cloudy\",\n  rain: \"Rain\",\n  snow: \"Snow\",\n  night: \"Clear night\",\n}\n\nconst ICON: Record<WeatherCondition, LucideIcon> = { sunny: Sun, cloudy: Cloud, rain: CloudRain, snow: CloudSnow, night: Moon }\n\n/** Stable pseudo-random numbers, so server and client render the same scene. */\nconst spread = (i: number, salt: number) => ((i * 9301 + salt * 49297) % 233280) / 233280\n\nfunction CloudShape({ className, style }: { className?: string; style?: React.CSSProperties }) {\n  return (\n    <span className={cn(\"absolute block aspect-[2.4] animate-weather-drift motion-reduce:animate-none\", className)} style={style}>\n      <span className=\"absolute bottom-0 left-0 h-[55%] w-full rounded-full bg-white/85\" />\n      <span className=\"absolute bottom-[25%] left-[15%] aspect-square w-[42%] rounded-full bg-white/85\" />\n      <span className=\"absolute bottom-[20%] left-[42%] aspect-square w-[50%] rounded-full bg-white/90\" />\n    </span>\n  )\n}\n\nfunction Scene({ condition }: { condition: WeatherCondition }) {\n  const cloudy = condition === \"cloudy\" || condition === \"rain\" || condition === \"snow\"\n  const dim = condition === \"rain\" ? \"opacity-70\" : \"\"\n  return (\n    <div aria-hidden=\"true\" className=\"pointer-events-none absolute inset-0 overflow-hidden\">\n      {condition === \"sunny\" ? (\n        <span className=\"absolute -top-10 -right-10 size-40\">\n          <span className=\"absolute inset-0 animate-spin rounded-full bg-[repeating-conic-gradient(rgb(255_255_255/0.28)_0deg_8deg,transparent_8deg_24deg)] [mask-image:radial-gradient(circle,black_20%,transparent_70%)] motion-reduce:animate-none\" style={{ animationDuration: \"40s\" }} />\n          <span className=\"absolute inset-[30%] rounded-full bg-amber-200 shadow-[0_0_40px_12px_rgb(253_230_138/0.8)]\" />\n        </span>\n      ) : null}\n      {condition === \"night\" ? (\n        <>\n          <span className=\"absolute top-6 right-8 size-12 rounded-full shadow-[inset_-10px_-4px_0_0_rgb(254_243_199)]\" />\n          {Array.from({ length: 22 }, (_, i) => (\n            <span\n              key={i}\n              className=\"absolute size-0.5 animate-pulse rounded-full bg-white motion-reduce:animate-none\"\n              style={{ left: `${spread(i, 1) * 100}%`, top: `${spread(i, 2) * 55}%`, animationDelay: `${spread(i, 3) * 2}s`, opacity: 0.4 + spread(i, 4) * 0.6 }}\n            />\n          ))}\n        </>\n      ) : null}\n      {cloudy ? (\n        <>\n          <CloudShape className={cn(\"top-[6%] w-[40%]\", dim)} style={{ animationDuration: \"38s\", animationDelay: \"-12s\" }} />\n          <CloudShape className={cn(\"top-[18%] w-[30%] opacity-80\", dim)} style={{ animationDuration: \"52s\", animationDelay: \"-30s\" }} />\n          <CloudShape className={cn(\"top-[2%] w-[24%] opacity-70\", dim)} style={{ animationDuration: \"64s\", animationDelay: \"-5s\" }} />\n        </>\n      ) : null}\n      {condition === \"rain\"\n        ? Array.from({ length: 42 }, (_, i) => (\n            <span\n              key={i}\n              className=\"absolute top-0 h-5 w-[1.5px] animate-weather-fall rounded-full bg-linear-to-b from-transparent to-white/90 motion-reduce:hidden\"\n              style={{ left: `${spread(i, 5) * 100}%`, animationDuration: `${0.55 + spread(i, 6) * 0.35}s`, animationDelay: `${-spread(i, 7)}s` }}\n            />\n          ))\n        : null}\n      {condition === \"snow\"\n        ? Array.from({ length: 36 }, (_, i) => (\n            <span\n              key={i}\n              className=\"absolute top-0 animate-weather-fall rounded-full bg-white motion-reduce:hidden\"\n              style={{\n                left: `${spread(i, 8) * 100}%`,\n                width: 2 + spread(i, 9) * 3,\n                height: 2 + spread(i, 9) * 3,\n                animationDuration: `${3 + spread(i, 10) * 3}s`,\n                animationDelay: `${-spread(i, 11) * 6}s`,\n              }}\n            />\n          ))\n        : null}\n    </div>\n  )\n}\n\n/**\n * A weather widget with a live sky: the sun's rays turn, clouds drift,\n * rain or snow falls, stars twinkle at night. With reduced motion the scene\n * is still. It's a labelled section; the scene itself is decorative.\n */\nfunction WeatherWidget({ city, condition, temperature, high, low, summary, forecast = [], className, ...props }: WeatherWidgetProps) {\n  const label = summary ?? LABEL[condition]\n  return (\n    <section\n      aria-label={`Weather in ${city}`}\n      data-slot=\"weather-widget\"\n      className={cn(\"relative isolate w-full max-w-sm overflow-hidden rounded-[1.75rem] bg-linear-to-b text-white shadow-xl\", SKY[condition], className)}\n      {...props}\n    >\n      <Scene condition={condition} />\n      <div className=\"relative flex flex-col p-5 [text-shadow:0_1px_3px_rgb(0_0_0/0.35)]\">\n        <p className=\"text-sm font-medium\">{city}</p>\n        <p className=\"mt-1 text-6xl font-light tracking-tight tabular-nums\">{temperature}°</p>\n        <p className=\"mt-1 text-sm font-medium\">{label}</p>\n        <p className=\"text-sm text-white/85\">\n          H:{high}° L:{low}°\n        </p>\n\n        {forecast.length > 0 ? (\n          <ul className=\"mt-5 grid grid-cols-5 gap-1 rounded-2xl bg-white/15 p-2.5 text-center text-xs backdrop-blur-md\">\n            {forecast.slice(0, 5).map((f) => {\n              const Icon = ICON[f.condition]\n              return (\n                <li key={f.day} className=\"flex flex-col items-center gap-1.5\">\n                  <span className=\"font-medium\">{f.day}</span>\n                  <Icon aria-label={LABEL[f.condition]} className=\"size-4\" />\n                  <span className=\"tabular-nums\">\n                    {f.high}° <span className=\"text-white/70\">{f.low}°</span>\n                  </span>\n                </li>\n              )\n            })}\n          </ul>\n        ) : null}\n      </div>\n    </section>\n  )\n}\n\nexport { WeatherWidget }\n",
      "type": "registry:ui"
    }
  ],
  "cssVars": {
    "theme": {
      "animate-weather-drift": "weather-drift 40s linear infinite",
      "animate-weather-fall": "weather-fall 1s linear infinite"
    }
  },
  "css": {
    "@keyframes weather-drift": {
      "from": {
        "transform": "translateX(-110%)"
      },
      "to": {
        "transform": "translateX(420%)"
      }
    },
    "@keyframes weather-fall": {
      "from": {
        "transform": "translateY(-20px)",
        "opacity": "0"
      },
      "10%": {
        "opacity": "1"
      },
      "to": {
        "transform": "translateY(380px)",
        "opacity": "0.2"
      }
    }
  },
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "data-display",
    "animations"
  ],
  "type": "registry:ui"
}