{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "archive-02",
  "title": "archive-02",
  "description": "Animated archive icon",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "icons/archive-02.tsx",
      "content": "'use client';\n\nimport type { Variants } from 'motion/react';\nimport { motion, useAnimation } from 'motion/react';\nimport type { HTMLAttributes } from 'react';\nimport { forwardRef } from 'react';\nimport { useIconAnimation } from '@/lib/use-icon-animation';\nimport { cn } from '@/lib/utils';\n\nexport interface Archive02IconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface Archive02IconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\n// A document with text slides through the bottom drawer's top seam.\nconst ARCHIVE_DOCUMENT =\n  'M6.9 11V4.5C6.9 3.9 7.4 3.4 8 3.4H16C16.6 3.4 17.1 3.9 17.1 4.5V11Z';\n\nconst ARCHIVE_DURATION = 0.94;\n\nconst ARCHIVE_TIMES = [\n  0, 0.05, 0.1, 0.16, 0.23, 0.31, 0.4, 0.5, 0.58, 0.65, 0.71,\n  0.76, 0.8, 0.84, 0.88, 0.93, 0.97, 1,\n];\n\nconst archiveDrawerVariants: Variants = {\n  normal: {\n    transform: 'translateY(0px)',\n    transition: { duration: 0.18, ease: [0.23, 1, 0.32, 1] },\n  },\n  animate: {\n    transform: [\n      'translateY(0px)',\n      'translateY(0.25px)',\n      'translateY(0.9px)',\n      'translateY(1.85px)',\n      'translateY(2.65px)',\n      'translateY(2.38px)',\n      'translateY(2.5px)',\n      'translateY(2.5px)',\n      'translateY(2.5px)',\n      'translateY(2.5px)',\n      'translateY(2.5px)',\n      'translateY(2.5px)',\n      'translateY(2.5px)',\n      'translateY(2.5px)',\n      'translateY(2.5px)',\n      'translateY(1.55px)',\n      'translateY(0.45px)',\n      'translateY(0px)',\n    ],\n    transition: {\n      duration: ARCHIVE_DURATION,\n      ease: [0.77, 0, 0.175, 1],\n      times: ARCHIVE_TIMES,\n    },\n  },\n};\n\nconst archiveDocumentVariants: Variants = {\n  normal: {\n    transform: 'translateY(11.3px)',\n    transition: { duration: 0.14, ease: [0.23, 1, 0.32, 1] },\n  },\n  animate: {\n    transform: [\n      'translateY(11.3px)',\n      'translateY(11.3px)',\n      'translateY(11.3px)',\n      'translateY(10.6px)',\n      'translateY(8.9px)',\n      'translateY(6.2px)',\n      'translateY(3.2px)',\n      'translateY(1.45px)',\n      'translateY(1.15px)',\n      'translateY(1.28px)',\n      'translateY(1.9px)',\n      'translateY(3.4px)',\n      'translateY(6.2px)',\n      'translateY(9.4px)',\n      'translateY(11.3px)',\n      'translateY(11.3px)',\n      'translateY(11.3px)',\n      'translateY(11.3px)',\n    ],\n    transition: {\n      duration: ARCHIVE_DURATION,\n      ease: [0.77, 0, 0.175, 1],\n      times: ARCHIVE_TIMES,\n    },\n  },\n};\nconst generatedGeometryVariants: Variants = {\n  normal: { visibility: 'hidden', transition: { duration: 0 } },\n  animate: { visibility: 'visible', transition: { duration: 0 } },\n};\n\nconst Archive02Icon = forwardRef<Archive02IconHandle, Archive02IconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const controls = useAnimation();\n    const { handleMouseEnter, handleMouseLeave } = useIconAnimation({\n      controls,\n      loops: false,\n      onMouseEnter,\n      onMouseLeave,\n      ref,\n    });\n\n    return (\n      <div\n        className={cn(className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\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          <defs>\n            <clipPath id=\"archive-document-window\" clipPathUnits=\"userSpaceOnUse\">\n              <rect x=\"0\" y=\"0\" width=\"24\" height=\"13.8\" />\n            </clipPath>\n            <mask\n              id=\"archive-back-mask\"\n              x=\"0\"\n              y=\"0\"\n              width=\"24\"\n              height=\"24\"\n              maskUnits=\"userSpaceOnUse\"\n            >\n              <rect x=\"0\" y=\"0\" width=\"24\" height=\"24\" fill=\"white\" />\n              <motion.g\n                variants={generatedGeometryVariants}\n                animate={controls}\n                initial=\"normal\"\n              >\n                <motion.rect\n                  x=\"6.1\"\n                  y=\"2.7\"\n                  width=\"11.8\"\n                  height=\"11.4\"\n                  rx=\"0.6\"\n                  fill=\"black\"\n                  variants={archiveDocumentVariants}\n                  animate={controls}\n                  initial=\"normal\"\n                />\n              </motion.g>\n              <motion.rect\n                x=\"0\"\n                y=\"11\"\n                width=\"24\"\n                height=\"13\"\n                fill=\"black\"\n                variants={archiveDrawerVariants}\n                animate={controls}\n                initial=\"normal\"\n              />\n            </mask>\n          </defs>\n          <path\n            d=\"M4 13.5V11C4.00005 9.59977 4.00008 8.89966 4.27263 8.36485C4.5123 7.89455 4.89469 7.51218 5.365 7.27253C5.89981 7 6.59993 7 8.00015 7H16C17.4001 7 18.1002 7 18.635 7.27248C19.1054 7.51217 19.4878 7.89462 19.7275 8.36502C20 8.8998 20 9.59987 20 11V13.5\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n            mask=\"url(#archive-back-mask)\"\n          />\n          <g clipPath=\"url(#archive-document-window)\">\n            <motion.g\n              variants={generatedGeometryVariants}\n              animate={controls}\n              initial=\"normal\"\n            >\n              <motion.g\n                variants={archiveDocumentVariants}\n                animate={controls}\n                initial=\"normal\"\n              >\n                <path\n                  d={ARCHIVE_DOCUMENT}\n                  stroke=\"currentColor\"\n                  strokeLinecap=\"round\"\n                  strokeLinejoin=\"round\"\n                  strokeWidth=\"1.5\"\n                />\n                <path\n                  d=\"M8.8 5.6H15.2M8.8 7.7H14.5M8.8 9.8H13.6\"\n                  stroke=\"currentColor\"\n                  strokeLinecap=\"round\"\n                  strokeWidth=\"0.9\"\n                />\n              </motion.g>\n            </motion.g>\n          </g>\n          <motion.path\n            d=\"M7 21H16.9999C19.3569 21 20.5354 21 21.2677 20.2678C21.9999 19.5355 21.9999 18.357 21.9999 16C21.9999 13.643 21.9999 12.4645 21.2677 11.7322C20.5354 11 19.3569 11 16.9999 11H7C4.64302 11 3.46453 11 2.7323 11.7322C2.00007 12.4644 2.00005 13.6429 2 15.9999C1.99995 18.357 1.99993 19.5355 2.73217 20.2677C3.4644 21 4.64294 21 7 21Z\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n            variants={archiveDrawerVariants}\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformOrigin: '12px 16px' }}\n          />\n          <path\n            d=\"M6 7C6.00004 5.5998 6.00006 4.89969 6.27259 4.3649C6.51227 3.89457 6.89467 3.51218 7.36501 3.27252C7.89981 3 8.59991 3 10.0001 3H14C15.4001 3 16.1002 3 16.635 3.27248C17.1054 3.51217 17.4878 3.89462 17.7275 4.36502C18 4.8998 18 5.59987 18 7\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n          />\n          <motion.path\n            d=\"M16 15L15.7 15.4C15.1111 16.1851 14.8167 16.5777 14.3944 16.7889C13.9721 17 13.4814 17 12.5 17H11.5C10.5186 17 10.0279 17 9.60557 16.7889C9.18328 16.5777 8.88885 16.1851 8.3 15.4L8 15\"\n            stroke=\"currentColor\"\n            strokeLinecap=\"round\"\n            strokeLinejoin=\"round\"\n            strokeWidth=\"1.5\"\n            variants={archiveDrawerVariants}\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformOrigin: '12px 16px' }}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nArchive02Icon.displayName = 'Archive02Icon';\n\nexport { Archive02Icon };\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"
}