Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnglePickerControl: Deprecate margin bottom #43867

Merged
merged 3 commits into from
Sep 5, 2022
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
4 changes: 4 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Breaking Changes

- `AnglePickerControl`: Deprecate bottom margin style. Add a `__nextHasNoMarginBottom` prop to start opting into the margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.4 ([#43867](https://github.com/WordPress/gutenberg/pull/43867)).

### Bug Fix

- `Popover`: enable auto-updating every animation frame ([#43617](https://github.com/WordPress/gutenberg/pull/43617)).
Expand Down
10 changes: 9 additions & 1 deletion packages/components/src/angle-picker-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AnglePickerControl } from '@wordpress/components';

const MyAnglePicker = () => {
const [ angle, setAngle ] = useState();
return <AnglePickerControl value={ angle } onChange={ setAngle } />;
return <AnglePickerControl value={ angle } onChange={ setAngle } __nextHasNoMarginBottom />;
};
```

Expand Down Expand Up @@ -39,3 +39,11 @@ A function that receives the new value of the input.

- Type: `function`
- Required: Yes

### __nextHasNoMarginBottom

Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 6.4. (The prop can be safely removed once this happens.)

- Type: `boolean`
- Required: No
- Default: `false`
12 changes: 12 additions & 0 deletions packages/components/src/angle-picker-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
import deprecated from '@wordpress/deprecated';
import { __ } from '@wordpress/i18n';

/**
Expand All @@ -27,6 +28,17 @@ export default function AnglePickerControl( {
onChange,
value,
} ) {
if ( ! __nextHasNoMarginBottom ) {
deprecated(
'Bottom margin styles for wp.components.AnglePickerControl',
{
since: '6.1',
version: '6.4',
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',
}
);
}

const handleOnNumberChange = ( unprocessedValue ) => {
const inputValue =
unprocessedValue !== '' ? parseInt( unprocessedValue, 10 ) : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import AnglePickerControl from '../';
export default {
title: 'Components/AnglePickerControl',
component: AnglePickerControl,
argTypes: {
__nextHasNoMarginBottom: { control: { type: 'boolean' } },
},
};

const AnglePickerWithState = ( args ) => {
Expand All @@ -24,3 +21,6 @@ const AnglePickerWithState = ( args ) => {
};

export const Default = AnglePickerWithState.bind( {} );
Default.args = {
__nextHasNoMarginBottom: true,
};