import React, { Component } from 'react'; import { TextLinkProps } from '@contentful/f36-text-link'; import { CommonProps } from '@contentful/f36-core'; interface NotificationCta { label: string; textLinkProps: Partial; } type NotificationVariant = 'positive' | 'negative' | 'warning' | 'primary'; type Placement = 'top' | 'bottom'; interface NotificationProps { id: string | number; text: string; onClose: () => void; duration?: number; withClose: boolean; isShown: boolean; variant: NotificationVariant; title?: string; cta?: Partial; } type ShowAction = (text: string, setting?: { variant: NotificationVariant; id?: string; duration?: number; withClose?: boolean; title?: string; cta?: Partial; }) => T; type CloseAction = (id: string | number) => T; type CloseAllAction = () => T; type SetDurationAction = (duration: number) => T; type SetPlacementAction = (placement: Placement, params?: { offset: number; }) => T; interface NotificationsManagerProps { register: (name: K, callback: NotificationsAPI[K]) => void; onReady?: () => void; } declare const NotificationsManager: { ({ register, onReady, }: NotificationsManagerProps): React.ReactElement; displayName: string; }; interface NotificationsAPI { success: ShowAction; error: ShowAction; show: ShowAction; close: CloseAction; closeAll: CloseAllAction; setPlacement: SetPlacementAction; setDuration: SetDurationAction; cleanup: () => void; } type ExternalShowAction = (text: string, settings?: { duration?: number; withClose?: boolean; id?: string; title?: string; cta?: Partial; }) => T; declare const Notification: { success: ExternalShowAction>; error: ExternalShowAction>; warning: ExternalShowAction>; info: ExternalShowAction>; close: CloseAction>; closeAll: CloseAllAction>; setPlacement: SetPlacementAction>; setDuration: SetDurationAction>; cleanup: () => Promise; }; interface NotificationItemProps extends CommonProps { /** * Defines the styling of notification * @default positive */ variant?: NotificationVariant; /** * @deprecated This prop no longer has any effect as Notifications must always have a close button. The prop will be removed in the next major release. */ withCloseButton?: boolean; /** * Aria label for close button * @default 'Dismiss' */ closeButtonAriaLabel?: string; /** * Function that will be triggered when close button is clicked */ onClose?: () => void; /** * Title of the notification */ title?: string; /** * Content of the notification */ children: React.ReactNode; /** * Label and text-link props of the CTA */ cta?: Partial; } declare const NotificationItem: React.ForwardRefExoticComponent>; interface NotificationItemContainerProps extends NotificationItemProps { duration?: number; isShown?: boolean; } interface NotificationItemContainerState { isShown: boolean; } declare class NotificationItemContainer extends Component { static defaultProps: Partial; displayName: 'NotificationItemContainer'; timer: number | null; state: { isShown: boolean; }; componentDidMount(): void; componentDidUpdate(prevProps: NotificationItemContainerProps): void; componentWillUnmount(): void; startTimer: () => void; stopTimer: () => void; handleClose: () => void; handleMouseEnter: () => void; handleMouseLeave: () => void; render(): React.JSX.Element; } export { Notification, NotificationItem, NotificationItemContainer, type NotificationItemContainerProps, type NotificationItemProps, type NotificationProps, type NotificationVariant, type NotificationsAPI, NotificationsManager, type NotificationsManagerProps };