{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "animated-timeline",
  "title": "Animated Timeline",
  "author": "AlgorizeTech",
  "description": "A timeline whose entries animate in on scroll, with five entrance styles. Use it on marketing pages for company history and roadmap sections.",
  "dependencies": [],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "src/components/custom/blocks/AnimatedTimelineBlock.tsx",
      "content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\nimport React, { forwardRef, useEffect, useRef, useState } from \"react\";\nimport { getThemeStyles } from \"./animated-timeline-theme\";\n\n// ==========================================\n// THEME & CONFIGURATION\n// ==========================================\nexport type TimelineLayout = \"left\" | \"right\" | \"center\";\nexport type TimelineAnimation =\n  | \"fade-up\"\n  | \"slide-in\"\n  | \"zoom-in\"\n  | \"flip-up\"\n  | \"blur-in\";\nexport type TimelineColor =\n  | \"indigo\"\n  | \"rose\"\n  | \"emerald\"\n  | \"blue\"\n  | \"zinc\"\n  | (string & {});\n\n// ==========================================\n// INTERFACES\n// ==========================================\nexport interface AnimatedTimelineItem {\n  id: string | number;\n  title: string;\n  date: string;\n  description?: string;\n  icon?: React.ElementType;\n}\n\nexport interface AnimatedTimelineProps\n  extends React.HTMLAttributes<HTMLDivElement> {\n  items: AnimatedTimelineItem[];\n  layout?: TimelineLayout;\n  animation?: TimelineAnimation;\n  color?: TimelineColor;\n}\n\n// ==========================================\n// NODE COMPONENT (Scroll-aware)\n// ==========================================\nfunction AnimatedTimelineNode({\n  item,\n  index,\n  isLast,\n  theme,\n  layout,\n  animation,\n}: {\n  item: AnimatedTimelineItem;\n  index: number;\n  isLast: boolean;\n  theme: Record<string, string>;\n  layout: TimelineLayout;\n  animation: TimelineAnimation;\n}) {\n  const [isVisible, setIsVisible] = useState(false);\n  const nodeRef = useRef<HTMLDivElement>(null);\n  const Icon = item.icon;\n  const isEven = index % 2 === 0;\n  const isCenter = layout === \"center\";\n\n  useEffect(() => {\n    const observer = new IntersectionObserver(\n      ([entry]) => {\n        if (entry.isIntersecting) setIsVisible(true);\n        else setIsVisible(false);\n      },\n      { threshold: 0.1, rootMargin: \"0px 0px -40px 0px\" },\n    );\n    if (nodeRef.current) observer.observe(nodeRef.current);\n    return () => observer.disconnect();\n  }, []);\n\n  let slideDir = \"translate-y-8\";\n  if (animation === \"slide-in\") {\n    if (layout === \"left\") slideDir = \"-translate-x-12\";\n    else if (layout === \"right\") slideDir = \"translate-x-12 sm:translate-x-12\";\n    else if (layout === \"center\") slideDir = isEven ? \"-translate-x-12\" : \"translate-x-12\";\n  }\n\n  const getAnimationClasses = () => {\n    if (!isVisible) {\n      return cn(\n        \"opacity-0 transition-all duration-700 ease-out\",\n        animation === \"fade-up\" && \"translate-y-8\",\n        animation === \"slide-in\" && slideDir,\n        animation === \"zoom-in\" && \"scale-90\",\n        animation === \"flip-up\" && \"[transform:rotateX(90deg)]\",\n        animation === \"blur-in\" && \"blur-md scale-95\",\n      );\n    }\n    return cn(\n      \"opacity-100 translate-y-0 translate-x-0 scale-100 [transform:rotateX(0deg)] blur-0\",\n      \"transition-all duration-700 ease-out\",\n    );\n  };\n\n  return (\n    <div\n      ref={nodeRef}\n      className=\"relative flex flex-col sm:flex-row w-full group [perspective:1000px]\"\n    >\n      {/* Line connecting nodes */}\n      {!isLast && (\n        <div\n          className={cn(\n            \"absolute w-[2px] bg-muted transition-all duration-1000 origin-top\",\n            \"left-[19px] sm:left-auto top-10 bottom-[-32px] sm:bottom-[-48px]\",\n            layout === \"left\" && \"sm:left-[19px]\",\n            layout === \"right\" && \"sm:right-[19px]\",\n            layout === \"center\" && \"sm:left-1/2 sm:-translate-x-1/2\",\n            isVisible ? \"scale-y-100 opacity-100\" : \"scale-y-0 opacity-0\",\n          )}\n        />\n      )}\n\n      {/* Node Dot / Icon Container */}\n      <div\n        className={cn(\n          \"absolute z-10 flex items-center justify-center rounded-full border-2 bg-background transition-all duration-500 delay-200\",\n          \"w-10 h-10 left-0 sm:left-auto\",\n          layout === \"left\" && \"sm:left-0\",\n          layout === \"right\" && \"sm:right-0\",\n          layout === \"center\" && \"sm:left-1/2 sm:-translate-x-1/2\",\n          isVisible\n            ? cn(theme.border, theme.glow, \"scale-100 opacity-100\")\n            : \"border-border scale-50 opacity-0\",\n        )}\n      >\n        {Icon ? (\n          <Icon\n            className={cn(\n              \"w-4 h-4 transition-colors duration-500 delay-300\",\n              isVisible ? theme.text : \"text-muted-foreground\",\n            )}\n          />\n        ) : (\n          <div\n            className={cn(\n              \"w-3 h-3 rounded-full transition-colors duration-500 delay-300\",\n              isVisible ? theme.bg : \"bg-muted\",\n            )}\n          />\n        )}\n      </div>\n\n      {/* Content Card */}\n      <div\n        className={cn(\n          \"flex flex-col w-full pl-16 sm:pl-0\",\n          layout === \"center\"\n            ? \"sm:w-[calc(50%-3rem)]\"\n            : \"sm:w-[calc(100%-4rem)]\",\n          layout === \"left\" && \"sm:ml-16\",\n          layout === \"right\" && \"sm:mr-16 sm:text-right\",\n          isCenter && isEven && \"sm:mr-auto sm:pr-0 sm:text-right\",\n          isCenter && !isEven && \"sm:ml-auto sm:pl-0 sm:text-left\",\n        )}\n      >\n        <div\n          className={cn(\n            \"flex flex-col gap-2 p-5 rounded-2xl bg-card text-card-foreground border border-border shadow-sm\",\n            getAnimationClasses(),\n          )}\n          style={{ transitionDelay: \"100ms\" }}\n        >\n          <div\n            className={cn(\n              \"flex flex-col sm:flex-row justify-between gap-2 sm:gap-4\",\n              (layout === \"right\" || (isCenter && isEven)) &&\n                \"sm:flex-row-reverse\",\n            )}\n          >\n            <h3\n              className={cn(\n                \"text-base font-semibold text-foreground transition-colors\",\n                \"group-hover:text-[var(--atl-color)]\",\n              )}\n            >\n              {item.title}\n            </h3>\n            <span\n              className={cn(\n                \"text-xs font-semibold px-2.5 py-1 rounded-md shrink-0 w-max bg-muted text-muted-foreground transition-colors duration-500\",\n                isVisible && theme.text,\n              )}\n            >\n              {item.date}\n            </span>\n          </div>\n          {item.description && (\n            <p className=\"text-sm text-muted-foreground\">\n              {item.description}\n            </p>\n          )}\n        </div>\n      </div>\n    </div>\n  );\n}\n\n// ==========================================\n// MAIN COMPONENT\n// ==========================================\nexport const AnimatedTimelineBlock = forwardRef<\n  HTMLDivElement,\n  AnimatedTimelineProps\n>(\n  (\n    {\n      items,\n      layout = \"left\",\n      animation = \"fade-up\",\n      color = \"primary\",\n      className,\n      ...props\n    },\n    ref,\n  ) => {\n    const { theme, style } = getThemeStyles(color as string);\n\n    return (\n      <div\n        ref={ref}\n        className={cn(\"w-full py-4\", className)}\n        style={style}\n        {...props}\n      >\n        <div className=\"relative flex flex-col gap-8 sm:gap-12\">\n          {items.map((item, index) => (\n            <AnimatedTimelineNode\n              key={item.id}\n              item={item}\n              index={index}\n              isLast={index === items.length - 1}\n              theme={theme}\n              layout={layout}\n              animation={animation}\n            />\n          ))}\n        </div>\n      </div>\n    );\n  },\n);\nAnimatedTimelineBlock.displayName = \"AnimatedTimelineBlock\";\n",
      "type": "registry:component",
      "target": "components/custom/blocks/AnimatedTimelineBlock.tsx"
    },
    {
      "path": "src/components/custom/blocks/animated-timeline-theme.ts",
      "content": "\"use client\";\n\nimport React from \"react\";\n\nconst colorThemes: Record<string, Record<string, string>> = {\n  primary: {\n    bg: \"bg-primary\",\n    text: \"text-primary\",\n    border: \"border-primary/30\",\n    glow: \"shadow-[0_0_15px_color-mix(in_oklab,var(--primary)_50%,transparent)]\",\n  },\n  indigo: {\n    bg: \"bg-indigo-600\",\n    text: \"text-indigo-600 dark:text-indigo-400\",\n    border: \"border-indigo-500\",\n    glow: \"shadow-[0_0_15px_rgba(99,102,241,0.5)]\",\n  },\n  rose: {\n    bg: \"bg-rose-600\",\n    text: \"text-rose-600 dark:text-rose-400\",\n    border: \"border-rose-500\",\n    glow: \"shadow-[0_0_15px_rgba(225,29,72,0.5)]\",\n  },\n  emerald: {\n    bg: \"bg-emerald-600\",\n    text: \"text-emerald-600 dark:text-emerald-400\",\n    border: \"border-emerald-500\",\n    glow: \"shadow-[0_0_15px_rgba(16,185,129,0.5)]\",\n  },\n  blue: {\n    bg: \"bg-blue-600\",\n    text: \"text-blue-600 dark:text-blue-400\",\n    border: \"border-blue-500\",\n    glow: \"shadow-[0_0_15px_rgba(59,130,246,0.5)]\",\n  },\n  violet: {\n    bg: \"bg-violet-600\",\n    text: \"text-violet-600 dark:text-violet-400\",\n    border: \"border-violet-500\",\n    glow: \"shadow-[0_0_15px_rgba(139,92,246,0.5)]\",\n  },\n  zinc: {\n    bg: \"bg-zinc-900 dark:bg-zinc-100\",\n    text: \"text-zinc-900 dark:text-zinc-100\",\n    border: \"border-zinc-900 dark:border-zinc-100\",\n    glow: \"shadow-[0_0_15px_rgba(255,255,255,0.3)] dark:shadow-[0_0_15px_rgba(255,255,255,0.4)]\",\n  },\n};\n\nconst hexToRgb = (hex: string) => {\n  let cleanHex = hex.replace(/^#/, \"\");\n  if (cleanHex.length === 3)\n    cleanHex = cleanHex\n      .split(\"\")\n      .map((x) => x + x)\n      .join(\"\");\n  const result = /^([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(cleanHex);\n  return result\n    ? `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}`\n    : \"99, 102, 241\";\n};\n\nexport const getThemeStyles = (color: string) => {\n  if (color && color.startsWith(\"#\")) {\n    const rgbStr = hexToRgb(color);\n\n    return {\n      theme: {\n        bg: \"bg-[var(--atl-color)]\",\n        text: \"text-[var(--atl-color)]\",\n        border: \"border-[var(--atl-color)]\",\n        glow: \"shadow-[0_0_15px_var(--atl-glow)]\",\n      },\n      style: {\n        \"--atl-color\": color,\n        \"--atl-glow\": `rgba(${rgbStr}, 0.5)`,\n      } as React.CSSProperties,\n    };\n  }\n  return { theme: colorThemes[color] || colorThemes.primary, style: {} };\n};\n",
      "type": "registry:component",
      "target": "components/custom/blocks/animated-timeline-theme.ts"
    }
  ],
  "docs": "Named exports: AnimatedTimelineBlock, getThemeStyles (from animated-timeline-theme.ts, which installs alongside). `animation` is fade-up | slide-in | zoom-in | flip-up | blur-in; `layout` is left | right | center. Uses IntersectionObserver rather than a motion library, so it has no runtime dependencies. For status-driven progress, use `timeline`.",
  "categories": [
    "data-display",
    "marketing"
  ],
  "type": "registry:component"
}
