@wordpress/global-styles-ui
Version:
Global Styles UI components for WordPress.
52 lines (51 loc) • 1.63 kB
JavaScript
// packages/global-styles-ui/src/presets/preset-edit-header.tsx
import {
__experimentalSpacer as Spacer,
Button,
FlexItem,
privateApis as componentsPrivateApis
} from "@wordpress/components";
import { moreVertical } from "@wordpress/icons";
import { Stack } from "@wordpress/ui";
import { ScreenHeader } from "../screen-header.mjs";
import { unlock } from "../lock-unlock.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
var { Menu } = unlock(componentsPrivateApis);
function PresetEditHeader({
title,
description,
menuLabel,
menuItems
}) {
return /* @__PURE__ */ jsxs(Stack, { justify: "space-between", align: "flex-start", children: [
/* @__PURE__ */ jsx(ScreenHeader, { title, description }),
menuItems.length > 0 && /* @__PURE__ */ jsx(FlexItem, { children: /* @__PURE__ */ jsx(Spacer, { marginTop: 2, marginBottom: 0, paddingX: 4, children: /* @__PURE__ */ jsxs(Menu, { children: [
/* @__PURE__ */ jsx(
Menu.TriggerButton,
{
render: /* @__PURE__ */ jsx(
Button,
{
size: "small",
icon: moreVertical,
label: menuLabel
}
)
}
),
/* @__PURE__ */ jsx(Menu.Popover, { children: menuItems.map((item) => /* @__PURE__ */ jsx(
Menu.Item,
{
disabled: item.disabled,
onClick: item.onClick,
children: /* @__PURE__ */ jsx(Menu.ItemLabel, { children: item.label })
},
item.label
)) })
] }) }) })
] });
}
export {
PresetEditHeader as default
};
//# sourceMappingURL=preset-edit-header.mjs.map