import { type Accessor } from "solid-js"; import type { BaseUIChangeEventDetails, REASONS } from "../internals/change-event-details.js"; import type { FloatingRootStore } from "../internals/floating-ui/components/floating-root-store.js"; import type { UseInteractionsReturn } from "../internals/floating-ui/hooks/use-interactions.js"; import type { TransitionStatus } from "../internals/use-transition-status/use-transition-status.js"; import type { TooltipStore } from "./store/tooltip-store.js"; /** * Reasons a tooltip's open state can change. Mirrors Base UI React's * `TooltipRoot.ChangeEventReason` union. */ export type TooltipRootChangeEventReason = typeof REASONS.triggerHover | typeof REASONS.triggerFocus | typeof REASONS.triggerPress | typeof REASONS.outsidePress | typeof REASONS.escapeKey | typeof REASONS.disabled | typeof REASONS.imperativeAction | typeof REASONS.none | typeof REASONS.cancelOpen | typeof REASONS.focusOut; export type TooltipRootChangeEventDetails = BaseUIChangeEventDetails; /** * Public projected state — surfaces via `data-*` attrs on the root and * downstream parts. */ export interface TooltipRootState { /** Whether the tooltip is currently open. */ open: boolean; } /** * `instant` is the string flag that Base UI emits as `data-instant` on the * popup / arrow / positioner to disable CSS transitions for specific * programmatic transitions (delay-group swap, focus, dismiss). */ export type TooltipInstantType = "delay" | "focus" | "dismiss" | undefined; /** * Context shape shared between `` and every tooltip sub-part. * Every reactive field is an `Accessor` so consumers don't need to guard * against top-level reactive reads. */ export interface TooltipRootContextValue { /** Reactive accessor for the current open state (gated by `disabled`). */ open: Accessor; /** Whether interactions are disabled. */ disabled: Accessor; /** Whether the popup is mounted (may still be true during exit). */ mounted: Accessor; /** Enter/exit transition phase. */ transitionStatus: Accessor; /** Instant-type flag projected onto the popup / arrow as `data-instant`. */ instantType: Accessor; /** Whether the delay-group currently has this member in instant phase. */ isInstantPhase: Accessor; /** Public projected state (used by `renderElement`). */ state: Accessor; /** Setter for `instantType` — called by trigger / popup when events fire. */ setInstantType: (value: TooltipInstantType) => void; /** Setter for `isInstantPhase` — called by the trigger's `useDelayGroup`. */ setIsInstantPhase: (value: boolean) => void; /** Imperative open setter. */ setOpen: (next: boolean, details: TooltipRootChangeEventDetails) => void; /** Reactive accessor for the root's floating-ui store. */ floatingRootContext: FloatingRootStore; /** Interaction prop bags produced by `useInteractions`. */ interactions: UseInteractionsReturn; /** Setter for the trigger DOM element. */ setTriggerElement: (node: HTMLElement | null) => void; /** Accessor for the trigger DOM element. */ triggerElement: Accessor; /** Setter for the popup DOM element. */ setPopupElement: (node: HTMLElement | null) => void; /** Accessor for the popup DOM element. */ popupElement: Accessor; /** * The `TooltipStore` owned by this root. Triggers register into its * `context.triggerElements` map; the handle (if any) is also backed * by this store. */ store: TooltipStore; /** * Accessor for the currently-selected trigger id. */ activeTriggerId: Accessor; setActiveTriggerId: (id: string | null) => void; /** Current payload. */ payload: Accessor; setPayload: (payload: unknown) => void; /** Accessor for whether hover-safe-polygon is disabled. */ disableHoverablePopup: Accessor; /** Accessor for the track-cursor-axis value. */ trackCursorAxis: Accessor<"none" | "x" | "y" | "both">; /** Accessor for whether clicking the trigger closes the tooltip. */ closeOnClick: Accessor; /** Internal writer used by the active trigger's `closeOnClick` option. */ setCloseOnClick: (value: boolean) => void; /** * Prop bag returned by `useClientPoint` — merged onto the active * trigger when `trackCursorAxis !== "none"`. Empty otherwise. */ clientPointReferenceProps: Accessor>; /** * Prop bag returned by `useClientPoint` — merged onto the popup when * `trackCursorAxis !== "none"`. Empty otherwise. */ clientPointFloatingProps: Accessor>; } /** * Solid 2's `useContext` throws `ContextNotFoundError` when the resolved * value is `undefined`, so the "no provider" sentinel is `null` here — the * helper below turns that into the Base UI error. */ export declare const TooltipRootContext: import("solid-js").Context; /** * Read the current `` context. Throws if used outside a root — * matches Base UI React's behavior. */ export declare function useTooltipRootContext(): TooltipRootContextValue; //# sourceMappingURL=tooltip-root-context.d.ts.map