{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"stamp","type":"registry:ui","title":"Result mark","description":"SunUI's result mark (exported as Result; Stamp is the old name of the same component): placed where the result happened, a small disc in the brand spot colour with a top highlight and a check that draws in and settles once on a spring, or muted text for negative results such as ended, expired or sold out. The shape picks what extra detail it carries (date adds a date, seal adds a second line) rather than how it looks. Appears instantly under reduced motion. The registry name stays stamp so existing installs keep working.","dependencies":["framer-motion"],"registryDependencies":["utils"],"categories":["status","feedback","commerce"],"meta":{"tier":"free","interaction":"press","addedAt":"2026-11-05","usage":{"whenToUse":["Showing the result of a shopper action: claimed, paid, won, sold out, ended","Building your own block that needs a SunUI style result mark without copying code"],"watchOut":["Place it in the layout where the action was (for example where the button stood), never on top of other content","Do not use it for labels that are not results, such as Recommended or Popular","One result line per card; do not repeat the same status on every item of a list when the list already says it"],"aliases":["status label","result label","claimed label","paid label","success checkmark","result badge","stamp","status stamp"]},"catalog":"basic"},"files":[{"path":"registry/free/stamp/stamp.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { motion, useReducedMotion } from \"framer-motion\";\nimport type { CSSProperties, ReactNode } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n/**\n * SunUI's result marker, Result: place it where the action happened (where the button was, in a status bar, next to a step), not over the content.\n * Positive result: a small disc in the brand accent colour with a top-edge highlight, the check drawn as a stroke, and the disc settling once with the pop spring.\n * Expired, ended, did not win: faded text with no icon.\n * shape decides what extra information comes with it, not the look:\n * - tick, box: text only (Copied, Claimed, Sold out)\n * - date: text plus a date (Paid 2026.11.06)\n * - seal: text plus a second line (Winner, tier name)\n * - chop: text (Invited, member name)\n * Do not use it for labels that are not results (Recommended, Popular).\n *\n * Since 2026-11-19 the primary name is Result; Stamp is the old name, the same component, so existing installs keep working.\n * The file name and registry name stay stamp, so the install command is unchanged.\n */\nexport type ResultShape = \"tick\" | \"box\" | \"seal\" | \"date\" | \"chop\";\n/** positive: positive result; muted: expired, ended, did not win. vermilion and ink are old names, equal to positive and muted respectively */\nexport type ResultTone = \"positive\" | \"muted\" | \"vermilion\" | \"ink\";\nexport type ResultSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface ResultProps {\n  children?: ReactNode;\n  shape?: ResultShape;\n  /** Defaults to positive */\n  tone?: ResultTone;\n  size?: ResultSize;\n  /** No longer affects the look; kept for compatibility with old code */\n  seed?: string | number;\n  /** Date shown by date; also usable as the second line of seal when there is no sub */\n  date?: Date | string | number;\n  /** Second line of seal, e.g. a tier name */\n  sub?: ReactNode;\n  /** No longer affects the look; kept for compatibility with old code */\n  filled?: boolean;\n  /** Adds a strikethrough to mark it void */\n  void?: boolean;\n  /** When false, show immediately without the settle animation (e.g. the claimed state after a refresh) */\n  appear?: boolean;\n  delay?: number;\n  className?: string;\n  style?: CSSProperties;\n}\n\n// Same as pop in sunui-motion: the rebound of a small element settling once\nconst pop = { type: \"spring\", stiffness: 620, damping: 20, mass: 0.8 } as const;\n\nconst TEXT: Record<ResultSize, string> = { sm: \"text-xs\", md: \"text-sm\", lg: \"text-base\" };\nconst DISC: Record<ResultSize, string> = { sm: \"size-4\", md: \"size-[18px]\", lg: \"size-5\" };\nconst ICON: Record<ResultSize, string> = { sm: \"size-2.5\", md: \"size-3\", lg: \"size-3.5\" };\n\nfunction formatDate(value: Date | string | number) {\n  const d = new Date(value);\n  if (Number.isNaN(d.getTime())) return \"\";\n  const p = (n: number) => String(n).padStart(2, \"0\");\n  return `${d.getFullYear()}.${p(d.getMonth() + 1)}.${p(d.getDate())}`;\n}\n\nexport function Result({\n  children,\n  shape = \"box\",\n  tone = \"positive\",\n  size = \"md\",\n  date,\n  sub,\n  void: voided = false,\n  appear = true,\n  delay = 0,\n  className,\n  style,\n}: ResultProps) {\n  const reduce = useReducedMotion() ?? false;\n  const positive = tone === \"positive\" || tone === \"vermilion\";\n  const animate = !reduce && appear;\n  const second = shape === \"seal\" ? (sub ?? (date !== undefined ? formatDate(date) : null)) : shape === \"date\" && date !== undefined ? formatDate(date) : null;\n\n  return (\n    <motion.span\n      aria-hidden=\"true\"\n      initial={animate ? { opacity: 0 } : false}\n      animate={{ opacity: 1 }}\n      exit={{ opacity: 0, transition: { duration: reduce ? 0 : 0.12 } }}\n      transition={animate ? { duration: 0.15, ease: \"easeOut\", delay } : { duration: 0 }}\n      style={style}\n      className={cn(\n        \"pointer-events-none inline-flex items-center gap-1.5 leading-tight font-medium whitespace-nowrap\",\n        TEXT[size],\n        positive ? \"text-foreground\" : \"text-muted-foreground\",\n        className,\n      )}\n    >\n      {positive && (\n        <motion.span\n          initial={animate ? { scale: 0.6 } : false}\n          animate={{ scale: 1 }}\n          transition={animate ? { ...pop, delay } : { duration: 0 }}\n          className={cn(\n            \"grid shrink-0 place-items-center rounded-full\",\n            \"bg-[color:var(--sunui-spot,var(--primary))] text-[color:var(--sunui-spot-foreground,var(--primary-foreground))]\",\n            \"shadow-[inset_0_1px_0_rgb(255_255_255/0.22),0_1px_2px_rgb(0_0_0/0.12)]\",\n            DISC[size],\n          )}\n        >\n          <svg viewBox=\"0 0 24 24\" className={ICON[size]} fill=\"none\" stroke=\"currentColor\" strokeWidth={3} strokeLinecap=\"round\" strokeLinejoin=\"round\">\n            <motion.path\n              d=\"M5 12.5l4.5 4.5L19 7.5\"\n              initial={animate ? { pathLength: 0 } : false}\n              animate={{ pathLength: 1 }}\n              transition={animate ? { duration: 0.22, ease: [0.23, 1, 0.32, 1], delay: delay + 0.06 } : { duration: 0 }}\n            />\n          </svg>\n        </motion.span>\n      )}\n      <span className={cn(voided && \"line-through decoration-1\")}>{children}</span>\n      {second && <span className=\"font-mono font-normal text-muted-foreground tabular-nums\">{second}</span>}\n    </motion.span>\n  );\n}\n\n/** Old name, equal to Result */\nexport const Stamp = Result;\nexport type StampShape = ResultShape;\nexport type StampTone = ResultTone;\nexport type StampSize = ResultSize;\nexport type StampProps = ResultProps;\n"}]}