@wordpress/widget-dashboard
Version:
Stateless rendering engine for widget dashboards: the WidgetDashboard compound component and its grid-settings kit.
33 lines • 1.29 kB
TypeScript
import type { ReactNode } from 'react';
interface DashboardUIContextValue {
inserterOpen: boolean;
setInserterOpen: (next: boolean) => void;
resetDialogOpen: boolean;
setResetDialogOpen: (next: boolean) => void;
/**
* `uuid` of the instance whose settings drawer is open, or `null`
* when no settings drawer is showing. The per-instance gear in the
* chrome sets it; the single `WidgetSettings` at the root reads
* it.
*/
settingsWidgetUuid: string | null;
setSettingsWidgetUuid: (next: string | null) => void;
}
/**
* Accesses the shared UI state: overlay open flags and the active settings
* instance with its placement. Throws when called outside `WidgetDashboard`.
*/
export declare function useDashboardUIContext(): DashboardUIContextValue;
interface ProviderProps {
children: ReactNode;
}
/**
* Holds transient UI state shared across compounds (the inserter modal and
* the per-instance settings drawer). Kept separate from the data context so
* that data mutations don't churn the UI state and vice-versa.
*
* @param {ProviderProps} props Component props.
*/
export declare function WidgetDashboardUIProvider({ children }: ProviderProps): import("react").JSX.Element;
export {};
//# sourceMappingURL=ui-context.d.ts.map