{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "animated-list",
  "title": "Animated list",
  "description": "Notification stack where new items spring in from the top, older ones glide down, slightly dimmed in the depth variant, and items beyond the limit blur away.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://goodui.dev/r/goodui-motion.json"
  ],
  "files": [
    {
      "path": "registry/components/lists/animated-list.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\"\nimport { cn } from \"@/lib/utils\"\nimport { spring as springs } from \"@/lib/goodui-motion\"\n\nexport type AnimatedListProps<T> = Omit<React.ComponentProps<\"ul\">, \"children\"> & {\n  /** Newest first. New items enter at the top and push the rest down. */\n  items: T[]\n  /** Stable unique key of an item; a new key is what makes an item animate in. */\n  getKey: (item: T) => string\n  /** Content of one item; `index` is 0 for the newest. */\n  renderItem: (item: T, index: number) => React.ReactNode\n  /** Items beyond this count leave the bottom of the stack. */\n  maxItems?: number\n  /** Dim and shrink older items slightly, like a notification stack. Dimming lowers text contrast, so use text-foreground/75 rather than text-muted-foreground for secondary text. */\n  depth?: boolean\n  /** Fade the bottom edge out. */\n  fadeEdge?: boolean\n  /** Accessible name for the live region. */\n  label?: string\n}\n\n/** Notification stack: new items spring in from the top while older ones glide down and drop off the end. */\nexport function AnimatedList<T>({\n  items,\n  getKey,\n  renderItem,\n  maxItems = 5,\n  depth = false,\n  fadeEdge = false,\n  label = \"Notifications\",\n  className,\n  style,\n  ...props\n}: AnimatedListProps<T>) {\n  const reduce = useReducedMotion() ?? false\n  const visible = items.slice(0, maxItems)\n  const spring = reduce ? { duration: 0 } : springs.ui\n\n  return (\n    // A plain list (so <li> children stay valid) that is also a polite live region announcing new items.\n    <ul\n      aria-live=\"polite\"\n      aria-relevant=\"additions\"\n      aria-label={label}\n      className={cn(\"relative flex w-full flex-col gap-2\", className)}\n      style={\n        fadeEdge\n          ? {\n              maskImage: \"linear-gradient(to bottom, black 70%, transparent)\",\n              WebkitMaskImage: \"linear-gradient(to bottom, black 70%, transparent)\",\n              ...style,\n            }\n          : style\n      }\n      {...props}\n    >\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        {visible.map((item, i) => {\n          const dim = depth ? Math.min(i, 4) : 0\n          // 6% per step keeps text in older items readable (at most 24% dimmer).\n          return (\n            <motion.li\n              key={getKey(item)}\n              layout={reduce ? false : \"position\"}\n              initial={reduce ? { opacity: 0 } : { opacity: 0, y: -24, scale: 0.92, filter: \"blur(4px)\" }}\n              animate={{ opacity: 1 - dim * 0.06, y: 0, scale: 1 - dim * 0.02, filter: \"blur(0px)\" }}\n              exit={reduce ? { opacity: 0 } : { opacity: 0, scale: 0.9, filter: \"blur(4px)\", transition: { duration: 0.2 } }}\n              transition={spring}\n              style={{ transformOrigin: \"50% 0%\" }}\n              className=\"list-none\"\n            >\n              {renderItem(item, i)}\n            </motion.li>\n          )\n        })}\n      </AnimatePresence>\n    </ul>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/goodui/animated-list.tsx"
    }
  ],
  "categories": [
    "components",
    "lists"
  ],
  "type": "registry:component"
}