@kadconsulting/dry
Version:
KAD Reusable Component Library
42 lines (41 loc) • 1.41 kB
TypeScript
/// <reference types="react" />
import { ButtonProps } from '../Button/ButtonTypes';
export type ToastType = 'success' | 'error' | 'warning' | 'info';
export type ToastPosition = 'top-left' | 'top-right' | 'top-right-plus-60' | 'bottom-left' | 'bottom-right' | 'center';
export type ToastLayout = 'vertical' | 'horizontal';
export interface ToastProps {
/** Support @testing-library/react `screen.getByTestId` */
'data-testid'?: string;
message: string;
type?: ToastType;
duration?: number;
onClose?: () => void;
className?: string;
actions?: React.ReactNode;
additionalText?: string;
additionalButtons?: ButtonProps[];
position?: ToastPosition;
layout?: ToastLayout;
easing?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out';
animationDuration?: number;
backgroundColor?: string;
textColor?: string;
borderRadius?: string;
boxShadow?: string;
closable?: boolean;
persistent?: boolean;
onAppearing?: () => void;
onAppeared?: () => void;
onDisappearing?: () => void;
onDisappeared?: () => void;
onClickOutside?: () => void;
onSwipeLeft?: () => void;
onSwipeRight?: () => void;
onSwipeUp?: () => void;
onSwipeDown?: () => void;
}
export interface ToastGroupProps extends Omit<ToastProps, 'position' | 'layout'> {
position?: ToastPosition;
layout?: ToastLayout;
spacing?: number;
}