114 lines
5.2 KiB
TypeScript
114 lines
5.2 KiB
TypeScript
import * as React from 'react';
|
|
import { DismissableLayer } from '@radix-ui/react-dismissable-layer';
|
|
import { FocusScope } from '@radix-ui/react-focus-scope';
|
|
import { Portal as Portal$1 } from '@radix-ui/react-portal';
|
|
import { Primitive } from '@radix-ui/react-primitive';
|
|
|
|
type Scope<C = any> = {
|
|
[scopeName: string]: React.Context<C>[];
|
|
} | undefined;
|
|
type ScopeHook = (scope: Scope) => {
|
|
[__scopeProp: string]: Scope;
|
|
};
|
|
interface CreateScope {
|
|
scopeName: string;
|
|
(): ScopeHook;
|
|
}
|
|
|
|
declare const createDialogScope: CreateScope;
|
|
interface DialogProps {
|
|
children?: React.ReactNode;
|
|
open?: boolean;
|
|
defaultOpen?: boolean;
|
|
onOpenChange?(open: boolean): void;
|
|
modal?: boolean;
|
|
}
|
|
declare const Dialog: React.FC<DialogProps>;
|
|
type PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
interface DialogTriggerProps extends PrimitiveButtonProps {
|
|
}
|
|
declare const DialogTrigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
type PortalProps = React.ComponentPropsWithoutRef<typeof Portal$1>;
|
|
interface DialogPortalProps {
|
|
children?: React.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 DialogPortal: React.FC<DialogPortalProps>;
|
|
interface DialogOverlayProps extends DialogOverlayImplProps {
|
|
/**
|
|
* Used to force mounting when more control is needed. Useful when
|
|
* controlling animation with React animation libraries.
|
|
*/
|
|
forceMount?: true;
|
|
}
|
|
declare const DialogOverlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
type PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
interface DialogOverlayImplProps extends PrimitiveDivProps {
|
|
}
|
|
interface DialogContentProps extends DialogContentTypeProps {
|
|
/**
|
|
* Used to force mounting when more control is needed. Useful when
|
|
* controlling animation with React animation libraries.
|
|
*/
|
|
forceMount?: true;
|
|
}
|
|
declare const DialogContent: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
interface DialogContentTypeProps extends Omit<DialogContentImplProps, 'trapFocus' | 'disableOutsidePointerEvents'> {
|
|
}
|
|
type DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;
|
|
type FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;
|
|
interface DialogContentImplProps extends Omit<DismissableLayerProps, 'onDismiss'> {
|
|
/**
|
|
* When `true`, focus cannot escape the `Content` via keyboard,
|
|
* pointer, or a programmatic focus.
|
|
* @defaultValue false
|
|
*/
|
|
trapFocus?: FocusScopeProps['trapped'];
|
|
/**
|
|
* Event handler called when auto-focusing on open.
|
|
* Can be prevented.
|
|
*/
|
|
onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'];
|
|
/**
|
|
* Event handler called when auto-focusing on close.
|
|
* Can be prevented.
|
|
*/
|
|
onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];
|
|
}
|
|
type PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;
|
|
interface DialogTitleProps extends PrimitiveHeading2Props {
|
|
}
|
|
declare const DialogTitle: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
type PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;
|
|
interface DialogDescriptionProps extends PrimitiveParagraphProps {
|
|
}
|
|
declare const DialogDescription: React.ForwardRefExoticComponent<DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
interface DialogCloseProps extends PrimitiveButtonProps {
|
|
}
|
|
declare const DialogClose: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
declare const WarningProvider: React.FC<{
|
|
contentName: string;
|
|
titleName: string;
|
|
docsSlug: string;
|
|
} & {
|
|
children: React.ReactNode;
|
|
}>;
|
|
declare const Root: React.FC<DialogProps>;
|
|
declare const Trigger: React.ForwardRefExoticComponent<DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
declare const Portal: React.FC<DialogPortalProps>;
|
|
declare const Overlay: React.ForwardRefExoticComponent<DialogOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
declare const Content: React.ForwardRefExoticComponent<DialogContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
declare const Title: React.ForwardRefExoticComponent<DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
declare const Description: React.ForwardRefExoticComponent<DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
declare const Close: React.ForwardRefExoticComponent<DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
|
|
export { Close, Content, Description, Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogOverlay, type DialogOverlayProps, DialogPortal, type DialogPortalProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, Overlay, Portal, Root, Title, Trigger, WarningProvider, createDialogScope };
|