-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
356 changed files
with
4,908 additions
and
2,426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: en-US | ||
order: 73 | ||
order: 74 | ||
category: Feedback | ||
title: Banner | ||
subTitle: Banner | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: zh-CN | ||
order: 73 | ||
order: 74 | ||
category: 反馈类 | ||
title: Banner 通知横幅 | ||
icon: doc-banner | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: en-US | ||
order: 74 | ||
order: 75 | ||
category: Feedback | ||
title: Notification | ||
subTitle: Notification | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: zh-CN | ||
order: 74 | ||
order: 75 | ||
category: 反馈类 | ||
title: Notification 通知 | ||
icon: doc-notification | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: en-US | ||
order: 75 | ||
order: 76 | ||
category: Feedback | ||
title: Popconfirm | ||
subTitle: Popconfirm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: zh-CN | ||
order: 75 | ||
order: 76 | ||
category: 反馈类 | ||
title: Popconfirm 气泡确认框 | ||
icon: doc-popconfirm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: en-US | ||
order: 76 | ||
order: 77 | ||
category: Feedback | ||
title: Progress | ||
subTitle: Progress | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: zh-CN | ||
order: 76 | ||
order: 77 | ||
category: 反馈类 | ||
title: Progress 进度条 | ||
icon: doc-progress | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: en-US | ||
order: 77 | ||
order: 78 | ||
category: Feedback | ||
title: Skeleton | ||
subTitle: Skeleton | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: zh-CN | ||
order: 77 | ||
order: 78 | ||
category: 反馈类 | ||
title: Skeleton 骨架屏 | ||
icon: doc-skeleton | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: en-US | ||
order: 78 | ||
order: 79 | ||
category: Feedback | ||
title: Spin | ||
subTitle: Spin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: zh-CN | ||
order: 78 | ||
order: 79 | ||
category: 反馈类 | ||
title: Spin 加载器 | ||
icon: doc-spin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: en-US | ||
order: 79 | ||
order: 80 | ||
category: Feedback | ||
title: Toast | ||
subTitle: Toast | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
localeCode: zh-CN | ||
order: 79 | ||
order: 80 | ||
category: 反馈类 | ||
title: Toast 提示 | ||
icon: doc-toast | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
--- | ||
localeCode: en-US | ||
order: 27 | ||
category: Input | ||
title: ColorPicker | ||
icon: doc-colorPlatteNew | ||
brief: Quickly and easily select colors, and provide a dropper tool to pick colors | ||
--- | ||
|
||
|
||
|
||
## Demos | ||
|
||
### How to import | ||
|
||
|
||
```jsx import | ||
import { ColorPicker } from '@douyinfe/semi-ui'; | ||
``` | ||
|
||
|
||
### Basic Use | ||
|
||
#### In portal | ||
|
||
```jsx live=true | ||
import { ColorPicker, Button } from '@douyinfe/semi-ui'; | ||
function Demo(){ | ||
return <div> | ||
<ColorPicker alpha={true} onChange={value=>{console.log(value)}} usePopover={true}/> | ||
|
||
<br/> | ||
<div>自定义 trigger</div> | ||
|
||
<ColorPicker alpha={true} onChange={value=>{console.log(value)}} usePopover={true}> | ||
<Button> Trigger </Button> | ||
</ColorPicker> | ||
|
||
</div> | ||
} | ||
|
||
``` | ||
|
||
#### Normal display | ||
```jsx live=true | ||
import { ColorPicker } from '@douyinfe/semi-ui'; | ||
function Demo(){ | ||
return <ColorPicker alpha={true} onChange={value=>{console.log(value)}}/> | ||
} | ||
|
||
``` | ||
|
||
### Eyedropper Color Picker | ||
|
||
Use `eyeDropper={true}` to enable the eyedropper function, which supports picking colors from the browser or external software screen. | ||
|
||
<Notice title='Notes'> | ||
To enable this function, the current web page must be deployed in a secure context such as HTTPS or localhost domain name, otherwise it will have no effect. The user's browser version must be Chromium > 95 | ||
</Notice> | ||
|
||
|
||
```jsx live=true | ||
import { ColorPicker } from '@douyinfe/semi-ui'; | ||
function Demo(){ | ||
return <ColorPicker alpha={true} eyeDropper={true} onChange={value=>{console.log(value)}}/> | ||
} | ||
|
||
``` | ||
|
||
### Default Value | ||
|
||
When converting between various color representation formats, there are theoretical errors between some formats, so the value returned to you by onChange is an object containing color values in three formats: hsva, hex, and rgba. | ||
|
||
The defaultValue (uncontrolled) and value (controlled) you pass in should also be objects containing the same three formats. | ||
|
||
We provide a static tool function `colorStringToValue` on the component class to convert common color strings to this object, supporting direct passing of strings such as rgb(57,197,187) #39c5bb and hsv(176,71,77). | ||
|
||
```jsx live=true | ||
import { ColorPicker } from '@douyinfe/semi-ui'; | ||
function Demo(){ | ||
return <div> | ||
<ColorPicker | ||
defaultValue={ColorPicker.colorStringToValue("rgb(57,197,187)")} | ||
onChange={(value)=>{ | ||
console.log(value) | ||
}} className={""} alpha={true}/> | ||
</div> | ||
|
||
} | ||
|
||
``` | ||
|
||
### Controlled | ||
|
||
Controlled use by passing in value | ||
|
||
```jsx live=true | ||
import { ColorPicker } from '@douyinfe/semi-ui'; | ||
function Demo(){ | ||
const [value,setValue] = useState(ColorPicker.colorStringToValue("#39c5bb")); | ||
console.log(value); | ||
return <div> | ||
<ColorPicker value={value} onChange={(value)=>{ | ||
setValue(value) | ||
}} className={""} alpha={true}/> | ||
</div> | ||
|
||
} | ||
|
||
``` | ||
|
||
|
||
### Rendering additional elements at the top and bottom | ||
|
||
Use `topSlot` and `bottomSlot` to render additional elements at the top and bottom | ||
|
||
```jsx live=true | ||
import { ColorPicker } from '@douyinfe/semi-ui'; | ||
function Demo(){ | ||
return <ColorPicker topSlot={<div> | ||
TopSlot | ||
</div>} bottomSlot={<div>Bottom Slot</div>} alpha={true} onChange={value=>{console.log(value)}}/> | ||
} | ||
|
||
``` | ||
|
||
### API Table | ||
|
||
| Parameter | Description | Type | Default value | | ||
|---------------|------------|---------------|------| | ||
| onChange | User selected color callback | (value)=>void | - | | ||
| alpha | Whether to enable transparency selection | boolean | true | | ||
| bottomSlot | Bottom rendering additional elements | ReactNode | - | | ||
| className | Class name | string | - | | ||
| defaultFormat | Default format for manual input | rgba hex hsva | hex | | ||
| defaultValue | Default value | Object | - | | ||
| eyeDropper | Whether to enable the eyedropper color picker | boolean | true | | ||
| height | Height | number | 280 | | ||
| style | Style | CSSProperties | - | | ||
| topSlot | Top rendering additional elements | ReactNode | - | | ||
| width | Width | number | 280 | | ||
| usePopover | Whether to put in Popover rendering | boolean | false | | ||
| popoverProps | When placing a Popover, the props passed to the Popover | Popover Props | - | |
Oops, something went wrong.