@@ -7,6 +7,7 @@ export default function Story() {
77 const [ value1 , setValue1 ] = useState < number | "" > ( 0 ) ;
88 const [ value2 , setValue2 ] = useState < number | "" > ( 100 ) ;
99 const [ value3 , setValue3 ] = useState < number | "" > ( 0 ) ;
10+ const [ value4 , setValue4 ] = useState < number | "" > ( 250 ) ;
1011
1112 return (
1213 < div className = "grid h-full w-full place-items-center" >
@@ -35,6 +36,16 @@ export default function Story() {
3536 />
3637 </ div >
3738
39+ < div className = "flex flex-col gap-2" >
40+ < label className = "text-sm text-text-dimmed" > Size: large, Step: 50</ label >
41+ < InputStepper
42+ value = { value4 }
43+ onChange = { ( e ) => setValue4 ( e . target . value === "" ? "" : Number ( e . target . value ) ) }
44+ step = { 50 }
45+ controlSize = "large"
46+ />
47+ </ div >
48+
3849 < div className = "flex flex-col gap-2" >
3950 < label className = "text-sm text-text-dimmed" > Disabled state</ label >
4051 < InputStepper
@@ -54,6 +65,7 @@ type InputStepperProps = JSX.IntrinsicElements["input"] & {
5465 min ?: number ;
5566 max ?: number ;
5667 round ?: boolean ;
68+ controlSize ?: "base" | "large" ;
5769} ;
5870
5971function InputStepper ( {
@@ -63,6 +75,7 @@ function InputStepper({
6375 min,
6476 max,
6577 round = true ,
78+ controlSize = "base" ,
6679 name,
6780 id,
6881 disabled = false ,
@@ -150,10 +163,30 @@ function InputStepper({
150163 } as unknown as ChangeEvent < HTMLInputElement > ) ;
151164 }
152165
166+ const sizeStyles = {
167+ base : {
168+ container : "h-9" ,
169+ input : "text-sm px-3" ,
170+ button : "size-6" ,
171+ icon : "size-3.5" ,
172+ gap : "gap-1 pr-1.5" ,
173+ } ,
174+ large : {
175+ container : "h-11 rounded-md" ,
176+ input : "text-base px-3.5" ,
177+ button : "size-8" ,
178+ icon : "size-5" ,
179+ gap : "gap-1.5 pr-[0.3125rem]" ,
180+ } ,
181+ } as const ;
182+
183+ const size = sizeStyles [ controlSize ] ;
184+
153185 return (
154186 < div
155187 className = { cn (
156- "flex h-9 items-center rounded border border-charcoal-600 bg-tertiary transition hover:border-charcoal-550/80 hover:bg-charcoal-600/80" ,
188+ "flex items-center rounded border border-charcoal-600 bg-tertiary transition hover:border-charcoal-550/80 hover:bg-charcoal-600/80" ,
189+ size . container ,
157190 "has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-offset-0 has-[:focus-visible]:outline-text-link" ,
158191 disabled && "cursor-not-allowed opacity-50" ,
159192 className
@@ -196,27 +229,29 @@ function InputStepper({
196229 disabled = { disabled }
197230 readOnly = { readOnly }
198231 className = { cn (
199- "placeholder:text-muted-foreground h-full grow border-0 bg-transparent px-3 text-left text-sm text-text-bright outline-none ring-0 focus:border-0 focus:outline-none focus:ring-0 disabled:cursor-not-allowed" ,
232+ "placeholder:text-muted-foreground h-full grow border-0 bg-transparent text-left text-text-bright outline-none ring-0 focus:border-0 focus:outline-none focus:ring-0 disabled:cursor-not-allowed" ,
233+ size . input ,
200234 // Hide number input arrows
201235 "[type=number]:border-0 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
202236 ) }
203237 />
204238
205- < div className = "flex items-center gap-1 pr-1.5" >
239+ < div className = { cn ( "flex items-center" , size . gap ) } >
206240 < button
207241 type = "button"
208242 onClick = { handleStepDown }
209243 onPointerDown = { ( e ) => e . preventDefault ( ) }
210244 disabled = { disabled || isMinDisabled }
211245 aria-label = { `Decrease by ${ step } ` }
212246 className = { cn (
213- "flex size-6 items-center justify-center rounded border border-error/30 bg-error/20 transition" ,
247+ "flex items-center justify-center rounded border border-error/30 bg-error/20 transition" ,
248+ size . button ,
214249 "hover:border-error/50 hover:bg-error/30" ,
215250 "disabled:cursor-not-allowed disabled:opacity-40" ,
216251 "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-text-link"
217252 ) }
218253 >
219- < MinusIcon className = "h-3.5 w-3.5 text-error" />
254+ < MinusIcon className = { cn ( " text-error", size . icon ) } />
220255 </ button >
221256
222257 < button
@@ -226,13 +261,14 @@ function InputStepper({
226261 disabled = { disabled || isMaxDisabled }
227262 aria-label = { `Increase by ${ step } ` }
228263 className = { cn (
229- "flex size-6 items-center justify-center rounded border border-success/30 bg-success/10 transition" ,
264+ "flex items-center justify-center rounded border border-success/30 bg-success/10 transition" ,
265+ size . button ,
230266 "hover:border-success/40 hover:bg-success/20" ,
231267 "disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent" ,
232268 "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-text-link"
233269 ) }
234270 >
235- < PlusIcon className = "h-3.5 w-3.5 text-success" />
271+ < PlusIcon className = { cn ( " text-success", size . icon ) } />
236272 </ button >
237273 </ div >
238274 </ div >
0 commit comments