-
Notifications
You must be signed in to change notification settings - Fork 844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EuiColorPicker
opacity support
#2850
Merged
Merged
Changes from 4 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
78e8187
alpha range
thompsongl 00f84a6
alpha tests
thompsongl 59addfa
docs
thompsongl 6af0bed
wip: rgba support
thompsongl 3a95340
maintain alpha value
thompsongl 9900dd9
prevent track visibility; clean up
thompsongl 1465d18
Merge branch 'master' into colorpicker-opacity
thompsongl 52c6aee
display toggles
thompsongl 34a654a
docs validation
thompsongl 3320fac
use rgba for swatches
thompsongl 0338379
Merge branch 'master' into colorpicker-opacity
thompsongl db5b934
use rgba for css
thompsongl 4a87871
better hue and format throughput
thompsongl cd89265
Merge branch 'master' into colorpicker-opacity
thompsongl 2976b67
color stops validation
thompsongl ddc394a
more docs
thompsongl f0471f2
better format output
thompsongl 8f21a0c
Merge branch 'master' into colorpicker-opacity
thompsongl cfc4c5e
disallow opacity when showAlpha=false
thompsongl 7676221
Merge branch 'master' into colorpicker-opacity
thompsongl 73bb0db
clean up
thompsongl f7f9948
Merge branch 'master' into colorpicker-opacity
thompsongl 9e3471c
updated opacity and validity logic
thompsongl 41733d6
fix button example
thompsongl 9b0bea8
better format detection for null
thompsongl 1345587
alpha channel for color stops
thompsongl 522d598
allow empty range value
thompsongl 887cd3d
sanitize rgb strings
thompsongl 1de8de3
more resiliant sanitization
thompsongl 99285c4
feedback
thompsongl 48c42c3
clean up
thompsongl bac43b4
Merge branch 'master' into colorpicker-opacity
thompsongl 5fd717f
usesEffect; clean up
thompsongl 64dc808
utils tests
thompsongl b71ae10
comment
thompsongl 751685d
Merge branch 'master' into colorpicker-opacity
thompsongl 010f310
CL
thompsongl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
|
||
import { EuiColorPicker, EuiFormRow } from '../../../../src/components'; | ||
import { useColorPicker } from './utils'; | ||
|
||
export const Alpha = () => { | ||
const [color, setColor, errors] = useColorPicker('#D36086'); | ||
|
||
const handleChange = hex => { | ||
setColor(hex); | ||
}; | ||
|
||
return ( | ||
<EuiFormRow | ||
label="Pick a color with optional opacity" | ||
isInvalid={!!errors} | ||
error={errors}> | ||
<EuiColorPicker | ||
onChange={handleChange} | ||
color={color} | ||
showAlpha={true} | ||
isInvalid={!!errors} | ||
/> | ||
</EuiFormRow> | ||
); | ||
}; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like
useColorPicker
is probably a service we'll want to document and export if it's this helpful in a consuming application?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to open an issue for this. I hadn't thought about it, but it does seem really useful and could be something of a pattern for other relatively simple form-like components.