{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "micro-status-mark",
  "type": "registry:component",
  "title": "Status Mark",
  "description": "A small status indicator whose outline morphs between a circle, a triangle and a rounded square as it changes between idle, loading, success, warning and error.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "micro",
    "status",
    "indicator",
    "morph",
    "loading",
    "svg",
    "state"
  ],
  "docs": "https://hyperblur.dev/effects/micro-status-mark",
  "files": [
    {
      "path": "registry/hyperblur/micro-status-mark.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/micro-status-mark.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport type MicroStatus = \"idle\" | \"loading\" | \"success\" | \"warning\" | \"error\";\n\nexport interface MicroStatusMarkProps\n  extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"color\"> {\n  status?: MicroStatus;\n  size?: number;\n  label?: string;\n  labels?: Partial<Record<MicroStatus, string>>;\n  showLabel?: boolean;\n  colors?: Partial<Record<MicroStatus, string>>;\n  duration?: number;\n}\n\nconst defaultColors: Record<MicroStatus, string> = {\n  idle: \"#8f8f8f\",\n  loading: \"#2f7bff\",\n  success: \"#34d27b\",\n  warning: \"#f5b83d\",\n  error: \"#ff5468\",\n};\n\nconst defaultLabels: Record<MicroStatus, string> = {\n  idle: \"Idle\",\n  loading: \"Loading\",\n  success: \"Success\",\n  warning: \"Warning\",\n  error: \"Error\",\n};\n\nconst css = `\n.hb-qr7 {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  box-sizing: border-box;\n  font-family: inherit;\n  font-size: 13px;\n  line-height: 1;\n  color: var(--hb-qr7-c);\n  transition: color 0.35s ease;\n}\n.hb-qr7-s {\n  flex: none;\n  display: block;\n  overflow: visible;\n}\n.hb-qr7-g {\n  transform-box: view-box;\n  transform-origin: 50% 50%;\n}\n.hb-qr7[data-status=\"loading\"] .hb-qr7-g { animation: hb-qr7-spin 0.9s linear infinite; }\n.hb-qr7-p {\n  fill: color-mix(in srgb, currentColor 14%, transparent);\n  stroke: currentColor;\n  stroke-width: 1.75;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n  stroke-dasharray: 100 0;\n  transition: fill 0.35s ease, stroke-dasharray 0.45s cubic-bezier(0.4, 0, 0.2, 1);\n}\n.hb-qr7[data-status=\"loading\"] .hb-qr7-p {\n  fill: transparent;\n  stroke-dasharray: 28 72;\n}\n.hb-qr7-i,\n.hb-qr7-k,\n.hb-qr7-w,\n.hb-qr7-e {\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 1.9;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n  opacity: 0;\n  transform-box: fill-box;\n  transform-origin: 50% 50%;\n  transform: scale(0.4);\n  transition: opacity 0.18s ease, transform 0.18s ease;\n}\n.hb-qr7-i { fill: currentColor; stroke: none; }\n.hb-qr7-w circle { fill: currentColor; stroke: none; }\n.hb-qr7-k { stroke-dasharray: 1; stroke-dashoffset: 1; }\n.hb-qr7[data-status=\"idle\"] .hb-qr7-i,\n.hb-qr7[data-status=\"success\"] .hb-qr7-k,\n.hb-qr7[data-status=\"warning\"] .hb-qr7-w,\n.hb-qr7[data-status=\"error\"] .hb-qr7-e {\n  opacity: 1;\n  transform: scale(1);\n  transition: opacity 0.2s ease 0.12s, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.12s, stroke-dashoffset 0.32s ease 0.22s;\n}\n.hb-qr7[data-status=\"success\"] .hb-qr7-k { stroke-dashoffset: 0; }\n.hb-qr7-l {\n  color: #d4d4d4;\n  white-space: nowrap;\n}\n@keyframes hb-qr7-spin {\n  to { transform: rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qr7,\n  .hb-qr7-p,\n  .hb-qr7-i,\n  .hb-qr7-k,\n  .hb-qr7-w,\n  .hb-qr7-e { transition: none !important; }\n  .hb-qr7[data-status=\"loading\"] .hb-qr7-g { animation: none; }\n}\n`;\n\ntype Shape = number[];\n\nfunction line(ax: number, ay: number, bx: number, by: number): number[] {\n  return [\n    ax + (bx - ax) / 3,\n    ay + (by - ay) / 3,\n    ax + ((bx - ax) * 2) / 3,\n    ay + ((by - ay) * 2) / 3,\n    bx,\n    by,\n  ];\n}\n\nfunction blob(k: number): Shape {\n  return [\n    12, 3,\n    12 + k, 3, 21, 12 - k, 21, 12,\n    21, 12 + k, 12 + k, 21, 12, 21,\n    12 - k, 21, 3, 12 + k, 3, 12,\n    3, 12 - k, 12 - k, 3, 12, 3,\n  ];\n}\n\nconst circle = blob(4.97);\nconst squircle = blob(7.6);\nconst triangle: Shape = [\n  12, 3.5,\n  ...line(12, 3.5, 21, 19.5),\n  ...line(21, 19.5, 12, 19.5),\n  ...line(12, 19.5, 3, 19.5),\n  ...line(3, 19.5, 12, 3.5),\n];\n\nfunction shapeFor(status: MicroStatus): Shape {\n  if (status === \"warning\") return triangle;\n  if (status === \"error\") return squircle;\n  return circle;\n}\n\nfunction toPath(n: Shape) {\n  const f = (v: number) => v.toFixed(2);\n  let d = `M${f(n[0])} ${f(n[1])}`;\n  for (let s = 0; s < 4; s += 1) {\n    const o = 2 + s * 6;\n    d += `C${f(n[o])} ${f(n[o + 1])} ${f(n[o + 2])} ${f(n[o + 3])} ${f(n[o + 4])} ${f(n[o + 5])}`;\n  }\n  return `${d}Z`;\n}\n\nfunction easeOutBack(t: number) {\n  const c1 = 1.3;\n  const c3 = c1 + 1;\n  return 1 + c3 * Math.pow(t - 1, 3) + c1 * Math.pow(t - 1, 2);\n}\n\nexport function MicroStatusMark({\n  status = \"idle\",\n  size = 28,\n  label,\n  labels,\n  showLabel = false,\n  colors,\n  duration = 480,\n  className = \"\",\n  style,\n  ...rest\n}: MicroStatusMarkProps) {\n  const pathRef = React.useRef<SVGPathElement>(null);\n  const shape = React.useRef<Shape>(shapeFor(status));\n  const text = label ?? labels?.[status] ?? defaultLabels[status];\n  const color = colors?.[status] ?? defaultColors[status];\n\n  React.useEffect(() => {\n    const path = pathRef.current;\n    if (!path) return;\n    const target = shapeFor(status);\n    const from = shape.current;\n    const reduced = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    if (reduced || duration <= 0 || from === target) {\n      shape.current = target;\n      path.setAttribute(\"d\", toPath(target));\n      return;\n    }\n    let raf = 0;\n    let begin = 0;\n    const step = (ts: number) => {\n      if (!begin) begin = ts;\n      const p = Math.min(1, (ts - begin) / duration);\n      const e = easeOutBack(p);\n      const next = target.map((v, i) => from[i] + (v - from[i]) * e);\n      shape.current = p < 1 ? next : target;\n      path.setAttribute(\"d\", toPath(shape.current));\n      if (p < 1) raf = requestAnimationFrame(step);\n    };\n    raf = requestAnimationFrame(step);\n    return () => cancelAnimationFrame(raf);\n  }, [status, duration]);\n\n  return (\n    <span\n      role=\"status\"\n      aria-label={showLabel ? undefined : text}\n      data-status={status}\n      className={`hb-qr7 ${className}`.trim()}\n      style={{ [\"--hb-qr7-c\" as string]: color, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-micro-status-mark\" precedence=\"default\">\n        {css}\n      </style>\n      <svg className=\"hb-qr7-s\" viewBox=\"0 0 24 24\" width={size} height={size} aria-hidden=\"true\">\n        <g className=\"hb-qr7-g\">\n          <path ref={pathRef} className=\"hb-qr7-p\" d={toPath(shapeFor(status))} pathLength={100} />\n        </g>\n        <circle className=\"hb-qr7-i\" cx=\"12\" cy=\"12\" r=\"2.3\" />\n        <path className=\"hb-qr7-k\" d=\"M7.8 12.4 10.9 15.5 16.4 9\" pathLength={1} />\n        <g className=\"hb-qr7-w\">\n          <path d=\"M12 9.4v4.2\" />\n          <circle cx=\"12\" cy=\"16.5\" r=\"1\" />\n        </g>\n        <g className=\"hb-qr7-e\">\n          <path d=\"M8.9 8.9 15.1 15.1M15.1 8.9 8.9 15.1\" />\n        </g>\n      </svg>\n      {showLabel ? <span className=\"hb-qr7-l\">{text}</span> : null}\n    </span>\n  );\n}\n"
    }
  ]
}