mirror of
https://github.com/zoriya/v10.git
synced 2026-08-11 00:19:28 +00:00
17 lines
590 B
JavaScript
17 lines
590 B
JavaScript
"use client";
|
|
import { createContext, useContext } from "react";
|
|
//#region src/ui/tooltip/context.tsx
|
|
const TooltipContext = createContext(null);
|
|
const TooltipContextProvider = TooltipContext.Provider;
|
|
function useTooltipContext() {
|
|
const ctx = useContext(TooltipContext);
|
|
if (!ctx) throw new Error("Tooltip compound components must be used within a Tooltip.Root");
|
|
return ctx;
|
|
}
|
|
function useOptionalTooltipContext() {
|
|
return useContext(TooltipContext);
|
|
}
|
|
//#endregion
|
|
export { TooltipContextProvider, useOptionalTooltipContext, useTooltipContext };
|
|
|
|
//# sourceMappingURL=context.js.map
|