@wordpress/block-editor
Version:
50 lines (49 loc) • 1.51 kB
JavaScript
// packages/block-editor/src/components/letter-spacing-control/index.js
import {
__experimentalUnitControl as UnitControl,
__experimentalUseCustomUnits as useCustomUnits
} from "@wordpress/components";
import deprecated from "@wordpress/deprecated";
import { __ } from "@wordpress/i18n";
import { useSettings } from "../../components/use-settings";
import { jsx } from "react/jsx-runtime";
function LetterSpacingControl({
__next40pxDefaultSize = false,
value,
onChange,
__unstableInputWidth = "60px",
...otherProps
}) {
const [availableUnits] = useSettings("spacing.units");
const units = useCustomUnits({
availableUnits: availableUnits || ["px", "em", "rem"],
defaultValues: { px: 2, em: 0.2, rem: 0.2 }
});
if (!__next40pxDefaultSize && (otherProps.size === void 0 || otherProps.size === "default")) {
deprecated(
`36px default size for wp.blockEditor.__experimentalLetterSpacingControl`,
{
since: "6.8",
version: "7.1",
hint: "Set the `__next40pxDefaultSize` prop to true to start opting into the new default size, which will become the default in a future version."
}
);
}
return /* @__PURE__ */ jsx(
UnitControl,
{
__next40pxDefaultSize,
__shouldNotWarnDeprecated36pxSize: true,
...otherProps,
label: __("Letter spacing"),
value,
__unstableInputWidth,
units,
onChange
}
);
}
export {
LetterSpacingControl as default
};
//# sourceMappingURL=index.js.map