{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "nav-highlight",
  "title": "Nav highlight",
  "description": "The shared highlight that glides between tabs, segments and nav rows.",
  "dependencies": [
    "motion@^12.23.12"
  ],
  "registryDependencies": [
    "@khaeli/motion-tokens",
    "@khaeli/utils"
  ],
  "files": [
    {
      "path": "registry/khaeli/ui/nav-highlight.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { LayoutGroup, useReducedMotion } from \"motion/react\"\nimport * as m from \"motion/react-m\"\nimport { cn } from \"@/lib/utils\"\n\nimport { motionTokens } from \"@/lib/motion-tokens\"\n\n// --- NavHighlight ---\n// One shared highlight that glides between the items of a set (after\n// Arc's segmented-control / tabs pattern): the active sidebar row, the rail's\n// current tile, the selected tab or segment. Render <NavHighlight /> inside\n// the active item only. When another item becomes active the same highlight\n// morphs across on spring.morph (layoutId); the items and their text never\n// move, and a reversed or repeated change retargets from where it is.\n//\n// - Wrap each set in <NavHighlightGroup> so two sets never trade highlights.\n// - The item must be `relative isolate`: the highlight is absolute, inset 0,\n//   painted behind the item's content (z -1 inside the item's stacking\n//   context). Give it its look with `className` (fill, radius).\n// - Reduced motion: the highlight jumps to the new item.\n\nfunction NavHighlightGroup({\n  id,\n  children,\n}: {\n  /** Scope name; defaults to a per-instance id. */\n  id?: string\n  children: React.ReactNode\n}) {\n  const fallback = React.useId()\n  return <LayoutGroup id={id ?? fallback}>{children}</LayoutGroup>\n}\n\nfunction NavHighlight({\n  className,\n  layoutId = \"nav-highlight\",\n  ...props\n}: Omit<React.ComponentProps<typeof m.span>, \"layoutId\" | \"transition\" | \"children\"> & {\n  /** Only needed when one group holds two independent highlights. */\n  layoutId?: string\n}) {\n  const reduce = useReducedMotion()\n  return (\n    <m.span\n      aria-hidden=\"true\"\n      data-slot=\"nav-highlight\"\n      layoutId={layoutId}\n      transition={reduce ? { duration: 0 } : motionTokens.spring.morph}\n      className={cn(\"pointer-events-none absolute inset-0 -z-1\", className)}\n      {...props}\n    />\n  )\n}\n\nexport { NavHighlight, NavHighlightGroup }\n",
      "type": "registry:ui"
    }
  ],
  "docs": "Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.",
  "type": "registry:ui"
}