{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "use-segment-interaction",
  "title": "useSegmentInteraction",
  "description": "Client hook that coordinates hover, focus, and persistent selection across Segment[] surfaces.",
  "registryDependencies": [
    "@retab/segment-interaction"
  ],
  "files": [
    {
      "path": "registry/new-york-v4/ui/use-segment-interaction.ts",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nimport { type SegmentInteraction } from \"@/lib/segment-interaction\";\n\nexport interface ControlledSegmentInteractionOptions {\n  previewSegmentId: string | null;\n  setPreviewSegmentId: (segmentId: string | null) => void;\n}\n\nexport function useSegmentInteraction(): SegmentInteraction {\n  const [previewSegmentId, setPreviewSegmentId] = React.useState<string | null>(\n    null,\n  );\n\n  return useSegmentInteractionObject({\n    previewSegmentId,\n    setPreviewSegmentId,\n  });\n}\n\nexport function useControlledSegmentInteraction(\n  options: ControlledSegmentInteractionOptions,\n): SegmentInteraction {\n  return useSegmentInteractionObject(options);\n}\n\nfunction useSegmentInteractionObject({\n  previewSegmentId,\n  setPreviewSegmentId,\n}: ControlledSegmentInteractionOptions): SegmentInteraction {\n  const previewSegment = React.useCallback(\n    (segmentId: string) => setPreviewSegmentId(segmentId),\n    [setPreviewSegmentId],\n  );\n  const clearPreview = React.useCallback(\n    () => setPreviewSegmentId(null),\n    [setPreviewSegmentId],\n  );\n\n  return React.useMemo(\n    () => ({\n      previewSegmentId,\n      previewSegment,\n      clearPreview,\n    }),\n    [clearPreview, previewSegment, previewSegmentId],\n  );\n}\n",
      "type": "registry:ui",
      "target": "@ui/use-segment-interaction.ts"
    }
  ],
  "type": "registry:ui"
}