UNPKG

@wordpress/block-editor

Version:
70 lines (66 loc) 2.41 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _clsx = _interopRequireDefault(require("clsx")); var _components = require("@wordpress/components"); var _i18n = require("@wordpress/i18n"); var _icons = require("@wordpress/icons"); var _jsxRuntime = require("react/jsx-runtime"); /** * External dependencies */ /** * WordPress dependencies */ function Warning({ className, actions, children, secondaryActions }) { return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { style: { display: 'contents', all: 'initial' }, children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { className: (0, _clsx.default)(className, 'block-editor-warning'), children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", { className: "block-editor-warning__contents", children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", { className: "block-editor-warning__message", children: children }), (actions?.length > 0 || secondaryActions) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", { className: "block-editor-warning__actions", children: [actions?.length > 0 && actions.map((action, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)("span", { className: "block-editor-warning__action", children: action }, i)), secondaryActions && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.DropdownMenu, { className: "block-editor-warning__secondary", icon: _icons.moreVertical, label: (0, _i18n.__)('More options'), popoverProps: { position: 'bottom left', className: 'block-editor-warning__dropdown' }, noIcons: true, children: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuGroup, { children: secondaryActions.map((item, pos) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, { onClick: item.onClick, children: item.title }, pos)) }) })] })] }) }) }); } /** * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/warning/README.md */ var _default = exports.default = Warning; //# sourceMappingURL=index.js.map