v0.9.0
This is a big release with new features
- We discovered that passed values are formatted in all our cases so we decided to automatically format passed value.
<Rifm
format={format}
- value={format(current)}
+ value={current}
...
>- The edge case with fixed point numbers is solved:
You have
0|.00, then press 1, it becomes01|.00and after format 1.00, this breaks our assumption that order of accepted symbols is not changed after format. The result is1.0|0.
replacefunction is changed tomaskboolean. Now you may pass boolean value based on current state.
<Rifm
- replace={v => 10 <= v.length}
+ mask={10 <= current.length}
>Note: we still discovering how to make this api cleaner.
- We added the new api for formatting with preserving cursor. It's called
replace(don't confuse with previous api) and has the same type asformat.
<Rifm
format={v => v}
replace={v =>
'Rifm is the best mask and formatting library. I love it! '
.repeat(20)
.slice(0, v.length)
}
...
>This api is now responsible for case enforcement which is no longer supported by format
<Rifm
- format={v => v.toLowerCase()}
+ format={v => v}
+ replace(v => v.toLowerCase())
...
>- The new docs should shed light on ideas behind RIFM and better describe api
https://github.com/istarkov/rifm#api
Thank you for using RIFM