-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix default color value in ColorPicker #6364
base: main
Are you sure you want to change the base?
Conversation
I did do this on purpose. In Spectrum, we have a specific state for no value that gets shown. RAC users could also implement something like that with the render props. Open to discussing the default but just thought I'd mention. |
@devongovett Maybe we can differentiate |
@@ -15,13 +15,13 @@ export interface ColorPickerState { | |||
|
|||
export function useColorPickerState(props: ColorPickerProps): ColorPickerState { | |||
let value = useColor(props.value); | |||
let defaultValue = useColor(props.defaultValue || '#0000')!; | |||
let defaultValue = useColor(props.defaultValue || '#000000')!; | |||
let [color, setColor] = useControlledState(value || undefined, defaultValue, props.onChange); | |||
|
|||
return { | |||
color, | |||
setColor(color) { |
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.
- add if check for null to early return in here
- update useColorSwatch so that color is required
- update docs (RSP/RAC/hooks)
Closes #6363
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: