UNPKG

@patreon/studio

Version:

Patreon Studio Design System

26 lines (25 loc) 875 B
import type { ContentBuilder, ToastProps } from './types'; export interface ToastData extends Pick<ToastProps, 'action' | 'data-tag' | 'duration' | 'isClosing'> { contentBuilder: ContentBuilder; id: number; key: string; } type PartialToastWithIdOrKey = Partial<ToastData> & (Pick<ToastData, 'id'> | Pick<ToastData, 'key'>); interface ReducerActionAdd { type: 'add'; payload: ToastData; } interface ReducerActionUpdate { type: 'update'; payload: PartialToastWithIdOrKey; } interface ReducerActionRemove { type: 'remove'; payload: PartialToastWithIdOrKey; } interface ReducerActionCloseAll { type: 'closeAll'; } type ToastReducerAction = ReducerActionAdd | ReducerActionUpdate | ReducerActionRemove | ReducerActionCloseAll; export declare const toasterReducer: (state: ToastData[], action: ToastReducerAction) => ToastData[]; export {};