import React from 'react'; import { RouteObject, Params, Location, NavigateFunction } from 'react-router-dom'; import { Theme } from '../providers/theme'; export declare namespace Hook { /*************************************** PROVIDER ***************************************/ interface ProviderProps { routes?: Routes; dialogs?: DialogComponent[]; children?: React.ReactNode | React.ReactNode[] | any; } export const Provider: React.FC; /**************************************** DIALOG ****************************************/ type DialogComponentProps = P & { open?: boolean; data: D; onClose?: DialogCallback; }; export interface DialogCallbackEvent { data: D; rejected?: boolean; } export type DialogCallback = (event: DialogCallbackEvent) => void; export type DialogComponent = React.ComponentType>; export function Dialog(dialog: (props: DialogComponentProps, context?: any) => React.ReactElement | null): { (props: DialogComponentProps, context?: any): React.ReactElement | null; open: (data: D, callback?: DialogCallback) => void; close: () => void; }; export interface Event { id: T; } export function createEvent(): Event; export function sendEvent(context: Event, value: T): void; export function useEvent(context: Event, callback: (value: T) => void): void; export interface CrossStateContext { id: T; } export function createCrossState(defaultValue?: T): CrossStateContext; export function crossState(context: CrossStateContext): { getValue: () => T; setValue: (newValue: T) => void; }; export function useCrossState(context: CrossStateContext): [T, (value: T) => void]; export function useRefresh(): [() => void]; /**************************************** THEMES ****************************************/ export function useTheme(): [Theme, (name: string) => void]; /************************************* LOCALIZATION *************************************/ export function useLanguage(): [string, (lan: string) => void]; export function useLocalization(texts: { [language: string]: T; }): [T, string, (language: string) => void]; export const Loading: React.FC<{}>; export function loading(): { start: () => void; stop: () => void; }; /**************************************** ROUTES ****************************************/ export interface RouteMenu { space?: boolean; icon: React.FC; sidebar?: React.FC; } export interface Route { menu?: RouteMenu; admin?: boolean; component: React.FC; children?: { [path: string]: Route; }; } export interface Routes { guard?: (path: string) => Promise | string; labels?: { [lan: string]: { [path: string]: string; }; }; children?: { [path: string]: Route; }; } export function createRoutes(routes: Routes): RouteObject[]; export function getVisibleRoutes(routes: Routes, isVisible: (path: string, route?: Route) => boolean): Routes; export function isValidPath(routes: Routes, path: string): boolean; export function getCrumbroad(routes: Routes): string; export function useRouter(): [Location & { params: Readonly>; }, NavigateFunction]; /************************************** DIMENSIONS **************************************/ export const useDimensions: (excludePadding?: boolean) => any[]; /*********************************** SCROLL POSITION ************************************/ export type ScrollPosition = { x: number; y: number; w: number; h: number; c: { w: number; h: number; }; }; export const DefaultScrollPosition: ScrollPosition; type ScrollPositionEffect = (params: { previous: ScrollPosition; current: ScrollPosition; }) => void; export const useScrollPosition: (element: any, handler?: ScrollPositionEffect, debounce?: number, deps?: any[]) => ScrollPosition; /*************************************** DEBOUNCE ***************************************/ export function useDebounce void>(callback: T, delay: number, deps: React.DependencyList): T; export {}; } export default Hook; //# sourceMappingURL=index.d.ts.map