Skip to content

v0.9.0

Choose a tag to compare

@TrySound TrySound released this 03 Jun 23:10
· 24 commits to master since this release

This is a big release with new features

  1. 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}
   ...
 >
  1. The edge case with fixed point numbers is solved:

You have 0|.00, then press 1, it becomes 01|.00 and after format 1.00, this breaks our assumption that order of accepted symbols is not changed after format. The result is 1.0|0.

  1. replace function is changed to mask boolean. 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.

  1. 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 as format.
<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())
 ...
 >
  1. 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