Fix Input validation, value handling and number steppers
Input: - honour `invalidMessage` instead of always reporting "Value mismatch" - don't let the mount value wipe an external `validity` prop, and don't force `isValid: true` on clear when `validity` is supplied - sync controlled and programmatic values into `textarea` (the value effect had an empty branch that skipped textareas entirely) - accept `defaultValue`/`value` of `0` and `""` (nil check, not truthiness) - clear debounce/validation/change-handler timers on unmount - type `wrapperProps` as `ComponentProps<"div">` - let `labelProps.htmlFor` override the name link deterministically - drop duplicated focus outline classes and the stale buttonDown guard that discarded edits made right after holding a stepper NumberInputButtons: - write through `setValue` so steppers work on controlled inputs and fire `onChange` - clamp to both `min` and `max`, including `0` values, and respect `step` - round float drift, ignore steps while a trailing decimal point is typed - instance-scoped press timers with unmount cleanup; a held press no longer double-steps on the trailing click Also adds a numberText stepper example to the dev playground.
This commit is contained in:
@@ -76,6 +76,10 @@ export default function FormsPage() {
|
||||
prefix="$"
|
||||
suffix="USD"
|
||||
inputMode="decimal"
|
||||
numberText
|
||||
min={50}
|
||||
defaultValue={50}
|
||||
step={5}
|
||||
/>
|
||||
<Input
|
||||
label="Error state"
|
||||
|
||||
Reference in New Issue
Block a user