Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/block-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Breaking Changes

- The `__next40pxDefaultSize` prop is now true by default. The prop can be safely removed from the following:
- `LetterSpacingControl` ([#79533](https://github.com/WordPress/gutenberg/pull/79533)).

### Deprecations

- Soft-deprecate the `__experimentalImageEditor` component. The Media Editor modal is now the default crop experience for core blocks ([#78654](https://github.com/WordPress/gutenberg/pull/78654)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@ export default function TypographyPanel( {
<LetterSpacingControl
value={ letterSpacing }
onChange={ setLetterSpacing }
size="__unstable-large"
__unstableInputWidth="auto"
/>
</ToolsPanelItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const MyLetterSpacingControl = () => (
value={ value }
onChange={ onChange }
__unstableInputWidth="auto"
__next40pxDefaultSize
/>
);
```
Expand All @@ -46,13 +45,6 @@ A callback function invoked when the value is changed.

Input width to pass through to inner UnitControl. Should be a valid CSS value.

#### `__next40pxDefaultSize`

- **Type:** `boolean`
- **Default:** `false`

Start opting into the larger default height that will become the default size in a future version.

## Related components

Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
__experimentalUnitControl as UnitControl,
__experimentalUseCustomUnits as useCustomUnits,
} from '@wordpress/components';
import deprecated from '@wordpress/deprecated';
import { __ } from '@wordpress/i18n';

/**
Expand All @@ -16,16 +15,17 @@ import { useSettings } from '../../components/use-settings';
/**
* Control for letter-spacing.
*
* @param {Object} props Component props.
* @param {boolean} props.__next40pxDefaultSize Start opting into the larger default height that will become the default size in a future version.
* @param {string} props.value Currently selected letter-spacing.
* @param {Function} props.onChange Handles change in letter-spacing selection.
* @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value.
* @param {Object} props Component props.
* @param {boolean} [props.__next40pxDefaultSize] Start opting into the larger default height that will become the default size in a future version.
* @param {string} props.value Currently selected letter-spacing.
* @param {Function} props.onChange Handles change in letter-spacing selection.
* @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value.
*
* @return {Element} Letter-spacing control.
*/
export default function LetterSpacingControl( {
__next40pxDefaultSize = false,
/** @deprecated Default behavior since WordPress 7.1. Prop can be safely removed. */
__next40pxDefaultSize: _next40pxDefaultSize,
value,
onChange,
__unstableInputWidth = '60px',
Expand All @@ -37,23 +37,9 @@ export default function LetterSpacingControl( {
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 }
__next40pxDefaultSize
__shouldNotWarnDeprecated36pxSize
{ ...otherProps }
label={ __( 'Letter spacing' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,12 @@ const meta = {
defaultValue: { summary: '60px' },
},
},
__next40pxDefaultSize: {
control: 'boolean',
description:
'Start opting into the larger default height that will become the default size in a future version.',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'false' },
},
},
},
};

export default meta;

export const Default = {
args: {
__next40pxDefaultSize: true,
},
render: function Template( { onChange, ...args } ) {
const [ value, setValue ] = useState( '' );
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ The following components are checked by this rule:
- FormFileUpload (special case - see below)
- FormTokenField
- InputControl
- LetterSpacingControl
- LineHeightControl
- NumberControl
- RangeControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ ruleTester.run( 'components-no-missing-40px-size-prop', rule, {
FontFamilyControl,
FormTokenField,
InputControl,
LetterSpacingControl,
LineHeightControl,
NumberControl,
RangeControl,
Expand All @@ -133,7 +132,6 @@ ruleTester.run( 'components-no-missing-40px-size-prop', rule, {
<FontFamilyControl __next40pxDefaultSize />
<FormTokenField __next40pxDefaultSize />
<InputControl __next40pxDefaultSize />
<LetterSpacingControl __next40pxDefaultSize />
<LineHeightControl __next40pxDefaultSize />
<NumberControl __next40pxDefaultSize />
<RangeControl __next40pxDefaultSize />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const COMPONENTS_REQUIRING_40PX = new Set( [
'FormTokenField',
'IconButton',
'InputControl',
'LetterSpacingControl',
'LineHeightControl',
'NumberControl',
'Radio',
Expand Down
1 change: 1 addition & 0 deletions tools/eslint/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ const restrictedSyntax = [
'BoxControl',
'FocalPointPicker',
'FontSizePicker',
'LetterSpacingControl',
'QueryControls',
'TextControl',
].map( ( componentName ) => ( {
Expand Down
Loading