@wordpress/global-styles-ui
Version:
Global Styles UI components for WordPress.
59 lines (58 loc) • 2.85 kB
JavaScript
;
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
let _wordpress_components = require("@wordpress/components");
let _wordpress_icons = require("@wordpress/icons");
let _wordpress_i18n = require("@wordpress/i18n");
let _wordpress_block_editor = require("@wordpress/block-editor");
let __navigation_button_tsx = require("./navigation-button.cjs");
let __hooks_ts = require("./hooks.cjs");
let __lock_unlock_ts = require("./lock-unlock.cjs");
let react_jsx_runtime = require("react/jsx-runtime");
// packages/global-styles-ui/src/root-menu.tsx
const { useHasDimensionsPanel, useHasTypographyPanel, useHasColorPanel, useSettingsForBlockElement, useHasBackgroundPanel } = (0, __lock_unlock_ts.unlock)(_wordpress_block_editor.privateApis);
function RootMenu() {
const [rawSettings] = (0, __hooks_ts.useSetting)("");
const settings = useSettingsForBlockElement(rawSettings);
const hasBackgroundPanel = useHasBackgroundPanel(rawSettings);
const hasTypographyPanel = useHasTypographyPanel(settings);
const hasColorPanel = useHasColorPanel(settings);
const hasLayoutPanel = useHasDimensionsPanel(settings);
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_components.__experimentalItemGroup, { children: [
hasTypographyPanel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__navigation_button_tsx.NavigationButtonAsItem, {
icon: _wordpress_icons.typography,
path: "/typography",
children: (0, _wordpress_i18n.__)("Typography")
}),
hasColorPanel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__navigation_button_tsx.NavigationButtonAsItem, {
icon: _wordpress_icons.color,
path: "/colors",
children: (0, _wordpress_i18n.__)("Colors")
}),
hasBackgroundPanel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__navigation_button_tsx.NavigationButtonAsItem, {
icon: _wordpress_icons.background,
path: "/background",
"aria-label": (0, _wordpress_i18n.__)("Background styles"),
children: (0, _wordpress_i18n.__)("Background")
}),
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__navigation_button_tsx.NavigationButtonAsItem, {
icon: _wordpress_icons.shadow,
path: "/shadows",
children: (0, _wordpress_i18n.__)("Shadows")
}),
hasLayoutPanel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__navigation_button_tsx.NavigationButtonAsItem, {
icon: _wordpress_icons.layout,
path: "/layout",
children: (0, _wordpress_i18n.__)("Layout")
}),
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__navigation_button_tsx.NavigationButtonAsItem, {
icon: _wordpress_icons.blockDefault,
path: "/blocks",
children: (0, _wordpress_i18n.__)("Blocks & Elements")
})
] }) });
}
exports.default = RootMenu;
//# sourceMappingURL=root-menu.cjs.map