UNPKG

@wordpress/global-styles-ui

Version:
62 lines (61 loc) • 2.78 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); let _wordpress_i18n = require("@wordpress/i18n"); let _wordpress_components = require("@wordpress/components"); let __navigation_button_tsx = require("./navigation-button.cjs"); let __subtitle_tsx = require("./subtitle.cjs"); let __hooks_ts = require("./hooks.cjs"); let react_jsx_runtime = require("react/jsx-runtime"); // packages/global-styles-ui/src/typography-elements.tsx function ElementItem({ parentMenu, element, label }) { const prefix = element === "text" || !element ? "" : `elements.${element}.`; const extraStyles = element === "link" ? { textDecoration: "underline" } : {}; const [fontFamily] = (0, __hooks_ts.useStyle)(prefix + "typography.fontFamily"); const [fontStyle] = (0, __hooks_ts.useStyle)(prefix + "typography.fontStyle"); const [fontWeight] = (0, __hooks_ts.useStyle)(prefix + "typography.fontWeight"); const [backgroundColor] = (0, __hooks_ts.useStyle)(prefix + "color.background"); const [fallbackBackgroundColor] = (0, __hooks_ts.useStyle)("color.background"); const [gradientValue] = (0, __hooks_ts.useStyle)(prefix + "color.gradient"); const [color] = (0, __hooks_ts.useStyle)(prefix + "color.text"); return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__navigation_button_tsx.NavigationButtonAsItem, { path: parentMenu + "/typography/" + element, children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_components.__experimentalHStack, { justify: "flex-start", children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.FlexItem, { className: "global-styles-ui-screen-typography__indicator", "aria-hidden": "true", style: { fontFamily: fontFamily ?? "serif", background: gradientValue ?? backgroundColor ?? fallbackBackgroundColor, color, fontStyle, fontWeight, ...extraStyles }, children: (0, _wordpress_i18n.__)("Aa") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.FlexItem, { children: label })] }) }); } function TypographyElements() { return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_components.__experimentalVStack, { spacing: 3, children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__subtitle_tsx.Subtitle, { level: 3, children: (0, _wordpress_i18n.__)("Elements") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalItemGroup, { isBordered: true, isSeparated: true, children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ElementItem, { parentMenu: "", element: "text", label: (0, _wordpress_i18n.__)("Text") }) })] }); } exports.default = TypographyElements; //# sourceMappingURL=typography-elements.cjs.map