UNPKG

@wordpress/global-styles-ui

Version:
54 lines (53 loc) • 2.07 kB
import { __experimentalItemGroup } from "@wordpress/components"; import { background, blockDefault, color, layout, shadow, typography } from "@wordpress/icons"; import { __ } from "@wordpress/i18n"; import { privateApis } from "@wordpress/block-editor"; import { NavigationButtonAsItem } from "./navigation-button.mjs"; import { useSetting } from "./hooks.mjs"; import { unlock } from "./lock-unlock.mjs"; import { Fragment, jsx, jsxs } from "react/jsx-runtime"; // packages/global-styles-ui/src/root-menu.tsx const { useHasDimensionsPanel, useHasTypographyPanel, useHasColorPanel, useSettingsForBlockElement, useHasBackgroundPanel } = unlock(privateApis); function RootMenu() { const [rawSettings] = useSetting(""); const settings = useSettingsForBlockElement(rawSettings); const hasBackgroundPanel = useHasBackgroundPanel(rawSettings); const hasTypographyPanel = useHasTypographyPanel(settings); const hasColorPanel = useHasColorPanel(settings); const hasLayoutPanel = useHasDimensionsPanel(settings); return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(__experimentalItemGroup, { children: [ hasTypographyPanel && /* @__PURE__ */ jsx(NavigationButtonAsItem, { icon: typography, path: "/typography", children: __("Typography") }), hasColorPanel && /* @__PURE__ */ jsx(NavigationButtonAsItem, { icon: color, path: "/colors", children: __("Colors") }), hasBackgroundPanel && /* @__PURE__ */ jsx(NavigationButtonAsItem, { icon: background, path: "/background", "aria-label": __("Background styles"), children: __("Background") }), /* @__PURE__ */ jsx(NavigationButtonAsItem, { icon: shadow, path: "/shadows", children: __("Shadows") }), hasLayoutPanel && /* @__PURE__ */ jsx(NavigationButtonAsItem, { icon: layout, path: "/layout", children: __("Layout") }), /* @__PURE__ */ jsx(NavigationButtonAsItem, { icon: blockDefault, path: "/blocks", children: __("Blocks & Elements") }) ] }) }); } export { RootMenu as default }; //# sourceMappingURL=root-menu.mjs.map