index.d.mts 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import * as React from "react";
  2. import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
  3. import { FocusScope } from "@radix-ui/react-focus-scope";
  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 createDialogScope: import("@radix-ui/react-context").CreateScope;
  8. export interface DialogProps {
  9. children?: React.ReactNode;
  10. open?: boolean;
  11. defaultOpen?: boolean;
  12. onOpenChange?(open: boolean): void;
  13. modal?: boolean;
  14. }
  15. export const Dialog: React.FC<DialogProps>;
  16. type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
  17. export interface DialogTriggerProps extends PrimitiveButtonProps {
  18. }
  19. export const DialogTrigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
  20. type PortalProps = React.ComponentPropsWithoutRef<typeof _Portal1>;
  21. export interface DialogPortalProps {
  22. children?: React.ReactNode;
  23. /**
  24. * Specify a container element to portal the content into.
  25. */
  26. container?: PortalProps['container'];
  27. /**
  28. * Used to force mounting when more control is needed. Useful when
  29. * controlling animation with React animation libraries.
  30. */
  31. forceMount?: true;
  32. }
  33. export const DialogPortal: React.FC<DialogPortalProps>;
  34. export interface DialogOverlayProps extends DialogOverlayImplProps {
  35. /**
  36. * Used to force mounting when more control is needed. Useful when
  37. * controlling animation with React animation libraries.
  38. */
  39. forceMount?: true;
  40. }
  41. export const DialogOverlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
  42. type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
  43. interface DialogOverlayImplProps extends PrimitiveDivProps {
  44. }
  45. export interface DialogContentProps extends DialogContentTypeProps {
  46. /**
  47. * Used to force mounting when more control is needed. Useful when
  48. * controlling animation with React animation libraries.
  49. */
  50. forceMount?: true;
  51. }
  52. export const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
  53. interface DialogContentTypeProps extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
  54. }
  55. type DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;
  56. type FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;
  57. interface DialogContentImplProps extends Omit<DismissableLayerProps, 'onDismiss'> {
  58. /**
  59. * When `true`, focus cannot escape the `Content` via keyboard,
  60. * pointer, or a programmatic focus.
  61. * @defaultValue false
  62. */
  63. trapFocus?: FocusScopeProps['trapped'];
  64. /**
  65. * Event handler called when auto-focusing on open.
  66. * Can be prevented.
  67. */
  68. onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
  69. /**
  70. * Event handler called when auto-focusing on close.
  71. * Can be prevented.
  72. */
  73. onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
  74. }
  75. type PrimitiveHeading2Props = Radix.ComponentPropsWithoutRef<typeof Primitive.h2>;
  76. export interface DialogTitleProps extends PrimitiveHeading2Props {
  77. }
  78. export const DialogTitle: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
  79. type PrimitiveParagraphProps = Radix.ComponentPropsWithoutRef<typeof Primitive.p>;
  80. export interface DialogDescriptionProps extends PrimitiveParagraphProps {
  81. }
  82. export const DialogDescription: React.ForwardRefExoticComponent<DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
  83. export interface DialogCloseProps extends PrimitiveButtonProps {
  84. }
  85. export const DialogClose: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
  86. export const WarningProvider: {
  87. (props: {
  88. contentName: string;
  89. titleName: string;
  90. docsSlug: string;
  91. } & {
  92. children: React.ReactNode;
  93. }): JSX.Element;
  94. displayName: string;
  95. };
  96. export const Root: React.FC<DialogProps>;
  97. export const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
  98. export const Portal: React.FC<DialogPortalProps>;
  99. export const Overlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
  100. export const Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
  101. export const Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
  102. export const Description: React.ForwardRefExoticComponent<DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
  103. export const Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
  104. //# sourceMappingURL=index.d.ts.map