@wordpress/global-styles-ui
Version:
Global Styles UI components for WordPress.
73 lines (72 loc) • 2.1 kB
JavaScript
// packages/global-styles-ui/src/screen-colors.tsx
import { __ } from "@wordpress/i18n";
import { __experimentalVStack as VStack } from "@wordpress/components";
import { privateApis as blockEditorPrivateApis } from "@wordpress/block-editor";
import { ScreenHeader } from "./screen-header.mjs";
import { ScreenBody } from "./screen-body.mjs";
import Palette from "./palette.mjs";
import { useStyle, useSetting } from "./hooks.mjs";
import { unlock } from "./lock-unlock.mjs";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
var { useSettingsForBlockElement, ColorPanel: StylesColorPanel } = unlock(
blockEditorPrivateApis
);
var ADDITIONAL_ELEMENTS = [
{ name: "cite", label: __("Citations") },
{ name: "textInput", label: __("Inputs") },
{ name: "select", label: __("Selects") }
];
var DEFAULT_CONTROLS = {
link: true,
heading: true,
button: true,
caption: true,
cite: true,
textInput: true,
select: true
};
function ScreenColors() {
const [style, setStyle] = useStyle(
"",
void 0,
"user",
false
);
const [inheritedStyle] = useStyle(
"",
void 0,
"merged",
false
);
const [rawSettings] = useSetting("");
const settings = useSettingsForBlockElement(rawSettings);
return /* @__PURE__ */ jsxs(Fragment, { children: [
/* @__PURE__ */ jsx(
ScreenHeader,
{
title: __("Colors"),
description: __(
"Palette colors and the application of those colors on site elements."
)
}
),
/* @__PURE__ */ jsx(ScreenBody, { children: /* @__PURE__ */ jsx(VStack, { spacing: 7, children: /* @__PURE__ */ jsx(Palette, {}) }) }),
/* @__PURE__ */ jsx(
StylesColorPanel,
{
inheritedValue: inheritedStyle,
value: style,
onChange: setStyle,
settings,
additionalElements: ADDITIONAL_ELEMENTS,
defaultControls: DEFAULT_CONTROLS,
showInheritanceLabelIndicators: false
}
)
] });
}
var screen_colors_default = ScreenColors;
export {
screen_colors_default as default
};
//# sourceMappingURL=screen-colors.mjs.map