index.d.mts 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. import * as React from "react";
  2. import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
  3. import * as PopperPrimitive from "@radix-ui/react-popper";
  4. import { Portal as _Portal1 } from "@radix-ui/react-portal";
  5. import * as Radix from "@radix-ui/react-primitive";
  6. import { Primitive } from "@radix-ui/react-primitive";
  7. export const createTooltipScope: import("@radix-ui/react-context").CreateScope;
  8. interface TooltipProviderProps {
  9. children: React.ReactNode;
  10. /**
  11. * The duration from when the pointer enters the trigger until the tooltip gets opened.
  12. * @defaultValue 700
  13. */
  14. delayDuration?: number;
  15. /**
  16. * How much time a user has to enter another trigger without incurring a delay again.
  17. * @defaultValue 300
  18. */
  19. skipDelayDuration?: number;
  20. /**
  21. * When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger.
  22. * @defaultValue false
  23. */
  24. disableHoverableContent?: boolean;
  25. }
  26. export const TooltipProvider: React.FC<TooltipProviderProps>;
  27. export interface TooltipProps {
  28. children?: React.ReactNode;
  29. open?: boolean;
  30. defaultOpen?: boolean;
  31. onOpenChange?: (open: boolean) => void;
  32. /**
  33. * The duration from when the pointer enters the trigger until the tooltip gets opened. This will
  34. * override the prop with the same name passed to Provider.
  35. * @defaultValue 700
  36. */
  37. delayDuration?: number;
  38. /**
  39. * When `true`, trying to hover the content will result in the tooltip closing as the pointer leaves the trigger.
  40. * @defaultValue false
  41. */
  42. disableHoverableContent?: boolean;
  43. }
  44. export const Tooltip: React.FC<TooltipProps>;
  45. type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
  46. export interface TooltipTriggerProps extends PrimitiveButtonProps {
  47. }
  48. export const TooltipTrigger: React.ForwardRefExoticComponent<TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
  49. type PortalProps = React.ComponentPropsWithoutRef<typeof _Portal1>;
  50. export interface TooltipPortalProps {
  51. children?: React.ReactNode;
  52. /**
  53. * Specify a container element to portal the content into.
  54. */
  55. container?: PortalProps['container'];
  56. /**
  57. * Used to force mounting when more control is needed. Useful when
  58. * controlling animation with React animation libraries.
  59. */
  60. forceMount?: true;
  61. }
  62. export const TooltipPortal: React.FC<TooltipPortalProps>;
  63. export interface TooltipContentProps extends TooltipContentImplProps {
  64. /**
  65. * Used to force mounting when more control is needed. Useful when
  66. * controlling animation with React animation libraries.
  67. */
  68. forceMount?: true;
  69. }
  70. export const TooltipContent: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<HTMLDivElement>>;
  71. type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;
  72. type PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;
  73. interface TooltipContentImplProps extends Omit<PopperContentProps, 'onPlaced'> {
  74. /**
  75. * A more descriptive label for accessibility purpose
  76. */
  77. 'aria-label'?: string;
  78. /**
  79. * Event handler called when the escape key is down.
  80. * Can be prevented.
  81. */
  82. onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];
  83. /**
  84. * Event handler called when the a `pointerdown` event happens outside of the `Tooltip`.
  85. * Can be prevented.
  86. */
  87. onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];
  88. }
  89. type PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;
  90. export interface TooltipArrowProps extends PopperArrowProps {
  91. }
  92. export const TooltipArrow: React.ForwardRefExoticComponent<TooltipArrowProps & React.RefAttributes<SVGSVGElement>>;
  93. export const Provider: React.FC<TooltipProviderProps>;
  94. export const Root: React.FC<TooltipProps>;
  95. export const Trigger: React.ForwardRefExoticComponent<TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
  96. export const Portal: React.FC<TooltipPortalProps>;
  97. export const Content: React.ForwardRefExoticComponent<TooltipContentProps & React.RefAttributes<HTMLDivElement>>;
  98. export const Arrow: React.ForwardRefExoticComponent<TooltipArrowProps & React.RefAttributes<SVGSVGElement>>;
  99. //# sourceMappingURL=index.d.ts.map