Skip to content

Commit

Permalink
fix: number field showcase
Browse files Browse the repository at this point in the history
  • Loading branch information
yyyyaaa committed Jul 19, 2024
1 parent ad3bf86 commit 87b8bee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/react/scaffolds/number-field/number-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(

// Default mode, fallback to react-aria logic
if (clampValueOnBlur) {
console.log("old mode");
newValue = state.numberValue;
applyFormatting(newValue);
inputProps.onBlur?.(e);
Expand Down
10 changes: 5 additions & 5 deletions packages/react/showroom/NumberField.show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import * as React from "react";
import type { Story } from "@ladle/react";
import Box from "../src/ui/box";
import Button from "../src/ui/button";
import Text from "../src/ui/text";
import NumberField from "../src/ui/number-field";
import Avatar from "../src/ui/avatar";
import {
NumberFieldIntent,
NumberFieldSize,
Expand Down Expand Up @@ -43,24 +41,26 @@ export const DefaultNumberField: Story<{
borderless={props.borderless}
textAlign={props.textAlign}
clampValueOnBlur={props.clampValueOnBlur}
minValue={props.minValue}
maxValue={props.maxValue}
decrementButton={
<Button
size="xs"
variant="unstyled"
leftIcon="minusRound"
onClick={() => setValue(value - 1)}
onClick={() => setValue(Math.max(value - 1, props.minValue))}
/>
}
incrementButton={
<Button
size="xs"
variant="unstyled"
leftIcon="plusRound"
onClick={() => setValue(value + 1)}
onClick={() => setValue(Math.min(value + 1, props.maxValue))}
/>
}
onChange={(value) => {
console.log("[sb1] Change", value);
console.log("NumberField Change", value);
setValue(value);
}}
/>
Expand Down

0 comments on commit 87b8bee

Please sign in to comment.