UNPKG

@gechiui/block-editor

Version:
51 lines (44 loc) 1.54 kB
import { createElement } from "@gechiui/element"; /** * External dependencies */ import { isEmpty } from 'lodash'; /** * GeChiUI dependencies */ import { __experimentalStyleProvider as StyleProvider, __experimentalToolsPanelContext as ToolsPanelContext } from '@gechiui/components'; import warning from '@gechiui/warning'; /** * Internal dependencies */ import useDisplayBlockControls from '../use-display-block-controls'; import groups from './groups'; export default function InspectorControlsFill(_ref) { var _groups$group; let { __experimentalGroup: group = 'default', children } = _ref; const isDisplayed = useDisplayBlockControls(); const Fill = (_groups$group = groups[group]) === null || _groups$group === void 0 ? void 0 : _groups$group.Fill; if (!Fill) { typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" ? warning(`Unknown InspectorControl group "${group}" provided.`) : void 0; return null; } if (!isDisplayed) { return null; } return createElement(StyleProvider, { document: document }, createElement(Fill, null, fillProps => { // Children passed to InspectorControlsFill will not have // access to any React Context whose Provider is part of // the InspectorControlsSlot tree. So we re-create the // Provider in this subtree. const value = !isEmpty(fillProps) ? fillProps : null; return createElement(ToolsPanelContext.Provider, { value: value }, children); })); } //# sourceMappingURL=fill.js.map