@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
35 lines • 1.61 kB
text/typescript
import { IconAlign, IconSpaceMode } from "../../Menu/renderUtils.mjs";
import "../../Menu/index.mjs";
import { ContextMenuItem } from "./type.mjs";
import "./renderItems.mjs";
import { ReactNode } from "react";
import "@floating-ui/react";
//#region src/base-ui/ContextMenu/store.d.ts
interface ShowContextMenuOptions {
footer?: ReactNode;
header?: ReactNode;
iconAlign?: IconAlign;
iconSpaceMode?: IconSpaceMode;
}
interface ContextMenuInterceptor {
close?: (fallback: () => void) => void;
show?: (items: ContextMenuItem[], options: ShowContextMenuOptions | undefined, fallback: () => void) => void;
}
/**
* Register a global interceptor for every context menu — imperative
* `showContextMenu`/`closeContextMenu` calls and `ContextMenuTrigger` alike.
* The interceptor may render the menu through another system (e.g. a native
* OS menu) or invoke `fallback()` to show the default web menu. Pass `null`
* to restore the default behavior.
*/
declare const setContextMenuInterceptor: (next: ContextMenuInterceptor | null) => void;
declare const showContextMenu: (items: ContextMenuItem[], options?: ShowContextMenuOptions) => void;
/**
* Update menu items while keeping current anchor/position.
* Useful for interactive menu items (e.g. checkbox) to avoid re-positioning.
*/
declare const updateContextMenuItems: (items: ContextMenuItem[]) => void;
declare const closeContextMenu: () => void;
//#endregion
export { ContextMenuInterceptor, ShowContextMenuOptions, closeContextMenu, setContextMenuInterceptor, showContextMenu, updateContextMenuItems };
//# sourceMappingURL=store.d.mts.map