{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "badge-12",
  "title": "Removable badge",
  "description": "A badge with a cross that removes it.",
  "dependencies": [
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/components/badge/badge-12.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { XIcon } from '@/registry/ndeko/lib/icons';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nconst REMOVE_TRANSITION: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\n\nconst REMOVE_VARIANTS: Variants = {\n  shown: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n  hidden: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n};\n\nconst FADE_VARIANTS: Variants = {\n  shown: { opacity: 1 },\n  hidden: { opacity: 0 },\n};\n\nfunction removeVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return REMOVE_VARIANTS;\n}\n\nexport default function Badge12() {\n  const [isShown, setIsShown] = useState(true);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const removeVariants = removeVariantsOf(shouldReduceMotion);\n\n  function remove() {\n    setIsShown(false);\n  }\n\n  return (\n    <AnimatePresence initial={false}>\n      {isShown && (\n        <motion.span\n          key='badge'\n          className='inline-flex'\n          variants={removeVariants}\n          initial='hidden'\n          animate='shown'\n          exit='hidden'\n          transition={REMOVE_TRANSITION}\n        >\n          <Badge className='gap-0'>\n            Design\n            <Button\n              variant='ghost'\n              size='icon-sm'\n              className='text-primary-ink/60 hover:text-primary-ink -me-1.5 size-5 rounded-[inherit] hover:bg-transparent'\n              aria-label='Remove Design'\n              onClick={remove}\n            >\n              <XIcon className='size-3' />\n            </Button>\n          </Badge>\n        </motion.span>\n      )}\n    </AnimatePresence>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "categories": [
    "components",
    "badge"
  ],
  "type": "registry:component"
}