{"version":3,"file":"TooltipContext.cjs","names":[],"sources":["../../../src/components/Tooltip/TooltipContext.ts"],"sourcesContent":["/*\n * Copyright 2024 New Vector Ltd.\n *\n * SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial\n * Please see LICENSE files in the repository root for full details.\n */\n\nimport { createContext, useContext } from \"react\";\nimport { useTooltip } from \"./useTooltip\";\n\ntype ContextType = ReturnType<typeof useTooltip> | null;\n/**\n * The context for the Tooltip components.\n */\nexport const TooltipContext = createContext<ContextType>(null);\n\n/**\n * Provides the context for the Tooltip components.\n */\nexport function useTooltipContext() {\n  const context = useContext(TooltipContext);\n\n  if (context == null) {\n    throw new Error(\"Tooltip components must be wrapped in <Tooltip />\");\n  }\n\n  return context;\n}\n"],"mappings":";;;;;;AAcA,IAAa,kBAAA,GAAA,MAAA,eAA4C,KAAK;;;;AAK9D,SAAgB,oBAAoB;CAClC,MAAM,WAAA,GAAA,MAAA,YAAqB,eAAe;AAE1C,KAAI,WAAW,KACb,OAAM,IAAI,MAAM,oDAAoD;AAGtE,QAAO"}