index.d.mts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import * as React from "react";
  2. import * as Radix from "@radix-ui/react-primitive";
  3. import { Primitive } from "@radix-ui/react-primitive";
  4. type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
  5. export interface DismissableLayerProps extends PrimitiveDivProps {
  6. /**
  7. * When `true`, hover/focus/click interactions will be disabled on elements outside
  8. * the `DismissableLayer`. Users will need to click twice on outside elements to
  9. * interact with them: once to close the `DismissableLayer`, and again to trigger the element.
  10. */
  11. disableOutsidePointerEvents?: boolean;
  12. /**
  13. * Event handler called when the escape key is down.
  14. * Can be prevented.
  15. */
  16. onEscapeKeyDown?: (event: KeyboardEvent) => void;
  17. /**
  18. * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.
  19. * Can be prevented.
  20. */
  21. onPointerDownOutside?: (event: PointerDownOutsideEvent) => void;
  22. /**
  23. * Event handler called when the focus moves outside of the `DismissableLayer`.
  24. * Can be prevented.
  25. */
  26. onFocusOutside?: (event: FocusOutsideEvent) => void;
  27. /**
  28. * Event handler called when an interaction happens outside the `DismissableLayer`.
  29. * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.
  30. * Can be prevented.
  31. */
  32. onInteractOutside?: (event: PointerDownOutsideEvent | FocusOutsideEvent) => void;
  33. /**
  34. * Handler called when the `DismissableLayer` should be dismissed
  35. */
  36. onDismiss?: () => void;
  37. }
  38. export const DismissableLayer: React.ForwardRefExoticComponent<DismissableLayerProps & React.RefAttributes<HTMLDivElement>>;
  39. interface DismissableLayerBranchProps extends PrimitiveDivProps {
  40. }
  41. export const DismissableLayerBranch: React.ForwardRefExoticComponent<DismissableLayerBranchProps & React.RefAttributes<HTMLDivElement>>;
  42. type PointerDownOutsideEvent = CustomEvent<{
  43. originalEvent: PointerEvent;
  44. }>;
  45. type FocusOutsideEvent = CustomEvent<{
  46. originalEvent: FocusEvent;
  47. }>;
  48. export const Root: React.ForwardRefExoticComponent<DismissableLayerProps & React.RefAttributes<HTMLDivElement>>;
  49. export const Branch: React.ForwardRefExoticComponent<DismissableLayerBranchProps & React.RefAttributes<HTMLDivElement>>;
  50. //# sourceMappingURL=index.d.ts.map