From 666e86eea2135dbb97b270016ee5722701f23e7f Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Tue, 6 Feb 2024 06:37:06 +0900 Subject: [PATCH 1/3] AnglePickerControl: Hard deprecate bottom margin --- .../src/angle-picker-control/README.md | 8 ------ .../src/angle-picker-control/index.tsx | 27 +++---------------- .../stories/index.story.tsx | 3 --- .../styles/angle-picker-control-styles.tsx | 18 ------------- .../src/angle-picker-control/types.ts | 2 ++ 5 files changed, 6 insertions(+), 52 deletions(-) diff --git a/packages/components/src/angle-picker-control/README.md b/packages/components/src/angle-picker-control/README.md index 3cbc1f6c8d9e1a..deed41089fdc1d 100644 --- a/packages/components/src/angle-picker-control/README.md +++ b/packages/components/src/angle-picker-control/README.md @@ -15,7 +15,6 @@ function Example() { ); }; @@ -43,10 +42,3 @@ The current value of the input. The value represents an angle in degrees and sho A function that receives the new value of the input. - Required: Yes - -### `__nextHasNoMarginBottom`: `boolean` - -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.) - -- Required: No -- Default: `false` diff --git a/packages/components/src/angle-picker-control/index.tsx b/packages/components/src/angle-picker-control/index.tsx index 06178e0b401015..dcd0fe6f94a2e0 100644 --- a/packages/components/src/angle-picker-control/index.tsx +++ b/packages/components/src/angle-picker-control/index.tsx @@ -7,18 +7,17 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import deprecated from '@wordpress/deprecated'; import { forwardRef } from '@wordpress/element'; import { isRTL, __ } from '@wordpress/i18n'; /** * Internal dependencies */ -import { FlexBlock } from '../flex'; +import { Flex, FlexBlock } from '../flex'; import { Spacer } from '../spacer'; import NumberControl from '../number-control'; import AngleCircle from './angle-circle'; -import { Root, UnitText } from './styles/angle-picker-control-styles'; +import { UnitText } from './styles/angle-picker-control-styles'; import type { WordPressComponentProps } from '../context'; import type { AnglePickerControlProps } from './types'; @@ -28,7 +27,6 @@ function UnforwardedAnglePickerControl( ref: ForwardedRef< any > ) { const { - __nextHasNoMarginBottom = false, className, label = __( 'Angle' ), onChange, @@ -36,16 +34,6 @@ function UnforwardedAnglePickerControl( ...restProps } = props; - if ( ! __nextHasNoMarginBottom ) { - deprecated( - 'Bottom margin styles for wp.components.AnglePickerControl', - { - since: '6.1', - 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: string | undefined ) => { if ( onChange === undefined ) { return; @@ -66,13 +54,7 @@ function UnforwardedAnglePickerControl( : [ null, unitText ]; return ( - + - + ); } @@ -115,7 +97,6 @@ function UnforwardedAnglePickerControl( * * ); * } diff --git a/packages/components/src/angle-picker-control/stories/index.story.tsx b/packages/components/src/angle-picker-control/stories/index.story.tsx index d10403a436bfc2..ebbf3425d802f1 100644 --- a/packages/components/src/angle-picker-control/stories/index.story.tsx +++ b/packages/components/src/angle-picker-control/stories/index.story.tsx @@ -52,6 +52,3 @@ const AnglePickerWithState: StoryFn< typeof AnglePickerControl > = ( { }; export const Default = AnglePickerWithState.bind( {} ); -Default.args = { - __nextHasNoMarginBottom: true, -}; diff --git a/packages/components/src/angle-picker-control/styles/angle-picker-control-styles.tsx b/packages/components/src/angle-picker-control/styles/angle-picker-control-styles.tsx index 08a907b21e0c99..0141bd860d7df9 100644 --- a/packages/components/src/angle-picker-control/styles/angle-picker-control-styles.tsx +++ b/packages/components/src/angle-picker-control/styles/angle-picker-control-styles.tsx @@ -1,37 +1,19 @@ /** * External dependencies */ -import { css } from '@emotion/react'; import styled from '@emotion/styled'; /** * Internal dependencies */ -import { Flex } from '../../flex'; import { COLORS } from '../../utils'; import { space } from '../../utils/space'; import { Text } from '../../text'; import CONFIG from '../../utils/config-values'; -import type { AnglePickerControlProps } from '../types'; - const CIRCLE_SIZE = 32; const INNER_CIRCLE_SIZE = 6; -const deprecatedBottomMargin = ( { - __nextHasNoMarginBottom, -}: Pick< AnglePickerControlProps, '__nextHasNoMarginBottom' > ) => { - return ! __nextHasNoMarginBottom - ? css` - margin-bottom: ${ space( 2 ) }; - ` - : ''; -}; - -export const Root = styled( Flex )` - ${ deprecatedBottomMargin } -`; - export const CircleRoot = styled.div` border-radius: 50%; border: ${ CONFIG.borderWidth } solid ${ COLORS.ui.border }; diff --git a/packages/components/src/angle-picker-control/types.ts b/packages/components/src/angle-picker-control/types.ts index 1ddd26f679db6d..d453be1d6023bd 100644 --- a/packages/components/src/angle-picker-control/types.ts +++ b/packages/components/src/angle-picker-control/types.ts @@ -4,6 +4,8 @@ export type AnglePickerControlProps = { * in a future version. * * @default false + * @deprecated Default behavior since WP 6.5. Prop can be safely removed. + * @ignore */ __nextHasNoMarginBottom?: boolean; /** From 84efb9ce653aae04767ef86f203b3c04513629bf Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Tue, 6 Feb 2024 06:37:25 +0900 Subject: [PATCH 2/3] Remove usage in CustomGradientPicker --- packages/components/src/custom-gradient-picker/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/components/src/custom-gradient-picker/index.tsx b/packages/components/src/custom-gradient-picker/index.tsx index 19cfd8f740df7d..da777692e4db4e 100644 --- a/packages/components/src/custom-gradient-picker/index.tsx +++ b/packages/components/src/custom-gradient-picker/index.tsx @@ -60,7 +60,6 @@ const GradientAnglePicker = ( { }; return ( From f0a33d5494a6c11c1aa1bf0766f014f088dc7584 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Tue, 6 Feb 2024 08:34:47 +0900 Subject: [PATCH 3/3] Update changelog --- packages/components/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 03411bfca9a722..5000cbf9f0da3c 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,9 @@ ## Unreleased +### Breaking Changes + +- `AnglePickerControl`: Remove deprecated `__nextHasNoMarginBottom` prop and promote to default behavior ([#58700](https://github.com/WordPress/gutenberg/pull/58700)). ### Enhancements