import * as React from 'react'; interface CommandOptions { history?: History; } declare class Command { perform: (...args: any) => any; private historyItem?; history?: { undo: History["undo"]; redo: History["redo"]; }; constructor(command: { perform: Command["perform"]; }, options?: CommandOptions); } interface ActionImplOptions { store: ActionStore; ancestors?: ActionImpl[]; history?: History; } declare class ActionImpl implements Action { id: Action["id"]; name: Action["name"]; shortcut: Action["shortcut"]; keywords: Action["keywords"]; section: Action["section"]; icon: Action["icon"]; subtitle: Action["subtitle"]; parent?: Action["parent"]; item?: Action["item"]; kind?: Action["kind"]; /** * @deprecated use action.command.perform */ perform: Action["perform"]; priority: number; command?: Command; ancestors: ActionImpl[]; children: ActionImpl[]; constructor(action: Action, options: ActionImplOptions); addChild(childActionImpl: ActionImpl): void; removeChild(actionImpl: ActionImpl): void; get parentActionImpl(): ActionImpl; static create(action: Action, options: ActionImplOptions): ActionImpl; } type ActionId = string; type Priority = number; type ActionSection = string | { name: string; priority: Priority; }; type Action = { id: ActionId; name: string; shortcut?: string[]; keywords?: string; section?: ActionSection; icon?: string | React.ReactElement | React.ReactNode; subtitle?: string; perform?: (currentActionImpl: ActionImpl) => any; parent?: ActionId; priority?: Priority; item?: any; kind?: string; }; type ActionStore = Record; type ActionTree = Record; interface ActionGroup { name: string; actions: ActionImpl[]; } interface KBarOptions { animations?: { enterMs?: number; exitMs?: number; }; callbacks?: { onOpen?: () => void; onClose?: () => void; onQueryChange?: (searchQuery: string) => void; onSelectAction?: (action: ActionImpl) => void; }; /** * `disableScrollBarManagement` ensures that kbar will not * manipulate the document's `margin-right` property when open. * By default, kbar will add additional margin to the document * body when opened in order to prevent any layout shift with * the appearance/disappearance of the scrollbar. */ disableScrollbarManagement?: boolean; /** * `disableDocumentLock` disables the "document lock" functionality * of kbar, where the body element's scrollbar is hidden and pointer * events are disabled when kbar is open. This is useful if you're using * a custom modal component that has its own implementation of this * functionality. */ disableDocumentLock?: boolean; enableHistory?: boolean; /** * `toggleShortcut` enables customizing which keyboard shortcut triggers * kbar. Defaults to "$mod+k" (cmd+k / ctrl+k) */ toggleShortcut?: string; /** * `enableToggleShortcut` enables the keyboard shortcut for toggling kbar. */ enableToggleShortcut?: boolean; /** * defaultShow will cause kbar to be open by default when the component * */ defaultShow?: boolean; } interface KBarProviderProps { actions?: Action[]; options?: KBarOptions; } interface KBarState { searchQuery: string; visualState: VisualState; actions: ActionTree; currentRootActionId?: ActionId | null; activeIndex: number; disabled: boolean; } interface KBarQuery { setCurrentRootAction: (actionId?: ActionId | null) => void; setVisualState: (cb: ((vs: VisualState) => VisualState) | VisualState) => void; setSearch: (search: string) => void; registerActions: (actions: Action[]) => () => void; toggle: () => void; setActiveIndex: (cb: number | ((currIndex: number) => number)) => void; inputRefSetter: (el: HTMLInputElement) => void; getInput: () => HTMLInputElement; disable: (disable: boolean) => void; } interface IKBarContext { getState: () => KBarState; query: KBarQuery; subscribe: (collector: (state: KBarState) => C, cb: (collected: C) => void) => void; options: KBarOptions; } declare enum VisualState { animatingIn = "animating-in", showing = "showing", animatingOut = "animating-out", hidden = "hidden" } interface HistoryItem { perform: () => any; negate: () => any; } interface History { undoStack: HistoryItem[]; redoStack: HistoryItem[]; add: (item: HistoryItem) => HistoryItem; remove: (item: HistoryItem) => void; undo: (item?: HistoryItem) => void; redo: (item?: HistoryItem) => void; reset: () => void; } export { type ActionId as A, Command as C, type HistoryItem as H, type IKBarContext as I, type KBarOptions as K, type Priority as P, VisualState as V, type ActionSection as a, type Action as b, type ActionStore as c, type ActionTree as d, type ActionGroup as e, type KBarProviderProps as f, type KBarState as g, type KBarQuery as h, type History as i, ActionImpl as j };