import { CSSProperties, ReactNode } from 'react'; import { TriggerProps } from '../trigger'; import { InputProps } from '../input'; /** * @title ColorPicker */ export interface ColorPickerProps { style?: CSSProperties; className?: string | string[]; /** * 默认值 */ defaultValue?: string; /** * 颜色值,受控模式 */ value?: string; /** * 显示颜色值 */ showText?: boolean; /** * 颜色值的格式 */ format?: 'hex' | 'rgb'; /** * 禁用 */ disabled?: boolean; /** * 输入框的尺寸 * @defaultValue middle */ size?: InputProps['size']; /** * 默认弹出框是打开还是关闭 */ defaultPopupVisible?: boolean; /** * 弹出框是打开还是关闭。(受控) */ popupVisible?: boolean; /** * 隐藏后是否销毁 DOM 结构 * @defaultValue true */ unmountOnExit?: boolean; /** * 可以接受所有 Trigger 组件的 Props */ triggerProps?: Partial; /** * 禁用透明通道 * @defaultValue true */ disabledAlpha?: boolean; /** * 显示历史颜色 */ showHistory?: boolean; /** * 历史颜色的颜色数组 */ historyColors?: string[]; /** * 显示预设颜色 * @defaultValue true */ showPreset?: boolean; /** * 预设颜色的颜色数组 */ presetColors?: string[]; /** * 自定义触发元素。 */ triggerElement?: ReactNode | ((params: { value: string; }) => ReactNode); /** * 颜色值改变时触发 */ onChange?: (value: string) => void; /** * 下拉框收起展开时触发。 */ onVisibleChange?: (visible: boolean) => void; /** * 自定义面板底部内容 */ renderFooter?: () => ReactNode; } export interface RGB { r: number; g: number; b: number; } export interface HSV { h: number; s: number; v: number; } export interface Color { hsv: HSV; rgb: RGB; hex: string; }