Skip to content

Commit f4a2ad1

Browse files
authored
AnglePickerControl: Deprecate margin bottom (#43867)
* AnglePickerControl: Deprecate margin bottom * Add changelog * Fix typo
1 parent 97f102c commit f4a2ad1

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

packages/components/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Breaking Changes
6+
7+
- `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)).
8+
59
### Bug Fix
610

711
- `Button`, `Icon`: Fix `iconSize` prop doesn't work with some icons ([#43821](https://github.com/WordPress/gutenberg/pull/43821)).

packages/components/src/angle-picker-control/README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { AnglePickerControl } from '@wordpress/components';
1111

1212
const MyAnglePicker = () => {
1313
const [ angle, setAngle ] = useState();
14-
return <AnglePickerControl value={ angle } onChange={ setAngle } />;
14+
return <AnglePickerControl value={ angle } onChange={ setAngle } __nextHasNoMarginBottom />;
1515
};
1616
```
1717

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

4040
- Type: `function`
4141
- Required: Yes
42+
43+
### __nextHasNoMarginBottom
44+
45+
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.)
46+
47+
- Type: `boolean`
48+
- Required: No
49+
- Default: `false`

packages/components/src/angle-picker-control/index.js

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import classnames from 'classnames';
66
/**
77
* WordPress dependencies
88
*/
9+
import deprecated from '@wordpress/deprecated';
910
import { __ } from '@wordpress/i18n';
1011

1112
/**
@@ -27,6 +28,17 @@ export default function AnglePickerControl( {
2728
onChange,
2829
value,
2930
} ) {
31+
if ( ! __nextHasNoMarginBottom ) {
32+
deprecated(
33+
'Bottom margin styles for wp.components.AnglePickerControl',
34+
{
35+
since: '6.1',
36+
version: '6.4',
37+
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',
38+
}
39+
);
40+
}
41+
3042
const handleOnNumberChange = ( unprocessedValue ) => {
3143
const inputValue =
3244
unprocessedValue !== '' ? parseInt( unprocessedValue, 10 ) : 0;

packages/components/src/angle-picker-control/stories/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ import AnglePickerControl from '../';
1111
export default {
1212
title: 'Components/AnglePickerControl',
1313
component: AnglePickerControl,
14-
argTypes: {
15-
__nextHasNoMarginBottom: { control: { type: 'boolean' } },
16-
},
1714
};
1815

1916
const AnglePickerWithState = ( args ) => {
@@ -24,3 +21,6 @@ const AnglePickerWithState = ( args ) => {
2421
};
2522

2623
export const Default = AnglePickerWithState.bind( {} );
24+
Default.args = {
25+
__nextHasNoMarginBottom: true,
26+
};

0 commit comments

Comments
 (0)