From f9efc9f1c7bccd6388a9398ee6f8ea08b23cb3d2 Mon Sep 17 00:00:00 2001 From: Chris Van Patten Date: Wed, 17 Oct 2018 22:11:35 -0400 Subject: [PATCH] Deprecate PanelColor components (#10391) * Deprecate PanelColor components * Update deprecation version numbers * Fix a test broken during the rebase --- docs/reference/deprecated.md | 2 ++ packages/components/CHANGELOG.md | 6 ++++++ packages/components/src/panel/color.js | 7 +++++++ packages/components/src/panel/test/color.js | 4 ++++ packages/editor/CHANGELOG.md | 6 ++++++ packages/editor/src/components/panel-color/index.js | 7 +++++++ 6 files changed, 32 insertions(+) diff --git a/docs/reference/deprecated.md b/docs/reference/deprecated.md index d0653f14fed93f..d7203f2edba183 100644 --- a/docs/reference/deprecated.md +++ b/docs/reference/deprecated.md @@ -4,6 +4,8 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo - `isEditorSidebarPanelOpened` selector (`core/edit-post`) has been removed. Please use `isEditorPanelEnabled` instead. - `toggleGeneralSidebarEditorPanel` action (`core/edit-post`) has been removed. Please use `toggleEditorPanelOpened` instead. +- `wp.components.PanelColor` component has been removed. Please use `wp.editor.PanelColorSettings` instead. +- `wp.editor.PanelColor` component has been removed. Please use `wp.editor.PanelColorSettings` instead. ## 4.2.0 diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index d74dfc694f8eb8..2665f8e62ee0fc 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -1,3 +1,9 @@ +## 4.2.0 (Unreleased) + +### Deprecation + +- `wp.components.PanelColor` has been deprecated in favor of `wp.editor.PanelColorSettings`. + ## 4.1.0 (2018-10-10) ### New Feature diff --git a/packages/components/src/panel/color.js b/packages/components/src/panel/color.js index 249585ae3b0268..3c137e79eeeb62 100644 --- a/packages/components/src/panel/color.js +++ b/packages/components/src/panel/color.js @@ -1,6 +1,7 @@ /** * WordPress dependencies */ +import deprecated from '@wordpress/deprecated'; import { __, sprintf } from '@wordpress/i18n'; /** @@ -10,6 +11,12 @@ import PanelBody from './body'; import ColorIndicator from '../color-indicator'; function PanelColor( { colorValue, colorName, title, ...props } ) { + deprecated( 'wp.components.PanelColor', { + version: '4.3', + alternative: 'wp.editor.PanelColorSettings', + plugin: 'Gutenberg', + } ); + // translators: %s: The name of the color e.g: "vivid red" or color hex code if name is not available e.g: "#f00". const currentColorLabel = sprintf( __( '(current color: %s)' ), colorName || colorValue ); return ( diff --git a/packages/components/src/panel/test/color.js b/packages/components/src/panel/test/color.js index c3ca26962db60d..31c00562daaeef 100644 --- a/packages/components/src/panel/test/color.js +++ b/packages/components/src/panel/test/color.js @@ -13,5 +13,9 @@ describe( 'PanelColor', () => { const wrapper = shallow( ); expect( wrapper ).toMatchSnapshot(); + + expect( console ).toHaveWarnedWith( + 'wp.components.PanelColor is deprecated and will be removed from Gutenberg in 4.3. Please use wp.editor.PanelColorSettings instead.' + ); } ); } ); diff --git a/packages/editor/CHANGELOG.md b/packages/editor/CHANGELOG.md index 4b518f3801b40f..d82d8b209de0ad 100644 --- a/packages/editor/CHANGELOG.md +++ b/packages/editor/CHANGELOG.md @@ -1,3 +1,9 @@ +## 4.1.0 (Unreleased) + +### Deprecations + +- `wp.editor.PanelColor` has been deprecated in favor of `wp.editor.PanelColorSettings`. + ## 4.0.0 (2018-09-30) ### Breaking Changes diff --git a/packages/editor/src/components/panel-color/index.js b/packages/editor/src/components/panel-color/index.js index 5ad46d0d86c1f5..327384a127653b 100644 --- a/packages/editor/src/components/panel-color/index.js +++ b/packages/editor/src/components/panel-color/index.js @@ -8,6 +8,7 @@ import { omit } from 'lodash'; */ import { PanelColor as PanelColorComponent } from '@wordpress/components'; import { ifCondition, compose } from '@wordpress/compose'; +import deprecated from '@wordpress/deprecated'; /** * Internal dependencies @@ -17,6 +18,12 @@ import withColorContext from '../color-palette/with-color-context'; import { getColorObjectByColorValue } from '../colors'; function PanelColor( { colors, title, colorValue, initialOpen, ...props } ) { + deprecated( 'wp.editor.PanelColor', { + version: '4.3', + alternative: 'wp.editor.PanelColorSettings', + plugin: 'Gutenberg', + } ); + const colorObject = getColorObjectByColorValue( colors, colorValue ); const colorName = colorObject && colorObject.name; return (