Skip to content

Commit

Permalink
feat(ColorPicker): numeric field inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
zettca committed Dec 6, 2024
1 parent 941db54 commit 71408cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/ColorPicker/ColorPicker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ describe("ColorPicker", () => {
);

expect(screen.getByText("#de2beb")).toBeInTheDocument();
expect(screen.getByRole("textbox", { name: "R" })).toBeInTheDocument();
expect(screen.getByRole("textbox", { name: "G" })).toBeInTheDocument();
expect(screen.getByRole("textbox", { name: "B" })).toBeInTheDocument();
expect(screen.getByRole("spinbutton", { name: "R" })).toBeInTheDocument();
expect(screen.getByRole("spinbutton", { name: "G" })).toBeInTheDocument();
expect(screen.getByRole("spinbutton", { name: "B" })).toBeInTheDocument();
});

it("should render recommended colors", () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/ColorPicker/Fields/Fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export const Fields = (props: FieldsProps) => {
value={internalRed}
onChange={(event, value) => onChangeRbg(event, value, "r")}
onBlur={() => setInternalRed(rgb?.r)}
inputProps={{ type: "number", min: 0, max: 255 }}
disableClear
/>
<HvInput
Expand All @@ -156,6 +157,7 @@ export const Fields = (props: FieldsProps) => {
value={internalGreen}
onChange={(event, value) => onChangeRbg(event, value, "g")}
onBlur={() => setInternalGreen(rgb?.g)}
inputProps={{ type: "number", min: 0, max: 255 }}
disableClear
/>
<HvInput
Expand All @@ -165,6 +167,7 @@ export const Fields = (props: FieldsProps) => {
value={internalBlue}
onChange={(event, value) => onChangeRbg(event, value, "b")}
onBlur={() => setInternalBlue(rgb?.b)}
inputProps={{ type: "number", min: 0, max: 255 }}
disableClear
/>
</div>
Expand Down

0 comments on commit 71408cb

Please sign in to comment.