diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx index 453c7d430c6..e88b8f0240f 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx @@ -8,7 +8,7 @@ import { closePopover } from '../../utils/closePopover'; import { Popover } from '../Tooltip/Popover'; import { PopoverController } from '../Tooltip/PopoverController'; -import { ColorPickerPopover, ColorPickerProps, ColorPickerChangeHandler } from './ColorPickerPopover'; +import { ColorPickerPopover, ColorPickerProps } from './ColorPickerPopover'; import { ColorSwatch } from './ColorSwatch'; import { SeriesColorPickerPopover } from './SeriesColorPickerPopover'; @@ -34,19 +34,12 @@ export const colorPickerFactory = ( static displayName = displayName; pickerTriggerRef = createRef(); - onColorChange = (color: string) => { - const { onColorChange, onChange } = this.props; - const changeHandler = (onColorChange || onChange) as ColorPickerChangeHandler; - - return changeHandler(color); - }; - render() { - const { theme, children } = this.props; + const { theme, children, onChange } = this.props; const styles = getStyles(theme); const popoverElement = React.createElement(popover, { ...{ ...this.props, children: null }, - onChange: this.onColorChange, + onChange, }); return ( diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx index 3a77661ac44..992eda49792 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx @@ -10,7 +10,6 @@ import { PopoverContentProps } from '../Tooltip'; import { NamedColorsPalette } from './NamedColorsPalette'; import SpectrumPalette from './SpectrumPalette'; -import { warnAboutColorPickerPropsDeprecation } from './warnAboutColorPickerPropsDeprecation'; export type ColorPickerChangeHandler = (color: string) => void; @@ -18,10 +17,6 @@ export interface ColorPickerProps extends Themeable2 { color: string; onChange: ColorPickerChangeHandler; - /** - * @deprecated Use onChange instead - */ - onColorChange?: ColorPickerChangeHandler; enableNamedColors?: boolean; } @@ -48,7 +43,6 @@ class UnThemedColorPickerPopover extends Reac this.state = { activePicker: 'palette', }; - warnAboutColorPickerPropsDeprecation('ColorPickerPopover', props); } getTabClassName = (tabName: PickerType | keyof T) => { @@ -57,12 +51,11 @@ class UnThemedColorPickerPopover extends Reac }; handleChange = (color: any) => { - const { onColorChange, onChange, enableNamedColors, theme } = this.props; - const changeHandler = onColorChange || onChange; + const { onChange, enableNamedColors, theme } = this.props; if (enableNamedColors) { - return changeHandler(color); + return onChange(color); } - changeHandler(colorManipulator.asHexString(theme.visualization.getColorByName(color))); + onChange(colorManipulator.asHexString(theme.visualization.getColorByName(color))); }; onTabChange = (tab: PickerType | keyof T) => { diff --git a/packages/grafana-ui/src/components/ColorPicker/warnAboutColorPickerPropsDeprecation.ts b/packages/grafana-ui/src/components/ColorPicker/warnAboutColorPickerPropsDeprecation.ts deleted file mode 100644 index 9f58ba70285..00000000000 --- a/packages/grafana-ui/src/components/ColorPicker/warnAboutColorPickerPropsDeprecation.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { deprecationWarning } from '@grafana/data'; - -import { ColorPickerProps } from './ColorPickerPopover'; - -export const warnAboutColorPickerPropsDeprecation = (componentName: string, props: ColorPickerProps) => { - const { onColorChange } = props; - if (onColorChange) { - deprecationWarning(componentName, 'onColorChange', 'onChange'); - } -};