UNPKG

@wordpress/block-editor

Version:
50 lines (49 loc) 1.9 kB
// packages/block-editor/src/components/warning/index.js import clsx from "clsx"; import { DropdownMenu, MenuGroup, MenuItem } from "@wordpress/components"; import { __ } from "@wordpress/i18n"; import { moreVertical } from "@wordpress/icons"; import { jsx, jsxs } from "react/jsx-runtime"; function Warning({ className, actions, children, secondaryActions }) { return /* @__PURE__ */ jsx("div", { style: { display: "contents", all: "initial" }, children: /* @__PURE__ */ jsx("div", { className: clsx(className, "block-editor-warning"), children: /* @__PURE__ */ jsxs("div", { className: "block-editor-warning__contents", children: [ /* @__PURE__ */ jsx("p", { className: "block-editor-warning__message", children }), (actions?.length > 0 || secondaryActions) && /* @__PURE__ */ jsxs("div", { className: "block-editor-warning__actions", children: [ actions?.length > 0 && actions.map((action, i) => /* @__PURE__ */ jsx( "span", { className: "block-editor-warning__action", children: action }, i )), secondaryActions && /* @__PURE__ */ jsx( DropdownMenu, { className: "block-editor-warning__secondary", icon: moreVertical, label: __("More options"), popoverProps: { placement: "bottom-end", className: "block-editor-warning__dropdown" }, noIcons: true, children: () => /* @__PURE__ */ jsx(MenuGroup, { children: secondaryActions.map( (item, pos) => /* @__PURE__ */ jsx( MenuItem, { onClick: item.onClick, children: item.title }, pos ) ) }) } ) ] }) ] }) }) }); } var warning_default = Warning; export { warning_default as default }; //# sourceMappingURL=index.js.map