| 1 |
import { __ } from "@wordpress/i18n"; |
| 2 |
import { __experimentalLetterSpacingControl as WPLetterSpacingControl } from "@wordpress/block-editor"; |
| 3 |
|
| 4 |
import TypographyPanelItem, { |
| 5 |
TypographyControlProps, |
| 6 |
} from "./TypographyPanelItem"; |
| 7 |
|
| 8 |
export default function LetterSpacingControl({ |
| 9 |
label = __("Letter spacing", "tableberg"), |
| 10 |
value, |
| 11 |
onChange, |
| 12 |
onDeselect, |
| 13 |
resetAllFilter, |
| 14 |
isShownByDefault = false, |
| 15 |
isSingleColumn = true, |
| 16 |
panelId, |
| 17 |
}: TypographyControlProps) { |
| 18 |
return ( |
| 19 |
<TypographyPanelItem |
| 20 |
label={label} |
| 21 |
hasValue={() => !!value} |
| 22 |
onDeselect={onDeselect ?? (() => onChange(""))} |
| 23 |
resetAllFilter={resetAllFilter} |
| 24 |
isShownByDefault={isShownByDefault} |
| 25 |
isSingleColumn={isSingleColumn} |
| 26 |
panelId={panelId} |
| 27 |
> |
| 28 |
<WPLetterSpacingControl |
| 29 |
__next40pxDefaultSize |
| 30 |
__unstableInputWidth="auto" |
| 31 |
value={value || undefined} |
| 32 |
onChange={newValue => onChange(newValue || "")} |
| 33 |
/> |
| 34 |
</TypographyPanelItem> |
| 35 |
); |
| 36 |
} |
| 37 |
|