UNPKG

@wordpress/components

Version:
42 lines (39 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports.ToolsPanelItem = void 0; var _hook = require("./hook"); var _view = require("../../view"); var _context = require("../../context"); var _jsxRuntime = require("react/jsx-runtime"); /** * External dependencies */ /** * Internal dependencies */ // This wraps controls to be conditionally displayed within a tools panel. It // prevents props being applied to HTML elements that would make them invalid. const UnconnectedToolsPanelItem = (props, forwardedRef) => { const { children, isShown, shouldRenderPlaceholder, ...toolsPanelItemProps } = (0, _hook.useToolsPanelItem)(props); if (!isShown) { return shouldRenderPlaceholder ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_view.View, { ...toolsPanelItemProps, ref: forwardedRef }) : null; } return /*#__PURE__*/(0, _jsxRuntime.jsx)(_view.View, { ...toolsPanelItemProps, ref: forwardedRef, children: children }); }; const ToolsPanelItem = exports.ToolsPanelItem = (0, _context.contextConnect)(UnconnectedToolsPanelItem, 'ToolsPanelItem'); var _default = exports.default = ToolsPanelItem; //# sourceMappingURL=component.js.map