@ducor/react
Version:
admin template ui interface
31 lines (30 loc) • 1.07 kB
TypeScript
import { ReactNode, ReactElement } from "react";
export interface LoadingOptions {
duration?: null | number;
message?: ReactNode | undefined;
}
interface LoadingState {
duration: null | number;
loadingCount: number;
message: ReactNode | undefined;
timeoutId: ReturnType<typeof setTimeout> | null;
}
export interface LoadingContextState {
background: React.RefObject<LoadingRefState>;
page: React.RefObject<LoadingRefState>;
screen: React.RefObject<LoadingRefState>;
}
export declare const LoadingContext: import("react").Context<LoadingContextState | undefined>;
export type LoadingRefState = {
isLoading: boolean;
start: (options?: LoadingOptions) => void;
update: (options?: LoadingOptions) => void;
finish: () => void;
force: (state: Partial<LoadingState>) => void;
} & LoadingState;
interface LoadingProviderProps {
children?: ReactNode | ReactElement;
defaultLoading?: "screen" | "page" | "background";
}
declare const LoadingProvider: React.FC<LoadingProviderProps>;
export default LoadingProvider;