{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "global-find-bar",
  "title": "Global Find Bar",
  "description": "Floating search bar for notebook-wide find functionality. Supports keyboard navigation (Enter/Shift+Enter for next/prev, Escape to close). Works with search-highlight CodeMirror extension for in-cell highlighting.",
  "dependencies": [
    "lucide-react"
  ],
  "files": [
    {
      "path": "registry/cell/GlobalFindBar.tsx",
      "content": "\"use client\";\n\n/**\n * Global find/search bar for notebook-wide search.\n * Complements the search-highlight CodeMirror extension for in-cell highlighting.\n */\n\nimport { ChevronDown, ChevronUp, X } from \"lucide-react\";\nimport { useCallback, useEffect, useRef } from \"react\";\n\nexport interface GlobalFindBarProps {\n  /** Current search query */\n  query: string;\n  /** Total number of matches found */\n  matchCount: number;\n  /** Index of the currently active match (0-based) */\n  currentMatchIndex: number;\n  /** Called when the search query changes */\n  onQueryChange: (query: string) => void;\n  /** Called when user navigates to next match */\n  onNextMatch: () => void;\n  /** Called when user navigates to previous match */\n  onPrevMatch: () => void;\n  /** Called when the find bar is closed */\n  onClose: () => void;\n}\n\n/**\n * A floating search bar for notebook-wide find functionality.\n * Supports keyboard navigation (Enter/Shift+Enter for next/prev, Escape to close).\n *\n * @example\n * ```tsx\n * <GlobalFindBar\n *   query={searchQuery}\n *   matchCount={matches.length}\n *   currentMatchIndex={currentMatch}\n *   onQueryChange={setSearchQuery}\n *   onNextMatch={() => setCurrentMatch((i) => (i + 1) % matches.length)}\n *   onPrevMatch={() => setCurrentMatch((i) => (i - 1 + matches.length) % matches.length)}\n *   onClose={() => setShowFindBar(false)}\n * />\n * ```\n */\nexport function GlobalFindBar({\n  query,\n  matchCount,\n  currentMatchIndex,\n  onQueryChange,\n  onNextMatch,\n  onPrevMatch,\n  onClose,\n}: GlobalFindBarProps) {\n  const inputRef = useRef<HTMLInputElement>(null);\n\n  // Focus input on mount\n  useEffect(() => {\n    requestAnimationFrame(() => {\n      inputRef.current?.focus();\n      inputRef.current?.select();\n    });\n  }, []);\n\n  const handleKeyDown = useCallback(\n    (e: React.KeyboardEvent) => {\n      if (e.key === \"Escape\") {\n        e.preventDefault();\n        onClose();\n      } else if (e.key === \"Enter\" && e.shiftKey) {\n        e.preventDefault();\n        onPrevMatch();\n      } else if (e.key === \"Enter\") {\n        e.preventDefault();\n        onNextMatch();\n      }\n    },\n    [onClose, onNextMatch, onPrevMatch],\n  );\n\n  const matchLabel =\n    query && matchCount > 0\n      ? `${currentMatchIndex + 1} of ${matchCount}`\n      : query\n        ? \"No results\"\n        : \"\";\n\n  return (\n    <div className=\"flex items-center gap-1.5 border-b bg-background px-3 py-1.5 shadow-sm\">\n      <div className=\"relative flex-1 max-w-sm\">\n        <input\n          ref={inputRef}\n          type=\"text\"\n          value={query}\n          onChange={(e) => onQueryChange(e.target.value)}\n          onKeyDown={handleKeyDown}\n          placeholder=\"Find in notebook...\"\n          autoComplete=\"off\"\n          autoCorrect=\"off\"\n          autoCapitalize=\"off\"\n          spellCheck={false}\n          className=\"h-7 w-full rounded border border-input bg-transparent px-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring\"\n          aria-label=\"Search notebook\"\n        />\n      </div>\n      <span className=\"text-xs text-muted-foreground min-w-[5rem] text-center tabular-nums\">\n        {matchLabel}\n      </span>\n      <button\n        type=\"button\"\n        onClick={onPrevMatch}\n        disabled={matchCount === 0}\n        className=\"flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-30 disabled:pointer-events-none transition-colors\"\n        title=\"Previous match (Shift+Enter)\"\n        aria-label=\"Previous match\"\n      >\n        <ChevronUp className=\"h-4 w-4\" />\n      </button>\n      <button\n        type=\"button\"\n        onClick={onNextMatch}\n        disabled={matchCount === 0}\n        className=\"flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-30 disabled:pointer-events-none transition-colors\"\n        title=\"Next match (Enter)\"\n        aria-label=\"Next match\"\n      >\n        <ChevronDown className=\"h-4 w-4\" />\n      </button>\n      <button\n        type=\"button\"\n        onClick={onClose}\n        className=\"flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors\"\n        title=\"Close (Escape)\"\n        aria-label=\"Close find bar\"\n      >\n        <X className=\"h-4 w-4\" />\n      </button>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/cell/GlobalFindBar.tsx"
    }
  ],
  "type": "registry:component"
}