@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
74 lines (73 loc) • 2.17 kB
TypeScript
import { LoadingScheme, ThemeConfig } from "../../core/system/index.types.js";
import "../../core/index.js";
import * as react822 from "react";
import { FC, PropsWithChildren, ReactNode } from "react";
//#region src/components/loading/loading-provider.d.ts
interface LoadingMethods {
/**
* Function to finish loading.
*/
finish: () => void;
/**
* Function to forcefully update the loading state.
*
* Please be careful, as it will forcefully overwrite the state of the loading component.
*/
force: (state: Partial<LoadingState>) => void;
/**
* Function to start loading.
*
* If you specify a `message` etc. as an argument, the loading will change accordingly.
*/
start: (options?: LoadingOptions) => void;
/**
* Function to update loading.
*
* If you specify a `message` etc. as an argument, the loading will change accordingly.
*/
update: (options: LoadingOptions) => void;
}
interface LoadingOptions {
duration?: null | number;
loadingScheme?: LoadingScheme;
message?: ReactNode;
}
interface LoadingState {
duration: null | number;
loadingCount: number;
loadingScheme: LoadingScheme;
message: ReactNode | undefined;
}
interface LoadingContext {
/**
* The background loading methods.
*/
background: LoadingMethods;
/**
* The page loading methods.
*/
page: LoadingMethods;
/**
* The screen loading methods.
*/
screen: LoadingMethods;
}
declare const LoadingContext: react822.Context<LoadingContext>;
interface LoadingProviderProps extends PropsWithChildren<ThemeConfig["loading"]> {}
declare const LoadingProvider: FC<LoadingProviderProps>;
interface LoadingSharedProps {
duration: null | number;
loadingScheme: LoadingScheme;
message: ReactNode | undefined;
onFinish: () => void;
initial?: boolean | string;
}
/**
* `useLoading` is a custom hook for controlling the loading of the application.
*
* @see https://yamada-ui.com/docs/hooks/use-loading
*/
declare const useLoading: () => LoadingContext;
//#endregion
export { LoadingOptions, LoadingProvider, LoadingProviderProps, LoadingSharedProps, useLoading };
//# sourceMappingURL=loading-provider.d.ts.map