UNPKG

@grandlinex/react-components

Version:
47 lines (46 loc) 2.06 kB
import { TabItem, WCMode } from '../layouts/TabLayout/lib/index'; export declare function useQData<T>(q: () => Promise<T | null>, init?: T | undefined): [T | null | undefined, (dat: T | null | undefined) => void, () => void]; /** * * @param q - Query function * @param init - Initial value * @return [state, isPending, refresh] */ export declare function useQData19<T>(q: () => Promise<T | null>, init?: Awaited<T | undefined>): [T | null | undefined, boolean, () => void]; export declare function useAsync<T>(callback: () => Promise<T>, dependencies?: any[]): [T | undefined, boolean, any]; export declare function useAutoClose<T extends HTMLElement>(closeFc: () => void, disabeld: boolean, extendSearch?: string): import("react").RefObject<T | null>; export declare function useAutoClose18<T extends HTMLElement>({ extendSearch, closeFc, init, noScip, }: { extendSearch?: string; closeFc?: () => void; init?: boolean; noScip?: boolean; }): [React.RefObject<T | null>, boolean, (x: boolean) => void]; export declare function useTabStore(): { tabState: { currentTabRight: number; currentTabLeft: number; tabsLeft: TabItem[]; tabsRight: TabItem[]; panel: string | null; }; addTab: (el: TabItem, pos: "left" | "right") => void; closeTab: (el: string, pos: "left" | "right") => void; moveTab: (key: string, dest: WCMode, target: WCMode, position?: number) => void; setCurrentTab: (index: number, pos: "left" | "right") => void; setPanel: import("react").Dispatch<import("react").SetStateAction<string | null>>; reset: () => void; }; export type TStore = ReturnType<typeof useTabStore>; /** * primary {string} Primary key 'ctrl' | 'shift' | 'alt' | 'meta' * secondary {string} Key code */ export type KeyBind = { key: { primary: 'ctrl' | 'shift' | 'alt' | 'meta'; secondary: string; }; action: () => void; }; export declare function useKeyListener(binds: KeyBind[]): void; export declare function usePathQueryMap(): Map<string, string>;