chore(color-picker): improve TS type (#49949)

* chore(color-picker): improve TS type

* Update components/color-picker/index.en-US.md

Co-authored-by: thinkasany <480968828@qq.com>
Signed-off-by: 红 <wxh16144@qq.com>

---------

Signed-off-by: 红 <wxh16144@qq.com>
Co-authored-by: thinkasany <480968828@qq.com>
This commit is contained in:
2024-07-19 11:04:46 +08:00 committed by GitHub
parent 4a84f7e335
commit f0bc8b5021
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 9 deletions

View File

@ -53,7 +53,7 @@ Common props ref[Common props](/docs/react/common-props)
| format | Format of color | `rgb` \| `hex` \| `hsb` | `hex` | |
| open | Whether to show popup | boolean | - | |
| presets | Preset colors | `{ label: ReactNode, colors: Array<string \| Color>, defaultOpen?: boolean }[]` | - | `defaultOpen: 5.11.0` |
| placement | Placement of popup | `top` \| `topLeft` \| `topRight` \| `bottom` \| `bottomLeft` \| `bottomRight` | `bottomLeft` | |
| placement | Placement of popup | The design of the [placement](/components/tooltip/#api) parameter is the same as the `Tooltips` component. | `bottomLeft` | |
| panelRender | Custom Render Panel | `(panel: React.ReactNode, extra: { components: { Picker: FC; Presets: FC } }) => React.ReactNode` | - | 5.7.0 |
| showText | Show color text | boolean \| `(color: Color) => React.ReactNode` | - | 5.7.0 |
| size | Setting the trigger size | `large` \| `middle` \| `small` | `middle` | 5.7.0 |

View File

@ -54,7 +54,7 @@ group:
| format | 颜色格式 | `rgb` \| `hex` \| `hsb` | `hex` | |
| open | 是否显示弹出窗口 | boolean | - | |
| presets | 预设的颜色 | `{ label: ReactNode, colors: Array<string \| Color>, defaultOpen?: boolean }[]` | - | `defaultOpen: 5.11.0` |
| placement | 弹出窗口的位置 | `top` \| `topLeft` \| `topRight` \| `bottom` \| `bottomLeft` \| `bottomRight` | `bottomLeft` | |
| placement | 弹出窗口的位置 | `Tooltips` 组件的 [placement](/components/tooltip-cn/#api) 参数设计 | `bottomLeft` | |
| panelRender | 自定义渲染面板 | `(panel: React.ReactNode, extra: { components: { Picker: FC; Presets: FC } }) => React.ReactNode` | - | 5.7.0 |
| showText | 显示颜色文本 | boolean \| `(color: Color) => React.ReactNode` | - | 5.7.0 |
| size | 设置触发器大小 | `large` \| `middle` \| `small` | `middle` | 5.7.0 |

View File

@ -3,6 +3,7 @@ import type { ColorPickerProps as RcColorPickerProps } from '@rc-component/color
import type { SizeType } from '../config-provider/SizeContext';
import type { PopoverProps } from '../popover';
import type { TooltipPlacement } from '../tooltip';
import type { Color } from './color';
export enum ColorFormat {
@ -25,13 +26,8 @@ export interface PresetsItem {
}
export type TriggerType = 'click' | 'hover';
export type TriggerPlacement =
| 'top'
| 'topLeft'
| 'topRight'
| 'bottom'
| 'bottomLeft'
| 'bottomRight';
export type TriggerPlacement = TooltipPlacement; // Alias, to prevent breaking changes.
export interface ColorPickerBaseProps {
color?: Color;
prefixCls: string;