{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "stamp",
  "title": "Stamp",
  "description": "A rubber stamp that slams onto the page: it starts large and transparent and lands rotated with a small overshoot.",
  "registryDependencies": [
    "@corsair-ui/utils",
    "@corsair-ui/use-entrance"
  ],
  "files": [
    {
      "path": "registry/default/ui/stamp.tsx",
      "content": "\"use client\";\n\nimport { useMemo, type ComponentProps, type CSSProperties, type Ref } from \"react\";\n\nimport { useEntrance, type EntranceTrigger } from \"@/registry/default/hooks/use-entrance\";\nimport { cn } from \"@/registry/default/lib/utils\";\n\nfunction mergeRefs<T>(...refs: (Ref<T> | undefined)[]) {\n  return (node: T | null) => {\n    for (const ref of refs) {\n      if (typeof ref === \"function\") ref(node);\n      else if (ref) ref.current = node;\n    }\n  };\n}\n\ninterface StampProps extends Omit<ComponentProps<\"span\">, \"onAnimationEnd\"> {\n  as?: \"span\" | \"div\";\n  /** Angle the stamp lands at, in degrees. */\n  rotate?: number;\n  /** Scale the stamp starts from before it slams down. */\n  from?: number;\n  /** \"load\" plays on first paint with CSS alone; \"in-view\" when the stamp scrolls into view. */\n  trigger?: EntranceTrigger;\n  /** In-view: play the first time only. */\n  once?: boolean;\n  /** Takes over from `trigger`: `false` holds the stamp up, `true` slams it down. */\n  play?: boolean;\n  /** Wait before the stamp falls, in ms. */\n  delay?: number;\n  /** How long the slam takes, in ms. */\n  duration?: number;\n  /** Called once the stamp has landed. */\n  onAnimationComplete?: () => void;\n}\n\n/**\n * A rubber stamp that slams onto the page: it starts large and transparent,\n * then lands rotated with a small overshoot. The content stays readable for\n * screen readers, and the server HTML and `prefers-reduced-motion` show the\n * stamp already in place.\n *\n * @example\n * <Stamp className=\"border-primary text-primary rounded-md border-2 px-3 py-1 font-bold tracking-widest uppercase\">Sold out</Stamp>\n */\nfunction Stamp({\n  as: Tag = \"span\",\n  rotate = -8,\n  from = 1.6,\n  trigger = \"in-view\",\n  once = true,\n  play,\n  delay = 0,\n  duration = 320,\n  onAnimationComplete,\n  className,\n  style,\n  ref,\n  ...props\n}: StampProps) {\n  const [observe, phase] = useEntrance<HTMLElement>({ trigger, once, play });\n  const mergedRef = useMemo(() => mergeRefs(ref, observe), [ref, observe]);\n\n  const stampStyle = {\n    \"--stamp-rotate\": `${rotate}deg`,\n    \"--stamp-from\": `${from}`,\n    ...(phase === \"static\"\n      ? {}\n      : {\n          animationDuration: `${duration}ms`,\n          animationDelay: `${delay}ms`,\n          animationPlayState: phase === \"armed\" ? \"paused\" : undefined,\n        }),\n    ...style,\n  } as CSSProperties;\n\n  return (\n    <Tag\n      ref={mergedRef as Ref<never>}\n      data-slot=\"stamp\"\n      data-state={phase}\n      className={cn(\n        \"inline-block [transform:rotate(var(--stamp-rotate))]\",\n        phase !== \"static\" && \"motion-safe:animate-stamp\",\n        className\n      )}\n      style={stampStyle}\n      onAnimationEnd={(event) => {\n        if (event.target === event.currentTarget) onAnimationComplete?.();\n      }}\n      {...props}\n    />\n  );\n}\n\nexport { Stamp, type StampProps };\n",
      "type": "registry:ui"
    }
  ],
  "tailwind": {
    "config": {
      "theme": {
        "extend": {
          "keyframes": {
            "stamp": {
              "from": {
                "opacity": "0",
                "transform": "rotate(var(--stamp-rotate, -8deg)) scale(var(--stamp-from, 1.6))"
              },
              "70%": {
                "opacity": "1",
                "transform": "rotate(var(--stamp-rotate, -8deg)) scale(0.96)"
              },
              "to": {
                "opacity": "1",
                "transform": "rotate(var(--stamp-rotate, -8deg)) scale(1)"
              }
            }
          },
          "animation": {
            "stamp": "stamp 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both"
          }
        }
      }
    }
  },
  "cssVars": {
    "theme": {
      "animate-stamp": "stamp 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both"
    }
  },
  "css": {
    "@keyframes stamp": {
      "from": {
        "opacity": "0",
        "transform": "rotate(var(--stamp-rotate, -8deg)) scale(var(--stamp-from, 1.6))"
      },
      "70%": {
        "opacity": "1",
        "transform": "rotate(var(--stamp-rotate, -8deg)) scale(0.96)"
      },
      "to": {
        "opacity": "1",
        "transform": "rotate(var(--stamp-rotate, -8deg)) scale(1)"
      }
    }
  },
  "categories": [
    "motion"
  ],
  "type": "registry:ui"
}