UNPKG

@wordpress/global-styles-ui

Version:
59 lines (58 loc) • 2.58 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_components = require("@wordpress/components"); let ___preview_colors_tsx = require("../preview-colors.cjs"); ___preview_colors_tsx = __toESM(___preview_colors_tsx); let ___hooks_ts = require("../hooks.cjs"); let ___subtitle_tsx = require("../subtitle.cjs"); let __variation_tsx = require("./variation.cjs"); __variation_tsx = __toESM(__variation_tsx); let react_jsx_runtime = require("react/jsx-runtime"); // packages/global-styles-ui/src/variations/variations-color.tsx const propertiesToFilter = ["color"]; function ColorVariations({ title, gap = 2 }) { const colorVariations = (0, ___hooks_ts.useCurrentMergeThemeStyleVariationsWithUserConfig)(propertiesToFilter); if (colorVariations?.length <= 1) return null; return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_wordpress_components.__experimentalVStack, { spacing: 3, children: [title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(___subtitle_tsx.Subtitle, { level: 3, children: title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_wordpress_components.__experimentalGrid, { gap, children: colorVariations.map((variation, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__variation_tsx.default, { variation, isPill: true, properties: propertiesToFilter, showTooltip: true, children: () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(___preview_colors_tsx.default, {}) }, index)) })] }); } exports.default = ColorVariations; //# sourceMappingURL=variations-color.cjs.map