@@ -20,14 +20,15 @@ export interface NumberInputSProps extends ComponentProps<"input"> {
2020 inputClass ?: string
2121 variant ?: ButtonVariant
2222 buttonClass ?: string
23- onChanged ?: ( v : number ) => void
23+ onValueChange ?: ( v : number ) => void
2424 id ?: string
2525 texts ?: NumberInputText
2626}
2727
2828export function NumberInputS ( p : NumberInputSProps ) {
2929 const [ s , rest ] = splitProps ( p , [
3030 "valueSignal" ,
31+ "onValueChange" ,
3132 "min" ,
3233 "max" ,
3334 "incrDecrAmount" ,
@@ -37,7 +38,6 @@ export function NumberInputS(p: NumberInputSProps) {
3738 "inputClass" ,
3839 "variant" ,
3940 "buttonClass" ,
40- "onChanged" ,
4141 "id" ,
4242 "texts" ,
4343 ] )
@@ -48,35 +48,35 @@ export function NumberInputS(p: NumberInputSProps) {
4848 if ( s . min !== undefined ) newN = Math . max ( s . min , newN )
4949 if ( s . max !== undefined ) newN = Math . min ( s . max , newN )
5050 s . valueSignal . set ( newN )
51- if ( s . onChanged ) s . onChanged ( newN )
51+ if ( s . onValueChange ) s . onValueChange ( newN )
5252 }
5353 const decrementMajor : JSX . EventHandlerUnion < HTMLButtonElement , MouseEvent > | undefined = ( e ) => {
5454 const n = s . valueSignal . get ( )
5555 let newN = n - ( s . incrDecrAmountMajor ?? 10 ) * ( e . ctrlKey ? 100 : 1 )
5656 if ( s . min !== undefined ) newN = Math . max ( s . min , newN )
5757 s . valueSignal . set ( newN )
58- if ( s . onChanged ) s . onChanged ( newN )
58+ if ( s . onValueChange ) s . onValueChange ( newN )
5959 }
6060 const decrement : JSX . EventHandlerUnion < HTMLButtonElement , MouseEvent > | undefined = ( e ) => {
6161 const n = s . valueSignal . get ( )
6262 let newN = n - ( s . incrDecrAmount ?? 1 ) * ( e . ctrlKey ? 100 : 1 )
6363 if ( s . min !== undefined ) newN = Math . max ( s . min , newN )
6464 s . valueSignal . set ( newN )
65- if ( s . onChanged ) s . onChanged ( newN )
65+ if ( s . onValueChange ) s . onValueChange ( newN )
6666 }
6767 const increment : JSX . EventHandlerUnion < HTMLButtonElement , MouseEvent > | undefined = ( e ) => {
6868 const n = s . valueSignal . get ( )
6969 let newN = n + ( s . incrDecrAmount ?? 1 ) * ( e . ctrlKey ? 100 : 1 )
7070 if ( s . max !== undefined ) newN = Math . min ( s . max , newN )
7171 s . valueSignal . set ( newN )
72- if ( s . onChanged ) s . onChanged ( newN )
72+ if ( s . onValueChange ) s . onValueChange ( newN )
7373 }
7474 const incrementMajor : JSX . EventHandlerUnion < HTMLButtonElement , MouseEvent > | undefined = ( e ) => {
7575 const n = s . valueSignal . get ( )
7676 let newN = n + ( s . incrDecrAmountMajor ?? 10 ) * ( e . ctrlKey ? 100 : 1 )
7777 if ( s . max !== undefined ) newN = Math . min ( s . max , newN )
7878 s . valueSignal . set ( newN )
79- if ( s . onChanged ) s . onChanged ( newN )
79+ if ( s . onValueChange ) s . onValueChange ( newN )
8080 }
8181 const defaultVariant = buttonVariant . ghost
8282
0 commit comments