From 92c12fea56c02731c64d6d4a2ed63b9ec72e2100 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Tue, 3 Dec 2024 04:39:30 +0900 Subject: [PATCH] LetteringSpacingControl: Deprecate 36px default size (#67429) Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: tyxla --- .../components/letter-spacing-control/README.md | 3 ++- .../components/letter-spacing-control/index.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/letter-spacing-control/README.md b/packages/block-editor/src/components/letter-spacing-control/README.md index ef119bbc943d2f..535ca2ae8cbbff 100644 --- a/packages/block-editor/src/components/letter-spacing-control/README.md +++ b/packages/block-editor/src/components/letter-spacing-control/README.md @@ -12,13 +12,14 @@ This component is used for blocks that display text, commonly inside a Renders a letter spacing control. ```jsx -import { LetterSpacingControl } from '@wordpress/block-editor'; +import { __experimentalLetterSpacingControl as LetterSpacingControl } from '@wordpress/block-editor'; const MyLetterSpacingControl = () => ( ); ``` diff --git a/packages/block-editor/src/components/letter-spacing-control/index.js b/packages/block-editor/src/components/letter-spacing-control/index.js index 1577e184c4a06c..1edbe65a3737e6 100644 --- a/packages/block-editor/src/components/letter-spacing-control/index.js +++ b/packages/block-editor/src/components/letter-spacing-control/index.js @@ -5,6 +5,7 @@ import { __experimentalUnitControl as UnitControl, __experimentalUseCustomUnits as useCustomUnits, } from '@wordpress/components'; +import deprecated from '@wordpress/deprecated'; import { __ } from '@wordpress/i18n'; /** @@ -35,9 +36,25 @@ export default function LetterSpacingControl( { availableUnits: availableUnits || [ 'px', 'em', 'rem' ], defaultValues: { px: 2, em: 0.2, rem: 0.2 }, } ); + + if ( + ! __next40pxDefaultSize && + ( otherProps.size === undefined || 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 (