Major Changes
-
#3342
d6089c3Thanks
@github-actions! - - Breaking: The value is a number, withnullfor an
empty input.api.valueand every callback'svalueare numbers; read the text fromformattedValue.
valueAsNumberis removed.- const [value, setValue] = useState("") + const [value, setValue] = useState<number | null>(null) - api.valueAsNumber + api.value
-
Breaking: Submit the raw number through a hidden input instead of the formatted text. It validates
minand
maxand accepts browser autofill, reported with the"autofill"reason. Render it when you setname.<input {...api.getInputProps()} /> + <input {...api.getHiddenInputProps()} /> -
Breaking: Remove the default
minandmax, so Home and End no longer jump to ±Number.MAX_SAFE_INTEGER.numberInput.machine({ + min: Number.MIN_SAFE_INTEGER, + max: Number.MAX_SAFE_INTEGER, }) -
Breaking: Render the input as a text field instead of a spinbutton, so VoiceOver on iOS can reach the steppers.
This removes thearia-value*attributes andtranslations.valueText.translations: { - valueText: (value) => `${value} units`, }, -
Breaking: Replace
allowOverflowandclampValueOnBlurwithallowOutOfRange. An out-of-range typed value is
kept and reported as invalid instead of clamped. Stepping always stays in range.- allowOverflow: true, - clampValueOnBlur: false, + allowOutOfRange: true,
-
Add
translations.roleDescription, defaulting to "number field". -
Add
Shift+ wheel to step bylargeStepandAlt+ wheel to step bysmallStep. -
Start stepping an empty field from 0, and wait 400ms before repeating a held stepper.
-
Fix the input keeping the typed text when a controlled parent clamps or refuses the change.
-
Fix
onValueCommitfiring when nothing changed, and reporting the previous value when controlled. -
Fix the steppers ignoring screen readers, and a page scroll that starts on a stepper changing the value.
-
Fix the mouse wheel blocking horizontal page scrolling, and the wheel, scrubber and pinch-zoom changing the value
when they shouldn't. -
Fix
snapOnStepskipping a step and never reaching aminormaxoff the step grid. -
Fix scrubbing stopping after one step.
-
Fix the
localebeing ignored withoutformatOptions, which read "1,5" as 1 in German. -
Fix typing: a trailing decimal point being dropped in Vue, Svelte and Solid, the caret being lost when the value
syncs, Persian digits and CJK punctuation being rejected, a minus being accepted whenminis 0 or more, and iPhone
users being unable to type a negative number. -
Fix Enter committing an out-of-range value without clamping it.
-
Breaking: Rename the
increment-pressanddecrement-presschange reasons toincrement-triggerand
decrement-trigger, after the parts that cause them.// before if (reason === "increment-press") { } // after if (reason === "increment-trigger") { }
-
Patch Changes
- #3342
730ea29Thanks
@github-actions! - - Fix focus, scroll and sync work scheduled for the next
frame running after the component unmounts. - Updated dependencies [
a80b307]:- @zag-js/dom-query@2.0.0-next.4
- @zag-js/core@2.0.0-next.4
- @zag-js/anatomy@2.0.0-next.4
- @zag-js/types@2.0.0-next.4
- @zag-js/utils@2.0.0-next.4