This package has been deprecated

Author message:

Package no longer supported

maskose-react
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published
maskose
A composable way to make masks.


Table of contents

Requirements

This packages requires react@16.8 and react-dom@16.8. That's because it uses hooks under the hood, even though everything could be done with class-based components. If you need support for a version prior than the one with hooks, please open an issue.

Installation

yarn add maskose maskose-react

or with npm:

npm install maskose maskose-react

Components

MaskoseInput

Prop name Type Description
mask MaskoseMask The mask to be used when masking the value.
maskedValue string The current masked value (the value in the input).
onMaskedValueChange (maskedValue: string) => void Callback that will be called every time the masked value (input value) changes.

Examples

const priceMask = mkBoostMask(
  mkCreate([
    mkCharBoostRepeat(3)(mkCharNum()),
    mkCharToBePut('.'),
    mkCharBoostRepeat(2)(mkCharNum()),
  ])
)([
  mkMaskBoostRightToLeft()
]);

function Form() {
  const [price, setPrice] = useState('');

  return (
    <>
      <MaskoseInput
        mask={priceMask}
        maskedValue={price}
        onMaskedValueChange={setPrice}
      />
    </>
  );
}

Docs

If you're looking for the docs of the maskose lib, you can find them here.

Readme

Keywords

Package Sidebar

Install

npm i maskose-react

Weekly Downloads

7

Version

0.0.5

License

MIT

Unpacked Size

8.61 kB

Total Files

7

Last publish

Collaborators

  • efreitasn