@elacity-js/uikit
Version:
React / Material UI Design kit for Elacity project
36 lines (35 loc) • 1.3 kB
TypeScript
import React from 'react';
import { FormikErrors, FormikHelpers } from 'formik';
import { Breakpoint } from '@mui/material/styles';
interface ProgressState {
value?: number;
label?: string | null;
}
interface ProgressUtil extends ProgressState {
set: (label: string | null, value?: number) => void;
}
export interface ModalOptionsProps<FormDataShape = any> {
title?: string;
maxWidth?: Breakpoint;
centerActions?: boolean;
okLabel?: string;
onOk?: (values: FormDataShape, helpers?: FormikHelpers<FormDataShape>) => Promise<void> | void;
Component: React.ComponentType;
formData?: FormDataShape;
formValidator?: (values: FormDataShape) => void | Promise<FormikErrors<FormDataShape>>;
withProgress?: boolean;
progress?: ProgressUtil;
withoutLogo?: boolean;
ActionsWrapper?: React.ComponentType<React.PropsWithChildren>;
additionalActions?: React.ReactNode;
}
export interface ModalContextValue {
openModal: <T>(options: ModalOptionsProps<T>) => void;
updateProgress?: ProgressUtil['set'];
closeModal?: () => void;
}
declare const ModalContext: React.Context<ModalContextValue>;
interface ModalProviderProps {
}
export declare const ModalProvider: React.FC<React.PropsWithChildren<ModalProviderProps>>;
export default ModalContext;