Skip to content

Commit f24299a

Browse files
fix(onInputS): call passed onInput method in addition to p.valueSignal.set
1 parent 3703e39 commit f24299a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/input/input/InputS.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type ComponentProps, splitProps } from "solid-js"
1+
import { type ComponentProps, type JSX, splitProps } from "solid-js"
22
import { Input } from "~ui/input/input/Input"
33
import type { SignalObject } from "~ui/utils/createSignalObject"
44

@@ -7,6 +7,12 @@ export interface InputSProps extends ComponentProps<"input"> {
77
}
88

99
export function InputS(p: InputSProps) {
10-
const [, rest] = splitProps(p, ["valueSignal"])
11-
return <Input value={p.valueSignal.get()} onInput={(e) => p.valueSignal.set(e.currentTarget.value)} {...rest} />
10+
const [, rest] = splitProps(p, ["valueSignal", "onInput"])
11+
const onInputLocal: JSX.InputEventHandlerUnion<HTMLInputElement, InputEvent> = (e) => {
12+
p.valueSignal.set(e.currentTarget.value)
13+
if (p.onInput && typeof p.onInput === "function") {
14+
p.onInput(e)
15+
}
16+
}
17+
return <Input value={p.valueSignal.get()} onInput={onInputLocal} {...rest} />
1218
}

0 commit comments

Comments
 (0)