UNPKG

@wordpress/global-styles-ui

Version:
90 lines (89 loc) • 4.47 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); // \0rolldown/runtime.js var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { key = keys[i]; if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); let _wordpress_i18n = require("@wordpress/i18n"); let _wordpress_ui = require("@wordpress/ui"); let __screen_header_tsx = require("./screen-header.cjs"); let __screen_body_tsx = require("./screen-body.cjs"); let __presets_preset_group_tsx = require("./presets/preset-group.cjs"); __presets_preset_group_tsx = __toESM(__presets_preset_group_tsx); let __presets_use_presets_ts = require("./presets/use-presets.cjs"); let __hooks_ts = require("./hooks.cjs"); let __utils_ts = require("./utils.cjs"); let react_jsx_runtime = require("react/jsx-runtime"); // packages/global-styles-ui/src/screen-text-shadows.tsx const DEFAULT_TEXT_SHADOW = "0.05em 0.05em 0.1em rgba(0, 0, 0, 0.3)"; function ScreenTextShadows() { const [defaultEnabled] = (0, __hooks_ts.useSetting)("typography.defaultTextShadowPresets"); const def = (0, __presets_use_presets_ts.usePresets)("typography.textShadowPresets", "default"); const theme = (0, __presets_use_presets_ts.usePresets)("typography.textShadowPresets", "theme"); const custom = (0, __presets_use_presets_ts.usePresets)("typography.textShadowPresets", "custom"); const addCustomTextShadow = () => { const index = (0, __utils_ts.getNewIndexFromPresets)(custom.presets, "text-shadow-"); custom.setPresets([...custom.presets, { name: (0, _wordpress_i18n.sprintf)((0, _wordpress_i18n.__)("Text Shadow %d"), index), textShadow: DEFAULT_TEXT_SHADOW, slug: `text-shadow-${index}` }]); }; return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__screen_header_tsx.ScreenHeader, { title: (0, _wordpress_i18n.__)("Text shadows"), description: (0, _wordpress_i18n.__)("Manage and create text shadow styles for use across the site.") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__screen_body_tsx.ScreenBody, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_ui.Stack, { direction: "column", className: "global-styles-ui__text-shadows-panel", gap: "xl", children: [ defaultEnabled && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__presets_preset_group_tsx.default, { label: (0, _wordpress_i18n.__)("Default"), items: def.presets, getEditPath: (slug) => `/typography/text-shadows/edit/default/${slug}` }), theme.presets.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__presets_preset_group_tsx.default, { label: (0, _wordpress_i18n.__)("Theme"), items: theme.presets, getEditPath: (slug) => `/typography/text-shadows/edit/theme/${slug}` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__presets_preset_group_tsx.default, { label: (0, _wordpress_i18n.__)("Custom"), items: custom.presets, getEditPath: (slug) => `/typography/text-shadows/edit/custom/${slug}`, addLabel: (0, _wordpress_i18n.__)("Add text shadow"), onAdd: addCustomTextShadow, menuAction: { label: (0, _wordpress_i18n.__)("Remove all custom text shadows"), optionsLabel: (0, _wordpress_i18n.__)("Text shadow options"), confirmText: (0, _wordpress_i18n.__)("Are you sure you want to remove all custom text shadows?"), confirmButtonText: (0, _wordpress_i18n.__)("Remove"), onConfirm: () => custom.setPresets([]) } }) ] }) })] }); } exports.DEFAULT_TEXT_SHADOW = DEFAULT_TEXT_SHADOW; exports.default = ScreenTextShadows; //# sourceMappingURL=screen-text-shadows.cjs.map