{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "highlight-text",
  "title": "highlightText",
  "description": "A utility function for highlight text.",
  "files": [
    {
      "path": "registry/default/lib/highlight-text.tsx",
      "content": "import * as React from \"react\";\n\nexport function highlightText(text: string, query: string): React.ReactNode {\n  const trimmed = query.trim();\n  if (!trimmed) {\n    return text;\n  }\n\n  const limited = trimmed.slice(0, 100);\n  const escaped = limited.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n  const regex = new RegExp(`(${escaped})`, \"gi\");\n\n  return text.split(regex).map((part, idx) =>\n    part.toLowerCase() === limited.toLowerCase() ? (\n      <mark key={idx} className=\"text-primary bg-transparent font-bold\">\n        {part}\n      </mark>\n    ) : (\n      part\n    ),\n  );\n}\n",
      "type": "registry:lib",
      "target": "lib/cubby-ui/highlight-text.tsx"
    }
  ],
  "type": "registry:lib"
}