import type { WidgetProps } from '../../../../domains/widgets/components/widget/types.js'; import type { DashboardPersistenceManager } from '../../persistence/types.js'; /** Options for the widget renaming middleware hook. */ export type UseWidgetRenamingParams = { /** Current widgets. */ widgets: WidgetProps[]; /** When false, returns widgets unchanged (no config.header.title.editing.enabled, no persistence wrap). */ enabled?: boolean; /** When provided, persists widget renames to the server on title/changed. */ persistence?: Pick; }; /** Output of the widget renaming middleware. */ export type WidgetRenamingOutput = { widgets: WidgetProps[]; }; /** * Middleware hook that enables widget-level rename UI and optionally persists renames. * Sets config.header.title.editing.enabled on each widget so ChartWidget/PivotTableWidget show rename UI. * When persistence is set, wraps widget onChange to call patchWidget on title/changed * before forwarding to the change-detection layer. * * @param options - Options containing widgets, enabled flag, and optional persistence. * @returns Widgets with config.header.title.editing.enabled and optionally wrapped onChange. * * @example * ```ts * const { widgets: widgetsWithRename } = useWidgetRenaming({ * widgets: widgetsWithDuplicate, * enabled: true, * persistence, * }); * ``` */ export declare function useWidgetRenaming(params: UseWidgetRenamingParams): WidgetRenamingOutput;