{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "motion-scroll-progress",
  "title": "Scroll progress",
  "description": "A component that visualizes scroll progress with animated indicators.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "components/core/scroll-progress.tsx",
      "content": "'use client';\n\nimport {\n  motion,\n  MotionValue,\n  SpringOptions,\n  useScroll,\n  useSpring,\n} from 'motion/react';\nimport { cn } from '@/lib/utils';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { RefObject } from 'react';\n\nexport type ScrollProgressProps = {\n  className?: string;\n  springOptions?: SpringOptions;\n  containerRef?: RefObject<HTMLDivElement | null>;\n};\n\nconst DEFAULT_SPRING_OPTIONS: SpringOptions = {\n  stiffness: 200,\n  damping: 50,\n  restDelta: 0.001,\n};\n\nfunction followerOf(\n  prefersReducedMotion: boolean | null,\n  target: MotionValue<number>,\n  spring: MotionValue<number>\n) {\n  if (prefersReducedMotion) {\n    return target;\n  }\n  return spring;\n}\n\nexport function ScrollProgress({\n  className,\n  springOptions,\n  containerRef,\n}: ScrollProgressProps) {\n  const { scrollYProgress } = useScroll({\n    container: containerRef,\n  });\n\n  const prefersReducedMotion = usePrefersReducedMotion();\n\n  const springScaleX = useSpring(scrollYProgress, {\n    ...DEFAULT_SPRING_OPTIONS,\n    ...(springOptions ?? {}),\n  });\n  const scaleX = followerOf(\n    prefersReducedMotion,\n    scrollYProgress,\n    springScaleX\n  );\n\n  return (\n    <motion.div\n      className={cn('inset-x-0 top-0 h-1 origin-left', className)}\n      style={{\n        scaleX,\n      }}\n    />\n  );\n}\n",
      "type": "registry:component",
      "target": "components/core/scroll-progress.tsx"
    }
  ],
  "categories": [
    "motion"
  ],
  "type": "registry:component"
}