import { css, cx } from '@fuel-ui/css'; import type { ToasterProps } from 'react-hot-toast'; import toast, { ToastBar, Toaster as Root } from 'react-hot-toast'; import { createComponent } from '../../utils'; import { IconButton } from '../IconButton'; export type ToastProps = ToasterProps; export const ToastProvider = createComponent( ({ className, position = 'bottom-right', ...props }) => { const classes = cx('fuel_Toast', className, styles.root()); return ( {(t) => ( {({ icon, message }) => (
{icon} {message} {t.type !== 'loading' && ( toast.dismiss(t.id)} /> )}
)}
)}
); }, ); export { toast }; const DEFAULT_STYLE = { padding: 0, boxShadow: 'none', borderRadius: '0', background: 'transparent', }; const styles = { root: css({ layer: 'layer-overlay', px: '$4', py: '$3', display: 'flex', alignItems: 'center', gap: '$4', color: '$overlayText', '& div[role="status"]': { m: '0', display: '-webkit-box', maxWidth: 200, lineClamp: 6, WebkitLineClamp: 6, WebkitBoxOrient: 'vertical', overflow: 'hidden', }, '.fuel_Icon[aria-label="Icon X"]': { color: '$overlayText', }, }), closeButton: css({ alignSelf: 'flex-start', }), };