import { ColorPickerPanel as RcColorPickerPanel } from '@rc-component/color-picker'; import type { FC } from 'react'; import React from 'react'; import Divider from '../divider'; import type { Color } from './color'; import ColorClear from './components/ColorClear'; import ColorInput from './components/ColorInput'; import ColorPresets from './components/ColorPresets'; import type { ColorPickerBaseProps } from './interface'; interface ColorPickerPanelProps extends ColorPickerBaseProps { onChange?: (value?: Color) => void; onClear?: (clear?: boolean) => void; } const ColorPickerPanel: FC = (props) => { const { prefixCls, allowClear, presets, onChange, onClear, color, ...injectProps } = props; const colorPickerPanelPrefixCls = `${prefixCls}-inner-panel`; const extraPanelRender = (panel: React.ReactNode) => (
{allowClear && ( { onChange?.(clearColor); onClear?.(true); }} {...injectProps} /> )} {panel} {Array.isArray(presets) && ( <> )}
); return ( ); }; if (process.env.NODE_ENV !== 'production') { ColorPickerPanel.displayName = 'ColorPickerPanel'; } export default ColorPickerPanel;