{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "search-01",
  "title": "search-01",
  "description": "Animated search icon",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "icons/search-01.tsx",
      "content": "'use client';\n\nimport { useAnimate, useReducedMotion } from 'motion/react';\nimport type { HTMLAttributes, MouseEventHandler } from 'react';\nimport {\n  forwardRef,\n  useCallback,\n  useImperativeHandle,\n  useRef,\n} from 'react';\nimport { cn } from '@/lib/utils';\n\nexport interface Search01IconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface Search01IconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst Search01Icon = forwardRef<Search01IconHandle, Search01IconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const [scope, animate] = useAnimate<HTMLDivElement>();\n    const shouldReduceMotion = useReducedMotion();\n    const isControlledRef = useRef(false);\n    const isPlayingRef = useRef(false);\n\n    const startAnimation = useCallback(() => {\n      if (shouldReduceMotion || isPlayingRef.current) return;\n\n      const target = scope.current?.querySelector<HTMLElement>(\n        '[data-search-icon]'\n      );\n      if (!target) return;\n\n      isPlayingRef.current = true;\n      void (async () => {\n        await animate(\n          target,\n          {\n            transform: [\n              'translate(0px, 0px) rotate(0deg) scale(1)',\n              'translate(1.25px, -0.55px) rotate(14deg) scale(0.78)',\n              'translate(0.4px, -0.8px) rotate(6deg) scale(0.76)',\n              'translate(-0.65px, 0.25px) rotate(-8deg) scale(0.8)',\n              'translate(-0.15px, 0.1px) rotate(-2.5deg) scale(1.08)',\n              'translate(0px, 0px) rotate(0deg) scale(1)',\n            ],\n          },\n          {\n            duration: 1.24,\n            times: [0, 0.32, 0.48, 0.64, 0.84, 1],\n            ease: [\n              [0.77, 0, 0.175, 1],\n              'linear',\n              'linear',\n              [0.77, 0, 0.175, 1],\n              [0.23, 1, 0.32, 1],\n            ],\n          }\n        );\n        isPlayingRef.current = false;\n      })();\n    }, [animate, scope, shouldReduceMotion]);\n\n    const stopAnimation = useCallback(() => {}, []);\n\n    useImperativeHandle(\n      ref,\n      () => {\n        isControlledRef.current = true;\n        return { startAnimation, stopAnimation };\n      },\n      [startAnimation, stopAnimation]\n    );\n\n    const handleMouseEnter = useCallback<MouseEventHandler<HTMLDivElement>>(\n      (event) => {\n        onMouseEnter?.(event);\n        if (!isControlledRef.current) startAnimation();\n      },\n      [onMouseEnter, startAnimation]\n    );\n\n    const handleMouseLeave = useCallback<MouseEventHandler<HTMLDivElement>>(\n      (event) => {\n        onMouseLeave?.(event);\n      },\n      [onMouseLeave]\n    );\n\n    return (\n      <div\n        ref={scope}\n        className={cn(className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <span\n          data-search-icon\n          style={{ display: 'inline-flex', transformOrigin: '11px 11px' }}\n        >\n          <svg\n            xmlns=\"http://www.w3.org/2000/svg\"\n            width={size}\n            height={size}\n            viewBox=\"0 0 24 24\"\n            fill=\"none\"\n            overflow=\"visible\"\n          >\n            <path\n              d=\"M17 17L21 21\"\n              stroke=\"currentColor\"\n              strokeLinecap=\"round\"\n              strokeLinejoin=\"round\"\n              strokeWidth=\"1.5\"\n            />\n            <path\n              d=\"M19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19C15.4183 19 19 15.4183 19 11Z\"\n              stroke=\"currentColor\"\n              strokeLinecap=\"round\"\n              strokeLinejoin=\"round\"\n              strokeWidth=\"1.5\"\n            />\n          </svg>\n        </span>\n      </div>\n    );\n  }\n);\n\nSearch01Icon.displayName = 'Search01Icon';\n\nexport { Search01Icon };\n",
      "type": "registry:ui"
    },
    {
      "path": "lib/use-icon-animation.ts",
      "content": "'use client';\n\nimport type { LegacyAnimationControls } from 'motion/react';\nimport { useReducedMotion } from 'motion/react';\nimport type {\n  ForwardedRef,\n  MouseEventHandler,\n} from 'react';\nimport { useCallback, useImperativeHandle, useRef } from 'react';\n\nexport interface AnimatedIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface UseIconAnimationOptions {\n  controls: LegacyAnimationControls;\n  loops?: boolean;\n  onMouseEnter?: MouseEventHandler<HTMLDivElement>;\n  onMouseLeave?: MouseEventHandler<HTMLDivElement>;\n  ref: ForwardedRef<AnimatedIconHandle>;\n}\n\nexport function useIconAnimation({\n  controls,\n  loops = false,\n  onMouseEnter,\n  onMouseLeave,\n  ref,\n}: UseIconAnimationOptions) {\n  const shouldReduceMotion = useReducedMotion();\n  const isControlledRef = useRef(false);\n  const isPlayingRef = useRef(false);\n  const runRef = useRef(0);\n\n  const startAnimation = useCallback(() => {\n    if (shouldReduceMotion || isPlayingRef.current) return;\n\n    isPlayingRef.current = true;\n    const run = ++runRef.current;\n    controls.set('normal');\n    void controls.start('animate').then(() => {\n      if (runRef.current === run) isPlayingRef.current = false;\n    });\n  }, [controls, shouldReduceMotion]);\n\n  const stopAnimation = useCallback(() => {\n    if (!loops) return;\n\n    runRef.current++;\n    isPlayingRef.current = false;\n    void controls.start('normal');\n  }, [controls, loops]);\n\n  useImperativeHandle(\n    ref,\n    () => {\n      isControlledRef.current = true;\n      return { startAnimation, stopAnimation };\n    },\n    [startAnimation, stopAnimation]\n  );\n\n  const handleMouseEnter = useCallback<MouseEventHandler<HTMLDivElement>>(\n    (event) => {\n      onMouseEnter?.(event);\n      if (!isControlledRef.current) startAnimation();\n    },\n    [onMouseEnter, startAnimation]\n  );\n\n  const handleMouseLeave = useCallback<MouseEventHandler<HTMLDivElement>>(\n    (event) => {\n      onMouseLeave?.(event);\n      if (!isControlledRef.current) stopAnimation();\n    },\n    [onMouseLeave, stopAnimation]\n  );\n\n  return { handleMouseEnter, handleMouseLeave };\n}\n",
      "type": "registry:lib"
    }
  ],
  "type": "registry:ui"
}