{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cross",
  "type": "registry:ui",
  "title": "cross",
  "description": "Animated cross icon for Vue",
  "dependencies": [
    "motion-v"
  ],
  "files": [
    {
      "path": "components/ui/cross.vue",
      "type": "registry:ui",
      "content": "<script setup lang=\"ts\">\nimport { motion, useAnimationControls } from 'motion-v'\nimport type { Variants } from 'motion-v'\nimport { useIconAnimation } from '../composables/useIconAnimation'\nimport type { AnimatedIconHandle } from '../types'\n\ndefineOptions({ inheritAttrs: false, name: 'CrossIcon' })\n\nwithDefaults(\n  defineProps<{\n    size?: number\n  }>(),\n  { size: 28 },\n)\n\n// after circle-x: the two closing strokes strike in sequence and settle\n// generated from @hugeicons/core-free-icons\nconst markVariants: Variants = {\n  normal: {\n    transform: 'scale(1) rotate(0deg)',\n  },\n  animate: {\n    transform: ['scale(1) rotate(0deg)', 'scale(0.86) rotate(-1.91deg)', 'scale(1.08) rotate(0.77deg)', 'scale(1) rotate(0deg)'],\n    transition: {\n      duration: 0.5,\n      ease: [0.23, 1, 0.32, 1],\n    },\n  },\n}\n\nconst controls = useAnimationControls()\nconst { onMouseEnter, onMouseLeave, startAnimation, stopAnimation } = useIconAnimation({\n  controls,\n  loops: false,\n})\n\ndefineExpose<AnimatedIconHandle>({ startAnimation, stopAnimation })\n</script>\n\n<template>\n  <div class=\"hia-icon\" @mouseenter=\"onMouseEnter\" @mouseleave=\"onMouseLeave\" v-bind=\"$attrs\">\n          <svg xmlns=\"http://www.w3.org/2000/svg\" :width=\"size\" :height=\"size\" viewBox=\"0 0 24 24\" fill=\"none\" overflow=\"visible\">\n            <motion.path d=\"M13.5001 7.50195V5.50195C13.5001 5.0373 13.5001 4.80497 13.4617 4.61177C13.3039 3.81839 12.6837 3.1982 11.8903 3.04038C11.6971 3.00195 11.4648 3.00195 11.0001 3.00195C10.5355 3.00195 10.3031 3.00195 10.1099 3.04038C9.31656 3.1982 8.69636 3.81839 8.53855 4.61177C8.50012 4.80497 8.50012 5.0373 8.50012 5.50195V7.50195C8.50012 8.44476 8.50012 8.91617 8.20723 9.20906C7.91434 9.50195 7.44293 9.50195 6.50012 9.50195H4.50012C4.03547 9.50195 3.80314 9.50195 3.60994 9.54038C2.81656 9.6982 2.19636 10.3184 2.03855 11.1118C2.00012 11.305 2.00012 11.5373 2.00012 12.002C2.00012 12.4666 2.00012 12.6989 2.03855 12.8921C2.19636 13.6855 2.81656 14.3057 3.60994 14.4635C3.80314 14.502 4.03547 14.502 4.50012 14.502H6.5001C7.44292 14.502 7.91433 14.502 8.20722 14.7949C8.50012 15.0877 8.50011 15.5592 8.5001 16.502L8.50008 18.5019C8.50007 18.9666 8.50007 19.1989 8.5385 19.3921C8.69631 20.1855 9.3165 20.8057 10.1099 20.9635C10.3031 21.002 10.5354 21.002 11.0001 21.002C11.4648 21.002 11.6971 21.002 11.8903 20.9635C12.6837 20.8057 13.3039 20.1855 13.4617 19.3922C13.5001 19.1989 13.5001 18.9666 13.5001 18.5019V16.502C13.5001 15.5591 13.5001 15.0877 13.793 14.7948C14.0859 14.502 14.5573 14.502 15.5001 14.502H17.5001C17.9648 14.502 18.1971 14.502 18.3903 14.4635C19.1837 14.3057 19.8039 13.6855 19.9617 12.8921C20.0001 12.6989 20.0001 12.4666 20.0001 12.002C20.0001 11.5373 20.0001 11.305 19.9617 11.1118C19.8039 10.3184 19.1837 9.6982 18.3903 9.54038C18.1971 9.50195 17.9648 9.50195 17.5001 9.50195H15.5001C14.5573 9.50195 14.0859 9.50195 13.793 9.20906C13.5001 8.91617 13.5001 8.44476 13.5001 7.50195Z\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\" :variants=\"markVariants\" :animate=\"controls\" initial=\"normal\" :style=\"{ transformOrigin: '11px 12px' }\" />\n          </svg>\n        </div>\n</template>\n"
    },
    {
      "path": "composables/useIconAnimation.ts",
      "type": "registry:lib",
      "content": "import { ref, toValue, type MaybeRefOrGetter } from 'vue'\nimport type { AnimatedIconHandle } from '../types'\n\nexport type IconPose = 'normal' | 'animate'\n\ntype AnimationControls = {\n  set: (variant: IconPose | Record<string, unknown>) => void\n  start: (variant: IconPose | Record<string, unknown>) => Promise<unknown>\n}\n\nexport function useReducedMotionFlag(\n  reduced?: MaybeRefOrGetter<boolean | undefined>,\n) {\n  if (typeof window === 'undefined') return () => false\n  return () => {\n    const override = reduced === undefined ? undefined : toValue(reduced)\n    if (override !== undefined) return override\n    return window.matchMedia('(prefers-reduced-motion: reduce)').matches\n  }\n}\n\nexport function useIconAnimation(options: {\n  controls: AnimationControls\n  loops?: boolean\n}): AnimatedIconHandle & {\n  onMouseEnter: () => void\n  onMouseLeave: () => void\n} {\n  const { controls, loops = false } = options\n  const isPlaying = ref(false)\n  let run = 0\n\n  const prefersReduced = () =>\n    typeof window !== 'undefined' &&\n    window.matchMedia('(prefers-reduced-motion: reduce)').matches\n\n  async function startAnimation() {\n    if (prefersReduced() || isPlaying.value) return\n\n    isPlaying.value = true\n    const current = ++run\n    controls.set('normal')\n    await controls.start('animate')\n    if (run === current) isPlaying.value = false\n  }\n\n  function stopAnimation() {\n    if (!loops) return\n    run += 1\n    isPlaying.value = false\n    void controls.start('normal')\n  }\n\n  return {\n    startAnimation,\n    stopAnimation,\n    onMouseEnter: () => {\n      void startAnimation()\n    },\n    onMouseLeave: () => {\n      stopAnimation()\n    },\n  }\n}\n"
    },
    {
      "path": "types/animated-icon.ts",
      "type": "registry:lib",
      "content": "export interface AnimatedIconHandle {\n  startAnimation: () => void\n  stopAnimation: () => void\n}\n\nexport interface AnimatedIconProps {\n  size?: number\n}\n"
    }
  ]
}
