Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 87b8bee

Browse files
committedJul 19, 2024·
fix: number field showcase
1 parent ad3bf86 commit 87b8bee

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed
 

‎packages/react/scaffolds/number-field/number-field.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
135135

136136
// Default mode, fallback to react-aria logic
137137
if (clampValueOnBlur) {
138-
console.log("old mode");
139138
newValue = state.numberValue;
140139
applyFormatting(newValue);
141140
inputProps.onBlur?.(e);

‎packages/react/showroom/NumberField.show.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import * as React from "react";
22
import type { Story } from "@ladle/react";
33
import Box from "../src/ui/box";
44
import Button from "../src/ui/button";
5-
import Text from "../src/ui/text";
65
import NumberField from "../src/ui/number-field";
7-
import Avatar from "../src/ui/avatar";
86
import {
97
NumberFieldIntent,
108
NumberFieldSize,
@@ -43,24 +41,26 @@ export const DefaultNumberField: Story<{
4341
borderless={props.borderless}
4442
textAlign={props.textAlign}
4543
clampValueOnBlur={props.clampValueOnBlur}
44+
minValue={props.minValue}
45+
maxValue={props.maxValue}
4646
decrementButton={
4747
<Button
4848
size="xs"
4949
variant="unstyled"
5050
leftIcon="minusRound"
51-
onClick={() => setValue(value - 1)}
51+
onClick={() => setValue(Math.max(value - 1, props.minValue))}
5252
/>
5353
}
5454
incrementButton={
5555
<Button
5656
size="xs"
5757
variant="unstyled"
5858
leftIcon="plusRound"
59-
onClick={() => setValue(value + 1)}
59+
onClick={() => setValue(Math.min(value + 1, props.maxValue))}
6060
/>
6161
}
6262
onChange={(value) => {
63-
console.log("[sb1] Change", value);
63+
console.log("NumberField Change", value);
6464
setValue(value);
6565
}}
6666
/>

0 commit comments

Comments
 (0)