{
  "schemaVersion": 1,
  "target": "react",
  "name": "dot-loader",
  "version": "0.1.0",
  "category": "ai-elements",
  "title": "Dot Loader",
  "description": "A tiny 3x3 or 4x4 dot grid for agent thinking states, with scan, wave, orbit, pulse and scatter patterns, an optional shimmering label and elapsed timer, and dots that gather into a check or an x when the work ends.",
  "tags": [
    "ai",
    "agent",
    "loader",
    "loading",
    "thinking",
    "status",
    "spinner",
    "timer"
  ],
  "requires": {
    "projectTypes": [
      "next",
      "vite-react"
    ],
    "styling": "tailwind-v4"
  },
  "npmDependencies": {},
  "registryDependencies": [],
  "docsPath": "/components/dot-loader",
  "props": [
    {
      "name": "pattern",
      "type": "\"scan\" | \"wave\" | \"orbit\" | \"pulse\" | \"scatter\"",
      "default": "\"wave\"",
      "description": "How light travels across the grid while running."
    },
    {
      "name": "grid",
      "type": "3 | 4",
      "default": "3",
      "description": "Dots per side."
    },
    {
      "name": "size",
      "type": "\"xs\" | \"sm\" | \"md\" | \"lg\"",
      "default": "\"sm\"",
      "description": "12, 16, 24 or 40px. DotGrid also takes a number of pixels."
    },
    {
      "name": "status",
      "type": "\"idle\" | \"running\" | \"done\" | \"failed\"",
      "default": "\"running\"",
      "description": "Running animates; done and failed gather the dots into a check or an x; idle holds them dim."
    },
    {
      "name": "label",
      "type": "ReactNode",
      "description": "Visible text beside the grid. Also the screen reader status."
    },
    {
      "name": "doneLabel / failedLabel",
      "type": "ReactNode",
      "default": "label",
      "description": "Text shown once the status is done or failed."
    },
    {
      "name": "shimmer",
      "type": "boolean",
      "default": "false",
      "description": "A slow highlight travels across the label while running."
    },
    {
      "name": "timer",
      "type": "boolean",
      "default": "false",
      "description": "Shows the elapsed time in mono after the label; it stops when the status leaves running."
    },
    {
      "name": "startedAt / endedAt",
      "type": "number | Date",
      "default": "mount time / when running stops",
      "description": "When the work started and ended."
    },
    {
      "name": "ariaLabel",
      "type": "string",
      "description": "Screen reader text when there is no visible label."
    },
    {
      "name": "DotGrid tone",
      "type": "\"status\" | \"inherit\"",
      "default": "\"status\"",
      "description": "DotGrid: color the dots by status, or use the current text color."
    },
    {
      "name": "formatElapsed",
      "type": "(ms) => string",
      "description": "The timer format on its own: 4.2s, 2m 05s, 1h 02m."
    }
  ],
  "accessibility": [
    "DotLoader is a polite status region (role=\"status\"); its label, or ariaLabel, is announced when the status changes. The elapsed timer is aria-hidden so it is not read every tick.",
    "The dot grid is decorative (aria-hidden); state is always carried by text.",
    "Under reduced motion the grid holds one still pose, the label shimmer is off, and the check or x appears without the dots travelling. The timer keeps counting.",
    "The animation pauses while the loader is off screen or the tab is hidden."
  ],
  "states": [
    "idle",
    "running",
    "done",
    "failed"
  ],
  "files": [
    {
      "path": "agent/dot-loader.tsx",
      "content": "\"use client\";\n\nimport { type ComponentProps, type ReactNode, useEffect, useMemo, useRef, useState } from \"react\";\n\n/*\n * Dot loader: a tiny grid of dots (3x3 or 4x4) where light travels in a pattern while an\n * agent works. When the work finishes, the same dots glide into a check (or an x on failure),\n * so the loader resolves into its result instead of being swapped for an icon.\n *\n * Brightness is computed per dot from one clock and written straight to the DOM; all loaders\n * share one requestAnimationFrame loop, and a loader only animates while it is on screen, the\n * tab is visible, and motion is allowed. Under reduced motion the grid holds one still pose and\n * the result appears without travel.\n */\n\nexport type DotLoaderPattern = \"scan\" | \"wave\" | \"orbit\" | \"pulse\" | \"scatter\";\nexport type DotLoaderStatus = \"idle\" | \"running\" | \"done\" | \"failed\";\nexport type DotLoaderSize = \"xs\" | \"sm\" | \"md\" | \"lg\";\n\nexport const dotLoaderPatterns: DotLoaderPattern[] = [\"scan\", \"wave\", \"orbit\", \"pulse\", \"scatter\"];\n\nfunction cx(...classes: (string | false | null | undefined)[]) {\n  return classes.filter(Boolean).join(\" \");\n}\n\nconst pixelSizes: Record<DotLoaderSize, number> = { xs: 12, sm: 16, md: 24, lg: 40 };\nconst textSizes: Record<DotLoaderSize, string> = { xs: \"text-xs\", sm: \"text-sm\", md: \"text-sm\", lg: \"text-[15px]\" };\nconst gaps: Record<DotLoaderSize, string> = { xs: \"gap-1.5\", sm: \"gap-2\", md: \"gap-2.5\", lg: \"gap-3\" };\n\nconst statusColor: Record<DotLoaderStatus, string> = {\n  idle: \"text-zinc-500\",\n  running: \"text-zinc-950 dark:text-white\",\n  done: \"text-emerald-600 dark:text-emerald-400\",\n  failed: \"text-red-600 dark:text-red-400\",\n};\n\n// ---------------------------------------------------------------------------\n// Geometry. Everything is drawn in a 16 x 16 box and scaled by the SVG.\n\nconst BOX = 16;\nconst DIM = 0.16;\n\ntype Dot = { x: number; y: number; col: number; row: number };\n\nfunction gridDots(n: number): Dot[] {\n  const cell = BOX / n;\n  const dots: Dot[] = [];\n  for (let row = 0; row < n; row++) {\n    for (let col = 0; col < n; col++) dots.push({ x: (col + 0.5) * cell, y: (row + 0.5) * cell, col, row });\n  }\n  return dots;\n}\n\ntype Pt = [number, number];\n\n/** Evenly spaced points along a polyline, endpoints included. */\nfunction along(path: Pt[], count: number): Pt[] {\n  const lengths = path.slice(1).map((p, i) => Math.hypot(p[0] - path[i]![0], p[1] - path[i]![1]));\n  const total = lengths.reduce((a, b) => a + b, 0);\n  const out: Pt[] = [];\n  for (let k = 0; k < count; k++) {\n    let d = count === 1 ? total / 2 : (total * k) / (count - 1);\n    let s = 0;\n    while (s < lengths.length - 1 && d > lengths[s]!) d -= lengths[s++]!;\n    const a = path[s]!;\n    const b = path[s + 1]!;\n    const f = lengths[s] ? Math.min(1, d / lengths[s]!) : 0;\n    out.push([a[0] + (b[0] - a[0]) * f, a[1] + (b[1] - a[1]) * f]);\n  }\n  return out;\n}\n\nconst checkPath: Pt[] = [\n  [3.25, 8.6],\n  [6.6, 11.9],\n  [12.75, 4.4],\n];\n\nfunction crossPoints(count: number): Pt[] {\n  const a = Math.ceil(count / 2);\n  const b = count - a;\n  // Fewer dots make a smaller x, so its beads still touch.\n  const lo = count < 12 ? 5 : 4.25;\n  const hi = BOX - lo;\n  const first = along([[lo, lo], [hi, hi]], a);\n  // The second arm skips the exact center when the first one already holds it.\n  let second = along([[hi, lo], [lo, hi]], b + (a % 2));\n  if (a % 2) second = second.filter((_, i) => i !== Math.floor(second.length / 2));\n  return [...first, ...second];\n}\n\n/** Assigns each target point the nearest free dot, so the dots take short, uncrossed paths. */\nfunction assign(dots: Dot[], targets: Pt[]): Pt[] {\n  const free = new Set(dots.map((_, i) => i));\n  const result: Pt[] = dots.map((d) => [d.x, d.y]);\n  for (const target of targets) {\n    let best = -1;\n    let bestD = Infinity;\n    for (const i of free) {\n      const d = Math.hypot(dots[i]!.x - target[0], dots[i]!.y - target[1]);\n      if (d < bestD) {\n        bestD = d;\n        best = i;\n      }\n    }\n    if (best < 0) break;\n    free.delete(best);\n    result[best] = target;\n  }\n  return result;\n}\n\n// ---------------------------------------------------------------------------\n// Patterns. Each dot gets a phase in [0, 1); light passes a dot when the cycle reaches it,\n// with a quick rise and an exponential tail.\n\ntype PatternSpec = {\n  /** Seconds per cycle. */\n  cycle: number;\n  /** How fast the tail fades; higher is a shorter tail. */\n  decay: number;\n  /** Discrete steps per cycle (0 = continuous). */\n  steps: number;\n  /** Cycle position used as the still pose under reduced motion. */\n  still: number;\n  phase: (dot: Dot, n: number, index: number) => number;\n};\n\nfunction ringIndex(dot: Dot, n: number): number {\n  const last = n - 1;\n  const { col, row } = dot;\n  if (row !== 0 && row !== last && col !== 0 && col !== last) return -1;\n  if (row === 0) return col;\n  if (col === last) return last + row;\n  if (row === last) return 2 * last + (last - col);\n  return 3 * last + (last - row);\n}\n\n// A fixed shuffle, so \"scatter\" looks random but is identical on every render and server.\nconst scatterOrder = [5, 12, 2, 9, 14, 0, 7, 11, 3, 15, 6, 1, 10, 13, 4, 8];\n\nconst patterns: Record<DotLoaderPattern, PatternSpec> = {\n  scan: { cycle: 1.6, decay: 9, steps: 0, still: 0.3, phase: (d, n) => (d.col / Math.max(1, n - 1)) * 0.42 },\n  wave: { cycle: 1.5, decay: 7, steps: 0, still: 0.32, phase: (d, n) => ((d.col + d.row) / Math.max(1, 2 * (n - 1))) * 0.5 },\n  orbit: {\n    cycle: 1.2,\n    decay: 3.6,\n    steps: 0,\n    still: 0.4,\n    phase: (d, n) => {\n      const k = ringIndex(d, n);\n      return k < 0 ? -1 : k / (4 * (n - 1));\n    },\n  },\n  pulse: {\n    cycle: 1.8,\n    decay: 8,\n    steps: 0,\n    still: 0.2,\n    phase: (d) => (Math.hypot(d.x - BOX / 2, d.y - BOX / 2) / Math.hypot(BOX / 2, BOX / 2)) * 0.45,\n  },\n  scatter: {\n    cycle: 1.6,\n    decay: 10,\n    steps: 0,\n    still: 0.5,\n    phase: (_, n, i) => {\n      const order = scatterOrder.filter((v) => v < n * n);\n      return order.indexOf(i) / (n * n);\n    },\n  },\n};\n\nfunction brightness(spec: PatternSpec, phase: number, t: number): number {\n  if (phase < 0) return DIM;\n  let p = t / spec.cycle;\n  if (spec.steps) p = Math.floor(p * spec.steps) / spec.steps;\n  const f = (((p - phase) % 1) + 1) % 1;\n  const rise = 0.035;\n  const light = f < rise ? f / rise : Math.exp(-(f - rise) * spec.decay);\n  return DIM + (1 - DIM) * light;\n}\n\n// ---------------------------------------------------------------------------\n// One shared animation loop.\n\nconst loops = new Set<(now: number) => void>();\nlet frame = 0;\n\nfunction tick(now: number) {\n  frame = 0;\n  for (const loop of loops) loop(now);\n  if (loops.size) frame = requestAnimationFrame(tick);\n}\n\nfunction addLoop(loop: (now: number) => void) {\n  loops.add(loop);\n  if (!frame) frame = requestAnimationFrame(tick);\n}\n\nfunction removeLoop(loop: (now: number) => void) {\n  loops.delete(loop);\n  if (!loops.size && frame) {\n    cancelAnimationFrame(frame);\n    frame = 0;\n  }\n}\n\n/** Reads prefers-reduced-motion and follows changes. */\nfunction useReducedMotionPreference() {\n  const [reduce, setReduce] = useState(false);\n  useEffect(() => {\n    const query = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n    const update = () => setReduce(query.matches);\n    update();\n    query.addEventListener(\"change\", update);\n    return () => query.removeEventListener(\"change\", update);\n  }, []);\n  return reduce;\n}\n\n// ---------------------------------------------------------------------------\n// The grid mark.\n\nexport interface DotGridProps extends Omit<ComponentProps<\"svg\">, \"children\"> {\n  /** How light travels across the grid while running. */\n  pattern?: DotLoaderPattern;\n  /** Dots per side. */\n  grid?: 3 | 4;\n  /** 12, 16, 24, or 40px, or a number of pixels. */\n  size?: DotLoaderSize | number;\n  /** `running` animates; `done` and `failed` gather the dots into a check or an x; `idle` holds them dim. */\n  status?: DotLoaderStatus;\n  /** `status` colors the dots by status (emerald when done, red when failed); `inherit` uses the current text color. */\n  tone?: \"status\" | \"inherit\";\n}\n\n/** The dot grid on its own, decorative. Use DotLoader for a labeled status. */\nexport function DotGrid({\n  pattern = \"wave\",\n  grid = 3,\n  size = \"sm\",\n  status = \"running\",\n  tone = \"status\",\n  className,\n  style,\n  ...props\n}: DotGridProps) {\n  const px = typeof size === \"number\" ? size : pixelSizes[size];\n  const dots = useMemo(() => gridDots(grid), [grid]);\n  const shapes = useMemo(() => {\n    const count = grid * grid;\n    return {\n      done: assign(dots, along(checkPath, count)),\n      failed: assign(dots, crossPoints(count)),\n    };\n  }, [dots, grid]);\n  const reduce = useReducedMotionPreference();\n  const svgRef = useRef<SVGSVGElement>(null);\n  const spec = patterns[pattern];\n  const radius = grid === 3 ? 1.4 : 1.1;\n  const resolved = status === \"done\" || status === \"failed\";\n  // Smaller beads once gathered, so the check reads as one stroke about 2 units wide.\n  const gathered = grid === 3 ? (status === \"failed\" ? 0.86 : 0.74) : 0.86;\n\n  useEffect(() => {\n    const svg = svgRef.current;\n    if (!svg) return;\n    const circles = Array.from(svg.querySelectorAll<SVGCircleElement>(\"circle\"));\n    const phases = dots.map((d, i) => spec.phase(d, grid, i));\n\n    const paint = (t: number) => {\n      circles.forEach((c, i) => {\n        c.style.opacity = brightness(spec, phases[i]!, t).toFixed(3);\n      });\n    };\n\n    if (status !== \"running\") {\n      circles.forEach((c) => {\n        c.style.opacity = status === \"idle\" ? \"0.32\" : \"1\";\n      });\n      return;\n    }\n    if (reduce) {\n      paint(spec.still * spec.cycle);\n      return;\n    }\n\n    let visible = true;\n    let running = false;\n    const loop = (now: number) => paint(now / 1000);\n    const update = () => {\n      const animate = visible && !document.hidden;\n      if (animate && !running) {\n        running = true;\n        addLoop(loop);\n      } else if (!animate && running) {\n        running = false;\n        removeLoop(loop);\n      }\n    };\n    paint(performance.now() / 1000);\n    const observer =\n      typeof IntersectionObserver === \"undefined\"\n        ? null\n        : new IntersectionObserver((entries) => {\n            visible = entries.some((entry) => entry.isIntersecting);\n            update();\n          });\n    observer?.observe(svg);\n    document.addEventListener(\"visibilitychange\", update);\n    update();\n    return () => {\n      running = false;\n      removeLoop(loop);\n      observer?.disconnect();\n      document.removeEventListener(\"visibilitychange\", update);\n    };\n  }, [status, reduce, spec, dots, grid]);\n\n  return (\n    <svg\n      ref={svgRef}\n      aria-hidden=\"true\"\n      viewBox={`0 0 ${BOX} ${BOX}`}\n      fill=\"currentColor\"\n      data-status={status}\n      data-pattern={pattern}\n      className={cx(\"shrink-0 overflow-visible transition-colors duration-300 motion-reduce:transition-none\", tone === \"status\" && statusColor[status], className)}\n      style={{ width: px, height: px, ...style }}\n      {...props}\n    >\n      {dots.map((dot, i) => {\n        const target = resolved ? shapes[status as \"done\" | \"failed\"][i]! : null;\n        const dx = target ? target[0] - dot.x : 0;\n        const dy = target ? target[1] - dot.y : 0;\n        // Dots leave in reading order, about 16ms apart; gathering back to the grid is quicker.\n        const delay = resolved && !reduce ? (dot.col + dot.row) * 16 : 0;\n        return (\n          <circle\n            key={i}\n            cx={dot.x}\n            cy={dot.y}\n            r={radius}\n            style={{\n              transformBox: \"fill-box\",\n              transformOrigin: \"center\",\n              transform: `translate(${dx.toFixed(2)}px, ${dy.toFixed(2)}px) scale(${resolved ? gathered : 1})`,\n              transition: reduce\n                ? \"none\"\n                : resolved\n                  ? `transform 420ms cubic-bezier(0.23, 1, 0.32, 1) ${delay}ms, opacity 200ms ease-out`\n                  : \"transform 260ms cubic-bezier(0.23, 1, 0.32, 1), opacity 160ms ease-out\",\n            }}\n          />\n        );\n      })}\n    </svg>\n  );\n}\n\n// ---------------------------------------------------------------------------\n// Elapsed time\n\nexport function formatElapsed(ms: number): string {\n  const s = Math.max(0, ms) / 1000;\n  if (s < 60) return `${s.toFixed(1)}s`;\n  const m = Math.floor(s / 60);\n  if (m < 60) return `${m}m ${String(Math.floor(s % 60)).padStart(2, \"0\")}s`;\n  return `${Math.floor(m / 60)}h ${String(m % 60).padStart(2, \"0\")}m`;\n}\n\nfunction toMs(value: number | Date | undefined): number | undefined {\n  return value instanceof Date ? value.getTime() : value;\n}\n\n/** Writes the elapsed time into a span ten times a second, without re-rendering React. */\nfunction ElapsedTime({ startedAt, endedAt, running }: { startedAt: number; endedAt?: number; running: boolean }) {\n  const ref = useRef<HTMLSpanElement>(null);\n  useEffect(() => {\n    const el = ref.current;\n    if (!el) return;\n    const write = () => {\n      el.textContent = formatElapsed((running ? Date.now() : (endedAt ?? Date.now())) - startedAt);\n    };\n    write();\n    if (!running) return;\n    const id = setInterval(write, 100);\n    return () => clearInterval(id);\n  }, [startedAt, endedAt, running]);\n  return (\n    <span ref={ref} aria-hidden=\"true\" className=\"font-mono text-xs text-zinc-500 tabular-nums\">\n      {formatElapsed((endedAt ?? startedAt) - startedAt)}\n    </span>\n  );\n}\n\n// ---------------------------------------------------------------------------\n// The labeled loader.\n\nexport interface DotLoaderProps extends Omit<ComponentProps<\"span\">, \"children\" | \"role\"> {\n  pattern?: DotLoaderPattern;\n  grid?: 3 | 4;\n  size?: DotLoaderSize;\n  status?: DotLoaderStatus;\n  /** Visible text beside the grid, for example \"Thinking\". Also the screen reader status. */\n  label?: ReactNode;\n  /** Text shown once `status` is `done`. Defaults to `label`. */\n  doneLabel?: ReactNode;\n  /** Text shown once `status` is `failed`. Defaults to `label`. */\n  failedLabel?: ReactNode;\n  /** A slow highlight travels across the label while running. Off under reduced motion. */\n  shimmer?: boolean;\n  /** Shows the elapsed time in mono after the label. It stops when the status leaves `running`. */\n  timer?: boolean;\n  /** When the work started, as epoch milliseconds or a Date. Defaults to when the loader mounted. */\n  startedAt?: number | Date;\n  /** When the work ended. Defaults to the moment the status left `running`. */\n  endedAt?: number | Date;\n  /** Screen reader text when there is no visible label. */\n  ariaLabel?: string;\n}\n\nconst defaultAria: Record<DotLoaderStatus, string> = {\n  idle: \"Queued\",\n  running: \"Working\",\n  done: \"Done\",\n  failed: \"Failed\",\n};\n\n/**\n * A dot-grid loader with an optional label, shimmer, and elapsed timer. It is a polite status\n * region, so the label is announced when the status changes; the timer is not announced.\n */\nexport function DotLoader({\n  pattern = \"wave\",\n  grid = 3,\n  size = \"sm\",\n  status = \"running\",\n  label,\n  doneLabel,\n  failedLabel,\n  shimmer = false,\n  timer = false,\n  startedAt,\n  endedAt,\n  ariaLabel,\n  className,\n  ...props\n}: DotLoaderProps) {\n  const [mountedAt] = useState(() => Date.now());\n  const [stoppedAt, setStoppedAt] = useState<number | undefined>(undefined);\n  const running = status === \"running\";\n  useEffect(() => {\n    setStoppedAt(running ? undefined : Date.now());\n  }, [running]);\n\n  const text = status === \"done\" ? (doneLabel ?? label) : status === \"failed\" ? (failedLabel ?? label) : label;\n  const start = toMs(startedAt) ?? mountedAt;\n  const end = toMs(endedAt) ?? stoppedAt;\n  const reduce = useReducedMotionPreference();\n\n  return (\n    <span\n      role=\"status\"\n      data-status={status}\n      className={cx(\"inline-flex max-w-full items-center align-middle\", gaps[size], className)}\n      {...props}\n    >\n      <DotGrid pattern={pattern} grid={grid} size={size} status={status} />\n      {text != null ? (\n        <span className={cx(\"min-w-0 truncate leading-5\", textSizes[size])}>\n          <ShimmerText active={shimmer && running && !reduce} tone={status}>\n            {text}\n          </ShimmerText>\n        </span>\n      ) : (\n        <span className=\"sr-only\">{ariaLabel ?? defaultAria[status]}</span>\n      )}\n      {timer && status !== \"idle\" ? <ElapsedTime startedAt={start} endedAt={end} running={running} /> : null}\n    </span>\n  );\n}\n\nconst toneText: Record<DotLoaderStatus, string> = {\n  idle: \"text-zinc-500\",\n  running: \"text-zinc-600 dark:text-zinc-400\",\n  done: \"text-zinc-600 dark:text-zinc-400\",\n  failed: \"text-red-600 dark:text-red-400\",\n};\n\n/**\n * The label twice: the base copy in the secondary color, and a primary-color copy on top that\n * is only visible through a soft band moving left to right. Plain text when inactive.\n */\nfunction ShimmerText({ active, tone, children }: { active: boolean; tone: DotLoaderStatus; children: ReactNode }) {\n  const overlay = useRef<HTMLSpanElement>(null);\n  useEffect(() => {\n    const el = overlay.current;\n    if (!active || !el || typeof el.animate !== \"function\") return;\n    const animation = el.animate(\n      [\n        { maskPosition: \"100% 0\", WebkitMaskPosition: \"100% 0\" },\n        { maskPosition: \"0% 0\", WebkitMaskPosition: \"0% 0\" },\n      ] as Keyframe[],\n      { duration: 2600, iterations: Infinity, easing: \"cubic-bezier(0.45, 0, 0.55, 1)\" },\n    );\n    return () => animation.cancel();\n  }, [active]);\n\n  const band = \"linear-gradient(90deg, transparent 0%, transparent 38%, #000 50%, transparent 62%, transparent 100%)\";\n  return (\n    <span className={cx(\"relative inline-block transition-colors duration-200 motion-reduce:transition-none\", toneText[tone])}>\n      {children}\n      {active ? (\n        <span\n          ref={overlay}\n          aria-hidden=\"true\"\n          className=\"pointer-events-none absolute inset-0 text-zinc-950 select-none dark:text-white\"\n          style={{\n            maskImage: band,\n            WebkitMaskImage: band,\n            maskSize: \"300% 100%\",\n            WebkitMaskSize: \"300% 100%\",\n            maskRepeat: \"no-repeat\",\n            WebkitMaskRepeat: \"no-repeat\",\n            maskPosition: \"100% 0\",\n            WebkitMaskPosition: \"100% 0\",\n          }}\n        >\n          {children}\n        </span>\n      ) : null}\n    </span>\n  );\n}\n"
    }
  ],
  "example": {
    "content": "\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { DotGrid, DotLoader, type DotLoaderPattern } from \"@/components/shaken/agent/dot-loader\";\n\nconst patterns: { pattern: DotLoaderPattern; grid: 3 | 4; use: string }[] = [\n  { pattern: \"wave\", grid: 3, use: \"Thinking\" },\n  { pattern: \"scan\", grid: 4, use: \"Reading files\" },\n  { pattern: \"orbit\", grid: 3, use: \"Waiting on a tool\" },\n  { pattern: \"pulse\", grid: 4, use: \"Planning\" },\n  { pattern: \"scatter\", grid: 4, use: \"Searching\" },\n];\n\nexport default function DotLoaderExample() {\n  // The second step finishes after a few seconds so the dots gather into a check.\n  const [indexed, setIndexed] = useState(false);\n  useEffect(() => {\n    const id = setTimeout(() => setIndexed(true), 3200);\n    return () => clearTimeout(id);\n  }, []);\n\n  return (\n    <div className=\"grid w-full max-w-md gap-8\">\n      <div className=\"grid grid-cols-5 gap-2\">\n        {patterns.map((item) => (\n          <div key={item.pattern} className=\"grid justify-items-center gap-3\">\n            <DotGrid pattern={item.pattern} grid={item.grid} size=\"lg\" className=\"text-zinc-950 dark:text-white\" />\n            <span className=\"font-mono text-xs text-zinc-500\">{item.pattern}</span>\n          </div>\n        ))}\n      </div>\n\n      <ul className=\"grid gap-2.5 border-t border-zinc-950/[0.07] pt-6 dark:border-white/[0.08]\">\n        <li>\n          <DotLoader status=\"done\" pattern=\"scan\" grid={4} label=\"Read 14 files in src/billing\" timer startedAt={Date.now() - 2100} endedAt={Date.now()} />\n        </li>\n        <li>\n          <DotLoader\n            status={indexed ? \"done\" : \"running\"}\n            pattern=\"orbit\"\n            label=\"Indexing invoices.csv\"\n            doneLabel=\"Indexed 2,318 rows\"\n            timer\n          />\n        </li>\n        <li>\n          <DotLoader pattern=\"wave\" label=\"Thinking about the refund policy\" shimmer timer />\n        </li>\n      </ul>\n    </div>\n  );\n}\n"
  }
}
