UNPKG

@wordpress/block-editor

Version:
53 lines (52 loc) 1.48 kB
// packages/block-editor/src/components/inspector-controls/slot.js import { __experimentalUseSlotFills as useSlotFills } from "@wordpress/components"; import warning from "@wordpress/warning"; import deprecated from "@wordpress/deprecated"; import BlockSupportToolsPanel from "./block-support-tools-panel"; import BlockSupportSlotContainer from "./block-support-slot-container"; import groups from "./groups"; import { jsx } from "react/jsx-runtime"; function InspectorControlsSlot({ __experimentalGroup, group = "default", label, fillProps, ...props }) { if (__experimentalGroup) { deprecated( "`__experimentalGroup` property in `InspectorControlsSlot`", { since: "6.2", version: "6.4", alternative: "`group`" } ); group = __experimentalGroup; } const slotFill = groups[group]; const fills = useSlotFills(slotFill?.name); if (!slotFill) { warning(`Unknown InspectorControls group "${group}" provided.`); return null; } if (!fills?.length) { return null; } const { Slot } = slotFill; if (label) { return /* @__PURE__ */ jsx(BlockSupportToolsPanel, { group, label, children: /* @__PURE__ */ jsx( BlockSupportSlotContainer, { ...props, fillProps, Slot } ) }); } return /* @__PURE__ */ jsx(Slot, { ...props, fillProps, bubblesVirtually: true }); } export { InspectorControlsSlot as default }; //# sourceMappingURL=slot.js.map