import { ReactNode } from 'react'; import { SlotClassNames, SlotStyles } from '../types/slots.types.js'; import { ColorValue } from '../themeProvider/color.types.js'; export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'; export type ToastSlots = 'root' | 'icon' | 'content' | 'closeButton' | 'progressBar'; /** Text Toast renders of its own, for translating it. */ export interface ToastLabels { /** The dismiss button, read out by screen readers. */ close?: string; } export interface ToastContextConfig { position?: ToastPosition; /** Duration in ms. 0 = persistent. */ duration?: number; showRemainingTime?: boolean; showCloseButton?: boolean; /** Whether multiple toasts can be visible simultaneously. */ allowStacking?: boolean; /** Pause the auto-dismiss timer while the toast is hovered or focused. */ pauseOnHover?: boolean; /** * Overrides the text a toast renders of its own. Set in `AhroweProvider`'s * `toast` for the whole app, or per toast through `showToast` options. */ labels?: ToastLabels; } export interface ToastOptions extends Omit { /** * A `ThemeColor` (default `Primary`) or any CSS colour. A ThemeColor also picks the icon; any * other colour shows a bell. */ color?: ColorValue; classNames?: SlotClassNames; styles?: SlotStyles; } export interface ToastHostProps extends ToastContextConfig { children: ReactNode; } export interface ToastItem extends Pick { id: string; content: ReactNode; options: ResolvedToastOptions; dismissing: boolean; } export interface ResolvedToastOptions { position: ToastPosition; duration: number; showRemainingTime: boolean; showCloseButton: boolean; pauseOnHover: boolean; color: ColorValue; classNames?: SlotClassNames; styles?: SlotStyles; }