UNPKG

@gechiui/block-editor

Version:
46 lines (43 loc) 1.33 kB
import { createElement } from "@gechiui/element"; /** * GeChiUI dependencies */ import { __experimentalUnitControl as UnitControl, __experimentalUseCustomUnits as useCustomUnits } from '@gechiui/components'; import { __ } from '@gechiui/i18n'; /** * Internal dependencies */ import useSetting from '../../components/use-setting'; /** * Control for letter-spacing. * * @param {Object} props Component props. * @param {string} props.value Currently selected letter-spacing. * @param {Function} props.onChange Handles change in letter-spacing selection. * @param {boolean} props.__unstableInputWidth Input width to pass through to inner UnitControl. * * @return {GCElement} Letter-spacing control. */ export default function LetterSpacingControl(_ref) { let { value, onChange, __unstableInputWidth = '60px' } = _ref; const units = useCustomUnits({ availableUnits: useSetting('spacing.units') || ['px', 'em', 'rem'], defaultValues: { px: '2', em: '.2', rem: '.2' } }); return createElement(UnitControl, { label: __('字母间距'), value: value, __unstableInputWidth: __unstableInputWidth, units: units, onChange: onChange }); } //# sourceMappingURL=index.js.map