Skip to content

Commit 47fff3c

Browse files
Merge pull request #6033 from pat270/LPD-53383
fix(@clayui/color-picker): LPD-53383 Hue slider thumb should update c…
2 parents 2bd7462 + d728383 commit 47fff3c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/clay-color-picker/src/Editor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export function Editor({
148148
onHueChange,
149149
}: Props) {
150150
const {b, g, r} = color.toRgb();
151-
const {s, v} = color.toHsv();
151+
const {h, s, v} = color.toHsv();
152152

153153
const rgbArr: Array<[number, string]> = [
154154
[r, 'r'],
@@ -170,7 +170,7 @@ export function Editor({
170170
tinycolor({h: hue, s, v}).setAlpha(color.getAlpha())
171171
);
172172
}}
173-
value={hue}
173+
value={Math.round(h)}
174174
/>
175175
<div className="clay-color-map-group">
176176
<GradientSelector

packages/clay-color-picker/src/__tests__/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,12 @@ describe('Interactions', () => {
416416
) as Array<HTMLElement>;
417417

418418
fireEvent.change(hueSlider as HTMLElement, {target: {value: 1}});
419-
fireEvent.change(hueSlider as HTMLElement, {target: {value: 0}});
420419

421-
expect(handleColorsChange).toBeCalledTimes(2);
420+
fireEvent.change(hueSlider as HTMLElement, {target: {value: 2}});
421+
422+
fireEvent.change(hueSlider as HTMLElement, {target: {value: 1}});
423+
424+
expect(handleColorsChange).toBeCalledTimes(3);
422425
});
423426
});
424427

0 commit comments

Comments
 (0)