{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "morphing-text",
  "type": "registry:component",
  "title": "Morphing Text",
  "description": "Text that smoothly animates character changes when the value updates.",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "registry/new-york/blocks/morphing-text/morphing-text.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, AnimatePresence, Transition, Variants } from \"motion/react\";\nimport { cn } from \"@/lib/utils\";\n\nexport type MorphingTextProps = {\n  children: string;\n  as?: React.ElementType;\n  className?: string;\n  style?: React.CSSProperties;\n  variants?: Variants;\n  transition?: Transition;\n};\n\nexport default function MorphingText({\n  children,\n  as: Component = \"span\",\n  className,\n  style,\n  variants,\n  transition,\n}: MorphingTextProps) {\n  const uniqueId = React.useId();\n\n  const characters = React.useMemo(() => {\n    const charCounts: Record<string, number> = {};\n\n    return children.split(\"\").map((char) => {\n      const lowerChar = char.toLowerCase();\n      charCounts[lowerChar] = (charCounts[lowerChar] || 0) + 1;\n\n      return {\n        id: `${uniqueId}-${lowerChar}${charCounts[lowerChar]}`,\n        label: char === \" \" ? \"\\u00A0\" : char,\n      };\n    });\n  }, [children, uniqueId]);\n\n  const defaultVariants: Variants = {\n    initial: { opacity: 0, y: -20, filter: \"blur(8px)\", scale: 0.8 },\n    animate: { opacity: 1, y: 0, filter: \"blur(0px)\", scale: 1 },\n    exit: { opacity: 0, y: 20, filter: \"blur(8px)\", scale: 0.8 },\n  };\n\n  const defaultTransition: Transition = {\n    duration: 0.3,\n    ease: [0.4, 0, 0.2, 1],\n  };\n\n  return (\n    <Component className={cn(className)} aria-label={children} style={style}>\n      <AnimatePresence mode=\"popLayout\" initial={false}>\n        {characters.map((character) => (\n          <motion.span\n            key={character.id}\n            layoutId={character.id}\n            className=\"inline-block\"\n            aria-hidden=\"true\"\n            initial=\"initial\"\n            animate=\"animate\"\n            exit=\"exit\"\n            variants={variants || defaultVariants}\n            transition={transition || defaultTransition}\n          >\n            {character.label}\n          </motion.span>\n        ))}\n      </AnimatePresence>\n    </Component>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/ui/morphing-text.tsx"
    }
  ]
}