UNPKG

@etsoo/react

Version:

TypeScript ReactJs UI Independent Framework

144 lines (143 loc) 3.8 kB
import React from "react"; import { INotificaseBase, INotification, INotifier, Notification, NotificationAlign, NotificationCallProps, NotificationContainer, NotificationRenderProps } from "@etsoo/notificationbase"; import { IAction } from "@etsoo/appscript"; import { IProviderProps } from "../states/IState"; /** * React notification call props */ export interface NotificationReactCallProps extends NotificationCallProps { /** * Full width */ fullWidth?: boolean; /** * Full screen */ fullScreen?: boolean; /** * Inputs layout */ inputs?: React.ReactNode; /** * Max width */ maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | false; /** * OK label */ okLabel?: string; /** * false to hide cancel button */ cancelButton?: boolean; /** * Cancel label */ cancelLabel?: string; /** * Window is closable */ closable?: boolean; /** * Draggable */ draggable?: boolean; /** * Type */ type?: string; /** * false to hide primary button */ primaryButton?: boolean; /** * Primary button props */ primaryButtonProps?: {}; /** * Buttons to override default buttons */ buttons?: (notification: INotificationReact, callback: (event: React.MouseEvent<HTMLButtonElement>, value?: any) => Promise<boolean>) => React.ReactNode; } /** * React notification interface */ export interface INotificationReact extends INotification<React.ReactNode, NotificationReactCallProps> { } /** * React notification base interface */ export interface INotificationBaseReact extends INotificaseBase<React.ReactNode, NotificationReactCallProps> { } /** * Action to manage the notifier */ interface INotifierAction extends IAction { /** * Notification */ notification: INotificationReact; /** * Add or dismiss */ dismiss: boolean; } /** * React notification */ export declare abstract class NotificationReact extends Notification<React.ReactNode, NotificationReactCallProps> implements INotificationReact { } /** * React notification render props */ export interface NotificationReactRenderProps extends NotificationRenderProps, IProviderProps<INotifierAction> { } /** * Notifier interface */ export interface INotifierReact extends INotifier<React.ReactNode, NotificationReactCallProps> { /** * Create state provider * @param className Style class name * @param debug Is debug mode * @returns Provider */ createProvider(className?: string, debug?: boolean): React.FunctionComponent<NotificationReactRenderProps>; } /** * Notifier for React */ export declare abstract class NotifierReact extends NotificationContainer<React.ReactNode, NotificationReactCallProps> implements INotifierReact { private static _instance; /** * Singleton instance */ static get instance(): INotifierReact; /** * Update notifier * @param notifier Notifier */ protected static updateInstance(notifier: INotifierReact): void; /** * Constructor */ protected constructor(); /** * State update */ protected stateUpdate?: React.Dispatch<INotifierAction>; /** * Create align container * @param align Align * @param children Children * @param options Other options */ protected abstract createContainer(align: NotificationAlign, children: React.ReactNode[]): React.ReactElement; /** * Create state provider * @param className Style class name * @returns Provider */ createProvider(className?: string, debug?: boolean): React.FunctionComponent<React.PropsWithChildren<NotificationReactRenderProps>>; } export {};