Skip to content
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

ColorPicker: wrong value type definitions when using rgb or hsb format #2004

Closed
VsevolodGolovanov opened this issue May 3, 2021 · 0 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@VsevolodGolovanov
Copy link

VsevolodGolovanov commented May 3, 2021

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Codesandbox Case (Bug Reports)

Current behavior
When using format="rgb" or format="hsb" you get an object with r, g and b fields or an object with h, s and b fields. But the value is typed as string.

Expected behavior
value should be typed as a union of all possible types. A user would use type guards and assertion functions to deal with this. Ideally classes would be provided to be able to distinguish between rgb and hsb with an instanceof check.
Alternatively, leave the value as string, drop the format property, and provide utility functions for user to convert between color value types instead. This actually seems like a better solution, though it is a breaking API change of course.
Or just make it value: any, as it was before...

Minimal reproduction of the problem with instructions

Please tell us about your environment:

  • React version:
  • PrimeReact version:
    6.3.1

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
@mertsincan mertsincan self-assigned this May 5, 2021
@mertsincan mertsincan added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label May 5, 2021
@mertsincan mertsincan added this to the 6.3.2 milestone May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

No branches or pull requests

2 participants