{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "empty-state-survey",
  "title": "Empty State Survey",
  "description": "First-run empty state as a surveyor's staked plot: corner stakes drop in, then dashed strings tauten around the future layout and tie off at the CTA.",
  "dependencies": [],
  "files": [
    {
      "path": "registry/core/empty-state-survey/component.tsx",
      "content": "\"use client\";\n\nimport {\n  useCallback,\n  useEffect,\n  useId,\n  useLayoutEffect,\n  useRef,\n  useState,\n  type CSSProperties,\n} from \"react\";\n\n// Empty state as a surveyor's staked plot, not a loading skeleton. A hidden\n// template (visibility:hidden, so it occupies real layout space but paints\n// nothing) is sized exactly like the content that will eventually live here —\n// table rows, a card grid, or a chart area — and measured via\n// getBoundingClientRect. An SVG overlay uses those real coordinates to drive\n// four corner stakes in one by one (translateY(-6px) + a back-eased spring\n// settle, 40ms stagger), then dashed \"string\" paths (4-3 dash, --border) draw\n// in via stroke-dashoffset on an ease-out-expo curve, outlining the plot's\n// real silhouette. The last string doesn't stop at the plot: it continues to\n// the CTA's top border and ties off in a small loop, so the one thing to do\n// is physically connected to the thing that's missing. Hovering or\n// keyboard-focusing the CTA nudges that connector's control point ~3px,\n// a gentle tug rather than a state change. The whole intro runs ~1.5s and the\n// component is fully static after — unlike a skeleton, which loops forever\n// because it's pretending data is imminent. Reduced motion renders every\n// stake and string already settled, no draw-in, and the connector snaps\n// instantly instead of easing on hover.\n//\n// The survey graphic (template + SVG) is aria-hidden decoration. The\n// accessible content is a plain heading, one sentence of body copy, and a\n// real button — the only focusable element in the region.\n\nexport type StakeLineShape =\n  /** A future data table: `rows` equal-height horizontal bands. */\n  | { kind: \"table\"; rows?: number }\n  /** A future card grid: `count` cells across `columns` columns. */\n  | { kind: \"cards\"; count?: number; columns?: number }\n  /** A future chart plot area, outlined with a simple L-axis. */\n  | { kind: \"chart\" };\n\nexport interface StakeLineProps {\n  /** Headline — what's missing. */\n  title?: string;\n  /** One sentence of supporting copy. */\n  description?: string;\n  /** Label of the single CTA the staked plot ties itself to. */\n  actionLabel?: string;\n  /** called when the CTA is pressed */\n  onAction?: () => void;\n  /** What the plot outlines. Defaults to a 3-column card grid of 6. */\n  shape?: StakeLineShape;\n  /** extra classes merged onto the rendered root element */\n  className?: string;\n}\n\ntype Rect = { x: number; y: number; w: number; h: number };\ntype Boxes = { outer: Rect; cells: Rect[]; cta: Rect };\n\nconst OUTER_RADIUS = 12;\nconst CELL_RADIUS = 6;\n\nfunction relRect(el: Element, rootBox: DOMRect): Rect {\n  const r = el.getBoundingClientRect();\n  return { x: r.left - rootBox.left, y: r.top - rootBox.top, w: r.width, h: r.height };\n}\n\nfunction roundedRectPath(x: number, y: number, w: number, h: number, radius: number): string {\n  const r = Math.max(0, Math.min(radius, w / 2, h / 2));\n  return `M${x + r},${y} H${x + w - r} A${r},${r} 0 0 1 ${x + w},${y + r} V${y + h - r} A${r},${r} 0 0 1 ${\n    x + w - r\n  },${y + h} H${x + r} A${r},${r} 0 0 1 ${x},${y + h - r} V${y + r} A${r},${r} 0 0 1 ${x + r},${y} Z`;\n}\n\nconst CSS = `\n@keyframes ns-stake-drop{from{opacity:0;transform:translateY(-6px) scale(.85)}to{opacity:1;transform:translateY(0) scale(1)}}\n@keyframes ns-stake-reveal{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}\n@keyframes ns-stake-loop-in{from{opacity:0;transform:scale(.4)}to{opacity:1;transform:scale(1)}}\n`;\n\nexport function StakeLine({\n  title = \"No projects yet\",\n  description = \"Projects show up here once you create one — the layout below is already staked out and waiting.\",\n  actionLabel = \"Create a project\",\n  onAction,\n  shape = { kind: \"cards\", count: 6, columns: 3 },\n  className = \"\",\n}: StakeLineProps) {\n  const uid = useId();\n  const rootRef = useRef<HTMLDivElement>(null);\n  const templateRef = useRef<HTMLDivElement>(null);\n  const ctaRef = useRef<HTMLButtonElement>(null);\n  const cellRefs = useRef<(HTMLDivElement | null)[]>([]);\n\n  const [boxes, setBoxes] = useState<Boxes | null>(null);\n  const [reduced, setReduced] = useState(false);\n  const [hovered, setHovered] = useState(false);\n  const [focused, setFocused] = useState(false);\n  const near = (hovered || focused) && !reduced;\n\n  useEffect(() => {\n    const mq = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    const onChange = () => setReduced(mq.matches);\n    onChange();\n    mq.addEventListener(\"change\", onChange);\n    return () => mq.removeEventListener(\"change\", onChange);\n  }, []);\n\n  const measure = useCallback(() => {\n    const root = rootRef.current;\n    const template = templateRef.current;\n    const cta = ctaRef.current;\n    if (!root || !template || !cta) return;\n    const rootBox = root.getBoundingClientRect();\n    if (!rootBox.width || !rootBox.height) return;\n    const outer = relRect(template, rootBox);\n    const cells = cellRefs.current\n      .filter((el): el is HTMLDivElement => !!el)\n      .map((el) => relRect(el, rootBox));\n    setBoxes({ outer, cells, cta: relRect(cta, rootBox) });\n  }, []);\n\n  // shape drives how many cell refs exist, so a shape change needs a remeasure\n  useLayoutEffect(() => {\n    measure();\n    const root = rootRef.current;\n    if (!root) return;\n    const ro = new ResizeObserver(() => measure());\n    ro.observe(root);\n    return () => ro.disconnect();\n  }, [measure, shape]);\n\n  // --- geometry derived from the measured boxes -----------------------------\n  const silhouetteMaskId = `ns-stake-sil-${uid}`;\n  const connectorMaskId = `ns-stake-con-${uid}`;\n\n  let silhouetteD = \"\";\n  let corners: { x: number; y: number; dx: number; dy: number }[] = [];\n  let restD = \"\";\n  let tugD = \"\";\n  let loopD = \"\";\n\n  if (boxes) {\n    const { outer, cells, cta } = boxes;\n    silhouetteD = roundedRectPath(outer.x, outer.y, outer.w, outer.h, OUTER_RADIUS);\n\n    for (const cell of cells) {\n      silhouetteD += ` ${roundedRectPath(cell.x, cell.y, cell.w, cell.h, CELL_RADIUS)}`;\n    }\n\n    if (shape.kind === \"chart\" && outer.w > 24 && outer.h > 24) {\n      const inset = 12;\n      const axisD = `M${outer.x + inset},${outer.y + inset} V${outer.y + outer.h - inset} H${\n        outer.x + outer.w - inset\n      }`;\n      silhouetteD += ` ${axisD}`;\n    }\n\n    corners = [\n      { x: outer.x, y: outer.y, dx: -5, dy: -5 },\n      { x: outer.x + outer.w, y: outer.y, dx: 5, dy: -5 },\n      { x: outer.x, y: outer.y + outer.h, dx: -5, dy: 5 },\n      { x: outer.x + outer.w, y: outer.y + outer.h, dx: 5, dy: 5 },\n    ];\n\n    const start = { x: outer.x + outer.w / 2, y: outer.y + outer.h };\n    const end = { x: cta.x + cta.w / 2, y: cta.y };\n    const mid = { x: (start.x + end.x) / 2, y: (start.y + end.y) / 2 };\n    restD = `M${start.x},${start.y} Q${mid.x},${mid.y} ${end.x},${end.y}`;\n    // the \"tug\": nudge the control point sideways, not along the line, so\n    // hover reads as a pluck rather than a no-op collinear shift\n    tugD = `M${start.x},${start.y} Q${mid.x + 3},${mid.y} ${end.x},${end.y}`;\n    loopD = `M${end.x - 4},${end.y} a4,3 0 1,0 8,0 a4,3 0 1,0 -8,0`;\n  }\n\n  return (\n    <div ref={rootRef} className={[\"relative\", className].join(\" \")}>\n      <style>{CSS}</style>\n\n      {/* Hidden template — never painted, only measured. Establishes the real\n          size and position of the content that doesn't exist yet. */}\n      {shape.kind === \"table\" && (\n        <div\n          ref={templateRef}\n          aria-hidden\n          style={{ visibility: \"hidden\" }}\n          className=\"flex w-full flex-col overflow-hidden rounded-md border border-border\"\n        >\n          {Array.from({ length: Math.max(1, shape.rows ?? 5) }, (_, i) => (\n            <div\n              key={i}\n              ref={(el) => {\n                cellRefs.current[i] = el;\n              }}\n              className=\"h-10 w-full border-b border-border last:border-b-0\"\n            />\n          ))}\n        </div>\n      )}\n\n      {shape.kind === \"cards\" && (\n        <div\n          ref={templateRef}\n          aria-hidden\n          style={{\n            visibility: \"hidden\",\n            display: \"grid\",\n            gridTemplateColumns: `repeat(${Math.max(1, shape.columns ?? 3)}, 1fr)`,\n            gap: 12,\n          }}\n          className=\"w-full\"\n        >\n          {Array.from({ length: Math.max(1, shape.count ?? 6) }, (_, i) => (\n            <div\n              key={i}\n              ref={(el) => {\n                cellRefs.current[i] = el;\n              }}\n              className=\"aspect-[4/3] rounded-md border border-border\"\n            />\n          ))}\n        </div>\n      )}\n\n      {shape.kind === \"chart\" && (\n        <div\n          ref={templateRef}\n          aria-hidden\n          style={{ visibility: \"hidden\" }}\n          className=\"h-44 w-full rounded-md border border-border\"\n        />\n      )}\n\n      <svg aria-hidden className=\"pointer-events-none absolute inset-0 h-full w-full overflow-visible\">\n        {boxes && (\n          <>\n            <defs>\n              <mask id={silhouetteMaskId} maskUnits=\"userSpaceOnUse\">\n                <path\n                  d={silhouetteD}\n                  pathLength={1}\n                  stroke=\"#fff\"\n                  strokeWidth={10}\n                  strokeLinecap=\"round\"\n                  fill=\"none\"\n                  strokeDasharray={reduced ? undefined : 1}\n                  style={\n                    reduced\n                      ? undefined\n                      : { animation: \"ns-stake-reveal 650ms cubic-bezier(.16,1,.3,1) 520ms both\" }\n                  }\n                />\n              </mask>\n              <mask id={connectorMaskId} maskUnits=\"userSpaceOnUse\">\n                <path\n                  d={restD}\n                  pathLength={1}\n                  stroke=\"#fff\"\n                  strokeWidth={10}\n                  strokeLinecap=\"round\"\n                  fill=\"none\"\n                  strokeDasharray={reduced ? undefined : 1}\n                  style={\n                    reduced\n                      ? undefined\n                      : { animation: \"ns-stake-reveal 220ms cubic-bezier(.16,1,.3,1) 1180ms both\" }\n                  }\n                />\n              </mask>\n            </defs>\n\n            {/* the plot's real silhouette: outer boundary + each future row/card */}\n            <path\n              d={silhouetteD}\n              stroke=\"var(--border)\"\n              strokeWidth={1.5}\n              strokeDasharray=\"4 3\"\n              strokeLinecap=\"round\"\n              fill=\"none\"\n              vectorEffect=\"non-scaling-stroke\"\n              mask={`url(#${silhouetteMaskId})`}\n            />\n\n            {/* four corner stakes, driven in one by one. Positioning lives on\n                the wrapping <g>'s SVG `transform` attribute; the drop-in\n                animates a plain CSS `transform` on the inner <path> only —\n                putting both on the same element would have the animated CSS\n                transform silently replace the attribute's translate instead\n                of composing with it, collapsing all four stakes onto (0,0). */}\n            {corners.map((c, i) => (\n              <g key={i} transform={`translate(${c.x + c.dx}, ${c.y + c.dy})`}>\n                <path\n                  d=\"M0,3 L0,-8 M-3,-8 L3,-8\"\n                  stroke=\"var(--ns-muted)\"\n                  strokeWidth={1.5}\n                  strokeLinecap=\"round\"\n                  fill=\"none\"\n                  style={\n                    reduced\n                      ? undefined\n                      : ({\n                          transformBox: \"fill-box\",\n                          transformOrigin: \"center\",\n                          opacity: 0,\n                          animation: `ns-stake-drop 340ms cubic-bezier(.34,1.56,.64,1) ${i * 40}ms both`,\n                        } as CSSProperties)\n                  }\n                />\n              </g>\n            ))}\n\n            {/* the string tying the missing content to the one thing to do */}\n            <path\n              stroke=\"var(--border)\"\n              strokeWidth={1.5}\n              strokeDasharray=\"4 3\"\n              strokeLinecap=\"round\"\n              fill=\"none\"\n              vectorEffect=\"non-scaling-stroke\"\n              mask={`url(#${connectorMaskId})`}\n              style={\n                {\n                  d: `path(\"${near ? tugD : restD}\")`,\n                  transition: reduced ? undefined : \"d 260ms cubic-bezier(.22,1,.36,1)\",\n                } as CSSProperties\n              }\n            />\n\n            {/* the cinch where the string ties off at the button */}\n            <path\n              d={loopD}\n              stroke=\"var(--border)\"\n              strokeWidth={1.5}\n              strokeLinecap=\"round\"\n              fill=\"none\"\n              style={\n                reduced\n                  ? undefined\n                  : ({\n                      opacity: 0,\n                      transformBox: \"fill-box\",\n                      transformOrigin: \"center\",\n                      animation: \"ns-stake-loop-in 150ms cubic-bezier(.34,1.56,.64,1) 1380ms both\",\n                    } as CSSProperties)\n              }\n            />\n          </>\n        )}\n      </svg>\n\n      <div className=\"relative z-10 mt-10 flex flex-col items-center px-6 pb-2 text-center\">\n        <h2 className=\"text-base font-semibold tracking-tight text-foreground\">{title}</h2>\n        <p className=\"mt-2 max-w-[38ch] text-sm leading-relaxed text-ns-muted\">{description}</p>\n        <button\n          ref={ctaRef}\n          type=\"button\"\n          onClick={onAction}\n          onPointerEnter={() => setHovered(true)}\n          onPointerLeave={() => setHovered(false)}\n          onFocus={() => setFocused(true)}\n          onBlur={() => setFocused(false)}\n          className={[\n            \"mt-6 inline-flex items-center justify-center rounded-sm bg-ns-accent px-4 py-2\",\n            \"text-sm font-medium text-white\",\n            \"transition-[background-color,transform,box-shadow] duration-200 ease-out\",\n            \"hover:-translate-y-px hover:bg-ns-accent-hover hover:shadow-[0_0_0_1px_var(--ns-accent)]\",\n            \"active:translate-y-0 active:bg-ns-accent-hover\",\n            \"focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ns-accent\",\n          ].join(\" \")}\n        >\n          {actionLabel}\n        </button>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "components/ui/empty-state-survey.tsx"
    }
  ],
  "cssVars": {
    "theme": {
      "color-ns-muted": "var(--ns-muted)",
      "color-ns-accent": "var(--ns-accent)",
      "color-ns-accent-hover": "var(--ns-accent-hover)"
    },
    "light": {
      "ns-muted": "#4d4d4d",
      "ns-accent": "#006bff",
      "ns-accent-hover": "#0059d1"
    },
    "dark": {
      "ns-muted": "#8f8f8f"
    }
  },
  "meta": {
    "collection": "core",
    "tags": [
      "empty-state",
      "onboarding",
      "first-run",
      "svg",
      "cta",
      "dashboard"
    ],
    "instruction": "An empty state for a list, board, or dashboard that has nothing in it yet, staged as a plot of land marked out and not yet built on: <StakeLine title description actionLabel onAction shape />. `shape` is one of `{ kind: 'table', rows? }`, `{ kind: 'cards', count?, columns? }` or `{ kind: 'chart' }` and describes the real silhouette of the content that will eventually live here. That silhouette is never guessed at — a template of the real layout (rows stacked full-width, or a CSS grid of card cells, or a plain plot box) is rendered with `visibility:hidden` so it occupies genuine layout space without painting anything, then measured with getBoundingClientRect (and re-measured on resize via a ResizeObserver) so the SVG overlay drawn on top always matches the actual slots, not a fixed illustration. On mount, four short SVG tick marks land at the plot's outer corners one by one (40ms stagger, translateY(-6px) into a back-eased spring settle, stroke in --ns-muted) — literal surveyor's stakes. Once they've settled, dashed string paths (a static 4-3 dash pattern in --border) draw themselves in via stroke-dashoffset on an ease-out-expo curve, outlining the plot's outer boundary plus every future row or card individually, so the emptiness reads as 'planned', not 'loading'. The last string doesn't stop at the plot: it continues down and terminates at the CTA's top border, closing in a small tied-off loop, so the one thing to do is physically wired to the thing that's missing rather than just sitting nearby. Hovering or keyboard-focusing the CTA nudges that connector's control point ~3px sideways — a gentle tug on the string, not a state change — via a CSS `d` transition, and releases back on blur/leave. The whole intro runs about 1.5 seconds; after that every stake and string is inert and the component does nothing until the CTA is used. Unlike skeleton-develop (and every other skeleton loader), which imitates content that is imminently arriving with grey placeholder blocks and offers no action, empty-state-survey is explicitly provisional — surveyor's marks mean 'planned', not 'loading' — and it always ships exactly one CTA that the layout points to, never a silent promise of data. The survey graphic (template + SVG overlay) is entirely `aria-hidden`; the accessible content is an ordinary heading, one sentence of body copy, and a real `<button>`, the only focusable element in the region. Colors are strictly --background, --foreground, --ns-muted, --border and --ns-accent (via the button's existing token classes) — no hex, no canvas, DOM+SVG+CSS only. `prefers-reduced-motion` renders every stake and string already in its settled, fully-drawn state with no draw-in, and the hover tug snaps instead of easing."
  },
  "type": "registry:ui"
}