-
Notifications
You must be signed in to change notification settings - Fork 45
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
23 changed files
with
1,089 additions
and
384 deletions.
There are no files selected for viewing
388 changes: 286 additions & 102 deletions
388
components/color-picker/__tests__/__snapshots__/index.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: 透明度输入框可配置 | ||
order: 12 | ||
--- | ||
|
||
我们提供透明度输入的配置能力,可通过 showAlphaInput 控制透明度输入框的显隐 | ||
|
||
```jsx | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { ColorPicker } from '@kdcloudjs/kdesign' | ||
|
||
const Demo: React.FC = () => { | ||
const onChange = (inputValue: string) => { | ||
console.log('color', inputValue) | ||
} | ||
|
||
return ( | ||
<> | ||
<ColorPicker onChange={onChange} /> | ||
<br /> | ||
<ColorPicker onChange={onChange} showAlphaInput={false} /> | ||
</> | ||
) | ||
} | ||
|
||
ReactDOM.render(<Demo />, mountNode) | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: 输出颜色格式可配置 | ||
order: 13 | ||
--- | ||
|
||
可以通过 format 属性对输出的颜色格式进行限制 | ||
|
||
```jsx | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { ColorPicker } from '@kdcloudjs/kdesign' | ||
|
||
const Demo: React.FC = () => { | ||
const onChange = (inputValue: string) => { | ||
console.log('color', inputValue) | ||
} | ||
|
||
return ( | ||
<> | ||
<ColorPicker onChange={onChange} format="HEX" /> | ||
<br /> | ||
<ColorPicker onChange={onChange} format="RGB" /> | ||
</> | ||
) | ||
} | ||
|
||
ReactDOM.render(<Demo />, mountNode) | ||
``` |
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
34 changes: 34 additions & 0 deletions
34
components/color-picker/demo/color-picker-historical-color.md
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,34 @@ | ||
--- | ||
title: 面板最近使用颜色可配置 | ||
order: 15 | ||
--- | ||
|
||
可以通过 historicalColor 属性在颜色面板中进行最近使用颜色的配置,最近颜色支持透明度 | ||
|
||
```jsx | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { ColorPicker } from '@kdcloudjs/kdesign' | ||
|
||
const Demo: React.FC = () => { | ||
const onChange = (inputValue: string) => { | ||
console.log('color', inputValue) | ||
} | ||
|
||
const historicalColor = [ | ||
'blue', | ||
'#0000FF', | ||
'#0000FFEE', | ||
'RGB(0,0,255)', | ||
'RGBA(0,0,200,0.5)', | ||
'HSL(240,100%,50%)', | ||
'HSLA(240,100%,50%,0.5)', | ||
'HSB(240,100%,100%)', | ||
'HSBA(240,100%,100%,0.5)', | ||
] | ||
|
||
return <ColorPicker onChange={onChange} format="HEX" historicalColor={historicalColor} /> | ||
} | ||
|
||
ReactDOM.render(<Demo />, mountNode) | ||
``` |
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
Oops, something went wrong.