Skip to content

Commit

Permalink
LetteringSpacingControl: Deprecate 36px default size (#67429)
Browse files Browse the repository at this point in the history
Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored and michalczaplinski committed Dec 5, 2024
1 parent 86be919 commit 9eaffe4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => (
<LetterSpacingControl
value={ value }
onChange={ onChange }
__unstableInputWidth="auto"
__next40pxDefaultSize
/>
);
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
__experimentalUnitControl as UnitControl,
__experimentalUseCustomUnits as useCustomUnits,
} from '@wordpress/components';
import deprecated from '@wordpress/deprecated';
import { __ } from '@wordpress/i18n';

/**
Expand Down Expand Up @@ -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 (
<UnitControl
__next40pxDefaultSize={ __next40pxDefaultSize }
__shouldNotWarnDeprecated36pxSize
{ ...otherProps }
label={ __( 'Letter spacing' ) }
value={ value }
Expand Down

0 comments on commit 9eaffe4

Please sign in to comment.