UNPKG

@loke/ui

Version:
100 lines (99 loc) 4.61 kB
import { DismissableLayer } from "@loke/ui/dismissable-layer"; import * as PopperPrimitive from "@loke/ui/popper"; import { Portal as PortalPrimitive } from "@loke/ui/portal"; import { Primitive } from "@loke/ui/primitive"; import { type ComponentPropsWithoutRef, type FC, type ReactNode } from "react"; declare const createTooltipScope: import("@loke/ui/context").CreateScope; interface TooltipProviderProps { children: ReactNode; /** * The duration from when the pointer enters the trigger until the tooltip gets opened. * @defaultValue 700 */ delayDuration?: number; /** * When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger. * @defaultValue false */ disableHoverableContent?: boolean; /** * How much time a user has to enter another trigger without incurring a delay again. * @defaultValue 300 */ skipDelayDuration?: number; } declare const TooltipProvider: FC<TooltipProviderProps>; interface TooltipProps { children?: ReactNode; defaultOpen?: boolean; /** * The duration from when the pointer enters the trigger until the tooltip gets opened. This will * override the prop with the same name passed to Provider. * @defaultValue 700 */ delayDuration?: number; /** * When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger. * @defaultValue false */ disableHoverableContent?: boolean; onOpenChange?: (open: boolean) => void; open?: boolean; } declare const Tooltip: FC<TooltipProps>; type PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>; interface TooltipTriggerProps extends PrimitiveButtonProps { } declare const TooltipTrigger: import("react").ForwardRefExoticComponent<TooltipTriggerProps & import("react").RefAttributes<HTMLButtonElement>>; type PortalProps = ComponentPropsWithoutRef<typeof PortalPrimitive>; interface TooltipPortalProps { children?: ReactNode; /** * Specify a container element to portal the content into. */ container?: PortalProps["container"]; /** * Used to force mounting when more control is needed. Useful when * controlling animation with React animation libraries. */ forceMount?: true; } declare const TooltipPortal: FC<TooltipPortalProps>; interface TooltipContentProps extends TooltipContentImplProps { /** * Used to force mounting when more control is needed. Useful when * controlling animation with React animation libraries. */ forceMount?: true; } declare const TooltipContent: import("react").ForwardRefExoticComponent<TooltipContentProps & import("react").RefAttributes<HTMLDivElement>>; type DismissableLayerProps = ComponentPropsWithoutRef<typeof DismissableLayer>; type PopperContentProps = ComponentPropsWithoutRef<typeof PopperPrimitive.Content>; interface TooltipContentImplProps extends Omit<PopperContentProps, "onPlaced"> { /** * A more descriptive label for accessibility purpose */ "aria-label"?: string; /** * Event handler called when the escape key is down. * Can be prevented. */ onEscapeKeyDown?: DismissableLayerProps["onEscapeKeyDown"]; /** * Event handler called when the a `pointerdown` event happens outside of the `Tooltip`. * Can be prevented. */ onPointerDownOutside?: DismissableLayerProps["onPointerDownOutside"]; } type PopperArrowProps = ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>; interface TooltipArrowProps extends PopperArrowProps { } declare const TooltipArrow: import("react").ForwardRefExoticComponent<TooltipArrowProps & import("react").RefAttributes<SVGSVGElement>>; declare const Provider: FC<TooltipProviderProps>; declare const Root: FC<TooltipProps>; declare const Trigger: import("react").ForwardRefExoticComponent<TooltipTriggerProps & import("react").RefAttributes<HTMLButtonElement>>; declare const Portal: FC<TooltipPortalProps>; declare const Content: import("react").ForwardRefExoticComponent<TooltipContentProps & import("react").RefAttributes<HTMLDivElement>>; declare const Arrow: import("react").ForwardRefExoticComponent<TooltipArrowProps & import("react").RefAttributes<SVGSVGElement>>; export { createTooltipScope, TooltipProvider, Tooltip, TooltipTrigger, TooltipPortal, TooltipContent, TooltipArrow, Provider, Root, Trigger, Portal, Content, Arrow, }; export type { TooltipProviderProps, TooltipProps, TooltipTriggerProps, TooltipPortalProps, TooltipContentProps, TooltipArrowProps, };