@atlrdsgn/kit
Version:
An ever–expanding library of React components, primitives, and tools
86 lines (85 loc) • 3.13 kB
TypeScript
import { default as React } from 'react';
import * as TST from '@radix-ui/react-toast';
type ToastVPProps = React.ComponentProps<typeof TST.Viewport> & {
className?: string;
asChild?: boolean;
/**
* The keys to use as the keyboard shortcut that
* will move focus to the toast viewport.
*
* Use `event.code` value for each key from `keycode.info`.
*
* For meta keys, use ctrlKey, shiftKey, altKey and/or metaKey.
*/
hotkey?: string[];
/**
* An author-localized label for the toast region to provide context
* for screen reader users when navigating page landmarks.
* The available `{hotkey}` placeholder will be replaced for you.
*/
label?: string;
};
interface ToastProviderProps {
/**
* The time in milliseconds that should
* elapse before automatically closing each toast.
*/
duration?: number;
label: string;
/**
* The direction of the pointer swipe that
* should close the toast.
*/
swipeDirection?: 'right' | 'left' | 'up' | 'down';
/**
* The distance in pixels that the swipe gesture
* must travel before a close is triggered.
*/
swipeThreshold?: number;
}
interface ToastRootProps {
className?: string;
asChild?: boolean;
type?: 'foreground' | 'background';
duration?: number;
defaultOpen?: boolean;
open?: boolean;
onOpenChange?: (() => void) | ((open: boolean) => void);
onEscapeKeyDown?: () => void;
onPause?: () => void;
onResume?: () => void;
onSwipeStart?: () => void;
onSwipeMove?: () => void;
onSwipeEnd?: () => void;
forceMount?: boolean;
}
export type ToastProps = ToastRootProps & ToastProviderProps & ToastVPProps & React.ComponentProps<typeof TST.Root>;
type ToastTitleProps = React.HTMLAttributes<HTMLDivElement> & {
className?: string;
children: React.ReactNode;
};
declare const ToastTitle: React.FC<ToastTitleProps>;
type ToastDescriptionProps = React.HTMLAttributes<HTMLParagraphElement> & {
className?: string;
children: React.ReactNode;
};
declare const ToastDescription: React.FC<ToastDescriptionProps>;
declare const ToastAction: React.ForwardRefExoticComponent<Omit<TST.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
type ToastContentProps = React.HTMLAttributes<HTMLDivElement> & {
className?: string;
children: React.ReactNode;
};
declare const ToastContent: React.FC<ToastContentProps>;
declare const ToastClose: React.ForwardRefExoticComponent<Omit<TST.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
/** ----------------- exports --- */
export declare const Toast: React.FC<ToastProps> & {
Title: typeof ToastTitle;
Description: typeof ToastDescription;
Content: typeof ToastContent;
Action: typeof ToastAction;
Close: typeof ToastClose;
};
export type ToastActionElement = React.ReactElement<typeof ToastAction>;
export type ToastPrimitive = React.ComponentProps<typeof Toast>;
export {};
//# sourceMappingURL=toast.d.ts.map