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

fix(ColorPicker): allow empty alpha field #2162

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/big-taxis-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@frontify/fondue-components": patch
---

fix(ColorPicker): allow empty alpha field
syeo66 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,16 @@ export const ColorValueInput = (
<TextInput.Root
data-test-id="color-picker-value-input-alpha"
className={styles.valueInput}
value={currentColor.alpha === undefined ? 100 : Math.trunc(currentColor.alpha * 100)}
value={currentColor.alpha === undefined ? '' : Math.trunc(currentColor.alpha * 100)}
type="number"
onBlur={() => currentColor.alpha === undefined && onColorChange({ ...currentColor, alpha: 1 })}
onChange={(event) => {
onColorChange({
...currentColor,
alpha: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,
alpha:
event.target.value === ''
? undefined
: getLimitedColorChannelValue(event.target.value, 0, 100) / 100,
});
}}
aria-label="Color Opacity"
Expand Down
Loading