import type { FloatingLayerContentProps } from "../utilities/floating-layer/types.js"; import type { ArrowProps, ArrowPropsWithoutHTML } from "../utilities/arrow/types.js"; import type { DismissibleLayerProps } from "../utilities/dismissible-layer/types.js"; import type { EscapeLayerProps } from "../utilities/escape-layer/types.js"; import type { Snippet } from "svelte"; import type { OnChangeFn, WithChild, WithChildNoChildrenSnippetProps, WithChildren, Without } from "../../internal/types.js"; import type { BitsPrimitiveButtonAttributes, BitsPrimitiveDivAttributes } from "../../shared/attributes.js"; import type { PortalProps } from "../utilities/portal/types.js"; import type { FloatingContentSnippetProps, StaticContentSnippetProps } from "../../shared/types.js"; import type { TooltipTether as TooltipTetherImpl } from "./tooltip.svelte.js"; export type TooltipTether = TooltipTetherImpl; export type TooltipRootSnippetProps = { open: boolean; triggerId: string | null; payload: [Payload] extends [never] ? null : Payload | null; }; export type TooltipProviderPropsWithoutHTML = WithChildren<{ /** * The delay in milliseconds before the tooltip opens. * * @defaultValue 700 */ delayDuration?: number; /** * How much time a user has to enter another trigger without * incurring a delay again. * @defaultValue 300 */ skipDelayDuration?: number; /** * Prevents tooltip from remaining open when hovering over the content. * * @defaultValue false */ disableHoverableContent?: boolean; /** * When `true`, the tooltip will not close when you click on the trigger. * * @defaultValue false */ disableCloseOnTriggerClick?: boolean; /** * When `true`, the tooltip will be disabled and will not open. * * @defaultValue false */ disabled?: boolean; /** * Prevent the tooltip from opening if the focus did not come using * the keyboard. * * @defaultValue false */ ignoreNonKeyboardFocus?: boolean; }>; export type TooltipProviderProps = TooltipProviderPropsWithoutHTML; export type TooltipRootPropsWithoutHTML = Omit; /** * A callback that will be called when the tooltip is opened or closed. */ onOpenChangeComplete?: OnChangeFn; /** * The delay in milliseconds before the tooltip opens. * * @defaultValue 700 */ delayDuration?: number; /** * Prevents tooltip from remaining open when hovering over the content. * * @defaultValue false */ disableHoverableContent?: boolean; /** * When `true`, the tooltip will not close when you click on the trigger. * * @defaultValue false */ disableCloseOnTriggerClick?: boolean; /** * When `true`, the tooltip will be disabled and will not open. * * @defaultValue false */ disabled?: boolean; /** * Prevent the tooltip from opening if the focus did not come using * the keyboard. * * @defaultValue false */ ignoreNonKeyboardFocus?: boolean; /** * The active trigger id for controlled single tooltip mode. */ triggerId?: string | null; /** * Shared tether used to connect detached triggers and infer payload types. */ tether?: TooltipTether | undefined; }>, "children"> & { children?: Snippet | Snippet<[TooltipRootSnippetProps]>; }; export type TooltipRootProps = TooltipRootPropsWithoutHTML; export type TooltipContentPropsWithoutHTML = WithChildNoChildrenSnippetProps & Omit & EscapeLayerProps & { /** * When `true`, the tooltip will be forced to mount in the DOM. * * Useful for more control over the transition behavior. */ forceMount?: boolean; }, FloatingContentSnippetProps>; export type TooltipContentProps = TooltipContentPropsWithoutHTML & Without; export type TooltipContentStaticPropsWithoutHTML = WithChildNoChildrenSnippetProps & Omit & EscapeLayerProps & { /** * When `true`, the tooltip will be forced to mount in the DOM. * * Useful for more control over the transition behavior. */ forceMount?: boolean; }, StaticContentSnippetProps>; export type TooltipContentStaticProps = TooltipContentStaticPropsWithoutHTML & Without; export type TooltipArrowPropsWithoutHTML = ArrowPropsWithoutHTML; export type TooltipArrowProps = ArrowProps; export type TooltipPortalPropsWithoutHTML = PortalProps; export type TooltipPortalProps = PortalProps; export type TooltipTriggerPropsWithoutHTML = WithChild<{ /** * Whether the tooltip trigger is disabled or not. * * @defaultValue false */ disabled?: boolean | null | undefined; /** * Payload for the trigger used by singleton tooltip root snippets. */ payload?: [Payload] extends [never] ? unknown : Payload; /** * Shared tether used to connect detached triggers and infer payload types. */ tether?: TooltipTether | undefined; }>; export type TooltipTriggerProps = TooltipTriggerPropsWithoutHTML & Without>;