70 lines
4.2 KiB
TypeScript
70 lines
4.2 KiB
TypeScript
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
import React from 'react';
|
|
|
|
interface WithFadeFromProps {
|
|
snapPoints: (number | string)[];
|
|
fadeFromIndex: number;
|
|
}
|
|
interface WithoutFadeFromProps {
|
|
snapPoints?: (number | string)[];
|
|
fadeFromIndex?: never;
|
|
}
|
|
type DialogProps = {
|
|
activeSnapPoint?: number | string | null;
|
|
setActiveSnapPoint?: (snapPoint: number | string | null) => void;
|
|
children?: React.ReactNode;
|
|
open?: boolean;
|
|
closeThreshold?: number;
|
|
noBodyStyles?: boolean;
|
|
onOpenChange?: (open: boolean) => void;
|
|
shouldScaleBackground?: boolean;
|
|
setBackgroundColorOnScale?: boolean;
|
|
scrollLockTimeout?: number;
|
|
fixed?: boolean;
|
|
handleOnly?: boolean;
|
|
dismissible?: boolean;
|
|
onDrag?: (event: React.PointerEvent<HTMLDivElement>, percentageDragged: number) => void;
|
|
onRelease?: (event: React.PointerEvent<HTMLDivElement>, open: boolean) => void;
|
|
modal?: boolean;
|
|
nested?: boolean;
|
|
onClose?: () => void;
|
|
direction?: 'top' | 'bottom' | 'left' | 'right';
|
|
defaultOpen?: boolean;
|
|
disablePreventScroll?: boolean;
|
|
repositionInputs?: boolean;
|
|
snapToSequentialPoint?: boolean;
|
|
container?: HTMLElement | null;
|
|
onAnimationEnd?: (open: boolean) => void;
|
|
preventScrollRestoration?: boolean;
|
|
autoFocus?: boolean;
|
|
} & (WithFadeFromProps | WithoutFadeFromProps);
|
|
declare function Root({ open: openProp, onOpenChange, children, onDrag: onDragProp, onRelease: onReleaseProp, snapPoints, shouldScaleBackground, setBackgroundColorOnScale, closeThreshold, scrollLockTimeout, dismissible, handleOnly, fadeFromIndex, activeSnapPoint: activeSnapPointProp, setActiveSnapPoint: setActiveSnapPointProp, fixed, modal, onClose, nested, noBodyStyles, direction, defaultOpen, disablePreventScroll, snapToSequentialPoint, preventScrollRestoration, repositionInputs, onAnimationEnd, container, autoFocus, }: DialogProps): React.JSX.Element;
|
|
declare const Overlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
type ContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
|
|
declare const Content: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
type HandleProps = React.ComponentPropsWithoutRef<'div'> & {
|
|
preventCycle?: boolean;
|
|
};
|
|
declare const Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
preventCycle?: boolean;
|
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
declare function NestedRoot({ onDrag, onOpenChange, ...rest }: DialogProps): React.JSX.Element;
|
|
type PortalProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>;
|
|
declare function Portal(props: PortalProps): React.JSX.Element;
|
|
declare const Drawer: {
|
|
Root: typeof Root;
|
|
NestedRoot: typeof NestedRoot;
|
|
Content: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
Overlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
Trigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
Portal: typeof Portal;
|
|
Handle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
preventCycle?: boolean;
|
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
Close: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
Title: React.ForwardRefExoticComponent<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
Description: React.ForwardRefExoticComponent<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
};
|
|
|
|
export { Content, type ContentProps, type DialogProps, Drawer, Handle, type HandleProps, NestedRoot, Overlay, Portal, Root, type WithFadeFromProps, type WithoutFadeFromProps };
|